// threejs.org/license (function(l,ja){"object"===typeof exports&&"undefined"!==typeof module?ja(exports):"function"===typeof define&&define.amd?define(["exports"],ja):ja(l.three={})})(this,function(l){function ja(){}function a(a,b){this.x=a||0;this.y=b||0}function q(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0b&&(b=a[c]);return b}function d(){object.defineproperty(this,"id",{value:sf+=2});this.uuid=g.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}; this.userdata={}}function mb(a,b,c,d,e,f){r.call(this);this.type="boxgeometry";this.parameters={width:a,height:b,depth:c,widthsegments:d,heightsegments:e,depthsegments:f};this.frombuffergeometry(new pb(a,b,c,d,e,f));this.mergevertices()}function pb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,la,b,fa){var r=f/la,u=g/b,w=f/2,v=g/2,z=l/2;g=la+1;var i=b+1,y=f=0,p,a,c=new n;for(a=0;am;m++){if(p=d[m])if(h=p[0],k=p[1]){q&&e.addattribute("morphtarget"+m, q[h]);f&&e.addattribute("morphnormal"+m,f[h]);c[m]=k;continue}c[m]=0}g.getuniforms().setvalue(a,"morphtargetinfluences",c)}}}function dg(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isgeometry&&g.updatefromobject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function za(a,b,c,d,e,f,g,h,k,m){a=void 0!==a?a:[];s.call(this,a,void 0!==b?b:301,c,d,e,f,g,h,k,m);this.flipy=!1}function nb(a,b,c,d){s.call(this,null);this.image={data:a, width:b,height:c,depth:d};this.minfilter=this.magfilter=1003;this.flipy=this.generatemipmaps=!1}function ob(a,b,c){var d=a[0];if(0>=d||0/gm, function(a,c){a=n[c];if(void 0===a)throw error("can not resolve #include <"+c+">");return be(a)})}function df(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\s]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseint(c);cd||a.height>d)e=d/math.max(a.width,a.height);if(1>e||!0===b){if(a instanceof htmlimageelement||a instanceof htmlcanvaselement||a instanceof imagebitmap)return void 0===la&&(la=document.createelementns("http://www.w3.org/1999/xhtml","canvas")),c=c?document.createelementns("http://www.w3.org/1999/xhtml","canvas"):la,b=b?g.floorpoweroftwo:math.floor,c.width=b(e*a.width),c.height=b(e*a.height),c.getcontext("2d").drawimage(a,0,0,c.width,c.height),console.warn("three.webglrenderer: texture has been resized from ("+ a.width+"x"+a.height+") to ("+c.width+"x"+c.height+")."),c;"data"in a&&console.warn("three.webglrenderer: image in datatexture is too big ("+a.width+"x"+a.height+").")}return a}function k(a){return g.ispoweroftwo(a.width)&&g.ispoweroftwo(a.height)}function m(a,b){return a.generatemipmaps&&b&&1003!==a.minfilter&&1006!==a.minfilter}function q(b,c,e,f){a.generatemipmap(b);d.get(c).__maxmiplevel=math.log(math.max(e,f))*math.log2e}function p(a,c){if(!e.iswebgl2)return a;var d=a;6403===a&&(5126===c&&(d= 33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("ext_color_buffer_float"):(34843===d||34837===d)&&console.warn("three.webglrenderer: floating point textures with rgb format not supported. please use rgba instead.");return d}function t(a){return 1003===a||1004===a||1005===a?9728:9729}function l(b){b=b.target; b.removeeventlistener("dispose",l);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.remove(b)}b.isvideotexture&&delete p[b.id];g.memory.textures--}function r(b){b=b.target;b.removeeventlistener("dispose",r);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.remove(b.texture);d.remove(b)}g.memory.textures--}function u(a,b){var e=d.get(a);if(a.isvideotexture){var f=a.id,h=g.render.frame;p[f]!==h&&(p[f]=h,a.update())}if(0w;w++)u[w]=t||x?x?b.image[w].image:b.image[w]:h(b.image[w],!1,!0,e.maxcubemapsize); var v=u[0],b=k(v)||e.iswebgl2,y=f.convert(b.format),z=f.convert(b.type),i=p(y,z);n(34067,b,b);for(w=0;6>w;w++)if(t)for(var la,p=u[w].mipmaps,fa=0,a=p.length;fax;x++)h.__webglframebuffer[x]=a.createframebuffer();else if(h.__webglframebuffer=a.createframebuffer(),x)if(e.iswebgl2){h.__webglmultisampledframebuffer=a.createframebuffer();h.__webglcolorrenderbuffer=a.createrenderbuffer();a.bindrenderbuffer(36161,h.__webglcolorrenderbuffer);x=f.convert(b.texture.format);var b=f.convert(b.texture.type); x=p(x,b);b=y(b);a.renderbufferstoragemultisample(36161,b,x,b.width,b.height);a.bindframebuffer(36160,h.__webglmultisampledframebuffer);a.framebufferrenderbuffer(36160,36064,36161,h.__webglcolorrenderbuffer);a.bindrenderbuffer(36161,null);b.depthbuffer&&(h.__webgldepthrenderbuffer=a.createrenderbuffer(),i(h.__webgldepthrenderbuffer,b,!0));a.bindframebuffer(36160,null)}else console.warn("three.webglrenderer: webglmultisamplerendertarget can only be used with webgl2.");if(l){c.bindtexture(34067,t.__webgltexture); n(34067,b.texture,w);for(x=0;6>x;x++)v(h.__webglframebuffer[x],b,36064,34069+x);m(b.texture,w)&&q(34067,b.texture,b.width,b.height);c.bindtexture(34067,null)}else c.bindtexture(3553,t.__webgltexture),n(3553,b.texture,w),v(h.__webglframebuffer,b,36064,3553),m(b.texture,w)&&q(3553,b.texture,b.width,b.height),c.bindtexture(3553,null);if(b.depthbuffer){h=d.get(b);t=!0===b.iswebglrendertargetcube;if(b.depthtexture){if(t)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(36160,h.__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);u(b.depthtexture,0);h=d.get(b.depthtexture).__webgltexture;if(1026===b.depthtexture.format)a.framebuffertexture2d(36160, 36096,3553,h,0);else if(1027===b.depthtexture.format)a.framebuffertexture2d(36160,33306,3553,h,0);else throw error("unknown depthtexture format");}else if(t)for(h.__webgldepthbuffer=[],t=0;6>t;t++)a.bindframebuffer(36160,h.__webglframebuffer[t]),h.__webgldepthbuffer[t]=a.createrenderbuffer(),i(h.__webgldepthbuffer[t],b);else a.bindframebuffer(36160,h.__webglframebuffer),h.__webgldepthbuffer=a.createrenderbuffer(),i(h.__webgldepthbuffer,b);a.bindframebuffer(36160,null)}};this.updaterendertargetmipmap= function(a){var b=a.texture,f=k(a)||e.iswebgl2;if(m(b,f)){f=a.iswebglrendertargetcube?34067:3553;var g=d.get(b).__webgltexture;c.bindtexture(f,g);q(f,b,a.width,a.height);c.bindtexture(f,null)}};this.updatemultisamplerendertarget=function(b){if(b.iswebglmultisamplerendertarget)if(e.iswebgl2){var c=d.get(b);a.bindframebuffer(36008,c.__webglmultisampledframebuffer);a.bindframebuffer(36009,c.__webglframebuffer);c=b.width;var f=b.height,g=16384;b.depthbuffer&&(g|=256);b.stencilbuffer&&(g|=1024);a.blitframebuffer(0, 0,c,f,0,0,c,f,g,9728)}else console.warn("three.webglrenderer: webglmultisamplerendertarget can only be used with webgl2.")}}function hf(a,b,c){return{convert:function(a){if(1e3===a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120; if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.iswebgl2)return 5131;var d=b.get("oes_texture_half_float");if(null!==d)return d.half_float_oes}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200=== a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209===a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("webgl_compressed_texture_s3tc"),null!==d){if(33776===a)return d.compressed_rgb_s3tc_dxt1_ext;if(33777===a)return d.compressed_rgba_s3tc_dxt1_ext;if(33778===a)return d.compressed_rgba_s3tc_dxt3_ext;if(33779===a)return d.compressed_rgba_s3tc_dxt5_ext}if(35840=== a||35841===a||35842===a||35843===a)if(d=b.get("webgl_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.compressed_rgb_pvrtc_4bppv1_img;if(35841===a)return d.compressed_rgb_pvrtc_2bppv1_img;if(35842===a)return d.compressed_rgba_pvrtc_4bppv1_img;if(35843===a)return d.compressed_rgba_pvrtc_2bppv1_img}if(36196===a&&(d=b.get("webgl_compressed_texture_etc1"),null!==d))return d.compressed_rgb_etc1_webgl;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816=== a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("webgl_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.iswebgl2){if(103===a)return 32775;if(104===a)return 32776}d=b.get("ext_blend_minmax");if(null!==d){if(103===a)return d.min_ext;if(104===a)return d.max_ext}}if(1020===a){if(c.iswebgl2)return 34042;d=b.get("webgl_depth_texture");if(null!==d)return d.unsigned_int_24_8_webgl}return 0}}}function pb(){e.call(this);this.type="group"}function ta(){e.call(this);this.type= "camera";this.matrixworldinverse=new q;this.projectionmatrix=new q;this.projectionmatrixinverse=new q}function x(a,b,c,d){ta.call(this);this.type="perspectivecamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2e3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmgauge=35;this.filmoffset=0;this.updateprojectionmatrix()}function dc(a){x.call(this);this.cameras=a||[]}function jf(a,b,c){kf.setfrommatrixposition(b.matrixworld);lf.setfrommatrixposition(c.matrixworld); var d=kf.distanceto(lf),e=b.projectionmatrix.elements,f=c.projectionmatrix.elements,g=e[14]/(e[10]-1);c=e[14]/(e[10]+1);var h=(e[9]+1)/e[5],k=(e[9]-1)/e[5],m=(e[8]-1)/e[0],q=(f[8]+1)/f[0];e=g*m;f=g*q;q=d/(-m+q);m=q*-m;b.matrixworld.decompose(a.position,a.quaternion,a.scale);a.translatex(m);a.translatez(q);a.matrixworld.compose(a.position,a.quaternion,a.scale);a.matrixworldinverse.getinverse(a.matrixworld);b=g+q;g=c+q;a.projectionmatrix.makeperspective(e-m,f+(d-m),h*c/g*b,k*c/g*b,b,g)}function mf(a){function b(){return null!== e&&!0===e.ispresenting}function c(){if(b()){var c=e.geteyeparameters("left"),f=c.renderwidth*q;c=c.renderheight*q;i=a.getpixelratio();v=a.getsize();a.setdrawingbuffersize(2*f,c,1);p.start()}else d.enabled&&a.setdrawingbuffersize(v.width,v.height,i),p.stop()}var d=this,e=null,f=null,g=null,h=[],k=new q,m=new q,q=1,p="stage";"undefined"!==typeof window&&"vrframedata"in window&&(f=new window.vrframedata,window.addeventlistener("vrdisplaypresentchange",c,!1));var t=new q,l=new ka,r=new n,u=new x;u.bounds= new v(0,0,.5,1);u.layers.enable(1);var w=new x;w.bounds=new v(.5,0,.5,1);w.layers.enable(2);var z=new dc([u,w]);z.layers.enable(1);z.layers.enable(2);var v,i,y=[];this.enabled=!1;this.getcontroller=function(a){var b=h[a];void 0===b&&(b=new pb,b.matrixautoupdate=!1,b.visible=!1,h[a]=b);return b};this.getdevice=function(){return e};this.setdevice=function(a){void 0!==a&&(e=a);p.setcontext(a)};this.setframebufferscalefactor=function(a){q=a};this.setframeofreferencetype=function(a){p=a};this.setposetarget= function(a){void 0!==a&&(g=a)};this.getcamera=function(a){var b="stage"===p?1.6:0;if(null===e)return a.position.set(0,b,0),a;e.depthnear=a.near;e.depthfar=a.far;e.getframedata(f);if("stage"===p){var c=e.stageparameters;c?k.fromarray(c.sittingtostandingtransform):k.maketranslation(0,b,0)}b=f.pose;c=null!==g?g:a;c.matrix.copy(k);c.matrix.decompose(c.position,c.quaternion,c.scale);null!==b.orientation&&(l.fromarray(b.orientation),c.quaternion.multiply(l));null!==b.position&&(l.setfromrotationmatrix(k), r.fromarray(b.position),r.applyquaternion(l),c.position.add(r));c.updatematrixworld();if(!1===e.ispresenting)return a;u.near=a.near;w.near=a.near;u.far=a.far;w.far=a.far;u.matrixworldinverse.fromarray(f.leftviewmatrix);w.matrixworldinverse.fromarray(f.rightviewmatrix);m.getinverse(k);"stage"===p&&(u.matrixworldinverse.multiply(m),w.matrixworldinverse.multiply(m));a=c.parent;null!==a&&(t.getinverse(a.matrixworld),u.matrixworldinverse.multiply(t),w.matrixworldinverse.multiply(t));u.matrixworld.getinverse(u.matrixworldinverse); w.matrixworld.getinverse(w.matrixworldinverse);u.projectionmatrix.fromarray(f.leftprojectionmatrix);w.projectionmatrix.fromarray(f.rightprojectionmatrix);jf(z,u,w);a=e.getlayers();a.length&&(a=a[0],null!==a.leftbounds&&4===a.leftbounds.length&&u.bounds.fromarray(a.leftbounds),null!==a.rightbounds&&4===a.rightbounds.length&&w.bounds.fromarray(a.rightbounds));a:for(a=0;af.normalmatrix.determinant();aa.setmaterial(e,h);var k=t(a,c,e,f),m=!1;if(b!==d.id||n!==k.id||vd!==(!0===e.wireframe))b=d.id,n=k.id,vd=!0===e.wireframe,m=!0;f.morphtargetinfluences&&(za.update(f,d,e,k),m=!0);h=d.index;var q=d.attributes.position;c=1;!0===e.wireframe&&(h=va.getwireframeattribute(d),c=2);a=aa;if(null!==h){var p=sa.get(h);a=ba;a.setindex(p)}if(m){if(d&&d.isinstancedbuffergeometry&!ya.iswebgl2&&null===ma.get("angle_instanced_arrays"))console.error("three.webglrenderer.setupvertexattributes: using three.instancedbuffergeometry but hardware does not support extension angle_instanced_arrays."); else{aa.initattributes();m=d.attributes;k=k.getattributes();var l=e.defaultattributevalues;for(b in k){var r=k[b];if(0<=r){var x=m[b];if(void 0!==x){var u=x.normalized,n=x.itemsize,w=sa.get(x);if(void 0!==w){var v=w.buffer,z=w.type;w=w.bytesperelement;if(x.isinterleavedbufferattribute){var y=x.data,i=y.stride;x=x.offset;y&&y.isinstancedinterleavedbuffer?(aa.enableattributeanddivisor(r,y.meshperattribute),void 0===d.maxinstancedcount&&(d.maxinstancedcount=y.meshperattribute*y.count)):aa.enableattribute(r); o.bindbuffer(34962,v);o.vertexattribpointer(r,n,z,u,i*w,x*w)}else x.isinstancedbufferattribute?(aa.enableattributeanddivisor(r,x.meshperattribute),void 0===d.maxinstancedcount&&(d.maxinstancedcount=x.meshperattribute*x.count)):aa.enableattribute(r),o.bindbuffer(34962,v),o.vertexattribpointer(r,n,z,u,0,0)}}else if(void 0!==l&&(u=l[b],void 0!==u))switch(u.length){case 2:o.vertexattrib2fv(r,u);break;case 3:o.vertexattrib3fv(r,u);break;case 4:o.vertexattrib4fv(r,u);break;default:o.vertexattrib1fv(r,u)}}}aa.disableunusedattributes()}null!== h&&o.bindbuffer(34963,p.buffer)}p=infinity;null!==h?p=h.count:void 0!==q&&(p=q.count);h=d.drawrange.start*c;q=null!==g?g.start*c:0;var b=math.max(h,q);g=math.max(0,math.min(p,h+d.drawrange.count*c,q+(null!==g?g.count*c:infinity))-1-b+1);if(0!==g){if(f.ismesh)if(!0===e.wireframe)aa.setlinewidth(e.wireframelinewidth*(null===r?t:1)),a.setmode(1);else switch(f.drawmode){case 0:a.setmode(4);break;case 1:a.setmode(5);break;case 2:a.setmode(6)}else f.isline?(e=e.linewidth,void 0===e&&(e=1),aa.setlinewidth(e* (null===r?t:1)),f.islinesegments?a.setmode(1):f.islineloop?a.setmode(2):a.setmode(3)):f.ispoints?a.setmode(0):f.issprite&&a.setmode(4);d&&d.isinstancedbuffergeometry?0=ya.maxtextures&&console.warn("three.webglrenderer: trying to use "+ a+" texture units while this gpu supports only "+ya.maxtextures);ca+=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);da.settexture2d(b,c)}}();this.settexture3d=function(){return function(a,b){da.settexture3d(a,b)}}();this.settexture=function(){var a=!1;return function(b,c){a||(console.warn("three.webglrenderer: .settexture is deprecated, use settexture2d instead."), a=!0);da.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?da.settexturecube(b,c):da.settexturecubedynamic(b,c)}}();this.setframebuffer=function(a){j=a};this.getrendertarget=function(){return r};this.setrendertarget=function(a){(r= a)&&void 0===da.get(a).__webglframebuffer&&da.setuprendertarget(a);var b=j,c=!1;a?(b=da.get(a).__webglframebuffer,a.iswebglrendertargetcube?(b=b[a.activecubeface],c=!0):b=a.iswebglmultisamplerendertarget?da.get(a).__webglmultisampledframebuffer:b,u.copy(a.viewport),cc.copy(a.scissor),ea=a.scissortest):(u.copy(ha).multiplyscalar(t),cc.copy(ka).multiplyscalar(t),ea=ta);k!==b&&(o.bindframebuffer(36160,b),k=b);aa.viewport(u);aa.scissor(cc);aa.setscissortest(ea);c&&(c=da.get(a.texture),o.framebuffertexture2d(36160, 36064,34069+a.activecubeface,c.__webgltexture,a.activemipmaplevel))};this.readrendertargetpixels=function(a,b,c,d,e,f){if(a&&a.iswebglrendertarget){var g=da.get(a).__webglframebuffer;if(g){var h=!1;g!==k&&(o.bindframebuffer(36160,g),h=!0);try{var k=a.texture,m=k.format,q=k.type;1023!==m&&ia.convert(m)!==o.getparameter(35739)?console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not in rgba or implementation defined format."):1009===q||ia.convert(q)===o.getparameter(35738)||1015=== q&&(ya.iswebgl2||ma.get("oes_texture_float")||ma.get("webgl_color_buffer_float"))||1016===q&&(ya.iswebgl2?ma.get("ext_color_buffer_float"):ma.get("ext_color_buffer_half_float"))?36053===o.checkframebufferstatus(36160)?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&o.readpixels(b,c,d,e,ia.convert(m),ia.convert(q),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&& o.bindframebuffer(36160,k)}}}else console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not three.webglrendertarget.")};this.copyframebuffertotexture=function(a,b,c){var d=b.image.width,e=b.image.height,f=ia.convert(b.format);this.settexture2d(b,0);o.copyteximage2d(3553,c||0,f,a.x,a.y,d,e,0)};this.copytexturetotexture=function(a,b,c,d){var e=b.image.width,f=b.image.height,g=ia.convert(c.format),h=ia.convert(c.type);this.settexture2d(c,0);b.isdatatexture?o.texsubimage2d(3553,d|| 0,a.x,a.y,e,f,g,h,b.image.data):o.texsubimage2d(3553,d||0,a.x,a.y,g,h,b.image)}}function qb(a,b){this.name="";this.color=new h(a);this.density=void 0!==b?b:2.5e-4}function rb(a,b,c){this.name="";this.color=new h(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1e3}function yd(){e.call(this);this.type="scene";this.overridematerial=this.fog=this.background=null;this.autoupdate=!0}function sb(a,b){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.version=0}function ec(a,b,c,d){this.data=a;this.itemsize=b;this.offset=c;this.normalized=!0===d}function ib(a){l.call(this);this.type="spritematerial";this.color=new h(16777215);this.map=null;this.rotation=0;this.sizeattenuation=!0;this.lights=!1;this.transparent=!0;this.setvalues(a)}function fc(a){e.call(this);this.type="sprite";if(void 0===sb){sb=new d;var b=new float32array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new sb(b,5);sb.setindex([0,1,2,0,2,3]);sb.addattribute("position", new ec(b,3,0,!1));sb.addattribute("uv",new ec(b,2,3,!1))}this.geometry=sb;this.material=void 0!==a?a:new ib;this.center=new a(.5,.5)}function gc(){e.call(this);this.type="lod";object.defineproperties(this,{levels:{enumerable:!0,value:[]}})}function hc(a,b){a&&a.isgeometry&&console.error("three.skinnedmesh no longer supports three.geometry. use three.buffergeometry instead.");oa.call(this,a,b);this.type="skinnedmesh";this.bindmode="attached";this.bindmatrix=new q;this.bindmatrixinverse=new q}function zd(a, b){a=a||[];this.bones=a.slice(0);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 boneinverses is the wrong length."),this.boneinverses=[],a=0,b=this.bones.length;ac;c++){var p=q[h[c]];var t=q[h[(c+1)%3]];f[0]=math.min(p,t);f[1]=math.max(p,t);p=f[0]+","+f[1];void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]})}}for(p in g)m=g[p],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&& a.isbuffergeometry)if(h=new n,null!==a.index){k=a.attributes.position;q=a.index;var l=a.groups;0===l.length&&(l=[{start:0,count:q.count,materialindex:0}]);a=0;for(e=l.length;ac;c++)p=q.getx(m+c),t=q.getx(m+(c+1)%3),f[0]=math.min(p,t),f[1]=math.max(p,t),p=f[0]+","+f[1],void 0===g[p]&&(g[p]={index1:f[0],index2:f[1]});for(p in g)m=g[p],h.frombufferattribute(k,m.index1),b.push(h.x,h.y,h.z),h.frombufferattribute(k,m.index2),b.push(h.x, h.y,h.z)}else for(k=a.attributes.position,m=0,d=k.count/3;mc;c++)g=3*m+c,h.frombufferattribute(k,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.frombufferattribute(k,g),b.push(h.x,h.y,h.z);this.addattribute("position",new c(b,3))}function kc(a,b,c){r.call(this);this.type="parametricgeometry";this.parameters={func:a,slices:b,stacks:c};this.frombuffergeometry(new wb(a,b,c));this.mergevertices()}function wb(a,b,c){d.call(this);this.type="parametricbuffergeometry";this.parameters={func:a,slices:b, stacks:c};var d=[],e=[],f=[],g=[],h=new n,k=new n,m=new n,q=new n,p=new n,t,l;3>a.length&&console.error("three.parametricgeometry: function must now modify a vector3 as third parameter.");var r=b+1;for(t=0;t<=c;t++){var u=t/c;for(l=0;l<=b;l++){var w=l/b;a(w,u,k);e.push(k.x,k.y,k.z);0<=w-1e-5?(a(w-1e-5,u,m),q.subvectors(k,m)):(a(w+1e-5,u,m),q.subvectors(m,k));0<=u-1e-5?(a(w,u-1e-5,m),p.subvectors(k,m)):(a(w,u+1e-5,m),p.subvectors(m,k));h.crossvectors(q,p).normalize();f.push(h.x,h.y,h.z);g.push(w,u)}}for(t= 0;td&&1===a.x&&(k[b]=a.x-1);0===c.x&&0===c.z&&(k[b]=d/2/math.pi+.5)}d.call(this);this.type="polyhedronbuffergeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],k=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;he&&(.2>b&&(k[a+0]+=1),.2>c&&(k[a+2]+=1),.2>d&&(k[a+ 4]+=1))})();this.addattribute("position",new c(h,3));this.addattribute("normal",new c(h.slice(),3));this.addattribute("uv",new c(k,2));0===d?this.computevertexnormals():this.normalizenormals()}function mc(a,b){r.call(this);this.type="tetrahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new xb(a,b));this.mergevertices()}function xb(a,b){za.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 nc(a,b){r.call(this);this.type="octahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new tb(a,b));this.mergevertices()}function tb(a,b){za.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 oc(a,b){r.call(this);this.type="icosahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new yb(a,b));this.mergevertices()} function yb(a,b){var c=(1+math.sqrt(5))/2;za.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 pc(a,b){r.call(this);this.type="dodecahedrongeometry";this.parameters={radius:a,detail:b};this.frombuffergeometry(new zb(a,b));this.mergevertices()} function zb(a,b){var c=(1+math.sqrt(5))/2,d=1/c;za.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 qc(a,b,c,d,e,f){r.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 $b(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.frombuffergeometry(a);this.mergevertices()}function $b(a,b,c,d,e){function f(e){q=a.getpointat(e/b,q);var f=g.normals[e];e=g.binormals[e];for(t=0;t<=d;t++){var m= t/d*math.pi*2,p=math.sin(m);m=-math.cos(m);k.x=m*f.x+p*e.x;k.y=m*f.y+p*e.y;k.z=m*f.z+p*e.z;k.normalize();r.push(k.x,k.y,k.z);h.x=q.x+c*k.x;h.y=q.y+c*k.y;h.z=q.z+c*k.z;l.push(h.x,h.y,h.z)}}d.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 n,k=new n,m=new a,q=new n,p,t,l=[],r=[],u=[], w=[];for(p=0;p=b;e-=d)f=of(e,a[e],a[e+1],f);f&&ub(f,f.next)&&(tc(f),f=f.next);return f} function uc(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!ub(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{tc(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b}function vc(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,k=h;do null===k.z&&(k.z=ge(k.x,k.y,d,e,f)),k.prevz=k.prev,k=k.nextz=k.next;while(k!==h);k.prevz.nextz=null;k.prevz=null;h=k;var m,q,p,l,x=1;do{k=h;var r=h=null;for(q=0;k;){q++;var n=k;for(m=p=0;mp.x?q.x>x.x?q.x:x.x:p.x>x.x?p.x:x.x,i=q.y>p.y?q.y>x.y?q.y:x.y:p.y>x.y?p.y:x.y;m=ge(q.x=m;){if(w!==r.prev&&w!==r.next&&bd(q.x,q.y,p.x,p.y,x.x,x.y,w.x,w.y)&&0<=qa(w.prev,w,w.next)){r=!1;break a}w=w.prevz}r=!0}}else a:if(r=a,q=r.prev,p=r,x=r.next,0<=qa(q,p,x))r=!1;else{for(m=r.next.next;m!==r.prev;){if(bd(q.x,q.y,p.x,p.y,x.x,x.y,m.x,m.y)&&0<=qa(m.prev,m,m.next)){r=!1;break a}m=m.next}r=!0}if(r)b.push(k.i/c),b.push(a.i/c),b.push(n.i/c),tc(a),h=a=n.next;else if(a=n,a===h){if(!g)vc(uc(a),b,c,d,e,f,1);else if(1=== g){g=b;h=c;k=a;do n=k.prev,r=k.next.next,!ub(n,r)&&pf(n,k,k.next,r)&&wc(n,r)&&wc(r,n)&&(g.push(n.i/h),g.push(k.i/h),g.push(r.i/h),tc(k),tc(k.next),k=a=r),k=k.next;while(k!==a);a=k;vc(a,b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(k=g.i!==h.i){k=g;n=h;if(r=k.next.i!==n.i&&k.prev.i!==n.i){b:{r=k;do{if(r.i!==k.i&&r.next.i!==k.i&&r.i!==n.i&&r.next.i!==n.i&&pf(r,r.next,k,n)){r=!0;break b}r=r.next}while(r!==k);r=!1}r=!r}if(r=r&&wc(k,n)&&wc(n,k)){r=k;q=!1;p=(k.x+n.x)/2;n=(k.y+n.y)/ 2;do r.y>n!==r.next.y>n&&r.next.y!==r.y&&p<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(q=!q),r=r.next;while(r!==k);r=q}k=r}if(k){a=qf(g,h);g=uc(g,g.next);a=uc(a,a.next);vc(g,b,c,d,e,f);vc(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function xg(a,b){return a.x-b.x}function yg(a,b){var c=b,d=a.x,e=a.y,f=-infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h= c.x=c.x&&c.x>=g&&d!==c.x&&bd(eh.x)&&wc(c,a)&&(h=c,m=q)}c=c.next}return h}function ge(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b| b<<1)&1431655765)<<1}function zg(a){var b=a,c=a;do b.xqa(a.prev,a,a.next)?0<=qa(a,b, a.next)&&0<=qa(a,a.prev,b):0>qa(a,b,a.prev)||0>qa(a,a.next,b)}function qf(a,b){var c=new he(a.i,a.x,a.y),d=new he(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function of(a,b,c,d){a=new he(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function tc(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevz&&(a.prevz.nextz=a.nextz);a.nextz&&(a.nextz.prevz=a.prevz)}function he(a,b,c){this.i=a;this.x=b;this.y= c;this.nextz=this.prevz=this.z=this.next=this.prev=null;this.steiner=!1}function rf(a){var b=a.length;2number.epsilon){var k=math.sqrt(h),m=math.sqrt(f*f+g*g);h=b.x-e/k;b=b.y+d/k;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new a(f,d);e=math.sqrt(e/2)}else a=!1,d>number.epsilon?f>number.epsilon&&(a=!0):d<-number.epsilon?f<-number.epsilon&&(a=!0):math.sign(e)===math.sign(g)&&(a=!0),a?(f=-e,e=math.sqrt(h)):(f=d,d=e,e=math.sqrt(h/2));return new a(f/e,d/ e)}function h(a,b){for(m=a.length;0<=--m;){var c=m;var f=m-1;0>f&&(f=a.length-1);var g,h=v+2*b;for(g=0;gq;q++){var p=m[f[q]];var l=m[f[(q+1)%3]];d[0]=math.min(p,l);d[1]=math.max(p,l);p=d[0]+","+d[1];void 0===e[p]?e[p]={index1:d[0],index2:d[1], face1:h,face2:void 0}:e[p].face2=h}for(p in e)if(d=e[p],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addattribute("position",new c(c,3))}function zb(a,b,c,d,e,f,g,h){r.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 ab(a,b,c,d,e,f,g,h));this.mergevertices()}function ab(a, b,c,d,e,f,g,h){function k(c){var e,f=new a,k=new n,p=0,v=!0===c?a:b,u=!0===c?1:-1;var c=r;for(e=1;e<=d;e++)l.push(0,w*u,0),t.push(0,u,0),x.push(.5,.5),r++;var e=r;for(e=0;e<=d;e++){var d=e/d*h+g,g=math.cos(d);d=math.sin(d);k.x=v*d;k.y=w*u;k.z=v*g;l.push(k.x,k.y,k.z);t.push(0,u,0);f.x=.5*g+.5;f.y=.5*d*u+.5;x.push(f.x,f.y);r++}for(e=0;ethis.duration&&this.resetduration()}function ah(a){switch(a.tolowercase()){case "scalar":case "double":case "float":case "number":case "integer":return ic;case "vector":case "vector2":case "vector3":case "vector4":return jc;case "color":return fd;case "quaternion":return ed;case "bool":case "boolean":return ed;case "string":return hd}throw error("three.keyframetrack: unsupported typename: "+a);}function bh(a){if(void 0===a.type)throw error("three.keyframetrack: track type undefined, can not parse"); var b=ah(a.type);if(void 0===a.times){var c=[],d=[];ta.flattenjson(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function ie(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0;this.onstart=void 0;this.onload=a;this.onprogress=b;this.onerror=c;this.itemstart=function(a){g++;if(!1===e&&void 0!==d.onstart)d.onstart(a,f,g);e=!0};this.itemend=function(a){f++;if(void 0!==d.onprogress)d.onprogress(a,f,g);if(f===g&&(e=!1,void 0!==d.onload))d.onload()}; this.itemerror=function(a){if(void 0!==d.onerror)d.onerror(a)};this.resolveurl=function(a){return h?h(a):a};this.seturlmodifier=function(a){h=a;return this}}function ja(a){this.manager=void 0!==a?a:aa}function vf(a){this.manager=void 0!==a?a:aa}function wf(a){this.manager=void 0!==a?a:aa;this._parser=null}function je(a){this.manager=void 0!==a?a:aa;this._parser=null}function fd(a){this.manager=void 0!==a?a:aa}function ke(a){this.manager=void 0!==a?a:aa}function id(a){this.manager=void 0!==a?a:aa} function j(){this.type="curve";this.arclengthdivisions=200}function ea(a,b,c,d,e,f,g,h){j.call(this);this.type="ellipsecurve";this.ax=a||0;this.ay=b||0;this.xradius=c||1;this.yradius=d||1;this.astartangle=e||0;this.aendangle=f||2*math.pi;this.aclockwise=g||!1;this.arotation=h||0}function kc(a,b,c,d,e,f){ea.call(this,a,b,c,c,d,e,f);this.type="arccurve"}function le(){var a=0,b=0,c=0,d=0;return{initcatmullrom:function(e,f,g,h,k){e=k*(g-e);h=k*(h-f);a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},initnonuniformcatmullrom:function(e, f,g,h,k,m,q){e=((f-e)/k-(g-e)/(k+m)+(g-f)/m)*m;h=((g-f)/m-(h-f)/(m+q)+(h-g)/q)*m;a=f;b=e;c=-3*f+3*g-2*e-h;d=2*f-2*g+e+h},calc:function(e){var f=e*e;return a+b*e+c*f+d*f*e}}}function va(a,b,c,d){j.call(this);this.type="catmullromcurve3";this.points=a||[];this.closed=b||!1;this.curvetype=c||"centripetal";this.tension=d||.5}function xf(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 gd(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}function hd(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 ka(a,b,c,d){j.call(this);this.type="cubicbeziercurve";this.v0=a||new a;this.v1=b||new a;this.v2=c||new a;this.v3=d||new a}function wa(a,b,c,d){j.call(this);this.type="cubicbeziercurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n;this.v3=d||new n}function ba(a,b){j.call(this);this.type="linecurve";this.v1=a||new a;this.v2=b||new a}function la(a,b){j.call(this);this.type="linecurve3";this.v1=a||new n;this.v2=b|| new n}function ma(a,b,c){j.call(this);this.type="quadraticbeziercurve";this.v0=a||new a;this.v1=b||new a;this.v2=c||new a}function xa(a,b,c){j.call(this);this.type="quadraticbeziercurve3";this.v0=a||new n;this.v1=b||new n;this.v2=c||new n}function na(a){j.call(this);this.type="splinecurve";this.points=a||[]}function bb(){j.call(this);this.type="curvepath";this.curves=[];this.autoclose=!1}function oa(a){bb.call(this);this.type="path";this.currentpoint=new a;a&&this.setfrompoints(a)}function jb(a){oa.call(this, a);this.uuid=g.generateuuid();this.type="shape";this.holes=[]}function ca(a,b){e.call(this);this.type="light";this.color=new h(a);this.intensity=void 0!==b?b:1;this.receiveshadow=void 0}function jd(a,b,c){ca.call(this,a,c);this.type="hemispherelight";this.castshadow=void 0;this.position.copy(e.defaultup);this.updatematrix();this.groundcolor=new h(b)}function hb(a){this.camera=a;this.bias=0;this.radius=1;this.mapsize=new a(512,512);this.map=null;this.matrix=new q}function kd(){hb.call(this,new x(50, 1,.5,500))}function ld(a,b,c,d,e,f){ca.call(this,a,b);this.type="spotlight";this.position.copy(e.defaultup);this.updatematrix();this.target=new e;object.defineproperty(this,"power",{get:function(){return this.intensity*math.pi},set:function(a){this.intensity=a/math.pi}});this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:math.pi/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new kd}function md(a,b,c,d){ca.call(this,a,b);this.type="pointlight";object.defineproperty(this,"power", {get:function(){return 4*this.intensity*math.pi},set:function(a){this.intensity=a/(4*math.pi)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new hb(new x(90,1,.5,500))}function id(a,b,c,d,e,f){ta.call(this);this.type="orthographiccamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2e3;this.updateprojectionmatrix()}function nd(){hb.call(this, new id(-5,5,5,-5,.5,500))}function od(a,b){ca.call(this,a,b);this.type="directionallight";this.position.copy(e.defaultup);this.updatematrix();this.target=new e;this.shadow=new nd}function pd(a,b){ca.call(this,a,b);this.type="ambientlight";this.castshadow=void 0}function qd(a,b,c,d){ca.call(this,a,b);this.type="rectarealight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function rd(a){this.manager=void 0!==a?a:aa;this.textures={}}function me(a){this.manager=void 0!==a?a:aa}function ne(a){this.manager= void 0!==a?a:aa;this.resourcepath=""}function oe(a){"undefined"===typeof createimagebitmap&&console.warn("three.imagebitmaploader: createimagebitmap() not supported.");"undefined"===typeof fetch&&console.warn("three.imagebitmaploader: fetch() not supported.");this.manager=void 0!==a?a:aa;this.options=void 0}function pe(){this.type="shapepath";this.color=new h;this.subpaths=[];this.currentpath=null}function qe(a){this.type="font";this.data=a}function yf(a){this.manager=void 0!==a?a:aa}function jd(){} function re(a){this.manager=void 0!==a?a:aa}function zf(){this.type="stereocamera";this.aspect=1;this.eyesep=.064;this.cameral=new x;this.cameral.layers.enable(1);this.cameral.matrixautoupdate=!1;this.camerar=new x;this.camerar.layers.enable(2);this.camerar.matrixautoupdate=!1}function kd(a,b,c,d){e.call(this);this.type="cubecamera";var e=new x(90,1,a,b);e.up.set(0,-1,0);e.lookat(new n(1,0,0));this.add(e);var f=new x(90,1,a,b);f.up.set(0,-1,0);f.lookat(new n(-1,0,0));this.add(f);var g=new x(90,1, a,b);g.up.set(0,0,1);g.lookat(new n(0,1,0));this.add(g);var h=new x(90,1,a,b);h.up.set(0,0,-1);h.lookat(new n(0,-1,0));this.add(h);var k=new x(90,1,a,b);k.up.set(0,-1,0);k.lookat(new n(0,0,1));this.add(k);var m=new x(90,1,a,b);m.up.set(0,-1,0);m.lookat(new n(0,0,-1));this.add(m);d=d||{format:1022,magfilter:1006,minfilter:1006};this.rendertarget=new jb(c,c,d);this.rendertarget.texture.name="cubecamera";this.update=function(a,b){null===this.parent&&this.updatematrixworld();var c=a.getrendertarget(), d=this.rendertarget,q=d.texture.generatemipmaps;d.texture.generatemipmaps=!1;d.activecubeface=0;a.render(b,e,d);d.activecubeface=1;a.render(b,f,d);d.activecubeface=2;a.render(b,g,d);d.activecubeface=3;a.render(b,h,d);d.activecubeface=4;a.render(b,k,d);d.texture.generatemipmaps=q;d.activecubeface=5;a.render(b,m,d);a.setrendertarget(c)};this.clear=function(a,b,c,d){for(var e=a.getrendertarget(),f=this.rendertarget,g=0;6>g;g++)f.activecubeface=g,a.setrendertarget(f),a.clear(b,c,d);a.setrendertarget(e)}} function se(a){this.autostart=void 0!==a?a:!0;this.elapsedtime=this.oldtime=this.starttime=0;this.running=!1}function te(){e.call(this);this.type="audiolistener";this.context=ue.getcontext();this.gain=this.context.creategain();this.gain.connect(this.context.destination);this.filter=null;this.timedelta=0}function lc(a){e.call(this);this.type="audio";this.listener=a;this.context=a.context;this.gain=this.context.creategain();this.gain.connect(a.getinput());this.autoplay=!1;this.buffer=null;this.detune= 0;this.loop=!1;this.offset=this.starttime=0;this.playbackrate=1;this.isplaying=!1;this.hasplaybackcontrol=!0;this.sourcetype="empty";this.filters=[]}function ve(a){lc.call(this,a);this.panner=this.context.createpanner();this.panner.connect(this.gain)}function we(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 xe(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 af(a,b,c){c=c||pa.parsetrackname(b);this._targetgroup=a;this._bindings=a.subscribe_(b,c)}function pa(a,b,c){this.path=b;this.parsedpath=c||pa.parsetrackname(b);this.node=pa.findnode(a,this.parsedpath.nodename)||a;this.rootnode=a}function bf(){this.uuid=g.generateuuid(); this._objects=array.prototype.slice.call(arguments);this.ncachedobjects_=0;var a={};this._indicesbyuuid=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedpaths=[];this._bindings=[];this._bindingsindicesbypath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inuse(){return this.total-d.ncachedobjects_}},get bindingsperobject(){return d._bindings.length}}}function cf(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 ye(a){this._root=a;this._initmemorymanager();this.time=this._accuindex=0;this.timescale=1}function sd(a,b){"string"===typeof a&&(console.warn("three.uniform: type parameter is no longer needed."),a=b);this.value=a}function ze(){d.call(this);this.type="instancedbuffergeometry";this.maxinstancedcount=void 0}function ae(a,b,c){sb.call(this,a,b);this.meshperattribute=c||1}function be(a,b,c,d){"number"===typeof c&&(d=c, c=!1,console.error("three.instancedbufferattribute: the constructor now expects normalized as the third argument."));k.call(this,a,b,c);this.meshperattribute=d||1}function df(a,b,c,d){this.ray=new rb(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 ef(a,b){return a.distance- b.distance}function ce(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 c(b,3));b=new w({fog:!1});this.cone=new u(a,b);this.add(this.cone);this.update()}function hf(a){var b=[];a&&a.isbone&&b.push(a);for(var c=0;ca?-1:0b;b++)a[b]=(16>b?"0":"")+b.tostring(16); return function(){var b=4294967295*math.random()|0,d=4294967295*math.random()|0,e=4294967295*math.random()|0,f=4294967295*math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+"-"+a[d&255]+a[d>>8&255]+"-"+a[d>>16&15|64]+a[d>>24&255]+"-"+a[e&63|128]+a[e>>8&255]+"-"+a[e>>16&255]+a[e>>24&255]+a[f&255]+a[f>>8&255]+a[f>>16&255]+a[f>>24&255]).touppercase()}}(),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*g.deg2rad},radtodeg:function(a){return a* g.rad2deg},ispoweroftwo:function(a){return 0===(a&a-1)&&0!==a},ceilpoweroftwo:function(a){return math.pow(2,math.ceil(math.log(a)/math.ln2))},floorpoweroftwo:function(a){return math.pow(2,math.floor(math.log(a)/math.ln2))}};object.defineproperties(a.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});object.assign(a.prototype,{isvector2:!0,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){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},dividescalar:function(a){return this.multiplyscalar(1/a)},applymatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y= a[1]*b+a[4]*c+a[7];return this},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=new a,b=new a;return function(c,d){a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clamplength:function(a,b){var c=this.length();return this.dividescalar(c|| 1).multiplyscalar(math.max(a,math.min(b,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},cross:function(a){return this.x*a.y-this.y*a.x},lengthsq:function(){return this.x*this.x+this.y*this.y},length:function(){return math.sqrt(this.x*this.x+this.y*this.y)},manhattanlength:function(){return math.abs(this.x)+math.abs(this.y)},normalize:function(){return this.dividescalar(this.length()||1)},angle:function(){var 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},manhattandistanceto:function(a){return math.abs(this.x-a.x)+math.abs(this.y-a.y)},setlength:function(a){return this.normalize().multiplyscalar(a)},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);b=math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});object.assign(q.prototype,{ismatrix4:!0,set:function(a,b,c,d,e,f,g,h,k,m,q,l,t,n,r,u){var p=this.elements; p[0]=a;p[4]=b;p[8]=c;p[12]=d;p[1]=e;p[5]=f;p[9]=g;p[13]=h;p[2]=k;p[6]=m;p[10]=q;p[14]=l;p[3]=t;p[7]=n;p[11]=r;p[15]=u;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 q).fromarray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];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=new n;return function(b){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[3]=0;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[7]=0;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(),makerotationfromeuler:function(a){a&&a.iseuler||console.error("three.matrix4: .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);var g=math.cos(d);d=math.sin(d);var h=math.cos(e);e=math.sin(e);if("xyz"===a.order){a= f*h;var k=f*e,m=c*h,q=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+m*d;b[5]=a-q*d;b[9]=-c*g;b[2]=q-a*d;b[6]=m+k*d;b[10]=f*g}else"yxz"===a.order?(a=g*h,k=g*e,m=d*h,q=d*e,b[0]=a+q*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=q+a*c,b[10]=f*g):"zxy"===a.order?(a=g*h,k=g*e,m=d*h,q=d*e,b[0]=a-q*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]=q-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"zyx"===a.order?(a=f*h,k=f*e,m=c*h,q=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+q,b[1]=g*e,b[5]=q*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c* g,b[10]=f*g):"yzx"===a.order?(a=f*g,k=f*d,m=c*g,q=c*d,b[0]=g*h,b[4]=q-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+m,b[10]=a-q*e):"xzy"===a.order&&(a=f*g,k=f*d,m=c*g,q=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+q,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=q*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(){var a=new n(0,0,0),b=new n(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookat:function(){var a=new n,b=new n, c=new n;return function(d,e,f){var g=this.elements;c.subvectors(d,e);0===c.lengthsq()&&(c.z=1);c.normalize();a.crossvectors(f,c);0===a.lengthsq()&&(1===math.abs(f.z)?c.x+=1e-4:c.z+=1e-4,c.normalize(),a.crossvectors(f,c));a.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;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],k=c[5],m=c[9],q=c[13],l=c[2],t=c[6],n=c[10],r=c[14],u=c[3],w=c[7],z=c[11];c=c[15];var v=d[0],i=d[4],y=d[8],p=d[12],a=d[1],b=d[5],c=d[9],e=d[13],d=d[2],g=d[6],f=d[10],h=d[14],l=d[3],j=d[7],k=d[11];d=d[15];b[0]=a*v+e*a+f*d+g*l;b[4]=a*i+e*b+f*g+g*j;b[8]=a*y+e*c+f*f+ g*k;b[12]=a*p+e*e+f*h+g*d;b[1]=h*v+k*a+m*d+q*l;b[5]=h*i+k*b+m*g+q*j;b[9]=h*y+k*c+m*f+q*k;b[13]=h*p+k*e+m*h+q*d;b[2]=l*v+t*a+n*d+r*l;b[6]=l*i+t*b+n*g+r*j;b[10]=l*y+t*c+n*f+r*k;b[14]=l*p+t*e+n*h+r*d;b[3]=u*v+w*a+z*d+c*l;b[7]=u*i+w*b+z*g+c*j;b[11]=u*y+w*c+z*f+c*k;b[15]=u*p+w*e+z*h+c*d;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= new n;return function(b){for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/k;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]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setfromrotationmatrix(b);e.x=g;e.y=h;e.z=k;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),k=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((c+d)*k);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);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}});object.assign(ka,{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],k=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var q=e[f+1],l=e[f+2];e=e[f+3];if(c!==e||h!==d||k!==q||m!==l){f=1-g;var t=h*d+k*q+m*l+c*e,n=0<=t?1:-1,r=1-t*t;r>number.epsilon&&(r=math.sqrt(r),t=math.atan2(r,t*n),f=math.sin(f*t)/r,g=math.sin(g*t)/r);n*=g;h=h*f+d*n;k=k*f+q*n;m=m*f+l*n;c=c*f+e*n;f===1-g&&(g=1/math.sqrt(h*h+k*k+m*m+c*c),h*=g,k*=g,m*=g,c*=g)}a[b]=h;a[b+1]=k;a[b+2]=m;a[b+3]=c}});object.defineproperties(ka.prototype,{x:{get:function(){return this._x}, set:function(a){this._x=a;this.onchangecallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this.onchangecallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onchangecallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onchangecallback()}}});object.assign(ka.prototype,{isquaternion:!0,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(!a||!a.iseuler)throw error("three.quaternion: .setfromeuler() now expects an euler rotation rather than a vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=math.cos,g=math.sin,h=f(c/2),k=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"xyz"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"yxz"===a? (this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"zxy"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"zyx"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"yzx"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f-c*d*e):"xzy"===a&&(this._x=c*k*f-h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f+c*d*e);if(!1!==b)this.onchangecallback();return this},setfromaxisangle:function(a, b){b/=2;var c=math.sin(b);this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=math.cos(b);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],k=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*math.sqrt(1+c-f-b),this._w=(k-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+k)/c):(c=2*math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onchangecallback();return this},setfromunitvectors:function(){var a=new n,b;return function(c,d){void 0===a&&(a=new n);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()}}(),angleto:function(a){return 2*math.acos(math.abs(g.clamp(this.dot(a),-1,1)))},rotatetowards:function(a, b){var c=this.angleto(a);if(0===c)return this;this.slerp(a,math.min(1,b/c));return this},inverse:function(){return this.conjugate()},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;a=a._w; var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;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;a=1-g*g;if(a<=number.epsilon)return g=1-b,this._w=g* f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize();a=math.sqrt(a);var h=math.atan2(a,g);g=math.sin((1-b)*h)/a;b=math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;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(n.prototype,{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){this.x*=a;this.y*=a;this.z*=a;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=new ka;return function(b){b&&b.iseuler||console.error("three.vector3: .applyeuler() now expects an euler rotation rather than a vector3 and order.");return this.applyquaternion(a.setfromeuler(b))}}(),applyaxisangle:function(){var a=new ka;return function(b,c){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;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);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;return this},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,k=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-m*-f;this.y=k*a+b*-f+m*-e-h*-g;this.z=m*a+b* -g+h*-f-k*-e;return this},project:function(a){return this.applymatrix4(a.matrixworldinverse).applymatrix4(a.projectionmatrix)},unproject:function(){var a=new q;return function(b){return this.applymatrix4(a.getinverse(b.projectionmatrix)).applymatrix4(b.matrixworld)}}(),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=new n,b=new n; return function(c,d){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.dividescalar(c||1).multiplyscalar(math.max(a,math.min(b,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)},manhattanlength:function(){return math.abs(this.x)+ math.abs(this.y)+math.abs(this.z)},normalize:function(){return this.dividescalar(this.length()||1)},setlength:function(a){return this.normalize().multiplyscalar(a)},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){return void 0!==b?(console.warn("three.vector3: .cross() now only accepts one argument. use .crossvectors( a, b ) instead."),this.crossvectors(a, b)):this.crossvectors(this,a)},crossvectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectonvector:function(a){var b=a.dot(this)/a.lengthsq();return this.copy(a).multiplyscalar(b)},projectonplane:function(){var a=new n;return function(b){a.copy(this).projectonvector(b);return this.sub(a)}}(),reflect:function(){var a=new n;return function(b){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(g.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},manhattandistanceto:function(a){return math.abs(this.x-a.x)+math.abs(this.y-a.y)+math.abs(this.z-a.z)},setfromspherical:function(a){return this.setfromsphericalcoords(a.radius,a.phi,a.theta)},setfromsphericalcoords:function(a,b,c){var d=math.sin(b)*a;this.x= d*math.sin(c);this.y=math.cos(b)*a;this.z=d*math.cos(c);return this},setfromcylindrical:function(a){return this.setfromcylindricalcoords(a.radius,a.theta,a.y)},setfromcylindricalcoords:function(a,b,c){this.x=a*math.sin(b);this.y=c;this.z=a*math.cos(b);return this},setfrommatrixposition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},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){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}});object.assign(ra.prototype,{ismatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=k;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){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= 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=new n;return function(b){for(var c=0,d=b.count;cc;c++)if(b[c]!==a[c])return!1;return!0},fromarray:function(a,b){void 0===b&&(b=0);for(var c=0;9>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]; return a}});var sc,kb={getdataurl:function(a){if("undefined"==typeof htmlcanvaselement)return a.src;if(!(a instanceof htmlcanvaselement)){void 0===sc&&(sc=document.createelementns("http://www.w3.org/1999/xhtml","canvas"));sc.width=a.width;sc.height=a.height;var b=sc.getcontext("2d");a instanceof imagedata?b.putimagedata(a,0,0):b.drawimage(a,0,0,a.width,a.height);a=sc}return 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);return a}});object.defineproperty(s.prototype,"needsupdate",{set:function(a){!0===a&&this.version++}});object.assign(v.prototype,{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){this.x*=a;this.y*=a;this.z*=a;this.w*=a;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){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var k=a[6];var m=a[10];if(.01>math.abs(c-e)&&.01>math.abs(d-h)&&.01>math.abs(g-k)){if(.1>math.abs(c+e)&&.1>math.abs(d+h)&&.1>math.abs(g+k)&&.1>math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=math.pi; b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+k)/4;b>f&&b>m?.01>b?(k=0,c=h=.707106781):(k=math.sqrt(b),h=c/k,c=d/k):f>m?.01>f?(k=.707106781,h=0,c=.707106781):(h=math.sqrt(f),k=c/h,c=g/h):.01>m?(h=k=.707106781,c=0):(c=math.sqrt(m),k=d/c,h=g/c);this.set(k,h,c,a);return this}a=math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>math.abs(a)&&(a=1);this.x=(k-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=math.acos((b+f+m-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 v,b=new v);a.set(c, c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),clamplength:function(a,b){var c=this.length();return this.dividescalar(c||1).multiplyscalar(math.max(a,math.min(b,c)))},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)},manhattanlength:function(){return math.abs(this.x)+math.abs(this.y)+math.abs(this.z)+math.abs(this.w)},normalize:function(){return this.dividescalar(this.length()||1)},setlength:function(a){return this.normalize().multiplyscalar(a)},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}});qa.prototype=object.assign(object.create(ja.prototype),{constructor:qa,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"})}});xd.prototype=object.assign(object.create(qa.prototype),{constructor:xd,iswebglmultisamplerendertarget:!0,copy:function(a){qa.prototype.copy.call(this,a);this.samples=a.samples;return this}});jb.prototype=object.create(qa.prototype);jb.prototype.constructor=jb;jb.prototype.iswebglrendertargetcube=!0;lb.prototype=object.create(s.prototype); lb.prototype.constructor=lb;lb.prototype.isdatatexture=!0;object.assign(ya.prototype,{isbox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setfromarray:function(a){for(var b=infinity,c=infinity,d=infinity,e=-infinity,f=-infinity,g=-infinity,h=0,k=a.length;he&&(e=m);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,k=a.count;he&&(e=m);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){void 0===b&&(console.warn("three.box3: .getparameter() target is now required"),b=new n);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.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=new n;return function(b){this.clamppoint(b.center,a);return a.distancetosquared(b.center)<=b.radius*b.radius}}(),intersectsplane:function(a){if(0=-a.constant},intersectstriangle:function(){function a(a){var e;var f=0;for(e=a.length-3;f<=e;f+=3){h.fromarray(a,f);var g=m.x*math.abs(h.x)+m.y*math.abs(h.y)+m.z*math.abs(h.z),k=b.dot(h),l=c.dot(h),q=d.dot(h);if(math.max(-math.max(k,l,q),math.min(k,l,q))>g)return!1}return!0}var b=new n,c=new n,d=new n,e=new n,f=new n,g=new n,h=new n, k=new n,m=new n,l=new n;return function(h){if(this.isempty())return!1;this.getcenter(k);m.subvectors(this.max,k);b.subvectors(h.a,k);c.subvectors(h.b,k);d.subvectors(h.c,k);e.subvectors(c,b);f.subvectors(d,c);g.subvectors(b,d);h=[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0,0,1];if(!a(h))return!1;l.crossvectors(e,f);h=[l.x,l.y,l.z];return a(h)}}(),clamppoint:function(a,b){void 0===b&&(console.warn("three.box3: .clamppoint() target is now required"), b=new n);return b.copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new n;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getboundingsphere:function(){var a=new n;return function(b){void 0===b&&(console.warn("three.box3: .getboundingsphere() target is now required"),b=new ga);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 n,new n,new n,new n,new n,new n,new n,new n];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)}});object.assign(ga.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setfrompoints:function(){var a=new ya;return function(b,c){var d=this.center; void 0!==c?d.copy(c):a.setfrompoints(b).getcenter(d);for(var e=c=0,f=b.length;e=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(a.distancetopoint(this.center))<=this.radius},clamppoint:function(a,b){var c=this.center.distancetosquared(a);void 0===b&&(console.warn("three.sphere: .clamppoint() target is now required"),b=new n);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyscalar(this.radius).add(this.center)); return b},getboundingbox:function(a){void 0===a&&(console.warn("three.sphere: .getboundingbox() target is now required"),a=new ya);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}});object.assign(ra.prototype,{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 n,b=new n;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){void 0===b&&(console.warn("three.plane: .projectpoint() target is now required"),b=new n);return b.copy(this.normal).multiplyscalar(-this.distancetopoint(a)).add(a)}, intersectline:function(){var a=new n;return function(b,c){void 0===c&&(console.warn("three.plane: .intersectline() target is now required"),c=new n);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distancetopoint(b.start))return c.copy(b.start)}else if(e=-(b.start.dot(this.normal)+this.constant)/e,!(0>e||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],k=c[6],m=c[7],l=c[8],p=c[9],t=c[10],n=c[11],r=c[12],u=c[13],w=c[14];c=c[15];b[0].setcomponents(f-a,m-g,n-l,c-r).normalize();b[1].setcomponents(f+a,m+g,n+l,c+r).normalize();b[2].setcomponents(f+d,m+h,n+p,c+u).normalize();b[3].setcomponents(f-d,m-h,n-p,c-u).normalize();b[4].setcomponents(f-e,m-k,n-t,c-w).normalize();b[5].setcomponents(f+e,m+k,n+t,c+w).normalize();return this},intersectsobject:function(){var a=new ga;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 ga;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)d;d++){var e=c[d]; a.x=0e.distancetopoint(a))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}});var n={alphamap_fragment:"#ifdef use_alphamap\n\tdiffusecolor.a *= texture2d( alphamap, vuv ).g;\n#endif",alphamap_pars_fragment:"#ifdef use_alphamap\n\tuniform sampler2d alphamap;\n#endif",alphatest_fragment:"#ifdef alphatest\n\tif ( diffusecolor.a < alphatest ) discard;\n#endif", aomap_fragment:"#ifdef use_aomap\n\tfloat ambientocclusion = ( texture2d( aomap, vuv2 ).r - 1.0 ) * aomapintensity + 1.0;\n\treflectedlight.indirectdiffuse *= ambientocclusion;\n\t#if defined( use_envmap ) && defined( physical )\n\t\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\t\treflectedlight.indirectspecular *= computespecularocclusion( dotnv, ambientocclusion, material.specularroughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef use_aomap\n\tuniform sampler2d aomap;\n\tuniform float aomapintensity;\n#endif", begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectnormal = vec3( normal );",bsdfs:"vec2 integratespecularbrdf( const in float dotnv, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotnv ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctuallightintensitytoirradiancefactor( const in float lightdistance, const in float cutoffdistance, const in float decayexponent ) {\n#if defined ( physically_correct_lights )\n\tfloat distancefalloff = 1.0 / max( pow( lightdistance, decayexponent ), 0.01 );\n\tif( cutoffdistance > 0.0 ) {\n\t\tdistancefalloff *= pow2( saturate( 1.0 - pow4( lightdistance / cutoffdistance ) ) );\n\t}\n\treturn distancefalloff;\n#else\n\tif( cutoffdistance > 0.0 && decayexponent > 0.0 ) {\n\t\treturn pow( saturate( -lightdistance / cutoffdistance + 1.0 ), decayexponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 brdf_diffuse_lambert( const in vec3 diffusecolor ) {\n\treturn reciprocal_pi * diffusecolor;\n}\nvec3 f_schlick( const in vec3 specularcolor, const in float dotlh ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotlh - 6.98316 ) * dotlh );\n\treturn ( 1.0 - specularcolor ) * fresnel + specularcolor;\n}\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 ltc_uv( const in vec3 n, const in vec3 v, const in float roughness ) {\n\tconst float lut_size = 64.0;\n\tconst float lut_scale = ( lut_size - 1.0 ) / lut_size;\n\tconst float lut_bias = 0.5 / lut_size;\n\tfloat dotnv = saturate( dot( n, v ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotnv ) );\n\tuv = uv * lut_scale + lut_bias;\n\treturn uv;\n}\nfloat ltc_clippedsphereformfactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 ltc_edgevectorformfactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 ltc_evaluate( const in vec3 n, const in vec3 v, const in vec3 p, const in mat3 minv, const in vec3 rectcoords[ 4 ] ) {\n\tvec3 v1 = rectcoords[ 1 ] - rectcoords[ 0 ];\n\tvec3 v2 = rectcoords[ 3 ] - rectcoords[ 0 ];\n\tvec3 lightnormal = cross( v1, v2 );\n\tif( dot( lightnormal, p - rectcoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 t1, t2;\n\tt1 = normalize( v - n * dot( v, n ) );\n\tt2 = - cross( n, t1 );\n\tmat3 mat = minv * transposemat3( mat3( t1, t2, n ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectcoords[ 0 ] - p );\n\tcoords[ 1 ] = mat * ( rectcoords[ 1 ] - p );\n\tcoords[ 2 ] = mat * ( rectcoords[ 2 ] - p );\n\tcoords[ 3 ] = mat * ( rectcoords[ 3 ] - p );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorformfactor = vec3( 0.0 );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 0 ], coords[ 1 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 1 ], coords[ 2 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 2 ], coords[ 3 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = ltc_clippedsphereformfactor( vectorformfactor );\n\treturn vec3( result );\n}\nvec3 brdf_specular_ggx_environment( const in geometriccontext geometry, const in vec3 specularcolor, const in float roughness ) {\n\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\tvec2 brdf = integratespecularbrdf( dotnv, roughness );\n\treturn specularcolor * brdf.x + brdf.y;\n}\nvoid brdf_specular_multiscattering_environment( const in geometriccontext geometry, const in vec3 specularcolor, const in float roughness, inout vec3 singlescatter, inout vec3 multiscatter ) {\n\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\tvec3 f = f_schlick( specularcolor, dotnv );\n\tvec2 brdf = integratespecularbrdf( dotnv, roughness );\n\tvec3 fssess = f * brdf.x + brdf.y;\n\tfloat ess = brdf.x + brdf.y;\n\tfloat ems = 1.0 - ess;\n\tvec3 favg = specularcolor + ( 1.0 - specularcolor ) * 0.047619;\tvec3 fms = fssess * favg / ( 1.0 - ems * favg );\n\tsinglescatter += fssess;\n\tmultiscatter += fms * ems;\n}\nfloat g_blinnphong_implicit( ) {\n\treturn 0.25;\n}\nfloat d_blinnphong( const in float shininess, const in float dotnh ) {\n\treturn reciprocal_pi * ( shininess * 0.5 + 1.0 ) * pow( dotnh, shininess );\n}\nvec3 brdf_specular_blinnphong( const in incidentlight incidentlight, const in geometriccontext geometry, const in vec3 specularcolor, const in float shininess ) {\n\tvec3 halfdir = normalize( incidentlight.direction + geometry.viewdir );\n\tfloat dotnh = saturate( dot( geometry.normal, halfdir ) );\n\tfloat dotlh = saturate( dot( incidentlight.direction, halfdir ) );\n\tvec3 f = f_schlick( specularcolor, dotlh );\n\tfloat g = g_blinnphong_implicit( );\n\tfloat d = d_blinnphong( shininess, dotnh );\n\treturn f * ( g * d );\n}\nfloat ggxroughnesstoblinnexponent( const in float ggxroughness ) {\n\treturn ( 2.0 / pow2( ggxroughness + 0.0001 ) - 2.0 );\n}\nfloat blinnexponenttoggxroughness( const in float blinnexponent ) {\n\treturn sqrt( 2.0 / ( blinnexponent + 2.0 ) );\n}", bumpmap_pars_fragment:"#ifdef use_bumpmap\n\tuniform sampler2d bumpmap;\n\tuniform float bumpscale;\n\tvec2 dhdxy_fwd() {\n\t\tvec2 dstdx = dfdx( vuv );\n\t\tvec2 dstdy = dfdy( vuv );\n\t\tfloat hll = bumpscale * texture2d( bumpmap, vuv ).x;\n\t\tfloat dbx = bumpscale * texture2d( bumpmap, vuv + dstdx ).x - hll;\n\t\tfloat dby = bumpscale * texture2d( bumpmap, vuv + dstdy ).x - hll;\n\t\treturn vec2( dbx, dby );\n\t}\n\tvec3 perturbnormalarb( vec3 surf_pos, vec3 surf_norm, vec2 dhdxy ) {\n\t\tvec3 vsigmax = vec3( dfdx( surf_pos.x ), dfdx( surf_pos.y ), dfdx( surf_pos.z ) );\n\t\tvec3 vsigmay = vec3( dfdy( surf_pos.x ), dfdy( surf_pos.y ), dfdy( surf_pos.z ) );\n\t\tvec3 vn = surf_norm;\n\t\tvec3 r1 = cross( vsigmay, vn );\n\t\tvec3 r2 = cross( vn, vsigmax );\n\t\tfloat fdet = dot( vsigmax, r1 );\n\t\tfdet *= ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\tvec3 vgrad = sign( fdet ) * ( dhdxy.x * r1 + dhdxy.y * r2 );\n\t\treturn normalize( abs( fdet ) * surf_norm - vgrad );\n\t}\n#endif", clipping_planes_fragment:"#if num_clipping_planes > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < union_clipping_planes; i ++ ) {\n\t\tplane = clippingplanes[ i ];\n\t\tif ( dot( vviewposition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if union_clipping_planes < num_clipping_planes\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = union_clipping_planes; i < num_clipping_planes; i ++ ) {\n\t\t\tplane = clippingplanes[ i ];\n\t\t\tclipped = ( dot( vviewposition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if num_clipping_planes > 0\n\t#if ! defined( physical ) && ! defined( phong ) && ! defined( matcap )\n\t\tvarying vec3 vviewposition;\n\t#endif\n\tuniform vec4 clippingplanes[ num_clipping_planes ];\n#endif",clipping_planes_pars_vertex:"#if num_clipping_planes > 0 && ! defined( physical ) && ! defined( phong ) && ! defined( matcap )\n\tvarying vec3 vviewposition;\n#endif",clipping_planes_vertex:"#if num_clipping_planes > 0 && ! defined( physical ) && ! defined( phong ) && ! defined( matcap )\n\tvviewposition = - mvposition.xyz;\n#endif", color_fragment:"#ifdef use_color\n\tdiffusecolor.rgb *= vcolor;\n#endif",color_pars_fragment:"#ifdef use_color\n\tvarying vec3 vcolor;\n#endif",color_pars_vertex:"#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 transposemat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat lineartorelativeluminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}", 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( sampler2d envmap, 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", defaultnormal_vertex:"vec3 transformednormal = normalmatrix * objectnormal;\n#ifdef flip_sided\n\ttransformednormal = - transformednormal;\n#endif",displacementmap_pars_vertex:"#ifdef use_displacementmap\n\tuniform sampler2d displacementmap;\n\tuniform float displacementscale;\n\tuniform float displacementbias;\n#endif",displacementmap_vertex:"#ifdef use_displacementmap\n\ttransformed += normalize( objectnormal ) * ( texture2d( displacementmap, uv ).x * displacementscale + displacementbias );\n#endif", emissivemap_fragment:"#ifdef use_emissivemap\n\tvec4 emissivecolor = texture2d( emissivemap, vuv );\n\temissivecolor.rgb = emissivemaptexeltolinear( emissivecolor ).rgb;\n\ttotalemissiveradiance *= emissivecolor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef use_emissivemap\n\tuniform sampler2d emissivemap;\n#endif",encodings_fragment:"gl_fragcolor = lineartooutputtexel( gl_fragcolor );",encodings_pars_fragment:"\nvec4 lineartolinear( in vec4 value ) {\n\treturn value;\n}\nvec4 gammatolinear( in vec4 value, in float gammafactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammafactor ) ), value.a );\n}\nvec4 lineartogamma( in vec4 value, in float gammafactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammafactor ) ), value.a );\n}\nvec4 srgbtolinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessthanequal( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 lineartosrgb( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessthanequal( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 rgbetolinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 lineartorgbe( in vec4 value ) {\n\tfloat maxcomponent = max( max( value.r, value.g ), value.b );\n\tfloat fexp = clamp( ceil( log2( maxcomponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fexp ), ( fexp + 128.0 ) / 255.0 );\n}\nvec4 rgbmtolinear( in vec4 value, in float maxrange ) {\n\treturn vec4( value.rgb * value.a * maxrange, 1.0 );\n}\nvec4 lineartorgbm( in vec4 value, in float maxrange ) {\n\tfloat maxrgb = max( value.r, max( value.g, value.b ) );\n\tfloat m = clamp( maxrgb / maxrange, 0.0, 1.0 );\n\tm = ceil( m * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( m * maxrange ), m );\n}\nvec4 rgbdtolinear( in vec4 value, in float maxrange ) {\n\treturn vec4( value.rgb * ( ( maxrange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 lineartorgbd( in vec4 value, in float maxrange ) {\n\tfloat maxrgb = max( value.r, max( value.g, value.b ) );\n\tfloat d = max( maxrange / maxrgb, 1.0 );\n\td = 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 = clogluvm * value.rgb;\n\txp_y_xyzp = max( xp_y_xyzp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vresult;\n\tvresult.xy = xp_y_xyzp.xy / xp_y_xyzp.z;\n\tfloat le = 2.0 * log2(xp_y_xyzp.y) + 127.0;\n\tvresult.w = fract( le );\n\tvresult.z = ( le - ( floor( vresult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vresult;\n}\nconst mat3 clogluvinversem = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 logluvtolinear( in vec4 value ) {\n\tfloat le = value.z * 255.0 + value.w;\n\tvec3 xp_y_xyzp;\n\txp_y_xyzp.y = exp2( ( le - 127.0 ) / 2.0 );\n\txp_y_xyzp.z = xp_y_xyzp.y / value.y;\n\txp_y_xyzp.x = value.x * xp_y_xyzp.z;\n\tvec3 vrgb = clogluvinversem * xp_y_xyzp.rgb;\n\treturn vec4( max( vrgb, 0.0 ), 1.0 );\n}", envmap_fragment:"#ifdef use_envmap\n\t#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, vec3( flipenvmap * reflectvec.x, reflectvec.yz ) );\n\t#elif defined( envmap_type_equirec )\n\t\tvec2 sampleuv;\n\t\treflectvec = normalize( reflectvec );\n\t\tsampleuv.y = asin( clamp( reflectvec.y, - 1.0, 1.0 ) ) * reciprocal_pi + 0.5;\n\t\tsampleuv.x = atan( reflectvec.z, reflectvec.x ) * reciprocal_pi2 + 0.5;\n\t\tvec4 envcolor = texture2d( envmap, sampleuv );\n\t#elif defined( envmap_type_sphere )\n\t\treflectvec = normalize( reflectvec );\n\t\tvec3 reflectview = 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", 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\tuniform int maxmiplevel;\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", 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",envmap_physical_pars_fragment:"#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( envmap, 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( envmap, queryreflectvec, blinnexponenttoggxroughness(blinnshininessexponent ));\n\t\t#elif defined( envmap_type_equirec )\n\t\t\tvec2 sampleuv;\n\t\t\tsampleuv.y = asin( clamp( reflectvec.y, - 1.0, 1.0 ) ) * reciprocal_pi + 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", 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", fog_vertex:"#ifdef use_fog\n\tfogdepth = -mvposition.z;\n#endif",fog_pars_vertex:"#ifdef use_fog\n\tvarying float fogdepth;\n#endif",fog_fragment:"#ifdef use_fog\n\t#ifdef fog_exp2\n\t\tfloat fogfactor = 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",fog_pars_fragment:"#ifdef use_fog\n\tuniform vec3 fogcolor;\n\tvarying float fogdepth;\n\t#ifdef fog_exp2\n\t\tuniform float fogdensity;\n\t#else\n\t\tuniform float fognear;\n\t\tuniform float fogfar;\n\t#endif\n#endif", gradientmap_pars_fragment:"#ifdef 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",lightmap_fragment:"#ifdef use_lightmap\n\treflectedlight.indirectdiffuse += pi * texture2d( lightmap, vuv2 ).xyz * lightmapintensity;\n#endif", lightmap_pars_fragment:"#ifdef use_lightmap\n\tuniform sampler2d lightmap;\n\tuniform float lightmapintensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\ngeometriccontext geometry;\ngeometry.position = mvposition.xyz;\ngeometry.normal = normalize( transformednormal );\ngeometry.viewdir = normalize( -mvposition.xyz );\ngeometriccontext backgeometry;\nbackgeometry.position = geometry.position;\nbackgeometry.normal = -geometry.normal;\nbackgeometry.viewdir = geometry.viewdir;\nvlightfront = vec3( 0.0 );\nvindirectfront = vec3( 0.0 );\n#ifdef double_sided\n\tvlightback = vec3( 0.0 );\n\tvindirectback = vec3( 0.0 );\n#endif\nincidentlight directlight;\nfloat dotnl;\nvec3 directlightcolor_diffuse;\n#if num_point_lights > 0\n\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\n\tfor ( int i = 0; i < num_hemi_lights; i ++ ) {\n\t\tvindirectfront += gethemispherelightirradiance( hemispherelights[ i ], geometry );\n\t\t#ifdef double_sided\n\t\t\tvindirectback += gethemispherelightirradiance( hemispherelights[ i ], backgeometry );\n\t\t#endif\n\t}\n#endif", lights_pars_begin:"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\tfloat shadowcameranear;\n\t\tfloat shadowcamerafar;\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 ltc_1;\tuniform sampler2d ltc_2;\n\tuniform rectarealight rectarealights[ num_rect_area_lights ];\n#endif\n#if num_hemi_lights > 0\n\tstruct hemispherelight {\n\t\tvec3 direction;\n\t\tvec3 skycolor;\n\t\tvec3 groundcolor;\n\t};\n\tuniform hemispherelight hemispherelights[ num_hemi_lights ];\n\tvec3 gethemispherelightirradiance( const in hemispherelight hemilight, const in geometriccontext geometry ) {\n\t\tfloat dotnl = dot( geometry.normal, hemilight.direction );\n\t\tfloat hemidiffuseweight = 0.5 * dotnl + 0.5;\n\t\tvec3 irradiance = mix( hemilight.groundcolor, hemilight.skycolor, hemidiffuseweight );\n\t\t#ifndef physically_correct_lights\n\t\t\tirradiance *= pi;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_phong_fragment:"blinnphongmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb;\nmaterial.specularcolor = specular;\nmaterial.specularshininess = shininess;\nmaterial.specularstrength = specularstrength;",lights_phong_pars_fragment:"varying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\nstruct blinnphongmaterial {\n\tvec3\tdiffusecolor;\n\tvec3\tspecularcolor;\n\tfloat\tspecularshininess;\n\tfloat\tspecularstrength;\n};\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_indirectdiffuse\t\tre_indirectdiffuse_blinnphong\n#define material_lightprobelod( material )\t(0)", 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", 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 normal = geometry.normal;\n\t\tvec3 viewdir = geometry.viewdir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightpos = rectarealight.position;\n\t\tvec3 halfwidth = rectarealight.halfwidth;\n\t\tvec3 halfheight = rectarealight.halfheight;\n\t\tvec3 lightcolor = rectarealight.color;\n\t\tfloat roughness = material.specularroughness;\n\t\tvec3 rectcoords[ 4 ];\n\t\trectcoords[ 0 ] = lightpos + halfwidth - halfheight;\t\trectcoords[ 1 ] = lightpos - halfwidth - halfheight;\n\t\trectcoords[ 2 ] = lightpos - halfwidth + halfheight;\n\t\trectcoords[ 3 ] = lightpos + halfwidth + halfheight;\n\t\tvec2 uv = ltc_uv( normal, viewdir, roughness );\n\t\tvec4 t1 = texture2d( ltc_1, uv );\n\t\tvec4 t2 = texture2d( ltc_2, uv );\n\t\tmat3 minv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularcolor * t2.x + ( vec3( 1.0 ) - material.specularcolor ) * t2.y );\n\t\treflectedlight.directspecular += lightcolor * fresnel * ltc_evaluate( normal, viewdir, position, minv, rectcoords );\n\t\treflectedlight.directdiffuse += lightcolor * material.diffusecolor * ltc_evaluate( normal, viewdir, position, mat3( 1.0 ), rectcoords );\n\t}\n#endif\nvoid re_direct_physical( const in incidentlight directlight, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight ) {\n\tfloat dotnl = saturate( dot( geometry.normal, directlight.direction ) );\n\tvec3 irradiance = dotnl * directlight.color;\n\t#ifndef physically_correct_lights\n\t\tirradiance *= pi;\n\t#endif\n\t#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\t#ifndef envmap_type_cube_uv\n\t\treflectedlight.indirectdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n\t#endif\n}\nvoid re_indirectspecular_physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatradiance, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight) {\n\t#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\tfloat clearcoatinv = 1.0 - clearcoatdhr;\n\t#if defined( envmap_type_cube_uv )\n\t\tvec3 singlescattering = vec3( 0.0 );\n\t\tvec3 multiscattering = vec3( 0.0 );\n\t\tvec3 cosineweightedirradiance = irradiance * reciprocal_pi;\n\t\tbrdf_specular_multiscattering_environment( geometry, material.specularcolor, material.specularroughness, singlescattering, multiscattering );\n\t\tvec3 diffuse = material.diffusecolor;\n\t\treflectedlight.indirectspecular += clearcoatinv * radiance * singlescattering;\n\t\treflectedlight.indirectdiffuse += multiscattering * cosineweightedirradiance;\n\t\treflectedlight.indirectdiffuse += diffuse * cosineweightedirradiance;\n\t#else\n\t\treflectedlight.indirectspecular += clearcoatinv * radiance * brdf_specular_ggx_environment( geometry, material.specularcolor, material.specularroughness );\n\t#endif\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}", lights_fragment_begin:"\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\t#pragma unroll_loop\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 ], pointlight.shadowcameranear, pointlight.shadowcamerafar ) : 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\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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#if ( num_hemi_lights > 0 )\n\t\t#pragma unroll_loop\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#endif\n#if defined( re_indirectspecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatradiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( re_indirectdiffuse )\n\t#ifdef use_lightmap\n\t\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 defined( use_envmap ) && defined( physical ) && defined( envmap_type_cube_uv )\n\t\tirradiance += getlightprobeindirectirradiance( geometry, maxmiplevel );\n\t#endif\n#endif\n#if defined( use_envmap ) && defined( re_indirectspecular )\n\tradiance += getlightprobeindirectradiance( geometry, material_blinnshininessexponent( material ), maxmiplevel );\n\t#ifndef standard\n\t\tclearcoatradiance += getlightprobeindirectradiance( geometry, material_clearcoat_blinnshininessexponent( material ), maxmiplevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( re_indirectdiffuse )\n\tre_indirectdiffuse( irradiance, geometry, material, reflectedlight );\n#endif\n#if defined( re_indirectspecular )\n\tre_indirectspecular( radiance, irradiance, clearcoatradiance, geometry, material, reflectedlight );\n#endif",logdepthbuf_fragment:"#if defined( use_logdepthbuf ) && defined( use_logdepthbuf_ext )\n\tgl_fragdepthext = log2( vfragdepth ) * logdepthbuffc * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( use_logdepthbuf ) && defined( use_logdepthbuf_ext )\n\tuniform float logdepthbuffc;\n\tvarying float vfragdepth;\n#endif", logdepthbuf_pars_vertex:"#ifdef use_logdepthbuf\n\t#ifdef use_logdepthbuf_ext\n\t\tvarying float vfragdepth;\n\t#else\n\t\tuniform float logdepthbuffc;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef use_logdepthbuf\n\t#ifdef use_logdepthbuf_ext\n\t\tvfragdepth = 1.0 + gl_position.w;\n\t#else\n\t\tgl_position.z = log2( max( epsilon, gl_position.w + 1.0 ) ) * logdepthbuffc - 1.0;\n\t\tgl_position.z *= gl_position.w;\n\t#endif\n#endif",map_fragment:"#ifdef use_map\n\tvec4 texelcolor = texture2d( map, vuv );\n\ttexelcolor = maptexeltolinear( texelcolor );\n\tdiffusecolor *= texelcolor;\n#endif", map_pars_fragment:"#ifdef use_map\n\tuniform sampler2d map;\n#endif",map_particle_fragment:"#ifdef use_map\n\tvec2 uv = ( uvtransform * vec3( gl_pointcoord.x, 1.0 - gl_pointcoord.y, 1 ) ).xy;\n\tvec4 maptexel = texture2d( map, uv );\n\tdiffusecolor *= maptexeltolinear( maptexel );\n#endif",map_particle_pars_fragment:"#ifdef use_map\n\tuniform mat3 uvtransform;\n\tuniform sampler2d map;\n#endif",metalnessmap_fragment:"float metalnessfactor = metalness;\n#ifdef use_metalnessmap\n\tvec4 texelmetalness = texture2d( metalnessmap, vuv );\n\tmetalnessfactor *= texelmetalness.b;\n#endif", metalnessmap_pars_fragment:"#ifdef use_metalnessmap\n\tuniform sampler2d metalnessmap;\n#endif",morphnormal_vertex:"#ifdef use_morphnormals\n\tobjectnormal += ( morphnormal0 - normal ) * morphtargetinfluences[ 0 ];\n\tobjectnormal += ( morphnormal1 - normal ) * morphtargetinfluences[ 1 ];\n\tobjectnormal += ( morphnormal2 - normal ) * morphtargetinfluences[ 2 ];\n\tobjectnormal += ( morphnormal3 - normal ) * morphtargetinfluences[ 3 ];\n#endif",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", normal_fragment_begin:"#ifdef flat_shaded\n\tvec3 fdx = vec3( dfdx( vviewposition.x ), dfdx( vviewposition.y ), dfdx( vviewposition.z ) );\n\tvec3 fdy = vec3( dfdy( vviewposition.x ), dfdy( vviewposition.y ), dfdy( vviewposition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vnormal );\n\t#ifdef double_sided\n\t\tnormal = normal * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t#endif\n#endif",normal_fragment_maps:"#ifdef use_normalmap\n\t#ifdef objectspace_normalmap\n\t\tnormal = texture2d( normalmap, vuv ).xyz * 2.0 - 1.0;\n\t\t#ifdef flip_sided\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef double_sided\n\t\t\tnormal = normal * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalmatrix * normal );\n\t#else\n\t\tnormal = perturbnormal2arb( -vviewposition, normal );\n\t#endif\n#elif defined( use_bumpmap )\n\tnormal = perturbnormalarb( -vviewposition, normal, dhdxy_fwd() );\n#endif", normalmap_pars_fragment:"#ifdef use_normalmap\n\tuniform sampler2d normalmap;\n\tuniform vec2 normalscale;\n\t#ifdef objectspace_normalmap\n\t\tuniform mat3 normalmatrix;\n\t#else\n\t\tvec3 perturbnormal2arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dfdx( eye_pos.x ), dfdx( eye_pos.y ), dfdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dfdy( eye_pos.x ), dfdy( eye_pos.y ), dfdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dfdx( vuv.st );\n\t\t\tvec2 st1 = dfdy( vuv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 s = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 t = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 n = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( s, t, n );\n\t\t\tvec3 mapn = texture2d( normalmap, vuv ).xyz * 2.0 - 1.0;\n\t\t\tmapn.xy *= normalscale;\n\t\t\tmapn.xy *= ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapn );\n\t\t}\n\t#endif\n#endif", packing:"vec3 packnormaltorgb( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackrgbtonormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float packupscale = 256. / 255.;const float unpackdownscale = 255. / 256.;\nconst vec3 packfactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 unpackfactors = unpackdownscale / vec4( packfactors, 1. );\nconst float shiftright8 = 1. / 256.;\nvec4 packdepthtorgba( const in float v ) {\n\tvec4 r = vec4( fract( v * packfactors ), v );\n\tr.yzw -= r.xyz * shiftright8;\treturn r * packupscale;\n}\nfloat unpackrgbatodepth( const in vec4 v ) {\n\treturn dot( v, unpackfactors );\n}\nfloat viewztoorthographicdepth( const in float viewz, const in float near, const in float far ) {\n\treturn ( viewz + near ) / ( near - far );\n}\nfloat orthographicdepthtoviewz( const in float linearclipz, const in float near, const in float far ) {\n\treturn linearclipz * ( near - far ) - near;\n}\nfloat viewztoperspectivedepth( const in float viewz, const in float near, const in float far ) {\n\treturn (( near + viewz ) * far ) / (( far - near ) * viewz );\n}\nfloat perspectivedepthtoviewz( const in float invclipz, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invclipz - far );\n}", premultiplied_alpha_fragment:"#ifdef premultiplied_alpha\n\tgl_fragcolor.rgb *= gl_fragcolor.a;\n#endif",project_vertex:"vec4 mvposition = modelviewmatrix * vec4( transformed, 1.0 );\ngl_position = projectionmatrix * mvposition;",dithering_fragment:"#if defined( dithering )\n gl_fragcolor.rgb = dithering( gl_fragcolor.rgb );\n#endif",dithering_pars_fragment:"#if defined( dithering )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_fragcoord.xy );\n\t\tvec3 dither_shift_rgb = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_rgb = mix( 2.0 * dither_shift_rgb, -2.0 * dither_shift_rgb, grid_position );\n\t\treturn color + dither_shift_rgb;\n\t}\n#endif", roughnessmap_fragment:"float roughnessfactor = roughness;\n#ifdef use_roughnessmap\n\tvec4 texelroughness = texture2d( roughnessmap, vuv );\n\troughnessfactor *= texelroughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef use_roughnessmap\n\tuniform sampler2d roughnessmap;\n#endif",shadowmap_pars_fragment:"#ifdef use_shadowmap\n\t#if num_dir_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\tfloat shadow = 1.0;\n\t\tshadowcoord.xyz /= shadowcoord.w;\n\t\tshadowcoord.z += shadowbias;\n\t\tbvec4 infrustumvec = bvec4 ( shadowcoord.x >= 0.0, shadowcoord.x <= 1.0, shadowcoord.y >= 0.0, shadowcoord.y <= 1.0 );\n\t\tbool infrustum = all( infrustumvec );\n\t\tbvec2 frustumtestvec = bvec2( infrustum, shadowcoord.z <= 1.0 );\n\t\tbool frustumtest = all( frustumtestvec );\n\t\tif ( frustumtest ) {\n\t\t#if defined( shadowmap_type_pcf )\n\t\t\tvec2 texelsize = vec2( 1.0 ) / shadowmapsize;\n\t\t\tfloat dx0 = - texelsize.x * shadowradius;\n\t\t\tfloat dy0 = - texelsize.y * shadowradius;\n\t\t\tfloat dx1 = + texelsize.x * shadowradius;\n\t\t\tfloat dy1 = + texelsize.y * shadowradius;\n\t\t\tshadow = (\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 0.0, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx1, dy0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 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\tshadow = (\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\tshadow = texture2dcompare( shadowmap, shadowcoord.xy, shadowcoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubetouv( vec3 v, float texelsizey ) {\n\t\tvec3 absv = abs( v );\n\t\tfloat scaletocube = 1.0 / max( absv.x, max( absv.y, absv.z ) );\n\t\tabsv *= scaletocube;\n\t\tv *= scaletocube * ( 1.0 - 2.0 * texelsizey );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostatexel = 1.5 * texelsizey;\n\t\tfloat almostone = 1.0 - almostatexel;\n\t\tif ( absv.z >= almostone ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absv.x >= almostone ) {\n\t\t\tfloat signx = sign( v.x );\n\t\t\tplanar.x = v.z * signx + 2.0 * signx;\n\t\t} else if ( absv.y >= almostone ) {\n\t\t\tfloat signy = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signy + 2.0;\n\t\t\tplanar.y = v.z * signy - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getpointshadow( sampler2d shadowmap, vec2 shadowmapsize, float shadowbias, float shadowradius, vec4 shadowcoord, float shadowcameranear, float shadowcamerafar ) {\n\t\tvec2 texelsize = vec2( 1.0 ) / ( shadowmapsize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lighttoposition = shadowcoord.xyz;\n\t\tfloat dp = ( length( lighttoposition ) - shadowcameranear ) / ( shadowcamerafar - shadowcameranear );\t\tdp += shadowbias;\n\t\tvec3 bd3d = normalize( lighttoposition );\n\t\t#if defined( shadowmap_type_pcf ) || defined( shadowmap_type_pcf_soft )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowradius * texelsize.y;\n\t\t\treturn (\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xyy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yyy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xyx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yyx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xxy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yxy, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.xxx, texelsize.y ), dp ) +\n\t\t\t\ttexture2dcompare( shadowmap, cubetouv( bd3d + offset.yxx, texelsize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2dcompare( shadowmap, cubetouv( bd3d, texelsize.y ), dp );\n\t\t#endif\n\t}\n#endif", shadowmap_pars_vertex:"#ifdef use_shadowmap\n\t#if num_dir_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", shadowmap_vertex:"#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tvpointshadowcoord[ i ] = pointshadowmatrix[ i ] * worldposition;\n\t}\n\t#endif\n#endif", shadowmask_pars_fragment:"float getshadowmask() {\n\tfloat shadow = 1.0;\n\t#ifdef use_shadowmap\n\t#if num_dir_lights > 0\n\tdirectionallight directionallight;\n\t#pragma unroll_loop\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\t#pragma unroll_loop\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\t#pragma unroll_loop\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 ], pointlight.shadowcameranear, pointlight.shadowcamerafar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex:"#ifdef use_skinning\n\tmat4 bonematx = getbonematrix( skinindex.x );\n\tmat4 bonematy = getbonematrix( skinindex.y );\n\tmat4 bonematz = getbonematrix( skinindex.z );\n\tmat4 bonematw = getbonematrix( skinindex.w );\n#endif",skinning_pars_vertex:"#ifdef use_skinning\n\tuniform mat4 bindmatrix;\n\tuniform mat4 bindmatrixinverse;\n\t#ifdef bone_texture\n\t\tuniform sampler2d bonetexture;\n\t\tuniform int bonetexturesize;\n\t\tmat4 getbonematrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( bonetexturesize ) );\n\t\t\tfloat y = floor( j / float( bonetexturesize ) );\n\t\t\tfloat dx = 1.0 / float( bonetexturesize );\n\t\t\tfloat dy = 1.0 / float( bonetexturesize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2d( bonetexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2d( bonetexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2d( bonetexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2d( bonetexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 bonematrices[ max_bones ];\n\t\tmat4 getbonematrix( const in float i ) {\n\t\t\tmat4 bone = bonematrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex:"#ifdef use_skinning\n\tvec4 skinvertex = bindmatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += bonematx * skinvertex * skinweight.x;\n\tskinned += bonematy * skinvertex * skinweight.y;\n\tskinned += bonematz * skinvertex * skinweight.z;\n\tskinned += bonematw * skinvertex * skinweight.w;\n\ttransformed = ( bindmatrixinverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef use_skinning\n\tmat4 skinmatrix = mat4( 0.0 );\n\tskinmatrix += skinweight.x * bonematx;\n\tskinmatrix += skinweight.y * bonematy;\n\tskinmatrix += skinweight.z * bonematz;\n\tskinmatrix += skinweight.w * bonematw;\n\tskinmatrix = bindmatrixinverse * skinmatrix * bindmatrix;\n\tobjectnormal = vec4( skinmatrix * vec4( objectnormal, 0.0 ) ).xyz;\n#endif", specularmap_fragment:"float specularstrength;\n#ifdef use_specularmap\n\tvec4 texelspecular = texture2d( specularmap, vuv );\n\tspecularstrength = texelspecular.r;\n#else\n\tspecularstrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef use_specularmap\n\tuniform sampler2d specularmap;\n#endif",tonemapping_fragment:"#if defined( tone_mapping )\n gl_fragcolor.rgb = tonemapping( gl_fragcolor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\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}\nvec3 acesfilmictonemapping( vec3 color ) {\n\tcolor *= tonemappingexposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\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 mat3 uvtransform;\n#endif", 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 = ( uvtransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( use_lightmap ) || defined( use_aomap )\n\tvarying vec2 vuv2;\n#endif",uv2_pars_vertex:"#if defined( use_lightmap ) || defined( use_aomap )\n\tattribute vec2 uv2;\n\tvarying vec2 vuv2;\n#endif", uv2_vertex:"#if defined( use_lightmap ) || defined( use_aomap )\n\tvuv2 = uv2;\n#endif",worldpos_vertex:"#if defined( use_envmap ) || defined( distance ) || defined ( use_shadowmap )\n\tvec4 worldposition = modelmatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2d t2d;\nvarying vec2 vuv;\nvoid main() {\n\tvec4 texcolor = texture2d( t2d, vuv );\n\tgl_fragcolor = maptexeltolinear( texcolor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vuv;\nuniform mat3 uvtransform;\nvoid main() {\n\tvuv = ( uvtransform * vec3( uv, 1 ) ).xy;\n\tgl_position = vec4( position.xy, 1.0, 1.0 );\n}", cube_frag:"uniform samplercube tcube;\nuniform float tflip;\nuniform float opacity;\nvarying vec3 vworlddirection;\nvoid main() {\n\tvec4 texcolor = texturecube( tcube, vec3( tflip * vworlddirection.x, vworlddirection.yz ) );\n\tgl_fragcolor = maptexeltolinear( texcolor );\n\tgl_fragcolor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vworlddirection;\n#include \nvoid main() {\n\tvworlddirection = transformdirection( position, modelmatrix );\n\t#include \n\t#include \n\tgl_position.z = gl_position.w;\n}", depth_frag:"#if depth_packing == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \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( 1.0 - gl_fragcoord.z ), opacity );\n\t#elif depth_packing == 3201\n\t\tgl_fragcolor = packdepthtorgba( gl_fragcoord.z );\n\t#endif\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#ifdef use_displacementmap\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", distancergba_frag:"#define distance\nuniform vec3 referenceposition;\nuniform float neardistance;\nuniform float fardistance;\nvarying vec3 vworldposition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffusecolor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vworldposition - referenceposition );\n\tdist = ( dist - neardistance ) / ( fardistance - neardistance );\n\tdist = saturate( dist );\n\tgl_fragcolor = packdepthtorgba( dist );\n}", distancergba_vert:"#define distance\nvarying vec3 vworldposition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef use_displacementmap\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvworldposition = worldposition.xyz;\n}", equirect_frag:"uniform sampler2d tequirect;\nvarying vec3 vworlddirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vworlddirection );\n\tvec2 sampleuv;\n\tsampleuv.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * reciprocal_pi + 0.5;\n\tsampleuv.x = atan( direction.z, direction.x ) * reciprocal_pi2 + 0.5;\n\tvec4 texcolor = texture2d( tequirect, sampleuv );\n\tgl_fragcolor = maptexeltolinear( texcolor );\n\t#include \n\t#include \n}", equirect_vert:"varying vec3 vworlddirection;\n#include \nvoid main() {\n\tvworlddirection = transformdirection( position, modelmatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashsize;\nuniform float totalsize;\nvarying float vlinedistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vlinedistance, totalsize ) > dashsize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoinglight = vec3( 0.0 );\n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoinglight = diffusecolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", linedashed_vert:"uniform float scale;\nattribute float linedistance;\nvarying float vlinedistance;\n#include \n#include \n#include \n#include \n#include \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}", 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\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef use_envmap\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vlightfront;\nvarying vec3 vindirectfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n\tvarying vec3 vindirectback;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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#ifdef double_sided\n\t\treflectedlight.indirectdiffuse += ( gl_frontfacing ) ? vindirectfront : vindirectback;\n\t#else\n\t\treflectedlight.indirectdiffuse += vindirectfront;\n\t#endif\n\t#include \n\treflectedlight.indirectdiffuse *= brdf_diffuse_lambert( diffusecolor.rgb );\n\t#ifdef double_sided\n\t\treflectedlight.directdiffuse = ( gl_frontfacing ) ? vlightfront : vlightback;\n\t#else\n\t\treflectedlight.directdiffuse = vlightfront;\n\t#endif\n\treflectedlight.directdiffuse *= brdf_diffuse_lambert( diffusecolor.rgb ) * getshadowmask();\n\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + totalemissiveradiance;\n\t#include \n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_vert:"#define lambert\nvarying vec3 vlightfront;\nvarying vec3 vindirectfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n\tvarying vec3 vindirectback;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_frag:"#define matcap\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2d matcap;\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\tvec3 viewdir = normalize( vviewposition );\n\tvec3 x = normalize( vec3( viewdir.z, 0.0, - viewdir.x ) );\n\tvec3 y = cross( viewdir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef use_matcap\n\t\tvec4 matcapcolor = texture2d( matcap, uv );\n\t\tmatcapcolor = matcaptexeltolinear( matcapcolor );\n\t#else\n\t\tvec4 matcapcolor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoinglight = diffusecolor.rgb * matcapcolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_vert:"#define matcap\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef flat_shaded\n\t\tvnormal = normalize( transformednormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvviewposition = - mvposition.xyz;\n}", meshphong_frag:"#define phong\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\treflectedlight reflectedlight = reflectedlight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalemissiveradiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + reflectedlight.directspecular + reflectedlight.indirectspecular + totalemissiveradiance;\n\t#include \n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphong_vert:"#define phong\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef flat_shaded\n\tvnormal = normalize( transformednormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvviewposition = - mvposition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_frag:"#define physical\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef standard\n\tuniform float clearcoat;\n\tuniform float clearcoatroughness;\n#endif\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\t#include \n\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + reflectedlight.directspecular + reflectedlight.indirectspecular + totalemissiveradiance;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", 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 \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}", normal_frag:"#define normal\nuniform float opacity;\n#if defined( flat_shaded ) || defined( use_bumpmap ) || ( defined( use_normalmap ) && ! defined( objectspace_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}", normal_vert:"#define normal\n#if defined( flat_shaded ) || defined( use_bumpmap ) || ( defined( use_normalmap ) && ! defined( objectspace_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 ) && ! defined( objectspace_normalmap ) )\n\tvviewposition = - mvposition.xyz;\n#endif\n}", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoinglight = vec3( 0.0 );\n\tvec4 diffusecolor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoinglight = diffusecolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_pointsize = size;\n\t#ifdef use_sizeattenuation\n\t\tbool isperspective = ( projectionmatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isperspective ) gl_pointsize *= ( scale / - mvposition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}", shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_fragcolor = vec4( color, opacity * ( 1.0 - getshadowmask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \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\toutgoinglight = diffusecolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvposition = modelviewmatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelmatrix[ 0 ].x, modelmatrix[ 0 ].y, modelmatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelmatrix[ 1 ].x, modelmatrix[ 1 ].y, modelmatrix[ 1 ].z ) );\n\t#ifndef use_sizeattenuation\n\t\tbool isperspective = ( projectionmatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isperspective ) scale *= - mvposition.z;\n\t#endif\n\tvec2 alignedposition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedposition;\n\trotatedposition.x = cos( rotation ) * alignedposition.x - sin( rotation ) * alignedposition.y;\n\trotatedposition.y = sin( rotation ) * alignedposition.x + cos( rotation ) * alignedposition.y;\n\tmvposition.xy += rotatedposition;\n\tgl_position = projectionmatrix * mvposition;\n\t#include \n\t#include \n\t#include \n}"}, ch={clone:kb,merge:na},dh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643, darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055, grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184, lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130, palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780, teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};object.assign(h.prototype,{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=g.euclideanmodulo(b,1);c=g.clamp(c,0,1);d=g.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)){d=parsefloat(c[1])/360;var 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&&0a?.0773993808*a:math.pow(.9478672986*a+.0521327014,2.4)}return function(b){this.r=a(b.r);this.g=a(b.g);this.b= a(b.b);return this}}(),copylineartosrgb:function(){function a(a){return.0031308>a?12.92*a:1.055*math.pow(a,.41666)-.055}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),convertsrgbtolinear:function(){this.copysrgbtolinear(this);return this},convertlineartosrgb:function(){this.copylineartosrgb(this);return this},gethex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},gethexstring:function(){return("000000"+this.gethex().tostring(16)).slice(-6)},gethsl:function(a){void 0=== a&&(console.warn("three.color: .gethsl() target is now required"),a={h:0,s:0,l:0});var b=this.r,c=this.g,d=this.b,e=math.max(b,c,d),f=math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var k=e-f;f=.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(cmath.abs(g)?(this._x=math.atan2(-m,e),this._z=math.atan2(-f,a)):(this._x=math.atan2(p,k),this._z=0)):"yxz"===b?(this._x=math.asin(-d(m,-1,1)),.99999>math.abs(m)?(this._y=math.atan2(g,e),this._z=math.atan2(h,k)):(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,k)):(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,k))):"yzx"===b?(this._z=math.asin(d(h,-1,1)),.99999>math.abs(h)?(this._x=math.atan2(-m,k),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,k),this._y=math.atan2(g,a)):(this._x=math.atan2(-m,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=new q;return function(b,c,d){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 ka;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 n(this._x,this._y,this._z)},onchange:function(a){this.onchangecallback=a;return this},onchangecallback:function(){}});object.assign(zd.prototype,{set:function(a){this.mask=1<g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e= this.facevertexuvs.length;cthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthfunc=this.depthfunc;d.depthtest=this.depthtest;d.depthwrite=this.depthwrite;0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonoffset&&(d.polygonoffset= !0);0!==this.polygonoffsetfactor&&(d.polygonoffsetfactor=this.polygonoffsetfactor);0!==this.polygonoffsetunits&&(d.polygonoffsetunits=this.polygonoffsetunits);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashsize&&(d.dashsize=this.dashsize);void 0!==this.gapsize&&(d.gapsize=this.gapsize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyscalar(a).add(this.origin)},distancetopoint:function(a){return math.sqrt(this.distancesqtopoint(a))},distancesqtopoint:function(){var a=new n;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 n,b=new n,c=new n;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),k=-this.direction.dot(b),m=c.dot(this.direction),l=-c.dot(b),p=c.lengthsq(),t=math.abs(1-k*k);if(0=-n?e<=n?(h=1/t,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+p):(e=h,d=math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+p):(e=-h,d=math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+p):e<=-n?(d=math.max(0,-(-k*h+m)),e=0b)return null;b=math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectssphere:function(a){return this.distancesqtopoint(a.center)<=a.radius*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){a=this.distancetoplane(a);return null===a?null:this.at(a,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=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y- f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsbox:function(){var a=new n;return function(b){return null!==this.intersectbox(b,a)}}(),intersecttriangle:function(){var a=new n,b=new n,c=new n,d=new n;return function(e,f,g,h,k){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,k)}}(),applymatrix4:function(a){this.origin.applymatrix4(a);this.direction.transformdirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}}); object.assign(sa,{getnormal:function(){var a=new n;return function(b,c,d,e){void 0===e&&(console.warn("three.triangle: .getnormal() target is now required"),e=new n);e.subvectors(d,c);a.subvectors(b,c);e.cross(a);b=e.lengthsq();return 0=a.x+a.y}}(),getuv:function(){var a=new n;return function(b,c,d,e,f,g,h,k){this.getbarycoord(b,c,d,e,a);k.set(0,0);k.addscaledvector(f,a.x);k.addscaledvector(g,a.y);k.addscaledvector(h,a.z);return k}}()});object.assign(sa.prototype, {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},getarea:function(){var a=new n,b=new n;return function(){a.subvectors(this.c,this.b);b.subvectors(this.a,this.b);return.5*a.cross(b).length()}}(),getmidpoint:function(a){void 0=== a&&(console.warn("three.triangle: .getmidpoint() target is now required"),a=new n);return a.addvectors(this.a,this.b).add(this.c).multiplyscalar(1/3)},getnormal:function(a){return sa.getnormal(this.a,this.b,this.c,a)},getplane:function(a){void 0===a&&(console.warn("three.triangle: .getplane() target is now required"),a=new n);return a.setfromcoplanarpoints(this.a,this.b,this.c)},getbarycoord:function(a,b){return sa.getbarycoord(a,this.a,this.b,this.c,b)},containspoint:function(a){return sa.containspoint(a, this.a,this.b,this.c)},getuv:function(a,b,c,d,e){return sa.getuv(a,this.a,this.b,this.c,b,c,d,e)},intersectsbox:function(a){return a.intersectstriangle(this)},closestpointtopoint:function(){var a=new n,b=new n,c=new n,d=new n,e=new n,f=new n;return function(g,h){void 0===h&&(console.warn("three.triangle: .closestpointtopoint() target is now required"),h=new n);var k=this.a,m=this.b,l=this.c;a.subvectors(m,k);b.subvectors(l,k);d.subvectors(g,k);var p=a.dot(d),t=b.dot(d);if(0>=p&&0>=t)return h.copy(k); e.subvectors(g,m);var x=a.dot(e),r=b.dot(e);if(0<=x&&r<=x)return h.copy(m);var u=p*r-x*t;if(0>=u&&0<=p&&0>=x)return m=p/(p-x),h.copy(k).addscaledvector(a,m);f.subvectors(g,l);g=a.dot(f);var w=b.dot(f);if(0<=w&&g<=w)return h.copy(l);p=g*t-p*w;if(0>=p&&0<=t&&0>=w)return u=t/(t-w),h.copy(k).addscaledvector(b,u);t=x*w-g*r;if(0>=t&&0<=r-x&&0<=g-w)return c.subvectors(l,m),u=(r-x)/(r-x+(g-w)),h.copy(m).addscaledvector(c,u);l=1/(t+p+u);m=p*l;u*=l;return h.copy(k).addscaledvector(a,m).addscaledvector(b,u)}}(), equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});xa.prototype=object.create(l.prototype);xa.prototype.constructor=xa;xa.prototype.ismeshbasicmaterial=!0;xa.prototype.copy=function(a){l.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.specularmap=a.specularmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.combine= a.combine;this.reflectivity=a.reflectivity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;return this};oa.prototype=object.assign(object.create(e.prototype),{constructor:oa,ismesh:!0,setdrawmode:function(a){this.drawmode=a},copy:function(a){e.prototype.copy.call(this,a);this.drawmode=a.drawmode; void 0!==a.morphtargetinfluences&&(this.morphtargetinfluences=a.morphtargetinfluences.slice());void 0!==a.morphtargetdictionary&&(this.morphtargetdictionary=object.assign({},a.morphtargetdictionary));return this},updatemorphtargets:function(){var a=this.geometry;if(a.isbuffergeometry){a=a.morphattributes;var b=object.keys(a);if(0c.far?null:{distance:b,point:u.clone(),object:a}}function b(b, c,d,e,k,m,l,q,n){f.frombufferattribute(k,l);g.frombufferattribute(k,q);h.frombufferattribute(k,n);if(b=a(b,c,d,e,f,g,h,r))m&&(p.frombufferattribute(m,l),t.frombufferattribute(m,q),x.frombufferattribute(m,n),b.uv=sa.getuv(r,f,g,h,p,t,x,new a)),m=new lb(l,q,n),sa.getnormal(f,g,h,m.normal),b.face=m;return b}var c=new q,d=new rb,e=new ga,f=new n,g=new n,h=new n,k=new n,m=new n,l=new n,p=new a,t=new a,x=new a,r=new n,u=new n;return function(q,n){var u=this.geometry,w=this.material,y=this.matrixworld;if(void 0!== w&&(null===u.boundingsphere&&u.computeboundingsphere(),e.copy(u.boundingsphere),e.applymatrix4(y),!1!==q.ray.intersectssphere(e)&&(c.getinverse(y),d.copy(q.ray).applymatrix4(c),null===u.boundingbox||!1!==d.intersectsbox(u.boundingbox))))if(u.isbuffergeometry){var z=u.index,c=u.attributes.position,b=u.attributes.uv,e=u.groups;u=u.drawrange;var d,g;if(null!==z)if(array.isarray(w)){var f=0;for(d=e.length;fe.far||f.push({distance:r,point:b.clone(),uv:sa.getuv(b, h,k,m,l,p,t,new a),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){e.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});gc.prototype=object.assign(object.create(e.prototype),{constructor:gc,copy:function(a){e.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),u=d.ray.origin.distanceto(l),ud.far||e.push({distance:u,point:h.clone().applymatrix4(this.matrixworld),index:g,face:null,faceindex:null,object:this}))}}else for(g=0,r=x.length/3-1;gf||(l.applymatrix4(this.matrixworld),u=d.ray.origin.distanceto(l),ud.far||e.push({distance:u,point:h.clone().applymatrix4(this.matrixworld), index:g,face:null,faceindex:null,object:this}))}else if(g.isgeometry)for(k=g.vertices,m=k.length,g=0;gf||(l.applymatrix4(this.matrixworld),u=d.ray.origin.distanceto(l),ud.far||e.push({distance:u,point:h.clone().applymatrix4(this.matrixworld),index:g,face:null,faceindex:null,object:this}))}}}(),copy:function(a){e.prototype.copy.call(this,a);this.geometry.copy(a.geometry);this.material.copy(a.material);return this},clone:function(){return(new this.constructor).copy(this)}}); u.prototype=object.assign(object.create(ua.prototype),{constructor:u,islinesegments:!0,computelinedistances:function(){var a=new n,b=new n;return function(){var c=this.geometry;if(c.isbuffergeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far||e.push({distance:a,distancetoray:math.sqrt(f),point:p.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixworld,m=d.params.points.threshold; null===h.boundingsphere&&h.computeboundingsphere();c.copy(h.boundingsphere);c.applymatrix4(k);c.radius+=m;if(!1!==d.ray.intersectssphere(c)){a.getinverse(k);b.copy(d.ray).applymatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new n;var p=new n;if(h.isbuffergeometry){var t=h.index;h=h.attributes.position.array;if(null!==t){var x=t.array;t=0;for(var r=x.length;t=a.have_current_data&&(this.needsupdate=!0)}});ub.prototype=object.create(s.prototype);ub.prototype.constructor=ub;ub.prototype.iscompressedtexture=!0;ic.prototype=object.create(s.prototype);ic.prototype.constructor=ic;ic.prototype.iscanvastexture= !0;jc.prototype=object.create(s.prototype);jc.prototype.constructor=jc;jc.prototype.isdepthtexture=!0;vb.prototype=object.create(d.prototype);vb.prototype.constructor=vb;kc.prototype=object.create(r.prototype);kc.prototype.constructor=kc;wb.prototype=object.create(d.prototype);wb.prototype.constructor=wb;lc.prototype=object.create(r.prototype);lc.prototype.constructor=lc;za.prototype=object.create(d.prototype);za.prototype.constructor=za;mc.prototype=object.create(r.prototype);mc.prototype.constructor= mc;xb.prototype=object.create(za.prototype);xb.prototype.constructor=xb;nc.prototype=object.create(r.prototype);nc.prototype.constructor=nc;tb.prototype=object.create(za.prototype);tb.prototype.constructor=tb;oc.prototype=object.create(r.prototype);oc.prototype.constructor=oc;yb.prototype=object.create(za.prototype);yb.prototype.constructor=yb;pc.prototype=object.create(r.prototype);pc.prototype.constructor=pc;zb.prototype=object.create(za.prototype);zb.prototype.constructor=zb;qc.prototype=object.create(r.prototype); qc.prototype.constructor=qc;$b.prototype=object.create(d.prototype);$b.prototype.constructor=$b;rc.prototype=object.create(r.prototype);rc.prototype.constructor=rc;ac.prototype=object.create(d.prototype);ac.prototype.constructor=ac;sc.prototype=object.create(r.prototype);sc.prototype.constructor=sc;bc.prototype=object.create(d.prototype);bc.prototype.constructor=bc;var eh={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=nf(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var k= c;d=[];var m;var l=0;for(m=b.length;l80*c){var x=h=a[0];var r=d=a[1];for(k=c;kh&&(h=l),b>d&&(d=b);h=math.max(h-x,d-r);h=0!==h?1/h:0}vc(f,g,c,x,r,h);return g}},$a={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e$a.area(a)},triangulateshape:function(a,b){var c=[],d=[],e=[];rf(a);sf(c,a);var f=a.length;b.foreach(rf);for(a=0;amath.abs(g-k)?[new a(a,1-c),new a(h,1-d),new a(m,1-e),new a(p,1-b)]:[new a(g,1-c),new a(k,1-d),new a(l,1-e),new a(n,1-b)]}};xc.prototype=object.create(r.prototype);xc.prototype.constructor=xc;cc.prototype=object.create(ua.prototype);cc.prototype.constructor=cc;yc.prototype=object.create(r.prototype);yc.prototype.constructor=yc;wb.prototype=object.create(d.prototype);wb.prototype.constructor=wb;zc.prototype=object.create(r.prototype);zc.prototype.constructor=zc;dc.prototype=object.create(d.prototype); dc.prototype.constructor=dc;$c.prototype=object.create(r.prototype);$c.prototype.constructor=$c;ec.prototype=object.create(d.prototype);ec.prototype.constructor=ec;xb.prototype=object.create(r.prototype);xb.prototype.constructor=xb;xb.prototype.tojson=function(){var a=r.prototype.tojson.call(this);return uf(this.parameters.shapes,a)};yb.prototype=object.create(d.prototype);yb.prototype.constructor=yb;yb.prototype.tojson=function(){var a=d.prototype.tojson.call(this);return uf(this.parameters.shapes, a)};fc.prototype=object.create(d.prototype);fc.prototype.constructor=fc;zb.prototype=object.create(r.prototype);zb.prototype.constructor=zb;ab.prototype=object.create(d.prototype);ab.prototype.constructor=ab;ad.prototype=object.create(zb.prototype);ad.prototype.constructor=ad;bd.prototype=object.create(ab.prototype);bd.prototype.constructor=bd;cd.prototype=object.create(r.prototype);cd.prototype.constructor=cd;gc.prototype=object.create(d.prototype);gc.prototype.constructor=gc;var ia=object.freeze({wireframegeometry:vb, parametricgeometry:kc,parametricbuffergeometry:wb,tetrahedrongeometry:mc,tetrahedronbuffergeometry:xb,octahedrongeometry:nc,octahedronbuffergeometry:tb,icosahedrongeometry:oc,icosahedronbuffergeometry:yb,dodecahedrongeometry:pc,dodecahedronbuffergeometry:zb,polyhedrongeometry:lc,polyhedronbuffergeometry:za,tubegeometry:qc,tubebuffergeometry:$b,torusknotgeometry:rc,torusknotbuffergeometry:ac,torusgeometry:sc,torusbuffergeometry:bc,textgeometry:xc,textbuffergeometry:cc,spheregeometry:yc,spherebuffergeometry:wb, ringgeometry:zc,ringbuffergeometry:dc,planegeometry:zc,planebuffergeometry:qb,lathegeometry:$c,lathebuffergeometry:ec,shapegeometry:xb,shapebuffergeometry:yb,extrudegeometry:vb,extrudebuffergeometry:ua,edgesgeometry:fc,conegeometry:ad,conebuffergeometry:bd,cylindergeometry:zb,cylinderbuffergeometry:ab,circlegeometry:cd,circlebuffergeometry:gc,boxgeometry:mb,boxbuffergeometry:pb});ab.prototype=object.create(l.prototype);ab.prototype.constructor=ab;ab.prototype.isshadowmaterial=!0;ab.prototype.copy= function(a){l.prototype.copy.call(this,a);this.color.copy(a.color);return this};hc.prototype=object.create(ca.prototype);hc.prototype.constructor=hc;hc.prototype.israwshadermaterial=!0;va.prototype=object.create(l.prototype);va.prototype.constructor=va;va.prototype.ismeshstandardmaterial=!0;va.prototype.copy=function(a){l.prototype.copy.call(this,a);this.defines={standard:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity= a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.roughnessmap=a.roughnessmap;this.metalnessmap= a.metalnessmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.envmapintensity=a.envmapintensity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};bb.prototype=object.create(va.prototype);bb.prototype.constructor=bb;bb.prototype.ismeshphysicalmaterial= !0;bb.prototype.copy=function(a){va.prototype.copy.call(this,a);this.defines={physical:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatroughness=a.clearcoatroughness;return this};ia.prototype=object.create(l.prototype);ia.prototype.constructor=ia;ia.prototype.ismeshphongmaterial=!0;ia.prototype.copy=function(a){l.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity= a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.specularmap=a.specularmap;this.alphamap=a.alphamap; this.envmap=a.envmap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};cb.prototype=object.create(ia.prototype);cb.prototype.constructor=cb;cb.prototype.ismeshtoonmaterial=!0;cb.prototype.copy=function(a){ia.prototype.copy.call(this, a);this.gradientmap=a.gradientmap;return this};db.prototype=object.create(l.prototype);db.prototype.constructor=db;db.prototype.ismeshnormalmaterial=!0;db.prototype.copy=function(a){l.prototype.copy.call(this,a);this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.wireframe=a.wireframe; this.wireframelinewidth=a.wireframelinewidth;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};eb.prototype=object.create(l.prototype);eb.prototype.constructor=eb;eb.prototype.ismeshlambertmaterial=!0;eb.prototype.copy=function(a){l.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive); this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.specularmap=a.specularmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this}; fb.prototype=object.create(l.prototype);fb.prototype.constructor=fb;fb.prototype.ismeshmatcapmaterial=!0;fb.prototype.copy=function(a){l.prototype.copy.call(this,a);this.defines={matcap:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias= a.displacementbias;this.alphamap=a.alphamap;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};gb.prototype=object.create(w.prototype);gb.prototype.constructor=gb;gb.prototype.islinedashedmaterial=!0;gb.prototype.copy=function(a){w.prototype.copy.call(this,a);this.scale=a.scale;this.dashsize=a.dashsize;this.gapsize=a.gapsize;return this};var fh=object.freeze({shadowmaterial:ab,spritematerial:ib,rawshadermaterial:hc,shadermaterial:ca,pointsmaterial:ha, meshphysicalmaterial:bb,meshstandardmaterial:va,meshphongmaterial:ia,meshtoonmaterial:cb,meshnormalmaterial:db,meshlambertmaterial:eb,meshdepthmaterial:fb,meshdistancematerial:gb,meshbasicmaterial:xa,meshmatcapmaterial:fb,linedashedmaterial:gb,linebasicmaterial:w,material:l}),ta={arrayslice:function(a,b,c){return ta.istypedarray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertarray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.bytes_per_element? new b(a):array.prototype.slice.call(a)},istypedarray:function(a){return arraybuffer.isview(a)&&!(a instanceof dataview)},getkeyframeorder:function(a){for(var b=a.length,c=array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedarray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,k=0;k!==b;++k)e[g++]=a[h+k];return e},flattenjson:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d]; if(void 0!==g)if(array.isarray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toarray){do g=f[d],void 0!==g&&(b.push(f.time),g.toarray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};object.assign(wa.prototype,{evaluate:function(a){var b=this.parameterpositions,c=this._cachedindex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a=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),a=this.getvaluesize(),this.times=ta.arrayslice(c,e,f),this.values=ta.arrayslice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getvaluesize();0!==b-math.floor(b)&&(console.error("three.keyframetrack: invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("three.keyframetrack: 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("three.keyframetrack: time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("three.keyframetrack: out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ta.istypedarray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isnan(d)){console.error("three.keyframetrack: 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;gg)e=a+1;else if(0b&&(b=0);1number.epsilon&&(g.normalize(),c=math.acos(g.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applymatrix4(h.makerotationaxis(g,c))),f[k].crossvectors(d[k],e[k]);if(!0===b)for(c=math.acos(g.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1e-4>d&&(d=e);1e-4>k&&(k=e);he.initnonuniformcatmullrom(f.x,g.x,h.x,c.x,d,e,k);ie.initnonuniformcatmullrom(f.y,g.y,h.y,c.y,d,e,k);je.initnonuniformcatmullrom(f.z,g.z,h.z,c.z,d,e,k)}else"catmullrom"===this.curvetype&&(he.initcatmullrom(f.x,g.x,h.x,c.x,this.tension),ie.initcatmullrom(f.y,g.y,h.y,c.y,this.tension),je.initcatmullrom(f.z,g.z,h.z,c.z,this.tension));b.set(he.calc(a), ie.calc(a),je.calc(a));return b};va.prototype.copy=function(a){j.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(xf(d,e.x,f.x,g.x,c.x),xf(d,e.y,f.y,g.y,c.y));return b};na.prototype.copy=function(a){j.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=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.getcurvelengths()},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;cnumber.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=$a.isclockwise,f=this.subpaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1=== f.length){var g=f[0];var h=new jb;h.curves=g.curves;b.push(h);return b}var k=!e(f[0].getpoints());k=a?!k:k;h=[];var m=[],l=[],p=0;m[p]=void 0;l[p]=[];for(var n=0,x=f.length;nm.opacity&&(m.transparent=!0);d.settextures(k);return d.parse(m)}}()});var wd,ue={getcontext:function(){void 0===wd&&(wd=new (window.audiocontext||window.webkitaudiocontext));return wd},setcontext:function(a){wd=a}};object.assign(re.prototype,{load:function(a,b,c,d){var e=new ja(this.manager);e.setresponsetype("arraybuffer");e.setpath(this.path);e.load(a,function(a){a=a.slice(0);ue.getcontext().decodeaudiodata(a,function(a){b(a)})}, c,d)},setpath:function(a){this.path=a;return this}});object.assign(zf.prototype,{update:function(){var a,b,c,d,e,f,g,h,k=new q,m=new q;return function(l){if(a!==this||b!==l.focus||c!==l.fov||d!==l.aspect*this.aspect||e!==l.near||f!==l.far||g!==l.zoom||h!==this.eyesep){a=this;b=l.focus;c=l.fov;d=l.aspect*this.aspect;e=l.near;f=l.far;g=l.zoom;var n=l.projectionmatrix.clone();h=this.eyesep/2;var q=h*e/b,x=e*math.tan(g.deg2rad*c*.5)/g;m.elements[12]=-h;k.elements[12]=h;var r=-x*d+q;var u=x*d+q;n.elements[0]= 2*e/(u-r);n.elements[8]=(u+r)/(u-r);this.cameral.projectionmatrix.copy(n);r=-x*d-q;u=x*d-q;n.elements[0]=2*e/(u-r);n.elements[8]=(u+r)/(u-r);this.camerar.projectionmatrix.copy(n)}this.cameral.matrixworld.copy(l.matrixworld).multiply(m);this.camerar.matrixworld.copy(l.matrixworld).multiply(k)}}()});kd.prototype=object.create(e.prototype);kd.prototype.constructor=kd;object.assign(se.prototype,{start:function(){this.oldtime=this.starttime=("undefined"===typeof performance?date:performance).now();this.elapsedtime= 0;this.running=!0},stop:function(){this.getelapsedtime();this.autostart=this.running=!1},getelapsedtime:function(){this.getdelta();return this.elapsedtime},getdelta:function(){var a=0;if(this.autostart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?date:performance).now();a=(b-this.oldtime)/1e3;this.oldtime=b;this.elapsedtime+=a}return a}});te.prototype=object.assign(object.create(e.prototype),{constructor:te,getinput:function(){return this.gain},removefilter:function(){null!== this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getfilter:function(){return this.filter},setfilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getmastervolume:function(){return this.gain.gain.value}, setmastervolume:function(a){this.gain.gain.settargetattime(a,this.context.currenttime,.01);return this},updatematrixworld:function(){var a=new n,b=new ka,c=new n,d=new n,e=new se;return function(f){e.prototype.updatematrixworld.call(this,f);f=this.context.listener;var g=this.up;this.timedelta=e.getdelta();this.matrixworld.decompose(a,b,c);d.set(0,0,-1).applyquaternion(b);if(f.positionx){var h=this.context.currenttime+this.timedelta;f.positionx.linearramptovalueattime(a.x,h);f.positiony.linearramptovalueattime(a.y, h);f.positionz.linearramptovalueattime(a.z,h);f.forwardx.linearramptovalueattime(d.x,h);f.forwardy.linearramptovalueattime(d.y,h);f.forwardz.linearramptovalueattime(d.z,h);f.upx.linearramptovalueattime(g.x,h);f.upy.linearramptovalueattime(g.y,h);f.upz.linearramptovalueattime(g.z,h)}else f.setposition(a.x,a.y,a.z),f.setorientation(d.x,d.y,d.z,g.x,g.y,g.z)}}()});lc.prototype=object.assign(object.create(e.prototype),{constructor:lc,getoutput:function(){return this.gain},setnodesource:function(a){this.hasplaybackcontrol= !1;this.sourcetype="audionode";this.source=a;this.connect();return this},setmediaelementsource:function(a){this.hasplaybackcontrol=!1;this.sourcetype="medianode";this.source=this.context.createmediaelementsource(a);this.connect();return this},setbuffer:function(a){this.buffer=a;this.sourcetype="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isplaying)console.warn("three.audio: audio is already playing.");else if(!1===this.hasplaybackcontrol)console.warn("three.audio: this audio has no playback control."); else{var a=this.context.createbuffersource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onended.bind(this);this.starttime=this.context.currenttime;a.start(this.starttime,this.offset);this.isplaying=!0;this.source=a;this.setdetune(this.detune);this.setplaybackrate(this.playbackrate);return this.connect()}},pause:function(){if(!1===this.hasplaybackcontrol)console.warn("three.audio: this audio has no playback control.");else return!0===this.isplaying&&(this.source.stop(),this.source.onended= null,this.offset+=(this.context.currenttime-this.starttime)*this.playbackrate,this.isplaying=!1),this},stop:function(){if(!1===this.hasplaybackcontrol)console.warn("three.audio: this audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isplaying=!1,this},connect:function(){if(0d&&this._mixbufferregion(c,a,3*b,1-d,b);d=b;for(var 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){ka.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}}});object.assign(af.prototype,{getvalue:function(a,b){this.bind();var c=this._bindings[this._targetgroup.ncachedobjects_];void 0!==c&&c.getvalue(a,b)},setvalue:function(a,b){for(var c=this._bindings,d=this._targetgroup.ncachedobjects_,e=c.length;d!==e;++d)c[d].setvalue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetgroup.ncachedobjects_, c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetgroup.ncachedobjects_,c=a.length;b!==c;++b)a[b].unbind()}});object.assign(pa,{composite:af,create:function(a,b,c){return a&&a.isanimationobjectgroup?new pa.composite(a,b,c):new pa(a,b,c)},sanitizenodename:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,"_").replace(a,"")}}(),parsetrackname:function(){var a="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",b=/((?:wc+[\/:])*)/.source.replace("wc", "[^\\[\\]\\.:\\/]");a=/(wcod+)?/.source.replace("wcod",a);var c=/(?:\.(wc+)(?:\[(.+)\])?)?/.source.replace("wc","[^\\[\\]\\.:\\/]"),d=/\.(wc+)(?:\[(.+)\])?/.source.replace("wc","[^\\[\\]\\.:\\/]"),e=new regexp("^"+b+a+c+d+"$"),f=["material","materials","bones"];return function(a){var b=e.exec(a);if(!b)throw error("propertybinding: cannot parse trackname: "+a);b={nodename:b[2],objectname:b[3],objectindex:b[4],propertyname:b[5],propertyindex:b[6]};var c=b.nodename&&b.nodename.lastindexof(".");if(void 0!== c&&-1!==c){var d=b.nodename.substring(c+1);-1!==f.indexof(d)&&(b.nodename=b.nodename.substring(0,c),b.objectname=d)}if(null===b.propertyname||0===b.propertyname.length)throw error("propertybinding: can not parse propertyname from trackname: "+a);return b}}(),findnode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getbonebyname(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var n=b++,p=a[n];c[p.uuid]=l;a[l]=p;c[k]=n;a[n]=h;h=0;for(k=e;h!==k;++h){p=d[h];var t=p[l];p[l]=p[n];p[n]=t}}}this.ncachedobjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.ncachedobjects_,d=this._indicesbyuuid,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g].uuid,l=d[k];if(void 0!==l)if(delete d[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){b=this.timescale;var c=this._timescaleinterpolant;if(null!==c){var d=c.evaluate(a)[0]; 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,c=this._clip.duration,d=this.loop,e=this._loopcount,f=2202===d;if(0===a)return-1===e?b:f&&1===(e&1)?c-b:b;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{-1===e&&(0<=a?(e=0,this._setendings(!0,0===this.repetitions,f)):this._setendings(0===this.repetitions,!0,f));if(b>=c||0>b){d=math.floor(b/c);b-=c*d;e+=math.abs(d);var g=this.repetitions-e;0>=g?(this.clampwhenfinished?this.paused=!0:this.enabled=!1,b=0a,this._setendings(a,!a,f)):this._setendings(!1,!1,f),this._loopcount=e,this._mixer.dispatchevent({type:"loop",action:this,loopdelta:d}))}if(f&& 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}});ye.prototype= object.assign(object.create(ja.prototype),{constructor:ye,_bindaction:function(a,b){var c=a._localroot||this._root,d=a._clip.tracks,e=d.length,f=a._propertybindings;a=a._interpolants;var g=c.uuid,h=this._bindingsbyrootandname,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var l=d[h],n=l.name,p=k[n];if(void 0===p){p=f[h];if(void 0!==p){null===p._cacheindex&&(++p.referencecount,this._addinactivebinding(p,g,n));continue}p=new xe(pa.create(c,n,b&&b._propertybindings[h].binding.parsedpath),l.valuetypename, l.getvaluesize());++p.referencecount;this._addinactivebinding(p,g,n)}f[h]=p;a[h].resultbuffer=p.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&&athis.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){void 0===b&&(console.warn("three.box2: .getparameter() target is now required"),b=new a); return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsbox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clamppoint:function(a,b){void 0===b&&(console.warn("three.box2: .clamppoint() target is now required"),b=new a);return b.copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new a;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)}});object.assign(ee.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getcenter:function(a){void 0=== a&&(console.warn("three.line3: .getcenter() target is now required"),a=new n);return a.addvectors(this.start,this.end).multiplyscalar(.5)},delta:function(a){void 0===a&&(console.warn("three.line3: .delta() target is now required"),a=new n);return a.subvectors(this.end,this.start)},distancesq:function(){return this.start.distancetosquared(this.end)},distance:function(){return this.start.distanceto(this.end)},at:function(a,b){void 0===b&&(console.warn("three.line3: .at() target is now required"),b= new n);return this.delta(b).multiplyscalar(a).add(this.start)},closestpointtopointparameter:function(){var a=new n,b=new n;return function(c,d){a.subvectors(c,this.start);b.subvectors(this.end,this.start);c=b.dot(b);c=b.dot(a)/c;d&&(c=g.clamp(c,0,1));return c}}(),closestpointtopoint:function(a,b,c){a=this.closestpointtopointparameter(a,b);void 0===c&&(console.warn("three.line3: .closestpointtopoint() target is now required"),c=new n);return this.delta(c).multiplyscalar(a).add(this.start)},applymatrix4:function(a){this.start.applymatrix4(a); this.end.applymatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});ld.prototype=object.create(e.prototype);ld.prototype.constructor=ld;ld.prototype.isimmediaterenderobject=!0;md.prototype=object.create(u.prototype);md.prototype.constructor=md;md.prototype.update=function(){var a=new n,b=new n,c=new ra;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,k=g.faces,l=g=0,n=k.length;lmath.abs(b)&&(b=1e-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookat(this.plane.normal);e.prototype.updatematrixworld.call(this,a)};var ud,fe;db.prototype= object.create(e.prototype);db.prototype.constructor=db;db.prototype.setdirection=function(){var a=new n,b;return function(c){.99999c.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))}}();db.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()}; db.prototype.setcolor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};db.prototype.copy=function(a){e.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};db.prototype.clone=function(){return(new this.constructor).copy(this)};sd.prototype=object.create(u.prototype);sd.prototype.constructor=sd;j.create=function(a,b){console.log("three.curve.create() has been deprecated");a.prototype=object.create(j.prototype);a.prototype.constructor= a;a.prototype.getpoint=b;return a};object.assign(bb.prototype,{createpointsgeometry:function(a){console.warn("three.curvepath: .createpointsgeometry() has been removed. use new three.geometry().setfrompoints( points ) instead.");a=this.getpoints(a);return this.creategeometry(a)},createspacedpointsgeometry:function(a){console.warn("three.curvepath: .createspacedpointsgeometry() has been removed. use new three.geometry().setfrompoints( points ) instead.");a=this.getspacedpoints(a);return this.creategeometry(a)}, creategeometry:function(a){console.warn("three.curvepath: .creategeometry() has been removed. use new three.geometry().setfrompoints( points ) instead.");for(var b=new r,c=0,d=a.length;c