// threejs.org/license (function(l,pa){"object"===typeof exports&&"undefined"!==typeof module?pa(exports):"function"===typeof define&&define.amd?define(["exports"],pa):pa(l.three=l.three||{})})(this,function(l){function pa(){}function d(a,b){this.x=a||0;this.y=b||0}function ea(a,b,c,d,e,f,g,h,m,k){object.defineproperty(this,"id",{value:ze++});this.uuid=n.generateuuid();this.name="";this.image=void 0!==a?a:ea.default_image;this.mipmaps=[];this.mapping=void 0!==b?b:ea.default_mapping;this.wraps=void 0!==c?c: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!==m?m:1;this.format=void 0!==g?g:1023;this.type=void 0!==h?h:1009;this.offset=new d(0,0);this.repeat=new d(1,1);this.generatemipmaps=!0;this.premultiplyalpha=!1;this.flipy=!0;this.unpackalignment=4;this.encoding=void 0!==k?k:3e3;this.version=0;this.onupdate=null}function fa(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}function ya(a,b,c){this.uuid=n.generateuuid();this.width= a;this.height=b;this.scissor=new fa(0,0,a,b);this.scissortest=!1;this.viewport=new fa(0,0,a,b);c=c||{};void 0===c.minfilter&&(c.minfilter=1006);this.texture=new ea(void 0,void 0,c.wraps,c.wrapt,c.magfilter,c.minfilter,c.format,c.type,c.anisotropy,c.encoding);this.depthbuffer=void 0!==c.depthbuffer?c.depthbuffer:!0;this.stencilbuffer=void 0!==c.stencilbuffer?c.stencilbuffer:!0;this.depthtexture=void 0!==c.depthtexture?c.depthtexture:null}function gb(a,b,c){ya.call(this,a,b,c);this.activemipmaplevel= this.activecubeface=0}function ca(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function q(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function s(){this.elements=new float32array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0= d||0 0 ) {\nfloat depth = gl_fragcoord.z / gl_fragcoord.w;\nfloat fogfactor = 0.0;\nif ( fogtype == 1 ) {\nfogfactor = smoothstep( fognear, fogfar, depth );\n} else {\nconst float log2 = 1.442695;\nfogfactor = exp2( - fogdensity * fogdensity * depth * depth * log2 );\nfogfactor = 1.0 - clamp( fogfactor, 0.0, 1.0 );\n}\ngl_fragcolor = mix( gl_fragcolor, vec4( fogcolor, gl_fragcolor.w ), fogfactor );\n}\n}"].join("\n")); v.compileshader(m);v.compileshader(o);v.attachshader(q,m);v.attachshader(q,o);v.linkprogram(q);f=q;w=v.getattriblocation(f,"position");y=v.getattriblocation(f,"uv");c=v.getuniformlocation(f,"uvoffset");d=v.getuniformlocation(f,"uvscale");e=v.getuniformlocation(f,"rotation");f=v.getuniformlocation(f,"scale");g=v.getuniformlocation(f,"color");h=v.getuniformlocation(f,"map");m=v.getuniformlocation(f,"opacity");k=v.getuniformlocation(f,"modelviewmatrix");t=v.getuniformlocation(f,"projectionmatrix");p= v.getuniformlocation(f,"fogtype");n=v.getuniformlocation(f,"fogdensity");u=v.getuniformlocation(f,"fognear");l=v.getuniformlocation(f,"fogfar");r=v.getuniformlocation(f,"fogcolor");a=v.getuniformlocation(f,"alphatest");q=document.createelementns("http://www.w3.org/1999/xhtml","canvas");q.width=8;q.height=8;m=q.getcontext("2d");m.fillstyle="white";m.fillrect(0,0,8,8);da=new ea(q);da.needsupdate=!0}v.useprogram(f);e.initattributes();e.enableattribute(w);e.enableattribute(y);e.disableunusedattributes(); e.disable(v.cull_face);e.enable(v.blend);v.bindbuffer(v.array_buffer,l);v.vertexattribpointer(w,2,v.float,!1,16,0);v.vertexattribpointer(y,2,v.float,!1,16,8);v.bindbuffer(v.element_array_buffer,c);v.uniformmatrix4fv(t,!1,d.projectionmatrix.elements);e.activetexture(v.texture0);v.uniform1i(h,0);m=q=0;(o=q.fog)?(v.uniform3f(r,o.color.r,o.color.g,o.color.b),o.isfog?(v.uniform1f(u,o.near),v.uniform1f(l,o.far),v.uniform1i(p,1),m=q=1):o.isfogexp2&&(v.uniform1f(n,o.density),v.uniform1i(p,2),m=q=2)):(v.uniform1i(p, 0),m=q=0);for(var o=0,p=b.length;o c&&(c=a[b]);return c}function t(){object.defineproperty(this,"id",{value:vd++});this.uuid=n.generateuuid();this.name="";this.type="geometry";this.vertices=[];this.colors=[];this.faces=[];this.facevertexuvs=[[]];this.morphtargets=[];this.morphnormals=[];this.skinweights=[];this.skinindices=[];this.linedistances=[];this.boundingsphere=this.boundingbox=null;this.groupsneedupdate=this.linedistancesneedupdate=this.colorsneedupdate=this.normalsneedupdate=this.uvsneedupdate=this.verticesneedupdate=this.elementsneedupdate= !1}function i(){object.defineproperty(this,"id",{value:vd++});this.uuid=n.generateuuid();this.name="";this.type="buffergeometry";this.index=null;this.attributes={};this.morphattributes={};this.groups=[];this.boundingsphere=this.boundingbox=null;this.drawrange={start:0,count:infinity}}function aa(a,b){x.call(this);this.type="mesh";this.geometry=void 0!==a?a:new i;this.material=void 0!==b?b:new ka({color:16777215*math.random()});this.drawmode=0;this.updatemorphtargets()}function ib(a,b,c,d,e,f){t.call(this); this.type="boxgeometry";this.parameters={width:a,height:b,depth:c,widthsegments:d,heightsegments:e,depthsegments:f};this.frombuffergeometry(new kb(a,b,c,d,e,f));this.mergevertices()}function kb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,l,c,f){var da=f/l,h=g/c,aa=f/2,x=g/2,d=l/2;g=l+1;var z=c+1,q=f=0,m,o,p=new q;for(o=0;o/g,function(a,c){var d=z[c];if(void 0===d)throw error("can not resolve #include <"+c+">");return xd(d)})}function qe(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\s]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseint(c);cb||a.height>b){var c=b/math.max(a.width,a.height),d=document.createelementns("http://www.w3.org/1999/xhtml","canvas");d.width=math.floor(a.width*c);d.height=math.floor(a.height*c);d.getcontext("2d").drawimage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("three.webglrenderer: image is too big ("+a.width+"x"+a.height+"). resized to "+ d.width+"x"+d.height,a);return d}return a}function m(a){return n.ispoweroftwo(a.width)&&n.ispoweroftwo(a.height)}function k(b){return 1003===b||1004===b||1005===b?a.nearest:a.linear}function t(b){b=b.target;b.removeeventlistener("dispose",t);a:{var c=d.get(b);if(b.image&&c.__image__webgltexturecube)a.deletetexture(c.__image__webgltexturecube);else{if(void 0===c.__webglinit)break a;a.deletetexture(c.__webgltexture)}d["delete"](b)}q.textures--}function p(b){b=b.target;b.removeeventlistener("dispose", p);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webgltexture&&a.deletetexture(e.__webgltexture);b.depthtexture&&b.depthtexture.dispose();if(b.iswebglrendertargetcube)for(e=0;6>e;e++)a.deleteframebuffer(c.__webglframebuffer[e]),c.__webgldepthbuffer&&a.deleterenderbuffer(c.__webgldepthbuffer[e]);else a.deleteframebuffer(c.__webglframebuffer),c.__webgldepthbuffer&&a.deleterenderbuffer(c.__webgldepthbuffer);d["delete"](b.texture);d["delete"](b)}q.textures--}function n(b,g){var k=d.get(b);if(0< b.version&&k.__version!==b.version){var n=b.image;if(void 0===n)console.warn("three.webglrenderer: texture marked for update but image is undefined",b);else if(!1===n.complete)console.warn("three.webglrenderer: texture marked for update but image is incomplete",b);else{void 0===k.__webglinit&&(k.__webglinit=!0,b.addeventlistener("dispose",t),k.__webgltexture=a.createtexture(),q.textures++);c.activetexture(a.texture0+g);c.bindtexture(a.texture_2d,k.__webgltexture);a.pixelstorei(a.unpack_flip_y_webgl, b.flipy);a.pixelstorei(a.unpack_premultiply_alpha_webgl,b.premultiplyalpha);a.pixelstorei(a.unpack_alignment,b.unpackalignment);var p=h(b.image,e.maxtexturesize);if((1001!==b.wraps||1001!==b.wrapt||1003!==b.minfilter&&1006!==b.minfilter)&&!1===m(p))if(n=p,n instanceof htmlimageelement||n instanceof htmlcanvaselement){var l=document.createelementns("http://www.w3.org/1999/xhtml","canvas");l.width=n.nearestpoweroftwo(n.width);l.height=n.nearestpoweroftwo(n.height);l.getcontext("2d").drawimage(n,0,0, l.width,l.height);console.warn("three.webglrenderer: image is not power of two ("+n.width+"x"+n.height+"). resized to "+l.width+"x"+l.height,n);p=l}else p=n;var n=m(p),l=f(b.format),g=f(b.type);u(a.texture_2d,b,n);var r=b.mipmaps;if(b.isdepthtexture){r=a.depth_component;if(1015===b.type){if(!w)throw error("float depth texture only supported in webgl2.0");r=a.depth_component32f}else w&&(r=a.depth_component16);1026===b.format&&r===a.depth_component&&1012!==b.type&&1014!==b.type&&(console.warn("three.webglrenderer: use unsignedshorttype or unsignedinttype for depthformat depthtexture."), b.type=1012,g=f(b.type));1027===b.format&&(r=a.depth_stencil,1020!==b.type&&(console.warn("three.webglrenderer: use unsignedint248type for depthstencilformat depthtexture."),b.type=1020,g=f(b.type)));c.teximage2d(a.texture_2d,0,r,p.width,p.height,0,l,g,null)}else if(b.isdatatexture)if(0r;r++)l[r]=n||p?p?b.image[r].image:b.image[r]:h(b.image[r],e.maxcubemapsize);var g=m(l[0]),w=f(b.format),aa=f(b.type);u(a.texture_cube_map,b,g);for(r=0;6>r;r++)if(n)for(var x,d=l[r].mipmaps,z=0,q=d.length;zk;k++)e.__webglframebuffer[k]=a.createframebuffer()}else e.__webglframebuffer= a.createframebuffer();if(g){c.bindtexture(a.texture_cube_map,f.__webgltexture);u(a.texture_cube_map,b.texture,h);for(k=0;6>k;k++)l(e.__webglframebuffer[k],b,a.color_attachment0,a.texture_cube_map_positive_x+k);b.texture.generatemipmaps&&h&&a.generatemipmap(a.texture_cube_map);c.bindtexture(a.texture_cube_map,null)}else c.bindtexture(a.texture_2d,f.__webgltexture),u(a.texture_2d,b.texture,h),l(e.__webglframebuffer,b,a.color_attachment0,a.texture_2d),b.texture.generatemipmaps&&h&&a.generatemipmap(a.texture_2d), c.bindtexture(a.texture_2d,null);if(b.depthbuffer){e=d.get(b);f=!0===b.iswebglrendertargetcube;if(b.depthtexture){if(f)throw error("target.depthtexture not supported in cube render targets");if(b&&b.iswebglrendertargetcube)throw error("depth texture with cube render targets is not supported!");a.bindframebuffer(a.framebuffer,e.__webglframebuffer);if(!b.depthtexture||!b.depthtexture.isdepthtexture)throw error("rendertarget.depthtexture must be an instance of three.depthtexture");d.get(b.depthtexture).__webgltexture&& b.depthtexture.image.width===b.width&&b.depthtexture.image.height===b.height||(b.depthtexture.image.width=b.width,b.depthtexture.image.height=b.height,b.depthtexture.needsupdate=!0);n(b.depthtexture,0);e=d.get(b.depthtexture).__webgltexture;if(1026===b.depthtexture.format)a.framebuffertexture2d(a.framebuffer,a.depth_attachment,a.texture_2d,e,0);else if(1027===b.depthtexture.format)a.framebuffertexture2d(a.framebuffer,a.depth_stencil_attachment,a.texture_2d,e,0);else throw error("unknown depthtexture format"); }else if(f)for(e.__webgldepthbuffer=[],f=0;6>f;f++)a.bindframebuffer(a.framebuffer,e.__webglframebuffer[f]),e.__webgldepthbuffer[f]=a.createrenderbuffer(),r(e.__webgldepthbuffer[f],b);else a.bindframebuffer(a.framebuffer,e.__webglframebuffer),e.__webgldepthbuffer=a.createrenderbuffer(),r(e.__webgldepthbuffer,b);a.bindframebuffer(a.framebuffer,null)}};this.updaterendertargetmipmap=function(b){var e=b.texture;e.generatemipmaps&&m(b)&&1003!==e.minfilter&&1006!==e.minfilter&&(b=b&&b.iswebglrendertargetcube? a.texture_cube_map:a.texture_2d,e=d.get(e).__webgltexture,c.bindtexture(b,e),a.generatemipmap(b),c.bindtexture(b,null))}}function qf(){var a={};return{get:function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c},"delete":function(b){delete a[b.uuid]},clear:function(){a={}}}}function rf(a,b,c){function d(b,c,d){var e=new uint8array(4),f=a.createtexture();a.bindtexture(b,f);a.texparameteri(b,a.texture_min_filter,a.nearest);a.texparameteri(b,a.texture_mag_filter,a.nearest);for(b=0;b=la.maxtextures&&console.warn("webglrenderer: trying to use "+a+" texture units while this gpu supports only "+ la.maxtextures);ea+=1;return a};this.settexture2d=function(){var a=!1;return function(b,c){b&&b.iswebglrendertarget&&(a||(console.warn("three.webglrenderer.settexture2d: don't use render targets as textures. use their .texture property instead."),a=!0),b=b.texture);ta.settexture2d(b,c)}}();this.settexture=function(){var a=!1;return function(b,c){a||(console.warn("three.webglrenderer: .settexture is deprecated, use settexture2d instead."),a=!0);ta.settexture2d(b,c)}}();this.settexturecube=function(){var a= !1;return function(b,c){b&&b.iswebglrendertargetcube&&(a||(console.warn("three.webglrenderer.settexturecube: don't use cube render targets as textures. use their .texture property instead."),a=!0),b=b.texture);b&&b.iscubetexture||array.isarray(b.image)&&6===b.image.length?ta.settexturecube(b,c):ta.settexturecubedynamic(b,c)}}();this.getcurrentrendertarget=function(){return w};this.setrendertarget=function(a){(w=a)&&void 0===ha.get(a).__webglframebuffer&&ta.setuprendertarget(a);var b=a&&a.iswebglrendertargetcube, c;a?(c=ha.get(a),c=b?c.__webglframebuffer[a.activecubeface]:c.__webglframebuffer,x.copy(a.scissor),sa=a.scissortest,z.copy(a.viewport)):(c=null,x.copy(ga).multiplyscalar(ra),sa=ka,z.copy(ia).multiplyscalar(ra));n!==c&&(b.bindframebuffer(b.framebuffer,c),n=c);y.scissor(x);y.setscissortest(sa);y.viewport(z);b&&(b=ha.get(a.texture),b.framebuffertexture2d(b.framebuffer,b.color_attachment0,b.texture_cube_map_positive_x+a.activecubeface,b.__webgltexture,a.activemipmaplevel))};this.readrendertargetpixels= function(a,b,c,d,e,f){if(!1===(a&&a.iswebglrendertarget))console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not three.webglrendertarget.");else{var g=ha.get(a).__webglframebuffer;if(g){var h=!1;g!==n&&(b.bindframebuffer(b.framebuffer,g),h=!0);try{var k=a.texture,m=k.format,n=k.type;1023!==m&&w(m)!==b.getparameter(b.implementation_color_read_format)?console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not in rgba or implementation defined format."):1009=== n||w(n)===b.getparameter(b.implementation_color_read_type)||1015===n&&(ja.get("oes_texture_float")||ja.get("webgl_color_buffer_float"))||1016===n&&ja.get("ext_color_buffer_half_float")?b.checkframebufferstatus(b.framebuffer)===b.framebuffer_complete?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&b.readpixels(b,c,d,e,w(m),w(n),f):console.error("three.webglrenderer.readrendertargetpixels: readpixels from rendertarget failed. framebuffer not complete."):console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not in unsignedbytetype or implementation defined type.")}finally{h&& b.bindframebuffer(b.framebuffer,n)}}}}}function kb(a,b){this.name="";this.color=new j(a);this.density=void 0!==b?b:2.5e-4}function lb(a,b,c){this.name="";this.color=new j(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1e3}function mb(){x.call(this);this.type="scene";this.overridematerial=this.fog=this.background=null;this.autoupdate=!0}function zd(a,b,c,d,e){x.call(this);this.lensflares=[];this.positionscreen=new q;this.customupdatecallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}function nb(a){x.call(this); this.type="spritematerial";this.color=new j(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setvalues(a)}function dc(a){x.call(this);this.type="sprite";this.material=void 0!==a?a:new nb}function ec(){x.call(this);this.type="lod";object.defineproperties(this,{levels:{enumerable:!0,value:[]}})}function od(a,b,c){this.usevertextexture=void 0!==c?c:!0;this.identitymatrix=new s;a=a||[];this.bones=a.slice(0);this.usevertextexture?(a=math.sqrt(4*this.bones.length),a=n.nextpoweroftwo(math.ceil(a)), this.bonetextureheight=this.bonetexturewidth=a=math.max(a,4),this.bonematrices=new float32array(this.bonetexturewidth*this.bonetextureheight*4),this.bonetexture=new eb(this.bonematrices,this.bonetexturewidth,this.bonetextureheight,1023,1015)):this.bonematrices=new float32array(16*this.bones.length);if(void 0===b)this.calculateinverses();else if(this.bones.length===b.length)this.boneinverses=b.slice(0);else for(console.warn("three.skeleton boninverses is the wrong length."),this.boneinverses=[],b= 0,a=this.bones.length;b=a.have_current_data&&(t.needsupdate=!0)}ea.call(this,a,b,c,d,e,f,g,h,m);this.generatemipmaps=!1;var t=this;k()}function nb(a,b,c,d,e,f,g,h,m,k,t,p){ea.call(this,null,f,g,h,m,k,d,e,t,p);this.image={width:b,height:c};this.mipmaps=a;this.generatemipmaps=this.flipy=!1}function sd(a,b,c,d,e,f,g,h,m){ea.call(this,a,b,c,d,e,f,g,h,m);this.needsupdate=!0}function gc(a,b,c,d,e,f,g, h,m,k){k=void 0!==k?k:1026;if(1026!==k&&1027!==k)throw error("depthtexture format must be either three.depthformat or three.depthstencilformat");void 0===c&&1026===k&&(c=1012);void 0===c&&1027===k&&(c=1020);ea.call(this,null,d,e,f,g,h,k,c,m);this.image={width:a,height:b};this.magfilter=void 0!==g?g:1003;this.minfilter=void 0!==h?h:1003;this.generatemipmaps=this.flipy=!1}function ob(a){function b(a,b){return a-b}i.call(this);this.type="wireframegeometry";var c=[],d,e,f,g,h=[0,0],m={},k,t=["a","b", "c"];if(a&&a.isgeometry){var p=a.faces;d=0;for(f=p.length;de;e++)h[0]=n[t[e]],h[1]=n[t[(e+1)%3]],h.sort(b),k=h.tostring(),void 0===m[k]&&(m[k]={index1:h[0],index2:h[1]})}for(k in m)d=m[k],t=a.vertices[d.index1],c.push(t.x,t.y,t.z),t=a.vertices[d.index2],c.push(t.x,t.y,t.z)}else if(a&&a.isbuffergeometry){var l,t=new q;if(null!==a.index){p=a.attributes.position;n=a.index;l=a.groups;0===l.length&&a.addgroup(0,n.count);a=0;for(g=l.length;ae;e++)h[0]=n.getx(d+e),h[1]=n.getx(d+(e+1)%3),h.sort(b),k=h.tostring(),void 0===m[k]&&(m[k]={index1:h[0],index2:h[1]});for(k in m)d=m[k],t.frombufferattribute(p,d.index1),c.push(t.x,t.y,t.z),t.frombufferattribute(p,d.index2),c.push(t.x,t.y,t.z)}else for(p=a.attributes.position,d=0,f=p.count/3;de;e++)m=3*d+e,t.frombufferattribute(p,m),c.push(t.x,t.y,t.z),m=3*d+(e+1)%3,t.frombufferattribute(p,m),c.push(t.x,t.y,t.z)}this.addattribute("position",new z(c,3))} function hc(a,b,c){t.call(this);this.type="parametricgeometry";this.parameters={func:a,slices:b,stacks:c};this.frombuffergeometry(new pb(a,b,c));this.mergevertices()}function pb(a,b,c){i.call(this);this.type="parametricbuffergeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g,h,m=b+1;for(g=0;g<=c;g++){var k=g/c;for(h=0;h<=b;h++){var t=h/b,p=a(t,k);e.push(p.x,p.y,p.z);f.push(t,k)}}for(g=0;gd&&1===a.x&&(m[b]=a.x-1);0===c.x&&0===c.z&&(m[b]=d/2/math.pi+ .5)}i.call(this);this.type="polyhedronbuffergeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;var h=[],m=[];(function(a){for(var c=new q,d=new q,g=new q,h=0;he&&(.2>b&&(m[a+0]+=1),.2>c&&(m[a+2]+=1),.2>d&&(m[a+4]+=1))})();this.addattribute("position",new z(h,3));this.addattribute("normal",new z(h.slice(),3));this.addattribute("uv", new z(m,2));this.normalizenormals()}function jc(a,b){t.call(this);this.type="tetrahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new qb(a,b));this.mergevertices()}function qb(a,b){ba.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],a,b);this.type="tetrahedronbuffergeometry";this.parameters={radius:a,detail:b}}function kc(a,b){t.call(this);this.type="octahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new ob(a,b));this.mergevertices()} function ob(a,b){ba.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],a,b);this.type="octahedronbuffergeometry";this.parameters={radius:a,detail:b}}function lc(a,b){t.call(this);this.type="icosahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new rb(a,b));this.mergevertices()}function rb(a,b){var c=(1+math.sqrt(5))/2;ba.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,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],a,b);this.type="icosahedronbuffergeometry";this.parameters={radius:a,detail:b}}function mc(a,b){t.call(this);this.type="dodecahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new sb(a,b));this.mergevertices()}function sb(a,b){var c=(1+math.sqrt(5))/2,d=1/c;ba.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,-c,0,-d,c,0, d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,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],a,b);this.type="dodecahedronbuffergeometry";this.parameters={radius:a,detail:b}}function nc(a,b,c,d,e,f){t.call(this);this.type="tubegeometry";this.parameters={path:a, tubularsegments:b,radius:c,radialsegments:d,closed:e};void 0!==f&&console.warn("three.tubegeometry: taper has been removed.");a=new tb(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.frombuffergeometry(a);this.mergevertices()}function tb(a,b,c,d,e){function f(e){var f=a.getpointat(e/b),k=g.normals[e];e=g.binormals[e];for(p=0;p<=d;p++){var t=p/d*math.pi*2,r=math.sin(t),t=-math.cos(t);m.x=t*k.x+r*e.x;m.y=t*k.y+r*e.y;m.z=t*k.z+r*e.z;m.normalize();l.push(m.x, m.y,m.z);h.x=f.x+c*m.x;h.y=f.y+c*m.y;h.z=f.z+c*m.z;n.push(h.x,h.y,h.z)}}i.call(this);this.type="tubebuffergeometry";this.parameters={path:a,tubularsegments:b,radius:c,radialsegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computefrenetframes(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new q,m=new q,k=new d,t,p,n=[],l=[],g=[],r=[];for(t=0;tq;q++)f[0]=l[m[q]],f[1]=l[m[(q+1)%3]],f.sort(c),h=f.tostring(),void 0===g[h]?g[h]={index1:f[0],index2:f[1],face1:p,face2:void 0}:g[h].face2=p;for(h in g)if(f=g[h],void 0===f.face2||k[f.face1].normal.dot(k[f.face2].normal)<= e)m=t[f.index1],d.push(m.x,m.y,m.z),m=t[f.index2],d.push(m.x,m.y,m.z);this.addattribute("position",new z(d,3))}function qb(a,b,c,d,e,f,g,h){t.call(this);this.type="cylindergeometry";this.parameters={radiustop:a,radiusbottom:b,height:c,radialsegments:d,heightsegments:e,openended:f,thetastart:g,thetalength:h};this.frombuffergeometry(new va(a,b,c,d,e,f,g,h));this.mergevertices()}function va(a,b,c,d,e,f,g,h){function m(c){var e,f,m,r=new d,c=new q,f=0,x=!0===c?a:b,h=!0===c?1:-1;f=g;for(e=1;e<=d;e++)p.push(0, a*h,0),n.push(0,h,0),l.push(.5,.5),g++;m=g;for(e=0;e<=d;e++){var aa=e/d*h+g,z=math.cos(aa),aa=math.sin(aa);c.x=x*aa;c.y=a*h;c.z=x*z;p.push(c.x,c.y,c.z);n.push(0,h,0);r.x=.5*z+.5;r.y=.5*aa*h+.5;l.push(r.x,r.y);g++}for(e=0;ethis.duration&&this.resetduration();this.optimize()}function hd(a){this.manager= void 0!==a?a:ta;this.textures={}}function ce(a){this.manager=void 0!==a?a:ta}function zb(){this.onloadstart=function(){};this.onloadprogress=function(){};this.onloadcomplete=function(){}}function de(a){"boolean"===typeof a&&(console.warn("three.jsonloader: showstatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:ta;this.withcredentials=!1}function se(a){this.manager=void 0!==a?a:ta;this.texturepath=""}function te(a,b,c,d,e){b=.5*(d-b);e=.5*(e-c);var f=a*a;return(2* c-2*d+b+e)*a*f+(-3*c+3*d-2*b-e)*f+b*a+c}function ab(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function bb(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}function ua(){}function ta(a,b){this.v1=a;this.v2=b}function ad(){this.curves=[];this.autoclose=!1}function wa(a,b,c,d,e,f,g,h){this.ax=a;this.ay=b;this.xradius=c;this.yradius=d;this.astartangle=e;this.aendangle=f;this.aclockwise=g;this.arotation=h||0}function cb(a){this.points=void 0===a?[]:a}function fc(a,b,c, d){this.v0=a;this.v1=b;this.v2=c;this.v3=d}function gc(a,b,c){this.v0=a;this.v1=b;this.v2=c}function bd(a){ad.call(this);this.currentpoint=new d;a&&this.frompoints(a)}function db(){bd.apply(this,arguments);this.holes=[]}function ee(){this.subpaths=[];this.currentpath=null}function fe(a){this.data=a}function ue(a){this.manager=void 0!==a?a:ta}function ge(a){this.manager=void 0!==a?a:ta}function he(a,b,c,d){ma.call(this,a,b);this.type="rectarealight";this.position.set(0,1,0);this.updatematrix();this.width= void 0!==c?c:10;this.height=void 0!==d?d:10}function ve(){this.type="stereocamera";this.aspect=1;this.eyesep=.064;this.cameral=new fa;this.cameral.layers.enable(1);this.cameral.matrixautoupdate=!1;this.camerar=new fa;this.camerar.layers.enable(2);this.camerar.matrixautoupdate=!1}function id(a,b,c){x.call(this);this.type="cubecamera";var d=new fa(90,1,a,b);d.up.set(0,-1,0);d.lookat(new q(1,0,0));this.add(d);var e=new fa(90,1,a,b);e.up.set(0,-1,0);e.lookat(new q(-1,0,0));this.add(e);var f=new fa(90, 1,a,b);f.up.set(0,0,1);f.lookat(new q(0,1,0));this.add(f);var g=new fa(90,1,a,b);g.up.set(0,0,-1);g.lookat(new q(0,-1,0));this.add(g);var h=new fa(90,1,a,b);h.up.set(0,-1,0);h.lookat(new q(0,0,1));this.add(h);var m=new fa(90,1,a,b);m.up.set(0,-1,0);m.lookat(new q(0,0,-1));this.add(m);this.rendertarget=new gb(c,c,{format:1022,magfilter:1006,minfilter:1006});this.updatecubemap=function(a,b){null===this.parent&&this.updatematrixworld();var c=this.rendertarget,n=c.texture.generatemipmaps;c.texture.generatemipmaps= !1;c.activecubeface=0;a.render(b,d,c);c.activecubeface=1;a.render(b,e,c);c.activecubeface=2;a.render(b,f,c);c.activecubeface=3;a.render(b,g,c);c.activecubeface=4;a.render(b,h,c);c.texture.generatemipmaps=n;c.activecubeface=5;a.render(b,m,c);a.setrendertarget(null)}}function ie(){x.call(this);this.type="audiolistener";this.context=je.getcontext();this.gain=this.context.creategain();this.gain.connect(this.context.destination);this.filter=null}function hc(a){x.call(this);this.type="audio";this.context= a.context;this.gain=this.context.creategain();this.gain.connect(a.getinput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.starttime=0;this.playbackrate=1;this.isplaying=!1;this.hasplaybackcontrol=!0;this.sourcetype="empty";this.filters=[]}function ke(a){hc.call(this,a);this.panner=this.context.createpanner();this.panner.connect(this.gain)}function le(a,b){this.analyser=a.context.createanalyser();this.analyser.fftsize=void 0!==b?b:2048;this.data=new uint8array(this.analyser.frequencybincount); a.getoutput().connect(this.analyser)}function jd(a,b,c){this.binding=a;this.valuesize=c;a=float64array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixbufferregion=b;this.referencecount=this.usecount=this.cumulativeweight=0}function ka(a,b,c){this.path=b;this.parsedpath=c||ka.parsetrackname(b);this.node=ka.findnode(a,this.parsedpath.nodename)||a;this.rootnode=a}function me(a){this.uuid=n.generateuuid(); this._objects=array.prototype.slice.call(arguments);this.ncachedobjects_=0;var b={};this._indicesbyuuid=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[];this._parsedpaths=[];this._bindings=[];this._bindingsindicesbypath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inuse(){return this.total-e.ncachedobjects_}},get bindingsperobject(){return e._bindings.length}}}function ne(a,b,c){this._mixer=a;this._clip=b;this._localroot=c||null;a=b.tracks; b=a.length;c=array(b);for(var d={endingstart:2400,endingend:2400},e=0;e!==b;++e){var f=a[e].createinterpolant(null);c[e]=f;f.settings=d}this._interpolantsettings=d;this._interpolants=c;this._propertybindings=array(b);this._weightinterpolant=this._timescaleinterpolant=this._byclipcacheindex=this._cacheindex=null;this.loop=2201;this._loopcount=-1;this._starttime=null;this.time=0;this._effectiveweight=this.weight=this._effectivetimescale=this.timescale=1;this.repetitions=infinity;this.paused=!1;this.enabled= !0;this.clampwhenfinished=!1;this.zeroslopeatend=this.zeroslopeatstart=!0}function cd(a){this._root=a;this._initmemorymanager();this.time=this._accuindex=0;this.timescale=1}function kd(a,b){"string"===typeof a&&(console.warn("three.uniform: type parameter is no longer needed."),a=b);this.value=a}function eb(){i.call(this);this.type="instancedbuffergeometry";this.maxinstancedcount=void 0}function oe(a,b,c,d){this.uuid=n.generateuuid();this.data=a;this.itemsize=b;this.offset=c;this.normalized=!0=== d}function ic(a,b){this.uuid=n.generateuuid();this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updaterange={offset:0,count:-1};this.onuploadcallback=function(){};this.version=0}function jc(a,b,c){ic.call(this,a,b);this.meshperattribute=c||1}function kc(a,b,c){u.call(this,a,b);this.meshperattribute=c||1}function pe(a,b,c,d){this.ray=new cb(a,b);this.near=c||0;this.far=d||infinity;this.params={mesh:{},line:{},lod:{},points:{threshold:1},sprite:{}};object.defineproperties(this.params, {pointcloud:{get:function(){console.warn("three.raycaster: params.pointcloud has been renamed to params.points.");return this.points}}})}function we(a,b){return a.distance-b.distance}function qe(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*math.pi*2,f=d/32* math.pi*2;b.push(math.cos(e),math.sin(e),1,math.cos(f),math.sin(f),1)}a.addattribute("position",new z(b,3));b=new ia({fog:!1});this.cone=new ga(a,b);this.add(this.cone);this.update()}function mc(a){this.bones=this.getbonelist(a);for(var b=new i,c=[],d=[],e=new j(0,0,1),f=new j(0,1,0),g=0;ga?-1:0e;e++)8===e||13===e||18===e||23===e?b[e]="-":14===e?b[e]="4":(2>=c&&(c=33554432+16777216*math.random()|0),d=c&15,c>>=4,b[e]=a[19===e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return math.max(b,math.min(c,a))},euclideanmodulo:function(a,b){return(a%b+b)%b},maplinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a, b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randint:function(a,b){return a+math.floor(math.random()*(b-a+1))},randfloat:function(a,b){return a+math.random()*(b-a)},randfloatspread:function(a){return a*(.5-math.random())},degtorad:function(a){return a*n.deg2rad},radtodeg:function(a){return a*n.rad2deg},ispoweroftwo:function(a){return 0===(a&a-1)&&0!==a},nearestpoweroftwo:function(a){return math.pow(2, math.round(math.log(a)/math.ln2))},nextpoweroftwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};d.prototype={constructor:d,isvector2:!0,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,b){this.x=a;this.y=b;return this},setscalar:function(a){this.y=this.x=a;return this},setx:function(a){this.x=a;return this},sety:function(a){this.y=a;return this},setcomponent:function(a,b){switch(a){case 0:this.x=b;break; case 1:this.y=b;break;default:throw error("index is out of range: "+a);}return this},getcomponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("three.vector2: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(a,b);this.x+=a.x; this.y+=a.y;return this},addscalar:function(a){this.x+=a;this.y+=a;return this},addvectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addscaledvector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("three.vector2: .sub() now only accepts one argument. use .subvectors( a, b ) instead."),this.subvectors(a,b);this.x-=a.x;this.y-=a.y;return this},subscalar:function(a){this.x-=a;this.y-=a;return this},subvectors:function(a,b){this.x= a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyscalar:function(a){isfinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},dividescalar:function(a){return this.multiplyscalar(1/a)},min:function(a){this.x=math.min(this.x,a.x);this.y=math.min(this.y,a.y);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);return this},clamp:function(a,b){this.x=math.max(a.x, math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.y));return this},clampscalar:function(){var a,b;return function(c,d){void 0===a&&(a=new d,b=new d);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clamplength:function(a,b){var c=this.length();return this.multiplyscalar(math.max(a,math.min(b,c))/c)},floor:function(){this.x=math.floor(this.x);this.y=math.floor(this.y);return this},ceil:function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);return this},round:function(){this.x=math.round(this.x); this.y=math.round(this.y);return this},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},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthsq:function(){return this.x*this.x+this.y*this.y},length:function(){return math.sqrt(this.x*this.x+this.y*this.y)},lengthmanhattan:function(){return math.abs(this.x)+math.abs(this.y)},normalize:function(){return this.dividescalar(this.length())}, angle:function(){var a=math.atan2(this.y,this.x);0>a&&(a+=2*math.pi);return a},distanceto:function(a){return math.sqrt(this.distancetosquared(a))},distancetosquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},distancetomanhattan:function(a){return math.abs(this.x-a.x)+math.abs(this.y-a.y)},setlength:function(a){return this.multiplyscalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpvectors:function(a,b,c){return this.subvectors(b, a).multiplyscalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},frombufferattribute:function(a,b,c){void 0!==c&&console.warn("three.vector2: offset has been removed from .frombufferattribute().");this.x=a.getx(b);this.y=a.gety(b);return this},rotatearound:function(a,b){var c=math.cos(b),d=math.sin(b),e=this.x- a.x,f=this.y-a.y;this.x=e*c-f*d+a.x;this.y=e*d+f*c+a.y;return this}};var ze=0;ea.default_image=void 0;ea.default_mapping=300;ea.prototype={constructor:ea,istexture:!0,set needsupdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wraps=a.wraps;this.wrapt=a.wrapt;this.magfilter=a.magfilter;this.minfilter=a.minfilter;this.anisotropy=a.anisotropy;this.format=a.format; this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.generatemipmaps=a.generatemipmaps;this.premultiplyalpha=a.premultiplyalpha;this.flipy=a.flipy;this.unpackalignment=a.unpackalignment;this.encoding=a.encoding;return this},tojson:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.4,type:"texture",generator:"texture.tojson"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x, this.offset.y],wrap:[this.wraps,this.wrapt],minfilter:this.minfilter,magfilter:this.magfilter,anisotropy:this.anisotropy,flipy:this.flipy};if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=n.generateuuid());if(void 0===a.images[c.uuid]){var d=a.images,e=c.uuid,f=c.uuid,g;void 0!==c.todataurl?g=c:(g=document.createelementns("http://www.w3.org/1999/xhtml","canvas"),g.width=c.width,g.height=c.height,g.getcontext("2d").drawimage(c,0,0,c.width,c.height));g=2048a.x||1a.x?0:1;break;case 1002:a.x=1===math.abs(math.floor(a.x)%2)?math.ceil(a.x)-a.x:a.x-math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===math.abs(math.floor(a.y)%2)?math.ceil(a.y)-a.y:a.y-math.floor(a.y)}this.flipy&&(a.y=1-a.y)}}};object.assign(ea.prototype,pa.prototype);fa.prototype={constructor:fa,isvector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setscalar:function(a){this.w=this.z=this.y=this.x=a;return this},setx:function(a){this.x=a;return this},sety:function(a){this.y=a;return this},setz:function(a){this.z=a;return this},setw:function(a){this.w=a;return this}, setcomponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw error("index is out of range: "+a);}return this},getcomponent:function(a){switch(a){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: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w? a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("three.vector4: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addscalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addvectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addscaledvector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b; return this},sub:function(a,b){if(void 0!==b)return console.warn("three.vector4: .sub() now only accepts one argument. use .subvectors( a, b ) instead."),this.subvectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subscalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subvectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyscalar:function(a){isfinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z= this.y=this.x=0;return this},applymatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},dividescalar:function(a){return this.multiplyscalar(1/a)},setaxisanglefromquaternion:function(a){this.w=2*math.acos(a.w);var b=math.sqrt(1-a.w*a.w);1e-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this}, setaxisanglefromrotationmatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],m=a[9];c=a[2];b=a[6];var k=a[10];if(.01>math.abs(d-g)&&.01>math.abs(f-c)&&.01>math.abs(m-b)){if(.1>math.abs(d+g)&&.1>math.abs(f+c)&&.1>math.abs(m+b)&&.1>math.abs(e+h+k-3))return this.set(1,0,0,0),this;a=math.pi;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;m=(m+b)/4;e>h&&e>k?.01>e?(b=0,d=c=.707106781):(b=math.sqrt(e),c=d/b,d=f/b):h>k?.01>h?(b=.707106781,c=0,d=.707106781):(c=math.sqrt(h), b=d/c,d=m/c):.01>k?(c=b=.707106781,d=0):(d=math.sqrt(k),b=f/d,c=m/d);this.set(b,c,d,a);return this}a=math.sqrt((b-m)*(b-m)+(f-c)*(f-c)+(g-d)*(g-d));.001>math.abs(a)&&(a=1);this.x=(b-m)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=math.acos((e+h+k-1)/2);return this},min:function(a){this.x=math.min(this.x,a.x);this.y=math.min(this.y,a.y);this.z=math.min(this.z,a.z);this.w=math.min(this.w,a.w);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);this.z=math.max(this.z,a.z); this.w=math.max(this.w,a.w);return this},clamp:function(a,b){this.x=math.max(a.x,math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.y));this.z=math.max(a.z,math.min(b.z,this.z));this.w=math.max(a.w,math.min(b.w,this.w));return this},clampscalar:function(){var a,b;return function(c,d){void 0===a&&(a=new fa,b=new fa);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),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},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},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},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},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthsq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthmanhattan:function(){return math.abs(this.x)+math.abs(this.y)+math.abs(this.z)+math.abs(this.w)},normalize:function(){return this.dividescalar(this.length())}, setlength:function(a){return this.multiplyscalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpvectors:function(a,b,c){return this.subvectors(b,a).multiplyscalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},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.w;return a},frombufferattribute:function(a,b,c){void 0!==c&&console.warn("three.vector4: offset has been removed from .frombufferattribute().");this.x=a.getx(b);this.y=a.gety(b);this.z=a.getz(b);this.w=a.getw(b);return this}};ya.prototype={constructor:ya,iswebglrendertarget:!0,setsize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a, b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthbuffer=a.depthbuffer;this.stencilbuffer=a.stencilbuffer;this.depthtexture=a.depthtexture;return this},dispose:function(){this.dispatchevent({type:"dispose"})}};object.assign(ya.prototype,pa.prototype);gb.prototype=object.create(ya.prototype);gb.prototype.constructor=gb;gb.prototype.iswebglrendertargetcube=!0; ca.prototype={constructor:ca,get x(){return this._x},set x(a){this._x=a;this.onchangecallback()},get y(){return this._y},set y(a){this._y=a;this.onchangecallback()},get z(){return this._z},set z(a){this._z=a;this.onchangecallback()},get w(){return this._w},set w(a){this._w=a;this.onchangecallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onchangecallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x= a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onchangecallback();return this},setfromeuler:function(a,b){if(!1===(a&&a.iseuler))throw error("three.quaternion: .setfromeuler() now expects an euler rotation rather than a vector3 and order.");var c=math.cos(a._x/2),d=math.cos(a._y/2),e=math.cos(a._z/2),f=math.sin(a._x/2),g=math.sin(a._y/2),h=math.sin(a._z/2),m=a.order;"xyz"===m?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"yxz"===m?(this._x=f*d*e+c*g*h,this._y=c*g* e-f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"zxy"===m?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"zyx"===m?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"yzx"===m?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"xzy"===m&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onchangecallback();return this},setfromaxisangle:function(a,b){var c= b/2,d=math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=math.cos(c);this.onchangecallback();return this},setfromrotationmatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],m=b[6],b=b[10],k=c+f+b;0f&&c>b?(c=2*math.sqrt(1+c-f-b),this._w=(m-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c, this._z=(g+m)/c):(c=2*math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+m)/c,this._z=.25*c);this.onchangecallback();return this},setfromunitvectors:function(){var a,b;return function(c,d){void 0===a&&(a=new q);b=c.dot(d)+1;1e-6>b?(b=0,math.abs(c.x)>math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossvectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*=-1;this._y*= -1;this._z*=-1;this.onchangecallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthsq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onchangecallback();return this},multiply:function(a, b){return void 0!==b?(console.warn("three.quaternion: .multiply() now only accepts one argument. use .multiplyquaternions( a, b ) instead."),this.multiplyquaternions(a,b)):this.multiplyquaternions(this,a)},premultiply:function(a){return this.multiplyquaternions(a,this)},multiplyquaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,m=b._z,k=b._w;this._x=c*k+f*g+d*m-e*h;this._y=d*k+f*h+e*g-c*m;this._z=e*k+f*m+c*h-d*g;this._w=f*k-c*g-d*h-e*m;this.onchangecallback();return this},slerp:function(a, b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=math.sqrt(1-g*g);if(.001>math.abs(h))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var m=math.atan2(h,g),g=math.sin((1-b)*m)/h,h=math.sin(b*m)/h;this._w=f*g+this._w*h;this._x= c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onchangecallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromarray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onchangecallback();return this},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._w;return a},onchange:function(a){this.onchangecallback=a;return this}, onchangecallback:function(){}};object.assign(ca,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpflat:function(a,b,c,d,e,f,g){var h=c[d+0],m=c[d+1],k=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],p=e[f+2];e=e[f+3];if(c!==e||h!==d||m!==l||k!==p){f=1-g;var n=h*d+m*l+k*p+c*e,u=0<=n?1:-1,q=1-n*n;q>number.epsilon&&(q=math.sqrt(q),n=math.atan2(q,n*u),f=math.sin(f*n)/q,g=math.sin(g*n)/q);u*=g;h=h*f+d*u;m=m*f+l*u;k=k*f+p*u;c=c*f+e*u;f===1-g&&(g=1/math.sqrt(h*h+m*m+k*k+c*c),h*=g,m*=g,k*=g,c*=g)}a[b]=h;a[b+ 1]=m;a[b+2]=k;a[b+3]=c}});q.prototype={constructor:q,isvector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setscalar:function(a){this.z=this.y=this.x=a;return this},setx:function(a){this.x=a;return this},sety:function(a){this.y=a;return this},setz:function(a){this.z=a;return this},setcomponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw error("index is out of range: "+a);}return this},getcomponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;default:throw error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("three.vector3: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addscalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this}, addvectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addscaledvector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("three.vector3: .sub() now only accepts one argument. use .subvectors( a, b ) instead."),this.subvectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subscalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subvectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z= a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("three.vector3: .multiply() now only accepts one argument. use .multiplyvectors( a, b ) instead."),this.multiplyvectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyscalar:function(a){isfinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyvectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyeuler:function(){var a;return function(b){!1===(b&& b.iseuler)&&console.error("three.vector3: .applyeuler() now expects an euler rotation rather than a vector3 and order.");void 0===a&&(a=new ca);return this.applyquaternion(a.setfromeuler(b))}}(),applyaxisangle:function(){var a;return function(b,c){void 0===a&&(a=new ca);return this.applyquaternion(a.setfromaxisangle(b,c))}}(),applymatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applymatrix4:function(a){var b= this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this.dividescalar(a[3]*b+a[7]*c+a[11]*d+a[15])},applyquaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,m=a*c+g*b-e*d,k=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+m*-g-k*-f;this.y=m*a+b*-f+k*-e-h*-g;this.z=k*a+b*-g+h*-f-m*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new s);a.multiplymatrices(b.projectionmatrix, a.getinverse(b.matrixworld));return this.applymatrix4(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new s);a.multiplymatrices(b.matrixworld,a.getinverse(b.projectionmatrix));return this.applymatrix4(a)}}(),transformdirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},dividescalar:function(a){return this.multiplyscalar(1/ a)},min:function(a){this.x=math.min(this.x,a.x);this.y=math.min(this.y,a.y);this.z=math.min(this.z,a.z);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);this.z=math.max(this.z,a.z);return this},clamp:function(a,b){this.x=math.max(a.x,math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.y));this.z=math.max(a.z,math.min(b.z,this.z));return this},clampscalar:function(){var a,b;return function(c,d){void 0===a&&(a=new q,b=new q);a.set(c,c,c);b.set(d,d,d);return this.clamp(a, b)}}(),clamplength:function(a,b){var c=this.length();return this.multiplyscalar(math.max(a,math.min(b,c))/c)},floor:function(){this.x=math.floor(this.x);this.y=math.floor(this.y);this.z=math.floor(this.z);return this},ceil:function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);this.z=math.ceil(this.z);return this},round:function(){this.x=math.round(this.x);this.y=math.round(this.y);this.z=math.round(this.z);return this},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},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthsq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthmanhattan:function(){return math.abs(this.x)+math.abs(this.y)+math.abs(this.z)},normalize:function(){return this.dividescalar(this.length())}, setlength:function(a){return this.multiplyscalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpvectors:function(a,b,c){return this.subvectors(b,a).multiplyscalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("three.vector3: .cross() now only accepts one argument. use .crossvectors( a, b ) instead."),this.crossvectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y- d*a.x;return this},crossvectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectonvector:function(a){var b=a.dot(this)/a.lengthsq();return this.copy(a).multiplyscalar(b)},projectonplane:function(){var a;return function(b){void 0===a&&(a=new q);a.copy(this).projectonvector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new q);return this.sub(a.copy(b).multiplyscalar(2*this.dot(b)))}}(),angleto:function(a){a= this.dot(a)/math.sqrt(this.lengthsq()*a.lengthsq());return math.acos(n.clamp(a,-1,1))},distanceto:function(a){return math.sqrt(this.distancetosquared(a))},distancetosquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},distancetomanhattan:function(a){return math.abs(this.x-a.x)+math.abs(this.y-a.y)+math.abs(this.z-a.z)},setfromspherical:function(a){var b=math.sin(a.phi)*a.radius;this.x=b*math.sin(a.theta);this.y=math.cos(a.phi)*a.radius;this.z=b*math.cos(a.theta);return this}, setfromcylindrical:function(a){this.x=a.radius*math.sin(a.theta);this.y=a.y;this.z=a.radius*math.cos(a.theta);return this},setfrommatrixposition:function(a){return this.setfrommatrixcolumn(a,3)},setfrommatrixscale:function(a){var b=this.setfrommatrixcolumn(a,0).length(),c=this.setfrommatrixcolumn(a,1).length();a=this.setfrommatrixcolumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setfrommatrixcolumn:function(a,b){if("number"===typeof a){console.warn("three.vector3: setfrommatrixcolumn now expects ( matrix, index )."); var c=a;a=b;b=c}return this.fromarray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},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;return a},frombufferattribute:function(a,b,c){void 0!==c&&console.warn("three.vector3: offset has been removed from .frombufferattribute().");this.x=a.getx(b);this.y=a.gety(b);this.z=a.getz(b); return this}};s.prototype={constructor:s,ismatrix4:!0,set:function(a,b,c,d,e,f,g,h,m,k,l,p,n,u,q,r){var a=this.elements;a[0]=a;a[4]=b;a[8]=c;a[12]=d;a[1]=e;a[5]=f;a[9]=g;a[13]=h;a[2]=m;a[6]=k;a[10]=l;a[14]=p;a[3]=n;a[7]=u;a[11]=q;a[15]=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new s).fromarray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyposition:function(a){var b=this.elements;a=a.elements; b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractbasis:function(a,b,c){a.setfrommatrixcolumn(this,0);b.setfrommatrixcolumn(this,1);c.setfrommatrixcolumn(this,2);return this},makebasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractrotation:function(){var a;return function(b){void 0===a&&(a=new q);var c=this.elements,d=b.elements,e=1/a.setfrommatrixcolumn(b,0).length(),f=1/a.setfrommatrixcolumn(b,1).length();b=1/a.setfrommatrixcolumn(b,2).length(); c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;return this}}(),makerotationfromeuler:function(a){!1===(a&&a.iseuler)&&console.error("three.matrix: .makerotationfromeuler() now expects a euler rotation rather than a vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=math.cos(c),c=math.sin(c),g=math.cos(d),d=math.sin(d),h=math.cos(e),e=math.sin(e);if("xyz"===a.order){a=f*h;var m=f*e,k=c*h,l=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=m+ k*d;b[5]=a-l*d;b[9]=-c*g;b[2]=l-a*d;b[6]=k+m*d;b[10]=f*g}else"yxz"===a.order?(a=g*h,m=g*e,k=d*h,l=d*e,b[0]=a+l*c,b[4]=k*c-m,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=m*c-k,b[6]=l+a*c,b[10]=f*g):"zxy"===a.order?(a=g*h,m=g*e,k=d*h,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=k+m*c,b[1]=m+k*c,b[5]=f*h,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"zyx"===a.order?(a=f*h,m=f*e,k=c*h,l=c*e,b[0]=g*h,b[4]=k*d-m,b[8]=a*d+l,b[1]=g*e,b[5]=l*d+a,b[9]=m*d-k,b[2]=-d,b[6]=c*g,b[10]=f*g):"yzx"===a.order?(a=f*g,m=f*d,k=c*g,l=c*d,b[0]= g*h,b[4]=l-a*e,b[8]=k*e+m,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=m*e+k,b[10]=a-l*e):"xzy"===a.order&&(a=f*g,m=f*d,k=c*g,l=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+l,b[5]=f*h,b[9]=m*e-k,b[2]=k*e-m,b[6]=c*h,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makerotationfromquaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,m=e+e;a=c*g;var k=c*h,c=c*m,l=d*h,d=d*m,e=e*m,g=f*g,h=f*h,f=f*m;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]= d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookat:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new q,b=new q,c=new q);var g=this.elements;c.subvectors(d,e).normalize();0===c.lengthsq()&&(c.z=1);a.crossvectors(f,c).normalize();0===a.lengthsq()&&(c.z+=1e-4,a.crossvectors(f,c).normalize());b.crossvectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!== b?(console.warn("three.matrix4: .multiply() now only accepts one argument. use .multiplymatrices( a, b ) instead."),this.multiplymatrices(a,b)):this.multiplymatrices(this,a)},premultiply:function(a){return this.multiplymatrices(a,this)},multiplymatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],m=c[12],k=c[1],l=c[5],p=c[9],n=c[13],u=c[2],q=c[6],r=c[10],a=c[14],w=c[3],y=c[7],k=c[11],c=c[15],v=d[0],e=d[4],l=d[8],c=d[12],f=d[1],x=d[5],h=d[9],d=d[13],z=d[2],j=d[6], i=d[10],q=d[14],m=d[3],o=d[7],p=d[11],d=d[15];e[0]=f*v+g*f+h*z+m*m;e[4]=f*e+g*x+h*j+m*o;e[8]=f*l+g*h+h*i+m*p;e[12]=f*c+g*d+h*q+m*d;e[1]=k*v+l*f+p*z+n*m;e[5]=k*e+l*x+p*j+n*o;e[9]=k*l+l*h+p*i+n*p;e[13]=k*c+l*d+p*q+n*d;e[2]=u*v+q*f+r*z+a*m;e[6]=u*e+q*x+r*j+a*o;e[10]=u*l+q*h+r*i+a*p;e[14]=u*c+q*d+r*q+a*d;e[3]=w*v+y*f+k*z+c*m;e[7]=w*e+y*x+k*j+c*o;e[11]=w*l+y*h+k*i+c*p;e[15]=w*c+y*d+k*q+c*d;return this},multiplytoarray:function(a,b,c){var d=this.elements;this.multiplymatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]= d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyscalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applytobufferattribute:function(){var a;return function(b){void 0===a&&(a=new q);for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,k=1/m;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=k;b.elements[9]*=k;b.elements[10]*=k;d.setfromrotationmatrix(b); e.x=g;e.y=h;e.z=m;return this}}(),makeperspective:function(a,b,c,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/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-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},makeorthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),m=1/(c-d),k=1/(f-e);g[0]= 2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*m;g[9]=0;g[13]=-((c+d)*m);g[2]=0;g[6]=0;g[10]=-2*k;g[14]=-((f+e)*k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromarray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}};za.prototype=object.create(ea.prototype);za.prototype.constructor=za;za.prototype.iscubetexture=!0;object.defineproperty(za.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var ee=new ea,fe=new za,be=[],de=[];je.prototype.setvalue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setvalue(a, b[f.id])}};var rd=/([\w\d_]+)(\])?(\[|\.)?/g;$a.prototype.setvalue=function(a,b,c){b=this.map[b];void 0!==b&&b.setvalue(a,c,this.renderer)};$a.prototype.set=function(a,b,c){var d=this.map[c];void 0!==d&&d.setvalue(a,b[c],this.renderer)};$a.prototype.setoptional=function(a,b,c){b=b[c];void 0!==b&&this.setvalue(a,c,b)};$a.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsupdate&&g.setvalue(a,h.value,d)}};$a.seqwithvalue=function(a,b){for(var c=[],d=0,e=a.length;d!== e;++d){var f=a[d];f.id in b&&c.push(f)}return c};var ja={merge:function(a){for(var b={},c=0;c 0.0 ) {\n#if defined ( physically_correct_lights )\n\t\t\tfloat distancefalloff = 1.0 / max( pow( lightdistance, decayexponent ), 0.01 );\n\t\t\tfloat maxdistancecutofffactor = pow2( saturate( 1.0 - pow4( lightdistance / cutoffdistance ) ) );\n\t\t\treturn distancefalloff * maxdistancecutofffactor;\n#else\n\t\t\treturn pow( saturate( -lightdistance / cutoffdistance + 1.0 ), decayexponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 brdf_diffuse_lambert( const in vec3 diffusecolor ) {\n\treturn reciprocal_pi * diffusecolor;\n}\nvec3 f_schlick( const in vec3 specularcolor, const in float dotlh ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotlh - 6.98316 ) * dotlh );\n\treturn ( 1.0 - specularcolor ) * fresnel + specularcolor;\n}\nfloat g_ggx_smith( const in float alpha, const in float dotnl, const in float dotnv ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotnl + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotnl ) );\n\tfloat gv = dotnv + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotnv ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat g_ggx_smithcorrelated( const in float alpha, const in float dotnl, const in float dotnv ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotnl * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotnv ) );\n\tfloat gl = dotnv * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotnl ) );\n\treturn 0.5 / max( gv + gl, epsilon );\n}\nfloat d_ggx( const in float alpha, const in float dotnh ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotnh ) * ( a2 - 1.0 ) + 1.0;\n\treturn reciprocal_pi * a2 / pow2( denom );\n}\nvec3 brdf_specular_ggx( const in incidentlight incidentlight, const in geometriccontext geometry, const in vec3 specularcolor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfdir = normalize( incidentlight.direction + geometry.viewdir );\n\tfloat dotnl = saturate( dot( geometry.normal, incidentlight.direction ) );\n\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\tfloat dotnh = saturate( dot( geometry.normal, halfdir ) );\n\tfloat dotlh = saturate( dot( incidentlight.direction, halfdir ) );\n\tvec3 f = f_schlick( specularcolor, dotlh );\n\tfloat g = g_ggx_smithcorrelated( alpha, dotnl, dotnv );\n\tfloat d = d_ggx( alpha, dotnh );\n\treturn f * ( g * d );\n}\nvec2 ltctexturecoords( const in geometriccontext geometry, const in float roughness ) {\n\tconst float lut_size = 64.0;\n\tconst float lut_scale = (lut_size - 1.0)/lut_size;\n\tconst float lut_bias = 0.5/lut_size;\n\tvec3 n = geometry.normal;\n\tvec3 v = geometry.viewdir;\n\tvec3 p = geometry.position;\n\tfloat theta = acos( dot( n, v ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * pi ) ) );\n\tuv = uv * lut_scale + lut_bias;\n\treturn uv;\n}\nvoid clipquadtohorizon( inout vec3 l[5], out int n ) {\n\tint config = 0;\n\tif ( l[0].z > 0.0 ) config += 1;\n\tif ( l[1].z > 0.0 ) config += 2;\n\tif ( l[2].z > 0.0 ) config += 4;\n\tif ( l[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tl[1] = -l[1].z * l[0] + l[0].z * l[1];\n\t\tl[2] = -l[3].z * l[0] + l[0].z * l[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tl[0] = -l[0].z * l[1] + l[1].z * l[0];\n\t\tl[2] = -l[2].z * l[1] + l[1].z * l[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tl[2] = -l[2].z * l[1] + l[1].z * l[2];\n\t\tl[3] = -l[3].z * l[0] + l[0].z * l[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tl[0] = -l[3].z * l[2] + l[2].z * l[3];\n\t\tl[1] = -l[1].z * l[2] + l[2].z * l[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tl[0] = -l[0].z * l[1] + l[1].z * l[0];\n\t\tl[3] = -l[3].z * l[2] + l[2].z * l[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tl[4] = -l[3].z * l[0] + l[0].z * l[3];\n\t\tl[3] = -l[3].z * l[2] + l[2].z * l[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tl[0] = -l[0].z * l[3] + l[3].z * l[0];\n\t\tl[1] = -l[2].z * l[3] + l[3].z * l[2];\n\t\tl[2] = l[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tl[1] = -l[1].z * l[0] + l[0].z * l[1];\n\t\tl[2] = -l[2].z * l[3] + l[3].z * l[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tl[4] = l[3];\n\t\tl[3] = -l[2].z * l[3] + l[3].z * l[2];\n\t\tl[2] = -l[2].z * l[1] + l[1].z * l[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tl[1] = -l[1].z * l[2] + l[2].z * l[1];\n\t\tl[0] = -l[0].z * l[3] + l[3].z * l[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tl[4] = l[3];\n\t\tl[3] = l[2];\n\t\tl[2] = -l[1].z * l[2] + l[2].z * l[1];\n\t\tl[1] = -l[1].z * l[0] + l[0].z * l[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tl[4] = -l[0].z * l[3] + l[3].z * l[0];\n\t\tl[0] = -l[0].z * l[1] + l[1].z * l[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tl[3] = l[0];\n\tif ( n == 4 )\n\t\tl[4] = l[0];\n}\nfloat integrateltcbrdfoverrectedge( vec3 v1, vec3 v2 ) {\n\tfloat costheta = dot( v1, v2 );\n\tfloat theta = acos( costheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initrectpoints( const in vec3 pos, const in vec3 halfwidth, const in vec3 halfheight, out vec3 rectpoints[4] ) {\n\trectpoints[0] = pos - halfwidth - halfheight;\n\trectpoints[1] = pos + halfwidth - halfheight;\n\trectpoints[2] = pos + halfwidth + halfheight;\n\trectpoints[3] = pos - halfwidth + halfheight;\n}\nvec3 integrateltcbrdfoverrect( const in geometriccontext geometry, const in mat3 brdfmat, const in vec3 rectpoints[4] ) {\n\tvec3 n = geometry.normal;\n\tvec3 v = geometry.viewdir;\n\tvec3 p = geometry.position;\n\tvec3 t1, t2;\n\tt1 = normalize(v - n * dot( v, n ));\n\tt2 = - cross( n, t1 );\n\tmat3 brdfwrtsurface = brdfmat * transpose( mat3( t1, t2, n ) );\n\tvec3 clippedrect[5];\n\tclippedrect[0] = brdfwrtsurface * ( rectpoints[0] - p );\n\tclippedrect[1] = brdfwrtsurface * ( rectpoints[1] - p );\n\tclippedrect[2] = brdfwrtsurface * ( rectpoints[2] - p );\n\tclippedrect[3] = brdfwrtsurface * ( rectpoints[3] - p );\n\tint n;\n\tclipquadtohorizon(clippedrect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedrect[0] = normalize( clippedrect[0] );\n\tclippedrect[1] = normalize( clippedrect[1] );\n\tclippedrect[2] = normalize( clippedrect[2] );\n\tclippedrect[3] = normalize( clippedrect[3] );\n\tclippedrect[4] = normalize( clippedrect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateltcbrdfoverrectedge( clippedrect[0], clippedrect[1] );\n\tsum += integrateltcbrdfoverrectedge( clippedrect[1], clippedrect[2] );\n\tsum += integrateltcbrdfoverrectedge( clippedrect[2], clippedrect[3] );\n\tif (n >= 4)\n\t\tsum += integrateltcbrdfoverrectedge( clippedrect[3], clippedrect[4] );\n\tif (n == 5)\n\t\tsum += integrateltcbrdfoverrectedge( clippedrect[4], clippedrect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 lo_i = vec3( sum, sum, sum );\n\treturn lo_i;\n}\nvec3 rect_area_light_specular_reflectance(\n\t\tconst in geometriccontext geometry,\n\t\tconst in vec3 lightpos, const in vec3 lighthalfwidth, const in vec3 lighthalfheight,\n\t\tconst in float roughness,\n\t\tconst in sampler2d ltcmat, const in sampler2d ltcmag ) {\n\tvec3 rectpoints[4];\n\tinitrectpoints( lightpos, lighthalfwidth, lighthalfheight, rectpoints );\n\tvec2 uv = ltctexturecoords( geometry, roughness );\n\tvec4 brdfltcapproxparams, t;\n\tbrdfltcapproxparams = texture2d( ltcmat, uv );\n\tt = texture2d( ltcmat, uv );\n\tfloat brdfltcscalar = texture2d( ltcmag, uv ).a;\n\tmat3 brdfltcapproxmat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularreflectance = integrateltcbrdfoverrect( geometry, brdfltcapproxmat, rectpoints );\n\tspecularreflectance *= brdfltcscalar;\n\treturn specularreflectance;\n}\nvec3 rect_area_light_diffuse_reflectance(\n\t\tconst in geometriccontext geometry,\n\t\tconst in vec3 lightpos, const in vec3 lighthalfwidth, const in vec3 lighthalfheight ) {\n\tvec3 rectpoints[4];\n\tinitrectpoints( lightpos, lighthalfwidth, lighthalfheight, rectpoints );\n\tmat3 diffusebrdfmat = mat3(1);\n\tvec3 diffusereflectance = integrateltcbrdfoverrect( geometry, diffusebrdfmat, rectpoints );\n\treturn diffusereflectance;\n}\nvec3 brdf_specular_ggx_environment( const in geometriccontext geometry, const in vec3 specularcolor, const in float roughness ) {\n\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotnv ) ) * r.x + r.y;\n\tvec2 ab = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularcolor * ab.x + ab.y;\n}\nfloat g_blinnphong_implicit( ) {\n\treturn 0.25;\n}\nfloat d_blinnphong( const in float shininess, const in float dotnh ) {\n\treturn reciprocal_pi * ( shininess * 0.5 + 1.0 ) * pow( dotnh, shininess );\n}\nvec3 brdf_specular_blinnphong( const in incidentlight incidentlight, const in geometriccontext geometry, const in vec3 specularcolor, const in float shininess ) {\n\tvec3 halfdir = normalize( incidentlight.direction + geometry.viewdir );\n\tfloat dotnh = saturate( dot( geometry.normal, halfdir ) );\n\tfloat dotlh = saturate( dot( incidentlight.direction, halfdir ) );\n\tvec3 f = f_schlick( specularcolor, dotlh );\n\tfloat g = g_blinnphong_implicit( );\n\tfloat d = d_blinnphong( shininess, dotnh );\n\treturn f * ( g * d );\n}\nfloat ggxroughnesstoblinnexponent( const in float ggxroughness ) {\n\treturn ( 2.0 / pow2( ggxroughness + 0.0001 ) - 2.0 );\n}\nfloat blinnexponenttoggxroughness( const in float blinnexponent ) {\n\treturn sqrt( 2.0 / ( blinnexponent + 2.0 ) );\n}\n", bumpmap_pars_fragment:"#ifdef use_bumpmap\n\tuniform sampler2d bumpmap;\n\tuniform float bumpscale;\n\tvec2 dhdxy_fwd() {\n\t\tvec2 dstdx = dfdx( vuv );\n\t\tvec2 dstdy = dfdy( vuv );\n\t\tfloat hll = bumpscale * texture2d( bumpmap, vuv ).x;\n\t\tfloat dbx = bumpscale * texture2d( bumpmap, vuv + dstdx ).x - hll;\n\t\tfloat dby = bumpscale * texture2d( bumpmap, vuv + dstdy ).x - hll;\n\t\treturn vec2( dbx, dby );\n\t}\n\tvec3 perturbnormalarb( vec3 surf_pos, vec3 surf_norm, vec2 dhdxy ) {\n\t\tvec3 vsigmax = dfdx( surf_pos );\n\t\tvec3 vsigmay = dfdy( surf_pos );\n\t\tvec3 vn = surf_norm;\n\t\tvec3 r1 = cross( vsigmay, vn );\n\t\tvec3 r2 = cross( vn, vsigmax );\n\t\tfloat fdet = dot( vsigmax, r1 );\n\t\tvec3 vgrad = sign( fdet ) * ( dhdxy.x * r1 + dhdxy.y * r2 );\n\t\treturn normalize( abs( fdet ) * surf_norm - vgrad );\n\t}\n#endif\n", clipping_planes_fragment:"#if num_clipping_planes > 0\n\tfor ( int i = 0; i < union_clipping_planes; ++ i ) {\n\t\tvec4 plane = clippingplanes[ i ];\n\t\tif ( dot( vviewposition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if union_clipping_planes < num_clipping_planes\n\t\tbool clipped = true;\n\t\tfor ( int i = union_clipping_planes; i < num_clipping_planes; ++ i ) {\n\t\t\tvec4 plane = clippingplanes[ i ];\n\t\t\tclipped = ( dot( vviewposition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n", clipping_planes_pars_fragment:"#if num_clipping_planes > 0\n\t#if ! defined( physical ) && ! defined( phong )\n\t\tvarying vec3 vviewposition;\n\t#endif\n\tuniform vec4 clippingplanes[ num_clipping_planes ];\n#endif\n",clipping_planes_pars_vertex:"#if num_clipping_planes > 0 && ! defined( physical ) && ! defined( phong )\n\tvarying vec3 vviewposition;\n#endif\n",clipping_planes_vertex:"#if num_clipping_planes > 0 && ! defined( physical ) && ! defined( phong )\n\tvviewposition = - mvposition.xyz;\n#endif\n", color_fragment:"#ifdef use_color\n\tdiffusecolor.rgb *= vcolor;\n#endif",color_pars_fragment:"#ifdef use_color\n\tvarying vec3 vcolor;\n#endif\n",color_pars_vertex:"#ifdef use_color\n\tvarying vec3 vcolor;\n#endif",color_vertex:"#ifdef use_color\n\tvcolor.xyz = color.xyz;\n#endif",common:"#define pi 3.14159265359\n#define pi2 6.28318530718\n#define pi_half 1.5707963267949\n#define reciprocal_pi 0.31830988618\n#define reciprocal_pi2 0.15915494\n#define log2 1.442695\n#define epsilon 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whitecompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, pi );\n\treturn fract(sin(sn) * c);\n}\nstruct incidentlight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct reflectedlight {\n\tvec3 directdiffuse;\n\tvec3 directspecular;\n\tvec3 indirectdiffuse;\n\tvec3 indirectspecular;\n};\nstruct geometriccontext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewdir;\n};\nvec3 transformdirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inversetransformdirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectonplane(in vec3 point, in vec3 pointonplane, in vec3 planenormal ) {\n\tfloat distance = dot( planenormal, point - pointonplane );\n\treturn - distance * planenormal + point;\n}\nfloat sideofplane( in vec3 point, in vec3 pointonplane, in vec3 planenormal ) {\n\treturn sign( dot( point - pointonplane, planenormal ) );\n}\nvec3 lineplaneintersect( in vec3 pointonline, in vec3 linedirection, in vec3 pointonplane, in vec3 planenormal ) {\n\treturn linedirection * ( dot( planenormal, pointonplane - pointonline ) / dot( planenormal, linedirection ) ) + pointonline;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n", cube_uv_reflection_fragment:"#ifdef envmap_type_cube_uv\n#define cubeuv_texturesize (1024.0)\nint getfacefromdirection(vec3 direction) {\n\tvec3 absdirection = abs(direction);\n\tint face = -1;\n\tif( absdirection.x > absdirection.z ) {\n\t\tif(absdirection.x > absdirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absdirection.z > absdirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeuv_maxlods1 (log2(cubeuv_texturesize*0.25) - 1.0)\n#define cubeuv_rangeclamp (exp2((6.0 - 1.0) * 2.0))\nvec2 miplevelinfo( vec3 vec, float roughnesslevel, float roughness ) {\n\tfloat scale = exp2(cubeuv_maxlods1 - roughnesslevel);\n\tfloat dxroughness = dfdx(roughness);\n\tfloat dyroughness = dfdy(roughness);\n\tvec3 dx = dfdx( vec * scale * dxroughness );\n\tvec3 dy = dfdy( vec * scale * dyroughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeuv_rangeclamp);\n\tfloat miplevel = 0.5 * log2(d);\n\treturn vec2(floor(miplevel), fract(miplevel));\n}\n#define cubeuv_maxlods2 (log2(cubeuv_texturesize*0.25) - 2.0)\n#define cubeuv_rcptexturesize (1.0 / cubeuv_texturesize)\nvec2 getcubeuv(vec3 direction, float roughnesslevel, float miplevel) {\n\tmiplevel = roughnesslevel > cubeuv_maxlods2 - 3.0 ? 0.0 : miplevel;\n\tfloat a = 16.0 * cubeuv_rcptexturesize;\n\tvec2 exp2_packed = exp2( vec2( roughnesslevel, miplevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powscale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipoffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bres = miplevel == 0.0;\n\tscale = bres && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getfacefromdirection(direction);\n\tfloat rcppowscale = 1.0 / powscale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipoffset,0.75 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipoffset, 0.75 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipoffset, 0.75 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipoffset,0.5 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipoffset, 0.5 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipoffset, 0.5 * rcppowscale);\n\t\toffset.y = bres && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texeloffset = 0.5 * cubeuv_rcptexturesize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texeloffset );\n\treturn base + s * ( scale - 2.0 * texeloffset );\n}\n#define cubeuv_maxlods3 (log2(cubeuv_texturesize*0.25) - 3.0)\nvec4 texturecubeuv(vec3 reflecteddirection, float roughness ) {\n\tfloat roughnessval = roughness* cubeuv_maxlods3;\n\tfloat r1 = floor(roughnessval);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessval);\n\tvec2 mipinfo = miplevelinfo(reflecteddirection, r1, roughness);\n\tfloat s = mipinfo.y;\n\tfloat level0 = mipinfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getcubeuv(reflecteddirection, r1, level0);\n\tvec4 color10 = envmaptexeltolinear(texture2d(envmap, uv_10));\n\tvec2 uv_20 = getcubeuv(reflecteddirection, r2, level0);\n\tvec4 color20 = envmaptexeltolinear(texture2d(envmap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", defaultnormal_vertex:"#ifdef flip_sided\n\tobjectnormal = -objectnormal;\n#endif\nvec3 transformednormal = normalmatrix * objectnormal;\n",displacementmap_pars_vertex:"#ifdef use_displacementmap\n\tuniform sampler2d displacementmap;\n\tuniform float displacementscale;\n\tuniform float displacementbias;\n#endif\n",displacementmap_vertex:"#ifdef use_displacementmap\n\ttransformed += normal * ( texture2d( displacementmap, uv ).x * displacementscale + displacementbias );\n#endif\n",emissivemap_fragment:"#ifdef use_emissivemap\n\tvec4 emissivecolor = texture2d( emissivemap, vuv );\n\temissivecolor.rgb = emissivemaptexeltolinear( emissivecolor ).rgb;\n\ttotalemissiveradiance *= emissivecolor.rgb;\n#endif\n", emissivemap_pars_fragment:"#ifdef use_emissivemap\n\tuniform sampler2d emissivemap;\n#endif\n",encodings_fragment:" gl_fragcolor = lineartooutputtexel( gl_fragcolor );\n",encodings_pars_fragment:"\nvec4 lineartolinear( in vec4 value ) {\n\treturn value;\n}\nvec4 gammatolinear( in vec4 value, in float gammafactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammafactor ) ), value.w );\n}\nvec4 lineartogamma( in vec4 value, in float gammafactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammafactor ) ), value.w );\n}\nvec4 srgbtolinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessthanequal( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 lineartosrgb( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessthanequal( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 rgbetolinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 lineartorgbe( in vec4 value ) {\n\tfloat maxcomponent = max( max( value.r, value.g ), value.b );\n\tfloat fexp = clamp( ceil( log2( maxcomponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fexp ), ( fexp + 128.0 ) / 255.0 );\n}\nvec4 rgbmtolinear( in vec4 value, in float maxrange ) {\n\treturn vec4( value.xyz * value.w * maxrange, 1.0 );\n}\nvec4 lineartorgbm( in vec4 value, in float maxrange ) {\n\tfloat maxrgb = max( value.x, max( value.g, value.b ) );\n\tfloat m = clamp( maxrgb / maxrange, 0.0, 1.0 );\n\tm = ceil( m * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( m * maxrange ), m );\n}\nvec4 rgbdtolinear( in vec4 value, in float maxrange ) {\n\treturn vec4( value.rgb * ( ( maxrange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 lineartorgbd( in vec4 value, in float maxrange ) {\n\tfloat maxrgb = max( value.x, max( value.g, value.b ) );\n\tfloat d = max( maxrange / maxrgb, 1.0 );\n\td = min( floor( d ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( d * ( 255.0 / maxrange ) ), d );\n}\nconst mat3 clogluvm = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 lineartologluv( in vec4 value ) {\n\tvec3 xp_y_xyzp = value.rgb * clogluvm;\n\txp_y_xyzp = max(xp_y_xyzp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vresult;\n\tvresult.xy = xp_y_xyzp.xy / xp_y_xyzp.z;\n\tfloat le = 2.0 * log2(xp_y_xyzp.y) + 127.0;\n\tvresult.w = fract(le);\n\tvresult.z = (le - (floor(vresult.w*255.0))/255.0)/255.0;\n\treturn vresult;\n}\nconst mat3 clogluvinversem = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 logluvtolinear( in vec4 value ) {\n\tfloat le = value.z * 255.0 + value.w;\n\tvec3 xp_y_xyzp;\n\txp_y_xyzp.y = exp2((le - 127.0) / 2.0);\n\txp_y_xyzp.z = xp_y_xyzp.y / value.y;\n\txp_y_xyzp.x = value.x * xp_y_xyzp.z;\n\tvec3 vrgb = xp_y_xyzp.rgb * clogluvinversem;\n\treturn vec4( max(vrgb, 0.0), 1.0 );\n}\n", envmap_fragment:"#ifdef use_envmap\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong )\n\t\tvec3 cameratovertex = normalize( vworldposition - cameraposition );\n\t\tvec3 worldnormal = inversetransformdirection( normal, viewmatrix );\n\t\t#ifdef envmap_mode_reflection\n\t\t\tvec3 reflectvec = reflect( cameratovertex, worldnormal );\n\t\t#else\n\t\t\tvec3 reflectvec = refract( cameratovertex, worldnormal, refractionratio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectvec = vreflect;\n\t#endif\n\t#ifdef envmap_type_cube\n\t\tvec4 envcolor = texturecube( envmap, flipnormal * vec3( flipenvmap * reflectvec.x, reflectvec.yz ) );\n\t#elif defined( envmap_type_equirec )\n\t\tvec2 sampleuv;\n\t\tsampleuv.y = saturate( flipnormal * reflectvec.y * 0.5 + 0.5 );\n\t\tsampleuv.x = atan( flipnormal * reflectvec.z, flipnormal * reflectvec.x ) * reciprocal_pi2 + 0.5;\n\t\tvec4 envcolor = texture2d( envmap, sampleuv );\n\t#elif defined( envmap_type_sphere )\n\t\tvec3 reflectview = flipnormal * normalize( ( viewmatrix * vec4( reflectvec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envcolor = texture2d( envmap, reflectview.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envcolor = vec4( 0.0 );\n\t#endif\n\tenvcolor = envmaptexeltolinear( envcolor );\n\t#ifdef envmap_blending_multiply\n\t\toutgoinglight = mix( outgoinglight, outgoinglight * envcolor.xyz, specularstrength * reflectivity );\n\t#elif defined( envmap_blending_mix )\n\t\toutgoinglight = mix( outgoinglight, envcolor.xyz, specularstrength * reflectivity );\n\t#elif defined( envmap_blending_add )\n\t\toutgoinglight += envcolor.xyz * specularstrength * reflectivity;\n\t#endif\n#endif\n", envmap_pars_fragment:"#if defined( use_envmap ) || defined( physical )\n\tuniform float reflectivity;\n\tuniform float envmapintensity;\n#endif\n#ifdef use_envmap\n\t#if ! defined( physical ) && ( defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong ) )\n\t\tvarying vec3 vworldposition;\n\t#endif\n\t#ifdef envmap_type_cube\n\t\tuniform samplercube envmap;\n\t#else\n\t\tuniform sampler2d envmap;\n\t#endif\n\tuniform float flipenvmap;\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong ) || defined( physical )\n\t\tuniform float refractionratio;\n\t#else\n\t\tvarying vec3 vreflect;\n\t#endif\n#endif\n", envmap_pars_vertex:"#ifdef use_envmap\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong )\n\t\tvarying vec3 vworldposition;\n\t#else\n\t\tvarying vec3 vreflect;\n\t\tuniform float refractionratio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef use_envmap\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong )\n\t\tvworldposition = worldposition.xyz;\n\t#else\n\t\tvec3 cameratovertex = normalize( worldposition.xyz - cameraposition );\n\t\tvec3 worldnormal = inversetransformdirection( transformednormal, viewmatrix );\n\t\t#ifdef envmap_mode_reflection\n\t\t\tvreflect = reflect( cameratovertex, worldnormal );\n\t\t#else\n\t\t\tvreflect = refract( cameratovertex, worldnormal, refractionratio );\n\t\t#endif\n\t#endif\n#endif\n", fog_vertex:"\n#ifdef use_fog\nfogdepth = -mvposition.z;\n#endif",fog_pars_vertex:"#ifdef use_fog\n varying float fogdepth;\n#endif\n",fog_fragment:"#ifdef use_fog\n\t#ifdef fog_exp2\n\t\tfloat fogfactor = whitecompliment( exp2( - fogdensity * fogdensity * fogdepth * fogdepth * log2 ) );\n\t#else\n\t\tfloat fogfactor = smoothstep( fognear, fogfar, fogdepth );\n\t#endif\n\tgl_fragcolor.rgb = mix( gl_fragcolor.rgb, fogcolor, fogfactor );\n#endif\n",fog_pars_fragment:"#ifdef use_fog\n\tuniform vec3 fogcolor;\n\tvarying float fogdepth;\n\t#ifdef fog_exp2\n\t\tuniform float fogdensity;\n\t#else\n\t\tuniform float fognear;\n\t\tuniform float fogfar;\n\t#endif\n#endif\n", gradientmap_pars_fragment:"#ifdef toon\n\tuniform sampler2d gradientmap;\n\tvec3 getgradientirradiance( vec3 normal, vec3 lightdirection ) {\n\t\tfloat dotnl = dot( normal, lightdirection );\n\t\tvec2 coord = vec2( dotnl * 0.5 + 0.5, 0.0 );\n\t\t#ifdef use_gradientmap\n\t\t\treturn texture2d( gradientmap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef use_lightmap\n\treflectedlight.indirectdiffuse += pi * texture2d( lightmap, vuv2 ).xyz * lightmapintensity;\n#endif\n", lightmap_pars_fragment:"#ifdef use_lightmap\n\tuniform sampler2d lightmap;\n\tuniform float lightmapintensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\ngeometriccontext geometry;\ngeometry.position = mvposition.xyz;\ngeometry.normal = normalize( transformednormal );\ngeometry.viewdir = normalize( -mvposition.xyz );\ngeometriccontext backgeometry;\nbackgeometry.position = geometry.position;\nbackgeometry.normal = -geometry.normal;\nbackgeometry.viewdir = geometry.viewdir;\nvlightfront = vec3( 0.0 );\n#ifdef double_sided\n\tvlightback = vec3( 0.0 );\n#endif\nincidentlight directlight;\nfloat dotnl;\nvec3 directlightcolor_diffuse;\n#if num_point_lights > 0\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tgetpointdirectlightirradiance( pointlights[ i ], geometry, directlight );\n\t\tdotnl = dot( geometry.normal, directlight.direction );\n\t\tdirectlightcolor_diffuse = pi * directlight.color;\n\t\tvlightfront += saturate( dotnl ) * directlightcolor_diffuse;\n\t\t#ifdef double_sided\n\t\t\tvlightback += saturate( -dotnl ) * directlightcolor_diffuse;\n\t\t#endif\n\t}\n#endif\n#if num_spot_lights > 0\n\tfor ( int i = 0; i < num_spot_lights; i ++ ) {\n\t\tgetspotdirectlightirradiance( spotlights[ i ], geometry, directlight );\n\t\tdotnl = dot( geometry.normal, directlight.direction );\n\t\tdirectlightcolor_diffuse = pi * directlight.color;\n\t\tvlightfront += saturate( dotnl ) * directlightcolor_diffuse;\n\t\t#ifdef double_sided\n\t\t\tvlightback += saturate( -dotnl ) * directlightcolor_diffuse;\n\t\t#endif\n\t}\n#endif\n#if num_dir_lights > 0\n\tfor ( int i = 0; i < num_dir_lights; i ++ ) {\n\t\tgetdirectionaldirectlightirradiance( directionallights[ i ], geometry, directlight );\n\t\tdotnl = dot( geometry.normal, directlight.direction );\n\t\tdirectlightcolor_diffuse = pi * directlight.color;\n\t\tvlightfront += saturate( dotnl ) * directlightcolor_diffuse;\n\t\t#ifdef double_sided\n\t\t\tvlightback += saturate( -dotnl ) * directlightcolor_diffuse;\n\t\t#endif\n\t}\n#endif\n#if num_hemi_lights > 0\n\tfor ( int i = 0; i < num_hemi_lights; i ++ ) {\n\t\tvlightfront += gethemispherelightirradiance( hemispherelights[ i ], geometry );\n\t\t#ifdef double_sided\n\t\t\tvlightback += gethemispherelightirradiance( hemispherelights[ i ], backgeometry );\n\t\t#endif\n\t}\n#endif\n", lights_pars:"uniform vec3 ambientlightcolor;\nvec3 getambientlightirradiance( const in vec3 ambientlightcolor ) {\n\tvec3 irradiance = ambientlightcolor;\n\t#ifndef physically_correct_lights\n\t\tirradiance *= pi;\n\t#endif\n\treturn irradiance;\n}\n#if num_dir_lights > 0\n\tstruct directionallight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowbias;\n\t\tfloat shadowradius;\n\t\tvec2 shadowmapsize;\n\t};\n\tuniform directionallight directionallights[ num_dir_lights ];\n\tvoid getdirectionaldirectlightirradiance( const in directionallight directionallight, const in geometriccontext geometry, out incidentlight directlight ) {\n\t\tdirectlight.color = directionallight.color;\n\t\tdirectlight.direction = directionallight.direction;\n\t\tdirectlight.visible = true;\n\t}\n#endif\n#if num_point_lights > 0\n\tstruct pointlight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowbias;\n\t\tfloat shadowradius;\n\t\tvec2 shadowmapsize;\n\t};\n\tuniform pointlight pointlights[ num_point_lights ];\n\tvoid getpointdirectlightirradiance( const in pointlight pointlight, const in geometriccontext geometry, out incidentlight directlight ) {\n\t\tvec3 lvector = pointlight.position - geometry.position;\n\t\tdirectlight.direction = normalize( lvector );\n\t\tfloat lightdistance = length( lvector );\n\t\tdirectlight.color = pointlight.color;\n\t\tdirectlight.color *= punctuallightintensitytoirradiancefactor( lightdistance, pointlight.distance, pointlight.decay );\n\t\tdirectlight.visible = ( directlight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if num_spot_lights > 0\n\tstruct spotlight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat conecos;\n\t\tfloat penumbracos;\n\t\tint shadow;\n\t\tfloat shadowbias;\n\t\tfloat shadowradius;\n\t\tvec2 shadowmapsize;\n\t};\n\tuniform spotlight spotlights[ num_spot_lights ];\n\tvoid getspotdirectlightirradiance( const in spotlight spotlight, const in geometriccontext geometry, out incidentlight directlight ) {\n\t\tvec3 lvector = spotlight.position - geometry.position;\n\t\tdirectlight.direction = normalize( lvector );\n\t\tfloat lightdistance = length( lvector );\n\t\tfloat anglecos = dot( directlight.direction, spotlight.direction );\n\t\tif ( anglecos > spotlight.conecos ) {\n\t\t\tfloat spoteffect = smoothstep( spotlight.conecos, spotlight.penumbracos, anglecos );\n\t\t\tdirectlight.color = spotlight.color;\n\t\t\tdirectlight.color *= spoteffect * punctuallightintensitytoirradiancefactor( lightdistance, spotlight.distance, spotlight.decay );\n\t\t\tdirectlight.visible = true;\n\t\t} else {\n\t\t\tdirectlight.color = vec3( 0.0 );\n\t\t\tdirectlight.visible = false;\n\t\t}\n\t}\n#endif\n#if num_rect_area_lights > 0\n\tstruct rectarealight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfwidth;\n\t\tvec3 halfheight;\n\t};\n\tuniform sampler2d ltcmat;\tuniform sampler2d ltcmag;\n\tuniform rectarealight rectarealights[ num_rect_area_lights ];\n#endif\n#if num_hemi_lights > 0\n\tstruct hemispherelight {\n\t\tvec3 direction;\n\t\tvec3 skycolor;\n\t\tvec3 groundcolor;\n\t};\n\tuniform hemispherelight hemispherelights[ num_hemi_lights ];\n\tvec3 gethemispherelightirradiance( const in hemispherelight hemilight, const in geometriccontext geometry ) {\n\t\tfloat dotnl = dot( geometry.normal, hemilight.direction );\n\t\tfloat hemidiffuseweight = 0.5 * dotnl + 0.5;\n\t\tvec3 irradiance = mix( hemilight.groundcolor, hemilight.skycolor, hemidiffuseweight );\n\t\t#ifndef physically_correct_lights\n\t\t\tirradiance *= pi;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( use_envmap ) && defined( physical )\n\tvec3 getlightprobeindirectirradiance( const in geometriccontext geometry, const in int maxmiplevel ) {\n\t\tvec3 worldnormal = inversetransformdirection( geometry.normal, viewmatrix );\n\t\t#ifdef envmap_type_cube\n\t\t\tvec3 queryvec = vec3( flipenvmap * worldnormal.x, worldnormal.yz );\n\t\t\t#ifdef texture_lod_ext\n\t\t\t\tvec4 envmapcolor = texturecubelodext( envmap, queryvec, float( maxmiplevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envmapcolor = texturecube( envmap, queryvec, float( maxmiplevel ) );\n\t\t\t#endif\n\t\t\tenvmapcolor.rgb = envmaptexeltolinear( envmapcolor ).rgb;\n\t\t#elif defined( envmap_type_cube_uv )\n\t\t\tvec3 queryvec = vec3( flipenvmap * worldnormal.x, worldnormal.yz );\n\t\t\tvec4 envmapcolor = texturecubeuv( queryvec, 1.0 );\n\t\t#else\n\t\t\tvec4 envmapcolor = vec4( 0.0 );\n\t\t#endif\n\t\treturn pi * envmapcolor.rgb * envmapintensity;\n\t}\n\tfloat getspecularmiplevel( const in float blinnshininessexponent, const in int maxmiplevel ) {\n\t\tfloat maxmiplevelscalar = float( maxmiplevel );\n\t\tfloat desiredmiplevel = maxmiplevelscalar - 0.79248 - 0.5 * log2( pow2( blinnshininessexponent ) + 1.0 );\n\t\treturn clamp( desiredmiplevel, 0.0, maxmiplevelscalar );\n\t}\n\tvec3 getlightprobeindirectradiance( const in geometriccontext geometry, const in float blinnshininessexponent, const in int maxmiplevel ) {\n\t\t#ifdef envmap_mode_reflection\n\t\t\tvec3 reflectvec = reflect( -geometry.viewdir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectvec = refract( -geometry.viewdir, geometry.normal, refractionratio );\n\t\t#endif\n\t\treflectvec = inversetransformdirection( reflectvec, viewmatrix );\n\t\tfloat specularmiplevel = getspecularmiplevel( blinnshininessexponent, maxmiplevel );\n\t\t#ifdef envmap_type_cube\n\t\t\tvec3 queryreflectvec = vec3( flipenvmap * reflectvec.x, reflectvec.yz );\n\t\t\t#ifdef texture_lod_ext\n\t\t\t\tvec4 envmapcolor = texturecubelodext( envmap, queryreflectvec, specularmiplevel );\n\t\t\t#else\n\t\t\t\tvec4 envmapcolor = texturecube( envmap, queryreflectvec, specularmiplevel );\n\t\t\t#endif\n\t\t\tenvmapcolor.rgb = envmaptexeltolinear( envmapcolor ).rgb;\n\t\t#elif defined( envmap_type_cube_uv )\n\t\t\tvec3 queryreflectvec = vec3( flipenvmap * reflectvec.x, reflectvec.yz );\n\t\t\tvec4 envmapcolor = texturecubeuv(queryreflectvec, blinnexponenttoggxroughness(blinnshininessexponent));\n\t\t#elif defined( envmap_type_equirec )\n\t\t\tvec2 sampleuv;\n\t\t\tsampleuv.y = saturate( reflectvec.y * 0.5 + 0.5 );\n\t\t\tsampleuv.x = atan( reflectvec.z, reflectvec.x ) * reciprocal_pi2 + 0.5;\n\t\t\t#ifdef texture_lod_ext\n\t\t\t\tvec4 envmapcolor = texture2dlodext( envmap, sampleuv, specularmiplevel );\n\t\t\t#else\n\t\t\t\tvec4 envmapcolor = texture2d( envmap, sampleuv, specularmiplevel );\n\t\t\t#endif\n\t\t\tenvmapcolor.rgb = envmaptexeltolinear( envmapcolor ).rgb;\n\t\t#elif defined( envmap_type_sphere )\n\t\t\tvec3 reflectview = normalize( ( viewmatrix * vec4( reflectvec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef texture_lod_ext\n\t\t\t\tvec4 envmapcolor = texture2dlodext( envmap, reflectview.xy * 0.5 + 0.5, specularmiplevel );\n\t\t\t#else\n\t\t\t\tvec4 envmapcolor = texture2d( envmap, reflectview.xy * 0.5 + 0.5, specularmiplevel );\n\t\t\t#endif\n\t\t\tenvmapcolor.rgb = envmaptexeltolinear( envmapcolor ).rgb;\n\t\t#endif\n\t\treturn envmapcolor.rgb * envmapintensity;\n\t}\n#endif\n", lights_phong_fragment:"blinnphongmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb;\nmaterial.specularcolor = specular;\nmaterial.specularshininess = shininess;\nmaterial.specularstrength = specularstrength;\n",lights_phong_pars_fragment:"varying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\nstruct blinnphongmaterial {\n\tvec3\tdiffusecolor;\n\tvec3\tspecularcolor;\n\tfloat\tspecularshininess;\n\tfloat\tspecularstrength;\n};\n#if num_rect_area_lights > 0\n\tvoid re_direct_rectarea_blinnphong( const in rectarealight rectarealight, const in geometriccontext geometry, const in blinnphongmaterial material, inout reflectedlight reflectedlight ) {\n\t\tvec3 matdiffcolor = material.diffusecolor;\n\t\tvec3 matspeccolor = material.specularcolor;\n\t\tvec3 lightcolor = rectarealight.color;\n\t\tfloat roughness = blinnexponenttoggxroughness( material.specularshininess );\n\t\tvec3 spec = rect_area_light_specular_reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectarealight.position, rectarealight.halfwidth, rectarealight.halfheight,\n\t\t\t\troughness,\n\t\t\t\tltcmat, ltcmag );\n\t\tvec3 diff = rect_area_light_diffuse_reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectarealight.position, rectarealight.halfwidth, rectarealight.halfheight );\n\t\treflectedlight.directspecular += lightcolor * matspeccolor * spec / pi2;\n\t\treflectedlight.directdiffuse += lightcolor * matdiffcolor * diff / pi2;\n\t}\n#endif\nvoid re_direct_blinnphong( const in incidentlight directlight, const in geometriccontext geometry, const in blinnphongmaterial material, inout reflectedlight reflectedlight ) {\n\t#ifdef toon\n\t\tvec3 irradiance = getgradientirradiance( geometry.normal, directlight.direction ) * directlight.color;\n\t#else\n\t\tfloat dotnl = saturate( dot( geometry.normal, directlight.direction ) );\n\t\tvec3 irradiance = dotnl * directlight.color;\n\t#endif\n\t#ifndef physically_correct_lights\n\t\tirradiance *= pi;\n\t#endif\n\treflectedlight.directdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n\treflectedlight.directspecular += irradiance * brdf_specular_blinnphong( directlight, geometry, material.specularcolor, material.specularshininess ) * material.specularstrength;\n}\nvoid re_indirectdiffuse_blinnphong( const in vec3 irradiance, const in geometriccontext geometry, const in blinnphongmaterial material, inout reflectedlight reflectedlight ) {\n\treflectedlight.indirectdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n}\n#define re_direct\t\t\t\tre_direct_blinnphong\n#define re_direct_rectarea\t\tre_direct_rectarea_blinnphong\n#define re_indirectdiffuse\t\tre_indirectdiffuse_blinnphong\n#define material_lightprobelod( material )\t(0)\n", lights_physical_fragment:"physicalmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb * ( 1.0 - metalnessfactor );\nmaterial.specularroughness = clamp( roughnessfactor, 0.04, 1.0 );\n#ifdef standard\n\tmaterial.specularcolor = mix( vec3( default_specular_coefficient ), diffusecolor.rgb, metalnessfactor );\n#else\n\tmaterial.specularcolor = mix( vec3( maximum_specular_coefficient * pow2( reflectivity ) ), diffusecolor.rgb, metalnessfactor );\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatroughness = clamp( clearcoatroughness, 0.04, 1.0 );\n#endif\n", lights_physical_pars_fragment:"struct physicalmaterial {\n\tvec3\tdiffusecolor;\n\tfloat\tspecularroughness;\n\tvec3\tspecularcolor;\n\t#ifndef standard\n\t\tfloat clearcoat;\n\t\tfloat clearcoatroughness;\n\t#endif\n};\n#define maximum_specular_coefficient 0.16\n#define default_specular_coefficient 0.04\nfloat clearcoatdhrapprox( const in float roughness, const in float dotnl ) {\n\treturn default_specular_coefficient + ( 1.0 - default_specular_coefficient ) * ( pow( 1.0 - dotnl, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if num_rect_area_lights > 0\n\tvoid re_direct_rectarea_physical( const in rectarealight rectarealight, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight ) {\n\t\tvec3 matdiffcolor = material.diffusecolor;\n\t\tvec3 matspeccolor = material.specularcolor;\n\t\tvec3 lightcolor = rectarealight.color;\n\t\tfloat roughness = material.specularroughness;\n\t\tvec3 spec = rect_area_light_specular_reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectarealight.position, rectarealight.halfwidth, rectarealight.halfheight,\n\t\t\t\troughness,\n\t\t\t\tltcmat, ltcmag );\n\t\tvec3 diff = rect_area_light_diffuse_reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectarealight.position, rectarealight.halfwidth, rectarealight.halfheight );\n\t\treflectedlight.directspecular += lightcolor * matspeccolor * spec;\n\t\treflectedlight.directdiffuse += lightcolor * matdiffcolor * diff;\n\t}\n#endif\nvoid re_direct_physical( const in incidentlight directlight, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight ) {\n\tfloat dotnl = saturate( dot( geometry.normal, directlight.direction ) );\n\tvec3 irradiance = dotnl * directlight.color;\n\t#ifndef physically_correct_lights\n\t\tirradiance *= pi;\n\t#endif\n\t#ifndef standard\n\t\tfloat clearcoatdhr = material.clearcoat * clearcoatdhrapprox( material.clearcoatroughness, dotnl );\n\t#else\n\t\tfloat clearcoatdhr = 0.0;\n\t#endif\n\treflectedlight.directspecular += ( 1.0 - clearcoatdhr ) * irradiance * brdf_specular_ggx( directlight, geometry, material.specularcolor, material.specularroughness );\n\treflectedlight.directdiffuse += ( 1.0 - clearcoatdhr ) * irradiance * brdf_diffuse_lambert( material.diffusecolor );\n\t#ifndef standard\n\t\treflectedlight.directspecular += irradiance * material.clearcoat * brdf_specular_ggx( directlight, geometry, vec3( default_specular_coefficient ), material.clearcoatroughness );\n\t#endif\n}\nvoid re_indirectdiffuse_physical( const in vec3 irradiance, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight ) {\n\treflectedlight.indirectdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n}\nvoid re_indirectspecular_physical( const in vec3 radiance, const in vec3 clearcoatradiance, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight ) {\n\t#ifndef standard\n\t\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\t\tfloat dotnl = dotnv;\n\t\tfloat clearcoatdhr = material.clearcoat * clearcoatdhrapprox( material.clearcoatroughness, dotnl );\n\t#else\n\t\tfloat clearcoatdhr = 0.0;\n\t#endif\n\treflectedlight.indirectspecular += ( 1.0 - clearcoatdhr ) * radiance * brdf_specular_ggx_environment( geometry, material.specularcolor, material.specularroughness );\n\t#ifndef standard\n\t\treflectedlight.indirectspecular += clearcoatradiance * material.clearcoat * brdf_specular_ggx_environment( geometry, vec3( default_specular_coefficient ), material.clearcoatroughness );\n\t#endif\n}\n#define re_direct\t\t\t\tre_direct_physical\n#define re_direct_rectarea\t\tre_direct_rectarea_physical\n#define re_indirectdiffuse\t\tre_indirectdiffuse_physical\n#define re_indirectspecular\t\tre_indirectspecular_physical\n#define material_blinnshininessexponent( material ) ggxroughnesstoblinnexponent( material.specularroughness )\n#define material_clearcoat_blinnshininessexponent( material ) ggxroughnesstoblinnexponent( material.clearcoatroughness )\nfloat computespecularocclusion( const in float dotnv, const in float ambientocclusion, const in float roughness ) {\n\treturn saturate( pow( dotnv + ambientocclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientocclusion );\n}\n", lights_template:"\ngeometriccontext geometry;\ngeometry.position = - vviewposition;\ngeometry.normal = normal;\ngeometry.viewdir = normalize( vviewposition );\nincidentlight directlight;\n#if ( num_point_lights > 0 ) && defined( re_direct )\n\tpointlight pointlight;\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tpointlight = pointlights[ i ];\n\t\tgetpointdirectlightirradiance( pointlight, geometry, directlight );\n\t\t#ifdef use_shadowmap\n\t\tdirectlight.color *= all( bvec2( pointlight.shadow, directlight.visible ) ) ? getpointshadow( pointshadowmap[ i ], pointlight.shadowmapsize, pointlight.shadowbias, pointlight.shadowradius, vpointshadowcoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n#endif\n#if ( num_spot_lights > 0 ) && defined( re_direct )\n\tspotlight spotlight;\n\tfor ( int i = 0; i < num_spot_lights; i ++ ) {\n\t\tspotlight = spotlights[ i ];\n\t\tgetspotdirectlightirradiance( spotlight, geometry, directlight );\n\t\t#ifdef use_shadowmap\n\t\tdirectlight.color *= all( bvec2( spotlight.shadow, directlight.visible ) ) ? getshadow( spotshadowmap[ i ], spotlight.shadowmapsize, spotlight.shadowbias, spotlight.shadowradius, vspotshadowcoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n#endif\n#if ( num_dir_lights > 0 ) && defined( re_direct )\n\tdirectionallight directionallight;\n\tfor ( int i = 0; i < num_dir_lights; i ++ ) {\n\t\tdirectionallight = directionallights[ i ];\n\t\tgetdirectionaldirectlightirradiance( directionallight, geometry, directlight );\n\t\t#ifdef use_shadowmap\n\t\tdirectlight.color *= all( bvec2( directionallight.shadow, directlight.visible ) ) ? getshadow( directionalshadowmap[ i ], directionallight.shadowmapsize, directionallight.shadowbias, directionallight.shadowradius, vdirectionalshadowcoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n#endif\n#if ( num_rect_area_lights > 0 ) && defined( re_direct_rectarea )\n\trectarealight rectarealight;\n\tfor ( int i = 0; i < num_rect_area_lights; i ++ ) {\n\t\trectarealight = rectarealights[ i ];\n\t\tre_direct_rectarea( rectarealight, geometry, material, reflectedlight );\n\t}\n#endif\n#if defined( re_indirectdiffuse )\n\tvec3 irradiance = getambientlightirradiance( ambientlightcolor );\n\t#ifdef use_lightmap\n\t\tvec3 lightmapirradiance = texture2d( lightmap, vuv2 ).xyz * lightmapintensity;\n\t\t#ifndef physically_correct_lights\n\t\t\tlightmapirradiance *= pi;\n\t\t#endif\n\t\tirradiance += lightmapirradiance;\n\t#endif\n\t#if ( num_hemi_lights > 0 )\n\t\tfor ( int i = 0; i < num_hemi_lights; i ++ ) {\n\t\t\tirradiance += gethemispherelightirradiance( hemispherelights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( use_envmap ) && defined( physical ) && defined( envmap_type_cube_uv )\n\t\tirradiance += getlightprobeindirectirradiance( geometry, 8 );\n\t#endif\n\tre_indirectdiffuse( irradiance, geometry, material, reflectedlight );\n#endif\n#if defined( use_envmap ) && defined( re_indirectspecular )\n\tvec3 radiance = getlightprobeindirectradiance( geometry, material_blinnshininessexponent( material ), 8 );\n\t#ifndef standard\n\t\tvec3 clearcoatradiance = getlightprobeindirectradiance( geometry, material_clearcoat_blinnshininessexponent( material ), 8 );\n\t#else\n\t\tvec3 clearcoatradiance = vec3( 0.0 );\n\t#endif\n\tre_indirectspecular( radiance, clearcoatradiance, geometry, material, reflectedlight );\n#endif\n", logdepthbuf_fragment:"#if defined(use_logdepthbuf) && defined(use_logdepthbuf_ext)\n\tgl_fragdepthext = log2(vfragdepth) * logdepthbuffc * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef use_logdepthbuf\n\tuniform float logdepthbuffc;\n\t#ifdef use_logdepthbuf_ext\n\t\tvarying float vfragdepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef use_logdepthbuf\n\t#ifdef use_logdepthbuf_ext\n\t\tvarying float vfragdepth;\n\t#endif\n\tuniform float logdepthbuffc;\n#endif",logdepthbuf_vertex:"#ifdef use_logdepthbuf\n\tgl_position.z = log2(max( epsilon, gl_position.w + 1.0 )) * logdepthbuffc;\n\t#ifdef use_logdepthbuf_ext\n\t\tvfragdepth = 1.0 + gl_position.w;\n\t#else\n\t\tgl_position.z = (gl_position.z - 1.0) * gl_position.w;\n\t#endif\n#endif\n", map_fragment:"#ifdef use_map\n\tvec4 texelcolor = texture2d( map, vuv );\n\ttexelcolor = maptexeltolinear( texelcolor );\n\tdiffusecolor *= texelcolor;\n#endif\n",map_pars_fragment:"#ifdef use_map\n\tuniform sampler2d map;\n#endif\n",map_particle_fragment:"#ifdef use_map\n\tvec4 maptexel = texture2d( map, vec2( gl_pointcoord.x, 1.0 - gl_pointcoord.y ) * offsetrepeat.zw + offsetrepeat.xy );\n\tdiffusecolor *= maptexeltolinear( maptexel );\n#endif\n",map_particle_pars_fragment:"#ifdef use_map\n\tuniform vec4 offsetrepeat;\n\tuniform sampler2d map;\n#endif\n", metalnessmap_fragment:"float metalnessfactor = metalness;\n#ifdef use_metalnessmap\n\tvec4 texelmetalness = texture2d( metalnessmap, vuv );\n\tmetalnessfactor *= texelmetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef use_metalnessmap\n\tuniform sampler2d metalnessmap;\n#endif",morphnormal_vertex:"#ifdef use_morphnormals\n\tobjectnormal += ( morphnormal0 - normal ) * morphtargetinfluences[ 0 ];\n\tobjectnormal += ( morphnormal1 - normal ) * morphtargetinfluences[ 1 ];\n\tobjectnormal += ( morphnormal2 - normal ) * morphtargetinfluences[ 2 ];\n\tobjectnormal += ( morphnormal3 - normal ) * morphtargetinfluences[ 3 ];\n#endif\n", morphtarget_pars_vertex:"#ifdef use_morphtargets\n\t#ifndef use_morphnormals\n\tuniform float morphtargetinfluences[ 8 ];\n\t#else\n\tuniform float morphtargetinfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef use_morphtargets\n\ttransformed += ( morphtarget0 - position ) * morphtargetinfluences[ 0 ];\n\ttransformed += ( morphtarget1 - position ) * morphtargetinfluences[ 1 ];\n\ttransformed += ( morphtarget2 - position ) * morphtargetinfluences[ 2 ];\n\ttransformed += ( morphtarget3 - position ) * morphtargetinfluences[ 3 ];\n\t#ifndef use_morphnormals\n\ttransformed += ( morphtarget4 - position ) * morphtargetinfluences[ 4 ];\n\ttransformed += ( morphtarget5 - position ) * morphtargetinfluences[ 5 ];\n\ttransformed += ( morphtarget6 - position ) * morphtargetinfluences[ 6 ];\n\ttransformed += ( morphtarget7 - position ) * morphtargetinfluences[ 7 ];\n\t#endif\n#endif\n", normal_flip:"#ifdef double_sided\n\tfloat flipnormal = ( float( gl_frontfacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipnormal = 1.0;\n#endif\n",normal_fragment:"#ifdef flat_shaded\n\tvec3 fdx = vec3( dfdx( vviewposition.x ), dfdx( vviewposition.y ), dfdx( vviewposition.z ) );\n\tvec3 fdy = vec3( dfdy( vviewposition.x ), dfdy( vviewposition.y ), dfdy( vviewposition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vnormal ) * flipnormal;\n#endif\n#ifdef use_normalmap\n\tnormal = perturbnormal2arb( -vviewposition, normal );\n#elif defined( use_bumpmap )\n\tnormal = perturbnormalarb( -vviewposition, normal, dhdxy_fwd() );\n#endif\n", normalmap_pars_fragment:"#ifdef use_normalmap\n\tuniform sampler2d normalmap;\n\tuniform vec2 normalscale;\n\tvec3 perturbnormal2arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dfdx( eye_pos.xyz );\n\t\tvec3 q1 = dfdy( eye_pos.xyz );\n\t\tvec2 st0 = dfdx( vuv.st );\n\t\tvec2 st1 = dfdy( vuv.st );\n\t\tvec3 s = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 t = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 n = normalize( surf_norm );\n\t\tvec3 mapn = texture2d( normalmap, vuv ).xyz * 2.0 - 1.0;\n\t\tmapn.xy = normalscale * mapn.xy;\n\t\tmat3 tsn = mat3( s, t, n );\n\t\treturn normalize( tsn * mapn );\n\t}\n#endif\n", packing:"vec3 packnormaltorgb( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackrgbtonormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float packupscale = 256. / 255.;const float unpackdownscale = 255. / 256.;\nconst vec3 packfactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 unpackfactors = unpackdownscale / vec4( packfactors, 1. );\nconst float shiftright8 = 1. / 256.;\nvec4 packdepthtorgba( const in float v ) {\n\tvec4 r = vec4( fract( v * packfactors ), v );\n\tr.yzw -= r.xyz * shiftright8;\treturn r * packupscale;\n}\nfloat unpackrgbatodepth( const in vec4 v ) {\n\treturn dot( v, unpackfactors );\n}\nfloat viewztoorthographicdepth( const in float viewz, const in float near, const in float far ) {\n\treturn ( viewz + near ) / ( near - far );\n}\nfloat orthographicdepthtoviewz( const in float linearclipz, const in float near, const in float far ) {\n\treturn linearclipz * ( near - far ) - near;\n}\nfloat viewztoperspectivedepth( const in float viewz, const in float near, const in float far ) {\n\treturn (( near + viewz ) * far ) / (( far - near ) * viewz );\n}\nfloat perspectivedepthtoviewz( const in float invclipz, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invclipz - far );\n}\n", premultiplied_alpha_fragment:"#ifdef premultiplied_alpha\n\tgl_fragcolor.rgb *= gl_fragcolor.a;\n#endif\n",project_vertex:"#ifdef use_skinning\n\tvec4 mvposition = modelviewmatrix * skinned;\n#else\n\tvec4 mvposition = modelviewmatrix * vec4( transformed, 1.0 );\n#endif\ngl_position = projectionmatrix * mvposition;\n",roughnessmap_fragment:"float roughnessfactor = roughness;\n#ifdef use_roughnessmap\n\tvec4 texelroughness = texture2d( roughnessmap, vuv );\n\troughnessfactor *= texelroughness.r;\n#endif\n", roughnessmap_pars_fragment:"#ifdef use_roughnessmap\n\tuniform sampler2d roughnessmap;\n#endif",shadowmap_pars_fragment:"#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\t\tuniform sampler2d directionalshadowmap[ num_dir_lights ];\n\t\tvarying vec4 vdirectionalshadowcoord[ num_dir_lights ];\n\t#endif\n\t#if num_spot_lights > 0\n\t\tuniform sampler2d spotshadowmap[ num_spot_lights ];\n\t\tvarying vec4 vspotshadowcoord[ num_spot_lights ];\n\t#endif\n\t#if num_point_lights > 0\n\t\tuniform sampler2d pointshadowmap[ num_point_lights ];\n\t\tvarying vec4 vpointshadowcoord[ num_point_lights ];\n\t#endif\n\tfloat texture2dcompare( sampler2d depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackrgbatodepth( texture2d( depths, uv ) ) );\n\t}\n\tfloat texture2dshadowlerp( sampler2d depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelsize = vec2( 1.0 ) / size;\n\t\tvec2 centroiduv = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2dcompare( depths, centroiduv + texelsize * offset.xx, compare );\n\t\tfloat lt = texture2dcompare( depths, centroiduv + texelsize * offset.xy, compare );\n\t\tfloat rb = texture2dcompare( depths, centroiduv + texelsize * offset.yx, compare );\n\t\tfloat rt = texture2dcompare( depths, centroiduv + texelsize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getshadow( sampler2d shadowmap, vec2 shadowmapsize, float shadowbias, float shadowradius, vec4 shadowcoord ) {\n\t\tshadowcoord.xyz /= shadowcoord.w;\n\t\tshadowcoord.z += shadowbias;\n\t\tbvec4 infrustumvec = bvec4 ( shadowcoord.x >= 0.0, shadowcoord.x <= 1.0, shadowcoord.y >= 0.0, shadowcoord.y <= 1.0 );\n\t\tbool infrustum = all( infrustumvec );\n\t\tbvec2 frustumtestvec = bvec2( infrustum, shadowcoord.z <= 1.0 );\n\t\tbool frustumtest = all( frustumtestvec );\n\t\tif ( frustumtest ) {\n\t\t#if defined( shadowmap_type_pcf )\n\t\t\tvec2 texelsize = vec2( 1.0 ) / shadowmapsize;\n\t\t\tfloat dx0 = - texelsize.x * shadowradius;\n\t\t\tfloat dy0 = - texelsize.y * shadowradius;\n\t\t\tfloat dx1 = + texelsize.x * shadowradius;\n\t\t\tfloat dy1 = + texelsize.y * shadowradius;\n\t\t\treturn (\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 0.0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx1, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx0, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy, shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx1, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx0, dy1 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 0.0, dy1 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx1, dy1 ), shadowcoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( shadowmap_type_pcf_soft )\n\t\t\tvec2 texelsize = vec2( 1.0 ) / shadowmapsize;\n\t\t\tfloat dx0 = - texelsize.x * shadowradius;\n\t\t\tfloat dy0 = - texelsize.y * shadowradius;\n\t\t\tfloat dx1 = + texelsize.x * shadowradius;\n\t\t\tfloat dy1 = + texelsize.y * shadowradius;\n\t\t\treturn (\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( 0.0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx1, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx0, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy, shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx1, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx0, dy1 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( 0.0, dy1 ), shadowcoord.z ) +\n\t\t\t\ttexture2dshadowlerp( shadowmap, shadowmapsize, shadowcoord.xy + vec2( dx1, dy1 ), shadowcoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2dcompare( shadowmap, shadowcoord.xy, shadowcoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubetouv( vec3 v, float texelsizey ) {\n\t\tvec3 absv = abs( v );\n\t\tfloat scaletocube = 1.0 / max( absv.x, max( absv.y, absv.z ) );\n\t\tabsv *= scaletocube;\n\t\tv *= scaletocube * ( 1.0 - 2.0 * texelsizey );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostatexel = 1.5 * texelsizey;\n\t\tfloat almostone = 1.0 - almostatexel;\n\t\tif ( absv.z >= almostone ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absv.x >= almostone ) {\n\t\t\tfloat signx = sign( v.x );\n\t\t\tplanar.x = v.z * signx + 2.0 * signx;\n\t\t} else if ( absv.y >= almostone ) {\n\t\t\tfloat signy = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signy + 2.0;\n\t\t\tplanar.y = v.z * signy - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getpointshadow( sampler2d shadowmap, vec2 shadowmapsize, float shadowbias, float shadowradius, vec4 shadowcoord ) {\n\t\tvec2 texelsize = vec2( 1.0 ) / ( shadowmapsize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lighttoposition = shadowcoord.xyz;\n\t\tvec3 bd3d = normalize( lighttoposition );\n\t\tfloat dp = ( length( lighttoposition ) - shadowbias ) / 1000.0;\n\t\t#if defined( shadowmap_type_pcf ) || defined( shadowmap_type_pcf_soft )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowradius * texelsize.y;\n\t\t\treturn (\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xyy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yyy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xyx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yyx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xxy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yxy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xxx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yxx, texelsize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2dcompare( shadowmap, cubetouv( bd3d, texelsize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", shadowmap_pars_vertex:"#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\t\tuniform mat4 directionalshadowmatrix[ num_dir_lights ];\n\t\tvarying vec4 vdirectionalshadowcoord[ num_dir_lights ];\n\t#endif\n\t#if num_spot_lights > 0\n\t\tuniform mat4 spotshadowmatrix[ num_spot_lights ];\n\t\tvarying vec4 vspotshadowcoord[ num_spot_lights ];\n\t#endif\n\t#if num_point_lights > 0\n\t\tuniform mat4 pointshadowmatrix[ num_point_lights ];\n\t\tvarying vec4 vpointshadowcoord[ num_point_lights ];\n\t#endif\n#endif\n", shadowmap_vertex:"#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\tfor ( int i = 0; i < num_dir_lights; i ++ ) {\n\t\tvdirectionalshadowcoord[ i ] = directionalshadowmatrix[ i ] * worldposition;\n\t}\n\t#endif\n\t#if num_spot_lights > 0\n\tfor ( int i = 0; i < num_spot_lights; i ++ ) {\n\t\tvspotshadowcoord[ i ] = spotshadowmatrix[ i ] * worldposition;\n\t}\n\t#endif\n\t#if num_point_lights > 0\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tvpointshadowcoord[ i ] = pointshadowmatrix[ i ] * worldposition;\n\t}\n\t#endif\n#endif\n", shadowmask_pars_fragment:"float getshadowmask() {\n\tfloat shadow = 1.0;\n\t#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\tdirectionallight directionallight;\n\tfor ( int i = 0; i < num_dir_lights; i ++ ) {\n\t\tdirectionallight = directionallights[ i ];\n\t\tshadow *= bool( directionallight.shadow ) ? getshadow( directionalshadowmap[ i ], directionallight.shadowmapsize, directionallight.shadowbias, directionallight.shadowradius, vdirectionalshadowcoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if num_spot_lights > 0\n\tspotlight spotlight;\n\tfor ( int i = 0; i < num_spot_lights; i ++ ) {\n\t\tspotlight = spotlights[ i ];\n\t\tshadow *= bool( spotlight.shadow ) ? getshadow( spotshadowmap[ i ], spotlight.shadowmapsize, spotlight.shadowbias, spotlight.shadowradius, vspotshadowcoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if num_point_lights > 0\n\tpointlight pointlight;\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tpointlight = pointlights[ i ];\n\t\tshadow *= bool( pointlight.shadow ) ? getpointshadow( pointshadowmap[ i ], pointlight.shadowmapsize, pointlight.shadowbias, pointlight.shadowradius, vpointshadowcoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n", skinbase_vertex:"#ifdef use_skinning\n\tmat4 bonematx = getbonematrix( skinindex.x );\n\tmat4 bonematy = getbonematrix( skinindex.y );\n\tmat4 bonematz = getbonematrix( skinindex.z );\n\tmat4 bonematw = getbonematrix( skinindex.w );\n#endif",skinning_pars_vertex:"#ifdef use_skinning\n\tuniform mat4 bindmatrix;\n\tuniform mat4 bindmatrixinverse;\n\t#ifdef bone_texture\n\t\tuniform sampler2d bonetexture;\n\t\tuniform int bonetexturewidth;\n\t\tuniform int bonetextureheight;\n\t\tmat4 getbonematrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( bonetexturewidth ) );\n\t\t\tfloat y = floor( j / float( bonetexturewidth ) );\n\t\t\tfloat dx = 1.0 / float( bonetexturewidth );\n\t\t\tfloat dy = 1.0 / float( bonetextureheight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2d( bonetexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2d( bonetexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2d( bonetexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2d( bonetexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 bonematrices[ max_bones ];\n\t\tmat4 getbonematrix( const in float i ) {\n\t\t\tmat4 bone = bonematrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", skinning_vertex:"#ifdef use_skinning\n\tvec4 skinvertex = bindmatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += bonematx * skinvertex * skinweight.x;\n\tskinned += bonematy * skinvertex * skinweight.y;\n\tskinned += bonematz * skinvertex * skinweight.z;\n\tskinned += bonematw * skinvertex * skinweight.w;\n\tskinned = bindmatrixinverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef use_skinning\n\tmat4 skinmatrix = mat4( 0.0 );\n\tskinmatrix += skinweight.x * bonematx;\n\tskinmatrix += skinweight.y * bonematy;\n\tskinmatrix += skinweight.z * bonematz;\n\tskinmatrix += skinweight.w * bonematw;\n\tskinmatrix = bindmatrixinverse * skinmatrix * bindmatrix;\n\tobjectnormal = vec4( skinmatrix * vec4( objectnormal, 0.0 ) ).xyz;\n#endif\n", specularmap_fragment:"float specularstrength;\n#ifdef use_specularmap\n\tvec4 texelspecular = texture2d( specularmap, vuv );\n\tspecularstrength = texelspecular.r;\n#else\n\tspecularstrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef use_specularmap\n\tuniform sampler2d specularmap;\n#endif",tonemapping_fragment:"#if defined( tone_mapping )\n gl_fragcolor.rgb = tonemapping( gl_fragcolor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float tonemappingexposure;\nuniform float tonemappingwhitepoint;\nvec3 lineartonemapping( vec3 color ) {\n\treturn tonemappingexposure * color;\n}\nvec3 reinhardtonemapping( vec3 color ) {\n\tcolor *= tonemappingexposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define uncharted2helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 uncharted2tonemapping( vec3 color ) {\n\tcolor *= tonemappingexposure;\n\treturn saturate( uncharted2helper( color ) / uncharted2helper( vec3( tonemappingwhitepoint ) ) );\n}\nvec3 optimizedcineontonemapping( vec3 color ) {\n\tcolor *= tonemappingexposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", uv_pars_fragment:"#if defined( use_map ) || defined( use_bumpmap ) || defined( use_normalmap ) || defined( use_specularmap ) || defined( use_alphamap ) || defined( use_emissivemap ) || defined( use_roughnessmap ) || defined( use_metalnessmap )\n\tvarying vec2 vuv;\n#endif",uv_pars_vertex:"#if defined( use_map ) || defined( use_bumpmap ) || defined( use_normalmap ) || defined( use_specularmap ) || defined( use_alphamap ) || defined( use_emissivemap ) || defined( use_roughnessmap ) || defined( use_metalnessmap )\n\tvarying vec2 vuv;\n\tuniform vec4 offsetrepeat;\n#endif\n", uv_vertex:"#if defined( use_map ) || defined( use_bumpmap ) || defined( use_normalmap ) || defined( use_specularmap ) || defined( use_alphamap ) || defined( use_emissivemap ) || defined( use_roughnessmap ) || defined( use_metalnessmap )\n\tvuv = uv * offsetrepeat.zw + offsetrepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( use_lightmap ) || defined( use_aomap )\n\tvarying vec2 vuv2;\n#endif",uv2_pars_vertex:"#if defined( use_lightmap ) || defined( use_aomap )\n\tattribute vec2 uv2;\n\tvarying vec2 vuv2;\n#endif", uv2_vertex:"#if defined( use_lightmap ) || defined( use_aomap )\n\tvuv2 = uv2;\n#endif",worldpos_vertex:"#if defined( use_envmap ) || defined( phong ) || defined( physical ) || defined( lambert ) || defined ( use_shadowmap )\n\t#ifdef use_skinning\n\t\tvec4 worldposition = modelmatrix * skinned;\n\t#else\n\t\tvec4 worldposition = modelmatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplercube tcube;\nuniform float tflip;\nuniform float opacity;\nvarying vec3 vworldposition;\n#include \nvoid main() {\n\tgl_fragcolor = texturecube( tcube, vec3( tflip * vworldposition.x, vworldposition.yz ) );\n\tgl_fragcolor.a *= opacity;\n}\n", cube_vert:"varying vec3 vworldposition;\n#include \nvoid main() {\n\tvworldposition = transformdirection( position, modelmatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if depth_packing == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( 1.0 );\n\t#if depth_packing == 3200\n\t\tdiffusecolor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if depth_packing == 3200\n\t\tgl_fragcolor = vec4( vec3( gl_fragcoord.z ), opacity );\n\t#elif depth_packing == 3201\n\t\tgl_fragcolor = packdepthtorgba( gl_fragcoord.z );\n\t#endif\n}\n", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", distancergba_frag:"uniform vec3 lightpos;\nvarying vec4 vworldposition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_fragcolor = packdepthtorgba( length( vworldposition.xyz - lightpos.xyz ) / 1000.0 );\n}\n",distancergba_vert:"varying vec4 vworldposition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvworldposition = worldposition;\n}\n", equirect_frag:"uniform sampler2d tequirect;\nuniform float tflip;\nvarying vec3 vworldposition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vworldposition );\n\tvec2 sampleuv;\n\tsampleuv.y = saturate( tflip * direction.y * -0.5 + 0.5 );\n\tsampleuv.x = atan( direction.z, direction.x ) * reciprocal_pi2 + 0.5;\n\tgl_fragcolor = texture2d( tequirect, sampleuv );\n}\n",equirect_vert:"varying vec3 vworldposition;\n#include \nvoid main() {\n\tvworldposition = transformdirection( position, modelmatrix );\n\t#include \n\t#include \n}\n", linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashsize;\nuniform float totalsize;\nvarying float vlinedistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vlinedistance, totalsize ) > dashsize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoinglight = vec3( 0.0 );\n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoinglight = diffusecolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", linedashed_vert:"uniform float scale;\nattribute float linedistance;\nvarying float vlinedistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvlinedistance = scale * linedistance;\n\tvec4 mvposition = modelviewmatrix * vec4( position, 1.0 );\n\tgl_position = projectionmatrix * mvposition;\n\t#include \n\t#include \n\t#include \n}\n", meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedlight reflectedlight = reflectedlight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef use_lightmap\n\t\treflectedlight.indirectdiffuse += texture2d( lightmap, vuv2 ).xyz * lightmapintensity;\n\t#else\n\t\treflectedlight.indirectdiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedlight.indirectdiffuse *= diffusecolor.rgb;\n\tvec3 outgoinglight = reflectedlight.indirectdiffuse;\n\t#include \n\t#include \n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef use_envmap\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vlightfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\treflectedlight reflectedlight = reflectedlight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalemissiveradiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedlight.indirectdiffuse = getambientlightirradiance( ambientlightcolor );\n\t#include \n\treflectedlight.indirectdiffuse *= brdf_diffuse_lambert( diffusecolor.rgb );\n\t#ifdef double_sided\n\t\treflectedlight.directdiffuse = ( gl_frontfacing ) ? vlightfront : vlightback;\n\t#else\n\t\treflectedlight.directdiffuse = vlightfront;\n\t#endif\n\treflectedlight.directdiffuse *= brdf_diffuse_lambert( diffusecolor.rgb ) * getshadowmask();\n\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + totalemissiveradiance;\n\t#include \n\t#include \n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_vert:"#define lambert\nvarying vec3 vlightfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphong_frag:"#define phong\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\treflectedlight reflectedlight = reflectedlight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalemissiveradiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + reflectedlight.directspecular + reflectedlight.indirectspecular + totalemissiveradiance;\n\t#include \n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphong_vert:"#define phong\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef flat_shaded\n\tvnormal = normalize( transformednormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvviewposition = - mvposition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphysical_frag:"#define physical\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef standard\n\tuniform float clearcoat;\n\tuniform float clearcoatroughness;\n#endif\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\treflectedlight reflectedlight = reflectedlight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalemissiveradiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + reflectedlight.directspecular + reflectedlight.indirectspecular + totalemissiveradiance;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphysical_vert:"#define physical\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef flat_shaded\n\tvnormal = normalize( transformednormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvviewposition = - mvposition.xyz;\n\t#include \n\t#include \n\t#include \n}\n", normal_frag:"#define normal\nuniform float opacity;\n#if defined( flat_shaded ) || defined( use_bumpmap ) || defined( use_normalmap )\n\tvarying vec3 vviewposition;\n#endif\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_fragcolor = vec4( packnormaltorgb( normal ), opacity );\n}\n", normal_vert:"#define normal\n#if defined( flat_shaded ) || defined( use_bumpmap ) || defined( use_normalmap )\n\tvarying vec3 vviewposition;\n#endif\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef flat_shaded\n\tvnormal = normalize( transformednormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( flat_shaded ) || defined( use_bumpmap ) || defined( use_normalmap )\n\tvviewposition = - mvposition.xyz;\n#endif\n}\n", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoinglight = vec3( 0.0 );\n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoinglight = diffusecolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef use_sizeattenuation\n\t\tgl_pointsize = size * ( scale / - mvposition.z );\n\t#else\n\t\tgl_pointsize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_fragcolor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getshadowmask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};j.prototype={constructor:j, iscolor:!0,r:1,g:1,b:1,set:function(a){a&&a.iscolor?this.copy(a):"number"===typeof a?this.sethex(a):"string"===typeof a&&this.setstyle(a);return this},setscalar:function(a){this.b=this.g=this.r=a;return this},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},setrgb:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},sethsl:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, c,d){b=n.euclideanmodulo(b,1);c=n.clamp(c,0,1);d=n.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setstyle:function(a){function b(b){void 0!==b&&1>parsefloat(b)&&console.warn("three.color: alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= math.min(255,parseint(c[1],10))/255,this.g=math.min(255,parseint(c[2],10))/255,this.b=math.min(255,parseint(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=math.min(100,parseint(c[1],10))/100,this.g=math.min(100,parseint(c[2],10))/100,this.b=math.min(100,parseint(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parsefloat(c[1])/ 360,e=parseint(c[2],10)/100,f=parseint(c[3],10)/100;b(c[5]);return this.sethsl(d,e,f)}}}else if(c=/^\#([a-fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseint(c.charat(0)+c.charat(0),16)/255,this.g=parseint(c.charat(1)+c.charat(1),16)/255,this.b=parseint(c.charat(2)+c.charat(2),16)/255,this;if(6===d)return this.r=parseint(c.charat(0)+c.charat(1),16)/255,this.g=parseint(c.charat(2)+c.charat(3),16)/255,this.b=parseint(c.charat(4)+c.charat(5),16)/255,this}a&&0=h?m/(e+f): m/(2-e-f);switch(e){case b:g=(c-d)/m+(cthis.max.x||a.ythis.max.y?!1:!0},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},getparameter:function(a,b){return(b||new d).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y- this.min.y))},intersectsbox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clamppoint:function(a,b){return(b||new d).copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new d;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a); this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};var af=0;x.prototype={constructor:x,ismaterial:!0,get needsupdate(){return this._needsupdate},set needsupdate(a){!0===a&&this.update();this._needsupdate=a},setvalues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("three.material: '"+b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("three."+this.type+": '"+b+"' is not a property of this material."): d&&d.iscolor?d.set(c):d&&d.isvector3&&c&&c.isvector3?d.copy(c):this[b]="overdraw"===b?number(c):c}}},tojson:function(a){function b(a){var b=[],c;for(c in a){var d=a[c];delete d.metadata;b.push(d)}return b}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.4,type:"material",generator:"material.tojson"}};d.uuid=this.uuid;d.type=this.type;""!==this.name&&(d.name=this.name);this.color&&this.color.iscolor&&(d.color=this.color.gethex());void 0!==this.roughness&&(d.roughness=this.roughness); void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.iscolor&&(d.emissive=this.emissive.gethex());this.specular&&this.specular.iscolor&&(d.specular=this.specular.gethex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearcoat&&(d.clearcoat=this.clearcoat);void 0!==this.clearcoatroughness&&(d.clearcoatroughness=this.clearcoatroughness);this.map&&this.map.istexture&&(d.map=this.map.tojson(a).uuid);this.alphamap&&this.alphamap.istexture&&(d.alphamap= this.alphamap.tojson(a).uuid);this.lightmap&&this.lightmap.istexture&&(d.lightmap=this.lightmap.tojson(a).uuid);this.bumpmap&&this.bumpmap.istexture&&(d.bumpmap=this.bumpmap.tojson(a).uuid,d.bumpscale=this.bumpscale);this.normalmap&&this.normalmap.istexture&&(d.normalmap=this.normalmap.tojson(a).uuid,d.normalscale=this.normalscale.toarray());this.displacementmap&&this.displacementmap.istexture&&(d.displacementmap=this.displacementmap.tojson(a).uuid,d.displacementscale=this.displacementscale,d.displacementbias= this.displacementbias);this.roughnessmap&&this.roughnessmap.istexture&&(d.roughnessmap=this.roughnessmap.tojson(a).uuid);this.metalnessmap&&this.metalnessmap.istexture&&(d.metalnessmap=this.metalnessmap.tojson(a).uuid);this.emissivemap&&this.emissivemap.istexture&&(d.emissivemap=this.emissivemap.tojson(a).uuid);this.specularmap&&this.specularmap.istexture&&(d.specularmap=this.specularmap.tojson(a).uuid);this.envmap&&this.envmap.istexture&&(d.envmap=this.envmap.tojson(a).uuid,d.reflectivity=this.reflectivity); this.gradientmap&&this.gradientmap.istexture&&(d.gradientmap=this.gradientmap.tojson(a).uuid);void 0!==this.size&&(d.size=this.size);void 0!==this.sizeattenuation&&(d.sizeattenuation=this.sizeattenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexcolors&&(d.vertexcolors=this.vertexcolors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthfunc=this.depthfunc; d.depthtest=this.depthtest;d.depthwrite=this.depthwrite;0e&&(e=k);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setfrombufferattribute:function(a){for(var b=infinity,c=infinity,d=infinity,e=-infinity,f=-infinity,g=-infinity,h=0,m=a.count;he&&(e=k);l>f&&(f=l);p>g&&(g=p)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setfrompoints:function(a){this.makeempty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},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&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getparameter:function(a, b){return(b||new q).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsbox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectssphere:function(){var a;return function(b){void 0===a&&(a=new q);this.clamppoint(b.center,a);return a.distancetosquared(b.center)<=b.radius*b.radius}}(),intersectsplane:function(a){var b, c;0=a.constant},clamppoint:function(a,b){return(b||new q).copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new q; return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getboundingsphere:function(){var a=new q;return function(b){b=b||new na;this.getcenter(b.center);b.radius=.5*this.getsize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isempty()&&this.makeempty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applymatrix4:function(){var a=[new q,new q,new q,new q,new q,new q,new q,new q];return function(b){if(this.isempty())return this; a[0].set(this.min.x,this.min.y,this.min.z).applymatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applymatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applymatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applymatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applymatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applymatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applymatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applymatrix4(b);this.setfrompoints(a);return this}}(), translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};na.prototype={constructor:na,set:function(a,b){this.center.copy(a);this.radius=b;return this},setfrompoints:function(){var a;return function(b,c){void 0===a&&(a=new pa);var d=this.center;void 0!==c?d.copy(c):a.setfrompoints(b).getcenter(d);for(var e=0,f=0,g=b.length;f=this.radius},containspoint:function(a){return a.distancetosquared(this.center)<=this.radius*this.radius},distancetopoint:function(a){return a.distanceto(this.center)-this.radius},intersectssphere:function(a){var b=this.radius+a.radius;return a.center.distancetosquared(this.center)<=b*b},intersectsbox:function(a){return a.intersectssphere(this)},intersectsplane:function(a){return math.abs(this.center.dot(a.normal)- a.constant)<=this.radius},clamppoint:function(a,b){var c=this.center.distancetosquared(a),d=b||new q;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyscalar(this.radius).add(this.center));return d},getboundingbox:function(a){a=a||new pa;a.set(this.center,this.center);a.expandbyscalar(this.radius);return a},applymatrix4:function(a){this.center.applymatrix4(a);this.radius*=a.getmaxscaleonaxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&& a.radius===this.radius}};ya.prototype={constructor:ya,ismatrix3:!0,set:function(a,b,c,d,e,f,g,h,m){var k=this.elements;k[0]=a;k[1]=d;k[2]=g;k[3]=b;k[4]=e;k[5]=h;k[6]=c;k[7]=f;k[8]=m;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromarray(this.elements)},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},setfrommatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9], a[2],a[6],a[10]);return this},applytobufferattribute:function(){var a;return function(b){void 0===a&&(a=new q);for(var c=0,d=b.count;cc;c++)this.elements[c]=a[c+b];return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}};la.prototype={constructor:la,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setcomponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setfromnormalandcoplanarpoint:function(a, b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setfromcoplanarpoints:function(){var a=new q,b=new q;return function(c,d,e){d=a.subvectors(e,d).cross(b.subvectors(c,d)).normalize();this.setfromnormalandcoplanarpoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyscalar(a);this.constant*=a;return this}, negate:function(){this.constant*=-1;this.normal.negate();return this},distancetopoint:function(a){return this.normal.dot(a)+this.constant},distancetosphere:function(a){return this.distancetopoint(a.center)-a.radius},projectpoint:function(a,b){return this.orthopoint(a,b).sub(a).negate()},orthopoint:function(a,b){var c=this.distancetopoint(a);return(b||new q).copy(this.normal).multiplyscalar(c)},intersectline:function(){var a=new q;return function(b,c){var d=c||new q,e=b.delta(a),f=this.normal.dot(e); if(0===f){if(0===this.distancetopoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setfrommatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],m=c[6],k=c[7],l=c[8],p=c[9],n=c[10],u=c[11],q=c[12],r=c[13],a=c[14],c=c[15];b[0].setcomponents(f-a,k-g,u-l,c-q).normalize();b[1].setcomponents(f+a,k+g,u+l,c+q).normalize();b[2].setcomponents(f+d,k+h,u+p,c+r).normalize();b[3].setcomponents(f- d,k-h,u-p,c-r).normalize();b[4].setcomponents(f-e,k-m,u-n,c-a).normalize();b[5].setcomponents(f+e,k+m,u+n,c+a).normalize();return this},intersectsobject:function(){var a=new na;return function(b){var c=b.geometry;null===c.boundingsphere&&c.computeboundingsphere();a.copy(c.boundingsphere).applymatrix4(b.matrixworld);return this.intersectssphere(a)}}(),intersectssprite:function(){var a=new na;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applymatrix4(b.matrixworld);return this.intersectssphere(a)}}(), intersectssphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distancetopoint(c)e;e++){var f=d[e];a.x=0 g&&0>f)return!1}return!0}}(),containspoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distancetopoint(a))return!1;return!0}};cb.prototype={constructor:cb,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new q).copy(this.direction).multiplyscalar(a).add(this.origin)},lookat:function(a){this.direction.copy(a).sub(this.origin).normalize(); return this},recast:function(){var a=new q;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestpointtopoint:function(a,b){var c=b||new q;c.subvectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyscalar(d).add(this.origin)},distancetopoint:function(a){return math.sqrt(this.distancesqtopoint(a))},distancesqtopoint:function(){var a=new q;return function(b){var c=a.subvectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distancetosquared(b); a.copy(this.direction).multiplyscalar(c).add(this.origin);return a.distancetosquared(b)}}(),distancesqtosegment:function(){var a=new q,b=new q,c=new q;return function(d,e,f,g){a.copy(d).add(e).multiplyscalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceto(e),m=-this.direction.dot(b),k=c.dot(this.direction),l=-c.dot(b),p=c.lengthsq(),n=math.abs(1-m*m),u;0=-u?e<=u?(h=1/n,d*=h,e*=h,m=d*(d+m*e+2*k)+e*(m*d+e+2*l)+p):(e=h,d=math.max(0,-(m* e+k)),m=-d*d+e*(e+2*l)+p):(e=-h,d=math.max(0,-(m*e+k)),m=-d*d+e*(e+2*l)+p):e<=-u?(d=math.max(0,-(-m*h+k)),e=0f)return null;f=math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectssphere:function(a){return this.distancetopoint(a.center)<=a.radius},distancetoplane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distancetopoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectplane:function(a, b){var c=this.distancetoplane(a);return null===c?null:this.at(c,b)},intersectsplane:function(a){var b=a.distancetopoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectbox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e; if(fg||e>d)return null;if(e>c||c!==c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectsbox:function(){var a=new q;return function(b){return null!==this.intersectbox(b,a)}}(),intersecttriangle:function(){var a=new q,b=new q,c=new q,d=new q;return function(e,f,g,h,m){b.subvectors(f,e);c.subvectors(g,e);d.crossvectors(b,c);f=this.direction.dot(d);if(0f)h= -1,f=-f;else return null;a.subvectors(this.origin,e);e=h*this.direction.dot(c.crossvectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,m)}}(),applymatrix4:function(a){this.direction.add(this.origin).applymatrix4(a);this.origin.applymatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}};db.rotationorders= "xyz yzx zxy xzy yxz zyx".split(" ");db.defaultorder="xyz";db.prototype={constructor:db,iseuler:!0,get x(){return this._x},set x(a){this._x=a;this.onchangecallback()},get y(){return this._y},set y(a){this._y=a;this.onchangecallback()},get z(){return this._z},set z(a){this._z=a;this.onchangecallback()},get order(){return this._order},set order(a){this._order=a;this.onchangecallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onchangecallback();return this}, clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onchangecallback();return this},setfromrotationmatrix:function(a,b,c){var d=n.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],m=e[5],k=e[9],l=e[2],p=e[6],e=e[10];b=b||this._order;"xyz"===b?(this._y=math.asin(d(g,-1,1)),.99999>math.abs(g)?(this._x=math.atan2(-k,e),this._z=math.atan2(-f,a)):(this._x=math.atan2(p,m),this._z=0)):"yxz"=== b?(this._x=math.asin(-d(k,-1,1)),.99999>math.abs(k)?(this._y=math.atan2(g,e),this._z=math.atan2(h,m)):(this._y=math.atan2(-l,a),this._z=0)):"zxy"===b?(this._x=math.asin(d(p,-1,1)),.99999>math.abs(p)?(this._y=math.atan2(-l,e),this._z=math.atan2(-f,m)):(this._y=0,this._z=math.atan2(h,a))):"zyx"===b?(this._y=math.asin(-d(l,-1,1)),.99999>math.abs(l)?(this._x=math.atan2(p,e),this._z=math.atan2(h,a)):(this._x=0,this._z=math.atan2(-f,m))):"yzx"===b?(this._z=math.asin(d(h,-1,1)),.99999>math.abs(h)?(this._x= math.atan2(-k,m),this._y=math.atan2(-l,a)):(this._x=0,this._y=math.atan2(g,e))):"xzy"===b?(this._z=math.asin(-d(f,-1,1)),.99999>math.abs(f)?(this._x=math.atan2(p,m),this._y=math.atan2(g,a)):(this._x=math.atan2(-k,e),this._y=0)):console.warn("three.euler: .setfromrotationmatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onchangecallback();return this},setfromquaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new s);a.makerotationfromquaternion(b);return this.setfromrotationmatrix(a, c,d)}}(),setfromvector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ca;return function(b){a.setfromeuler(this);return this.setfromquaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},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},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},tovector3:function(a){return a?a.set(this._x,this._y,this._z):new q(this._x,this._y,this._z)},onchange:function(a){this.onchangecallback=a;return this},onchangecallback:function(){}};nd.prototype={constructor:nd,set:function(a){this.mask=1<=b.x+b.y}}();za.prototype={constructor:za,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setfrompointsandindices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this}, area:function(){var a=new q,b=new q;return function(){a.subvectors(this.c,this.b);b.subvectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new q).addvectors(this.a,this.b).add(this.c).multiplyscalar(1/3)},normal:function(a){return za.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new la).setfromcoplanarpoints(this.a,this.b,this.c)},barycoordfrompoint:function(a,b){return za.barycoordfrompoint(a,this.a,this.b,this.c,b)},containspoint:function(a){return za.containspoint(a, this.a,this.b,this.c)},closestpointtopoint:function(){var a,b,c,d;return function(e,f){void 0===a&&(a=new la,b=[new hb,new hb,new hb],c=new q,d=new q);var g=f||new q,h=infinity;a.setfromcoplanarpoints(this.a,this.b,this.c);a.projectpoint(e,c);if(!0===this.containspoint(c))g.copy(c);else{b[0].set(this.a,this.b);b[1].set(this.b,this.c);b[2].set(this.c,this.a);for(var m=0;md;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.facevertexuvs.length;cb.far?null:{distance:c,point:w.clone(),object:a}}function c(c,d,e,f,k,l,p,t){g.frombufferattribute(f,l);h.frombufferattribute(f,p);m.frombufferattribute(f,t);if(c=b(c,d,e,g,h,m,a))k&&(n.frombufferattribute(k,l),u.frombufferattribute(k,p),g.frombufferattribute(k,t),c.uv=a(a,g,h,m,n,u,g)),c.face= new ha(l,p,t,za.normal(g,h,m)),c.faceindex=l;return c}var d=new s,e=new cb,f=new na,g=new q,h=new q,m=new q,k=new q,l=new q,p=new q,n=new d,u=new d,g=new d,r=new q,a=new q,w=new q;return function(q,r){var v=this.geometry,w=this.material,l=this.matrixworld;if(void 0!==w&&(null===v.boundingsphere&&v.computeboundingsphere(),f.copy(v.boundingsphere),f.applymatrix4(l),!1!==q.ray.intersectssphere(f)&&(d.getinverse(l),e.copy(q.ray).applymatrix4(d),null===v.boundingbox||!1!==e.intersectsbox(v.boundingbox)))){var c; if(v.isbuffergeometry){var f,x,w=v.index,h=v.attributes.position,l=v.attributes.uv,d,z;if(null!==w)for(d=0,z=w.count;dthis.scale.x*this.scale.y/4||c.push({distance:math.sqrt(d),point:this.position, face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});ec.prototype=object.assign(object.create(x.prototype),{constructor:ec,copy:function(a){x.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e- 1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applymatrix4(this.matrixworld), r=d.ray.origin.distanceto(l),rd.far||e.push({distance:r,point:h.clone().applymatrix4(this.matrixworld),index:g,face:null,faceindex:null,object:this}))}else for(g=0,g=u.length/3-1;gf||(l.applymatrix4(this.matrixworld),r=d.ray.origin.distanceto(l),rd.far||e.push({distance:r,point:h.clone().applymatrix4(this.matrixworld),index:g,face:null,faceindex:null,object:this}))}else if(g.isgeometry)for(m=g.vertices, k=m.length,g=0;gf||(l.applymatrix4(this.matrixworld),r=d.ray.origin.distanceto(l),rd.far||e.push({distance:r,point:h.clone().applymatrix4(this.matrixworld),index:g,face:null,faceindex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});ga.prototype=object.assign(object.create(ua.prototype),{constructor:ga,islinesegments:!0});oa.prototype=object.create(x.prototype);oa.prototype.constructor= oa;oa.prototype.ispointsmaterial=!0;oa.prototype.copy=function(a){x.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeattenuation=a.sizeattenuation;return this};mb.prototype=object.assign(object.create(x.prototype),{constructor:mb,ispoints:!0,raycast:function(){var a=new s,b=new cb,c=new na;return function(d,e){function f(a,c){var f=b.distancesqtopoint(a);if(fd.far||e.push({distance:k,distancetoray:math.sqrt(f),point:h.clone(),index:c,face:null,object:g})}}var g=this,h=this.geometry,m=this.matrixworld,k=d.params.points.threshold;null===h.boundingsphere&&h.computeboundingsphere();c.copy(h.boundingsphere);c.applymatrix4(m);if(!1!==d.ray.intersectssphere(c)){a.getinverse(m);b.copy(d.ray).applymatrix4(a);var k=k/((this.scale.x+this.scale.y+this.scale.z)/3),l=k*k,k=new q;if(h.isbuffergeometry){var p=h.index,h=h.attributes.position.array;if(null!==p)for(var n= p.array,p=0,u=n.length;pc)return null;var d=[],e=[],f=[],g,h,m;if(0=k--){console.warn("three.shapeutils: unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);m=h+1;c<=m&&(m=0);var l;a:{var p,n,q,g,r,a,w,y;p=a[e[g]].x;n=a[e[g]].y;q=a[e[h]].x;g=a[e[h]].y;r=a[e[m]].x;a=a[e[m]].y;if(0>=(q- p)*(a-n)-(g-n)*(r-p))l=!1;else{var k,v,e,x,c,f,d,h,z,j;k=r-q;v=a-g;e=p-r;x=n-a;c=q-p;f=g-n;for(l=0;l=-number.epsilon&&h>=-number.epsilon&&d>=-number.epsilon)){l=!1;break a}l=!0}}if(l){d.push([a[e[g]],a[e[h]],a[e[m]]]);f.push([e[g],e[h],e[m]]);g=h;for(m=h+1;mnumber.epsilon){if(0t||t>p)return[];k=m*l-k*n;if(0>k||k>p)return[]}else{if(0c?[]:k===c?f?[]:[g]:a<=c?[g,h]:[g,m]}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return math.abs(a)>number.epsilon?(b=g*c-d*b,0e&&(e=d);var g=a+1;g>d&&(g=0);d=f(h[a],h[e],h[g],k[b]);if(!d)return!1;d=k.length-1;e=b-1;0>e&&(e=d);g=b+1;g>d&&(g=0);return(d=f(k[b],k[e],k[g],h[a]))?!0:!1}function d(a,b){var c,f;for(c=0;cq){console.log("infinite loop! holes left:"+m.length+", probably hole outside shape!");break}for(n=d;nm;m++)l=k[m].x+":"+k[m].y,l=p[l],void 0!==l&&(k[m]=l);return n.concat()},isclockwise:function(a){return 0>ia.area(a)}};la.prototype=object.create(t.prototype);la.prototype.constructor=la;la.prototype.addshapelist=function(a,b){for(var c=a.length,d=0;dnumber.epsilon){var k=math.sqrt(h),m=math.sqrt(d*d+g*g),h=b.x-f/k;b=b.y+e/k;g=((c.x-g/m-h)*g-(c.y+d/m-b)*d)/(e*g-f*d);d=h+e*g-a.x;e=b+f*g-a.y;f=d*d+e*e;if(2>=f)return new d(d,e);f=math.sqrt(f/2)}else a=!1,e>number.epsilon?d>number.epsilon&&(a=!0):e<-number.epsilon?d<-number.epsilon&&(a=!0):math.sign(f)===math.sign(g)&&(a=!0),a?(d=-f,f=math.sqrt(h)):(d=e,e=f,f=math.sqrt(h/2));return new d(d/f,e/f)} function e(a,b){var c,d;for(r=a.length;0<=--r;){c=r;d=r-1;0>d&&(d=a.length-1);var e,f=u+2*l;for(e=0;emath.abs(b.y-c.y)?[new d(b.x,1-b.z),new d(c.x,1-c.z),new d(d.x,1-d.z),new d(e.x,1-e.z)]:[new d(b.y,1-b.z),new d(c.y,1-c.z),new d(d.y,1-d.z),new d(e.y,1-e.z)]}};qc.prototype=object.create(la.prototype);qc.prototype.constructor=qc;rc.prototype=object.create(t.prototype);rc.prototype.constructor=rc;pb.prototype=object.create(i.prototype);pb.prototype.constructor=pb;sc.prototype=object.create(t.prototype);sc.prototype.constructor= sc;wb.prototype=object.create(i.prototype);wb.prototype.constructor=wb;tc.prototype=object.create(t.prototype);tc.prototype.constructor=tc;xb.prototype=object.create(i.prototype);xb.prototype.constructor=xb;yb.prototype=object.create(t.prototype);yb.prototype.constructor=yb;zb.prototype=object.create(i.prototype);zb.prototype.constructor=zb;$b.prototype=object.create(i.prototype);$b.prototype.constructor=$b;qb.prototype=object.create(t.prototype);qb.prototype.constructor=qb;va.prototype=object.create(i.prototype); va.prototype.constructor=va;uc.prototype=object.create(qb.prototype);uc.prototype.constructor=uc;vc.prototype=object.create(va.prototype);vc.prototype.constructor=vc;wc.prototype=object.create(t.prototype);wc.prototype.constructor=wc;ac.prototype=object.create(i.prototype);ac.prototype.constructor=ac;var ma=object.freeze({wireframegeometry:ob,parametricgeometry:hc,parametricbuffergeometry:pb,tetrahedrongeometry:jc,tetrahedronbuffergeometry:qb,octahedrongeometry:kc,octahedronbuffergeometry:ob,icosahedrongeometry:lc, icosahedronbuffergeometry:rb,dodecahedrongeometry:mc,dodecahedronbuffergeometry:sb,polyhedrongeometry:ic,polyhedronbuffergeometry:ba,tubegeometry:nc,tubebuffergeometry:tb,torusknotgeometry:oc,torusknotbuffergeometry:ub,torusgeometry:pc,torusbuffergeometry:vb,textgeometry:qc,spheregeometry:rc,spherebuffergeometry:pb,ringgeometry:sc,ringbuffergeometry:wb,planegeometry:ac,planebuffergeometry:lb,lathegeometry:tc,lathebuffergeometry:xb,shapegeometry:yb,shapebuffergeometry:zb,extrudegeometry:la,edgesgeometry:$b, conegeometry:uc,conebuffergeometry:vc,cylindergeometry:qb,cylinderbuffergeometry:va,circlegeometry:wc,circlebuffergeometry:ac,boxgeometry:ib,boxbuffergeometry:kb});bc.prototype=object.create(ha.prototype);bc.prototype.constructor=bc;bc.prototype.isshadowmaterial=!0;cc.prototype=object.create(ha.prototype);cc.prototype.constructor=cc;cc.prototype.israwshadermaterial=!0;xc.prototype={constructor:xc,ismultimaterial:!0,tojson:function(a){for(var b={metadata:{version:4.2,type:"material",generator:"materialexporter"}, uuid:this.uuid,type:this.type,materials:[]},c=this.materials,d=0,e=c.length;d=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=math.max(f,1),e=f-1),d=this.getvaluesize(),this.times=na.arrayslice(c,e,f),this.values=na.arrayslice(this.values,e*d,f*d);return this},validate:function(){var a=!0,b=this.getvaluesize();0!==b-math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("track is empty", this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isnan(g)){console.error("time is not a valid number",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&na.istypedarray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isnan(d)){console.error("value is not a valid number",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getvaluesize(),d=2302===this.getinterpolation(),e=1, f=a.length-1,g=1;gk.opacity&&(k.transparent=!0);d.settextures(m);return d.parse(k)}}()};zb.handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;cg;g++)n=y[m++],w=a[2*n],n=a[2*n+1],w=new d(w,n),2!==g&&c.facevertexuvs[d][h].push(w),0!==g&&c.facevertexuvs[d][h+1].push(w);p&&(p=3*y[m++],u.normal.set(x[p++],x[p++],x[p]), r.normal.copy(u.normal));if(g)for(d=0;4>d;d++)p=3*y[m++],g=new q(x[p++],x[p++],x[p]),2!==d&&u.vertexnormals.push(g),0!==d&&r.vertexnormals.push(g);l&&(l=y[m++],l=v[l],u.color.sethex(l),r.color.sethex(l));if(b)for(d=0;4>d;d++)l=y[m++],l=v[l],2!==d&&u.vertexcolors.push(new j(l)),0!==d&&r.vertexcolors.push(new j(l));c.faces.push(u);c.faces.push(r)}else{u=new ha;u.a=y[m++];u.b=y[m++];u.c=y[m++];h&&(h=y[m++],u.materialindex=h);h=c.faces.length;if(d)for(d=0;dg;g++)n=y[m++],w=a[2*n],n=a[2*n+1],w=new d(w,n),c.facevertexuvs[d][h].push(w);p&&(p=3*y[m++],u.normal.set(x[p++],x[p++],x[p]));if(g)for(d=0;3>d;d++)p=3*y[m++],g=new q(x[p++],x[p++],x[p]),u.vertexnormals.push(g);l&&(l=y[m++],u.color.sethex(v[l]));if(b)for(d=0;3>d;d++)l=y[m++],u.vertexcolors.push(new j(v[l]));c.faces.push(u)}})(d);(function(){var b=void 0!==a.influencespervertex?a.influencespervertex:2;if(a.skinweights)for(var d=0,g=a.skinweights.length;dm)g=d+1;else if(0b&&(b=0);1number.epsilon&&(g.normalize(),c=math.acos(n.clamp(d[m-1].dot(d[m]),-1,1)),e[m].applymatrix4(h.makerotationaxis(g,c))),f[m].crossvectors(d[m],e[m]);if(!0===b)for(c=math.acos(n.clamp(e[0].dot(e[a]),-1,1)),c/=a,0=b)return b=c[a]-b,a=this.curves[a],c=a.getlength(),a.getpointat(0===c?0:1-b/c);a++}return null},getlength:function(){var a=this.getcurvelengths();return a[a.length-1]},updatearclengths:function(){this.needsupdate= !0;this.cachelengths=null;this.getlengths()},getcurvelengths:function(){if(this.cachelengths&&this.cachelengths.length===this.curves.length)return this.cachelengths;for(var a=[],b=0,c=0,d=this.curves.length;cc;)c+=b;for(;c>b;)c-=b;cb.length-2?b.length-1:a+1],b=b[a>b.length-3?b.length-1:a+2];return new d(te(c,d.x,e.x,f.x,b.x),te(c,d.y,e.y,f.y,b.y))};fc.prototype=object.create(ua.prototype);fc.prototype.constructor= fc;fc.prototype.getpoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new d(bb(a,b.x,c.x,d.x,e.x),bb(a,b.y,c.y,d.y,e.y))};gc.prototype=object.create(ua.prototype);gc.prototype.constructor=gc;gc.prototype.getpoint=function(a){var b=this.v0,c=this.v1,d=this.v2;return new d(ab(a,b.x,c.x,d.x),ab(a,b.y,c.y,d.y))};var xe=object.assign(object.create(ad.prototype),{frompoints:function(a){this.moveto(a[0].x,a[0].y);for(var b=1,c=a.length;bnumber.epsilon){if(0>m&&(g=b[f],k=-k,h=b[e],m=-m),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=m*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=ia.isclockwise,f=this.subpaths;if(0===f.length)return[];if(!0===b)return c(f);var g,h,m,k=[];if(1===f.length)return h=f[0],m=new db,m.curves=h.curves,k.push(m),k;var l=!e(f[0].getpoints()),l=a?!l:l;m=[];var p= [],n=[],q=0,x;p[q]=void 0;n[q]=[];for(var r=0,a=f.length;rd&&this._mixbufferregion(c,a,3*b,1-d,b);for(var d=b,f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setvalue(c,a);break}}, saveoriginalstate:function(){var a=this.buffer,b=this.valuesize,c=3*b;this.binding.getvalue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeweight=0},restoreoriginalstate:function(){this.binding.setvalue(this.buffer,3*this.valuesize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d,e){ca.slerpflat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}};ka.prototype={constructor:ka,getvalue:function(a, b){this.bind();this.getvalue(a,b)},setvalue:function(a,b){this.bind();this.setvalue(a,b)},bind:function(){var a=this.node,b=this.parsedpath,c=b.objectname,d=b.propertyname,e=b.propertyindex;a||(this.node=a=ka.findnode(this.rootnode,b.nodename)||this.rootnode);this.getvalue=this._getvalue_unavailable;this.setvalue=this._setvalue_unavailable;if(a){if(c){var f=b.objectindex;switch(c){case "materials":if(!a.material){console.error(" can not bind to material as node does not have a material",this);return}if(!a.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array", this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c=c){var p=c++,n=b[p];d[n.uuid]=l;b[l]=n;d[k]=p;b[p]=m;m=0;for(k=f;m!==k;++m){var n=e[m],q=n[l];n[l]=n[p];n[p]=q}}}this.ncachedobjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.ncachedobjects_,e=this._indicesbyuuid,f=this._bindings,g=f.length,h=0,m=arguments.length;h!==m;++h){var k=arguments[h].uuid,l=e[k]; if(void 0!==l)if(delete e[k],lb||0===c)return;this._starttime=null;b*=c}b*=this._updatetimescale(a);c=this._updatetime(b);a=this._updateweight(a);if(0c.parameterpositions[1]&& (this.stopfading(),0===d&&(this.enabled=!1))}}return this._effectiveweight=b},_updatetimescale:function(a){var b=0;if(!this.paused){var b=this.timescale,c=this._timescaleinterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterpositions[1]&&(this.stopwarping(),0===b?this.paused=!0:this.timescale=b)}}return this._effectivetimescale=b},_updatetime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopcount;if(2200===d)a:{if(-1===e&&(this._loopcount= 0,this._setendings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampwhenfinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchevent({type:"finished",action:this,direction:0>a?-1:1})}else{d=2202===d;-1===e&&(0<=a?(e=0,this._setendings(!0,0===this.repetitions,d)):this._setendings(0===this.repetitions,!0,d));if(b>=c||0>b){var f=math.floor(b/c),b=b-c*f,e=e+math.abs(f),g=this.repetitions-e;0>g?(this.clampwhenfinished?this.paused=!0:this.enabled=!1,b=0a,this._setendings(a,!a,d)):this._setendings(!1,!1,d),this._loopcount=e,this._mixer.dispatchevent({type:"loop",action:this,loopdelta:f}))}if(d&&1===(e&1))return this.time=b,c-b}return this.time=b},_setendings:function(a,b,c){var d=this._interpolantsettings;c?(d.endingstart=2401,d.endingend=2401):(d.endingstart=a?this.zeroslopeatstart?2401:2400:2402,d.endingend=b?this.zeroslopeatend?2401:2400:2402)},_schedulefading:function(a,b,c){var d=this._mixer,e=d.time, f=this._weightinterpolant;null===f&&(this._weightinterpolant=f=d._lendcontrolinterpolant());d=f.parameterpositions;f=f.samplevalues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}};cd.prototype={constructor:cd,clipaction:function(a,b){var c=b||this._root,d=c.uuid,e="string"===typeof a?qa.findbyname(c,a):a,c=null!==e?e.uuid:a,f=this._actionsbyclip[c],g=null;if(void 0!==f){g=f.actionbyroot[d];if(void 0!==g)return g;g=f.knownactions[0];null===e&&(e=g._clip)}if(null===e)return null;e=new ne(this,e,b);this._bindaction(e, g);this._addinactiveaction(e,c,d);return e},existingaction:function(a,b){var c=b||this._root,d=c.uuid,c="string"===typeof a?qa.findbyname(c,a):a,c=this._actionsbyclip[c?c.uuid:a];return void 0!==c?c.actionbyroot[d]||null:null},stopallaction:function(){for(var a=this._actions,b=this._nactiveactions,c=this._bindings,d=this._nactivebindings,e=this._nactivebindings=this._nactiveactions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].usecount=0;return this},update:function(a){a*=this.timescale;for(var b= this._actions,c=this._nactiveactions,d=this.time+=a,e=math.sign(a),f=this._accuindex^=1,g=0;g!==c;++g){var h=b[g];h.enabled&&h._update(d,a,e,f)}a=this._bindings;b=this._nactivebindings;for(g=0;g!==b;++g)a[g].apply(f);return this},getroot:function(){return this._root},uncacheclip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsbyclip,d=c[a];if(void 0!==d){for(var d=d.knownactions,e=0,f=d.length;e!==f;++e){var g=d[e];this._deactivateaction(g);var h=g._cacheindex,l=b[b.length-1];g._cacheindex= null;g._byclipcacheindex=null;l._cacheindex=h;b[h]=l;b.pop();this._removeinactivebindingsforaction(g)}delete c[a]}},uncacheroot:function(a){a=a.uuid;var b=this._actionsbyclip,c;for(c in b){var d=b[c].actionbyroot[a];void 0!==d&&(this._deactivateaction(d),this._removeinactiveaction(d))}c=this._bindingsbyrootandname[a];if(void 0!==c)for(var e in c)a=c[e],a.restoreoriginalstate(),this._removeinactivebinding(a)},uncacheaction:function(a,b){var c=this.existingaction(a,b);null!==c&&(this._deactivateaction(c), this._removeinactiveaction(c))}};object.assign(cd.prototype,{_bindaction:function(a,b){var c=a._localroot||this._root,d=a._clip.tracks,e=d.length,f=a._propertybindings,g=a._interpolants,h=c.uuid,l=this._bindingsbyrootandname,k=l[h];void 0===k&&(k={},l[h]=k);for(l=0;l!==e;++l){var q=d[l],p=q.name,n=k[p];if(void 0===n){n=f[l];if(void 0!==n){null===n._cacheindex&&(++n.referencecount,this._addinactivebinding(n,h,p));continue}n=new jd(ka.create(c,p,b&&b._propertybindings[l].binding.parsedpath),q.valuetypename, q.getvaluesize());++n.referencecount;this._addinactivebinding(n,h,p)}f[l]=n;g[l].resultbuffer=n.buffer}},_activateaction:function(a){if(!this._isactiveaction(a)){if(null===a._cacheindex){var b=(a._localroot||this._root).uuid,c=a._clip.uuid,d=this._actionsbyclip[c];this._bindaction(a,d&&d.knownactions[0]);this._addinactiveaction(a,c,b)}b=a._propertybindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.usecount++&&(this._lendbinding(e),e.saveoriginalstate())}this._lendaction(a)}},_deactivateaction:function(a){if(this._isactiveaction(a)){for(var b= a._propertybindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.usecount&&(e.restoreoriginalstate(),this._takebackbinding(e))}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&&ah.end&&(h.end=f);c||(c=l)}}for(l in d)h=d[l],this.createanimation(l,h.start,h.end,a);this.firstanimation=c};oa.prototype.setanimationdirectionforward=function(a){if(a=this.animationsmap[a])a.direction=1,a.directionbackwards=!1};oa.prototype.setanimationdirectionbackward=function(a){if(a=this.animationsmap[a])a.direction=-1,a.directionbackwards=!0};oa.prototype.setanimationfps= function(a,b){var c=this.animationsmap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};oa.prototype.setanimationduration=function(a,b){var c=this.animationsmap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};oa.prototype.setanimationweight=function(a,b){var c=this.animationsmap[a];c&&(c.weight=b)};oa.prototype.setanimationtime=function(a,b){var c=this.animationsmap[a];c&&(c.time=b)};oa.prototype.getanimationtime=function(a){var b=0;if(a=this.animationsmap[a])b=a.time;return b};oa.prototype.getanimationduration= function(a){var b=-1;if(a=this.animationsmap[a])b=a.duration;return b};oa.prototype.playanimation=function(a){var b=this.animationsmap[a];b?(b.time=0,b.active=!0):console.warn("three.morphblendmesh: animation["+a+"] undefined in .playanimation()")};oa.prototype.stopanimation=function(a){if(a=this.animationsmap[a])a.active=!1};oa.prototype.update=function(a){for(var b=0,c=this.animationslist.length;b d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionbackwards=!0),0>d.time&&(d.time=0,d.directionbackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.start+n.clamp(math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentframe&&(this.morphtargetinfluences[d.lastframe]=0,this.morphtargetinfluences[d.currentframe]=1*g,this.morphtargetinfluences[f]=0,d.lastframe=d.currentframe,d.currentframe=f);e=d.time%e/e;d.directionbackwards&&(e=1-e);d.currentframe!== d.lastframe?(this.morphtargetinfluences[d.currentframe]=e*g,this.morphtargetinfluences[d.lastframe]=(1-e)*g):this.morphtargetinfluences[d.currentframe]=g}}};dd.prototype=object.create(x.prototype);dd.prototype.constructor=dd;dd.prototype.isimmediaterenderobject=!0;ed.prototype=object.create(ga.prototype);ed.prototype.constructor=ed;ed.prototype.update=function(){var a=new q,b=new q,c=new ya;return function(){var d=["a","b","c"];this.object.updatematrixworld(!0);c.getnormalmatrix(this.object.matrixworld); var e=this.object.matrixworld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isgeometry)for(var h=g.vertices,l=g.faces,k=g=0,q=l.length;kc.y?this.quaternion.set(1, 0,0,0):(a.set(c.z,0,-c.x).normalize(),b=math.acos(c.y),this.quaternion.setfromaxisangle(a,b))}}();fb.prototype.setlength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,math.max(0,a-b),1);this.line.updatematrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updatematrix()};fb.prototype.setcolor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};nd.prototype=object.create(ga.prototype);nd.prototype.constructor=nd;var qd=new q, ye=new ve,ze=new ve,ae=new ve;va.prototype=object.create(ua.prototype);va.prototype.constructor=va;va.prototype.getpoint=function(a){var b=this.points,c=b.length;2>c&&console.log("duh, you need at least 2 points");a*=c-(this.closed?0:1);var d=math.floor(a);a-=d;this.closed?d+=0d&&(d=1);1e-4>c&&(c=d);1e-4>h&&(h=d);ye.initnonuniformcatmullrom(e.x,f.x,g.x,b.x,c,d,h);ze.initnonuniformcatmullrom(e.y,f.y,g.y,b.y,c,d,h);ae.initnonuniformcatmullrom(e.z,f.z,g.z,b.z,c,d,h)}else"catmullrom"===this.type&&(c=void 0!==this.tension?this.tension: .5,ye.initcatmullrom(e.x,f.x,g.x,b.x,c),ze.initcatmullrom(e.y,f.y,g.y,b.y,c),ae.initcatmullrom(e.z,f.z,g.z,b.z,c));return new q(ye.calc(a),ze.calc(a),ae.calc(a))};id.prototype=object.create(ua.prototype);id.prototype.constructor=id;id.prototype.getpoint=function(a){var b=this.v0,c=this.v1,d=this.v2,e=this.v3;return new q(bb(a,b.x,c.x,d.x,e.x),bb(a,b.y,c.y,d.y,e.y),bb(a,b.z,c.z,d.z,e.z))};jd.prototype=object.create(ua.prototype);jd.prototype.constructor=jd;jd.prototype.getpoint=function(a){var b=this.v0, c=this.v1,d=this.v2;return new q(ab(a,b.x,c.x,d.x),ab(a,b.y,c.y,d.y),ab(a,b.z,c.z,d.z))};kd.prototype=object.create(ua.prototype);kd.prototype.constructor=kd;kd.prototype.getpoint=function(a){if(1===a)return this.v2.clone();var b=new q;b.subvectors(this.v2,this.v1);b.multiplyscalar(a);b.add(this.v1);return b};od.prototype=object.create(wa.prototype);od.prototype.constructor=od;ua.create=function(a,b){console.log("three.curve.create() has been deprecated");a.prototype=object.create(ua.prototype);a.prototype.constructor= a;a.prototype.getpoint=b;return a};xe.prototype=object.create(va.prototype);ye.prototype=object.create(va.prototype);we.prototype=object.create(va.prototype);object.assign(we.prototype,{initfromarray:function(a){console.error("three.spline: .initfromarray() has been removed.")},getcontrolpointsarray:function(a){console.error("three.spline: .getcontrolpointsarray() has been removed.")},reparametrizebyarclength:function(a){console.error("three.spline: .reparametrizebyarclength() has been removed.")}}); fd.prototype.setcolors=function(){console.error("three.gridhelper: setcolors() has been deprecated, pass them in the constructor instead.")};object.assign(sc.prototype,{center:function(a){console.warn("three.box2: .center() has been renamed to .getcenter().");return this.getcenter(a)},empty:function(){console.warn("three.box2: .empty() has been renamed to .isempty().");return this.isempty()},isintersectionbox:function(a){console.warn("three.box2: .isintersectionbox() has been renamed to .intersectsbox()."); return this.intersectsbox(a)},size:function(a){console.warn("three.box2: .size() has been renamed to .getsize().");return this.getsize(a)}});object.assign(pa.prototype,{center:function(a){console.warn("three.box3: .center() has been renamed to .getcenter().");return this.getcenter(a)},empty:function(){console.warn("three.box3: .empty() has been renamed to .isempty().");return this.isempty()},isintersectionbox:function(a){console.warn("three.box3: .isintersectionbox() has been renamed to .intersectsbox()."); return this.intersectsbox(a)},isintersectionsphere:function(a){console.warn("three.box3: .isintersectionsphere() has been renamed to .intersectssphere().");return this.intersectssphere(a)},size:function(a){console.warn("three.box3: .size() has been renamed to .getsize().");return this.getsize(a)}});hb.prototype.center=function(a){console.warn("three.line3: .center() has been renamed to .getcenter().");return this.getcenter(a)};n.random16=function(){console.warn("three.math.random16() has been deprecated. use math.random() instead."); return math.random()};object.assign(ya.prototype,{flattentoarrayoffset:function(a,b){console.warn("three.matrix3: .flattentoarrayoffset() has been deprecated. use .toarray() instead.");return this.toarray(a,b)},multiplyvector3:function(a){console.warn("three.matrix3: .multiplyvector3() has been removed. use vector.applymatrix3( matrix ) instead.");return a.applymatrix3(this)},multiplyvector3array:function(a){console.warn("three.matrix3: .multiplyvector3array() has been renamed. use matrix.applytovector3array( array ) instead."); return this.applytovector3array(a)},applytobuffer:function(a,b,c){console.warn("three.matrix3: .applytobuffer() has been removed. use matrix.applytobufferattribute( attribute ) instead.");return this.applytobufferattribute(a)},applytovector3array:function(a,b,c){console.error("three.matrix3: .applytovector3array() has been removed.")}});object.assign(s.prototype,{extractposition:function(a){console.warn("three.matrix4: .extractposition() has been renamed to .copyposition().");return this.copyposition(a)}, flattentoarrayoffset:function(a,b){console.warn("three.matrix4: .flattentoarrayoffset() has been deprecated. use .toarray() instead.");return this.toarray(a,b)},getposition:function(){var a;return function(){void 0===a&&(a=new q);console.warn("three.matrix4: .getposition() has been removed. use vector3.setfrommatrixposition( matrix ) instead.");return a.setfrommatrixcolumn(this,3)}}(),setrotationfromquaternion:function(a){console.warn("three.matrix4: .setrotationfromquaternion() has been renamed to .makerotationfromquaternion()."); return this.makerotationfromquaternion(a)},multiplyvector3:function(a){console.warn("three.matrix4: .multiplyvector3() has been removed. use vector.applymatrix4( matrix ) instead.");return a.applymatrix4(this)},multiplyvector4:function(a){console.warn("three.matrix4: .multiplyvector4() has been removed. use vector.applymatrix4( matrix ) instead.");return a.applymatrix4(this)},multiplyvector3array:function(a){console.warn("three.matrix4: .multiplyvector3array() has been renamed. use matrix.applytovector3array( array ) instead."); return this.applytovector3array(a)},rotateaxis:function(a){console.warn("three.matrix4: .rotateaxis() has been removed. use vector3.transformdirection( matrix ) instead.");a.transformdirection(this)},crossvector:function(a){console.warn("three.matrix4: .crossvector() has been removed. use vector.applymatrix4( matrix ) instead.");return a.applymatrix4(this)},translate:function(){console.error("three.matrix4: .translate() has been removed.")},rotatex:function(){console.error("three.matrix4: .rotatex() has been removed.")}, rotatey:function(){console.error("three.matrix4: .rotatey() has been removed.")},rotatez:function(){console.error("three.matrix4: .rotatez() has been removed.")},rotatebyaxis:function(){console.error("three.matrix4: .rotatebyaxis() has been removed.")},applytobuffer:function(a,b,c){console.warn("three.matrix4: .applytobuffer() has been removed. use matrix.applytobufferattribute( attribute ) instead.");return this.applytobufferattribute(a)},applytovector3array:function(a,b,c){console.error("three.matrix4: .applytovector3array() has been removed.")}, makefrustum:function(a,b,c,d,e,f){console.warn("three.matrix4: .makefrustum() has been removed. use .makeperspective( left, right, top, bottom, near, far ) instead.");return this.makeperspective(a,b,d,c,e,f)}});la.prototype.isintersectionline=function(a){console.warn("three.plane: .isintersectionline() has been renamed to .intersectsline().");return this.intersectsline(a)};ca.prototype.multiplyvector3=function(a){console.warn("three.quaternion: .multiplyvector3() has been removed. use is now vector.applyquaternion( quaternion ) instead."); return a.applyquaternion(this)};object.assign(cb.prototype,{isintersectionbox:function(a){console.warn("three.ray: .isintersectionbox() has been renamed to .intersectsbox().");return this.intersectsbox(a)},isintersectionplane:function(a){console.warn("three.ray: .isintersectionplane() has been renamed to .intersectsplane().");return this.intersectsplane(a)},isintersectionsphere:function(a){console.warn("three.ray: .isintersectionsphere() has been renamed to .intersectssphere().");return this.intersectssphere(a)}}); object.assign(db.prototype,{extrude:function(a){console.warn("three.shape: .extrude() has been removed. use extrudegeometry() instead.");return new la(this,a)},makegeometry:function(a){console.warn("three.shape: .makegeometry() has been removed. use shapegeometry() instead.");return new yb(this,a)}});object.assign(d.prototype,{fromattribute:function(a,b,c){console.error("three.vector2: .fromattribute() has been renamed to .frombufferattribute().");return this.frombufferattribute(a,b,c)}});object.assign(q.prototype, {seteulerfromrotationmatrix:function(){console.error("three.vector3: .seteulerfromrotationmatrix() has been removed. use euler.setfromrotationmatrix() instead.")},seteulerfromquaternion:function(){console.error("three.vector3: .seteulerfromquaternion() has been removed. use euler.setfromquaternion() instead.")},getpositionfrommatrix:function(a){console.warn("three.vector3: .getpositionfrommatrix() has been renamed to .setfrommatrixposition().");return this.setfrommatrixposition(a)},getscalefrommatrix:function(a){console.warn("three.vector3: .getscalefrommatrix() has been renamed to .setfrommatrixscale()."); return this.setfrommatrixscale(a)},getcolumnfrommatrix:function(a,b){console.warn("three.vector3: .getcolumnfrommatrix() has been renamed to .setfrommatrixcolumn().");return this.setfrommatrixcolumn(b,a)},applyprojection:function(a){console.warn("three.vector3: .applyprojection() has been removed. use .applymatrix4( m ) instead.");return this.applymatrix4(a)},fromattribute:function(a,b,c){console.error("three.vector3: .fromattribute() has been renamed to .frombufferattribute().");return this.frombufferattribute(a, b,c)}});object.assign(fa.prototype,{fromattribute:function(a,b,c){console.error("three.vector4: .fromattribute() has been renamed to .frombufferattribute().");return this.frombufferattribute(a,b,c)}});t.prototype.computetangents=function(){console.warn("three.geometry: .computetangents() has been removed.")};object.assign(x.prototype,{getchildbyname:function(a){console.warn("three.object3d: .getchildbyname() has been renamed to .getobjectbyname().");return this.getobjectbyname(a)},renderdepth:function(){console.warn("three.object3d: .renderdepth has been removed. use .renderorder, instead.")}, translate:function(a,b){console.warn("three.object3d: .translate() has been removed. use .translateonaxis( axis, distance ) instead.");return this.translateonaxis(b,a)}});object.defineproperties(x.prototype,{eulerorder:{get:function(){console.warn("three.object3d: .eulerorder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("three.object3d: .eulerorder is now .rotation.order.");this.rotation.order=a}},usequaternion:{get:function(){console.warn("three.object3d: .usequaternion has been removed. the library now uses quaternions by default.")}, set:function(){console.warn("three.object3d: .usequaternion has been removed. the library now uses quaternions by default.")}}});object.defineproperties(ec.prototype,{objects:{get:function(){console.warn("three.lod: .objects has been renamed to .levels.");return this.levels}}});fa.prototype.setlens=function(a,b){console.warn("three.perspectivecamera.setlens is deprecated. use .setfocallength and .filmgauge for a photographic setup.");void 0!==b&&(this.filmgauge=b);this.setfocallength(a)};object.defineproperties(ma.prototype, {onlyshadow:{set:function(){console.warn("three.light: .onlyshadow has been removed.")}},shadowcamerafov:{set:function(a){console.warn("three.light: .shadowcamerafov is now .shadow.camera.fov.");this.shadow.camera.fov=a}},shadowcameraleft:{set:function(a){console.warn("three.light: .shadowcameraleft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowcameraright:{set:function(a){console.warn("three.light: .shadowcameraright is now .shadow.camera.right.");this.shadow.camera.right=a}},shadowcameratop:{set:function(a){console.warn("three.light: .shadowcameratop is now .shadow.camera.top."); this.shadow.camera.top=a}},shadowcamerabottom:{set:function(a){console.warn("three.light: .shadowcamerabottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=a}},shadowcameranear:{set:function(a){console.warn("three.light: .shadowcameranear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowcamerafar:{set:function(a){console.warn("three.light: .shadowcamerafar is now .shadow.camera.far.");this.shadow.camera.far=a}},shadowcameravisible:{set:function(){console.warn("three.light: .shadowcameravisible has been removed. use new three.camerahelper( light.shadow.camera ) instead.")}}, shadowbias:{set:function(a){console.warn("three.light: .shadowbias is now .shadow.bias.");this.shadow.bias=a}},shadowdarkness:{set:function(){console.warn("three.light: .shadowdarkness has been removed.")}},shadowmapwidth:{set:function(a){console.warn("three.light: .shadowmapwidth is now .shadow.mapsize.width.");this.shadow.mapsize.width=a}},shadowmapheight:{set:function(a){console.warn("three.light: .shadowmapheight is now .shadow.mapsize.height.");this.shadow.mapsize.height=a}}});object.defineproperties(u.prototype, {length:{get:function(){console.warn("three.bufferattribute: .length has been deprecated. use .count instead.");return this.array.length}}});object.assign(i.prototype,{addindex:function(a){console.warn("three.buffergeometry: .addindex() has been renamed to .setindex().");this.setindex(a)},adddrawcall:function(a,b,c){void 0!==c&&console.warn("three.buffergeometry: .adddrawcall() no longer supports indexoffset.");console.warn("three.buffergeometry: .adddrawcall() is now .addgroup().");this.addgroup(a, b)},cleardrawcalls:function(){console.warn("three.buffergeometry: .cleardrawcalls() is now .cleargroups().");this.cleargroups()},computetangents:function(){console.warn("three.buffergeometry: .computetangents() has been removed.")},computeoffsets:function(){console.warn("three.buffergeometry: .computeoffsets() has been removed.")}});object.defineproperties(i.prototype,{drawcalls:{get:function(){console.error("three.buffergeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("three.buffergeometry: .offsets has been renamed to .groups."); return this.groups}}});object.defineproperties(kd.prototype,{dynamic:{set:function(){console.warn("three.uniform: .dynamic has been removed. use object.onbeforerender() instead.")}},onupdate:{value:function(){console.warn("three.uniform: .onupdate() has been removed. use object.onbeforerender() instead.");return this}}});object.defineproperties(x.prototype,{wraparound:{get:function(){console.warn("three."+this.type+": .wraparound has been removed.")},set:function(){console.warn("three."+this.type+ ": .wraparound has been removed.")}},wraprgb:{get:function(){console.warn("three."+this.type+": .wraprgb has been removed.");return new j}}});object.defineproperties(ca.prototype,{metal:{get:function(){console.warn("three.meshphongmaterial: .metal has been removed. use three.meshstandardmaterial instead.");return!1},set:function(){console.warn("three.meshphongmaterial: .metal has been removed. use three.meshstandardmaterial instead")}}});object.defineproperties(ha.prototype,{derivatives:{get:function(){console.warn("three.shadermaterial: .derivatives has been moved to .extensions.derivatives."); return this.extensions.derivatives},set:function(a){console.warn("three. shadermaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});object.assign(yd.prototype,{supportsfloattextures:function(){console.warn("three.webglrenderer: .supportsfloattextures() is now .extensions.get( 'oes_texture_float' ).");return this.extensions.get("oes_texture_float")},supportshalffloattextures:function(){console.warn("three.webglrenderer: .supportshalffloattextures() is now .extensions.get( 'oes_texture_half_float' )."); return this.extensions.get("oes_texture_half_float")},supportsstandardderivatives:function(){console.warn("three.webglrenderer: .supportsstandardderivatives() is now .extensions.get( 'oes_standard_derivatives' ).");return this.extensions.get("oes_standard_derivatives")},supportscompressedtextures3tc:function(){console.warn("three.webglrenderer: .supportscompressedtextures3tc() is now .extensions.get( 'webgl_compressed_texture_s3tc' ).");return this.extensions.get("webgl_compressed_texture_s3tc")}, supportscompressedtexturepvrtc:function(){console.warn("three.webglrenderer: .supportscompressedtexturepvrtc() is now .extensions.get( 'webgl_compressed_texture_pvrtc' ).");return this.extensions.get("webgl_compressed_texture_pvrtc")},supportsblendminmax:function(){console.warn("three.webglrenderer: .supportsblendminmax() is now .extensions.get( 'ext_blend_minmax' ).");return this.extensions.get("ext_blend_minmax")},supportsvertextextures:function(){console.warn("three.webglrenderer: .supportsvertextextures() is now .capabilities.vertextextures."); return this.capabilities.vertextextures},supportsinstancedarrays:function(){console.warn("three.webglrenderer: .supportsinstancedarrays() is now .extensions.get( 'angle_instanced_arrays' ).");return this.extensions.get("angle_instanced_arrays")},enablescissortest:function(a){console.warn("three.webglrenderer: .enablescissortest() is now .setscissortest().");this.setscissortest(a)},initmaterial:function(){console.warn("three.webglrenderer: .initmaterial() has been removed.")},addpreplugin:function(){console.warn("three.webglrenderer: .addpreplugin() has been removed.")}, addpostplugin:function(){console.warn("three.webglrenderer: .addpostplugin() has been removed.")},updateshadowmap:function(){console.warn("three.webglrenderer: .updateshadowmap() has been removed.")}});object.defineproperties(yd.prototype,{shadowmapenabled:{get:function(){return this.shadowmap.enabled},set:function(a){console.warn("three.webglrenderer: .shadowmapenabled is now .shadowmap.enabled.");this.shadowmap.enabled=a}},shadowmaptype:{get:function(){return this.shadowmap.type},set:function(a){console.warn("three.webglrenderer: .shadowmaptype is now .shadowmap.type."); this.shadowmap.type=a}},shadowmapcullface:{get:function(){return this.shadowmap.cullface},set:function(a){console.warn("three.webglrenderer: .shadowmapcullface is now .shadowmap.cullface.");this.shadowmap.cullface=a}}});object.defineproperties(ke.prototype,{cullface:{get:function(){return this.renderreversesided?2:1},set:function(a){a=1!==a;console.warn("webglrenderer: .shadowmap.cullface is deprecated. set .shadowmap.renderreversesided to "+a+".");this.renderreversesided=a}}});object.defineproperties(ya.prototype, {wraps:{get:function(){console.warn("three.webglrendertarget: .wraps is now .texture.wraps.");return this.texture.wraps},set:function(a){console.warn("three.webglrendertarget: .wraps is now .texture.wraps.");this.texture.wraps=a}},wrapt:{get:function(){console.warn("three.webglrendertarget: .wrapt is now .texture.wrapt.");return this.texture.wrapt},set:function(a){console.warn("three.webglrendertarget: .wrapt is now .texture.wrapt.");this.texture.wrapt=a}},magfilter:{get:function(){console.warn("three.webglrendertarget: .magfilter is now .texture.magfilter."); return this.texture.magfilter},set:function(a){console.warn("three.webglrendertarget: .magfilter is now .texture.magfilter.");this.texture.magfilter=a}},minfilter:{get:function(){console.warn("three.webglrendertarget: .minfilter is now .texture.minfilter.");return this.texture.minfilter},set:function(a){console.warn("three.webglrendertarget: .minfilter is now .texture.minfilter.");this.texture.minfilter=a}},anisotropy:{get:function(){console.warn("three.webglrendertarget: .anisotropy is now .texture.anisotropy."); return this.texture.anisotropy},set:function(a){console.warn("three.webglrendertarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("three.webglrendertarget: .offset is now .texture.offset.");return this.texture.offset},set:function(a){console.warn("three.webglrendertarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("three.webglrendertarget: .repeat is now .texture.repeat.");return this.texture.repeat}, set:function(a){console.warn("three.webglrendertarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("three.webglrendertarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("three.webglrendertarget: .format is now .texture.format.");this.texture.format=a}},type:{get:function(){console.warn("three.webglrendertarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("three.webglrendertarget: .type is now .texture.type."); this.texture.type=a}},generatemipmaps:{get:function(){console.warn("three.webglrendertarget: .generatemipmaps is now .texture.generatemipmaps.");return this.texture.generatemipmaps},set:function(a){console.warn("three.webglrendertarget: .generatemipmaps is now .texture.generatemipmaps.");this.texture.generatemipmaps=a}}});hc.prototype.load=function(a){console.warn("three.audio: .load has been deprecated. use three.audioloader instead.");var b=this;(new ge).load(a,function(a){b.setbuffer(a)});return this}; le.prototype.getdata=function(){console.warn("three.audioanalyser: .getdata() is now .getfrequencydata().");return this.getfrequencydata()};l.webglrendertargetcube=gb;l.webglrendertarget=ya;l.webglrenderer=yd;l.shaderlib=bb;l.uniformslib=v;l.uniformsutils=ja;l.shaderchunk=z;l.fogexp2=kb;l.fog=lb;l.scene=mb;l.lensflare=zd;l.sprite=dc;l.lod=ec;l.skinnedmesh=qd;l.skeleton=od;l.bone=pd;l.mesh=aa;l.linesegments=ga;l.line=ua;l.points=mb;l.group=fc;l.videotexture=rd;l.datatexture=eb;l.compressedtexture= nb;l.cubetexture=za;l.canvastexture=sd;l.depthtexture=gc;l.texture=ea;l.compressedtextureloader=re;l.datatextureloader=ae;l.cubetextureloader=be;l.textureloader=td;l.objectloader=se;l.materialloader=hd;l.buffergeometryloader=ce;l.defaultloadingmanager=ta;l.loadingmanager=$d;l.jsonloader=de;l.imageloader=yc;l.fontloader=ue;l.fileloader=sa;l.loader=zb;l.cache=ld;l.audioloader=ge;l.spotlightshadow=vd;l.spotlight=wd;l.pointlight=xd;l.rectarealight=he;l.hemispherelight=ud;l.directionallightshadow=yd;l.directionallight= zd;l.ambientlight=ad;l.lightshadow=wb;l.light=ma;l.stereocamera=ve;l.perspectivecamera=fa;l.orthographiccamera=jb;l.cubecamera=id;l.camera=ra;l.audiolistener=ie;l.positionalaudio=ke;l.audiocontext=je;l.audioanalyser=le;l.audio=hc;l.vectorkeyframetrack=dc;l.stringkeyframetrack=ed;l.quaternionkeyframetrack=$c;l.numberkeyframetrack=ec;l.colorkeyframetrack=gd;l.booleankeyframetrack=fd;l.propertymixer=jd;l.propertybinding=ka;l.keyframetrack=yb;l.animationutils=na;l.animationobjectgroup=me;l.animationmixer= cd;l.animationclip=qa;l.uniform=kd;l.instancedbuffergeometry=eb;l.buffergeometry=i;l.geometryidcount=function(){return vd++};l.geometry=t;l.interleavedbufferattribute=oe;l.instancedinterleavedbuffer=jc;l.interleavedbuffer=ic;l.instancedbufferattribute=kc;l.face3=ha;l.object3d=x;l.raycaster=pe;l.layers=nd;l.eventdispatcher=pa;l.clock=re;l.quaternionlinearinterpolant=dd;l.linearinterpolant=zc;l.discreteinterpolant=cd;l.cubicinterpolant=bd;l.interpolant=xa;l.triangle=za;l.math=n;l.spherical=se;l.cylindrical= te;l.plane=la;l.frustum=tc;l.sphere=na;l.ray=cb;l.matrix4=s;l.matrix3=ya;l.box3=pa;l.box2=sc;l.line3=hb;l.euler=db;l.vector4=fa;l.vector3=q;l.vector2=d;l.quaternion=ca;l.color=j;l.morphblendmesh=oa;l.immediaterenderobject=dd;l.vertexnormalshelper=ed;l.spotlighthelper=lc;l.skeletonhelper=mc;l.pointlighthelper=nc;l.rectarealighthelper=oc;l.hemispherelighthelper=pc;l.gridhelper=fd;l.polargridhelper=ld;l.facenormalshelper=gd;l.directionallighthelper=qc;l.camerahelper=hd;l.boxhelper=rc;l.arrowhelper=fb; l.axishelper=nd;l.catmullromcurve3=va;l.cubicbeziercurve3=id;l.quadraticbeziercurve3=jd;l.linecurve3=kd;l.arccurve=od;l.ellipsecurve=wa;l.splinecurve=cb;l.cubicbeziercurve=fc;l.quadraticbeziercurve=gc;l.linecurve=ta;l.shape=db;l.path=bd;l.shapepath=ee;l.font=fe;l.curvepath=ad;l.curve=ua;l.shapeutils=ia;l.sceneutils={createmultimaterialobject:function(a,b){for(var c=new fc,d=0,e=b.length;d