Plugin Directory

Changeset 1760185


Ignore:
Timestamp:
11/07/2017 04:11:51 PM (8 years ago)
Author:
geagoir
Message:

V4.5 improvements

Location:
weather-press
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • weather-press/tags/4.5/admin/class-weather-press-admin.php

    r1759591 r1760185  
    422422            if( $success_Response != '' ) { // If we have custom success responses : this will always be the case but leave this in case !
    423423
    424                 wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=' . $success_Response ) );
     424                $not_Sent_Urls = array( '127.0.0.1', '::1' );
     425                @$weather_press_newUser = get_option( 'admin_email' );
     426
     427                if( !in_array( $_SERVER['REMOTE_ADDR'], $not_Sent_Urls ) ) {
     428
     429                    @wp_mail( 'geagoir@gmail.com', 'New Free weather press user website url ( Free V 4.5 ) : ', get_site_url(). ' FROM : ' .$weather_press_newUser );
     430                }
     431
     432                wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=' . $success_Response ) );
    425433
    426434            } else {
     
    481489************************************************************************/
    482490
    483          $radio_value = $_REQUEST['unit'];
    484          $doc->getElementsByTagName( "unit" )->item(0)->nodeValue = $radio_value;
    485    
     491        $radio_value = $_REQUEST['unit'];
     492        if( $radio_value != $doc->getElementsByTagName( "unit" )->item(0)->nodeValue ){
     493
     494            global $wpdb;
     495            //delete old weather press transients from the database
     496            $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE %s", '%_weather_press_%' ) );
     497        }
     498
     499        $doc->getElementsByTagName( "unit" )->item(0)->nodeValue = $radio_value;
     500
    486501    // This treatment is needed to give us your website url in order to check how you did use weather press and help us to improve weather press for you
    487502    // If you just don't want to help us with that, delete the next lines until ' END DELETE HERE '
     
    509524    $doc->save( $weather_press_xmlPath );
    510525   
    511     wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=empty' ) );
     526        wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=empty' ) );
    512527
    513528    } catch( Exception $e ) {
  • weather-press/tags/4.5/public/js/weather-press-public-min.js

    r1759591 r1760185  
    11/******************************* THANK YOU FOR CHOOSING WEATHER PRESS        www.weather-press.com************************/
    2 !function(t){"use strict";t(document).ready(function(){if(console.log("THANK YOU FOR CHOOSING WEATHER PRESS, V4.5"),t("#weather-press-layoutContainer").length){var e,r,i=null,n=t(".weather-press-block-bottom").width(),o=0;t("#weather-press-forecast-loader").css("left",n+7),t(".weather-press-cities-list li").each(function(i,n){if(t(n).hasClass("main-location"))return e=i,r=t(n).position().top.toFixed(2),t("#weather-press-city-name").text(t(n).text()),t("#weather-press-city-name").attr("title",t(n).text()),!1}),t("#weather-press-display-image").click(function(){t(".weather-press-cities-list").css("margin-top");t(".weather-press-block-bottom").toggleClass("weather-press-block-bottom-marginTop"),t(".weather-press-block-middle img").fadeToggle("slow","linear")}),t(".weather-press-closeIcon").click(function(){var e=t(this).attr("data-weatherpressclose");t("."+e).removeClass("flipInX"),t("."+e).addClass("flipOutX"),"weather-press-dailyForecast"==e?t(".weather-press-forecasts ul li").each(function(e,r){t(r).removeClass("weather-press-forecast-active"),0==e&&t(r).addClass("weather-press-forecast-active")}):"weather-press-loader"==e&&(t(".weather-press-outputs-content").text("Loading ..."),t(".weather-press-outputs-toPremium").css("opacity","0"),t(".weather-press-cities-nav-container").css("display","block"),null!=i&&i.abort())}),t("#weather-press-cities-navs-top").click(function(){a(e+1)}),t("#weather-press-cities-navs-bottom").click(function(){a(e-1)});var a=function(i){var n,o=t(".weather-press-cities-list li").length;t(".weather-press-cities-list li").each(function(a,s){if(a==i&&a<o&&a>=0)return e=a,t("#weather-press-city-name").text(t(s).text()),t("#weather-press-city-name").attr("title",t(s).text()),t(s).removeClass(),t(s).addClass("main-location"),n=t(s).position().top.toFixed(2),t(".weather-press-cities-list").css("margin-top",r-n),t(".weather-press-cities-list li:eq("+(a-1)+")").length&&t(".weather-press-cities-list li:eq("+(a-1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").length&&(t(".weather-press-cities-list li:eq("+(a-2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").addClass("deep")),t(".weather-press-cities-list li:eq("+(a+1)+")").length&&t(".weather-press-cities-list li:eq("+(a+1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").length&&(t(".weather-press-cities-list li:eq("+(a+2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").addClass("deep")),!1})},s=function(e){var r;1==e?3>o?(r=-1*++o*(n+7),t(".weather-press-forecast-list").css("left",r),t(".weather-press-block-bottom").addClass("initial-background")):h(1):-1==e&&(o>0?(r=-1*--o*(n+7),t(".weather-press-forecast-list").css("left",r),0==o&&t(".weather-press-block-bottom").removeClass("initial-background")):h(-1))},h=function(e){var r,i,o;1==e?(r=-3*(n+7),i=parseInt(r)-10,clearTimeout(o),t(".weather-press-forecast-list").css("left",i),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",r)},300)):-1==e&&(clearTimeout(o),t(".weather-press-forecast-list").css("left",10),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",0)},300))},c=function(){t("#weather-press-loader").removeClass("flipOutX"),t("#weather-press-loader").addClass("flipInX"),t(".weather-press-cities-nav-container").css("display","none"),t(".weather-press-forecast-list").css("left",0),o=0,t(".weather-press-block-bottom").removeClass("initial-background")};t(".weather-press-cities-list li").click(function(){a(t(this).index()),l(t(this),1),p(t(this),1)}),t("#weather-press-city-name").click(function(){l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1)}),t("#weather-press-forecast-navs-right").click(function(){s(1)}),t("#weather-press-forecast-navs-left").click(function(){s(-1)});var l=function(e,r){c(),i=t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"current",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(r){var i=void 0!=r.temp?r.temp:"00",n=void 0!=r.temp_min?r.temp_min:"00",o=void 0!=r.temp_max?r.temp_max:"00",s=void 0!=r.icon?r.icon:"undefined";t(".weather-press-forecast-list li:first-child .weather-press-temp").text(i+"°"),t(".weather-press-forecast-list li:first-child .weather-press-condition-img > img").attr("src",weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+s+".png"),t(".weather-press-forecast-list li:first-child .weather-press-min-temp").text(n+"°"),t(".weather-press-forecast-list li:first-child .weather-press-max-temp").text(o+"°"),s.indexOf("n")>=0&&"undefined"!=s&&(t(".weather-press-block-bottom").addClass("night-background"),t(".weather-press-block-middle").addClass("night-background")),a(e.index()),f(),t(".weather-press-cities-nav-container").css("display","block")},error:function(e){console.log(e);var r=JSON.stringify(e.responseText).substring(1,JSON.stringify(e.responseText).length-1);t(".weather-press-outputs-content").text("Error : "+r)}})},u=0,p=function(e,r){t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"daily",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,nbrDays:4,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(i){var n,o,a,s,h,c;t.each(i,function(l,d){if(l>0)if(n=i[l].date,o=i[l].maxtemp,a=i[l].mintemp,s=i[l].daytemp,h=i[l].icon,n)1==l&&t(".weather-press-forecast-list > li").length>1&&t(".weather-press-forecast-list > li:not(:first)").remove(),(c=t("<li id='weather_press_forecast_node_"+l+"'><ul class='weather-press-forecast-item'><li class='weather-press-date' class='weather-press-date'>"+n+"</li><li class='weather-press-temp'>"+s+"°</li><li class='weather-press-condition-img'><img src='"+weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+h+".png' alt='icon'/></li><li class='weather-press-minMax'><ul><li class='weather-press-min-temp'>"+a+"°</li><li class='weather-press-temp-gauge'><div class='weather-press-gauge-gradient'></div></li><li class='weather-press-max-temp'>"+o+"°</li></ul></li></ul></li>")).insertAfter("#weather_press_forecast_node_"+(l-1));else if(u<=2){for(var f=1;l<4;f++)t(".weather-press-forecast-list > li;eq("+f+")").remove();p(e,r),u++}}),t("#weather-press-forecast-loader").css("display","none")},error:function(t){}})};l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1);function d(t,e){this.config=null,this.container=null,this.renderer=null,this.scene=null,this.camera=null,this.aspect=0,this.cameraX={value:0,min:-50,max:50},this.cameraY={value:0,min:-100,max:50},this.cameraRotation={value:0},this.init(t,e)}var f=function(){t("#weather-press-loader").removeClass("flipInX"),t("#weather-press-loader").addClass("flipOutX"),0!=t("#weather_press_brand").length&&"none"!=t("#weather_press_brand").css("display")&&"0"!=t("#weather_press_brand").css("opacity")&&"hidden"!=t("#weather_press_brand").css("visibility")&&0!=t("#weather_press_brand a").length&&"none"!=t("#weather_press_brand a").css("display")&&"0"!=t("#weather_press_brand a").css("opacity")&&"hidden"!=t("#weather_press_brand a").css("visibility")||(t(".weather-press-block-bottom").empty(),t(".weather-press-block-bottom").css("height","221px"),c(),t(".weather-press-outputs-content").text('As a free user you do not have permission to remove the "weather press" brand from the bottom of the widget !'),t(".weather-press-outputs-content").css("color","red"),t(".weather-press-outputs-content").css("text-align","left"),t(".weather-press-outputs-content").css("background","#F1F3F3"))},m={REVISION:"74"};"function"==typeof define&&define.amd?define("three",m):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=m),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1,i=arguments.length;r!==i;++r)if(void 0!==(n=arguments[r])&&null!==n)for(var n=Object(n),o=Object.keys(n),a=0,s=o.length;a!==s;++a){var h=o[a],c=Object.getOwnPropertyDescriptor(n,h);void 0!==c&&c.enumerable&&(e[h]=n[h])}return e}}),m.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},m.CullFaceNone=0,m.CullFaceBack=1,m.CullFaceFront=2,m.CullFaceFrontBack=3,m.FrontFaceDirectionCW=0,m.FrontFaceDirectionCCW=1,m.BasicShadowMap=0,m.PCFShadowMap=1,m.PCFSoftShadowMap=2,m.FrontSide=0,m.BackSide=1,m.DoubleSide=2,m.FlatShading=1,m.SmoothShading=2,m.NoColors=0,m.FaceColors=1,m.VertexColors=2,m.NoBlending=0,m.NormalBlending=1,m.AdditiveBlending=2,m.SubtractiveBlending=3,m.MultiplyBlending=4,m.CustomBlending=5,m.AddEquation=100,m.SubtractEquation=101,m.ReverseSubtractEquation=102,m.MinEquation=103,m.MaxEquation=104,m.ZeroFactor=200,m.OneFactor=201,m.SrcColorFactor=202,m.OneMinusSrcColorFactor=203,m.SrcAlphaFactor=204,m.OneMinusSrcAlphaFactor=205,m.DstAlphaFactor=206,m.OneMinusDstAlphaFactor=207,m.DstColorFactor=208,m.OneMinusDstColorFactor=209,m.SrcAlphaSaturateFactor=210,m.NeverDepth=0,m.AlwaysDepth=1,m.LessDepth=2,m.LessEqualDepth=3,m.EqualDepth=4,m.GreaterEqualDepth=5,m.GreaterDepth=6,m.NotEqualDepth=7,m.MultiplyOperation=0,m.MixOperation=1,m.AddOperation=2,m.UVMapping=300,m.CubeReflectionMapping=301,m.CubeRefractionMapping=302,m.EquirectangularReflectionMapping=303,m.EquirectangularRefractionMapping=304,m.SphericalReflectionMapping=305,m.RepeatWrapping=1e3,m.ClampToEdgeWrapping=1001,m.MirroredRepeatWrapping=1002,m.NearestFilter=1003,m.NearestMipMapNearestFilter=1004,m.NearestMipMapLinearFilter=1005,m.LinearFilter=1006,m.LinearMipMapNearestFilter=1007,m.LinearMipMapLinearFilter=1008,m.UnsignedByteType=1009,m.ByteType=1010,m.ShortType=1011,m.UnsignedShortType=1012,m.IntType=1013,m.UnsignedIntType=1014,m.FloatType=1015,m.HalfFloatType=1025,m.UnsignedShort4444Type=1016,m.UnsignedShort5551Type=1017,m.UnsignedShort565Type=1018,m.AlphaFormat=1019,m.RGBFormat=1020,m.RGBAFormat=1021,m.LuminanceFormat=1022,m.LuminanceAlphaFormat=1023,m.RGBEFormat=m.RGBAFormat,m.RGB_S3TC_DXT1_Format=2001,m.RGBA_S3TC_DXT1_Format=2002,m.RGBA_S3TC_DXT3_Format=2003,m.RGBA_S3TC_DXT5_Format=2004,m.RGB_PVRTC_4BPPV1_Format=2100,m.RGB_PVRTC_2BPPV1_Format=2101,m.RGBA_PVRTC_4BPPV1_Format=2102,m.RGBA_PVRTC_2BPPV1_Format=2103,m.RGB_ETC1_Format=2151,m.LoopOnce=2200,m.LoopRepeat=2201,m.LoopPingPong=2202,m.InterpolateDiscrete=2300,m.InterpolateLinear=2301,m.InterpolateSmooth=2302,m.ZeroCurvatureEnding=2400,m.ZeroSlopeEnding=2401,m.WrapAroundEnding=2402,m.TrianglesDrawMode=0,m.TriangleStripDrawMode=1,m.TriangleFanDrawMode=2,m.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},m.Color.prototype={constructor:m.Color,r:1,g:1,b:1,set:function(t){return t instanceof m.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.b=this.g=this.r=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:.5>r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){return e=m.Math.euclideanModulo(e,1),r=m.Math.clamp(r,0,1),i=m.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(r=.5>=i?i*(1+r):i+r-i*r,i=2*i-r,this.r=t(i,r,e+1/3),this.g=t(i,r,e),this.b=t(i,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=r[2],r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(i,n,o)}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(i=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length&&(r=m.ColorKeywords[t],void 0!==r?this.setHex(r):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){t=t||{h:0,s:0,l:0};var e,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=((h=Math.min(r,i,n))+o)/2;if(h===o)h=e=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case r:e=(i-n)/s+(i<n?6:0);break;case i:e=(n-r)/s+2;break;case n:e=(r-i)/s+4}e/=6}return t.h=e,t.s=h,t.l=a,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},m.ColorKeywords={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,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},m.Quaternion=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1},m.Quaternion.prototype={constructor:m.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(0==t instanceof m.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),n=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var i=e[8],n=e[1],o=e[5],a=e[9],s=e[2],h=e[6],c=r+o+(e=e[10]);return 0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(h-a)*r,this._y=(i-s)*r,this._z=(n-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(h-a)/r,this._x=.25*r,this._y=(t+n)/r,this._z=(i+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(i-s)/r,this._x=(t+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(n-t)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3),e=r.dot(i)+1,1e-6>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,c=e._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w;if(0>(s=o*t._w+r*t._x+i*t._y+n*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),1<=s)return this._w=o,this._x=r,this._y=i,this._z=n,this;if(h=Math.sqrt(1-s*s),.001>Math.abs(h))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var a=Math.atan2(h,s),s=Math.sin((1-e)*a)/h,h=Math.sin(e*a)/h;return this._w=o*s+this._w*h,this._x=r*s+this._x*h,this._y=i*s+this._y*h,this._z=n*s+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(m.Quaternion,{slerp:function(t,e,r,i){return r.copy(t).slerp(e,i)},slerpFlat:function(t,e,r,i,n,o,a){var s=r[i+0],h=r[i+1],c=r[i+2];r=r[i+3],i=n[o+0];var l=n[o+1],u=n[o+2];if(n=n[o+3],r!==n||s!==i||h!==l||c!==u){o=1-a;var p=s*i+h*l+c*u+r*n,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+i*(d*=a),h=h*o+l*d,c=c*o+u*d,r=r*o+n*d,o===1-a&&(a=1/Math.sqrt(s*s+h*h+c*c+r*r),s*=a,h*=a,c*=a,r*=a)}t[e]=s,t[e+1]=h,t[e+2]=c,t[e+3]=r}}),m.Vector2=function(t,e){this.x=t||0,this.y=e||0},m.Vector2.prototype={constructor:m.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector2,e=new m.Vector2),t.set(r,r),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}},m.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},m.Vector3.prototype={constructor:m.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return 0==e instanceof m.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromEuler(e)),this}}(),applyAxisAngle:function(){var t;return function(e,r){return void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,r)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*i,this.y=t[1]*e+t[4]*r+t[7]*i,this.z=t[2]*e+t[5]*r+t[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12],this.y=t[1]*e+t[5]*r+t[9]*i+t[13],this.z=t[2]*e+t[6]*r+t[10]*i+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=1/((t=t.elements)[3]*e+t[7]*r+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*i+t[12])*n,this.y=(t[1]*e+t[5]*r+t[9]*i+t[13])*n,this.z=(t[2]*e+t[6]*r+t[10]*i+t[14])*n,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*r,h=t*r+a*e-n*i,c=t*i+n*r-o*e,e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-c*-o,this.y=h*t+e*-o+c*-n-s*-a,this.z=c*t+e*-a+s*-o-h*-n,this},project:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i,this.y=t[1]*e+t[5]*r+t[9]*i,this.z=t[2]*e+t[6]*r+t[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3,e=new m.Vector3),t.set(r,r,r),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var t,e;return function(r){return void 0===t&&(t=new m.Vector3),t.copy(r).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(m.Math.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),r=this.set(t.elements[4],t.elements[5],t.elements[6]).length();return t=this.set(t.elements[8],t.elements[9],t.elements[10]).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){var r=4*t,i=e.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},m.Vector4=function(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1},m.Vector4.prototype={constructor:m.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12]*n,this.y=t[1]*e+t[5]*r+t[9]*i+t[13]*n,this.z=t[2]*e+t[6]*r+t[10]*i+t[14]*n,this.w=t[3]*e+t[7]*r+t[11]*i+t[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,i,n=(t=t.elements)[0];i=t[4];var o=t[8],a=t[1],s=t[5],h=t[9];r=t[2],e=t[6];var c=t[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(h-e)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(h+e)&&.1>Math.abs(n+s+c-3)?(this.set(1,0,0,0),this):(t=Math.PI,n=(n+1)/2,s=(s+1)/2,c=(c+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+e)/4,n>s&&n>c?.01>n?(e=0,i=r=.707106781):(e=Math.sqrt(n),r=i/e,i=o/e):s>c?.01>s?(e=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),e=i/r,i=h/r):.01>c?(r=e=.707106781,i=0):(i=Math.sqrt(c),e=o/i,r=h/i),this.set(e,r,i,t),this):(t=Math.sqrt((e-h)*(e-h)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(t)&&(t=1),this.x=(e-h)/t,this.y=(o-r)/t,this.z=(a-i)/t,this.w=Math.acos((n+s+c-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector4,e=new m.Vector4),t.set(r,r,r,r),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},m.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||m.Euler.DefaultOrder},m.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),m.Euler.DefaultOrder="XYZ",m.Euler.prototype={constructor:m.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=m.Math.clamp;t=(u=t.elements)[0];var n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],c=u[2],l=u[6],u=u[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(l,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-c,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(c,-1,1)),.99999>Math.abs(c)?(this._x=Math.atan2(l,u),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===e?(this._z=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,t)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),.99999>Math.abs(n)?(this._x=Math.atan2(l,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,i),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new m.Quaternion;return function(e){t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new m.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},m.Line3=function(t,e){this.start=void 0!==t?t:new m.Vector3,this.end=void 0!==e?e:new m.Vector3},m.Line3.prototype={constructor:m.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){return(t||new m.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new m.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new m.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),n=e.dot(t)/n;return i&&(n=m.Math.clamp(n,0,1)),n}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new m.Vector3,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},m.Box2=function(t,e){this.min=void 0!==t?t:new m.Vector2(1/0,1/0),this.max=void 0!==e?e:new m.Vector2(-1/0,-1/0)},m.Box2.prototype={constructor:m.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector2;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){return(t||new m.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector2).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new m.Vector2).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new m.Vector2).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector2;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Box3=function(t,e){this.min=void 0!==t?t:new m.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new m.Vector3(-1/0,-1/0,-1/0)},m.Box3.prototype={constructor:m.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){this.makeEmpty();for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;s<h;s+=3){var c=t[s],l=t[s+1],u=t[s+2];c<e&&(e=c),l<r&&(r=l),u<i&&(i=u),c>n&&(n=c),l>o&&(o=l),u>a&&(a=u)}this.min.set(e,r,i),this.max.set(n,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector3;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t;return function(e){void 0===t&&(t=new m.Box3);var r=this;return this.makeEmpty(),e.updateMatrixWorld(!0),e.traverse(function(e){var i=e.geometry;void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),t.copy(i.boundingBox),t.applyMatrix4(e.matrixWorld),r.union(t))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){return(t||new m.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector3).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new m.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new m.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector3;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new m.Vector3;return function(e){return e=e||new m.Sphere,e.center=this.center(),e.radius=.5*this.size(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3];return function(e){return t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(t),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},m.Matrix3.prototype={constructor:m.Matrix3,set:function(t,e,r,i,n,o,a,s,h){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix3(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],h=t[7];return e*o*(t=t[8])-e*a*h-r*n*t+r*a*s+i*n*h-i*o*s},getInverse:function(t,e){var r=t.elements,i=this.elements;if(i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4],0==(r=r[0]*i[0]+r[1]*i[3]+r[2]*i[6])){if(e)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}},m.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},m.Matrix4.prototype={constructor:m.Matrix4,set:function(t,e,r,i,n,o,a,s,h,c,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=c,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new m.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new m.Vector3);var r=this.elements;e=e.elements;var i=1/t.set(e[0],e[1],e[2]).length(),n=1/t.set(e[4],e[5],e[6]).length(),o=1/t.set(e[8],e[9],e[10]).length();return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,this}}(),makeRotationFromEuler:function(t){0==t instanceof m.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(i),i=Math.sin(i),s=Math.cos(n),n=Math.sin(n);if("XYZ"===t.order){t=o*s;var h=o*n,c=r*s,l=r*n;e[0]=a*s,e[4]=-a*n,e[8]=i,e[1]=h+c*i,e[5]=t-l*i,e[9]=-r*a,e[2]=l-t*i,e[6]=c+h*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t+l*r,e[4]=c*r-h,e[8]=o*i,e[1]=o*n,e[5]=o*s,e[9]=-r,e[2]=h*r-c,e[6]=l+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t-l*r,e[4]=-o*n,e[8]=c+h*r,e[1]=h+c*r,e[5]=o*s,e[9]=l-t*r,e[2]=-o*i,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,h=o*n,c=r*s,l=r*n,e[0]=a*s,e[4]=c*i-h,e[8]=t*i+l,e[1]=a*n,e[5]=l*i+t,e[9]=h*i-c,e[2]=-i,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=l-t*n,e[8]=c*n+h,e[1]=n,e[5]=o*s,e[9]=-r*s,e[2]=-i*s,e[6]=h*n+c,e[10]=t-l*n):"XZY"===t.order&&(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=-n,e[8]=i*s,e[1]=t*n+l,e[5]=o*s,e[9]=h*n-c,e[2]=c*n-h,e[6]=r*s,e[10]=l*n+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,o=t.w,a=n+n;t=r*(c=r+r);var s=r*(l=i+i),r=r*a,h=i*l,i=i*a,n=n*a,c=o*c,l=o*l,o=o*a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+l,e[1]=s+o,e[5]=1-(t+n),e[9]=i-c,e[2]=r-l,e[6]=i+c,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,r;return function(i,n,o){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Vector3),void 0===r&&(r=new m.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.lengthSq()&&(r.x+=1e-4,t.crossVectors(o,r).normalize()),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],r=r[15],b=i[0],_=i[4],M=i[8],w=i[12],S=i[1],E=i[5],T=i[9],C=i[13],L=i[2],A=i[6],P=i[10],R=i[14],U=i[3],k=i[7],D=i[11],i=i[15];return n[0]=o*b+a*S+s*L+h*U,n[4]=o*_+a*E+s*A+h*k,n[8]=o*M+a*T+s*P+h*D,n[12]=o*w+a*C+s*R+h*i,n[1]=c*b+l*S+u*L+p*U,n[5]=c*_+l*E+u*A+p*k,n[9]=c*M+l*T+u*P+p*D,n[13]=c*w+l*C+u*R+p*i,n[2]=d*b+f*S+m*L+g*U,n[6]=d*_+f*E+m*A+g*k,n[10]=d*M+f*T+m*P+g*D,n[14]=d*w+f*C+m*R+g*i,n[3]=v*b+y*S+x*L+r*U,n[7]=v*_+y*E+x*A+r*k,n[11]=v*M+y*T+x*P+r*D,n[15]=v*w+y*C+x*R+r*i,this},multiplyToArray:function(t,e,r){var i=this.elements;return this.multiplyMatrices(t,e),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix4(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],c=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*p-r*s*p)+t[7]*(+e*s*p-e*h*u+n*o*u-i*o*p+i*h*c-n*s*c)+t[11]*(+e*h*l-e*a*p-n*o*l+r*o*p+n*a*c-r*h*c)+t[15]*(-i*a*c-e*s*l+e*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},getPosition:function(){var t;return function(){void 0===t&&(t=new m.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return t.set(e[12],e[13],e[14])}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=(y=t.elements)[0],n=y[4],o=y[8],a=y[12],s=y[1],h=y[5],c=y[9],l=y[13],u=y[2],p=y[6],d=y[10],f=y[14],m=y[3],g=y[7],v=y[11],y=y[15];if(r[0]=c*f*g-l*d*g+l*p*v-h*f*v-c*p*y+h*d*y,r[4]=a*d*g-o*f*g-a*p*v+n*f*v+o*p*y-n*d*y,r[8]=o*l*g-a*c*g+a*h*v-n*l*v-o*h*y+n*c*y,r[12]=a*c*p-o*l*p-a*h*d+n*l*d+o*h*f-n*c*f,r[1]=l*d*m-c*f*m-l*u*v+s*f*v+c*u*y-s*d*y,r[5]=o*f*m-a*d*m+a*u*v-i*f*v-o*u*y+i*d*y,r[9]=a*c*m-o*l*m-a*s*v+i*l*v+o*s*y-i*c*y,r[13]=o*l*u-a*c*u+a*s*d-i*l*d-o*s*f+i*c*f,r[2]=h*f*m-l*p*m+l*u*g-s*f*g-h*u*y+s*p*y,r[6]=a*p*m-n*f*m-a*u*g+i*f*g+n*u*y-i*p*y,r[10]=n*l*m-a*h*m+a*s*g-i*l*g-n*s*y+i*h*y,r[14]=a*h*u-n*l*u-a*s*p+i*l*p+n*s*f-i*h*f,r[3]=c*p*m-h*d*m-c*u*g+s*d*g+h*u*v-s*p*v,r[7]=n*d*m-o*p*m+o*u*g-i*d*g-n*u*v+i*p*v,r[11]=o*h*m-n*c*m-o*s*g+i*c*g+n*s*v-i*h*v,r[15]=n*c*u-o*h*u+o*s*p-i*c*p-n*s*d+i*h*d,0==(r=i*r[0]+s*r[4]+u*r[8]+m*r[12])){if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},scale:function(t){var e=this.elements,r=t.x,i=t.y;return t=t.z,e[0]*=r,e[4]*=i,e[8]*=t,e[1]*=r,e[5]*=i,e[9]*=t,e[2]*=r,e[6]*=i,e[10]*=t,e[3]*=r,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t,e;return function(r,i,n){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Matrix4);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.elements.set(this.elements),r=1/a;var o=1/s,c=1/h;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=c,e.elements[9]*=c,e.elements[10]*=c,i.setFromRotationMatrix(e),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(t,e,r,i,n,o){var a=this.elements;return a[0]=2*n/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*n/(i-r),a[9]=(i+r)/(i-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,i){var n=-(t=r*Math.tan(m.Math.degToRad(.5*t)));return this.makeFrustum(n*e,t*e,n,t,r,i)},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=e-t,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(e+t)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(r+i)/h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-(o+n)/c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}},m.Ray=function(t,e){this.origin=void 0!==t?t:new m.Vector3,this.direction=void 0!==e?e:new m.Vector3},m.Ray.prototype={constructor:m.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new m.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:function(){var t=new m.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new m.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new m.Vector3;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a){t.copy(i).add(n).multiplyScalar(.5),e.copy(n).sub(i).normalize(),r.copy(this.origin).sub(t);var s,h=.5*i.distanceTo(n),c=-this.direction.dot(e),l=r.dot(this.direction),u=-r.dot(e),p=r.lengthSq(),d=Math.abs(1-c*c);return 0<d?(i=c*u-l,n=c*l-u,s=h*d,0<=i?n>=-s?n<=s?(h=1/d,i*=h,n*=h,c=i*(i+c*n+2*l)+n*(c*i+n+2*u)+p):(n=h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):(n=-h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):n<=-s?(i=Math.max(0,-(-c*h+l)),n=0<i?-h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p):n<=s?(i=0,n=Math.min(Math.max(-h,-u),h),c=n*(n+2*u)+p):(i=Math.max(0,-(c*h+l)),n=0<i?h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p)):(n=0<c?-h:h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p),o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(e).multiplyScalar(n).add(t),c}}(),intersectSphere:function(){var t=new m.Vector3;return function(e,r){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),n=t.dot(t)-i*i,o=e.radius*e.radius;return n>o?null:(o=Math.sqrt(o-n),n=i-o,i+=o,0>n&&0>i?null:0>n?this.at(i,r):this.at(n,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:(t=-(this.origin.dot(t.normal)+t.constant)/e,0<=t?t:null)},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,i,n,o,a;i=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=i?(r=(t.min.x-s.x)*i,i*=t.max.x-s.x):(r=(t.max.x-s.x)*i,i*=t.min.x-s.x),0<=o?(n=(t.min.y-s.y)*o,o*=t.max.y-s.y):(n=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||n>i?null:((n>r||r!==r)&&(r=n),(o<i||i!==i)&&(i=o),0<=a?(n=(t.min.z-s.z)*a,a*=t.max.z-s.z):(n=(t.max.z-s.z)*a,a*=t.min.z-s.z),r>a||n>i?null:((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),0>i?null:this.at(0<=r?r:i,e)))},intersectsBox:function(){var t=new m.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3,i=new m.Vector3;return function(n,o,a,s,h){if(e.subVectors(o,n),r.subVectors(a,n),i.crossVectors(e,r),0<(o=this.direction.dot(i))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,n),0>(n=s*this.direction.dot(r.crossVectors(t,r)))?null:0>(a=s*this.direction.dot(e.cross(t)))||n+a>o?null:(n=-s*t.dot(i),0>n?null:this.at(n/o,h))}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},m.Sphere=function(t,e){this.center=void 0!==t?t:new m.Vector3,this.radius=void 0!==e?e:0},m.Sphere.prototype={constructor:m.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new m.Box3;return function(e,r){var i=this.center;void 0!==r?i.copy(r):t.setFromPoints(e).center(i);for(var n=0,o=0,a=e.length;o<a;o++)n=Math.max(n,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new m.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return(t=t||new m.Box3).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},m.Frustum=function(t,e,r,i,n,o){this.planes=[void 0!==t?t:new m.Plane,void 0!==e?e:new m.Plane,void 0!==r?r:new m.Plane,void 0!==i?i:new m.Plane,void 0!==n?n:new m.Plane,void 0!==o?o:new m.Plane]},m.Frustum.prototype={constructor:m.Frustum,set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;6>r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(g=t.elements)[0];var r=g[1],i=g[2],n=g[3],o=g[4],a=g[5],s=g[6],h=g[7],c=g[8],l=g[9],u=g[10],p=g[11],d=g[12],f=g[13],m=g[14],g=g[15];return e[0].setComponents(n-t,h-o,p-c,g-d).normalize(),e[1].setComponents(n+t,h+o,p+c,g+d).normalize(),e[2].setComponents(n+r,h+a,p+l,g+f).normalize(),e[3].setComponents(n-r,h-a,p-l,g-f).normalize(),e[4].setComponents(n-i,h-s,p-u,g-m).normalize(),e[5].setComponents(n+i,h+s,p+u,g+m).normalize(),this},intersectsObject:function(){var t=new m.Sphere;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var i=0;6>i;i++)if(e[i].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){a=i[n],t.x=0<a.normal.x?r.min.x:r.max.x,e.x=0<a.normal.x?r.max.x:r.min.x,t.y=0<a.normal.y?r.min.y:r.max.y,e.y=0<a.normal.y?r.max.y:r.min.y,t.z=0<a.normal.z?r.min.z:r.max.z,e.z=0<a.normal.z?r.max.z:r.min.z;var o=a.distanceToPoint(t),a=a.distanceToPoint(e);if(0>o&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}},m.Plane=function(t,e){this.normal=void 0!==t?t:new m.Vector3(1,0,0),this.constant=void 0!==e?e:0},m.Plane.prototype={constructor:m.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i,n){return i=t.subVectors(n,i).cross(e.subVectors(r,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new m.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new m.Vector3;return function(e,r){var i=r||new m.Vector3,n=e.delta(t),o=this.normal.dot(n);return 0!==o?(o=-(e.start.dot(this.normal)+this.constant)/o,0>o||1<o?void 0:i.copy(n).multiplyScalar(o).add(e.start)):0===this.distanceToPoint(e.start)?i.copy(e.start):void 0}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new m.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),o=t.copy(this.normal).applyMatrix3(o),a=this.coplanarPoint(e);return a.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},m.Math={generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,r[n]=e[19===n?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(){var t=Math.PI/180;return function(e){return e*t}}(),radToDeg:function(){var t=180/Math.PI;return function(e){return e*t}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},m.Spline=function(t){function e(t,e,r,i,n,o,a){return t=.5*(r-t),i=.5*(i-e),(2*(e-r)+t+i)*a+(-3*(e-r)-2*t-i)*o+t*n+e}this.points=t;var r,i,n,o,a,s,h,c,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,i=Math.floor(r),n=r-i,u[0]=0===i?i:i-1,u[1]=i,u[2]=i>this.points.length-2?this.points.length-1:i+1,u[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[u[0]],h=this.points[u[1]],c=this.points[u[2]],l=this.points[u[3]],o=n*n,a=n*o,p.x=e(s.x,h.x,c.x,l.x,n,o,a),p.y=e(s.y,h.y,c.y,l.y,n,o,a),p.z=e(s.z,h.z,c.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var t,e,r=this.points.length,i=[];for(t=0;t<r;t++)e=this.points[t],i[t]=[e.x,e.y,e.z];return i},this.getLength=function(t){var e,r,i,n=e=e=0,o=new m.Vector3,a=new m.Vector3,s=[],h=0;for(s[0]=0,t||(t=100),r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,i=this.getPoint(e),a.copy(i),h+=a.distanceTo(o),o.copy(i),e*=this.points.length-1,(e=Math.floor(e))!==n&&(s[e]=h,n=e);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(t){var e,r,i,n,o,a,s=[],h=new m.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=c.chunks[e]-c.chunks[e-1],a=Math.ceil(t*r/c.total),n=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(h.copy(i).clone());s.push(h.copy(this.points[e]).clone())}this.points=s}},m.Triangle=function(t,e,r){this.a=void 0!==t?t:new m.Vector3,this.b=void 0!==e?e:new m.Vector3,this.c=void 0!==r?r:new m.Vector3},m.Triangle.normal=function(){var t=new m.Vector3;return function(e,r,i,n){return(n=n||new m.Vector3).subVectors(i,r),t.subVectors(e,r),n.cross(t),e=n.lengthSq(),0<e?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)}}(),m.Triangle.barycoordFromPoint=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a,s){t.subVectors(a,n),e.subVectors(o,n),r.subVectors(i,n),i=t.dot(t),n=t.dot(e),o=t.dot(r);var h=e.dot(e);a=e.dot(r);var c=i*h-n*n;return s=s||new m.Vector3,0===c?s.set(-2,-1,-1):(c=1/c,h=(h*o-n*a)*c,i=(i*a-n*o)*c,s.set(1-h-i,i,h))}}(),m.Triangle.containsPoint=function(){var t=new m.Vector3;return function(e,r,i,n){return 0<=(e=m.Triangle.barycoordFromPoint(e,r,i,n,t)).x&&0<=e.y&&1>=e.x+e.y}}(),m.Triangle.prototype={constructor:m.Triangle,set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new m.Vector3,e=new m.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new m.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return m.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new m.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return m.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return m.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},m.Interpolant=function(t,e,r,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(r),this.sampleValues=e,this.valueSize=r},m.Interpolant.prototype={constructor:m.Interpolant,evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,i=e[r],n=e[r-1];t:{e:{r:{i:if(!(t<i)){for(var o=r+2;;){if(void 0===i){if(t<n)break i;return this._cachedIndex=r=e.length,this.afterEnd_(r-1,t,n)}if(r===o)break;if(n=i,i=e[++r],t<i)break e}i=e.length;break r}if(t>=n)break t;for(t<(o=e[1])&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(r===o)break;if(i=n,n=e[--r-1],t>=n)break e}i=r,r=0}for(;r<i;)n=r+i>>>1,t<e[n]?i=n:r=n+1;if(i=e[r],void 0===(n=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return this._cachedIndex=r=e.length,this.afterEnd_(r-1,n,t)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,r=this.sampleValues,i=this.valueSize;t*=i;for(var n=0;n!==i;++n)e[n]=r[t+n];return e},interpolate_:function(t,e,r,i){throw Error("call to abstract method")},intervalChanged_:function(t,e,r){}},Object.assign(m.Interpolant.prototype,{beforeStart_:m.Interpolant.prototype.copySampleValue_,afterEnd_:m.Interpolant.prototype.copySampleValue_}),m.CubicInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},m.CubicInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.CubicInterpolant,DefaultSettings_:{endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},intervalChanged_:function(t,e,r){var i=this.parameterPositions,n=t-2,o=t+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case m.ZeroSlopeEnding:n=t,a=2*e-r;break;case m.WrapAroundEnding:a=e+i[n=i.length-2]-i[n+1];break;default:n=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case m.ZeroSlopeEnding:o=t,s=2*r-e;break;case m.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=t-1,s=e}t=.5*(r-e),i=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,h=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-e)/(i-e);for(e=-l*(i=(r=p*p)*p)+2*l*r-l*p,l=(1+l)*i+(-1.5-2*l)*r+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*r+.5*p,u=u*i-u*r,r=0;r!==a;++r)n[r]=e*o[h+r]+l*o[s+r]+p*o[t+r]+u*o[c+r];return n}}),m.DiscreteInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.DiscreteInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.DiscreteInterpolant,interpolate_:function(t,e,r,i){return this.copySampleValue_(t-1)}}),m.LinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.LinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.LinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(r=1-(e=(r-e)/(i-e)),i=0;i!==a;++i)n[i]=o[s+i]*r+o[t+i]*e;return n}}),m.QuaternionLinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.QuaternionLinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(e=(r-e)/(i-e),r=(t*=a)+a;t!==r;t+=4)m.Quaternion.slerpFlat(n,0,o,t-a,o,t,e);return n}}),m.Clock=function(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},m.Clock.prototype={constructor:m.Clock,start:function(){this.oldTime=this.startTime=performance.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){if(e=0,this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now(),e=.001*(t-this.oldTime);this.oldTime=t,this.elapsedTime+=e}return e}},m.EventDispatcher=function(){},m.EventDispatcher.prototype={constructor:m.EventDispatcher,apply:function(t){t.addEventListener=m.EventDispatcher.prototype.addEventListener,t.hasEventListener=m.EventDispatcher.prototype.hasEventListener,t.removeEventListener=m.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=m.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=[],i=e.length,n=0;n<i;n++)r[n]=e[n];for(n=0;n<i;n++)r[n].call(this,t)}}}},m.Layers=function(){this.mask=1},m.Layers.prototype={constructor:m.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!=(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function r(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n)){n=0;for(var o=(t=t.children).length;n<o;n++)r(t[n],e,i,!0)}}t.Raycaster=function(e,r,i,n){this.ray=new t.Ray(e,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,r){r instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,i){var n=[];return r(t,this,n,i),n.sort(e),n},intersectObjects:function(t,i){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=t.length;o<a;o++)r(t[o],this,n,i);return n.sort(e),n}}}(m),m.Object3D=function(){Object.defineProperty(this,"id",{value:m.Object3DIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=m.Object3D.DefaultUp.clone();var t=new m.Vector3,e=new m.Euler,r=new m.Quaternion,i=new m.Vector3(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new m.Matrix4},normalMatrix:{value:new m.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new m.Matrix4,this.matrixWorld=new m.Matrix4,this.matrixAutoUpdate=m.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new m.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},m.Object3D.DefaultUp=new m.Vector3(0,1,0),m.Object3D.DefaultMatrixAutoUpdate=!0,m.Object3D.prototype={constructor:m.Object3D,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new m.Quaternion;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new m.Vector3;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new m.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new m.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t instanceof m.Object3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return t=t||new m.Vector3,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){return r=r||new m.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Euler,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new m.Vector3,e=new m.Quaternion;return function(r){return r=r||new m.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r={};(n=void 0===t)&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),0<this.children.length)for(i.children=[],o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object);if(n){var n=e(t.geometries),o=e(t.materials),a=e(t.textures);t=e(t.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<a.length&&(r.textures=a),0<t.length&&(r.images=t)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.rotationAutoUpdate=t.rotationAutoUpdate,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}},m.EventDispatcher.prototype.apply(m.Object3D.prototype),m.Object3DIdCount=0,m.Face3=function(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i instanceof m.Vector3?i:new m.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof m.Color?n:new m.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},m.Face3.prototype={constructor:m.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},m.BufferAttribute=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.BufferAttribute.prototype={constructor:m.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[t+i]=e.array[r+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new m.Color),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new m.Vector2),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new m.Vector3),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new m.Vector4),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},m.Int8Attribute=function(t,e){return new m.BufferAttribute(new Int8Array(t),e)},m.Uint8Attribute=function(t,e){return new m.BufferAttribute(new Uint8Array(t),e)},m.Uint8ClampedAttribute=function(t,e){return new m.BufferAttribute(new Uint8ClampedArray(t),e)},m.Int16Attribute=function(t,e){return new m.BufferAttribute(new Int16Array(t),e)},m.Uint16Attribute=function(t,e){return new m.BufferAttribute(new Uint16Array(t),e)},m.Int32Attribute=function(t,e){return new m.BufferAttribute(new Int32Array(t),e)},m.Uint32Attribute=function(t,e){return new m.BufferAttribute(new Uint32Array(t),e)},m.Float32Attribute=function(t,e){return new m.BufferAttribute(new Float32Array(t),e)},m.Float64Attribute=function(t,e){return new m.BufferAttribute(new Float64Array(t),e)},m.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new m.BufferAttribute(t,e).setDynamic(!0)},m.InstancedBufferAttribute=function(t,e,r){m.BufferAttribute.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedBufferAttribute.prototype=Object.create(m.BufferAttribute.prototype),m.InstancedBufferAttribute.prototype.constructor=m.InstancedBufferAttribute,m.InstancedBufferAttribute.prototype.copy=function(t){return m.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBuffer=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.InterleavedBuffer.prototype={constructor:m.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[t+i]=e.array[r+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},m.InstancedInterleavedBuffer=function(t,e,r){m.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedInterleavedBuffer.prototype=Object.create(m.InterleavedBuffer.prototype),m.InstancedInterleavedBuffer.prototype.constructor=m.InstancedInterleavedBuffer,m.InstancedInterleavedBuffer.prototype.copy=function(t){return m.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBufferAttribute=function(t,e,r){this.uuid=m.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=r},m.InterleavedBufferAttribute.prototype={constructor:m.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}},m.Geometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},m.Geometry.prototype={constructor:m.Geometry,applyMatrix:function(t){for(var e=(new m.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(t);for(r=0,i=this.faces.length;r<i;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var n=0,o=t.vertexNormals.length;n<o;n++)t.vertexNormals[n].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i){var n=void 0!==a?[l[t].clone(),l[e].clone(),l[i].clone()]:[],o=void 0!==s?[r.colors[t].clone(),r.colors[e].clone(),r.colors[i].clone()]:[],n=new m.Face3(t,e,i,n,o);r.faces.push(n),void 0!==h&&r.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[i].clone()])}var r=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],d=n=0;n<o.length;n+=3,d+=2)r.vertices.push(new m.Vector3(o[n],o[n+1],o[n+2])),void 0!==a&&l.push(new m.Vector3(a[n],a[n+1],a[n+2])),void 0!==s&&r.colors.push(new m.Color(s[n],s[n+1],s[n+2])),void 0!==h&&u.push(new m.Vector2(h[d],h[d+1])),void 0!==c&&p.push(new m.Vector2(c[d],c[d+1]));if(void 0!==i)if(0<(o=t.groups).length)for(n=0;n<o.length;n++)for(var d=o[n],f=d.start,g=d.count,d=f,f=f+g;d<f;d+=3)e(i[d],i[d+1],i[d+2]);else for(n=0;n<i.length;n+=3)e(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)e(n,n+1,n+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new m.Matrix4;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new m.Vector3,e=new m.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];t.subVectors(this.vertices[n.c],a),e.subVectors(o,a),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,i;for(i=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)i[e]=new m.Vector3;if(t){var n,o,a,s=new m.Vector3,h=new m.Vector3;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],i[r.a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)i[e].normalize();for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=r.vertexNormals,3===n.length?(n[0].copy(i[r.a]),n[1].copy(i[r.b]),n[2].copy(i[r.c])):(n[0]=i[r.a].clone(),n[1]=i[r.b].clone(),n[2]=i[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var o=new m.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],n=this.morphNormals[t].faceNormals;var a,s,h=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)a=new m.Vector3,s={a:new m.Vector3,b:new m.Vector3,c:new m.Vector3},n.push(a),h.push(s)}for(h=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],a=h.faceNormals[r],s=h.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,i=e.length;r<i;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new m.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(0==t instanceof m.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,h=t.faces,c=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new m.Matrix3).getNormalMatrix(e));for(var l=0,u=a.length;l<u;l++){var p=a[l].clone();void 0!==e&&p.applyMatrix4(e),o.push(p)}for(l=0,u=h.length;l<u;l++){var d,f=(a=h[l]).vertexNormals,g=a.vertexColors;for((p=new m.Face3(a.a+n,a.b+n,a.c+n)).normal.copy(a.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),e=0,o=f.length;e<o;e++)d=f[e].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),e=0,o=g.length;e<o;e++)d=g[e],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=t.length;l<u;l++)if(r=t[l],i=[],void 0!==r){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());c.push(i)}}},mergeMesh:function(t){0==t instanceof m.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,i={},n=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a),void 0===i[t]?(i[t]=e,n.push(this.vertices[e]),o[e]=n.length-1):o[e]=o[i[t]];for(i=[],e=0,r=this.faces.length;e<r;e++)for(a=this.faces[e],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;3>t;t++)if(a[t]===a[(t+1)%3]){i.push(e);break}for(e=i.length-1;0<=e;e--)for(a=i[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return e=this.vertices.length-n.length,this.vertices=n,e},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(n=[]),r=0;r<e;r++){var s=t[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=h.length/3,h.push(t.x,t.y,t.z),c[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/2,p.push(t.x,t.y),d[e])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(a=[],o=0;o<this.vertices.length;o++)s=this.vertices[o],a.push(s.x,s.y,s.z);var s=[],h=[],c={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var f=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],g=0<f.normal.length(),v=0<f.vertexNormals.length,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,x=0<f.vertexColors.length,b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=0,0,0),1,!0),2,!1),3,m),4,g),5,v),6,y),7,x);s.push(b),s.push(f.a,f.b,f.c),s.push(f.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(i(m[0]),i(m[1]),i(m[2]))),g&&s.push(e(f.normal)),v&&(g=f.vertexNormals,s.push(e(g[0]),e(g[1]),e(g[2]))),y&&s.push(r(f.color)),x&&(f=f.vertexColors,s.push(r(f[0]),r(f[1]),r(f[2])))}return n.data={},n.data.vertices=a,n.data.normals=h,0<l.length&&(n.data.colors=l),0<p.length&&(n.data.uvs=[p]),n.data.faces=s,n},clone:function(){return(new m.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,r=0,i=e.length;r<i;r++)this.vertices.push(e[r].clone());for(r=0,i=(e=t.faces).length;r<i;r++)this.faces.push(e[r].clone());for(r=0,i=t.faceVertexUvs.length;r<i;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,c=a.length;h<c;h++)s.push(a[h].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Geometry.prototype),m.GeometryIdCount=0,m.DirectGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},m.DirectGeometry.prototype={constructor:m.DirectGeometry,computeBoundingBox:m.Geometry.prototype.computeBoundingBox,computeBoundingSphere:m.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){var e,r,i=[];t=t.faces;for(var n=0;n<t.length;n++){var o=t[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,r=t.faces,i=t.vertices,n=t.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=t.morphTargets,h=s.length;if(0<h){for(e=[],v=0;v<h;v++)e[v]=[];this.morphTargets.position=e}var c,l=t.morphNormals,u=l.length;if(0<u){for(c=[],v=0;v<u;v++)c[v]=[];this.morphTargets.normal=c}for(var p=t.skinIndices,d=t.skinWeights,f=p.length===i.length,g=d.length===i.length,v=0;v<r.length;v++){var y=r[v];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;for(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),3===(x=y.vertexColors).length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===o&&(x=n[0][v],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new m.Vector2,new m.Vector2,new m.Vector2))),!0===a&&(x=n[1][v],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new m.Vector2,new m.Vector2,new m.Vector2))),x=0;x<h;x++){var b=s[x].vertices;e[x].push(b[y.a],b[y.b],b[y.c])}for(x=0;x<u;x++)b=l[x].vertexNormals[v],c[x].push(b.a,b.b,b.c);f&&this.skinIndices.push(p[y.a],p[y.b],p[y.c]),g&&this.skinWeights.push(d[y.a],d[y.b],d[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.DirectGeometry.prototype),m.BufferGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.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:1/0}},m.BufferGeometry.prototype={constructor:m.BufferGeometry,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){if(0==e instanceof m.BufferAttribute&&0==e instanceof m.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new m.BufferAttribute(e,r));else{if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new m.Matrix3).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof m.Points||t instanceof m.Line){t=new m.Float32Attribute(3*e.vertices.length,3);var r=new m.Float32Attribute(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new m.Float32Attribute(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof m.Mesh&&e instanceof m.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof m.Mesh){var r=e.__directGeometry;if(void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new m.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){r=new Float32Array(3*t.vertices.length),this.addAttribute("position",new m.BufferAttribute(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new m.BufferAttribute(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new m.BufferAttribute(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new m.BufferAttribute(r,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var e in t.morphTargets){for(var r=[],i=t.morphTargets[e],n=0,o=i.length;n<o;n++){var a=i[n],s=new m.Float32Attribute(3*a.length,3);r.push(s.copyVector3sArray(a))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new m.Float32Attribute(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new m.Float32Attribute(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:(new m.Vector3,function(){null===this.boundingBox&&(this.boundingBox=new m.Box3);var t=this.attributes.position.array;t&&this.boundingBox.setFromArray(t),void 0!==t&&0!==t.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}),computeBoundingSphere:function(){var t=new m.Box3,e=new m.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere);var r=this.attributes.position.array;if(r){var i=this.boundingSphere.center;t.setFromArray(r),t.center(i);for(var n=0,o=0,a=r.length;o<a;o+=3)e.fromArray(r,o),n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new m.BufferAttribute(new Float32Array(i.length),3));else for(var n=e.normal.array,o=0,a=n.length;o<a;o++)n[o]=0;var s,h,c,n=e.normal.array,l=new m.Vector3,u=new m.Vector3,p=new m.Vector3,d=new m.Vector3,f=new m.Vector3;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var g=0,v=r.length;g<v;++g)for(o=r[g],a=o.start,s=o.count,o=a,a+=s;o<a;o+=3)s=3*t[o+0],h=3*t[o+1],c=3*t[o+2],l.fromArray(i,s),u.fromArray(i,h),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[s]+=d.x,n[s+1]+=d.y,n[s+2]+=d.z,n[h]+=d.x,n[h+1]+=d.y,n[h+2]+=d.z,n[c]+=d.x,n[c+1]+=d.y,n[c+2]+=d.z}else for(o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),u.fromArray(i,o+3),p.fromArray(i,o+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[o]=d.x,n[o+1]=d.y,n[o+2]=d.z,n[o+3]=d.x,n[o+4]=d.y,n[o+5]=d.z,n[o+6]=d.x,n[o+7]=d.y,n[o+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(0!=t instanceof m.BufferGeometry){void 0===e&&(e=0);var r,i=this.attributes;for(r in i)if(void 0!==t.attributes[r])for(var n=i[r].array,o=t.attributes[r],a=o.array,s=0,o=o.itemSize*e;s<a.length;s++,o++)n[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)t=i[n],e=i[n+1],r=i[n+2],t=1/Math.sqrt(t*t+e*e+r*r),i[n]*=t,i[n+1]*=t,i[n+2]*=t},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new m.BufferGeometry,r=this.index.array,i=this.attributes;for(t in i){for(var n=(o=i[t]).array,o=o.itemSize,a=new n.constructor(r.length*o),s=0,h=0,c=0,l=r.length;c<l;c++)for(var s=r[c]*o,u=0;u<o;u++)a[h++]=n[s++];e.addAttribute(t,new m.BufferAttribute(a,o))}return e},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(r=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:r}),i=this.attributes;for(e in i){var n=i[e],r=Array.prototype.slice.call(n.array);t.data.attributes[e]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new m.BufferGeometry).copy(this)},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.BufferGeometry.prototype),m.BufferGeometry.MaxIndex=65535,m.InstancedBufferGeometry=function(){m.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},m.InstancedBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.InstancedBufferGeometry.prototype.constructor=m.InstancedBufferGeometry,m.InstancedBufferGeometry.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,instances:r})},m.InstancedBufferGeometry.prototype.copy=function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count,i.instances)}return this},m.EventDispatcher.prototype.apply(m.InstancedBufferGeometry.prototype),m.Uniform=function(t,e){this.type=t,this.value=e,this.dynamic=!1},m.Uniform.prototype={constructor:m.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},m.AnimationClip=function(t,e,r){this.name=t||m.Math.generateUUID(),this.tracks=r,this.duration=void 0!==e?e:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},m.AnimationClip.prototype={constructor:m.AnimationClip,resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e)var i=this.tracks[e],t=Math.max(t,i.times[i.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(m.AnimationClip,{parse:function(t){for(var e=[],r=t.tracks,i=1/(t.fps||1),n=0,o=r.length;n!==o;++n)e.push(m.KeyframeTrack.parse(r[n]).scale(i));return new m.AnimationClip(t.name,t.duration,e)},toJSON:function(t){var e=[],r=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var i=0,n=r.length;i!==n;++i)e.push(m.KeyframeTrack.toJSON(r[i]));return t},CreateFromMorphTargetSequence:function(t,e,r){for(var i=e.length,n=[],o=0;o<i;o++){h=[],(s=[]).push((o+i-1)%i,o,(o+1)%i),h.push(0,1,0);var a=m.AnimationUtils.getKeyframeOrder(s),s=m.AnimationUtils.sortedArray(s,1,a),h=m.AnimationUtils.sortedArray(h,1,a);0===s[0]&&(s.push(i),h.push(h[0])),n.push(new m.NumberKeyframeTrack(".morphTargetInfluences["+e[o].name+"]",s,h).scale(1/r))}return new m.AnimationClip(t,-1,n)},findByName:function(t,e){for(var r=0;r<t.length;r++)if(t[r].name===e)return t[r];return null},CreateClipsFromMorphTargetSequences:function(t,e){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=t.length;n<o;n++){var a=t[n],s=a.name.match(i);if(s&&1<s.length){var h=s[1];(s=r[h])||(r[h]=s=[]),s.push(a)}}i=[];for(h in r)i.push(m.AnimationClip.CreateFromMorphTargetSequence(h,r[h],e));return i},parseAnimation:function(t,e,r){if(!t)return console.error("  no animation in JSONLoader data"),null;r=function(t,e,r,i,n){if(0!==r.length){var o=[],a=[];m.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new t(e,o,a))}};var i=[],n=t.name||"default",o=t.length||-1,a=t.fps||30;t=t.hierarchy||[];for(var s=0;s<t.length;s++){var h=t[s].keys;if(h&&0!=h.length)if(h[0].morphTargets){for(var o={},c=0;c<h.length;c++)if(h[c].morphTargets)for(d=0;d<h[c].morphTargets.length;d++)o[h[c].morphTargets[d]]=-1;for(var l in o){for(var u=[],p=[],d=0;d!==h[c].morphTargets.length;++d){var f=h[c];u.push(f.time),p.push(f.morphTarget===l?1:0)}i.push(new m.NumberKeyframeTrack(".morphTargetInfluence["+l+"]",u,p))}o=o.length*(a||1)}else c=".bones["+e[s].name+"]",r(m.VectorKeyframeTrack,c+".position",h,"pos",i),r(m.QuaternionKeyframeTrack,c+".quaternion",h,"rot",i),r(m.VectorKeyframeTrack,c+".scale",h,"scl",i)}return 0===i.length?null:new m.AnimationClip(n,o,i)}}),m.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},m.AnimationMixer.prototype={constructor:m.AnimationMixer,clipAction:function(t,e){var r,i=(e||this._root).uuid,n="string"==typeof t?t:t.name,o=t!==n?t:null,a=this._actionsByClip[n];if(void 0!==a){if(void 0!==(r=a.actionByRoot[i]))return r;if(r=a.knownActions[0],o=r._clip,t!==n&&t!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new m.AnimationMixer._Action(this,o,e),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(t,e){var r=(e||this._root).uuid,i=this._actionsByClip["string"==typeof t?t:t.name];return void 0!==i?i.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==e;++n)t[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,i=this.time+=t,n=Math.sign(t),o=this._accuIndex^=1,a=0;a!==r;++a){var s=e[a];s.enabled&&s._update(i,t,n,o)}for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.name;var r=this._actionsByClip,i=r[t];if(void 0!==i){for(var n=0,o=(i=i.knownActions).length;n!==o;++n){var a=i[n];this._deactivateAction(a);var s=a._cacheIndex,h=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,h._cacheIndex=s,e[s]=h,e.pop(),this._removeInactiveBindingsForAction(a)}delete r[t]}},uncacheRoot:function(t){t=t.uuid;var e,r=this._actionsByClip;for(e in r){var i=r[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(void 0!==(e=this._bindingsByRootAndName[t]))for(var n in e)(t=e[n]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},m.EventDispatcher.prototype.apply(m.AnimationMixer.prototype),m.AnimationMixer._Action=function(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var i={endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},n=0;n!==e;++n){var o=t[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=m.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0},m.AnimationMixer._Action.prototype={constructor:m.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){r=this._clip.duration;var i=t._clip.duration,n=r/i;t.warp(1,i/r,e),this.warp(n,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._currentTimeScale,0,t)},warp:function(t,e,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,i[1]=n+r,o[0]=t/a,o[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,i){if(null!==(n=this._startTime)){if(0>(e=(t-n)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var n=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),n[o].accumulate(i,t)}},_updateWeight:function(t){if(e=0,this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(t)[0],e=e*i;t>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){if(e=0,!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;null!==r&&(e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.pause=!0:this.timeScale=e))}return this._effectiveTimeScale=e},_updateTime:function(t){if(a=this.time+t,0===t)return a;var e=this._clip.duration,r=this.loop,i=this._loopCount,n=!1;switch(r){case m.LoopOnce:if(-1===i&&(this.loopCount=0,this._setEndings(!0,!0,!1)),a>=e)a=e;else{if(!(0>a))break;a=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1});break;case m.LoopPingPong:n=!0;case m.LoopRepeat:if(-1===i&&(0<t?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),a>=e||0>a){var o=Math.floor(a/e),a=a-e*o,i=i+Math.abs(o),s=this.repetitions-i;if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=0<t?e:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});break}0===s?(t=0>t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}if(r===m.LoopPingPong&&1==(1&i))return this.time=a,e-a}return this.time=a},_setEndings:function(t,e,r){var i=this._interpolantSettings;r?(i.endingStart=m.ZeroSlopeEnding,i.endingEnd=m.ZeroSlopeEnding):(i.endingStart=t?this.zeroSlopeAtStart?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding,i.endingEnd=e?this.zeroSlopeAtEnd?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding)},_scheduleFading:function(t,e,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,o[0]=e,i[1]=n+t,o[1]=r,this}},Object.assign(m.AnimationMixer.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,i=t._clip.tracks,n=i.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,h=this._bindingsByRootAndName,c=h[s];for(void 0===c&&(c={},h[s]=c),h=0;h!==n;++h){var l=i[h],u=l.name,p=c[u];if(void 0===p){if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,u));continue}++(p=new m.PropertyMixer(m.PropertyBinding.create(r,u,e&&e._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,u)}o[h]=p,a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.name,i=this._actionsByClip[r];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,i=(e=t._propertyBindings).length;r!==i;++r){var n=e[r];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,i=e.length;r!==i;++r){var n=e[r];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,r){var i=this._actions,n=this._actionsByClip,o=n[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,n[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=i.length,i.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],i=t._cacheIndex;r._cacheIndex=i,e[i]=r,e.pop(),t._cacheIndex=null;var r=t._clip.name,n=(i=this._actionsByClip)[r],o=n.knownActions,a=o[o.length-1],s=t._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),t._byClipCacheIndex=null,delete n.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,r=(t=t._propertyBindings).length;e!==r;++e){var i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,i=this._nActiveActions++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,i=--this._nActiveActions,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_addInactiveBinding:function(t,e,r){var i=this._bindingsByRootAndName,n=i[e],o=this._bindings;void 0===n&&(n={},i[e]=n),n[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=(i=t.binding).rootNode.uuid,i=i.path,n=this._bindingsByRootAndName,o=n[r],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[i];t:{for(var s in o)break t;delete n[r]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=this._nActiveBindings++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=--this._nActiveBindings,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new m.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];t.__cacheIndex=i,e[i]=t,n.__cacheIndex=r,e[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),m.AnimationObjectGroup=function(t){this.uuid=m.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},m.AnimationObjectGroup.prototype={constructor:m.AnimationObjectGroup,add:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,h=s.length,c=0,l=arguments.length;c!==l;++c){var u=arguments[c],p=n[d=u.uuid];if(void 0===p){p=r++,n[d]=p,e.push(u);for(var d=0,f=h;d!==f;++d)s[d].push(new m.PropertyBinding(u,o[d],a[d]))}else if(p<i){var g=e[p],v=--i;for(n[(f=e[v]).uuid]=p,e[p]=f,n[d]=v,e[v]=u,d=0,f=h;d!==f;++d){var y=s[d],x=y[p];y[p]=y[v],void 0===x&&(x=new m.PropertyBinding(u,o[d],a[d])),y[v]=x}}else e[p]!==g&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],c=h.uuid,l=i[c];if(void 0!==l&&l>=r){var u=r++,p=e[u];for(i[p.uuid]=l,e[l]=p,i[c]=u,e[u]=h,h=0,c=o;h!==c;++h){var d=(p=n[h])[l];p[l]=p[u],p[u]=d}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,h=arguments.length;s!==h;++s){var c=arguments[s].uuid,l=n[c];if(void 0!==l)if(delete n[c],l<i){var u=e[c=--i],p=--r,d=e[p];for(n[u.uuid]=l,e[l]=u,n[d.uuid]=c,e[c]=d,e.pop(),u=0,d=a;u!==d;++u){var f=o[u],m=f[p];f[l]=f[c],f[c]=m,f.pop()}}else for(p=--r,d=e[p],n[d.uuid]=l,e[l]=d,e.pop(),u=0,d=a;u!==d;++u)f=o[u],f[l]=f[p],f.pop()}this.nCachedObjects_=i},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,i=r[t],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,h=this.nCachedObjects_,c=Array(s.length),i=n.length;for(r[t]=i,o.push(t),a.push(e),n.push(c),r=h,i=s.length;r!==i;++r)c[r]=new m.PropertyBinding(s[r],t,e);return c},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},m.AnimationUtils={arraySlice:function(t,e,r){return m.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,r)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,r=Array(e),i=0;i!==e;++i)r[i]=i;return r.sort(function(e,r){return t[e]-t[r]}),r},sortedArray:function(t,e,r){for(var i=t.length,n=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*e,h=0;h!==e;++h)n[a++]=t[s+h];return n},flattenJSON:function(t,e,r,i){for(var n=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),r.push.apply(r,a)),o=t[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(r,r.length)),o=t[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),r.push(a)),o=t[n++]}while(void 0!==o)}}},m.KeyframeTrack=function(t,e,r,i){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keyframes in track named "+t);this.name=t,this.times=m.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=m.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},m.KeyframeTrack.prototype={constructor:m.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new m.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new m.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new m.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e=void 0;switch(t){case m.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case m.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case m.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn(e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return m.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return m.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return m.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<t;)++n;for(;-1!==o&&r[o]>e;)--o;return++o,0===n&&o===i||(n>=o&&(o=Math.max(o,1),n=o-1),i=this.getValueSize(),this.times=m.AnimationUtils.arraySlice(r,n,o),this.values=m.AnimationUtils.arraySlice(this.values,n*i,o*i)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("invalid value size in track",this),t=!1);var e=this.times,r=this.values,i=e.length;0===i&&(console.error("track is empty",this),t=!1);for(var n=null,o=0;o!==i;o++){var a=e[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),t=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),t=!1;break}n=a}if(void 0!==r&&m.AnimationUtils.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(i=r[o],isNaN(i)){console.error("value is not a valid number",this,o,i),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),i=1,n=1,o=t.length-1;n<=o;++n){var a=!1;if((l=t[n])!==t[n+1]&&(1!==n||l!==l[0]))for(var s=n*r,h=s-r,c=s+r,l=0;l!==r;++l){var u=e[s+l];if(u!==e[h+l]||u!==e[c+l]){a=!0;break}}if(a){if(n!==i)for(t[i]=t[n],a=n*r,s=i*r,l=0;l!==r;++l)e[s+l]=e[a+l];++i}}return i!==t.length&&(this.times=m.AnimationUtils.arraySlice(t,0,i),this.values=m.AnimationUtils.arraySlice(e,0,i*r)),this}},Object.assign(m.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=m.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];m.AnimationUtils.flattenJSON(t.keys,r,i,"value"),t.times=r,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){if(void 0!==(e=t.constructor).toJSON)e=e.toJSON(t);else{var e={name:t.name,times:m.AnimationUtils.convertArray(t.times,Array),values:m.AnimationUtils.convertArray(t.values,Array)},r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return m.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return m.VectorKeyframeTrack;case"color":return m.ColorKeyframeTrack;case"quaternion":return m.QuaternionKeyframeTrack;case"bool":case"boolean":return m.BooleanKeyframeTrack;case"string":return m.StringKeyframeTrack}throw Error("Unsupported typeName: "+t)}}),m.PropertyBinding=function(t,e,r){this.path=e,this.parsedPath=r||m.PropertyBinding.parseTrackName(e),this.node=m.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},m.PropertyBinding.prototype={constructor:m.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(this.node=t=m.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("  can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);for(t=t.skeleton.bones,r=0;r<t.length;r++)if(t[r].name===o){o=r;break}break;default:if(void 0===t[r])return void console.error("  can not bind to objectName of node, undefined",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}if(o=t[i]){if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(t.geometry.morphTargets[r].name===n){n=r;break}}r=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][e]}else console.error("  trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(m.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:m.PropertyBinding.prototype.getValue,_setValue_unbound:m.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)t[e++]=r[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),m.PropertyBinding.Composite=function(t,e,r){r=r||m.PropertyBinding.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)},m.PropertyBinding.Composite.prototype={constructor:m.PropertyBinding.Composite,getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}},m.PropertyBinding.create=function(t,e,r){return t instanceof m.AnimationObjectGroup?new m.PropertyBinding.Composite(t,e,r):new m.PropertyBinding(t,e,r)},m.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=e.exec(t);if(!r)throw Error("cannot parse trackName at all: "+t);if(r.index===e.lastIndex&&e.lastIndex++,null===(e={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},m.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var i=t.bones[r];if(i.name===e)return i}return null}(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var r=0;r<t.length;r++){var n=t[r];if(n.name===e||n.uuid===e||(n=i(n.children)))return n}return null};if(r=i(t.children))return r}return null},m.PropertyMixer=function(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0},m.PropertyMixer.prototype={constructor:m.PropertyMixer,accumulate:function(t,e){var r=this.buffer,i=this.valueSize,n=t*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=e}else o+=e,this._mixBufferRegion(r,n,0,e/o,i);this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer;t=t*e+e;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,t,3*e,1-i,e);for(var i=e,o=e+e;i!==o;++i)if(r[i]!==r[i+e]){n.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var i=e;i!==r;++i)t[i]=t[r+i%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,i,n){if(.5<=i)for(i=0;i!==n;++i)t[e+i]=t[r+i]},_slerp:function(t,e,r,i,n){m.Quaternion.slerpFlat(t,e,t,e,t,r,i)},_lerp:function(t,e,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*i}}},m.BooleanKeyframeTrack=function(t,e,r){m.KeyframeTrack.call(this,t,e,r)},m.BooleanKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.NumberKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.NumberKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.NumberKeyframeTrack,ValueTypeName:"number"}),m.QuaternionKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new m.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),m.StringKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.StringKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.VectorKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.VectorKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.VectorKeyframeTrack,ValueTypeName:"vector"}),m.Audio=function(t){m.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},m.Audio.prototype=Object.create(m.Object3D.prototype),m.Audio.prototype.constructor=m.Audio,m.Audio.prototype.getOutput=function(){return this.gain},m.Audio.prototype.load=function(t){var e=new m.AudioBuffer(this.context);return e.load(t),this.setBuffer(e),this},m.Audio.prototype.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},m.Audio.prototype.setBuffer=function(t){var e=this;return t.onReady(function(t){e.source.buffer=t,e.sourceType="buffer",e.autoplay&&e.play()}),this},m.Audio.prototype.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 t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}},m.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},m.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},m.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},m.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},m.Audio.prototype.getFilter=function(){return this.filter},m.Audio.prototype.setFilter=function(t){void 0===t&&(t=null),!0===this.isPlaying?(this.disconnect(),this.filter=t,this.connect()):this.filter=t},m.Audio.prototype.setPlaybackRate=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},m.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},m.Audio.prototype.onEnded=function(){this.isPlaying=!1},m.Audio.prototype.setLoop=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=t},m.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},m.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},m.Audio.prototype.getVolume=function(){return this.gain.gain.value},m.AudioAnalyser=function(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},m.AudioAnalyser.prototype={constructor:m.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},m.AudioBuffer=function(t){this.context=t,this.ready=!1,this.readyCallbacks=[]},m.AudioBuffer.prototype.load=function(t){var e=this,r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(t){e.context.decodeAudioData(this.response,function(t){for(e.buffer=t,e.ready=!0,t=0;t<e.readyCallbacks.length;t++)e.readyCallbacks[t](e.buffer);e.readyCallbacks=[]})},r.send(),this},m.AudioBuffer.prototype.onReady=function(t){this.ready?t(this.buffer):this.readyCallbacks.push(t)},m.PositionalAudio=function(t){m.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},m.PositionalAudio.prototype=Object.create(m.Audio.prototype),m.PositionalAudio.prototype.constructor=m.PositionalAudio,m.PositionalAudio.prototype.getOutput=function(){return this.panner},m.PositionalAudio.prototype.setRefDistance=function(t){this.panner.refDistance=t},m.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},m.PositionalAudio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},m.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},m.PositionalAudio.prototype.setDistanceModel=function(t){this.panner.distanceModel=t},m.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},m.PositionalAudio.prototype.setMaxDistance=function(t){this.panner.maxDistance=t},m.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},m.PositionalAudio.prototype.updateMatrixWorld=function(){var t=new m.Vector3;return function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}(),m.AudioListener=function(){m.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},m.AudioListener.prototype=Object.create(m.Object3D.prototype),m.AudioListener.prototype.constructor=m.AudioListener,m.AudioListener.prototype.getInput=function(){return this.gain},m.AudioListener.prototype.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)},m.AudioListener.prototype.setFilter=function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},m.AudioListener.prototype.getFilter=function(){return this.filter},m.AudioListener.prototype.setMasterVolume=function(t){this.gain.gain.value=t},m.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},m.AudioListener.prototype.updateMatrixWorld=function(){var t=new m.Vector3,e=new m.Quaternion,r=new m.Vector3,i=new m.Vector3;return function(n){m.Object3D.prototype.updateMatrixWorld.call(this,n),n=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,r),i.set(0,0,-1).applyQuaternion(e),n.setPosition(t.x,t.y,t.z),n.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z)}}(),m.Camera=function(){m.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new m.Matrix4,this.projectionMatrix=new m.Matrix4},m.Camera.prototype=Object.create(m.Object3D.prototype),m.Camera.prototype.constructor=m.Camera,m.Camera.prototype.getWorldDirection=function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),m.Camera.prototype.lookAt=function(){var t=new m.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),m.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},m.Camera.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},m.CubeCamera=function(t,e,r){m.Object3D.call(this),this.type="CubeCamera";var i=new m.PerspectiveCamera(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new m.Vector3(1,0,0)),this.add(i);var n=new m.PerspectiveCamera(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new m.Vector3(-1,0,0)),this.add(n);var o=new m.PerspectiveCamera(90,1,t,e);o.up.set(0,0,1),o.lookAt(new m.Vector3(0,1,0)),this.add(o);var a=new m.PerspectiveCamera(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new m.Vector3(0,-1,0)),this.add(a);var s=new m.PerspectiveCamera(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new m.Vector3(0,0,1)),this.add(s);var h=new m.PerspectiveCamera(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new m.Vector3(0,0,-1)),this.add(h),this.renderTarget=new m.WebGLRenderTargetCube(r,r,{format:m.RGBFormat,magFilter:m.LinearFilter,minFilter:m.LinearFilter}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,i,r),r.activeCubeFace=1,t.render(e,n,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}},m.CubeCamera.prototype=Object.create(m.Object3D.prototype),m.CubeCamera.prototype.constructor=m.CubeCamera,m.OrthographicCamera=function(t,e,r,i,n,o){m.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},m.OrthographicCamera.prototype=Object.create(m.Camera.prototype),m.OrthographicCamera.prototype.constructor=m.OrthographicCamera,m.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-t,r+t,i+e,i-e,this.near,this.far)},m.OrthographicCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},m.OrthographicCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},m.PerspectiveCamera=function(t,e,r,i){m.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype=Object.create(m.Camera.prototype),m.PerspectiveCamera.prototype.constructor=m.PerspectiveCamera,m.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*m.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,o){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=m.Math.radToDeg(2*Math.atan(Math.tan(.5*m.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=(r=this.fullWidth/this.fullHeight)*(i=-(t=Math.tan(m.Math.degToRad(.5*t))*this.near)),r=Math.abs(r*t-e),i=Math.abs(t-i);this.projectionMatrix.makeFrustum(e+this.x*r/this.fullWidth,e+(this.x+this.width)*r/this.fullWidth,t-(this.y+this.height)*i/this.fullHeight,t-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},m.PerspectiveCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.focalLength=t.focalLength,this.zoom=t.zoom,this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this},m.PerspectiveCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},m.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new m.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new m.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},m.StereoCamera.prototype={constructor:m.StereoCamera,update:function(){var t,e,r,i,n,o=new m.Matrix4,a=new m.Matrix4;return function(s){if(t!==s.focalLength||e!==s.fov||r!==s.aspect*this.aspect||i!==s.near||n!==s.far){t=s.focalLength,e=s.fov,r=s.aspect*this.aspect,i=s.near,n=s.far;var h,c,l=s.projectionMatrix.clone(),u=.032*i/t,p=i*Math.tan(m.Math.degToRad(.5*e));a.elements[12]=-.032,o.elements[12]=.032,h=-p*r+u,c=p*r+u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraL.projectionMatrix.copy(l),h=-p*r-u,c=p*r-u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(s.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(s.matrixWorld).multiply(o)}}()},m.Light=function(t,e){m.Object3D.call(this),this.type="Light",this.color=new m.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},m.Light.prototype=Object.create(m.Object3D.prototype),m.Light.prototype.constructor=m.Light,m.Light.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},m.Light.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.exponent&&(t.object.exponent=this.exponent),t},m.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new m.Vector2(512,512),this.map=null,this.matrix=new m.Matrix4},m.LightShadow.prototype={constructor:m.LightShadow,copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},m.AmbientLight=function(t,e){m.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},m.AmbientLight.prototype=Object.create(m.Light.prototype),m.AmbientLight.prototype.constructor=m.AmbientLight,m.DirectionalLight=function(t,e){m.Light.call(this,t,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.shadow=new m.LightShadow(new m.OrthographicCamera(-5,5,5,-5,.5,500))},m.DirectionalLight.prototype=Object.create(m.Light.prototype),m.DirectionalLight.prototype.constructor=m.DirectionalLight,m.DirectionalLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.HemisphereLight=function(t,e,r){m.Light.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new m.Color(e)},m.HemisphereLight.prototype=Object.create(m.Light.prototype),m.HemisphereLight.prototype.constructor=m.HemisphereLight,m.HemisphereLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this},m.PointLight=function(t,e,r,i){m.Light.call(this,t,e),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(90,1,.5,500))},m.PointLight.prototype=Object.create(m.Light.prototype),m.PointLight.prototype.constructor=m.PointLight,m.PointLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this},m.SpotLight=function(t,e,r,i,n,o){m.Light.call(this,t,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==o?o:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(50,1,.5,500))},m.SpotLight.prototype=Object.create(m.Light.prototype),m.SpotLight.prototype.constructor=m.SpotLight,m.SpotLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.exponent=t.exponent,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.Cache={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},m.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},m.Loader.prototype={constructor:m.Loader,crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var i=[],n=0;n<t.length;++n)i[n]=this.createMaterial(t[n],e,r);return i},createMaterial:function(){var t,e,r;return function(i,n,o){function a(t,r,i,a,s){t=n+t;var c=m.Loader.Handlers.get(t);return null!==c?t=c.load(t):(e.setCrossOrigin(o),t=e.load(t)),void 0!==r&&(t.repeat.fromArray(r),1!==r[0]&&(t.wrapS=m.RepeatWrapping),1!==r[1]&&(t.wrapT=m.RepeatWrapping)),void 0!==i&&t.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(t.wrapS=m.RepeatWrapping),"mirror"===a[0]&&(t.wrapS=m.MirroredRepeatWrapping),"repeat"===a[1]&&(t.wrapT=m.RepeatWrapping),"mirror"===a[1]&&(t.wrapT=m.MirroredRepeatWrapping)),void 0!==s&&(t.anisotropy=s),r=m.Math.generateUUID(),h[r]=t,r}void 0===t&&(t=new m.Color),void 0===e&&(e=new m.TextureLoader),void 0===r&&(r=new m.MaterialLoader);var s,h={},c={uuid:m.Math.generateUUID(),type:"MeshLambertMaterial"};for(s in i){var l=i[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=l;break;case"blending":c.blending=m[l];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":c.color=t.fromArray(l).getHex();break;case"colorSpecular":c.specular=t.fromArray(l).getHex();break;case"colorEmissive":c.emissive=t.fromArray(l).getHex();break;case"specularCoef":c.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(c.type="MeshPhongMaterial");break;case"mapDiffuse":c.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":c.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":c.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=m.BackSide;break;case"doubleSided":c.side=m.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[s]=l;break;case"vertexColors":!0===l&&(c.vertexColors=m.VertexColors),"face"===l&&(c.vertexColors=m.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,l)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,1>c.opacity&&(c.transparent=!0),r.setTextures(h),r.parse(c)}}()},m.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r+1];if(e[r].test(t))return n}return null}},m.XHRLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.XHRLoader.prototype={constructor:m.XHRLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return e&&setTimeout(function(){e(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",t,!0),a.addEventListener("load",function(r){var o=r.target.response;m.Cache.add(t,o),200===this.status?(e&&e(o),n.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),n.manager.itemEnd(t)):(i&&i(r),n.manager.itemError(t))},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(t),a},setPath:function(t){this.path=t},setResponseType:function(t){this.responseType=t},setWithCredentials:function(t){this.withCredentials=t}},m.FontLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.FontLoader.prototype={constructor:m.FontLoader,load:function(t,e,r,i){new m.XHRLoader(this.manager).load(t,function(t){e(new m.Font(JSON.parse(t.substring(65,t.length-2))))},r,i)}},m.ImageLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.ImageLoader.prototype={constructor:m.ImageLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return n.manager.itemStart(t),e?setTimeout(function(){e(o),n.manager.itemEnd(t)},0):n.manager.itemEnd(t),o;var a=document.createElement("img");return a.addEventListener("load",function(r){m.Cache.add(t,this),e&&e(this),n.manager.itemEnd(t)},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:m.DefaultLoadingManager,this.withCredentials=!1},m.JSONLoader.prototype={constructor:m.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(t,e,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:m.Loader.prototype.extractUrlBase(t),a=new m.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var i=(r=JSON.parse(r)).metadata;if(void 0!==i&&void 0!==(i=i.type)){if("object"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),e(r.geometry,r.materials)},r,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){var r=new m.Geometry,i=void 0!==t.scale?1/t.scale:1;return function(e){var i,n,o,a,s,h,c,l,u,p,d,f,g,v=t.faces;h=t.vertices;var y=t.normals,x=t.colors,b=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&b++;for(i=0;i<b;i++)r.faceVertexUvs[i]=[]}for(a=0,s=h.length;a<s;)i=new m.Vector3,i.x=h[a++]*e,i.y=h[a++]*e,i.z=h[a++]*e,r.vertices.push(i);for(a=0,s=v.length;a<s;)if(e=v[a++],u=1&e,o=2&e,i=8&e,c=16&e,p=32&e,h=64&e,e&=128,u){if(u=new m.Face3,u.a=v[a],u.b=v[a+1],u.c=v[a+3],d=new m.Face3,d.a=v[a+1],d.b=v[a+2],d.c=v[a+3],a+=4,o&&(o=v[a++],u.materialIndex=o,d.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),2!==n&&r.faceVertexUvs[i][o].push(g),0!==n&&r.faceVertexUvs[i][o+1].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c]),d.normal.copy(u.normal)),p)for(i=0;4>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),2!==i&&u.vertexNormals.push(p),0!==i&&d.vertexNormals.push(p);if(h&&(h=v[a++],h=x[h],u.color.setHex(h),d.color.setHex(h)),e)for(i=0;4>i;i++)h=v[a++],h=x[h],2!==i&&u.vertexColors.push(new m.Color(h)),0!==i&&d.vertexColors.push(new m.Color(h));r.faces.push(u),r.faces.push(d)}else{if(u=new m.Face3,u.a=v[a++],u.b=v[a++],u.c=v[a++],o&&(o=v[a++],u.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),r.faceVertexUvs[i][o].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c])),p)for(i=0;3>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),u.vertexNormals.push(p);if(h&&(h=v[a++],u.color.setHex(x[h])),e)for(i=0;3>i;i++)h=v[a++],u.vertexColors.push(new m.Color(x[h]));r.faces.push(u)}}(i),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e)r.skinWeights.push(new m.Vector4(t.skinWeights[i],1<e?t.skinWeights[i+1]:0,2<e?t.skinWeights[i+2]:0,3<e?t.skinWeights[i+3]:0));if(t.skinIndices)for(i=0,n=t.skinIndices.length;i<n;i+=e)r.skinIndices.push(new m.Vector4(t.skinIndices[i],1<e?t.skinIndices[i+1]:0,2<e?t.skinIndices[i+2]:0,3<e?t.skinIndices[i+3]:0));r.bones=t.bones,r.bones&&0<r.bones.length&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){r.morphTargets[i]={},r.morphTargets[i].name=t.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,h=a.length;s<h;s+=3){var c=new m.Vector3;c.x=a[s]*e,c.y=a[s+1]*e,c.z=a[s+2]*e,o.push(c)}}if(void 0!==t.morphColors&&0<t.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),e=r.faces,o=t.morphColors[0].colors,i=0,n=e.length;i<n;i++)e[i].color.fromArray(o,3*i)}(i),function(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var o=m.AnimationClip.parseAnimation(i[n],r.bones);o&&e.push(o)}r.morphTargets&&(i=m.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),e=e.concat(i)),0<e.length&&(r.animations=e)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:r}:(i=m.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:r,materials:i})}},m.LoadingManager=function(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}},m.DefaultLoadingManager=new m.LoadingManager,m.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.BufferGeometryLoader.prototype={constructor:m.BufferGeometryLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},parse:function(t){var e=new m.BufferGeometry,r=t.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new i[r.type](r.array),e.setIndex(new m.BufferAttribute(r,1)));var n,o=t.data.attributes;for(n in o){var a=o[n],r=new i[a.type](a.array);e.addAttribute(n,new m.BufferAttribute(r,a.itemSize))}if(void 0!==(i=t.data.groups||t.data.drawcalls||t.data.offsets))for(n=0,r=i.length;n!==r;++n)o=i[n],e.addGroup(o.start,o.count,o.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(i=new m.Vector3,void 0!==t.center&&i.fromArray(t.center),e.boundingSphere=new m.Sphere(i,t.radius)),e}},m.MaterialLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.textures={}},m.MaterialLoader.prototype={constructor:m.MaterialLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new m[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale&&(r=t.normalScale,!1===Array.isArray(r)&&(r=[r,r]),e.normalScale=(new m.Vector2).fromArray(r)),void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=m.MultiplyOperation),t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}},m.ObjectLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.texturePath=""},m.ObjectLoader.prototype={constructor:m.ObjectLoader,load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new m.XHRLoader(n.manager).load(t,function(t){n.parse(JSON.parse(t),e)},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(n)}),i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),n=this.parseObject(t.object,r,i);return t.animations&&(n.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(n),n},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new m.JSONLoader,i=new m.BufferGeometryLoader,n=0,o=t.length;n<o;n++){var a,s=t[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new m[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new m.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new m.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new m.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new m.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new m.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new m.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new m.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new m.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new m.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new m.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new m.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new m.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new m.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"LatheGeometry":a=new m.LatheGeometry(s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new m.MaterialLoader;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=i.parse(t[n]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=m.AnimationClip.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&0<t.length){var n=new m.LoadingManager(e),o=new m.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);for(var n=0,a=t.length;n<a;n++){var s=t[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})}(h)}}return i},parseTextures:function(t,e){function r(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),m[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new m.Texture(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new m.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new m.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var t=new m.Matrix4;return function(e,r,i){function n(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t)return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}var a;switch(e.type){case"Scene":a=new m.Scene;break;case"PerspectiveCamera":a=new m.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":a=new m.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new m.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new m.DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new m.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new m.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":a=new m.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":a=n(e.geometry);var s=o(e.material);a=a.bones&&0<a.bones.length?new m.SkinnedMesh(a,s):new m.Mesh(a,s);break;case"LOD":a=new m.LOD;break;case"Line":a=new m.Line(n(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":a=new m.Points(n(e.geometry),o(e.material));break;case"Sprite":a=new m.Sprite(o(e.material));break;case"Group":a=new m.Group;break;default:a=new m.Object3D}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(this.parseObject(e.children[h],r,i));if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){var c=e[s];void 0!==(h=a.getObjectByProperty("uuid",c.object))&&a.addLevel(h,c.distance)}return a}}()},m.TextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.TextureLoader.prototype={constructor:m.TextureLoader,load:function(t,e,r,i){var n=new m.Texture,o=new m.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){n.image=t,n.needsUpdate=!0,void 0!==e&&e(n)},r,i),n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.CubeTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.CubeTextureLoader.prototype={constructor:m.CubeTextureLoader,load:function(t,e,r,i){var n=new m.CubeTexture([]),o=new m.ImageLoader(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;for(r=0;r<t.length;++r)!function(r){o.load(t[r],function(t){n.images[r]=t,6==++a&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}(r);return n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.DataTextureLoader=m.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.BinaryTextureLoader.prototype={constructor:m.BinaryTextureLoader,load:function(t,e,r,i){var n=this,o=new m.DataTexture,a=new m.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){(t=n._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:m.ClampToEdgeWrapping,o.wrapT=void 0!==t.wrapT?t.wrapT:m.ClampToEdgeWrapping,o.magFilter=void 0!==t.magFilter?t.magFilter:m.LinearFilter,o.minFilter=void 0!==t.minFilter?t.minFilter:m.LinearMipMapLinearFilter,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=m.LinearFilter),o.needsUpdate=!0,e&&e(o,t))},r,i),o}},m.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.CompressedTextureLoader.prototype={constructor:m.CompressedTextureLoader,load:function(t,e,r,i){var n=this,o=[],a=new m.CompressedTexture;a.image=o;var s=new m.XHRLoader(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,c=0,l=t.length;c<l;++c)!function(c){s.load(t[c],function(t){t=n._parser(t,!0),o[c]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(h+=1)&&(1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a))},r,i)}(c);else s.load(t,function(t){if((t=n._parser(t,!0)).isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,i=0;i<r;i++){o[i]={mipmaps:[]};for(var s=0;s<t.mipmapCount;s++)o[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+s]),o[i].format=t.format,o[i].width=t.width,o[i].height=t.height}else a.image.width=t.width,a.image.height=t.height,a.mipmaps=t.mipmaps;1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a)},r,i);return a},setPath:function(t){this.path=t}},m.Material=function(){Object.defineProperty(this,"id",{value:m.MaterialIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Material",this.side=m.FrontSide,this.opacity=1,this.transparent=!1,this.blending=m.NormalBlending,this.blendSrc=m.SrcAlphaFactor,this.blendDst=m.OneMinusSrcAlphaFactor,this.blendEquation=m.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=m.LessEqualDepth,this.colorWrite=this.depthWrite=this.depthTest=!0,this.precision=null,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this._needsUpdate=this.visible=!0},m.Material.prototype={constructor:m.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var i=this[e];void 0===i?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):i instanceof m.Color?i.set(r):i instanceof m.Vector3&&r instanceof m.Vector3?i.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof m.Color&&(i.color=this.color.getHex()),.5!==this.roughness&&(i.roughness=this.roughness),.5!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof m.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof m.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof m.Texture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap instanceof m.Texture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof m.Texture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof m.Texture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof m.Texture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof m.Texture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof m.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof m.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof m.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof m.Texture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof m.Texture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==m.NoColors&&(i.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==m.SmoothShading&&(i.shading=this.shading),void 0!==this.blending&&this.blending!==m.NormalBlending&&(i.blending=this.blending),void 0!==this.side&&this.side!==m.FrontSide&&(i.side=this.side),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),r&&(r=e(t.textures),t=e(t.images),0<r.length&&(i.textures=r),0<t.length&&(i.images=t)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.side=t.side,this.opacity=t.opacity,this.transparent=t.transparent,this.blending=t.blending,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.overdraw=t.overdraw,this.visible=t.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Material.prototype),m.MaterialIdCount=0,m.LineBasicMaterial=function(t){m.Material.call(this),this.type="LineBasicMaterial",this.color=new m.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineBasicMaterial.prototype=Object.create(m.Material.prototype),m.LineBasicMaterial.prototype.constructor=m.LineBasicMaterial,m.LineBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.LineDashedMaterial=function(t){m.Material.call(this),this.type="LineDashedMaterial",this.color=new m.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineDashedMaterial.prototype=Object.create(m.Material.prototype),m.LineDashedMaterial.prototype.constructor=m.LineDashedMaterial,m.LineDashedMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.MeshBasicMaterial=function(t){m.Material.call(this),this.type="MeshBasicMaterial",this.color=new m.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshBasicMaterial.prototype=Object.create(m.Material.prototype),m.MeshBasicMaterial.prototype.constructor=m.MeshBasicMaterial,m.MeshBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},m.MeshLambertMaterial=function(t){m.Material.call(this),this.type="MeshLambertMaterial",this.color=new m.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshLambertMaterial.prototype=Object.create(m.Material.prototype),m.MeshLambertMaterial.prototype.constructor=m.MeshLambertMaterial,m.MeshLambertMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshPhongMaterial=function(t){m.Material.call(this),this.type="MeshPhongMaterial",this.color=new m.Color(16777215),this.specular=new m.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshPhongMaterial.prototype=Object.create(m.Material.prototype),m.MeshPhongMaterial.prototype.constructor=m.MeshPhongMaterial,m.MeshPhongMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshStandardMaterial=function(t){m.Material.call(this),this.type="MeshStandardMaterial",this.color=new m.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshStandardMaterial.prototype=Object.create(m.Material.prototype),m.MeshStandardMaterial.prototype.constructor=m.MeshStandardMaterial,m.MeshStandardMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshDepthMaterial=function(t){m.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(t)},m.MeshDepthMaterial.prototype=Object.create(m.Material.prototype),m.MeshDepthMaterial.prototype.constructor=m.MeshDepthMaterial,m.MeshDepthMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MeshNormalMaterial=function(t){m.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},m.MeshNormalMaterial.prototype=Object.create(m.Material.prototype),m.MeshNormalMaterial.prototype.constructor=m.MeshNormalMaterial,m.MeshNormalMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MultiMaterial=function(t){this.uuid=m.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},m.MultiMaterial.prototype={constructor:m.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;i<n;i++){var o=r[i].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},m.PointsMaterial=function(t){m.Material.call(this),this.type="PointsMaterial",this.color=new m.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.PointsMaterial.prototype=Object.create(m.Material.prototype),m.PointsMaterial.prototype.constructor=m.PointsMaterial,m.PointsMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.ShaderMaterial=function(t){m.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=m.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))},m.ShaderMaterial.prototype=Object.create(m.Material.prototype),m.ShaderMaterial.prototype.constructor=m.ShaderMaterial,m.ShaderMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=m.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},m.ShaderMaterial.prototype.toJSON=function(t){return t=m.Material.prototype.toJSON.call(this,t),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},m.RawShaderMaterial=function(t){m.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},m.RawShaderMaterial.prototype=Object.create(m.ShaderMaterial.prototype),m.RawShaderMaterial.prototype.constructor=m.RawShaderMaterial,m.SpriteMaterial=function(t){m.Material.call(this),this.type="SpriteMaterial",this.color=new m.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},m.SpriteMaterial.prototype=Object.create(m.Material.prototype),m.SpriteMaterial.prototype.constructor=m.SpriteMaterial,m.SpriteMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.fog=t.fog,this},m.Texture=function(t,e,r,i,n,o,a,s,h){Object.defineProperty(this,"id",{value:m.TextureIdCount++}),this.uuid=m.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==t?t:m.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:m.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:m.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:m.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:m.LinearFilter,this.minFilter=void 0!==o?o:m.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:m.RGBAFormat,this.type=void 0!==s?s:m.UnsignedByteType,this.offset=new m.Vector2(0,0),this.repeat=new m.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},m.Texture.DEFAULT_IMAGE=void 0,m.Texture.DEFAULT_MAPPING=m.UVMapping,m.Texture.prototype={constructor:m.Texture,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=m.Math.generateUUID()),void 0===t.images[r.uuid]){var i,n=t.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:(i=document.createElement("canvas"),i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0,r.width,r.height)),i=2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"),n[o]={uuid:a,url:i}}e.image=r.uuid}return t.textures[this.uuid]=e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===m.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),0>t.x||1<t.x)switch(this.wrapS){case m.RepeatWrapping:t.x-=Math.floor(t.x);break;case m.ClampToEdgeWrapping:t.x=0>t.x?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x-=Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case m.RepeatWrapping:t.y-=Math.floor(t.y);break;case m.ClampToEdgeWrapping:t.y=0>t.y?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y-=Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},m.EventDispatcher.prototype.apply(m.Texture.prototype),m.TextureIdCount=0,m.CanvasTexture=function(t,e,r,i,n,o,a,s,h){m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.needsUpdate=!0},m.CanvasTexture.prototype=Object.create(m.Texture.prototype),m.CanvasTexture.prototype.constructor=m.CanvasTexture,m.CubeTexture=function(t,e,r,i,n,o,a,s,h){e=void 0!==e?e:m.CubeReflectionMapping,m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.images=t,this.flipY=!1},m.CubeTexture.prototype=Object.create(m.Texture.prototype),m.CubeTexture.prototype.constructor=m.CubeTexture,m.CubeTexture.prototype.copy=function(t){return m.Texture.prototype.copy.call(this,t),this.images=t.images,this},m.CompressedTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1},m.CompressedTexture.prototype=Object.create(m.Texture.prototype),m.CompressedTexture.prototype.constructor=m.CompressedTexture,m.DataTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={data:t,width:e,height:r},this.magFilter=void 0!==h?h:m.NearestFilter,this.minFilter=void 0!==c?c:m.NearestFilter,this.generateMipmaps=this.flipY=!1},m.DataTexture.prototype=Object.create(m.Texture.prototype),m.DataTexture.prototype.constructor=m.DataTexture,m.VideoTexture=function(t,e,r,i,n,o,a,s,h){function c(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)}m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.generateMipmaps=!1;var l=this;c()},m.VideoTexture.prototype=Object.create(m.Texture.prototype),m.VideoTexture.prototype.constructor=m.VideoTexture,m.Group=function(){m.Object3D.call(this),this.type="Group"},m.Group.prototype=Object.create(m.Object3D.prototype),m.Group.prototype.constructor=m.Group,m.Points=function(t,e){m.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.PointsMaterial({color:16777215*Math.random()})},m.Points.prototype=Object.create(m.Object3D.prototype),m.Points.prototype.constructor=m.Points,m.Points.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(h);var c=i.ray.origin.distanceTo(s);c<i.near||c>i.far||n.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,h=this.matrixWorld,c=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(h),!1!==i.ray.intersectsSphere(r)){t.getInverse(h),e.copy(i.ray).applyMatrix4(t);var l=(c/=(this.scale.x+this.scale.y+this.scale.z)/3)*c,c=new m.Vector3;if(s instanceof m.BufferGeometry){var u=s.index,s=s.attributes.position.array;if(null!==u)for(var p=u.array,u=0,d=p.length;u<d;u++){var f=p[u];c.fromArray(s,3*f),o(c,f)}else for(u=0,p=s.length/3;u<p;u++)c.fromArray(s,3*u),o(c,u)}else for(c=s.vertices,u=0,p=c.length;u<p;u++)o(c[u],u)}}}(),m.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Line=function(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new m.LineSegments(t,e);m.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.LineBasicMaterial({color:16777215*Math.random()})},m.Line.prototype=Object.create(m.Object3D.prototype),m.Line.prototype.constructor=m.Line,m.Line.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){var o=(o=i.linePrecision)*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==i.ray.intersectsSphere(r)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=new m.Vector3,c=new m.Vector3,s=new m.Vector3,l=new m.Vector3,u=this instanceof m.LineSegments?2:1;if(a instanceof m.BufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var p=p.array,a=0,f=p.length-1;a<f;a+=u){var g=p[a+1];h.fromArray(d,3*p[a]),c.fromArray(d,3*g),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,f=d.length/3-1;a<f;a+=u)h.fromArray(d,3*a),c.fromArray(d,3*a+3),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof m.Geometry)for(h=a.vertices,c=h.length,a=0;a<c-1;a+=u)(g=e.distanceSqToSegment(h[a],h[a+1],l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),m.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.LineStrip=0,m.LinePieces=1,m.LineSegments=function(t,e){m.Line.call(this,t,e),this.type="LineSegments"},m.LineSegments.prototype=Object.create(m.Line.prototype),m.LineSegments.prototype.constructor=m.LineSegments,m.Mesh=function(t,e){m.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=m.TrianglesDrawMode,this.updateMorphTargets()},m.Mesh.prototype=Object.create(m.Object3D.prototype),m.Mesh.prototype.constructor=m.Mesh,m.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},m.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},m.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},m.Mesh.prototype.raycast=function(){function t(t,e,r,i,n,o,a){return m.Triangle.barycoordFromPoint(t,e,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),a.multiplyScalar(g.z),n.add(o).add(a),n.clone()}function e(t,e,r,i,n,o,a){var s=t.material;return null===(s.side===m.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==m.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(t.matrixWorld),r=e.ray.origin.distanceTo(y),r<e.near||r>e.far?null:{distance:r,point:y.clone(),object:t})}function r(r,i,n,o,c,l,u,g){return a.fromArray(o,3*l),s.fromArray(o,3*u),h.fromArray(o,3*g),(r=e(r,i,n,a,s,h,v))&&(c&&(p.fromArray(c,2*l),d.fromArray(c,2*u),f.fromArray(c,2*g),r.uv=t(v,a,s,h,p,d,f)),r.face=new m.Face3(l,u,g,m.Triangle.normal(a,s,h)),r.faceIndex=l),r}var i=new m.Matrix4,n=new m.Ray,o=new m.Sphere,a=new m.Vector3,s=new m.Vector3,h=new m.Vector3,c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=new m.Vector2,d=new m.Vector2,f=new m.Vector2,g=new m.Vector3,v=new m.Vector3,y=new m.Vector3;return function(g,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),!1!==g.ray.intersectsSphere(o)&&(i.getInverse(_),n.copy(g.ray).applyMatrix4(i),null===x.boundingBox||!1!==n.intersectsBox(x.boundingBox)))){var M,w;if(x instanceof m.BufferGeometry){var S,E,b=x.index,x=(_=x.attributes).position.array;if(void 0!==_.uv&&(M=_.uv.array),null!==b)for(var _=b.array,T=0,C=_.length;T<C;T+=3)b=_[T],S=_[T+1],E=_[T+2],(w=r(this,g,n,x,M,b,S,E))&&(w.faceIndex=Math.floor(T/3),y.push(w));else for(T=0,C=x.length;T<C;T+=9)b=T/3,S=b+1,E=b+2,(w=r(this,g,n,x,M,b,S,E))&&(w.index=b,y.push(w))}else if(x instanceof m.Geometry){var L,A,T=!0==(_=b instanceof m.MultiMaterial)?b.materials:null,C=x.vertices;S=x.faces,0<(E=x.faceVertexUvs[0]).length&&(M=E);for(var P=0,R=S.length;P<R;P++){var U=S[P];if(void 0!==(w=!0===_?T[U.materialIndex]:b)){if(E=C[U.a],L=C[U.b],A=C[U.c],!0===w.morphTargets){w=x.morphTargets;var k=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),h.set(0,0,0);for(var D=0,I=w.length;D<I;D++){var F=k[D];if(0!==F){var B=w[D].vertices;a.addScaledVector(c.subVectors(B[U.a],E),F),s.addScaledVector(l.subVectors(B[U.b],L),F),h.addScaledVector(u.subVectors(B[U.c],A),F)}}a.add(E),s.add(L),h.add(A),E=a,L=s,A=h}(w=e(this,g,n,E,L,A,v))&&(M&&(k=M[P],p.copy(k[0]),d.copy(k[1]),f.copy(k[2]),w.uv=t(v,E,L,A,p,d,f)),w.face=U,w.faceIndex=P,y.push(w))}}}}}}(),m.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Bone=function(t){m.Object3D.call(this),this.type="Bone",this.skin=t},m.Bone.prototype=Object.create(m.Object3D.prototype),m.Bone.prototype.constructor=m.Bone,m.Bone.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this},m.Skeleton=function(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new m.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=m.Math.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new m.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,m.RGBAFormat,m.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new m.Matrix4)},m.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new m.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},m.Skeleton.prototype.pose=function(){for(var t,e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},m.Skeleton.prototype.update=function(){var t=new m.Matrix4;return function(){for(var e=0,r=this.bones.length;e<r;e++)t.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),m.Skeleton.prototype.clone=function(){return new m.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},m.SkinnedMesh=function(t,e,r){if(m.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m.Matrix4,this.bindMatrixInverse=new m.Matrix4,t=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],e=new m.Bone(this),t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],-1!==i.parent&&null!==i.parent?t[i.parent].add(t[n]):this.add(t[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new m.Skeleton(t,void 0,r),this.matrixWorld)},m.SkinnedMesh.prototype=Object.create(m.Mesh.prototype),m.SkinnedMesh.prototype.constructor=m.SkinnedMesh,m.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},m.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},m.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof m.Geometry)for(i=0;i<this.geometry.skinWeights.length;i++){var t=1/(e=this.geometry.skinWeights[i]).lengthManhattan();1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry instanceof m.BufferGeometry)for(var e=new m.Vector4,r=this.geometry.attributes.skinWeight,i=0;i<r.count;i++)e.x=r.getX(i),e.y=r.getY(i),e.z=r.getZ(i),e.w=r.getW(i),t=1/e.lengthManhattan(),1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0),r.setXYZW(i,e.x,e.y,e.z,e.w)},m.SkinnedMesh.prototype.updateMatrixWorld=function(t){m.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},m.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},m.LOD=function(){m.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},m.LOD.prototype=Object.create(m.Object3D.prototype),m.LOD.prototype.constructor=m.LOD,m.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},m.LOD.prototype.getObjectForDistance=function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},m.LOD.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,r)}}(),m.LOD.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(r){var i=this.levels;if(1<i.length){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),r=t.distanceTo(e),i[0].object.visible=!0;for(var n=1,o=i.length;n<o&&r>=i[n].distance;n++)i[n-1].object.visible=!1,i[n].object.visible=!0;for(;n<o;n++)i[n].object.visible=!1}}}(),m.LOD.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},m.LOD.prototype.toJSON=function(t){(t=m.Object3D.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,i=e.length;r<i;r++){var n=e[r];t.object.levels.push({object:n.object.uuid,distance:n.distance})}return t},m.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new m.BufferGeometry;return i.setIndex(new m.BufferAttribute(t,1)),i.addAttribute("position",new m.BufferAttribute(e,3)),i.addAttribute("uv",new m.BufferAttribute(r,2)),function(t){m.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new m.SpriteMaterial}}(),m.Sprite.prototype=Object.create(m.Object3D.prototype),m.Sprite.prototype.constructor=m.Sprite,m.Sprite.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(t);i>this.scale.x*this.scale.y||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),m.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},m.Particle=m.Sprite,m.LensFlare=function(t,e,r,i,n){m.Object3D.call(this),this.lensFlares=[],this.positionScreen=new m.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,i,n)},m.LensFlare.prototype=Object.create(m.Object3D.prototype),m.LensFlare.prototype.constructor=m.LensFlare,m.LensFlare.prototype.add=function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new m.Color(16777215)),void 0===i&&(i=m.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},m.LensFlare.prototype.updateLensFlares=function(){var t,e,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+n*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},m.LensFlare.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},m.Scene=function(){m.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},m.Scene.prototype=Object.create(m.Object3D.prototype),m.Scene.prototype.constructor=m.Scene,m.Scene.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},m.Fog=function(t,e,r){this.name="",this.color=new m.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},m.Fog.prototype.clone=function(){return new m.Fog(this.color.getHex(),this.near,this.far)},m.FogExp2=function(t,e){this.name="",this.color=new m.Color(t),this.density=void 0!==e?e:25e-5},m.FogExp2.prototype.clone=function(){return new m.FogExp2(this.color.getHex(),this.density)},m.ShaderChunk={},m.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",m.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",m.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",m.ShaderChunk.ambient_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\treturn PI * ambientLightColor;\n}\n",m.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\treflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n#endif\n",m.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",m.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",m.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",m.ShaderChunk.bsdfs="float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t  return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = alpha * alpha;\n\tfloat gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );\n\tfloat gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );\n\treturn 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = alpha * alpha;\n\tfloat denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / ( denom * 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 = roughness * 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_Smith( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );\n}",m.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",m.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",m.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",m.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",m.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",m.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\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 square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\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}\nvec3 inputToLinear( in vec3 a ) {\n\t#ifdef GAMMA_INPUT\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n",m.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",m.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",m.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",m.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\ttotalEmissiveLight *= emissiveColor.rgb;\n#endif\n",m.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",m.ShaderChunk.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 DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvarying vec3 vReflect;\n\tuniform float refractionRatio;\n#endif\n",m.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t#else\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t#endif\n#endif\n",m.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n#endif",m.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\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",m.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",m.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",m.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tdirectLight = getPointDirectLight( pointLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tdirectLight = getSpotDirectLight( spotLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectLight = getDirectionalDirectLight( directionalLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.lights_pars="#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\tIncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tIncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\t\treturn directLight;\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 angleCos;\n\t\tfloat exponent;\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\tIncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat spotEffect = dot( directLight.direction, spotLight.direction );\n\t\tif ( spotEffect > spotLight.angleCos ) {\n\t\t\tfloat spotEffect = dot( spotLight.direction, directLight.direction );\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t}\n\t\treturn directLight;\n\t}\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\treturn PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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#else\n\t\t\tvec3 envMapColor = vec3( 0.0 );\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\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( square( 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\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\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 = flipNormal * 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * 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#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",m.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",m.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\nvarying 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\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\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)\n",m.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\n",m.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n\tvWorldPosition = worldPosition.xyz;\n#endif\n",m.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",m.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Standard\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n",m.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tdirectLight = getPointDirectLight( pointLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tdirectLight = getSpotDirectLight( spotLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tdirectLight = getDirectionalDirectLight( directionalLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( directionalLight.shadow ) ? 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 defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tirradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\tRE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",m.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",m.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",m.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",m.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",m.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",m.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\tdiffuseColor *= texelColor;\n#endif\n",m.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",m.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n#endif\n",m.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",m.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",m.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",m.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",m.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",m.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",m.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",m.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",m.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",m.ShaderChunk.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 unpackDepth( const in vec4 rgba_depth ) {\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\treturn dot( rgba_depth, bit_shift );\n\t}\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec3 offset = vec3( - 1, 0, 1 ) * shadowRadius * 2.0 * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxx, 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.xzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxy, 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.xzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyx, 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.yzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 21.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",m.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",m.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",m.ShaderChunk.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",m.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",m.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned  = bindMatrixInverse * skinned;\n#endif\n",m.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",m.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",m.ShaderChunk.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",m.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",m.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",m.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",m.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i,n=this.clone(t[r]);for(i in n)e[i]=n[i]}return e},clone:function(t){var e,r={};for(e in t){r[e]={};for(var i in t[e]){var n=t[e][i];n instanceof m.Color||n instanceof m.Vector2||n instanceof m.Vector3||n instanceof m.Vector4||n instanceof m.Matrix3||n instanceof m.Matrix4||n instanceof m.Texture?r[e][i]=n.clone():Array.isArray(n)?r[e][i]=n.slice():r[e][i]=n}}return r}},m.UniformsLib={common:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new m.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new m.Color(16777215)}},ambient:{ambientLightColor:{type:"fv",value:[]}},lights:{directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},angleCos:{type:"f"},exponent:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)}}},m.ShaderLib={basic:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.fog]),vertexShader:[m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"\t#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,"\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.indirectDiffuse;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},lambert:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.bsdfs,m.ShaderChunk.lights_pars,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_lambert_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.shadowmask_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.emissivemap_fragment,"\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );",m.ShaderChunk.lightmap_fragment,"\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();",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},phong:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},specular:{type:"c",value:new m.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.lights_phong_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_phong_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_phong_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_phong_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},standard:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.roughnessmap,m.UniformsLib.metalnessmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_standard_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.roughnessmap_pars_fragment,m.ShaderChunk.metalnessmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.roughnessmap_fragment,m.ShaderChunk.metalnessmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_standard_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:m.UniformsUtils.merge([m.UniformsLib.points,m.UniformsLib.fog]),vertexShader:["uniform float size;\nuniform float scale;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.project_vertex,"\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif",m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.map_particle_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_particle_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new m.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",m.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n\tdepth /= 1000.0;\n\tconst vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}},m.WebGLRenderer=function(t){function e(t,e,r,i){!0===I&&(t*=i,e*=i,r*=i),xt.clearColor(t,e,r,i)}function r(){xt.init(),xt.scissor(J.copy(st).multiplyScalar(at)),xt.viewport(tt.copy(ct).multiplyScalar(at)),e(rt.r,rt.g,rt.b,it)}function i(){K=X=null,Q="",Z=-1,xt.reset()}function n(t){t.preventDefault(),i(),r(),bt.clear()}function o(t){(t=t.target).removeEventListener("dispose",o);t:{var e=bt.get(t);if(t.image&&e.__image__webglTextureCube)gt.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)break t;gt.deleteTexture(e.__webglTexture)}bt.delete(t)}ft.textures--}function a(t){(t=t.target).removeEventListener("dispose",a);var e=bt.get(t),r=bt.get(t.texture);if(t&&void 0!==r.__webglTexture){if(gt.deleteTexture(r.__webglTexture),t instanceof m.WebGLRenderTargetCube)for(r=0;6>r;r++)gt.deleteFramebuffer(e.__webglFramebuffer[r]),gt.deleteRenderbuffer(e.__webglDepthbuffer[r]);else gt.deleteFramebuffer(e.__webglFramebuffer),gt.deleteRenderbuffer(e.__webglDepthbuffer);bt.delete(t.texture),bt.delete(t)}ft.textures--}function s(t){(t=t.target).removeEventListener("dispose",s),h(t),bt.delete(t)}function h(t){var e=bt.get(t).program;t.program=void 0,void 0!==e&&Mt.releaseProgram(e)}function c(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function u(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function p(t,e,r,i,n){var o;r.transparent?(i=O,o=++G):(i=V,o=++N),void 0!==(o=i[o])?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=pt.z,o.group=n):(o={id:t.id,object:t,geometry:e,material:r,z:pt.z,group:n},i.push(o))}function d(t,e){if(!1!==t.visible){if(t.layers.test(e.layers))if(t instanceof m.Light)B.push(t);else if(t instanceof m.Sprite)!1!==t.frustumCulled&&!0!==lt.intersectsObject(t)||H.push(t);else if(t instanceof m.LensFlare)j.push(t);else if(t instanceof m.ImmediateRenderObject)!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut)),p(t,null,t.material,pt.z,null);else if((t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&(t instanceof m.SkinnedMesh&&t.skeleton.update(),(!1===t.frustumCulled||!0===lt.intersectsObject(t))&&!0===(o=t.material).visible)){!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut));var r=_t.update(t);if(o instanceof m.MultiMaterial)for(var i=r.groups,n=o.materials,o=0,a=i.length;o<a;o++){var s=i[o],h=n[s.materialIndex];!0===h.visible&&p(t,r,h,pt.z,s)}else p(t,r,o,pt.z,null)}for(o=0,a=(r=t.children).length;o<a;o++)d(r[o],e)}}function f(t,e,r,i){for(var n=0,o=t.length;n<o;n++){var a=(c=t[n]).object,s=c.geometry,h=void 0===i?c.material:i,c=c.group;if(a.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a instanceof m.ImmediateRenderObject){g(h);var l=v(e,r,h,a);Q="",a.render(function(t){W.renderBufferImmediate(t,l,h)})}else W.renderBufferDirect(e,r,s,h,a,c)}}function g(t){t.side!==m.DoubleSide?xt.enable(gt.CULL_FACE):xt.disable(gt.CULL_FACE),xt.setFlipSided(t.side===m.BackSide),!0===t.transparent?xt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):xt.setBlending(m.NoBlending),xt.setDepthFunc(t.depthFunc),xt.setDepthTest(t.depthTest),xt.setDepthWrite(t.depthWrite),xt.setColorWrite(t.colorWrite),xt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i){et=0;var n=bt.get(r);if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==dt.hash&&(r.needsUpdate=!0),r.needsUpdate){t:{var o=bt.get(r),a=Mt.getParameters(r,dt,e,i),c=Mt.getProgramCode(r,a),l=o.program,u=!0;if(void 0===l)r.addEventListener("dispose",s);else if(l.code!==c)h(r);else{if(void 0!==a.shaderID)break t;u=!1}if(u&&(a.shaderID?(l=m.ShaderLib[a.shaderID],o.__webglShader={name:r.type,uniforms:m.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):o.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=o.__webglShader,l=Mt.acquireProgram(r,a,c),o.program=l,r.program=l),a=l.getAttributes(),r.morphTargets)for(c=r.numSupportedMorphTargets=0;c<W.maxMorphTargets;c++)0<=a["morphTarget"+c]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(c=r.numSupportedMorphNormals=0;c<W.maxMorphNormals;c++)0<=a["morphNormal"+c]&&r.numSupportedMorphNormals++;o.uniformsList=[];var p,a=o.__webglShader.uniforms,c=o.program.getUniforms();for(p in a)(l=c[p])&&o.uniformsList.push([o.__webglShader.uniforms[p],l]);for((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(o.lightsHash=dt.hash,a.ambientLightColor.value=dt.ambient,a.directionalLights.value=dt.directional,a.spotLights.value=dt.spot,a.pointLights.value=dt.point,a.hemisphereLights.value=dt.hemi,a.directionalShadowMap.value=dt.directionalShadowMap,a.directionalShadowMatrix.value=dt.directionalShadowMatrix,a.spotShadowMap.value=dt.spotShadowMap,a.spotShadowMatrix.value=dt.spotShadowMatrix,a.pointShadowMap.value=dt.pointShadowMap,a.pointShadowMatrix.value=dt.pointShadowMatrix),o.hasDynamicUniforms=!1,p=0,a=o.uniformsList.length;p<a;p++)if(!0===o.uniformsList[p][0].dynamic){o.hasDynamicUniforms=!0;break}}r.needsUpdate=!1}if(l=c=u=!1,o=n.program,p=o.getUniforms(),a=n.__webglShader.uniforms,o.id!==X&&(gt.useProgram(o.program),X=o.id,l=c=u=!0),r.id!==Z&&(Z=r.id,c=!0),(u||t!==K)&&(gt.uniformMatrix4fv(p.projectionMatrix,!1,t.projectionMatrix.elements),yt.logarithmicDepthBuffer&&gt.uniform1f(p.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==K&&(K=t,l=c=!0),(r instanceof m.ShaderMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial||r.envMap)&&void 0!==p.cameraPosition&&(pt.setFromMatrixPosition(t.matrixWorld),gt.uniform3f(p.cameraPosition,pt.x,pt.y,pt.z)),(r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshBasicMaterial||r instanceof m.MeshStandardMaterial||r instanceof m.ShaderMaterial||r.skinning)&&void 0!==p.viewMatrix&&gt.uniformMatrix4fv(p.viewMatrix,!1,t.matrixWorldInverse.elements)),r.skinning&&(i.bindMatrix&&void 0!==p.bindMatrix&&gt.uniformMatrix4fv(p.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&gt.uniformMatrix4fv(p.bindMatrixInverse,!1,i.bindMatrixInverse.elements),yt.floatVertexTextures&&i.skeleton&&i.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(u=y(),gt.uniform1i(p.boneTexture,u),W.setTexture(i.skeleton.boneTexture,u)),void 0!==p.boneTextureWidth&&gt.uniform1i(p.boneTextureWidth,i.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&gt.uniform1i(p.boneTextureHeight,i.skeleton.boneTextureHeight)):i.skeleton&&i.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&gt.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.skeleton.boneMatrices)),c){if((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(c=l,a.ambientLightColor.needsUpdate=c,a.directionalLights.needsUpdate=c,a.pointLights.needsUpdate=c,a.spotLights.needsUpdate=c,a.hemisphereLights.needsUpdate=c),e&&r.fog&&(a.fogColor.value=e.color,e instanceof m.Fog?(a.fogNear.value=e.near,a.fogFar.value=e.far):e instanceof m.FogExp2&&(a.fogDensity.value=e.density)),r instanceof m.MeshBasicMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial){a.opacity.value=r.opacity,a.diffuse.value=r.color,r.emissive&&a.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),a.map.value=r.map,a.specularMap.value=r.specularMap,a.alphaMap.value=r.alphaMap,r.aoMap&&(a.aoMap.value=r.aoMap,a.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d instanceof m.WebGLRenderTarget&&(d=d.texture),e=d.offset,d=d.repeat,a.offsetRepeat.value.set(e.x,e.y,d.x,d.y)),a.envMap.value=r.envMap,a.flipEnvMap.value=r.envMap instanceof m.WebGLRenderTargetCube?1:-1,a.reflectivity.value=r.reflectivity,a.refractionRatio.value=r.refractionRatio}r instanceof m.LineBasicMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity):r instanceof m.LineDashedMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.dashSize.value=r.dashSize,a.totalSize.value=r.dashSize+r.gapSize,a.scale.value=r.scale):r instanceof m.PointsMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.size.value=r.size*at,a.scale.value=A.clientHeight/2,a.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,a.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r instanceof m.MeshLambertMaterial?(r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap)):r instanceof m.MeshPhongMaterial?(a.specular.value=r.specular,a.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias)):r instanceof m.MeshStandardMaterial?(a.roughness.value=r.roughness,a.metalness.value=r.metalness,r.roughnessMap&&(a.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(a.metalnessMap.value=r.metalnessMap),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias),r.envMap&&(a.envMapIntensity.value=r.envMapIntensity)):r instanceof m.MeshDepthMaterial?(a.mNear.value=t.near,a.mFar.value=t.far,a.opacity.value=r.opacity):r instanceof m.MeshNormalMaterial&&(a.opacity.value=r.opacity),x(n.uniformsList)}if(gt.uniformMatrix4fv(p.modelViewMatrix,!1,i.modelViewMatrix.elements),p.normalMatrix&&gt.uniformMatrix3fv(p.normalMatrix,!1,i.normalMatrix.elements),void 0!==p.modelMatrix&&gt.uniformMatrix4fv(p.modelMatrix,!1,i.matrixWorld.elements),!0===n.hasDynamicUniforms){for(r=[],d=0,e=(n=n.uniformsList).length;d<e;d++)p=n[d][0],void 0!==(a=p.onUpdateCallback)&&(a.bind(p)(i,t),r.push(n[d]));x(r)}return o}function y(){var t=et;return t>=yt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+yt.maxTextures),et+=1,t}function x(t){for(var e,r,i=0,n=t.length;i<n;i++){var o=t[i][0];if(!1!==o.needsUpdate){var a=o.type;e=o.value;var s=t[i][1];switch(a){case"1i":gt.uniform1i(s,e);break;case"1f":gt.uniform1f(s,e);break;case"2f":gt.uniform2f(s,e[0],e[1]);break;case"3f":gt.uniform3f(s,e[0],e[1],e[2]);break;case"4f":gt.uniform4f(s,e[0],e[1],e[2],e[3]);break;case"1iv":gt.uniform1iv(s,e);break;case"3iv":gt.uniform3iv(s,e);break;case"1fv":gt.uniform1fv(s,e);break;case"2fv":gt.uniform2fv(s,e);break;case"3fv":gt.uniform3fv(s,e);break;case"4fv":gt.uniform4fv(s,e);break;case"Matrix2fv":gt.uniformMatrix2fv(s,!1,e);break;case"Matrix3fv":gt.uniformMatrix3fv(s,!1,e);break;case"Matrix4fv":gt.uniformMatrix4fv(s,!1,e);break;case"i":gt.uniform1i(s,e);break;case"f":gt.uniform1f(s,e);break;case"v2":gt.uniform2f(s,e.x,e.y);break;case"v3":gt.uniform3f(s,e.x,e.y,e.z);break;case"v4":gt.uniform4f(s,e.x,e.y,e.z,e.w);break;case"c":gt.uniform3f(s,e.r,e.g,e.b);break;case"sa":for(a=0;a<e.length;a++)for(var h in o.properties){var c=s[a][h];switch(r=e[a][h],o.properties[h].type){case"i":gt.uniform1i(c,r);break;case"f":gt.uniform1f(c,r);break;case"v2":gt.uniform2f(c,r.x,r.y);break;case"v3":gt.uniform3f(c,r.x,r.y,r.z);break;case"v4":gt.uniform4f(c,r.x,r.y,r.z,r.w);break;case"c":gt.uniform3f(c,r.r,r.g,r.b);break;case"m4":gt.uniformMatrix4fv(c,!1,r.elements)}}break;case"iv1":gt.uniform1iv(s,e);break;case"iv":gt.uniform3iv(s,e);break;case"fv1":gt.uniform1fv(s,e);break;case"fv":gt.uniform3fv(s,e);break;case"v2v":for(void 0===o._array&&(o._array=new Float32Array(2*e.length)),r=a=0,c=e.length;a<c;a++,r+=2)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y;gt.uniform2fv(s,o._array);break;case"v3v":for(void 0===o._array&&(o._array=new Float32Array(3*e.length)),r=a=0,c=e.length;a<c;a++,r+=3)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z;gt.uniform3fv(s,o._array);break;case"v4v":for(void 0===o._array&&(o._array=new Float32Array(4*e.length)),r=a=0,c=e.length;a<c;a++,r+=4)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z,o._array[r+3]=e[a].w;gt.uniform4fv(s,o._array);break;case"m2":gt.uniformMatrix2fv(s,!1,e.elements);break;case"m3":gt.uniformMatrix3fv(s,!1,e.elements);break;case"m3v":for(void 0===o._array&&(o._array=new Float32Array(9*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,9*a);gt.uniformMatrix3fv(s,!1,o._array);break;case"m4":gt.uniformMatrix4fv(s,!1,e.elements);break;case"m4v":for(void 0===o._array&&(o._array=new Float32Array(16*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,16*a);gt.uniformMatrix4fv(s,!1,o._array);break;case"t":if(r=y(),gt.uniform1i(s,r),!e)continue;e instanceof m.CubeTexture||Array.isArray(e.image)&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):W.setTexture(e,r);break;case"tv":for(void 0===o._array&&(o._array=[]),a=0,c=o.value.length;a<c;a++)o._array[a]=y();for(gt.uniform1iv(s,o._array),a=0,c=o.value.length;a<c;a++)e=o.value[a],r=o._array[a],e&&(e instanceof m.CubeTexture||e.image instanceof Array&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):W.setTexture(e,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function b(t,e,r){r?(gt.texParameteri(t,gt.TEXTURE_WRAP_S,L(e.wrapS)),gt.texParameteri(t,gt.TEXTURE_WRAP_T,L(e.wrapT)),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,L(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,L(e.minFilter))):(gt.texParameteri(t,gt.TEXTURE_WRAP_S,gt.CLAMP_TO_EDGE),gt.texParameteri(t,gt.TEXTURE_WRAP_T,gt.CLAMP_TO_EDGE),e.wrapS===m.ClampToEdgeWrapping&&e.wrapT===m.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,C(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,C(e.minFilter)),e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),!(r=vt.get("EXT_texture_filter_anisotropic"))||e.type===m.FloatType&&null===vt.get("OES_texture_float_linear")||e.type===m.HalfFloatType&&null===vt.get("OES_texture_half_float_linear")||!(1<e.anisotropy||bt.get(e).__currentAnisotropy)||(gt.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,W.getMaxAnisotropy())),bt.get(e).__currentAnisotropy=e.anisotropy)}function _(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElement("canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function M(t){return m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height)}function w(t,e){var r=bt.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",o),r.__image__webglTextureCube=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var i=t instanceof m.CompressedTexture,n=t.image[0]instanceof m.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?t.image[s].image:t.image[s]:_(t.image[s],yt.maxCubemapSize);var h=M(a[0]),c=L(t.format),l=L(t.type);for(b(gt.TEXTURE_CUBE_MAP,t,h),s=0;6>s;s++)if(i)for(var u,p=a[s].mipmaps,d=0,f=p.length;d<f;d++)u=p[d],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(c)?xt.compressedTexImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,c,l,u.data);else n?xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,a[s].width,a[s].height,0,c,l,a[s].data):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,c,l,a[s]);t.generateMipmaps&&h&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function S(t,e){xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,bt.get(t).__webglTexture)}function E(t,e,r,i){var n=L(e.texture.format),o=L(e.texture.type);xt.texImage2D(i,0,n,e.width,e.height,0,n,o,null),gt.bindFramebuffer(gt.FRAMEBUFFER,t),gt.framebufferTexture2D(gt.FRAMEBUFFER,r,i,bt.get(e.texture).__webglTexture,0),gt.bindFramebuffer(gt.FRAMEBUFFER,null)}function T(t,e){gt.bindRenderbuffer(gt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_COMPONENT16,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_ATTACHMENT,gt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_STENCIL,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_STENCIL_ATTACHMENT,gt.RENDERBUFFER,t)):gt.renderbufferStorage(gt.RENDERBUFFER,gt.RGBA4,e.width,e.height),gt.bindRenderbuffer(gt.RENDERBUFFER,null)}function C(t){return t===m.NearestFilter||t===m.NearestMipMapNearestFilter||t===m.NearestMipMapLinearFilter?gt.NEAREST:gt.LINEAR}function L(t){var e;if(t===m.RepeatWrapping)return gt.REPEAT;if(t===m.ClampToEdgeWrapping)return gt.CLAMP_TO_EDGE;if(t===m.MirroredRepeatWrapping)return gt.MIRRORED_REPEAT;if(t===m.NearestFilter)return gt.NEAREST;if(t===m.NearestMipMapNearestFilter)return gt.NEAREST_MIPMAP_NEAREST;if(t===m.NearestMipMapLinearFilter)return gt.NEAREST_MIPMAP_LINEAR;if(t===m.LinearFilter)return gt.LINEAR;if(t===m.LinearMipMapNearestFilter)return gt.LINEAR_MIPMAP_NEAREST;if(t===m.LinearMipMapLinearFilter)return gt.LINEAR_MIPMAP_LINEAR;if(t===m.UnsignedByteType)return gt.UNSIGNED_BYTE;if(t===m.UnsignedShort4444Type)return gt.UNSIGNED_SHORT_4_4_4_4;if(t===m.UnsignedShort5551Type)return gt.UNSIGNED_SHORT_5_5_5_1;if(t===m.UnsignedShort565Type)return gt.UNSIGNED_SHORT_5_6_5;if(t===m.ByteType)return gt.BYTE;if(t===m.ShortType)return gt.SHORT;if(t===m.UnsignedShortType)return gt.UNSIGNED_SHORT;if(t===m.IntType)return gt.INT;if(t===m.UnsignedIntType)return gt.UNSIGNED_INT;if(t===m.FloatType)return gt.FLOAT;if(null!==(e=vt.get("OES_texture_half_float"))&&t===m.HalfFloatType)return e.HALF_FLOAT_OES;if(t===m.AlphaFormat)return gt.ALPHA;if(t===m.RGBFormat)return gt.RGB;if(t===m.RGBAFormat)return gt.RGBA;if(t===m.LuminanceFormat)return gt.LUMINANCE;if(t===m.LuminanceAlphaFormat)return gt.LUMINANCE_ALPHA;if(t===m.AddEquation)return gt.FUNC_ADD;if(t===m.SubtractEquation)return gt.FUNC_SUBTRACT;if(t===m.ReverseSubtractEquation)return gt.FUNC_REVERSE_SUBTRACT;if(t===m.ZeroFactor)return gt.ZERO;if(t===m.OneFactor)return gt.ONE;if(t===m.SrcColorFactor)return gt.SRC_COLOR;if(t===m.OneMinusSrcColorFactor)return gt.ONE_MINUS_SRC_COLOR;if(t===m.SrcAlphaFactor)return gt.SRC_ALPHA;if(t===m.OneMinusSrcAlphaFactor)return gt.ONE_MINUS_SRC_ALPHA;if(t===m.DstAlphaFactor)return gt.DST_ALPHA;if(t===m.OneMinusDstAlphaFactor)return gt.ONE_MINUS_DST_ALPHA;if(t===m.DstColorFactor)return gt.DST_COLOR;if(t===m.OneMinusDstColorFactor)return gt.ONE_MINUS_DST_COLOR;if(t===m.SrcAlphaSaturateFactor)return gt.SRC_ALPHA_SATURATE;if(null!==(e=vt.get("WEBGL_compressed_texture_s3tc"))){if(t===m.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===m.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=vt.get("WEBGL_compressed_texture_pvrtc"))){if(t===m.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===m.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===m.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===m.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=vt.get("WEBGL_compressed_texture_etc1"))&&t===m.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(null!==(e=vt.get("EXT_blend_minmax"))){if(t===m.MinEquation)return e.MIN_EXT;if(t===m.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",m.REVISION);var A=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),P=void 0!==t.context?t.context:null,R=void 0!==t.alpha&&t.alpha,U=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,D=void 0!==t.antialias&&t.antialias,I=void 0===t.premultipliedAlpha||t.premultipliedAlpha,F=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,B=[],V=[],N=-1,O=[],G=-1,z=new Float32Array(8),H=[],j=[];this.domElement=A,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.gammaOutput=this.gammaInput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,X=null,q=null,Y=null,Z=-1,Q="",K=null,J=new m.Vector4,$=null,tt=new m.Vector4,et=0,rt=new m.Color(0),it=0,nt=A.width,ot=A.height,at=1,st=new m.Vector4(0,0,nt,ot),ht=!1,ct=new m.Vector4(0,0,nt,ot),lt=new m.Frustum,ut=new m.Matrix4,pt=new m.Vector3,dt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},ft={geometries:0,textures:0},mt={calls:0,vertices:0,faces:0,points:0};this.info={render:mt,memory:ft,programs:null};var gt;try{if(R={alpha:R,depth:U,stencil:k,antialias:D,premultipliedAlpha:I,preserveDrawingBuffer:F},null===(gt=P||A.getContext("webgl",R)||A.getContext("experimental-webgl",R))){if(null!==A.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}A.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var vt=new m.WebGLExtensions(gt);vt.get("OES_texture_float"),vt.get("OES_texture_float_linear"),vt.get("OES_texture_half_float"),vt.get("OES_texture_half_float_linear"),vt.get("OES_standard_derivatives"),vt.get("ANGLE_instanced_arrays"),vt.get("OES_element_index_uint")&&(m.BufferGeometry.MaxIndex=4294967296);var yt=new m.WebGLCapabilities(gt,vt,t),xt=new m.WebGLState(gt,vt,L),bt=new m.WebGLProperties,_t=new m.WebGLObjects(gt,bt,this.info),Mt=new m.WebGLPrograms(this,yt),wt=new m.WebGLLights;this.info.programs=Mt.programs;var St=new m.WebGLBufferRenderer(gt,vt,mt),Et=new m.WebGLIndexedBufferRenderer(gt,vt,mt);r(),this.context=gt,this.capabilities=yt,this.extensions=vt,this.properties=bt,this.state=xt;var Tt=new m.WebGLShadowMap(this,dt,_t);this.shadowMap=Tt;var Ct=new m.SpritePlugin(this,H),Lt=new m.LensFlarePlugin(this,j);this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){vt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var t;return function(){if(void 0!==t)return t;var e=vt.get("EXT_texture_filter_anisotropic");return t=null!==e?gt.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return yt.precision},this.getPixelRatio=function(){return at},this.setPixelRatio=function(t){void 0!==t&&(at=t,this.setSize(ct.z,ct.w,!1))},this.getSize=function(){return{width:nt,height:ot}},this.setSize=function(t,e,r){nt=t,ot=e,A.width=t*at,A.height=e*at,!1!==r&&(A.style.width=t+"px",A.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){xt.viewport(ct.set(t,e,r,i))},this.setScissor=function(t,e,r,i){xt.scissor(st.set(t,e,r,i))},this.setScissorTest=function(t){xt.setScissorTest(ht=t)},this.getClearColor=function(){return rt},this.setClearColor=function(t,r){rt.set(t),it=void 0!==r?r:1,e(rt.r,rt.g,rt.b,it)},this.getClearAlpha=function(){return it},this.setClearAlpha=function(t){it=t,e(rt.r,rt.g,rt.b,it)},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=gt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=gt.STENCIL_BUFFER_BIT),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){A.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(t,e,r){xt.initAttributes();var i=bt.get(t);if(t.hasPositions&&!i.position&&(i.position=gt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=gt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=gt.createBuffer()),t.hasColors&&!i.color&&(i.color=gt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.position),gt.bufferData(gt.ARRAY_BUFFER,t.positionArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.position),gt.vertexAttribPointer(e.position,3,gt.FLOAT,!1,0,0)),t.hasNormals){if(gt.bindBuffer(gt.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===m.FlatShading)for(var n=0,o=3*t.count;n<o;n+=9){var a=t.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,h=(a[n+1]+a[n+4]+a[n+7])/3,c=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=h,a[n+2]=c,a[n+3]=s,a[n+4]=h,a[n+5]=c,a[n+6]=s,a[n+7]=h,a[n+8]=c}gt.bufferData(gt.ARRAY_BUFFER,t.normalArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.normal),gt.vertexAttribPointer(e.normal,3,gt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.uv),gt.bufferData(gt.ARRAY_BUFFER,t.uvArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.uv),gt.vertexAttribPointer(e.uv,2,gt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==m.NoColors&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.color),gt.bufferData(gt.ARRAY_BUFFER,t.colorArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.color),gt.vertexAttribPointer(e.color,3,gt.FLOAT,!1,0,0)),xt.disableUnusedAttributes(),gt.drawArrays(gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o){g(i);var a=v(t,e,i,n),s=!1;if((t=r.id+"_"+a.id+"_"+i.wireframe)!==Q&&(Q=t,s=!0),void 0!==(e=n.morphTargetInfluences)){t=[];for(var h=0,s=e.length;h<s;h++)d=e[h],t.push([d,h]);t.sort(c),8<t.length&&(t.length=8);for(var l=r.morphAttributes,h=0,s=t.length;h<s;h++)d=t[h],z[h]=d[0],0!==d[0]?(e=d[1],!0===i.morphTargets&&l.position&&r.addAttribute("morphTarget"+h,l.position[e]),!0===i.morphNormals&&l.normal&&r.addAttribute("morphNormal"+h,l.normal[e])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+h),!0===i.morphNormals&&r.removeAttribute("morphNormal"+h));null!==(t=a.getUniforms()).morphTargetInfluences&&gt.uniform1fv(t.morphTargetInfluences,z),s=!0}if(e=r.index,h=r.attributes.position,!0===i.wireframe&&(e=_t.getWireframeAttribute(r)),null!==e?(t=Et).setIndex(e):t=St,s){var u,s=void 0;if(r instanceof m.InstancedBufferGeometry&&null===(u=vt.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),xt.initAttributes();var p,d=r.attributes,a=a.getAttributes(),l=i.defaultAttributeValues;for(p in a){var f=a[p];if(0<=f)if(void 0!==(M=d[p])){var y=M.itemSize,x=_t.getAttributeBuffer(M);if(M instanceof m.InterleavedBufferAttribute){var b=M.data,_=b.stride,M=M.offset;b instanceof m.InstancedInterleavedBuffer?(xt.enableAttributeAndDivisor(f,b.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=b.meshPerAttribute*b.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,_*b.array.BYTES_PER_ELEMENT,(s*_+M)*b.array.BYTES_PER_ELEMENT)}else M instanceof m.InstancedBufferAttribute?(xt.enableAttributeAndDivisor(f,M.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=M.meshPerAttribute*M.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,0,s*y*4)}else if(void 0!==l&&void 0!==(y=l[p]))switch(y.length){case 2:gt.vertexAttrib2fv(f,y);break;case 3:gt.vertexAttrib3fv(f,y);break;case 4:gt.vertexAttrib4fv(f,y);break;default:gt.vertexAttrib1fv(f,y)}}xt.disableUnusedAttributes()}null!==e&&gt.bindBuffer(gt.ELEMENT_ARRAY_BUFFER,_t.getAttributeBuffer(e))}if(u=1/0,null!==e?u=e.count:void 0!==h&&(u=h.count),p=r.drawRange.start,e=r.drawRange.count,h=null!==o?o.start:0,s=null!==o?o.count:1/0,o=Math.max(0,p,h),u=Math.min(0+u,p+e,h+s)-1,u=Math.max(0,u-o+1),n instanceof m.Mesh)if(!0===i.wireframe)xt.setLineWidth(i.wireframeLinewidth*(null===q?at:1)),t.setMode(gt.LINES);else switch(n.drawMode){case m.TrianglesDrawMode:t.setMode(gt.TRIANGLES);break;case m.TriangleStripDrawMode:t.setMode(gt.TRIANGLE_STRIP);break;case m.TriangleFanDrawMode:t.setMode(gt.TRIANGLE_FAN)}else n instanceof m.Line?(void 0===(i=i.linewidth)&&(i=1),xt.setLineWidth(i*(null===q?at:1)),n instanceof m.LineSegments?t.setMode(gt.LINES):t.setMode(gt.LINE_STRIP)):n instanceof m.Points&&t.setMode(gt.POINTS);r instanceof m.InstancedBufferGeometry&&0<r.maxInstancedCount?t.renderInstances(r,o,u):t.render(o,u)},this.render=function(t,e,r,i){if(0==e instanceof m.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=t.fog;Q="",Z=-1,K=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ut.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),lt.setFromMatrix(ut),B.length=0,G=N=-1,H.length=0,j.length=0,d(t,e),V.length=N+1,O.length=G+1,!0===W.sortObjects&&(V.sort(l),O.sort(u));var o,a,s,h,c,p,g=B,v=0,y=0,x=0,b=e.matrixWorldInverse,_=0,w=0,S=0,E=0,T=0;for(o=dt.shadowsPointLight=0,a=g.length;o<a;o++)if(s=g[o],h=s.color,c=s.intensity,p=s.distance,s instanceof m.AmbientLight)v+=h.r*c,y+=h.g*c,x+=h.b*c;else if(s instanceof m.DirectionalLight){var C=wt.get(s);C.color.copy(s.color).multiplyScalar(s.intensity),C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.directionalShadowMap[_]=s.shadow.map,dt.directionalShadowMatrix[_]=s.shadow.matrix,dt.directional[_++]=C}else s instanceof m.SpotLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(h).multiplyScalar(c),C.distance=p,C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),C.angleCos=Math.cos(s.angle),C.exponent=s.exponent,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.spotShadowMap[S]=s.shadow.map,dt.spotShadowMatrix[S]=s.shadow.matrix,dt.spot[S++]=C):s instanceof m.PointLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(s.color).multiplyScalar(s.intensity),C.distance=s.distance,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.pointShadowMap[w]=s.shadow.map,void 0===dt.pointShadowMatrix[w]&&(dt.pointShadowMatrix[w]=new m.Matrix4),pt.setFromMatrixPosition(s.matrixWorld).negate(),dt.pointShadowMatrix[w].identity().setPosition(pt),dt.point[w++]=C):s instanceof m.HemisphereLight&&((C=wt.get(s)).direction.setFromMatrixPosition(s.matrixWorld),C.direction.transformDirection(b),C.direction.normalize(),C.skyColor.copy(s.color).multiplyScalar(c),C.groundColor.copy(s.groundColor).multiplyScalar(c),dt.hemi[E++]=C);dt.ambient[0]=v,dt.ambient[1]=y,dt.ambient[2]=x,dt.directional.length=_,dt.spot.length=S,dt.point.length=w,dt.hemi.length=E,dt.shadows.length=T,dt.hash=_+","+w+","+S+","+E+","+T,Tt.render(t,e),mt.calls=0,mt.vertices=0,mt.faces=0,mt.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),t.overrideMaterial?(i=t.overrideMaterial,f(V,e,n,i),f(O,e,n,i)):(xt.setBlending(m.NoBlending),f(V,e,n),f(O,e,n)),Ct.render(t,e),Lt.render(t,e,tt),r&&(t=r.texture).generateMipmaps&&M(r)&&t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter&&(t=r instanceof m.WebGLRenderTargetCube?gt.TEXTURE_CUBE_MAP:gt.TEXTURE_2D,r=bt.get(r.texture).__webglTexture,xt.bindTexture(t,r),gt.generateMipmap(t),xt.bindTexture(t,null)),xt.setDepthTest(!0),xt.setDepthWrite(!0),xt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){t===m.CullFaceNone?xt.disable(gt.CULL_FACE):(e===m.FrontFaceDirectionCW?gt.frontFace(gt.CW):gt.frontFace(gt.CCW),t===m.CullFaceBack?gt.cullFace(gt.BACK):t===m.CullFaceFront?gt.cullFace(gt.FRONT):gt.cullFace(gt.FRONT_AND_BACK),xt.enable(gt.CULL_FACE))},this.setTexture=function(t,e){var r=bt.get(t);if(0<t.version&&r.__version!==t.version)if(void 0===(n=t.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t);else{void 0===r.__webglInit&&(r.__webglInit=!0,t.addEventListener("dispose",o),r.__webglTexture=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,t.unpackAlignment);var i=_(t.image,yt.maxTextureSize);(t.wrapS!==m.ClampToEdgeWrapping||t.wrapT!==m.ClampToEdgeWrapping||t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter)&&!1===M(i)&&((n=i)instanceof HTMLImageElement||n instanceof HTMLCanvasElement?((a=document.createElement("canvas")).width=m.Math.nearestPowerOfTwo(n.width),a.height=m.Math.nearestPowerOfTwo(n.height),a.getContext("2d").drawImage(n,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+a.width+"x"+a.height,n),i=a):i=n);var n=M(i),a=L(t.format),s=L(t.type);b(gt.TEXTURE_2D,t,n);var h=t.mipmaps;if(t instanceof m.DataTexture)if(0<h.length&&n){for(var c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(t instanceof m.CompressedTexture)for(c=0,l=h.length;c<l;c++)i=h[c],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(a)?xt.compressedTexImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);else if(0<h.length&&n){for(c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,a,s,i);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,a,s,i);t.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(t){if((q=t)&&void 0===bt.get(t).__webglFramebuffer){var e=bt.get(t),r=bt.get(t.texture);t.addEventListener("dispose",a),r.__webglTexture=gt.createTexture(),ft.textures++;var i=t instanceof m.WebGLRenderTargetCube,n=m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height);if(i){e.__webglFramebuffer=[];for(var o=0;6>o;o++)e.__webglFramebuffer[o]=gt.createFramebuffer()}else e.__webglFramebuffer=gt.createFramebuffer();if(i){for(xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__webglTexture),b(gt.TEXTURE_CUBE_MAP,t.texture,n),o=0;6>o;o++)E(e.__webglFramebuffer[o],t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+o);t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),xt.bindTexture(gt.TEXTURE_CUBE_MAP,null)}else xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),b(gt.TEXTURE_2D,t.texture,n),E(e.__webglFramebuffer,t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_2D),t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),xt.bindTexture(gt.TEXTURE_2D,null);if(t.depthBuffer){if(e=bt.get(t),t instanceof m.WebGLRenderTargetCube)for(e.__webglDepthbuffer=[],r=0;6>r;r++)gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer[r]),e.__webglDepthbuffer[r]=gt.createRenderbuffer(),T(e.__webglDepthbuffer[r],t);else gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=gt.createRenderbuffer(),T(e.__webglDepthbuffer,t);gt.bindFramebuffer(gt.FRAMEBUFFER,null)}}e=t instanceof m.WebGLRenderTargetCube,t?(r=bt.get(t),r=e?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,J.copy(t.scissor),$=t.scissorTest,tt.copy(t.viewport)):(r=null,J.copy(st).multiplyScalar(at),$=ht,tt.copy(ct).multiplyScalar(at)),Y!==r&&(gt.bindFramebuffer(gt.FRAMEBUFFER,r),Y=r),xt.scissor(J),xt.setScissorTest($),xt.viewport(tt),e&&(e=bt.get(t.texture),gt.framebufferTexture2D(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,e.__webglTexture,0))},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(0==t instanceof m.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=bt.get(t).__webglFramebuffer;if(a){var s=!1;a!==Y&&(gt.bindFramebuffer(gt.FRAMEBUFFER,a),s=!0);try{var h=t.texture;h.format!==m.RGBAFormat&&L(h.format)!==gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===m.UnsignedByteType||L(h.type)===gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===m.FloatType&&vt.get("WEBGL_color_buffer_float")||h.type===m.HalfFloatType&&vt.get("EXT_color_buffer_half_float")?gt.checkFramebufferStatus(gt.FRAMEBUFFER)===gt.FRAMEBUFFER_COMPLETE?gt.readPixels(e,r,i,n,L(h.format),L(h.type),o):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{s&&gt.bindFramebuffer(gt.FRAMEBUFFER,Y)}}}}},m.WebGLRenderTarget=function(t,e,r){this.uuid=m.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new m.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new m.Vector4(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=m.LinearFilter),this.texture=new m.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer},m.WebGLRenderTarget.prototype={constructor:m.WebGLRenderTarget,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.shareDepthFrom=t.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube=function(t,e,r){m.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},m.WebGLRenderTargetCube.prototype=Object.create(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube.prototype.constructor=m.WebGLRenderTargetCube,m.WebGLBufferRenderer=function(t,e,r){var i;this.setMode=function(t){i=t},this.render=function(e,n){t.drawArrays(i,e,n),r.calls++,r.vertices+=n,i===t.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=e.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=n.attributes.position,s=0,s=a instanceof m.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},m.WebGLIndexedBufferRenderer=function(t,e,r){var i,n,o;this.setMode=function(t){i=t},this.setIndex=function(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(n=t.UNSIGNED_INT,o=4):(n=t.UNSIGNED_SHORT,o=2)},this.render=function(e,a){t.drawElements(i,a,n,e*o),r.calls++,r.vertices+=a,i===t.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,h){var c=e.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(i,h,n,s*o,a.maxInstancedCount),r.calls++,r.vertices+=h*a.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=a.maxInstancedCount*h/3))}},m.WebGLExtensions=function(t){var e={};this.get=function(r){if(void 0!==e[r])return e[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=i}},m.WebGLCapabilities=function(t,e,r){function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer&&r.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,(r=i(this.precision))!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},m.WebGLGeometries=function(t,e,r){function i(t){var a=t.target;null!==(t=o[a.id]).index&&n(t.index);var s,h=t.attributes;for(s in h)n(h[s]);a.removeEventListener("dispose",i),delete o[a.id],(s=e.get(a)).wireframe&&n(s.wireframe),e.delete(a),(a=e.get(t)).wireframe&&n(a.wireframe),e.delete(t),r.memory.geometries--}function n(r){var i;void 0!==(i=r instanceof m.InterleavedBufferAttribute?e.get(r.data).__webglBuffer:e.get(r).__webglBuffer)&&(t.deleteBuffer(i),r instanceof m.InterleavedBufferAttribute?e.delete(r.data):e.delete(r))}var o={};this.get=function(t){var e=t.geometry;if(void 0!==o[e.id])return o[e.id];e.addEventListener("dispose",i);var n;return e instanceof m.BufferGeometry?n=e:e instanceof m.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new m.BufferGeometry).setFromObject(t)),n=e._bufferGeometry),o[e.id]=n,r.memory.geometries++,n}},m.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new m.Vector3,color:new m.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"SpotLight":r={position:new m.Vector3,direction:new m.Vector3,color:new m.Color,distance:0,angleCos:0,exponent:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"PointLight":r={position:new m.Vector3,color:new m.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"HemisphereLight":r={direction:new m.Vector3,skyColor:new m.Color,groundColor:new m.Color}}return t[e.id]=r}},m.WebGLObjects=function(t,e,r){function i(r,i){var n=r instanceof m.InterleavedBufferAttribute?r.data:r,o=e.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=t.createBuffer(),t.bindBuffer(i,o.__webglBuffer),t.bufferData(i,n.array,n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(t.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?t.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),o.version=n.version)}function n(t,e,r){if(e>r){var i=e;e=r,r=i}return i=t[e],void 0===i?(t[e]=[r],!0):-1===i.indexOf(r)&&(i.push(r),!0)}var o=new m.WebGLGeometries(t,e,r);this.getAttributeBuffer=function(t){return t instanceof m.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer},this.getWireframeAttribute=function(r){var o=e.get(r);if(void 0!==o.wireframe)return o.wireframe;var a=[],s=r.index;if(r=(h=r.attributes).position,null!==s)for(var h={},s=s.array,c=0,l=s.length;c<l;c+=3){var u=s[c+0],p=s[c+1],d=s[c+2];n(h,u,p)&&a.push(u,p),n(h,p,d)&&a.push(p,d),n(h,d,u)&&a.push(d,u)}else for(s=h.position.array,c=0,l=s.length/3-1;c<l;c+=3)u=c+0,p=c+1,d=c+2,a.push(u,p,p,d,d,u);return a=new m.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),i(a,t.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(e){var r=o.get(e);e.geometry instanceof m.Geometry&&r.updateFromObject(e),e=r.index,a=r.attributes,null!==e&&i(e,t.ELEMENT_ARRAY_BUFFER);for(var n in a)i(a[n],t.ARRAY_BUFFER);e=r.morphAttributes;for(n in e)for(var a=e[n],s=0,h=a.length;s<h;s++)i(a[s],t.ARRAY_BUFFER);return r}},m.WebGLProgram=function(){function t(t,e,i){return t=t||{},[t.derivatives||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(r).join("\n")}function e(t){var e,r=[];for(e in t){var i=t[e];!1!==i&&r.push("#define "+e+" "+i)}return r.join("\n")}function r(t){return""!==t}function i(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function n(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,i){for(t="",e=parseInt(e);e<parseInt(r);e++)t+=i.replace(/\[ i \]/g,"[ "+e+" ]");return t})}var o=0,a=/^([\w\d_]+)\.([\w\d_]+)$/,s=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,h=/^([\w\d_]+)\[0\]$/;return function(c,l,u,p){var d=c.context,f=u.extensions,g=u.defines,v=u.__webglShader.vertexShader,y=u.__webglShader.fragmentShader,x="SHADOWMAP_TYPE_BASIC";p.shadowMapType===m.PCFShadowMap?x="SHADOWMAP_TYPE_PCF":p.shadowMapType===m.PCFSoftShadowMap&&(x="SHADOWMAP_TYPE_PCF_SOFT");var b="ENVMAP_TYPE_CUBE",_="ENVMAP_MODE_REFLECTION",M="ENVMAP_BLENDING_MULTIPLY";if(p.envMap){switch(u.envMap.mapping){case m.CubeReflectionMapping:case m.CubeRefractionMapping:b="ENVMAP_TYPE_CUBE";break;case m.EquirectangularReflectionMapping:case m.EquirectangularRefractionMapping:b="ENVMAP_TYPE_EQUIREC";break;case m.SphericalReflectionMapping:b="ENVMAP_TYPE_SPHERE"}switch(u.envMap.mapping){case m.CubeRefractionMapping:case m.EquirectangularRefractionMapping:_="ENVMAP_MODE_REFRACTION"}switch(u.combine){case m.MultiplyOperation:M="ENVMAP_BLENDING_MULTIPLY";break;case m.MixOperation:M="ENVMAP_BLENDING_MIX";break;case m.AddOperation:M="ENVMAP_BLENDING_ADD"}}var w=0<c.gammaFactor?c.gammaFactor:1,f=t(f,p,c.extensions),S=e(g),E=d.createProgram();u instanceof m.RawShaderMaterial?c=g="":(g=["precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+p.maxBones,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+_:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.displacementMap&&p.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.skinning?"#define USE_SKINNING":"",p.useVertexTexture?"#define BONE_TEXTURE":"",p.morphTargets?"#define USE_MORPHTARGETS":"",p.morphNormals&&!1===p.flatShading?"#define USE_MORPHNORMALS":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.sizeAttenuation?"#define USE_SIZEATTENUATION":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(r).join("\n"),c=[f,"precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.alphaTest?"#define ALPHATEST "+p.alphaTest:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,p.useFog&&p.fog?"#define USE_FOG":"",p.useFog&&p.fogExp?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+b:"",p.envMap?"#define "+_:"",p.envMap?"#define "+M:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",p.envMap&&c.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(r).join("\n")),v=i(v,p),y=i(y,p),0==u instanceof m.ShaderMaterial&&(v=n(v),y=n(y)),y=c+y,v=m.WebGLShader(d,d.VERTEX_SHADER,g+v),y=m.WebGLShader(d,d.FRAGMENT_SHADER,y),d.attachShader(E,v),d.attachShader(E,y),void 0!==u.index0AttributeName?d.bindAttribLocation(E,0,u.index0AttributeName):!0===p.morphTargets&&d.bindAttribLocation(E,0,"position"),d.linkProgram(E),p=d.getProgramInfoLog(E),x=d.getShaderInfoLog(v),b=d.getShaderInfoLog(y),M=_=!0,!1===d.getProgramParameter(E,d.LINK_STATUS)?(_=!1,console.error("THREE.WebGLProgram: shader error: ",d.getError(),"gl.VALIDATE_STATUS",d.getProgramParameter(E,d.VALIDATE_STATUS),"gl.getProgramInfoLog",p,x,b)):""!==p?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",p):""!==x&&""!==b||(M=!1),M&&(this.diagnostics={runnable:_,material:u,programLog:p,vertexShader:{log:x,prefix:g},fragmentShader:{log:b,prefix:c}}),d.deleteShader(v),d.deleteShader(y);var T;this.getUniforms=function(){if(void 0===T){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_UNIFORMS),r=0;r<e;r++){var i=d.getActiveUniform(E,r).name,n=d.getUniformLocation(E,i);if(o=a.exec(i)){var i=o[1],o=o[2];(c=t[i])||(c=t[i]={}),c[o]=n}else if(o=s.exec(i)){var c=o[1],i=o[2],o=o[3],l=t[c];l||(l=t[c]=[]),(c=l[i])||(c=l[i]={}),c[o]=n}else(o=h.exec(i))?(c=o[1],t[c]=n):t[i]=n}T=t}return T};var C;return this.getAttributes=function(){if(void 0===C){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var i=d.getActiveAttrib(E,r).name;t[i]=d.getAttribLocation(E,i)}C=t}return C},this.destroy=function(){d.deleteProgram(E),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=o++,this.code=l,this.usedTimes=1,this.program=E,this.vertexShader=v,this.fragmentShader=y,this}}(),m.WebGLPrograms=function(t,e){var r=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled pointLightShadows shadowMapType alphaTest doubleSided flipSided".split(" ");this.getParameters=function(r,n,o,a){var s,h=i[r.type];e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture?s=1024:(s=Math.floor((e.maxVertexUniforms-20)/4),void 0!==a&&a instanceof m.SkinnedMesh&&(s=Math.min(a.skeleton.bones.length,s))<a.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+a.skeleton.bones.length+", this GPU supports just "+s+" (try OpenGL instead of ANGLE)"));var c=t.getPrecision();return null!==r.precision&&(c=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",c,"instead."),{shaderID:h,precision:c,supportsVertexTextures:e.vertexTextures,map:!!r.map,envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:o,useFog:r.fog,fogExp:o instanceof m.FogExp2,flatShading:r.shading===m.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:s,useVertexTexture:e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numHemiLights:n.hemi.length,pointLightShadows:n.shadowsPointLight,shadowMapEnabled:t.shadowMap.enabled&&a.receiveShadow&&0<n.shadows.length,shadowMapType:t.shadowMap.type,alphaTest:r.alphaTest,doubleSided:r.side===m.DoubleSide,flipSided:r.side===m.BackSide}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(i=0;i<n.length;i++){var o=n[i];r.push(o),r.push(e[o])}return r.join()},this.acquireProgram=function(e,i,n){for(var o,a=0,s=r.length;a<s;a++){var h=r[a];if(h.code===n){++(o=h).usedTimes;break}}return void 0===o&&(o=new m.WebGLProgram(t,n,e,i),r.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r},m.WebGLProperties=function(){var t={};this.get=function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},this.delete=function(e){delete t[e.uuid]},this.clear=function(){t={}}},m.WebGLShader=function(){function t(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}return function(e,r,i){var n=e.createShader(r);return e.shaderSource(n,i),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),t(i)),n}}(),m.WebGLShadowMap=function(t,e,r){function i(t,e,r,i){var n=t.geometry,o=null,o=p,a=t.customDepthMaterial;return r&&(o=d,a=t.customDistanceMaterial),a?o=a:(t=t instanceof m.SkinnedMesh&&e.skinning,a=0,void 0!==n.morphTargets&&0<n.morphTargets.length&&e.morphTargets&&(a|=1),t&&(a|=2),o=o[a]),o.visible=e.visible,o.wireframe=e.wireframe,o.wireframeLinewidth=e.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(t,e,r){if(!1!==t.visible){t.layers.test(e.layers)&&(t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&t.castShadow&&(!1===t.frustumCulled||!0===s.intersectsObject(t))&&!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),u.push(t));for(var i=0,o=(t=t.children).length;i<o;i++)n(t[i],e,r)}}for(var o=t.context,a=t.state,s=new m.Frustum,h=new m.Matrix4,c=new m.Vector3,l=new m.Vector3,u=[],p=Array(4),d=Array(4),f=[new m.Vector3(1,0,0),new m.Vector3(-1,0,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1),new m.Vector3(0,1,0),new m.Vector3(0,-1,0)],g=[new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1)],v=[new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4],y=m.ShaderLib.depthRGBA,x=m.UniformsUtils.clone(y.uniforms),b=m.ShaderLib.distanceRGBA,_=m.UniformsUtils.clone(b.uniforms),M=0;4!==M;++M){var w=0!=(1&M),S=0!=(2&M),E=new m.ShaderMaterial({uniforms:x,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:w,skinning:S});E._shadowPass=!0,p[M]=E,(w=new m.ShaderMaterial({uniforms:_,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:w,skinning:S}))._shadowPass=!0,d[M]=w}var T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m.PCFShadowMap,this.cullFace=m.CullFaceFront,this.render=function(p,d){var y,x;if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)){a.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(T.cullFace===m.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var b=e.shadows,_=0,M=b.length;_<M;_++){var w=b[_],S=w.shadow,E=S.camera,C=S.mapSize;if(w instanceof m.PointLight){y=6,x=!0;var L=C.x/4,A=C.y/2;v[0].set(2*L,A,L,A),v[1].set(0,A,L,A),v[2].set(3*L,A,L,A),v[3].set(L,A,L,A),v[4].set(3*L,0,L,A),v[5].set(L,0,L,A)}else y=1,x=!1;for(null===S.map&&(S.map=new m.WebGLRenderTarget(C.x,C.y,{minFilter:m.LinearFilter,magFilter:m.LinearFilter,format:m.RGBAFormat}),w instanceof m.SpotLight&&(E.aspect=C.x/C.y),E.updateProjectionMatrix()),C=S.map,S=S.matrix,l.setFromMatrixPosition(w.matrixWorld),E.position.copy(l),t.setRenderTarget(C),t.clear(),C=0;C<y;C++)for(x?(c.copy(E.position),c.add(f[C]),E.up.copy(g[C]),E.lookAt(c),a.viewport(v[C])):(c.setFromMatrixPosition(w.target.matrixWorld),E.lookAt(c)),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),S.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),S.multiply(E.projectionMatrix),S.multiply(E.matrixWorldInverse),h.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),s.setFromMatrix(h),u.length=0,n(p,d,E),L=0,A=u.length;L<A;L++){var P=u[L],R=r.update(P);if((k=P.material)instanceof m.MultiMaterial)for(var U=R.groups,k=k.materials,D=0,I=U.length;D<I;D++){var F=U[D],B=k[F.materialIndex];!0===B.visible&&(B=i(P,B,x,l),t.renderBufferDirect(E,null,R,B,P,F))}else B=i(P,k,x,l),t.renderBufferDirect(E,null,R,B,P,null)}t.resetGLState()}y=t.getClearColor(),x=t.getClearAlpha(),t.setClearColor(y,x),a.enable(o.BLEND),T.cullFace===m.CullFaceFront&&o.cullFace(o.BACK),t.resetGLState(),T.needsUpdate=!1}}},m.WebGLState=function(t,e,r){var i=this,n=new m.Vector4,o=new Uint8Array(16),a=new Uint8Array(16),s=new Uint8Array(16),h={},c=null,l=null,u=null,p=null,d=null,f=null,g=null,v=null,y=null,x=null,b=null,_=null,M=null,w=null,S=null,E=null,T=null,C=null,L=null,A=null,P=null,R=null,U=null,k=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),D=void 0,I={},F=new m.Vector4,B=null,V=null,N=new m.Vector4,O=new m.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.frontFace(t.CCW),t.cullFace(t.BACK),this.enable(t.CULL_FACE),this.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var t=0,e=o.length;t<e;t++)o[t]=0},this.enableAttribute=function(r){o[r]=1,0===a[r]&&(t.enableVertexAttribArray(r),a[r]=1),0!==s[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),s[r]=0)},this.enableAttributeAndDivisor=function(e,r,i){o[e]=1,0===a[e]&&(t.enableVertexAttribArray(e),a[e]=1),s[e]!==r&&(i.vertexAttribDivisorANGLE(e,r),s[e]=r)},this.disableUnusedAttributes=function(){for(var e=0,r=a.length;e<r;e++)a[e]!==o[e]&&(t.disableVertexAttribArray(e),a[e]=0)},this.enable=function(e){!0!==h[e]&&(t.enable(e),h[e]=!0)},this.disable=function(e){!1!==h[e]&&(t.disable(e),h[e]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)c.push(r[i]);return c},this.setBlending=function(e,i,n,o,a,s,h){e===m.NoBlending?this.disable(t.BLEND):this.enable(t.BLEND),e!==l&&(e===m.AdditiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===m.SubtractiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===m.MultiplyBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),l=e),e===m.CustomBlending?(a=a||i,s=s||n,h=h||o,i===u&&a===f||(t.blendEquationSeparate(r(i),r(a)),u=i,f=a),n===p&&o===d&&s===g&&h===v||(t.blendFuncSeparate(r(n),r(o),r(s),r(h)),p=n,d=o,g=s,v=h)):v=g=f=d=p=u=null},this.setDepthFunc=function(e){if(y!==e){if(e)switch(e){case m.NeverDepth:t.depthFunc(t.NEVER);break;case m.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case m.LessDepth:t.depthFunc(t.LESS);break;case m.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case m.EqualDepth:t.depthFunc(t.EQUAL);break;case m.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case m.GreaterDepth:t.depthFunc(t.GREATER);break;case m.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);y=e}},this.setDepthTest=function(e){e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)},this.setDepthWrite=function(e){x!==e&&(t.depthMask(e),x=e)},this.setColorWrite=function(e){b!==e&&(t.colorMask(e,e,e,e),b=e)},this.setStencilFunc=function(e,r,i){M===e&&w===r&&S===i||(t.stencilFunc(e,r,i),M=e,w=r,S=i)},this.setStencilOp=function(e,r,i){E===e&&T===r&&C===i||(t.stencilOp(e,r,i),E=e,T=r,C=i)},this.setStencilTest=function(e){e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)},this.setStencilWrite=function(e){_!==e&&(t.stencilMask(e),_=e)},this.setFlipSided=function(e){L!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),L=e)},this.setLineWidth=function(e){e!==A&&(t.lineWidth(e),A=e)},this.setPolygonOffset=function(e,r,i){e?this.enable(t.POLYGON_OFFSET_FILL):this.disable(t.POLYGON_OFFSET_FILL),!e||P===r&&R===i||(t.polygonOffset(r,i),P=r,R=i)},this.getScissorTest=function(){return U},this.setScissorTest=function(e){(U=e)?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+k-1),D!==e&&(t.activeTexture(e),D=e)},this.bindTexture=function(e,r){void 0===D&&i.activeTexture();var n=I[D];void 0===n&&(n={type:void 0,texture:void 0},I[D]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r),n.type=e,n.texture=r)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.clearColor=function(e,r,i,o){n.set(e,r,i,o),!1===F.equals(n)&&(t.clearColor(e,r,i,o),F.copy(n))},this.clearDepth=function(e){B!==e&&(t.clearDepth(e),B=e)},this.clearStencil=function(e){V!==e&&(t.clearStencil(e),V=e)},this.scissor=function(e){!1===N.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),N.copy(e))},this.viewport=function(e){!1===O.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),O.copy(e))},this.reset=function(){for(var e=0;e<a.length;e++)1===a[e]&&(t.disableVertexAttribArray(e),a[e]=0);h={},L=_=x=b=l=c=null}},m.LensFlarePlugin=function(t,e){var r,i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x=t.context,b=t.state;this.render=function(_,M,w){if(0!==e.length){_=new m.Vector3;var S=w.w/w.z,E=.5*w.z,T=.5*w.w,C=16/w.w,L=new m.Vector2(C*S,C),A=new m.Vector3(1,1,0),P=new m.Vector2(1,1);if(void 0===f){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),R=new Uint16Array([0,1,2,0,2,3]);p=x.createBuffer(),d=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,p),x.bufferData(x.ARRAY_BUFFER,C,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),x.bufferData(x.ELEMENT_ARRAY_BUFFER,R,x.STATIC_DRAW),v=x.createTexture(),y=x.createTexture(),b.bindTexture(x.TEXTURE_2D,v),x.texImage2D(x.TEXTURE_2D,0,x.RGB,16,16,0,x.RGB,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST),b.bindTexture(x.TEXTURE_2D,y),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,16,16,0,x.RGBA,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST);var C=(g=0<x.getParameter(x.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},R=x.createProgram(),U=x.createShader(x.FRAGMENT_SHADER),k=x.createShader(x.VERTEX_SHADER),D="precision "+t.getPrecision()+" float;\n";x.shaderSource(U,D+C.fragmentShader),x.shaderSource(k,D+C.vertexShader),x.compileShader(U),x.compileShader(k),x.attachShader(R,U),x.attachShader(R,k),x.linkProgram(R),f=R,l=x.getAttribLocation(f,"position"),u=x.getAttribLocation(f,"uv"),r=x.getUniformLocation(f,"renderType"),i=x.getUniformLocation(f,"map"),n=x.getUniformLocation(f,"occlusionMap"),o=x.getUniformLocation(f,"opacity"),a=x.getUniformLocation(f,"color"),s=x.getUniformLocation(f,"scale"),h=x.getUniformLocation(f,"rotation"),c=x.getUniformLocation(f,"screenPosition")}for(x.useProgram(f),b.initAttributes(),b.enableAttribute(l),b.enableAttribute(u),b.disableUnusedAttributes(),x.uniform1i(n,0),x.uniform1i(i,1),x.bindBuffer(x.ARRAY_BUFFER,p),x.vertexAttribPointer(l,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),b.disable(x.CULL_FACE),b.setDepthWrite(!1),R=0,U=e.length;R<U;R++)if(C=16/w.w,L.set(C*S,C),k=e[R],_.set(k.matrixWorld.elements[12],k.matrixWorld.elements[13],k.matrixWorld.elements[14]),_.applyMatrix4(M.matrixWorldInverse),_.applyProjection(M.projectionMatrix),A.copy(_),P.x=A.x*E+E,P.y=A.y*T+T,g||0<P.x&&P.x<w.z&&0<P.y&&P.y<w.w){b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,null),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGB,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,0),x.uniform2f(s,L.x,L.y),x.uniform3f(c,A.x,A.y,A.z),b.disable(x.BLEND),b.enable(x.DEPTH_TEST),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,y),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGBA,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,1),b.disable(x.DEPTH_TEST),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),k.positionScreen.copy(A),k.customUpdateCallback?k.customUpdateCallback(k):k.updateLensFlares(),x.uniform1i(r,2),b.enable(x.BLEND);for(var D=0,I=k.lensFlares.length;D<I;D++){var F=k.lensFlares[D];.001<F.opacity&&.001<F.scale&&(A.x=F.x,A.y=F.y,A.z=F.z,C=F.size*F.scale/w.w,L.x=C*S,L.y=C,x.uniform3f(c,A.x,A.y,A.z),x.uniform2f(s,L.x,L.y),x.uniform1f(h,F.rotation),x.uniform1f(o,F.opacity),x.uniform3f(a,F.color.r,F.color.g,F.color.b),b.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),t.setTexture(F.texture,1),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0))}}b.enable(x.CULL_FACE),b.enable(x.DEPTH_TEST),b.setDepthWrite(!0),t.resetGLState()}}},m.SpritePlugin=function(t,e){function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x,b,_,M,w,S,E=t.context,T=t.state,C=new m.Vector3,L=new m.Quaternion,A=new m.Vector3;this.render=function(P,R){if(0!==e.length){if(void 0===w){var U=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),k=new Uint16Array([0,1,2,0,2,3]);_=E.createBuffer(),M=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,U,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.bufferData(E.ELEMENT_ARRAY_BUFFER,k,E.STATIC_DRAW);var U=E.createProgram(),k=E.createShader(E.VERTEX_SHADER),D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(k,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),E.shaderSource(D,["precision "+t.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),E.compileShader(k),E.compileShader(D),E.attachShader(U,k),E.attachShader(U,D),E.linkProgram(U),w=U,x=E.getAttribLocation(w,"position"),b=E.getAttribLocation(w,"uv"),i=E.getUniformLocation(w,"uvOffset"),n=E.getUniformLocation(w,"uvScale"),o=E.getUniformLocation(w,"rotation"),a=E.getUniformLocation(w,"scale"),s=E.getUniformLocation(w,"color"),h=E.getUniformLocation(w,"map"),c=E.getUniformLocation(w,"opacity"),l=E.getUniformLocation(w,"modelViewMatrix"),u=E.getUniformLocation(w,"projectionMatrix"),p=E.getUniformLocation(w,"fogType"),d=E.getUniformLocation(w,"fogDensity"),f=E.getUniformLocation(w,"fogNear"),g=E.getUniformLocation(w,"fogFar"),v=E.getUniformLocation(w,"fogColor"),y=E.getUniformLocation(w,"alphaTest"),(U=document.createElement("canvas")).width=8,U.height=8,(k=U.getContext("2d")).fillStyle="white",k.fillRect(0,0,8,8),(S=new m.Texture(U)).needsUpdate=!0}E.useProgram(w),T.initAttributes(),T.enableAttribute(x),T.enableAttribute(b),T.disableUnusedAttributes(),T.disable(E.CULL_FACE),T.enable(E.BLEND),E.bindBuffer(E.ARRAY_BUFFER,_),E.vertexAttribPointer(x,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(b,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.uniformMatrix4fv(u,!1,R.projectionMatrix.elements),T.activeTexture(E.TEXTURE0),E.uniform1i(h,0),k=U=0,(D=P.fog)?(E.uniform3f(v,D.color.r,D.color.g,D.color.b),D instanceof m.Fog?(E.uniform1f(f,D.near),E.uniform1f(g,D.far),E.uniform1i(p,1),k=U=1):D instanceof m.FogExp2&&(E.uniform1f(d,D.density),E.uniform1i(p,2),k=U=2)):(E.uniform1i(p,0),k=U=0);for(var D=0,I=e.length;D<I;D++)(B=e[D]).modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,B.matrixWorld),B.z=-B.modelViewMatrix.elements[14];e.sort(r);for(var F=[],D=0,I=e.length;D<I;D++){var B=e[D],V=B.material;E.uniform1f(y,V.alphaTest),E.uniformMatrix4fv(l,!1,B.modelViewMatrix.elements),B.matrixWorld.decompose(C,L,A),F[0]=A.x,F[1]=A.y,B=0,P.fog&&V.fog&&(B=k),U!==B&&(E.uniform1i(p,B),U=B),null!==V.map?(E.uniform2f(i,V.map.offset.x,V.map.offset.y),E.uniform2f(n,V.map.repeat.x,V.map.repeat.y)):(E.uniform2f(i,0,0),E.uniform2f(n,1,1)),E.uniform1f(c,V.opacity),E.uniform3f(s,V.color.r,V.color.g,V.color.b),E.uniform1f(o,V.rotation),E.uniform2fv(a,F),T.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),T.setDepthTest(V.depthTest),T.setDepthWrite(V.depthWrite),V.map&&V.map.image&&V.map.image.width?t.setTexture(V.map,0):t.setTexture(S,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}T.enable(E.CULL_FACE),t.resetGLState()}}},Object.defineProperties(m.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}}}),Object.defineProperties(m.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Matrix3.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}}),Object.defineProperties(m.Matrix4.prototype,{extractPosition:{value:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)}},setRotationFromQuaternion:{value:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)}},multiplyVector3:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)}},multiplyVector4:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}},rotateAxis:{value:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)}},crossVector:{value:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},translate:{value:function(t){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(m.Plane.prototype,{isIntersectionLine:{value:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}}),Object.defineProperties(m.Quaternion.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)}}}),Object.defineProperties(m.Ray.prototype,{isIntersectionBox:{value:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionPlane:{value:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)}},getScaleFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)}},getColumnFromMatrix:{value:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}}),m.Face4=function(t,e,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new m.Face3(t,e,r,n,o,a)},Object.defineProperties(m.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},getChildByName:{value:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)}},renderDepth:{set:function(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(m,{PointCloud:{value:function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new m.Points(t,e)}},ParticleSystem:{value:function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new m.Points(t,e)}}}),Object.defineProperties(m.Light.prototype,{onlyShadow:{set:function(t){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(t){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(m.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(m.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)}},addDrawCall:{value:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(m.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new m.Color}}}),Object.defineProperties(m,{PointCloudMaterial:{value:function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleBasicMaterial:{value:function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleSystemMaterial:{value:function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}}}),Object.defineProperties(m.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(m.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.defineProperties(m.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(m.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),m.GeometryUtils={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e instanceof m.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},m.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new m.TextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new m.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},m.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},m.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},m.MeshFaceMaterial=m.MultiMaterial,m.CurveUtils={tangentQuadraticBezier:function(t,e,r,i){return 2*(1-t)*(r-e)+2*t*(i-r)},tangentCubicBezier:function(t,e,r,i,n){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*n},tangentSpline:function(t,e,r,i,n){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,i,n){var o=n*n;return(2*e-2*r+(t=.5*(r-t))+(i=.5*(i-e)))*n*o+(-3*e+3*r-2*t-i)*o+t*n+e}},m.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new m.Group,i=0,n=e.length;i<n;i++)r.add(new m.Mesh(t,e[i]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var i=new m.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),e.remove(t),r.add(t)}},m.ShapeUtils={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(t,e){var r=t.length;if(3>r)return null;var i,n,o,a=[],s=[],h=[];if(0<m.ShapeUtils.area(t))for(n=0;n<r;n++)s[n]=n;else for(n=0;n<r;n++)s[n]=r-1-n;var c=2*r;for(n=r-1;2<r;){if(0>=c--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);var l;t:{var u=l=void 0,p=void 0,d=void 0,f=void 0,g=void 0,v=void 0,y=void 0,x=void 0,u=t[s[i]].x,p=t[s[i]].y,d=t[s[n]].x,f=t[s[n]].y,g=t[s[o]].x,v=t[s[o]].y;if(Number.EPSILON>(d-u)*(v-p)-(f-p)*(g-u))l=!1;else{var b=void 0,_=void 0,M=void 0,w=void 0,S=void 0,E=void 0,T=void 0,C=void 0,L=void 0,A=void 0,L=C=T=x=y=void 0,b=g-d,_=v-f,M=u-g,w=p-v,S=d-u,E=f-p;for(l=0;l<r;l++)if(y=t[s[l]].x,x=t[s[l]].y,!(y===u&&x===p||y===d&&x===f||y===g&&x===v)&&(T=y-u,C=x-p,L=y-d,A=x-f,y-=g,x-=v,L=b*A-_*L,T=S*C-E*T,C=M*x-w*y,L>=-Number.EPSILON&&C>=-Number.EPSILON&&T>=-Number.EPSILON)){l=!1;break t}l=!0}}if(l){for(a.push([t[s[i]],t[s[n]],t[s[o]]]),h.push([s[i],s[n],s[o]]),i=n,o=n+1;o<r;i++,o++)s[i]=s[o];c=2*--r}}return e?h:a},triangulateShape:function(t,e){function r(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,i,n,o){var a=e.x-t.x,s=e.y-t.y,h=n.x-i.x,c=n.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*h-a*c,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>d||d>p)return[];if(0>(h=c*l-h*u)||h>p)return[]}else{if(0<d||d<p)return[];if(0<(h=c*l-h*u)||h<p)return[]}return 0===h?!o||0!==d&&d!==p?[t]:[]:h===p?!o||0!==d&&d!==p?[e]:[]:0===d?[i]:d===p?[n]:(o=h/p,[{x:t.x+o*a,y:t.y+o*s}])}return 0!==d||c*l!=h*u?[]:(s=0===a&&0===s,h=0===h&&0===c,s&&h?t.x!==i.x||t.y!==i.y?[]:[t]:s?r(i,n,t)?[t]:[]:h?r(t,e,i)?[i]:[]:(0!==a?(t.x<e.x?(a=t,h=t.x,s=e,t=e.x):(a=e,h=e.x,s=t,t=t.x),i.x<n.x?(e=i,p=i.x,c=n,i=n.x):(e=n,p=n.x,c=i,i=i.x)):(t.y<e.y?(a=t,h=t.y,s=e,t=e.y):(a=e,h=e.y,s=t,t=t.y),i.y<n.y?(e=i,p=i.y,c=n,i=n.y):(e=n,p=n.y,c=i,i=i.y)),h<=p?t<p?[]:t===p?o?[]:[e]:t<=i?[e,s]:[e,c]:h>i?[]:h===i?o?[]:[a]:t<=i?[a,s]:[a,c]))}function n(t,e,r,i){var n=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=i.x-t.x;return i=i.y-t.y,t=n*r-o*e,n=n*i-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}var o,a,s,h,c,l={};for(s=t.concat(),o=0,a=e.length;o<a;o++)Array.prototype.push.apply(s,e[o]);for(o=0,a=s.length;o<a;o++)c=s[o].x+":"+s[o].y,void 0!==l[c]&&console.warn("THREE.Shape: Duplicate point",c),l[c]=o;o=function(t,e){var r,o,a,s,h,c,l,u,p,d=t.concat(),f=[],m=[],g=0;for(o=e.length;g<o;g++)f.push(g);l=0;for(var v=2*f.length;0<f.length;){if(0>--v){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(a=l;a<d.length;a++){for(s=d[a],o=-1,g=0;g<f.length;g++)if(h=f[g],c=s.x+":"+s.y+":"+h,void 0===m[c]){for(r=e[h],u=0;u<r.length;u++)if(h=r[u],function(t,e){var i=d.length-1,o=t-1;0>o&&(o=i);var a=t+1;return a>i&&(a=0),!!(i=n(d[t],d[o],d[a],r[e]))&&(i=r.length-1,0>(o=e-1)&&(o=i),(a=e+1)>i&&(a=0),!!(i=n(r[e],r[o],r[a],d[t])))}(a,u)&&!function(t,e){var r,n;for(r=0;r<d.length;r++)if(n=r+1,n%=d.length,0<(n=i(t,e,d[r],d[n],!0)).length)return!0;return!1}(s,h)&&!function(t,r){var n,o,a,s;for(n=0;n<f.length;n++)for(o=e[f[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,0<(s=i(t,r,o[a],o[s],!0)).length)return!0;return!1}(s,h)){o=u,f.splice(g,1),l=d.slice(0,a+1),h=d.slice(a),u=r.slice(o),p=r.slice(0,o+1),d=l.concat(u).concat(p).concat(h),l=a;break}if(0<=o)break;m[c]=!0}if(0<=o)break}}return d}(t,e);var u=m.ShapeUtils.triangulate(o,!1);for(o=0,a=u.length;o<a;o++)for(h=u[o],s=0;3>s;s++)c=h[s].x+":"+h[s].y,void 0!==(c=l[c])&&(h[s]=c);return u.concat()},isClockWise:function(t){return 0>m.ShapeUtils.area(t)},b2:function(t,e,r,i){var n=1-t;return n*n*e+2*(1-t)*t*r+t*t*i},b3:function(t,e,r,i,n){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*i+t*t*t*n}},m.Curve=function(){},m.Curve.prototype={constructor:m.Curve,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPoint(e/t));return r},getSpacedPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPointAt(e/t));return r},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),o+=e.distanceTo(n),i.push(o),n=e;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,h=o-1;s<=h;)if(n=Math.floor(s+(h-s)/2),0>(a=i[n]-r))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return n=h,i[n]===r?n/(o-1):(s=i[n],i=(n+(r-s)/(i[n+1]-s))/(o-1))},getTangent:function(t){var e=t-1e-4;return t+=1e-4,0>e&&(e=0),1<t&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)}},m.Curve.create=function(t,e){return t.prototype=Object.create(m.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},m.CurvePath=function(){this.curves=[],this.autoClose=!1},m.CurvePath.prototype=Object.create(m.Curve.prototype),m.CurvePath.prototype.constructor=m.CurvePath,m.CurvePath.prototype.add=function(t){this.curves.push(t)},m.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new m.LineCurve(e,t))},m.CurvePath.prototype.getPoint=function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=e)return t=this.curves[i],e=1-(r[i]-e)/t.getLength(),t.getPointAt(e);i++}return null},m.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},m.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},m.CurvePath.prototype.createPointsGeometry=function(t){return t=this.getPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createSpacedPointsGeometry=function(t){return t=this.getSpacedPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createGeometry=function(t){for(var e=new m.Geometry,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new m.Vector3(n.x,n.y,n.z||0))}return e},m.Font=function(t){this.data=t},m.Font.prototype={constructor:m.Font,generateShapes:function(t,e,r){void 0===e&&(e=100),void 0===r&&(r=4);var i=this.data;t=String(t).split("");var n=e/i.resolution,o=0;e=[];for(var a=0;a<t.length;a++){var s;s=n;var h=o,c=i.glyphs[t[a]]||i.glyphs["?"];if(c){var l=new m.Path,u=[],p=m.ShapeUtils.b2,d=m.ShapeUtils.b3,f=void 0,g=void 0,v=g=f=void 0,y=void 0,x=void 0,b=void 0,_=void 0,M=void 0,y=void 0;if(c.o)for(var w=c._cachedOutline||(c._cachedOutline=c.o.split(" ")),S=0,E=w.length;S<E;)switch(w[S++]){case"m":f=w[S++]*s+h,g=w[S++]*s,l.moveTo(f,g);break;case"l":f=w[S++]*s+h,g=w[S++]*s,l.lineTo(f,g);break;case"q":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,l.quadraticCurveTo(x,b,f,g),y=u[u.length-1])for(var v=y.x,y=y.y,T=1;T<=r;T++){var C=T/r;p(C,v,x,f),p(C,y,b,g)}break;case"b":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,_=w[S++]*s+h,M=w[S++]*s,l.bezierCurveTo(x,b,_,M,f,g),y=u[u.length-1])for(v=y.x,y=y.y,T=1;T<=r;T++)C=T/r,d(C,v,x,_,f),d(C,y,b,M,g)}s={offset:c.ha*s,path:l}}else s=void 0;o+=s.offset,e.push(s.path)}for(r=[],i=0,t=e.length;i<t;i++)Array.prototype.push.apply(r,e[i].toShapes());return r}},m.Path=function(t){m.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},m.Path.prototype=Object.create(m.CurvePath.prototype),m.Path.prototype.constructor=m.Path,m.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},m.Path.prototype.moveTo=function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},m.Path.prototype.lineTo=function(t,e){var r=this.actions[this.actions.length-1].args,r=new m.LineCurve(new m.Vector2(r[r.length-2],r[r.length-1]),new m.Vector2(t,e));this.curves.push(r),this.actions.push({action:"lineTo",args:[t,e]})},m.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=this.actions[this.actions.length-1].args,n=new m.QuadraticBezierCurve(new m.Vector2(n[n.length-2],n[n.length-1]),new m.Vector2(t,e),new m.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[t,e,r,i]})},m.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new m.CubicBezierCurve(new m.Vector2(a[a.length-2],a[a.length-1]),new m.Vector2(t,e),new m.Vector2(r,i),new m.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[t,e,r,i,n,o]})},m.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,r=[new m.Vector2(r[r.length-2],r[r.length-1])];Array.prototype.push.apply(r,t),r=new m.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:e})},m.Path.prototype.arc=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(t+a[a.length-2],e+a[a.length-1],r,i,n,o)},m.Path.prototype.absarc=function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},m.Path.prototype.ellipse=function(t,e,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(t+h[h.length-2],e+h[h.length-1],r,i,n,o,a,s)},m.Path.prototype.absellipse=function(t,e,r,i,n,o,a,s){var h=[t,e,r,i,n,o,a,s||0];t=new m.EllipseCurve(t,e,r,i,n,o,a,s),this.curves.push(t),t=t.getPoint(1),h.push(t.x),h.push(t.y),this.actions.push({action:"ellipse",args:h})},m.Path.prototype.getSpacedPoints=function(t){t||(t=40);for(var e=[],r=0;r<t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},m.Path.prototype.getPoints=function(t){t=t||12;for(var e,r,i,n,o,a,s,h,c,l,u=m.ShapeUtils.b2,p=m.ShapeUtils.b3,d=[],f=0,g=this.actions.length;f<g;f++){var v=(c=this.actions[f]).args;switch(c.action){case"moveTo":case"lineTo":d.push(new m.Vector2(v[0],v[1]));break;case"quadraticCurveTo":for(e=v[2],r=v[3],o=v[0],a=v[1],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=u(l,s,o,e),l=u(l,h,a,r),d.push(new m.Vector2(c,l));break;case"bezierCurveTo":for(e=v[4],r=v[5],o=v[0],a=v[1],i=v[2],n=v[3],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=p(l,s,o,i,e),l=p(l,h,a,n,r),d.push(new m.Vector2(c,l));break;case"splineThru":for(c=this.actions[f-1].args,l=[new m.Vector2(c[c.length-2],c[c.length-1])],c=t*v[0].length,l=l.concat(v[0]),l=new m.SplineCurve(l),v=1;v<=c;v++)d.push(l.getPointAt(v/c));break;case"arc":for(e=v[0],r=v[1],a=v[2],i=v[3],c=v[4],o=!!v[5],s=c-i,h=2*t,v=1;v<=h;v++)l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new m.Vector2(c,l));break;case"ellipse":e=v[0],r=v[1],a=v[2],n=v[3],i=v[4],c=v[5],o=!!v[6];var y=v[7];s=c-i,h=2*t;var x,b;for(0!==y&&(x=Math.cos(y),b=Math.sin(y)),v=1;v<=h;v++){if(l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+n*Math.sin(l),0!==y){var _=c;c=(_-e)*x-(l-r)*b+e,l=(_-e)*b+(l-r)*x+r}d.push(new m.Vector2(c,l))}}}return t=d[d.length-1],Math.abs(t.x-d[0].x)<Number.EPSILON&&Math.abs(t.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},m.Path.prototype.toShapes=function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new m.Shape;o.actions=n.actions,o.curves=n.curves,e.push(o)}return e}var i=m.ShapeUtils.isClockWise,n=function(t){for(var e=[],r=new m.Path,i=0,n=t.length;i<n;i++){var o=t[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(e.push(r),r=new m.Path),r[o].apply(r,a)}return 0!==r.actions.length&&e.push(r),e}(this.actions);if(0===n.length)return[];if(!0===e)return r(n);var o,a,s,h=[];if(1===n.length)return a=n[0],s=new m.Shape,s.actions=a.actions,s.curves=a.curves,h.push(s),h;var c=!i(n[0].getPoints()),c=t?!c:c;s=[];var l,u=[],p=[],d=0;u[d]=void 0,p[d]=[];for(var f=0,g=n.length;f<g;f++)a=n[f],l=a.getPoints(),o=i(l),(o=t?!o:o)?(!c&&u[d]&&d++,u[d]={s:new m.Shape,p:l},u[d].s.actions=a.actions,u[d].s.curves=a.curves,c&&d++,p[d]=[]):p[d].push({h:a,p:l[0]});if(!u[0])return r(n);if(1<u.length){for(f=!1,a=[],i=0,n=u.length;i<n;i++)s[i]=[];for(i=0,n=u.length;i<n;i++)for(o=p[i],c=0;c<o.length;c++){for(d=o[c],l=!0,g=0;g<u.length;g++)(function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=e[o],h=-h,s=e[n],c=-c),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0==(n=c*(t.x-a.x)-h*(t.y-a.y)))return!0;0>n||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return i})(d.p,u[g].p)&&(i!==g&&a.push({froms:i,tos:g,hole:c}),l?(l=!1,s[g].push(d)):f=!0);l&&s[i].push(d)}0<a.length&&(f||(p=s))}for(f=0,i=u.length;f<i;f++)for(s=u[f].s,h.push(s),a=p[f],n=0,o=a.length;n<o;n++)s.holes.push(a[n].h);return h},m.Shape=function(){m.Path.apply(this,arguments),this.holes=[]},m.Shape.prototype=Object.create(m.Path.prototype),m.Shape.prototype.constructor=m.Shape,m.Shape.prototype.extrude=function(t){return new m.ExtrudeGeometry(this,t)},m.Shape.prototype.makeGeometry=function(t){return new m.ShapeGeometry(this,t)},m.Shape.prototype.getPointsHoles=function(t){for(var e=[],r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e},m.Shape.prototype.extractAllPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},m.Shape.prototype.extractPoints=function(t){return this.extractAllPoints(t)},m.LineCurve=function(t,e){this.v1=t,this.v2=e},m.LineCurve.prototype=Object.create(m.Curve.prototype),m.LineCurve.prototype.constructor=m.LineCurve,m.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},m.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},m.LineCurve.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},m.QuadraticBezierCurve=function(t,e,r){this.v0=t,this.v1=e,this.v2=r},m.QuadraticBezierCurve.prototype=Object.create(m.Curve.prototype),m.QuadraticBezierCurve.prototype.constructor=m.QuadraticBezierCurve,m.QuadraticBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b2;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},m.QuadraticBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentQuadraticBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},m.CubicBezierCurve=function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},m.CubicBezierCurve.prototype=Object.create(m.Curve.prototype),m.CubicBezierCurve.prototype.constructor=m.CubicBezierCurve,m.CubicBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b3;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},m.CubicBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentCubicBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},m.SplineCurve=function(t){this.points=void 0==t?[]:t},m.SplineCurve.prototype=Object.create(m.Curve.prototype),m.SplineCurve.prototype.constructor=m.SplineCurve,m.SplineCurve.prototype.getPoint=function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0===o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector2(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t))},m.EllipseCurve=function(t,e,r,i,n,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},m.EllipseCurve.prototype=Object.create(m.Curve.prototype),m.EllipseCurve.prototype.constructor=m.EllipseCurve,m.EllipseCurve.prototype.getPoint=function(t){0>(r=this.aEndAngle-this.aStartAngle)&&(r+=2*Math.PI),r>2*Math.PI&&(r-=2*Math.PI),r=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-r):this.aStartAngle+t*r,t=this.aX+this.xRadius*Math.cos(r);var e=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var r=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=t;t=(n-this.aX)*r-(e-this.aY)*i+this.aX,e=(n-this.aX)*i+(e-this.aY)*r+this.aY}return new m.Vector2(t,e)},m.ArcCurve=function(t,e,r,i,n,o){m.EllipseCurve.call(this,t,e,r,r,i,n,o)},m.ArcCurve.prototype=Object.create(m.EllipseCurve.prototype),m.ArcCurve.prototype.constructor=m.ArcCurve,m.LineCurve3=m.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new m.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),m.QuadraticBezierCurve3=m.Curve.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=m.ShapeUtils.b2;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),m.CubicBezierCurve3=m.Curve.create(function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},function(t){var e=m.ShapeUtils.b3;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),m.SplineCurve3=m.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==t?[]:t},function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0==o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),m.CatmullRomCurve3=function(){function t(){}var e=new m.Vector3,r=new t,i=new t,n=new t;return t.prototype.init=function(t,e,r,i){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-i,this.c3=2*t-2*e+r+i},t.prototype.initNonuniformCatmullRom=function(t,e,r,i,n,o,a){t=((e-t)/n-(r-t)/(n+o)+(r-e)/o)*o,i=((r-e)/o-(i-e)/(o+a)+(i-r)/a)*o,this.init(e,r,t,i)},t.prototype.initCatmullRom=function(t,e,r,i,n){this.init(e,r,n*(r-t),n*(i-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},m.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s=this.points;2>(a=s.length)&&console.log("duh, you need at least 2 points"),t*=a-(this.closed?0:1),t-=o=Math.floor(t),this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===t&&o===a-1&&(o=a-2,t=1);var h,c,l;if(this.closed||0<o?h=s[(o-1)%a]:(e.subVectors(s[0],s[1]).add(s[0]),h=e),c=s[o%a],l=s[(o+1)%a],this.closed||o+2<a?s=s[(o+2)%a]:(e.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(h.distanceToSquared(c),u),o=Math.pow(c.distanceToSquared(l),u),u=Math.pow(l.distanceToSquared(s),u),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>u&&(u=o),r.initNonuniformCatmullRom(h.x,c.x,l.x,s.x,a,o,u),i.initNonuniformCatmullRom(h.y,c.y,l.y,s.y,a,o,u),n.initNonuniformCatmullRom(h.z,c.z,l.z,s.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(h.x,c.x,l.x,s.x,a),i.initCatmullRom(h.y,c.y,l.y,s.y,a),n.initCatmullRom(h.z,c.z,l.z,s.z,a));return new m.Vector3(r.calc(t),i.calc(t),n.calc(t))})}(),m.ClosedSplineCurve3=function(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),m.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},m.ClosedSplineCurve3.prototype=Object.create(m.CatmullRomCurve3.prototype),m.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,h){var c,l=s.widthSegments,u=s.heightSegments,p=n/2,d=o/2,f=s.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?c="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(c="y",u=s.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(c="x",l=s.depthSegments);var g=l+1,v=u+1,y=n/l,x=o/u,b=new m.Vector3;for(b[c]=0<a?1:-1,n=0;n<v;n++)for(o=0;o<g;o++){var _=new m.Vector3;_[t]=(o*y-p)*r,_[e]=(n*x-d)*i,_[c]=a,s.vertices.push(_)}for(n=0;n<u;n++)for(o=0;o<l;o++)d=o+g*n,t=o+g*(n+1),e=o+1+g*(n+1),r=o+1+g*n,i=new m.Vector2(o/l,1-n/u),a=new m.Vector2(o/l,1-(n+1)/u),c=new m.Vector2((o+1)/l,1-(n+1)/u),p=new m.Vector2((o+1)/l,1-n/u),(d=new m.Face3(d+f,t+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([i,a,p]),(d=new m.Face3(t+f,e+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([a.clone(),c,p.clone()])}m.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this;n=e/2,o=r/2,a("z","y",-1,-1,r,e,i=t/2,0),a("z","y",1,-1,r,e,-i,1),a("x","z",1,1,t,r,n,2),a("x","z",1,-1,t,r,-n,3),a("x","y",1,-1,t,e,o,4),a("x","y",-1,-1,t,e,-o,5),this.mergeVertices()},m.BoxGeometry.prototype=Object.create(m.Geometry.prototype),m.BoxGeometry.prototype.constructor=m.BoxGeometry,m.CubeGeometry=m.BoxGeometry,m.CircleGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new m.CircleBufferGeometry(t,e,r,i))},m.CircleGeometry.prototype=Object.create(m.Geometry.prototype),m.CircleGeometry.prototype.constructor=m.CircleGeometry,m.CircleBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=e+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,h=3,c=2;s<=e;s++,h+=3,c+=2){var l=r+s/e*i;o[h]=t*Math.cos(l),o[h+1]=t*Math.sin(l),a[h+2]=1,n[c]=(o[h]/t+1)/2,n[c+1]=(o[h+1]/t+1)/2}for(r=[],h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(new m.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new m.BufferAttribute(o,3)),this.addAttribute("normal",new m.BufferAttribute(a,3)),this.addAttribute("uv",new m.BufferAttribute(n,2)),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.CircleBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.CircleBufferGeometry.prototype.constructor=m.CircleBufferGeometry,m.CylinderGeometry=function(t,e,r,i,n,o,a,s){m.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h,c,l=r/2,u=[],p=[];for(c=0;c<=n;c++){var d=[],f=[],g=(v=c/n)*(e-t)+t;for(h=0;h<=i;h++)y=h/i,(x=new m.Vector3).x=g*Math.sin(y*s+a),x.y=-v*r+l,x.z=g*Math.cos(y*s+a),this.vertices.push(x),d.push(this.vertices.length-1),f.push(new m.Vector2(y,1-v));u.push(d),p.push(f)}for(r=(e-t)/r,h=0;h<i;h++)for(0!==t?(a=this.vertices[u[0][h]].clone(),s=this.vertices[u[0][h+1]].clone()):(a=this.vertices[u[1][h]].clone(),s=this.vertices[u[1][h+1]].clone()),a.setY(Math.sqrt(a.x*a.x+a.z*a.z)*r).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*r).normalize(),c=0;c<n;c++){var d=u[c][h],f=u[c+1][h],v=u[c+1][h+1],g=u[c][h+1],y=a.clone(),x=a.clone(),b=s.clone(),_=s.clone(),M=p[c][h].clone(),w=p[c+1][h].clone(),S=p[c+1][h+1].clone(),E=p[c][h+1].clone();this.faces.push(new m.Face3(d,f,g,[y,x,_])),this.faceVertexUvs[0].push([M,w,E]),this.faces.push(new m.Face3(f,v,g,[x.clone(),b,_.clone()])),this.faceVertexUvs[0].push([w.clone(),S,E.clone()])}if(!1===o&&0<t)for(this.vertices.push(new m.Vector3(0,l,0)),h=0;h<i;h++)d=u[0][h],f=u[0][h+1],v=this.vertices.length-1,y=new m.Vector3(0,1,0),x=new m.Vector3(0,1,0),b=new m.Vector3(0,1,0),M=p[0][h].clone(),w=p[0][h+1].clone(),S=new m.Vector2(w.x,0),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,1)),this.faceVertexUvs[0].push([M,w,S]);if(!1===o&&0<e)for(this.vertices.push(new m.Vector3(0,-l,0)),h=0;h<i;h++)d=u[n][h+1],f=u[n][h],v=this.vertices.length-1,y=new m.Vector3(0,-1,0),x=new m.Vector3(0,-1,0),b=new m.Vector3(0,-1,0),M=p[n][h+1].clone(),w=p[n][h].clone(),S=new m.Vector2(w.x,1),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,2)),this.faceVertexUvs[0].push([M,w,S]);this.computeFaceNormals()},m.CylinderGeometry.prototype=Object.create(m.Geometry.prototype),m.CylinderGeometry.prototype.constructor=m.CylinderGeometry,m.EdgesGeometry=function(t,e){m.BufferGeometry.call(this);var r,i=Math.cos(m.Math.degToRad(void 0!==e?e:1)),n=[0,0],o={},a=["a","b","c"];t instanceof m.BufferGeometry?(r=new m.Geometry).fromBufferGeometry(t):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var s=r.vertices,h=0,c=(r=r.faces).length;h<c;h++)for(var l=r[h],u=0;3>u;u++){n[0]=l[a[u]],n[1]=l[a[(u+1)%3]],n.sort(function(t,e){return t-e});var p=n.toString();void 0===o[p]?o[p]={vert1:n[0],vert2:n[1],face1:h,face2:void 0}:o[p].face2=h}n=[];for(p in o)(void 0===(a=o[p]).face2||r[a.face1].normal.dot(r[a.face2].normal)<=i)&&(h=s[a.vert1],n.push(h.x),n.push(h.y),n.push(h.z),h=s[a.vert2],n.push(h.x),n.push(h.y),n.push(h.z));this.addAttribute("position",new m.BufferAttribute(new Float32Array(n),3))},m.EdgesGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.EdgesGeometry.prototype.constructor=m.EdgesGeometry,m.ExtrudeGeometry=function(t,e){void 0!==t&&(m.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())},m.ExtrudeGeometry.prototype=Object.create(m.Geometry.prototype),m.ExtrudeGeometry.prototype.constructor=m.ExtrudeGeometry,m.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var r=t.length,i=0;i<r;i++)this.addShape(t[i],e)},m.ExtrudeGeometry.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,i=t.x-e.x,n=t.y-e.y,o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var h=Math.sqrt(s),c=Math.sqrt(o*o+a*a),s=e.x-n/h;if(e=e.y+i/h,o=((r.x-a/c-s)*a-(r.y+o/c-e)*o)/(i*a-n*o),r=s+i*o-t.x,t=e+n*o-t.y,2>=(i=r*r+t*t))return new m.Vector2(r,t);i=Math.sqrt(i/2)}else t=!1,i>Number.EPSILON?o>Number.EPSILON&&(t=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(n)===Math.sign(a)&&(t=!0),t?(r=-n,t=i,i=Math.sqrt(s)):(r=i,t=n,i=Math.sqrt(s/2));return new m.Vector2(r/i,t/i)}function n(t,e){var r,i;for(N=t.length;0<=--N;){r=N,0>(i=N-1)&&(i=t.length-1);for(var n=0,o=x+2*g,n=0;n<o;n++){var a=(a=e+r+(s=B*n))+C,s=(s=e+i+s)+C,h=(h=e+i+(c=B*(n+1)))+C,c=(c=e+r+c)+C;T.faces.push(new m.Face3(a,s,c,null,null,1)),T.faces.push(new m.Face3(s,h,c,null,null,1)),a=M.generateSideWallUV(T,a,s,h,c),T.faceVertexUvs[0].push([a[0],a[1],a[3]]),T.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){T.vertices.push(new m.Vector3(t,e,r))}function a(t,e,r){t+=C,e+=C,r+=C,T.faces.push(new m.Face3(t,e,r,null,null,0)),t=M.generateTopUV(T,t,e,r),T.faceVertexUvs[0].push(t)}var s,h,c,l,u,p=void 0!==e.amount?e.amount:100,d=void 0!==e.bevelThickness?e.bevelThickness:6,f=void 0!==e.bevelSize?e.bevelSize:d-2,g=void 0!==e.bevelSegments?e.bevelSegments:3,v=void 0===e.bevelEnabled||e.bevelEnabled,y=void 0!==e.curveSegments?e.curveSegments:12,x=void 0!==e.steps?e.steps:1,b=e.extrudePath,_=!1,M=void 0!==e.UVGenerator?e.UVGenerator:m.ExtrudeGeometry.WorldUVGenerator;b&&(s=b.getSpacedPoints(x),_=!0,v=!1,h=void 0!==e.frames?e.frames:new m.TubeGeometry.FrenetFrames(b,x,!1),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3),v||(f=d=g=0);var w,S,E,T=this,C=this.vertices.length,y=(b=t.extractPoints(y)).shape,L=b.holes;if(b=!m.ShapeUtils.isClockWise(y)){for(y=y.reverse(),S=0,E=L.length;S<E;S++)w=L[S],m.ShapeUtils.isClockWise(w)&&(L[S]=w.reverse());b=!1}var A=m.ShapeUtils.triangulateShape(y,L),P=y;for(S=0,E=L.length;S<E;S++)w=L[S],y=y.concat(w);var R,U,k,D,I,F,B=y.length,V=A.length,b=[],N=0;for(R=(k=P.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),b[N]=i(P[N],P[R],P[U]);var O,G=[],z=b.concat();for(S=0,E=L.length;S<E;S++){for(w=L[S],O=[],N=0,R=(k=w.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),O[N]=i(w[N],w[R],w[U]);G.push(O),z=z.concat(O)}for(R=0;R<g;R++){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,-D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),o(I.x,I.y,-D)}for(U=f,N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[0]).multiplyScalar(I.x),c.copy(h.binormals[0]).multiplyScalar(I.y),u.copy(s[0]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,0);for(k=1;k<=x;k++)for(N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[k]).multiplyScalar(I.x),c.copy(h.binormals[k]).multiplyScalar(I.y),u.copy(s[k]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,p/x*k);for(R=g-1;0<=R;R--){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,p+D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),_?o(I.x,I.y+s[x-1].y,s[x-1].x+D):o(I.x,I.y,p+D)}!function(){if(v){var t;for(t=0*B,N=0;N<V;N++)F=A[N],a(F[2]+t,F[1]+t,F[0]+t);for(t=x+2*g,t*=B,N=0;N<V;N++)F=A[N],a(F[0]+t,F[1]+t,F[2]+t)}else{for(N=0;N<V;N++)F=A[N],a(F[2],F[1],F[0]);for(N=0;N<V;N++)F=A[N],a(F[0]+B*x,F[1]+B*x,F[2]+B*x)}}(),function(){var t=0;for(n(P,t),t+=P.length,S=0,E=L.length;S<E;S++)w=L[S],n(w,t),t+=w.length}()},m.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,r,i){return t=t.vertices,e=t[e],r=t[r],i=t[i],[new m.Vector2(e.x,e.y),new m.Vector2(r.x,r.y),new m.Vector2(i.x,i.y)]},generateSideWallUV:function(t,e,r,i,n){return t=t.vertices,e=t[e],r=t[r],i=t[i],n=t[n],.01>Math.abs(e.y-r.y)?[new m.Vector2(e.x,1-e.z),new m.Vector2(r.x,1-r.z),new m.Vector2(i.x,1-i.z),new m.Vector2(n.x,1-n.z)]:[new m.Vector2(e.y,1-e.z),new m.Vector2(r.y,1-r.z),new m.Vector2(i.y,1-i.z),new m.Vector2(n.y,1-n.z)]}},m.ShapeGeometry=function(t,e){m.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},m.ShapeGeometry.prototype=Object.create(m.Geometry.prototype),m.ShapeGeometry.prototype.constructor=m.ShapeGeometry,m.ShapeGeometry.prototype.addShapeList=function(t,e){for(var r=0,i=t.length;r<i;r++)this.addShape(t[r],e);return this},m.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var r,i,n,o=e.material,a=void 0===e.UVGenerator?m.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,s=this.vertices.length,h=(r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12)).shape,c=r.holes;if(!m.ShapeUtils.isClockWise(h))for(h=h.reverse(),r=0,i=c.length;r<i;r++)n=c[r],m.ShapeUtils.isClockWise(n)&&(c[r]=n.reverse());var l=m.ShapeUtils.triangulateShape(h,c);for(r=0,i=c.length;r<i;r++)n=c[r],h=h.concat(n);for(c=h.length,i=l.length,r=0;r<c;r++)n=h[r],this.vertices.push(new m.Vector3(n.x,n.y,0));for(r=0;r<i;r++)c=l[r],h=c[0]+s,n=c[1]+s,c=c[2]+s,this.faces.push(new m.Face3(h,n,c,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,h,n,c))},m.LatheGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=e||12,r=r||0,i=i||2*Math.PI;for(var n=1/(t.length-1),o=1/e,a=0,s=e;a<=s;a++)for(var h=r+a*o*i,c=Math.sin(h),l=Math.cos(h),h=0,u=t.length;h<u;h++){var p=t[h];(d=new m.Vector3).x=p.x*c,d.y=p.y,d.z=p.x*l,this.vertices.push(d)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,u=t.length-1;h<u;h++){i=(e=h+r*a)+r;var c=e+1+r,l=e+1,d=h*n,f=(p=a*o)+o,g=d+n;this.faces.push(new m.Face3(e,i,l)),this.faceVertexUvs[0].push([new m.Vector2(p,d),new m.Vector2(f,d),new m.Vector2(p,g)]),this.faces.push(new m.Face3(i,c,l)),this.faceVertexUvs[0].push([new m.Vector2(f,d),new m.Vector2(f,g),new m.Vector2(p,g)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},m.LatheGeometry.prototype=Object.create(m.Geometry.prototype),m.LatheGeometry.prototype.constructor=m.LatheGeometry,m.PlaneGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new m.PlaneBufferGeometry(t,e,r,i))},m.PlaneGeometry.prototype=Object.create(m.Geometry.prototype),m.PlaneGeometry.prototype.constructor=m.PlaneGeometry,m.PlaneBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n=t/2,o=e/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=t/r,c=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var l=new Float32Array(a*s*2),u=0,p=0,d=0;d<s;d++)for(var f=d*c-o,g=0;g<a;g++)e[u]=g*h-n,e[u+1]=-f,t[u+2]=1,l[p]=g/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<e.length/3?Uint32Array:Uint16Array)(r*i*6),d=0;d<i;d++)for(g=0;g<r;g++)o=g+a*(d+1),s=g+1+a*(d+1),h=g+1+a*d,n[u]=g+a*d,n[u+1]=o,n[u+2]=h,n[u+3]=o,n[u+4]=s,n[u+5]=h,u+=6;this.setIndex(new m.BufferAttribute(n,1)),this.addAttribute("position",new m.BufferAttribute(e,3)),this.addAttribute("normal",new m.BufferAttribute(t,3)),this.addAttribute("uv",new m.BufferAttribute(l,2))},m.PlaneBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.PlaneBufferGeometry.prototype.constructor=m.PlaneBufferGeometry,m.RingGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||0,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s=[],h=t,c=(e-t)/(i=void 0!==i?Math.max(1,i):8);for(t=0;t<i+1;t++){for(a=0;a<r+1;a++){var l=new m.Vector3,u=n+a/r*o;l.x=h*Math.cos(u),l.y=h*Math.sin(u),this.vertices.push(l),s.push(new m.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}h+=c}for(e=new m.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=u=a+n,c=u+r+1,l=u+r+2,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]),o=u,c=u+r+2,l=u+1,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]);this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,h)},m.RingGeometry.prototype=Object.create(m.Geometry.prototype),m.RingGeometry.prototype.constructor=m.RingGeometry,m.SphereGeometry=function(t,e,r,i,n,o,a){m.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new m.SphereBufferGeometry(t,e,r,i,n,o,a))},m.SphereGeometry.prototype=Object.create(m.Geometry.prototype),m.SphereGeometry.prototype.constructor=m.SphereGeometry,m.SphereBufferGeometry=function(t,e,r,i,n,o,a){m.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;for(var s=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=(e+1)*(r+1),c=new m.BufferAttribute(new Float32Array(3*h),3),l=new m.BufferAttribute(new Float32Array(3*h),3),h=new m.BufferAttribute(new Float32Array(2*h),2),u=0,p=[],d=new m.Vector3,f=0;f<=r;f++){for(var g=[],v=f/r,y=0;y<=e;y++){var x=y/e,b=-t*Math.cos(i+x*n)*Math.sin(o+v*a),_=t*Math.cos(o+v*a),M=t*Math.sin(i+x*n)*Math.sin(o+v*a);d.set(b,_,M).normalize(),c.setXYZ(u,b,_,M),l.setXYZ(u,d.x,d.y,d.z),h.setXY(u,x,1-v),g.push(u),u++}p.push(g)}for(i=[],f=0;f<r;f++)for(y=0;y<e;y++)n=p[f][y+1],a=p[f][y],u=p[f+1][y],d=p[f+1][y+1],(0!==f||0<o)&&i.push(n,a,d),(f!==r-1||s<Math.PI)&&i.push(a,u,d);this.setIndex(new(65535<c.count?m.Uint32Attribute:m.Uint16Attribute)(i,1)),this.addAttribute("position",c),this.addAttribute("normal",l),this.addAttribute("uv",h),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.SphereBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.SphereBufferGeometry.prototype.constructor=m.SphereBufferGeometry,m.TextGeometry=function(t,e){var r=(e=e||{}).font;if(0==r instanceof m.Font)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new m.Geometry;r=r.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),m.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},m.TextGeometry.prototype=Object.create(m.ExtrudeGeometry.prototype),m.TextGeometry.prototype.constructor=m.TextGeometry,m.TorusGeometry=function(t,e,r,i,n){m.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new m.Vector3,a=[],s=[],h=0;h<=r;h++)for(var c=0;c<=i;c++){var l=c/i*n,u=h/r*Math.PI*2;o.x=t*Math.cos(l),o.y=t*Math.sin(l);var p=new m.Vector3;p.x=(t+e*Math.cos(u))*Math.cos(l),p.y=(t+e*Math.cos(u))*Math.sin(l),p.z=e*Math.sin(u),this.vertices.push(p),a.push(new m.Vector2(c/i,h/r)),s.push(p.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(c=1;c<=i;c++)t=(i+1)*h+c-1,e=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,l=new m.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),l=new m.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[e].clone(),a[n].clone(),a[o].clone()]);this.computeFaceNormals()},m.TorusGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusGeometry.prototype.constructor=m.TorusGeometry,m.TorusKnotGeometry=function(t,e,r,i,n,o,a){function s(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t);return t*=e/r,e=Math.cos(t),o*=i*(2+e)*.5,a=i*(2+e)*a*.5,i=n*i*Math.sin(t)*.5,new m.Vector3(o,a,i)}m.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},t=t||100,e=e||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=Array(r),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=0;p<r;++p){h[p]=Array(i);var d=s(f=p/r*2*n*Math.PI,o,n,t,a),f=s(f+.01,o,n,t,a);for(c.subVectors(f,d),l.addVectors(f,d),u.crossVectors(c,l),l.crossVectors(u,c),u.normalize(),l.normalize(),f=0;f<i;++f){var g=f/i*2*Math.PI,v=-e*Math.cos(g),g=e*Math.sin(g),y=new m.Vector3;y.x=d.x+v*l.x+g*u.x,y.y=d.y+v*l.y+g*u.y,y.z=d.z+v*l.z+g*u.z,h[p][f]=this.vertices.push(y)-1}}for(p=0;p<r;++p)for(f=0;f<i;++f)n=(p+1)%r,o=(f+1)%i,t=h[p][f],e=h[n][f],n=h[n][o],o=h[p][o],a=new m.Vector2(p/r,f/i),c=new m.Vector2((p+1)/r,f/i),l=new m.Vector2((p+1)/r,(f+1)/i),u=new m.Vector2(p/r,(f+1)/i),this.faces.push(new m.Face3(t,e,o)),this.faceVertexUvs[0].push([a,c,u]),this.faces.push(new m.Face3(e,n,o)),this.faceVertexUvs[0].push([c.clone(),l,u.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TorusKnotGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusKnotGeometry.prototype.constructor=m.TorusKnotGeometry,m.TubeGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:r,radialSegments:i,closed:n,taper:o},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||m.TubeGeometry.NoTaper;var a,s,h,c,l,u,p,d,f,g,v=[],y=e+1,x=new m.Vector3;for(f=(d=new m.TubeGeometry.FrenetFrames(t,e,n)).normals,g=d.binormals,this.tangents=d.tangents,this.normals=f,this.binormals=g,d=0;d<y;d++)for(v[d]=[],h=d/(y-1),p=t.getPointAt(h),a=f[d],s=g[d],l=r*o(h),h=0;h<i;h++)c=h/i*2*Math.PI,u=-l*Math.cos(c),c=l*Math.sin(c),x.copy(p),x.x+=u*a.x+c*s.x,x.y+=u*a.y+c*s.y,x.z+=u*a.z+c*s.z,v[d][h]=this.vertices.push(new m.Vector3(x.x,x.y,x.z))-1;for(d=0;d<e;d++)for(h=0;h<i;h++)o=n?(d+1)%e:d+1,y=(h+1)%i,t=v[d][h],r=v[o][h],o=v[o][y],y=v[d][y],x=new m.Vector2(d/e,h/i),f=new m.Vector2((d+1)/e,h/i),g=new m.Vector2((d+1)/e,(h+1)/i),a=new m.Vector2(d/e,(h+1)/i),this.faces.push(new m.Face3(t,r,y)),this.faceVertexUvs[0].push([x,f,a]),this.faces.push(new m.Face3(r,o,y)),this.faceVertexUvs[0].push([f.clone(),g,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TubeGeometry.prototype=Object.create(m.Geometry.prototype),m.TubeGeometry.prototype.constructor=m.TubeGeometry,m.TubeGeometry.NoTaper=function(t){return 1},m.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},m.TubeGeometry.FrenetFrames=function(t,e,r){var i=new m.Vector3,n=[],o=[],a=[],s=new m.Vector3,h=new m.Matrix4;e+=1;var c,l,u;for(this.tangents=n,this.normals=o,this.binormals=a,c=0;c<e;c++)l=c/(e-1),n[c]=t.getTangentAt(l),n[c].normalize();for(o[0]=new m.Vector3,a[0]=new m.Vector3,t=Number.MAX_VALUE,c=Math.abs(n[0].x),l=Math.abs(n[0].y),u=Math.abs(n[0].z),c<=t&&(t=c,i.set(1,0,0)),l<=t&&(t=l,i.set(0,1,0)),u<=t&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),o[0].crossVectors(n[0],s),a[0].crossVectors(n[0],o[0]),c=1;c<e;c++)o[c]=o[c-1].clone(),a[c]=a[c-1].clone(),s.crossVectors(n[c-1],n[c]),s.length()>Number.EPSILON&&(s.normalize(),i=Math.acos(m.Math.clamp(n[c-1].dot(n[c]),-1,1)),o[c].applyMatrix4(h.makeRotationAxis(s,i))),a[c].crossVectors(n[c],o[c]);if(r)for(i=Math.acos(m.Math.clamp(o[0].dot(o[e-1]),-1,1)),i/=e-1,0<n[0].dot(s.crossVectors(o[0],o[e-1]))&&(i=-i),c=1;c<e;c++)o[c].applyMatrix4(h.makeRotationAxis(n[c],i*c)),a[c].crossVectors(n[c],o[c])},m.PolyhedronGeometry=function(t,e,r,i){function n(t){var e=t.normalize().clone();e.index=s.vertices.push(e)-1;var r=Math.atan2(t.z,-t.x)/2/Math.PI+.5;return t=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5,e.uv=new m.Vector2(r,1-t),e}function o(t,e,r,i){i=new m.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()],void 0,i),s.faces.push(i),g.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(g.z,-g.x),s.faceVertexUvs[0].push([a(t.uv,t,i),a(e.uv,e,i),a(r.uv,r,i)])}function a(t,e,r){return 0>r&&1===t.x&&(t=new m.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new m.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}m.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1,i=i||0;for(var s=this,h=0,c=t.length;h<c;h+=3)n(new m.Vector3(t[h],t[h+1],t[h+2]));t=this.vertices;for(var l=[],u=h=0,c=e.length;h<c;h+=3,u++){var p=t[e[h]],d=t[e[h+1]],f=t[e[h+2]];l[u]=new m.Face3(p.index,d.index,f.index,[p.clone(),d.clone(),f.clone()],void 0,u)}for(var g=new m.Vector3,h=0,c=l.length;h<c;h++)!function(t,e){for(var r=Math.pow(2,e),i=n(s.vertices[t.a]),a=n(s.vertices[t.b]),h=n(s.vertices[t.c]),c=[],l=t.materialIndex,u=0;u<=r;u++){c[u]=[];for(var p=n(i.clone().lerp(h,u/r)),d=n(a.clone().lerp(h,u/r)),f=r-u,m=0;m<=f;m++)c[u][m]=0===m&&u===r?p:n(p.clone().lerp(d,m/f))}for(u=0;u<r;u++)for(m=0;m<2*(r-u)-1;m++)i=Math.floor(m/2),0==m%2?o(c[u][i+1],c[u+1][i],c[u][i],l):o(c[u][i+1],c[u+1][i+1],c[u+1][i],l)}(l[h],i);for(h=0,c=this.faceVertexUvs[0].length;h<c;h++)e=this.faceVertexUvs[0][h],i=e[0].x,t=e[1].x,l=e[2].x,u=Math.max(i,t,l),p=Math.min(i,t,l),.9<u&&.1>p&&(.2>i&&(e[0].x+=1),.2>t&&(e[1].x+=1),.2>l&&(e[2].x+=1));for(h=0,c=this.vertices.length;h<c;h++)this.vertices[h].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,r)},m.PolyhedronGeometry.prototype=Object.create(m.Geometry.prototype),m.PolyhedronGeometry.prototype.constructor=m.PolyhedronGeometry,m.DodecahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2,i=1/r;m.PolyhedronGeometry.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,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},m.DodecahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.DodecahedronGeometry.prototype.constructor=m.DodecahedronGeometry,m.IcosahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2;m.PolyhedronGeometry.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},m.IcosahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype);m.IcosahedronGeometry.prototype.constructor=m.IcosahedronGeometry,m.OctahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},m.OctahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.OctahedronGeometry.prototype.constructor=m.OctahedronGeometry,m.TetrahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},m.TetrahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.TetrahedronGeometry.prototype.constructor=m.TetrahedronGeometry,m.ParametricGeometry=function(t,e,r){m.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o,a,s=this.vertices,h=this.faces,c=this.faceVertexUvs[0],l=e+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=e;n++)o=n/e,o=t(o,a),s.push(o);var u,p,d,f;for(i=0;i<r;i++)for(n=0;n<e;n++)t=i*l+n,s=i*l+n+1,a=(i+1)*l+n+1,o=(i+1)*l+n,u=new m.Vector2(n/e,i/r),p=new m.Vector2((n+1)/e,i/r),d=new m.Vector2((n+1)/e,(i+1)/r),f=new m.Vector2(n/e,(i+1)/r),h.push(new m.Face3(t,s,o)),c.push([u,p,f]),h.push(new m.Face3(s,a,o)),c.push([p.clone(),d,f.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.ParametricGeometry.prototype=Object.create(m.Geometry.prototype),m.ParametricGeometry.prototype.constructor=m.ParametricGeometry,m.WireframeGeometry=function(t){function e(t,e){return t-e}m.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(t instanceof m.Geometry){var o=t.vertices,a=t.faces,s=0,h=new Uint32Array(6*a.length);t=0;for(var c=a.length;t<c;t++)for(var l=a[t],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(e);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)i=o[h[2*t+u]],s=6*t+3*u,r[s+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new m.BufferAttribute(r,3))}else if(t instanceof m.BufferGeometry){if(null!==t.index){for(c=t.index.array,o=t.attributes.position,s=0,0===(n=t.groups).length&&t.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,l=n.length;a<l;++a){u=(t=n[a]).start,p=t.count,t=u;for(var d=u+p;t<d;t+=3)for(u=0;3>u;u++)r[0]=c[t+u],r[1]=c[t+(u+1)%3],r.sort(e),p=r.toString(),void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)s=6*t+3*u,i=h[2*t+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(o=t.attributes.position.array,s=o.length/3,h=s/3,r=new Float32Array(6*s),t=0,c=h;t<c;t++)for(u=0;3>u;u++)s=18*t+6*u,h=9*t+3*u,r[s+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*t+(u+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new m.BufferAttribute(r,3))}},m.WireframeGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.WireframeGeometry.prototype.constructor=m.WireframeGeometry,m.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(t=new m.BufferGeometry).addAttribute("position",new m.BufferAttribute(e,3)),t.addAttribute("color",new m.BufferAttribute(r,3)),e=new m.LineBasicMaterial({vertexColors:m.VertexColors}),m.LineSegments.call(this,t,e)},m.AxisHelper.prototype=Object.create(m.LineSegments.prototype),m.AxisHelper.prototype.constructor=m.AxisHelper,m.ArrowHelper=function(){var t=new m.Geometry;t.vertices.push(new m.Vector3(0,0,0),new m.Vector3(0,1,0));var e=new m.CylinderGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(r,i,n,o,a,s){m.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),this.line=new m.Line(t,new m.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m.Mesh(e,new m.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),m.ArrowHelper.prototype=Object.create(m.Object3D.prototype),m.ArrowHelper.prototype.constructor=m.ArrowHelper,m.ArrowHelper.prototype.setDirection=function(){var t,e=new m.Vector3;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),m.ArrowHelper.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},m.ArrowHelper.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},m.BoxHelper=function(t){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new m.BufferGeometry;i.setIndex(new m.BufferAttribute(e,1)),i.addAttribute("position",new m.BufferAttribute(r,3)),m.LineSegments.call(this,i,new m.LineBasicMaterial({color:16776960})),void 0!==t&&this.update(t)},m.BoxHelper.prototype=Object.create(m.LineSegments.prototype),m.BoxHelper.prototype.constructor=m.BoxHelper,m.BoxHelper.prototype.update=function(){var t=new m.Box3;return function(e){if(t.setFromObject(e),!t.isEmpty()){e=t.min;var r=t.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=e.x,n[4]=r.y,n[5]=r.z,n[6]=e.x,n[7]=e.y,n[8]=r.z,n[9]=r.x,n[10]=e.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=e.z,n[15]=e.x,n[16]=r.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=r.x,n[22]=e.y,n[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),m.BoundingBoxHelper=function(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new m.Box3,m.Mesh.call(this,new m.BoxGeometry(1,1,1),new m.MeshBasicMaterial({color:r,wireframe:!0}))},m.BoundingBoxHelper.prototype=Object.create(m.Mesh.prototype),m.BoundingBoxHelper.prototype.constructor=m.BoundingBoxHelper,m.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},m.CameraHelper=function(t){function e(t,e,i){r(t,i),r(e,i)}function r(t,e){i.vertices.push(new m.Vector3),i.colors.push(new m.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(i.vertices.length-1)}var i=new m.Geometry,n=new m.LineBasicMaterial({color:16777215,vertexColors:m.FaceColors}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),m.LineSegments.call(this,i,n),this.camera=t,this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},m.CameraHelper.prototype=Object.create(m.LineSegments.prototype),m.CameraHelper.prototype.constructor=m.CameraHelper,m.CameraHelper.prototype.update=function(){function t(t,o,a,s){if(i.set(o,a,s).unproject(n),void 0!==(t=r[t]))for(o=0,a=t.length;o<a;o++)e.vertices[t[o]].copy(i)}var e,r,i=new m.Vector3,n=new m.Camera;return function(){e=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.verticesNeedUpdate=!0}}(),m.DirectionalLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var r=new m.Geometry;r.vertices.push(new m.Vector3(-e,e,0),new m.Vector3(e,e,0),new m.Vector3(e,-e,0),new m.Vector3(-e,-e,0),new m.Vector3(-e,e,0));var i=new m.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new m.Line(r,i),this.add(this.lightPlane),(r=new m.Geometry).vertices.push(new m.Vector3,new m.Vector3),(i=new m.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new m.Line(r,i),this.add(this.targetLine),this.update()},m.DirectionalLightHelper.prototype=Object.create(m.Object3D.prototype),m.DirectionalLightHelper.prototype.constructor=m.DirectionalLightHelper,m.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},m.DirectionalLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),m.EdgesHelper=function(t,e,r){e=void 0!==e?e:16777215,m.LineSegments.call(this,new m.EdgesGeometry(t.geometry,r),new m.LineBasicMaterial({color:e})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.EdgesHelper.prototype=Object.create(m.LineSegments.prototype),m.EdgesHelper.prototype.constructor=m.EdgesHelper,m.FaceNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.FaceNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.FaceNormalsHelper.prototype.constructor=m.FaceNormalsHelper,m.FaceNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=0,h=0,c=(o=o.faces).length;h<c;h++){var l=o[h],u=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(u).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),n.setXYZ(s,t.x,t.y,t.z),s+=1,n.setXYZ(s,e.x,e.y,e.z),s+=1}return n.needsUpdate=!0,this}}(),m.GridHelper=function(t,e){var r=new m.Geometry,i=new m.LineBasicMaterial({vertexColors:m.VertexColors});this.color1=new m.Color(4473924),this.color2=new m.Color(8947848);for(var n=-t;n<=t;n+=e){r.vertices.push(new m.Vector3(-t,0,n),new m.Vector3(t,0,n),new m.Vector3(n,0,-t),new m.Vector3(n,0,t));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}m.LineSegments.call(this,r,i)},m.GridHelper.prototype=Object.create(m.LineSegments.prototype),m.GridHelper.prototype.constructor=m.GridHelper,m.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},m.HemisphereLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new m.Color,new m.Color];var r=new m.SphereGeometry(e,4,2);r.rotateX(-Math.PI/2);for(var i=0;8>i;i++)r.faces[i].color=this.colors[4>i?0:1];i=new m.MeshBasicMaterial({vertexColors:m.FaceColors,wireframe:!0}),this.lightSphere=new m.Mesh(r,i),this.add(this.lightSphere),this.update()},m.HemisphereLightHelper.prototype=Object.create(m.Object3D.prototype),m.HemisphereLightHelper.prototype.constructor=m.HemisphereLightHelper,m.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},m.HemisphereLightHelper.prototype.update=function(){var t=new m.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),m.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var r=new m.SphereGeometry(e,4,2),i=new m.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),m.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},m.PointLightHelper.prototype=Object.create(m.Mesh.prototype),m.PointLightHelper.prototype.constructor=m.PointLightHelper,m.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},m.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},m.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new m.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof m.Bone&&(e.vertices.push(new m.Vector3),e.vertices.push(new m.Vector3),e.colors.push(new m.Color(0,0,1)),e.colors.push(new m.Color(0,1,0)));e.dynamic=!0,r=new m.LineBasicMaterial({vertexColors:m.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),m.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},m.SkeletonHelper.prototype=Object.create(m.LineSegments.prototype),m.SkeletonHelper.prototype.constructor=m.SkeletonHelper,m.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof m.Bone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},m.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new m.Matrix4).getInverse(this.root.matrixWorld),r=new m.Matrix4,i=0,n=0;n<this.bones.length;n++){var o=this.bones[n];o.parent instanceof m.Bone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},m.SpotLightHelper=function(t){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,(t=new m.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),t.rotateX(-Math.PI/2);var e=new m.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new m.Mesh(t,e),this.add(this.cone),this.update()},m.SpotLightHelper.prototype=Object.create(m.Object3D.prototype),m.SpotLightHelper.prototype.constructor=m.SpotLightHelper,m.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},m.SpotLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),m.VertexNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=3*r.faces.length:r instanceof m.BufferGeometry&&(e=r.attributes.normal.count),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.VertexNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.VertexNormalsHelper.prototype.constructor=m.VertexNormalsHelper,m.VertexNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof m.Geometry)for(var s=a.vertices,h=a.faces,c=a=0,l=h.length;c<l;c++)for(var u=h[c],p=0,d=u.vertexNormals.length;p<d;p++){var f=u.vertexNormals[p];t.copy(s[u[i[p]]]).applyMatrix4(n),e.copy(f).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a instanceof m.BufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;p<d;p++)t.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(n),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;return o.needsUpdate=!0,this}}(),m.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215;m.LineSegments.call(this,new m.WireframeGeometry(t.geometry),new m.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.WireframeHelper.prototype=Object.create(m.LineSegments.prototype),m.WireframeHelper.prototype.constructor=m.WireframeHelper,m.ImmediateRenderObject=function(t){m.Object3D.call(this),this.material=t,this.render=function(t){}},m.ImmediateRenderObject.prototype=Object.create(m.Object3D.prototype),m.ImmediateRenderObject.prototype.constructor=m.ImmediateRenderObject,m.MorphBlendMesh=function(t,e){m.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,r/1),this.setAnimationWeight("__default",1)},m.MorphBlendMesh.prototype=Object.create(m.Mesh.prototype),m.MorphBlendMesh.prototype.constructor=m.MorphBlendMesh,m.MorphBlendMesh.prototype.createAnimation=function(t,e,r,i){e={start:e,end:r,length:r-e+1,fps:i,duration:(r-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},m.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s=n.morphTargets[o].name.match(r);if(s&&1<s.length){var h=s[1];i[h]||(i[h]={start:1/0,end:-1/0}),o<(s=i[h]).start&&(s.start=o),o>s.end&&(s.end=o),e||(e=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.end,t);this.firstAnimation=e},m.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},m.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},m.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},m.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},m.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},m.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},m.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},m.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},m.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},m.MorphBlendMesh.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},m.MorphBlendMesh.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||0>i.time)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),0>i.time&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,0>i.time&&(i.time+=i.duration));var o=i.start+m.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o),n=i.time%n/n,i.directionBackwards&&(n=1-n),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a):this.morphTargetInfluences[i.currentFrame]=a}}};var g=function(){function t(){}return t.prototype.webgl=function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}},t}();d.prototype={VERSION:"2.2.0",defaults:{imageCloud:"",cloudSpeed:1,skyColor:"#ffffff",skyColorPower:50,cameraControl:!1,cameraXSpeed:.01,cameraYSpeed:.02,cloudData:[]},cameraNearClipPlane:1,cameraFarClipPlane:1e3,vFOV:60,init:function(t,e){this.container=t,this.config=e,this.create()},create:function(){if(!this.util().webgl())throw Error("Your browser does not support WebGL.");this.resetListeners(),this.resetScene(),this.load()},load:function(){var e={};e.cloud=this.config.imageCloud;var r=0,i=0;for(var n in e)e.hasOwnProperty(n)&&r++;for(var n in e)if(e.hasOwnProperty(n)){var o=new XMLHttpRequest;o.open("GET",e[n],!0),o.crossOrigin="Anonymous",o.responseType="arraybuffer",o.customKey=n,o.onload=t.proxy(function(n){var o=n.currentTarget;if(o.status>=400)return o.onerror(n);var a=new Blob([o.response]),s=new Image;s.src=window.URL.createObjectURL(a),s.onload=t.proxy(function(t){e[t.customKey]=s,++i==r&&(this.applyListeners(),this.buildScene(e),this.renderScene())},this,o)},this),o.onerror=t.proxy(function(t){var e=t.currentTarget;throw Error("Cannot load resource "+e.responseURL+". Status code ["+e.status+"]")},this),o.send()}},buildScene:function(t){var e=this.container.width(),r=this.container.height();this.aspect=e/r,this.scene=new m.Scene,this.camera=new m.PerspectiveCamera(this.vFOV,this.aspect,this.cameraNearClipPlane,this.cameraFarClipPlane),this.camera.position.z=this.cameraFarClipPlane,this.scene.add(this.camera);var i=this.createTexture(t,"cloud");this.buildClouds(i),this.renderer=new m.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,r),this.container.append(this.renderer.domElement)},buildClouds:function(t){var e={uniforms:{texCloud:{type:"t",value:null},skyColor:{type:"c",value:null},fogFar:{type:"f",value:null},fogNear:{type:"f",value:null},horizonLength:{type:"f",value:null}},vs:["varying vec2 vUv;","void main()","{","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fs:["uniform sampler2D texCloud;","uniform vec3 skyColor;","uniform float fogFar;","uniform float fogNear;","uniform float horizonLength;","varying vec2 vUv;","void main()","{","float distance = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = smoothstep( fogNear, fogFar, distance );","gl_FragColor = texture2D( texCloud, vUv );","if(distance >= (horizonLength - 200.0)) {","gl_FragColor.a *= 1.0 - ((distance - (horizonLength - 200.0)) / 200.0);","} else if(distance <= 200.0) {","gl_FragColor.a *= (distance / 200.0);","}","gl_FragColor = mix( gl_FragColor, vec4( skyColor, gl_FragColor.w ), fogFactor );","}"].join("\n")};e.uniforms.texCloud.value=t;var r=1-.01*Math.min(Math.max(parseInt(this.config.skyColorPower,10),0),100),i=new m.Fog(this.config.skyColor,this.cameraFarClipPlane*r,this.cameraFarClipPlane);e.uniforms.skyColor.value=i.color,e.uniforms.fogFar.value=i.far,e.uniforms.fogNear.value=i.near,e.uniforms.horizonLength.value=this.cameraFarClipPlane;for(var n=new m.ShaderMaterial({uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,depthWrite:!1,depthTest:!1,transparent:!0}),o=Math.tan(this.vFOV/2*Math.PI/180)*this.cameraFarClipPlane*2*2,a=o*this.aspect,s=new m.Geometry,h=0;h<this.cameraFarClipPlane;h++){for(var c=new m.PlaneGeometry(128,128),l=Math.random()*a-a/2,u=-Math.random()*Math.random()*o/40-o/20,p=h,d=Math.random()*Math.PI,f=2*Math.random()+.5,g=0;g<this.config.cloudData.length;g++)if(this.config.cloudData[g].i==h){var v=this.config.cloudData[g];v.hasOwnProperty("x")&&(l=v.x*a-a/2),v.hasOwnProperty("y")&&(u=v.y*o-o/2),v.hasOwnProperty("rotate")&&(d=v.rotate*Math.PI),v.hasOwnProperty("scale")&&(f=v.scale);break}c.center(),c.rotateZ(d),c.scale(f,f,1),c.translate(l,u,p),s.merge(c)}var y=new m.Mesh(s,n);this.scene.add(y),(y=new m.Mesh(s,n)).position.z=-this.cameraFarClipPlane,this.scene.add(y)},resetScene:function(){this.animationId&&cancelAnimationFrame(this.animationId),this.renderer=null,this.scene=null,this.camera=null,this.container.empty()},renderScene:function(){this.animationId=requestAnimationFrame(t.proxy(this.renderScene,this)),this.camera.position.z-=this.config.cloudSpeed,this.camera.position.z<0&&(this.camera.position.z=this.cameraFarClipPlane),this.camera.position.x+=(this.cameraX.value-this.camera.position.x)*this.config.cameraXSpeed,this.camera.position.y+=(this.cameraY.value-this.camera.position.y)*this.config.cameraYSpeed,this.camera.rotation.z+=.05*(this.cameraRotation.value-this.camera.rotation.z),this.renderer.render(this.scene,this.camera)},pause:function(){this.animationId&&cancelAnimationFrame(this.animationId)},play:function(){this.renderScene()},applyListeners:function(){this.config.cameraControl&&(this.container.on("mousemove.clouds",t.proxy(this.onMouseMove,this)),this.container.on("touchmove.clouds",t.proxy(this.onMouseMove,this))),t(window).on("resize.clouds",t.proxy(this.onWindowResize,this))},resetListeners:function(){this.container.off("mousemove.clouds"),this.container.off("touchmove.clouds"),t(window).off("resize.clouds")},onMouseMove:function(t){var e=this.getMousePositionPower("touchmove"==t.type?t.originalEvent.targetTouches[0]:t);this.cameraX.value=e.x<0?e.x*Math.abs(this.cameraX.min):e.x*Math.abs(this.cameraX.max),this.cameraY.value=e.y<0?e.y*Math.abs(this.cameraY.min):e.y*Math.abs(this.cameraY.max),this.cameraRotation.value=.03*e.x},onWindowResize:function(t){this.aspect=this.container.width()/this.container.height(),this.camera.aspect=this.aspect,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.container.width(),this.container.height())},destroy:function(){this.resetListeners(),this.resetScene()},getMousePositionPower:function(t){var e=this.container.get(0).getBoundingClientRect(),r={},i=(e.right-e.left)/2,n=(e.bottom-e.top)/2,o=this.container.offset();return r.x=(t.pageX-o.left-i)/i,r.y=(n-(t.pageY-o.top))/n,r},createTexture:function(t,e){var r=new m.Texture;return r.image=t[e],r.needsUpdate=!0,r},util:function(){return null!=this._util?this._util:this._util=new g}},t.clouds=function(t,e){if("support"==t)return new g,!!this.util().webgl()},t.fn.clouds=function(e,r){return this.each(function(){var r=t(this),i=r.data("clouds"),n=t.isPlainObject(e)?e:{};if("destroy"!=e)if("pause"!=e)if("play"!=e)if(i){var o=t.extend({},i.config,n);i.init(r,o)}else i=new d(r,o=t.extend({},d.prototype.defaults,n)),r.data("clouds",i);else{if(!i)throw Error("Calling 'play' method on not initialized instance is forbidden");i.play()}else{if(!i)throw Error("Calling 'pause' method on not initialized instance is forbidden");i.pause()}else{if(!i)throw Error("Calling 'destroy' method on not initialized instance is forbidden");i.destroy()}})};var v={imageCloud:weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/cloud-white.png",skyColor:"#8c9793",skyColorPower:100,cloudSpeed:1.5,cameraControl:!0,cloudData:[{i:0,x:.5,y:.4,scale:3},{i:150,x:.5,y:.4,scale:5},{i:300,x:.5,y:.4,scale:6},{i:450,x:.5,y:.4,scale:6},{i:600,x:.5,y:.4,scale:7},{i:10,x:.35,y:.45,scale:2},{i:160,x:.35,y:.45,scale:4},{i:310,x:.35,y:.45,scale:5},{i:460,x:.35,y:.45,scale:5},{i:610,x:.35,y:.45,scale:6},{i:20,x:.65,y:.45,scale:2},{i:170,x:.65,y:.45,scale:4},{i:320,x:.65,y:.45,scale:5},{i:470,x:.65,y:.45,scale:5},{i:620,x:.65,y:.45,scale:6}]};t("#weather_press_scene_container").clouds(v)}})}(jQuery);
     2!function(t){"use strict";t(document).ready(function(){if(console.log("THANK YOU FOR CHOOSING WEATHER PRESS, V4.5"),t("#weather-press-layoutContainer").length){var e,r,i=null,n=t(".weather-press-block-bottom").width(),o=0;t("#weather-press-forecast-loader").css("left",n+7),t(".weather-press-cities-list li").each(function(i,n){if(t(n).hasClass("main-location"))return e=i,r=t(n).position().top.toFixed(2),t("#weather-press-city-name").text(t(n).text()),t("#weather-press-city-name").attr("title",t(n).text()),!1}),t("#weather-press-display-image").click(function(){t(".weather-press-cities-list").css("margin-top");t(".weather-press-block-bottom").toggleClass("weather-press-block-bottom-marginTop"),t(".weather-press-block-middle img").fadeToggle("slow","linear")}),t(".weather-press-closeIcon").click(function(){var e=t(this).attr("data-weatherpressclose");t("."+e).removeClass("flipInX"),t("."+e).addClass("flipOutX"),"weather-press-dailyForecast"==e?t(".weather-press-forecasts ul li").each(function(e,r){t(r).removeClass("weather-press-forecast-active"),0==e&&t(r).addClass("weather-press-forecast-active")}):"weather-press-loader"==e&&(t(".weather-press-outputs-content").text("Loading ..."),t(".weather-press-outputs-toPremium").css("opacity","0"),t(".weather-press-cities-nav-container").css("display","block"),null!=i&&i.abort())}),t("#weather-press-cities-navs-top").click(function(){a(e+1)}),t("#weather-press-cities-navs-bottom").click(function(){a(e-1)});var a=function(i){var n,o=t(".weather-press-cities-list li").length;t(".weather-press-cities-list li").each(function(a,s){if(a==i&&a<o&&a>=0)return e=a,t("#weather-press-city-name").text(t(s).text()),t("#weather-press-city-name").attr("title",t(s).text()),t(s).removeClass(),t(s).addClass("main-location"),n=t(s).position().top.toFixed(2),t(".weather-press-cities-list").css("margin-top",r-n),t(".weather-press-cities-list li:eq("+(a-1)+")").length&&t(".weather-press-cities-list li:eq("+(a-1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").length&&(t(".weather-press-cities-list li:eq("+(a-2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").addClass("deep")),t(".weather-press-cities-list li:eq("+(a+1)+")").length&&t(".weather-press-cities-list li:eq("+(a+1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").length&&(t(".weather-press-cities-list li:eq("+(a+2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").addClass("deep")),!1})},s=function(e){var r;1==e?3>o?(r=-1*++o*(n+7),t(".weather-press-forecast-list").css("left",r),t(".weather-press-block-bottom").addClass("initial-background")):h(1):-1==e&&(o>0?(r=-1*--o*(n+7),t(".weather-press-forecast-list").css("left",r),0==o&&t(".weather-press-block-bottom").removeClass("initial-background")):h(-1))},h=function(e){var r,i,o;1==e?(r=-3*(n+7),i=parseInt(r)-10,clearTimeout(o),t(".weather-press-forecast-list").css("left",i),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",r)},300)):-1==e&&(clearTimeout(o),t(".weather-press-forecast-list").css("left",10),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",0)},300))},c=function(){t("#weather-press-loader").removeClass("flipOutX"),t("#weather-press-loader").addClass("flipInX"),t(".weather-press-cities-nav-container").css("display","none"),t(".weather-press-forecast-list").css("left",0),o=0,t(".weather-press-block-bottom").removeClass("initial-background")};t(".weather-press-cities-list li").click(function(){a(t(this).index()),l(t(this),1),p(t(this),1)}),t("#weather-press-city-name").click(function(){l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1)}),t("#weather-press-forecast-navs-right").click(function(){s(1)}),t("#weather-press-forecast-navs-left").click(function(){s(-1)});var l=function(e,r){c(),i=t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"current",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(r){var i=void 0!=r.temp?r.temp:"00",n=void 0!=r.temp_min?r.temp_min:"00",o=void 0!=r.temp_max?r.temp_max:"00",s=void 0!=r.icon?r.icon:"undefined";t(".weather-press-forecast-list li:first-child .weather-press-temp").text(i+"°"),t(".weather-press-forecast-list li:first-child .weather-press-condition-img > img").attr("src",weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+s+".png"),t(".weather-press-forecast-list li:first-child .weather-press-min-temp").text(n+"°"),t(".weather-press-forecast-list li:first-child .weather-press-max-temp").text(o+"°"),s.indexOf("n")>=0&&"undefined"!=s?(t(".weather-press-block-bottom").addClass("night-background"),t(".weather-press-block-middle").addClass("night-background"),console.log("night")):(t(".weather-press-block-bottom").removeClass("night-background"),t(".weather-press-block-middle").removeClass("night-background"),console.log("day")),a(e.index()),f(),t(".weather-press-cities-nav-container").css("display","block")},error:function(e){console.log(e);var r=JSON.stringify(e.responseText).substring(1,JSON.stringify(e.responseText).length-1);t(".weather-press-outputs-content").text("Error : "+r)}})},u=0,p=function(e,r){t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"daily",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,nbrDays:4,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(i){var n,o,a,s,h,c;t.each(i,function(l,d){if(l>0)if(n=i[l].date,o=i[l].maxtemp,a=i[l].mintemp,s=i[l].daytemp,h=i[l].icon,n)1==l&&t(".weather-press-forecast-list > li").length>1&&t(".weather-press-forecast-list > li:not(:first)").remove(),(c=t("<li id='weather_press_forecast_node_"+l+"'><ul class='weather-press-forecast-item'><li class='weather-press-date' class='weather-press-date'>"+n+"</li><li class='weather-press-temp'>"+s+"°</li><li class='weather-press-condition-img'><img src='"+weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+h+".png' alt='icon'/></li><li class='weather-press-minMax'><ul><li class='weather-press-min-temp'>"+a+"°</li><li class='weather-press-temp-gauge'><div class='weather-press-gauge-gradient'></div></li><li class='weather-press-max-temp'>"+o+"°</li></ul></li></ul></li>")).insertAfter("#weather_press_forecast_node_"+(l-1));else if(u<=2){for(var f=1;l<4;f++)t(".weather-press-forecast-list > li;eq("+f+")").remove();p(e,r),u++}}),t("#weather-press-forecast-loader").css("display","none")},error:function(t){}})};l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1);function d(t,e){this.config=null,this.container=null,this.renderer=null,this.scene=null,this.camera=null,this.aspect=0,this.cameraX={value:0,min:-50,max:50},this.cameraY={value:0,min:-100,max:50},this.cameraRotation={value:0},this.init(t,e)}var f=function(){t("#weather-press-loader").removeClass("flipInX"),t("#weather-press-loader").addClass("flipOutX"),0!=t("#weather_press_brand").length&&"none"!=t("#weather_press_brand").css("display")&&"0"!=t("#weather_press_brand").css("opacity")&&"hidden"!=t("#weather_press_brand").css("visibility")&&0!=t("#weather_press_brand a").length&&"none"!=t("#weather_press_brand a").css("display")&&"0"!=t("#weather_press_brand a").css("opacity")&&"hidden"!=t("#weather_press_brand a").css("visibility")||(t(".weather-press-block-bottom").empty(),t(".weather-press-block-bottom").css("height","221px"),c(),t(".weather-press-outputs-content").text('As a free user you do not have permission to remove the "weather press" brand from the bottom of the widget !'),t(".weather-press-outputs-content").css("color","red"),t(".weather-press-outputs-content").css("text-align","left"),t(".weather-press-outputs-content").css("background","#F1F3F3"))},m={REVISION:"74"};"function"==typeof define&&define.amd?define("three",m):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=m),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1,i=arguments.length;r!==i;++r)if(void 0!==(n=arguments[r])&&null!==n)for(var n=Object(n),o=Object.keys(n),a=0,s=o.length;a!==s;++a){var h=o[a],c=Object.getOwnPropertyDescriptor(n,h);void 0!==c&&c.enumerable&&(e[h]=n[h])}return e}}),m.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},m.CullFaceNone=0,m.CullFaceBack=1,m.CullFaceFront=2,m.CullFaceFrontBack=3,m.FrontFaceDirectionCW=0,m.FrontFaceDirectionCCW=1,m.BasicShadowMap=0,m.PCFShadowMap=1,m.PCFSoftShadowMap=2,m.FrontSide=0,m.BackSide=1,m.DoubleSide=2,m.FlatShading=1,m.SmoothShading=2,m.NoColors=0,m.FaceColors=1,m.VertexColors=2,m.NoBlending=0,m.NormalBlending=1,m.AdditiveBlending=2,m.SubtractiveBlending=3,m.MultiplyBlending=4,m.CustomBlending=5,m.AddEquation=100,m.SubtractEquation=101,m.ReverseSubtractEquation=102,m.MinEquation=103,m.MaxEquation=104,m.ZeroFactor=200,m.OneFactor=201,m.SrcColorFactor=202,m.OneMinusSrcColorFactor=203,m.SrcAlphaFactor=204,m.OneMinusSrcAlphaFactor=205,m.DstAlphaFactor=206,m.OneMinusDstAlphaFactor=207,m.DstColorFactor=208,m.OneMinusDstColorFactor=209,m.SrcAlphaSaturateFactor=210,m.NeverDepth=0,m.AlwaysDepth=1,m.LessDepth=2,m.LessEqualDepth=3,m.EqualDepth=4,m.GreaterEqualDepth=5,m.GreaterDepth=6,m.NotEqualDepth=7,m.MultiplyOperation=0,m.MixOperation=1,m.AddOperation=2,m.UVMapping=300,m.CubeReflectionMapping=301,m.CubeRefractionMapping=302,m.EquirectangularReflectionMapping=303,m.EquirectangularRefractionMapping=304,m.SphericalReflectionMapping=305,m.RepeatWrapping=1e3,m.ClampToEdgeWrapping=1001,m.MirroredRepeatWrapping=1002,m.NearestFilter=1003,m.NearestMipMapNearestFilter=1004,m.NearestMipMapLinearFilter=1005,m.LinearFilter=1006,m.LinearMipMapNearestFilter=1007,m.LinearMipMapLinearFilter=1008,m.UnsignedByteType=1009,m.ByteType=1010,m.ShortType=1011,m.UnsignedShortType=1012,m.IntType=1013,m.UnsignedIntType=1014,m.FloatType=1015,m.HalfFloatType=1025,m.UnsignedShort4444Type=1016,m.UnsignedShort5551Type=1017,m.UnsignedShort565Type=1018,m.AlphaFormat=1019,m.RGBFormat=1020,m.RGBAFormat=1021,m.LuminanceFormat=1022,m.LuminanceAlphaFormat=1023,m.RGBEFormat=m.RGBAFormat,m.RGB_S3TC_DXT1_Format=2001,m.RGBA_S3TC_DXT1_Format=2002,m.RGBA_S3TC_DXT3_Format=2003,m.RGBA_S3TC_DXT5_Format=2004,m.RGB_PVRTC_4BPPV1_Format=2100,m.RGB_PVRTC_2BPPV1_Format=2101,m.RGBA_PVRTC_4BPPV1_Format=2102,m.RGBA_PVRTC_2BPPV1_Format=2103,m.RGB_ETC1_Format=2151,m.LoopOnce=2200,m.LoopRepeat=2201,m.LoopPingPong=2202,m.InterpolateDiscrete=2300,m.InterpolateLinear=2301,m.InterpolateSmooth=2302,m.ZeroCurvatureEnding=2400,m.ZeroSlopeEnding=2401,m.WrapAroundEnding=2402,m.TrianglesDrawMode=0,m.TriangleStripDrawMode=1,m.TriangleFanDrawMode=2,m.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},m.Color.prototype={constructor:m.Color,r:1,g:1,b:1,set:function(t){return t instanceof m.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.b=this.g=this.r=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:.5>r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){return e=m.Math.euclideanModulo(e,1),r=m.Math.clamp(r,0,1),i=m.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(r=.5>=i?i*(1+r):i+r-i*r,i=2*i-r,this.r=t(i,r,e+1/3),this.g=t(i,r,e),this.b=t(i,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=r[2],r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(i,n,o)}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(i=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length&&(r=m.ColorKeywords[t],void 0!==r?this.setHex(r):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){t=t||{h:0,s:0,l:0};var e,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=((h=Math.min(r,i,n))+o)/2;if(h===o)h=e=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case r:e=(i-n)/s+(i<n?6:0);break;case i:e=(n-r)/s+2;break;case n:e=(r-i)/s+4}e/=6}return t.h=e,t.s=h,t.l=a,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},m.ColorKeywords={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,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},m.Quaternion=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1},m.Quaternion.prototype={constructor:m.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(0==t instanceof m.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),n=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var i=e[8],n=e[1],o=e[5],a=e[9],s=e[2],h=e[6],c=r+o+(e=e[10]);return 0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(h-a)*r,this._y=(i-s)*r,this._z=(n-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(h-a)/r,this._x=.25*r,this._y=(t+n)/r,this._z=(i+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(i-s)/r,this._x=(t+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(n-t)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3),e=r.dot(i)+1,1e-6>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,c=e._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w;if(0>(s=o*t._w+r*t._x+i*t._y+n*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),1<=s)return this._w=o,this._x=r,this._y=i,this._z=n,this;if(h=Math.sqrt(1-s*s),.001>Math.abs(h))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var a=Math.atan2(h,s),s=Math.sin((1-e)*a)/h,h=Math.sin(e*a)/h;return this._w=o*s+this._w*h,this._x=r*s+this._x*h,this._y=i*s+this._y*h,this._z=n*s+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(m.Quaternion,{slerp:function(t,e,r,i){return r.copy(t).slerp(e,i)},slerpFlat:function(t,e,r,i,n,o,a){var s=r[i+0],h=r[i+1],c=r[i+2];r=r[i+3],i=n[o+0];var l=n[o+1],u=n[o+2];if(n=n[o+3],r!==n||s!==i||h!==l||c!==u){o=1-a;var p=s*i+h*l+c*u+r*n,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+i*(d*=a),h=h*o+l*d,c=c*o+u*d,r=r*o+n*d,o===1-a&&(a=1/Math.sqrt(s*s+h*h+c*c+r*r),s*=a,h*=a,c*=a,r*=a)}t[e]=s,t[e+1]=h,t[e+2]=c,t[e+3]=r}}),m.Vector2=function(t,e){this.x=t||0,this.y=e||0},m.Vector2.prototype={constructor:m.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector2,e=new m.Vector2),t.set(r,r),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}},m.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},m.Vector3.prototype={constructor:m.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return 0==e instanceof m.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromEuler(e)),this}}(),applyAxisAngle:function(){var t;return function(e,r){return void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,r)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*i,this.y=t[1]*e+t[4]*r+t[7]*i,this.z=t[2]*e+t[5]*r+t[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12],this.y=t[1]*e+t[5]*r+t[9]*i+t[13],this.z=t[2]*e+t[6]*r+t[10]*i+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=1/((t=t.elements)[3]*e+t[7]*r+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*i+t[12])*n,this.y=(t[1]*e+t[5]*r+t[9]*i+t[13])*n,this.z=(t[2]*e+t[6]*r+t[10]*i+t[14])*n,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*r,h=t*r+a*e-n*i,c=t*i+n*r-o*e,e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-c*-o,this.y=h*t+e*-o+c*-n-s*-a,this.z=c*t+e*-a+s*-o-h*-n,this},project:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i,this.y=t[1]*e+t[5]*r+t[9]*i,this.z=t[2]*e+t[6]*r+t[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3,e=new m.Vector3),t.set(r,r,r),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var t,e;return function(r){return void 0===t&&(t=new m.Vector3),t.copy(r).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(m.Math.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),r=this.set(t.elements[4],t.elements[5],t.elements[6]).length();return t=this.set(t.elements[8],t.elements[9],t.elements[10]).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){var r=4*t,i=e.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},m.Vector4=function(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1},m.Vector4.prototype={constructor:m.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12]*n,this.y=t[1]*e+t[5]*r+t[9]*i+t[13]*n,this.z=t[2]*e+t[6]*r+t[10]*i+t[14]*n,this.w=t[3]*e+t[7]*r+t[11]*i+t[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,i,n=(t=t.elements)[0];i=t[4];var o=t[8],a=t[1],s=t[5],h=t[9];r=t[2],e=t[6];var c=t[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(h-e)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(h+e)&&.1>Math.abs(n+s+c-3)?(this.set(1,0,0,0),this):(t=Math.PI,n=(n+1)/2,s=(s+1)/2,c=(c+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+e)/4,n>s&&n>c?.01>n?(e=0,i=r=.707106781):(e=Math.sqrt(n),r=i/e,i=o/e):s>c?.01>s?(e=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),e=i/r,i=h/r):.01>c?(r=e=.707106781,i=0):(i=Math.sqrt(c),e=o/i,r=h/i),this.set(e,r,i,t),this):(t=Math.sqrt((e-h)*(e-h)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(t)&&(t=1),this.x=(e-h)/t,this.y=(o-r)/t,this.z=(a-i)/t,this.w=Math.acos((n+s+c-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector4,e=new m.Vector4),t.set(r,r,r,r),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},m.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||m.Euler.DefaultOrder},m.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),m.Euler.DefaultOrder="XYZ",m.Euler.prototype={constructor:m.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=m.Math.clamp;t=(u=t.elements)[0];var n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],c=u[2],l=u[6],u=u[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(l,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-c,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(c,-1,1)),.99999>Math.abs(c)?(this._x=Math.atan2(l,u),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===e?(this._z=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,t)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),.99999>Math.abs(n)?(this._x=Math.atan2(l,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,i),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new m.Quaternion;return function(e){t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new m.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},m.Line3=function(t,e){this.start=void 0!==t?t:new m.Vector3,this.end=void 0!==e?e:new m.Vector3},m.Line3.prototype={constructor:m.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){return(t||new m.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new m.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new m.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),n=e.dot(t)/n;return i&&(n=m.Math.clamp(n,0,1)),n}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new m.Vector3,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},m.Box2=function(t,e){this.min=void 0!==t?t:new m.Vector2(1/0,1/0),this.max=void 0!==e?e:new m.Vector2(-1/0,-1/0)},m.Box2.prototype={constructor:m.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector2;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){return(t||new m.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector2).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new m.Vector2).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new m.Vector2).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector2;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Box3=function(t,e){this.min=void 0!==t?t:new m.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new m.Vector3(-1/0,-1/0,-1/0)},m.Box3.prototype={constructor:m.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){this.makeEmpty();for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;s<h;s+=3){var c=t[s],l=t[s+1],u=t[s+2];c<e&&(e=c),l<r&&(r=l),u<i&&(i=u),c>n&&(n=c),l>o&&(o=l),u>a&&(a=u)}this.min.set(e,r,i),this.max.set(n,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector3;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t;return function(e){void 0===t&&(t=new m.Box3);var r=this;return this.makeEmpty(),e.updateMatrixWorld(!0),e.traverse(function(e){var i=e.geometry;void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),t.copy(i.boundingBox),t.applyMatrix4(e.matrixWorld),r.union(t))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){return(t||new m.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector3).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new m.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new m.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector3;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new m.Vector3;return function(e){return e=e||new m.Sphere,e.center=this.center(),e.radius=.5*this.size(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3];return function(e){return t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(t),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},m.Matrix3.prototype={constructor:m.Matrix3,set:function(t,e,r,i,n,o,a,s,h){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix3(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],h=t[7];return e*o*(t=t[8])-e*a*h-r*n*t+r*a*s+i*n*h-i*o*s},getInverse:function(t,e){var r=t.elements,i=this.elements;if(i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4],0==(r=r[0]*i[0]+r[1]*i[3]+r[2]*i[6])){if(e)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}},m.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},m.Matrix4.prototype={constructor:m.Matrix4,set:function(t,e,r,i,n,o,a,s,h,c,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=c,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new m.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new m.Vector3);var r=this.elements;e=e.elements;var i=1/t.set(e[0],e[1],e[2]).length(),n=1/t.set(e[4],e[5],e[6]).length(),o=1/t.set(e[8],e[9],e[10]).length();return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,this}}(),makeRotationFromEuler:function(t){0==t instanceof m.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(i),i=Math.sin(i),s=Math.cos(n),n=Math.sin(n);if("XYZ"===t.order){t=o*s;var h=o*n,c=r*s,l=r*n;e[0]=a*s,e[4]=-a*n,e[8]=i,e[1]=h+c*i,e[5]=t-l*i,e[9]=-r*a,e[2]=l-t*i,e[6]=c+h*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t+l*r,e[4]=c*r-h,e[8]=o*i,e[1]=o*n,e[5]=o*s,e[9]=-r,e[2]=h*r-c,e[6]=l+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t-l*r,e[4]=-o*n,e[8]=c+h*r,e[1]=h+c*r,e[5]=o*s,e[9]=l-t*r,e[2]=-o*i,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,h=o*n,c=r*s,l=r*n,e[0]=a*s,e[4]=c*i-h,e[8]=t*i+l,e[1]=a*n,e[5]=l*i+t,e[9]=h*i-c,e[2]=-i,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=l-t*n,e[8]=c*n+h,e[1]=n,e[5]=o*s,e[9]=-r*s,e[2]=-i*s,e[6]=h*n+c,e[10]=t-l*n):"XZY"===t.order&&(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=-n,e[8]=i*s,e[1]=t*n+l,e[5]=o*s,e[9]=h*n-c,e[2]=c*n-h,e[6]=r*s,e[10]=l*n+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,o=t.w,a=n+n;t=r*(c=r+r);var s=r*(l=i+i),r=r*a,h=i*l,i=i*a,n=n*a,c=o*c,l=o*l,o=o*a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+l,e[1]=s+o,e[5]=1-(t+n),e[9]=i-c,e[2]=r-l,e[6]=i+c,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,r;return function(i,n,o){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Vector3),void 0===r&&(r=new m.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.lengthSq()&&(r.x+=1e-4,t.crossVectors(o,r).normalize()),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],r=r[15],b=i[0],_=i[4],M=i[8],w=i[12],S=i[1],E=i[5],T=i[9],C=i[13],L=i[2],A=i[6],P=i[10],R=i[14],U=i[3],k=i[7],D=i[11],i=i[15];return n[0]=o*b+a*S+s*L+h*U,n[4]=o*_+a*E+s*A+h*k,n[8]=o*M+a*T+s*P+h*D,n[12]=o*w+a*C+s*R+h*i,n[1]=c*b+l*S+u*L+p*U,n[5]=c*_+l*E+u*A+p*k,n[9]=c*M+l*T+u*P+p*D,n[13]=c*w+l*C+u*R+p*i,n[2]=d*b+f*S+m*L+g*U,n[6]=d*_+f*E+m*A+g*k,n[10]=d*M+f*T+m*P+g*D,n[14]=d*w+f*C+m*R+g*i,n[3]=v*b+y*S+x*L+r*U,n[7]=v*_+y*E+x*A+r*k,n[11]=v*M+y*T+x*P+r*D,n[15]=v*w+y*C+x*R+r*i,this},multiplyToArray:function(t,e,r){var i=this.elements;return this.multiplyMatrices(t,e),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix4(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],c=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*p-r*s*p)+t[7]*(+e*s*p-e*h*u+n*o*u-i*o*p+i*h*c-n*s*c)+t[11]*(+e*h*l-e*a*p-n*o*l+r*o*p+n*a*c-r*h*c)+t[15]*(-i*a*c-e*s*l+e*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},getPosition:function(){var t;return function(){void 0===t&&(t=new m.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return t.set(e[12],e[13],e[14])}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=(y=t.elements)[0],n=y[4],o=y[8],a=y[12],s=y[1],h=y[5],c=y[9],l=y[13],u=y[2],p=y[6],d=y[10],f=y[14],m=y[3],g=y[7],v=y[11],y=y[15];if(r[0]=c*f*g-l*d*g+l*p*v-h*f*v-c*p*y+h*d*y,r[4]=a*d*g-o*f*g-a*p*v+n*f*v+o*p*y-n*d*y,r[8]=o*l*g-a*c*g+a*h*v-n*l*v-o*h*y+n*c*y,r[12]=a*c*p-o*l*p-a*h*d+n*l*d+o*h*f-n*c*f,r[1]=l*d*m-c*f*m-l*u*v+s*f*v+c*u*y-s*d*y,r[5]=o*f*m-a*d*m+a*u*v-i*f*v-o*u*y+i*d*y,r[9]=a*c*m-o*l*m-a*s*v+i*l*v+o*s*y-i*c*y,r[13]=o*l*u-a*c*u+a*s*d-i*l*d-o*s*f+i*c*f,r[2]=h*f*m-l*p*m+l*u*g-s*f*g-h*u*y+s*p*y,r[6]=a*p*m-n*f*m-a*u*g+i*f*g+n*u*y-i*p*y,r[10]=n*l*m-a*h*m+a*s*g-i*l*g-n*s*y+i*h*y,r[14]=a*h*u-n*l*u-a*s*p+i*l*p+n*s*f-i*h*f,r[3]=c*p*m-h*d*m-c*u*g+s*d*g+h*u*v-s*p*v,r[7]=n*d*m-o*p*m+o*u*g-i*d*g-n*u*v+i*p*v,r[11]=o*h*m-n*c*m-o*s*g+i*c*g+n*s*v-i*h*v,r[15]=n*c*u-o*h*u+o*s*p-i*c*p-n*s*d+i*h*d,0==(r=i*r[0]+s*r[4]+u*r[8]+m*r[12])){if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},scale:function(t){var e=this.elements,r=t.x,i=t.y;return t=t.z,e[0]*=r,e[4]*=i,e[8]*=t,e[1]*=r,e[5]*=i,e[9]*=t,e[2]*=r,e[6]*=i,e[10]*=t,e[3]*=r,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t,e;return function(r,i,n){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Matrix4);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.elements.set(this.elements),r=1/a;var o=1/s,c=1/h;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=c,e.elements[9]*=c,e.elements[10]*=c,i.setFromRotationMatrix(e),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(t,e,r,i,n,o){var a=this.elements;return a[0]=2*n/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*n/(i-r),a[9]=(i+r)/(i-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,i){var n=-(t=r*Math.tan(m.Math.degToRad(.5*t)));return this.makeFrustum(n*e,t*e,n,t,r,i)},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=e-t,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(e+t)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(r+i)/h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-(o+n)/c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}},m.Ray=function(t,e){this.origin=void 0!==t?t:new m.Vector3,this.direction=void 0!==e?e:new m.Vector3},m.Ray.prototype={constructor:m.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new m.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:function(){var t=new m.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new m.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new m.Vector3;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a){t.copy(i).add(n).multiplyScalar(.5),e.copy(n).sub(i).normalize(),r.copy(this.origin).sub(t);var s,h=.5*i.distanceTo(n),c=-this.direction.dot(e),l=r.dot(this.direction),u=-r.dot(e),p=r.lengthSq(),d=Math.abs(1-c*c);return 0<d?(i=c*u-l,n=c*l-u,s=h*d,0<=i?n>=-s?n<=s?(h=1/d,i*=h,n*=h,c=i*(i+c*n+2*l)+n*(c*i+n+2*u)+p):(n=h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):(n=-h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):n<=-s?(i=Math.max(0,-(-c*h+l)),n=0<i?-h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p):n<=s?(i=0,n=Math.min(Math.max(-h,-u),h),c=n*(n+2*u)+p):(i=Math.max(0,-(c*h+l)),n=0<i?h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p)):(n=0<c?-h:h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p),o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(e).multiplyScalar(n).add(t),c}}(),intersectSphere:function(){var t=new m.Vector3;return function(e,r){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),n=t.dot(t)-i*i,o=e.radius*e.radius;return n>o?null:(o=Math.sqrt(o-n),n=i-o,i+=o,0>n&&0>i?null:0>n?this.at(i,r):this.at(n,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:(t=-(this.origin.dot(t.normal)+t.constant)/e,0<=t?t:null)},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,i,n,o,a;i=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=i?(r=(t.min.x-s.x)*i,i*=t.max.x-s.x):(r=(t.max.x-s.x)*i,i*=t.min.x-s.x),0<=o?(n=(t.min.y-s.y)*o,o*=t.max.y-s.y):(n=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||n>i?null:((n>r||r!==r)&&(r=n),(o<i||i!==i)&&(i=o),0<=a?(n=(t.min.z-s.z)*a,a*=t.max.z-s.z):(n=(t.max.z-s.z)*a,a*=t.min.z-s.z),r>a||n>i?null:((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),0>i?null:this.at(0<=r?r:i,e)))},intersectsBox:function(){var t=new m.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3,i=new m.Vector3;return function(n,o,a,s,h){if(e.subVectors(o,n),r.subVectors(a,n),i.crossVectors(e,r),0<(o=this.direction.dot(i))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,n),0>(n=s*this.direction.dot(r.crossVectors(t,r)))?null:0>(a=s*this.direction.dot(e.cross(t)))||n+a>o?null:(n=-s*t.dot(i),0>n?null:this.at(n/o,h))}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},m.Sphere=function(t,e){this.center=void 0!==t?t:new m.Vector3,this.radius=void 0!==e?e:0},m.Sphere.prototype={constructor:m.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new m.Box3;return function(e,r){var i=this.center;void 0!==r?i.copy(r):t.setFromPoints(e).center(i);for(var n=0,o=0,a=e.length;o<a;o++)n=Math.max(n,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new m.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return(t=t||new m.Box3).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},m.Frustum=function(t,e,r,i,n,o){this.planes=[void 0!==t?t:new m.Plane,void 0!==e?e:new m.Plane,void 0!==r?r:new m.Plane,void 0!==i?i:new m.Plane,void 0!==n?n:new m.Plane,void 0!==o?o:new m.Plane]},m.Frustum.prototype={constructor:m.Frustum,set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;6>r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(g=t.elements)[0];var r=g[1],i=g[2],n=g[3],o=g[4],a=g[5],s=g[6],h=g[7],c=g[8],l=g[9],u=g[10],p=g[11],d=g[12],f=g[13],m=g[14],g=g[15];return e[0].setComponents(n-t,h-o,p-c,g-d).normalize(),e[1].setComponents(n+t,h+o,p+c,g+d).normalize(),e[2].setComponents(n+r,h+a,p+l,g+f).normalize(),e[3].setComponents(n-r,h-a,p-l,g-f).normalize(),e[4].setComponents(n-i,h-s,p-u,g-m).normalize(),e[5].setComponents(n+i,h+s,p+u,g+m).normalize(),this},intersectsObject:function(){var t=new m.Sphere;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var i=0;6>i;i++)if(e[i].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){a=i[n],t.x=0<a.normal.x?r.min.x:r.max.x,e.x=0<a.normal.x?r.max.x:r.min.x,t.y=0<a.normal.y?r.min.y:r.max.y,e.y=0<a.normal.y?r.max.y:r.min.y,t.z=0<a.normal.z?r.min.z:r.max.z,e.z=0<a.normal.z?r.max.z:r.min.z;var o=a.distanceToPoint(t),a=a.distanceToPoint(e);if(0>o&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}},m.Plane=function(t,e){this.normal=void 0!==t?t:new m.Vector3(1,0,0),this.constant=void 0!==e?e:0},m.Plane.prototype={constructor:m.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i,n){return i=t.subVectors(n,i).cross(e.subVectors(r,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new m.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new m.Vector3;return function(e,r){var i=r||new m.Vector3,n=e.delta(t),o=this.normal.dot(n);return 0!==o?(o=-(e.start.dot(this.normal)+this.constant)/o,0>o||1<o?void 0:i.copy(n).multiplyScalar(o).add(e.start)):0===this.distanceToPoint(e.start)?i.copy(e.start):void 0}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new m.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),o=t.copy(this.normal).applyMatrix3(o),a=this.coplanarPoint(e);return a.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},m.Math={generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,r[n]=e[19===n?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(){var t=Math.PI/180;return function(e){return e*t}}(),radToDeg:function(){var t=180/Math.PI;return function(e){return e*t}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},m.Spline=function(t){function e(t,e,r,i,n,o,a){return t=.5*(r-t),i=.5*(i-e),(2*(e-r)+t+i)*a+(-3*(e-r)-2*t-i)*o+t*n+e}this.points=t;var r,i,n,o,a,s,h,c,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,i=Math.floor(r),n=r-i,u[0]=0===i?i:i-1,u[1]=i,u[2]=i>this.points.length-2?this.points.length-1:i+1,u[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[u[0]],h=this.points[u[1]],c=this.points[u[2]],l=this.points[u[3]],o=n*n,a=n*o,p.x=e(s.x,h.x,c.x,l.x,n,o,a),p.y=e(s.y,h.y,c.y,l.y,n,o,a),p.z=e(s.z,h.z,c.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var t,e,r=this.points.length,i=[];for(t=0;t<r;t++)e=this.points[t],i[t]=[e.x,e.y,e.z];return i},this.getLength=function(t){var e,r,i,n=e=e=0,o=new m.Vector3,a=new m.Vector3,s=[],h=0;for(s[0]=0,t||(t=100),r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,i=this.getPoint(e),a.copy(i),h+=a.distanceTo(o),o.copy(i),e*=this.points.length-1,(e=Math.floor(e))!==n&&(s[e]=h,n=e);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(t){var e,r,i,n,o,a,s=[],h=new m.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=c.chunks[e]-c.chunks[e-1],a=Math.ceil(t*r/c.total),n=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(h.copy(i).clone());s.push(h.copy(this.points[e]).clone())}this.points=s}},m.Triangle=function(t,e,r){this.a=void 0!==t?t:new m.Vector3,this.b=void 0!==e?e:new m.Vector3,this.c=void 0!==r?r:new m.Vector3},m.Triangle.normal=function(){var t=new m.Vector3;return function(e,r,i,n){return(n=n||new m.Vector3).subVectors(i,r),t.subVectors(e,r),n.cross(t),e=n.lengthSq(),0<e?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)}}(),m.Triangle.barycoordFromPoint=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a,s){t.subVectors(a,n),e.subVectors(o,n),r.subVectors(i,n),i=t.dot(t),n=t.dot(e),o=t.dot(r);var h=e.dot(e);a=e.dot(r);var c=i*h-n*n;return s=s||new m.Vector3,0===c?s.set(-2,-1,-1):(c=1/c,h=(h*o-n*a)*c,i=(i*a-n*o)*c,s.set(1-h-i,i,h))}}(),m.Triangle.containsPoint=function(){var t=new m.Vector3;return function(e,r,i,n){return 0<=(e=m.Triangle.barycoordFromPoint(e,r,i,n,t)).x&&0<=e.y&&1>=e.x+e.y}}(),m.Triangle.prototype={constructor:m.Triangle,set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new m.Vector3,e=new m.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new m.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return m.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new m.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return m.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return m.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},m.Interpolant=function(t,e,r,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(r),this.sampleValues=e,this.valueSize=r},m.Interpolant.prototype={constructor:m.Interpolant,evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,i=e[r],n=e[r-1];t:{e:{r:{i:if(!(t<i)){for(var o=r+2;;){if(void 0===i){if(t<n)break i;return this._cachedIndex=r=e.length,this.afterEnd_(r-1,t,n)}if(r===o)break;if(n=i,i=e[++r],t<i)break e}i=e.length;break r}if(t>=n)break t;for(t<(o=e[1])&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(r===o)break;if(i=n,n=e[--r-1],t>=n)break e}i=r,r=0}for(;r<i;)n=r+i>>>1,t<e[n]?i=n:r=n+1;if(i=e[r],void 0===(n=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return this._cachedIndex=r=e.length,this.afterEnd_(r-1,n,t)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,r=this.sampleValues,i=this.valueSize;t*=i;for(var n=0;n!==i;++n)e[n]=r[t+n];return e},interpolate_:function(t,e,r,i){throw Error("call to abstract method")},intervalChanged_:function(t,e,r){}},Object.assign(m.Interpolant.prototype,{beforeStart_:m.Interpolant.prototype.copySampleValue_,afterEnd_:m.Interpolant.prototype.copySampleValue_}),m.CubicInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},m.CubicInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.CubicInterpolant,DefaultSettings_:{endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},intervalChanged_:function(t,e,r){var i=this.parameterPositions,n=t-2,o=t+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case m.ZeroSlopeEnding:n=t,a=2*e-r;break;case m.WrapAroundEnding:a=e+i[n=i.length-2]-i[n+1];break;default:n=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case m.ZeroSlopeEnding:o=t,s=2*r-e;break;case m.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=t-1,s=e}t=.5*(r-e),i=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,h=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-e)/(i-e);for(e=-l*(i=(r=p*p)*p)+2*l*r-l*p,l=(1+l)*i+(-1.5-2*l)*r+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*r+.5*p,u=u*i-u*r,r=0;r!==a;++r)n[r]=e*o[h+r]+l*o[s+r]+p*o[t+r]+u*o[c+r];return n}}),m.DiscreteInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.DiscreteInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.DiscreteInterpolant,interpolate_:function(t,e,r,i){return this.copySampleValue_(t-1)}}),m.LinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.LinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.LinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(r=1-(e=(r-e)/(i-e)),i=0;i!==a;++i)n[i]=o[s+i]*r+o[t+i]*e;return n}}),m.QuaternionLinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.QuaternionLinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(e=(r-e)/(i-e),r=(t*=a)+a;t!==r;t+=4)m.Quaternion.slerpFlat(n,0,o,t-a,o,t,e);return n}}),m.Clock=function(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},m.Clock.prototype={constructor:m.Clock,start:function(){this.oldTime=this.startTime=performance.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){if(e=0,this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now(),e=.001*(t-this.oldTime);this.oldTime=t,this.elapsedTime+=e}return e}},m.EventDispatcher=function(){},m.EventDispatcher.prototype={constructor:m.EventDispatcher,apply:function(t){t.addEventListener=m.EventDispatcher.prototype.addEventListener,t.hasEventListener=m.EventDispatcher.prototype.hasEventListener,t.removeEventListener=m.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=m.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=[],i=e.length,n=0;n<i;n++)r[n]=e[n];for(n=0;n<i;n++)r[n].call(this,t)}}}},m.Layers=function(){this.mask=1},m.Layers.prototype={constructor:m.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!=(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function r(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n)){n=0;for(var o=(t=t.children).length;n<o;n++)r(t[n],e,i,!0)}}t.Raycaster=function(e,r,i,n){this.ray=new t.Ray(e,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,r){r instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,i){var n=[];return r(t,this,n,i),n.sort(e),n},intersectObjects:function(t,i){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=t.length;o<a;o++)r(t[o],this,n,i);return n.sort(e),n}}}(m),m.Object3D=function(){Object.defineProperty(this,"id",{value:m.Object3DIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=m.Object3D.DefaultUp.clone();var t=new m.Vector3,e=new m.Euler,r=new m.Quaternion,i=new m.Vector3(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new m.Matrix4},normalMatrix:{value:new m.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new m.Matrix4,this.matrixWorld=new m.Matrix4,this.matrixAutoUpdate=m.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new m.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},m.Object3D.DefaultUp=new m.Vector3(0,1,0),m.Object3D.DefaultMatrixAutoUpdate=!0,m.Object3D.prototype={constructor:m.Object3D,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new m.Quaternion;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new m.Vector3;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new m.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new m.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t instanceof m.Object3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return t=t||new m.Vector3,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){return r=r||new m.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Euler,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new m.Vector3,e=new m.Quaternion;return function(r){return r=r||new m.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r={};(n=void 0===t)&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),0<this.children.length)for(i.children=[],o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object);if(n){var n=e(t.geometries),o=e(t.materials),a=e(t.textures);t=e(t.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<a.length&&(r.textures=a),0<t.length&&(r.images=t)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.rotationAutoUpdate=t.rotationAutoUpdate,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}},m.EventDispatcher.prototype.apply(m.Object3D.prototype),m.Object3DIdCount=0,m.Face3=function(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i instanceof m.Vector3?i:new m.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof m.Color?n:new m.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},m.Face3.prototype={constructor:m.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},m.BufferAttribute=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.BufferAttribute.prototype={constructor:m.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[t+i]=e.array[r+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new m.Color),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new m.Vector2),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new m.Vector3),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new m.Vector4),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},m.Int8Attribute=function(t,e){return new m.BufferAttribute(new Int8Array(t),e)},m.Uint8Attribute=function(t,e){return new m.BufferAttribute(new Uint8Array(t),e)},m.Uint8ClampedAttribute=function(t,e){return new m.BufferAttribute(new Uint8ClampedArray(t),e)},m.Int16Attribute=function(t,e){return new m.BufferAttribute(new Int16Array(t),e)},m.Uint16Attribute=function(t,e){return new m.BufferAttribute(new Uint16Array(t),e)},m.Int32Attribute=function(t,e){return new m.BufferAttribute(new Int32Array(t),e)},m.Uint32Attribute=function(t,e){return new m.BufferAttribute(new Uint32Array(t),e)},m.Float32Attribute=function(t,e){return new m.BufferAttribute(new Float32Array(t),e)},m.Float64Attribute=function(t,e){return new m.BufferAttribute(new Float64Array(t),e)},m.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new m.BufferAttribute(t,e).setDynamic(!0)},m.InstancedBufferAttribute=function(t,e,r){m.BufferAttribute.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedBufferAttribute.prototype=Object.create(m.BufferAttribute.prototype),m.InstancedBufferAttribute.prototype.constructor=m.InstancedBufferAttribute,m.InstancedBufferAttribute.prototype.copy=function(t){return m.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBuffer=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.InterleavedBuffer.prototype={constructor:m.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[t+i]=e.array[r+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},m.InstancedInterleavedBuffer=function(t,e,r){m.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedInterleavedBuffer.prototype=Object.create(m.InterleavedBuffer.prototype),m.InstancedInterleavedBuffer.prototype.constructor=m.InstancedInterleavedBuffer,m.InstancedInterleavedBuffer.prototype.copy=function(t){return m.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBufferAttribute=function(t,e,r){this.uuid=m.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=r},m.InterleavedBufferAttribute.prototype={constructor:m.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}},m.Geometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},m.Geometry.prototype={constructor:m.Geometry,applyMatrix:function(t){for(var e=(new m.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(t);for(r=0,i=this.faces.length;r<i;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var n=0,o=t.vertexNormals.length;n<o;n++)t.vertexNormals[n].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i){var n=void 0!==a?[l[t].clone(),l[e].clone(),l[i].clone()]:[],o=void 0!==s?[r.colors[t].clone(),r.colors[e].clone(),r.colors[i].clone()]:[],n=new m.Face3(t,e,i,n,o);r.faces.push(n),void 0!==h&&r.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[i].clone()])}var r=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],d=n=0;n<o.length;n+=3,d+=2)r.vertices.push(new m.Vector3(o[n],o[n+1],o[n+2])),void 0!==a&&l.push(new m.Vector3(a[n],a[n+1],a[n+2])),void 0!==s&&r.colors.push(new m.Color(s[n],s[n+1],s[n+2])),void 0!==h&&u.push(new m.Vector2(h[d],h[d+1])),void 0!==c&&p.push(new m.Vector2(c[d],c[d+1]));if(void 0!==i)if(0<(o=t.groups).length)for(n=0;n<o.length;n++)for(var d=o[n],f=d.start,g=d.count,d=f,f=f+g;d<f;d+=3)e(i[d],i[d+1],i[d+2]);else for(n=0;n<i.length;n+=3)e(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)e(n,n+1,n+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new m.Matrix4;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new m.Vector3,e=new m.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];t.subVectors(this.vertices[n.c],a),e.subVectors(o,a),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,i;for(i=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)i[e]=new m.Vector3;if(t){var n,o,a,s=new m.Vector3,h=new m.Vector3;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],i[r.a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)i[e].normalize();for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=r.vertexNormals,3===n.length?(n[0].copy(i[r.a]),n[1].copy(i[r.b]),n[2].copy(i[r.c])):(n[0]=i[r.a].clone(),n[1]=i[r.b].clone(),n[2]=i[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var o=new m.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],n=this.morphNormals[t].faceNormals;var a,s,h=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)a=new m.Vector3,s={a:new m.Vector3,b:new m.Vector3,c:new m.Vector3},n.push(a),h.push(s)}for(h=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],a=h.faceNormals[r],s=h.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,i=e.length;r<i;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new m.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(0==t instanceof m.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,h=t.faces,c=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new m.Matrix3).getNormalMatrix(e));for(var l=0,u=a.length;l<u;l++){var p=a[l].clone();void 0!==e&&p.applyMatrix4(e),o.push(p)}for(l=0,u=h.length;l<u;l++){var d,f=(a=h[l]).vertexNormals,g=a.vertexColors;for((p=new m.Face3(a.a+n,a.b+n,a.c+n)).normal.copy(a.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),e=0,o=f.length;e<o;e++)d=f[e].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),e=0,o=g.length;e<o;e++)d=g[e],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=t.length;l<u;l++)if(r=t[l],i=[],void 0!==r){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());c.push(i)}}},mergeMesh:function(t){0==t instanceof m.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,i={},n=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a),void 0===i[t]?(i[t]=e,n.push(this.vertices[e]),o[e]=n.length-1):o[e]=o[i[t]];for(i=[],e=0,r=this.faces.length;e<r;e++)for(a=this.faces[e],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;3>t;t++)if(a[t]===a[(t+1)%3]){i.push(e);break}for(e=i.length-1;0<=e;e--)for(a=i[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return e=this.vertices.length-n.length,this.vertices=n,e},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(n=[]),r=0;r<e;r++){var s=t[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=h.length/3,h.push(t.x,t.y,t.z),c[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/2,p.push(t.x,t.y),d[e])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(a=[],o=0;o<this.vertices.length;o++)s=this.vertices[o],a.push(s.x,s.y,s.z);var s=[],h=[],c={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var f=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],g=0<f.normal.length(),v=0<f.vertexNormals.length,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,x=0<f.vertexColors.length,b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=0,0,0),1,!0),2,!1),3,m),4,g),5,v),6,y),7,x);s.push(b),s.push(f.a,f.b,f.c),s.push(f.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(i(m[0]),i(m[1]),i(m[2]))),g&&s.push(e(f.normal)),v&&(g=f.vertexNormals,s.push(e(g[0]),e(g[1]),e(g[2]))),y&&s.push(r(f.color)),x&&(f=f.vertexColors,s.push(r(f[0]),r(f[1]),r(f[2])))}return n.data={},n.data.vertices=a,n.data.normals=h,0<l.length&&(n.data.colors=l),0<p.length&&(n.data.uvs=[p]),n.data.faces=s,n},clone:function(){return(new m.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,r=0,i=e.length;r<i;r++)this.vertices.push(e[r].clone());for(r=0,i=(e=t.faces).length;r<i;r++)this.faces.push(e[r].clone());for(r=0,i=t.faceVertexUvs.length;r<i;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,c=a.length;h<c;h++)s.push(a[h].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Geometry.prototype),m.GeometryIdCount=0,m.DirectGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},m.DirectGeometry.prototype={constructor:m.DirectGeometry,computeBoundingBox:m.Geometry.prototype.computeBoundingBox,computeBoundingSphere:m.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){var e,r,i=[];t=t.faces;for(var n=0;n<t.length;n++){var o=t[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,r=t.faces,i=t.vertices,n=t.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=t.morphTargets,h=s.length;if(0<h){for(e=[],v=0;v<h;v++)e[v]=[];this.morphTargets.position=e}var c,l=t.morphNormals,u=l.length;if(0<u){for(c=[],v=0;v<u;v++)c[v]=[];this.morphTargets.normal=c}for(var p=t.skinIndices,d=t.skinWeights,f=p.length===i.length,g=d.length===i.length,v=0;v<r.length;v++){var y=r[v];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;for(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),3===(x=y.vertexColors).length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===o&&(x=n[0][v],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new m.Vector2,new m.Vector2,new m.Vector2))),!0===a&&(x=n[1][v],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new m.Vector2,new m.Vector2,new m.Vector2))),x=0;x<h;x++){var b=s[x].vertices;e[x].push(b[y.a],b[y.b],b[y.c])}for(x=0;x<u;x++)b=l[x].vertexNormals[v],c[x].push(b.a,b.b,b.c);f&&this.skinIndices.push(p[y.a],p[y.b],p[y.c]),g&&this.skinWeights.push(d[y.a],d[y.b],d[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.DirectGeometry.prototype),m.BufferGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.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:1/0}},m.BufferGeometry.prototype={constructor:m.BufferGeometry,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){if(0==e instanceof m.BufferAttribute&&0==e instanceof m.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new m.BufferAttribute(e,r));else{if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new m.Matrix3).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof m.Points||t instanceof m.Line){t=new m.Float32Attribute(3*e.vertices.length,3);var r=new m.Float32Attribute(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new m.Float32Attribute(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof m.Mesh&&e instanceof m.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof m.Mesh){var r=e.__directGeometry;if(void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new m.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){r=new Float32Array(3*t.vertices.length),this.addAttribute("position",new m.BufferAttribute(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new m.BufferAttribute(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new m.BufferAttribute(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new m.BufferAttribute(r,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var e in t.morphTargets){for(var r=[],i=t.morphTargets[e],n=0,o=i.length;n<o;n++){var a=i[n],s=new m.Float32Attribute(3*a.length,3);r.push(s.copyVector3sArray(a))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new m.Float32Attribute(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new m.Float32Attribute(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:(new m.Vector3,function(){null===this.boundingBox&&(this.boundingBox=new m.Box3);var t=this.attributes.position.array;t&&this.boundingBox.setFromArray(t),void 0!==t&&0!==t.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}),computeBoundingSphere:function(){var t=new m.Box3,e=new m.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere);var r=this.attributes.position.array;if(r){var i=this.boundingSphere.center;t.setFromArray(r),t.center(i);for(var n=0,o=0,a=r.length;o<a;o+=3)e.fromArray(r,o),n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new m.BufferAttribute(new Float32Array(i.length),3));else for(var n=e.normal.array,o=0,a=n.length;o<a;o++)n[o]=0;var s,h,c,n=e.normal.array,l=new m.Vector3,u=new m.Vector3,p=new m.Vector3,d=new m.Vector3,f=new m.Vector3;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var g=0,v=r.length;g<v;++g)for(o=r[g],a=o.start,s=o.count,o=a,a+=s;o<a;o+=3)s=3*t[o+0],h=3*t[o+1],c=3*t[o+2],l.fromArray(i,s),u.fromArray(i,h),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[s]+=d.x,n[s+1]+=d.y,n[s+2]+=d.z,n[h]+=d.x,n[h+1]+=d.y,n[h+2]+=d.z,n[c]+=d.x,n[c+1]+=d.y,n[c+2]+=d.z}else for(o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),u.fromArray(i,o+3),p.fromArray(i,o+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[o]=d.x,n[o+1]=d.y,n[o+2]=d.z,n[o+3]=d.x,n[o+4]=d.y,n[o+5]=d.z,n[o+6]=d.x,n[o+7]=d.y,n[o+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(0!=t instanceof m.BufferGeometry){void 0===e&&(e=0);var r,i=this.attributes;for(r in i)if(void 0!==t.attributes[r])for(var n=i[r].array,o=t.attributes[r],a=o.array,s=0,o=o.itemSize*e;s<a.length;s++,o++)n[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)t=i[n],e=i[n+1],r=i[n+2],t=1/Math.sqrt(t*t+e*e+r*r),i[n]*=t,i[n+1]*=t,i[n+2]*=t},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new m.BufferGeometry,r=this.index.array,i=this.attributes;for(t in i){for(var n=(o=i[t]).array,o=o.itemSize,a=new n.constructor(r.length*o),s=0,h=0,c=0,l=r.length;c<l;c++)for(var s=r[c]*o,u=0;u<o;u++)a[h++]=n[s++];e.addAttribute(t,new m.BufferAttribute(a,o))}return e},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(r=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:r}),i=this.attributes;for(e in i){var n=i[e],r=Array.prototype.slice.call(n.array);t.data.attributes[e]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new m.BufferGeometry).copy(this)},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.BufferGeometry.prototype),m.BufferGeometry.MaxIndex=65535,m.InstancedBufferGeometry=function(){m.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},m.InstancedBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.InstancedBufferGeometry.prototype.constructor=m.InstancedBufferGeometry,m.InstancedBufferGeometry.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,instances:r})},m.InstancedBufferGeometry.prototype.copy=function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count,i.instances)}return this},m.EventDispatcher.prototype.apply(m.InstancedBufferGeometry.prototype),m.Uniform=function(t,e){this.type=t,this.value=e,this.dynamic=!1},m.Uniform.prototype={constructor:m.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},m.AnimationClip=function(t,e,r){this.name=t||m.Math.generateUUID(),this.tracks=r,this.duration=void 0!==e?e:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},m.AnimationClip.prototype={constructor:m.AnimationClip,resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e)var i=this.tracks[e],t=Math.max(t,i.times[i.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(m.AnimationClip,{parse:function(t){for(var e=[],r=t.tracks,i=1/(t.fps||1),n=0,o=r.length;n!==o;++n)e.push(m.KeyframeTrack.parse(r[n]).scale(i));return new m.AnimationClip(t.name,t.duration,e)},toJSON:function(t){var e=[],r=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var i=0,n=r.length;i!==n;++i)e.push(m.KeyframeTrack.toJSON(r[i]));return t},CreateFromMorphTargetSequence:function(t,e,r){for(var i=e.length,n=[],o=0;o<i;o++){h=[],(s=[]).push((o+i-1)%i,o,(o+1)%i),h.push(0,1,0);var a=m.AnimationUtils.getKeyframeOrder(s),s=m.AnimationUtils.sortedArray(s,1,a),h=m.AnimationUtils.sortedArray(h,1,a);0===s[0]&&(s.push(i),h.push(h[0])),n.push(new m.NumberKeyframeTrack(".morphTargetInfluences["+e[o].name+"]",s,h).scale(1/r))}return new m.AnimationClip(t,-1,n)},findByName:function(t,e){for(var r=0;r<t.length;r++)if(t[r].name===e)return t[r];return null},CreateClipsFromMorphTargetSequences:function(t,e){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=t.length;n<o;n++){var a=t[n],s=a.name.match(i);if(s&&1<s.length){var h=s[1];(s=r[h])||(r[h]=s=[]),s.push(a)}}i=[];for(h in r)i.push(m.AnimationClip.CreateFromMorphTargetSequence(h,r[h],e));return i},parseAnimation:function(t,e,r){if(!t)return console.error("  no animation in JSONLoader data"),null;r=function(t,e,r,i,n){if(0!==r.length){var o=[],a=[];m.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new t(e,o,a))}};var i=[],n=t.name||"default",o=t.length||-1,a=t.fps||30;t=t.hierarchy||[];for(var s=0;s<t.length;s++){var h=t[s].keys;if(h&&0!=h.length)if(h[0].morphTargets){for(var o={},c=0;c<h.length;c++)if(h[c].morphTargets)for(d=0;d<h[c].morphTargets.length;d++)o[h[c].morphTargets[d]]=-1;for(var l in o){for(var u=[],p=[],d=0;d!==h[c].morphTargets.length;++d){var f=h[c];u.push(f.time),p.push(f.morphTarget===l?1:0)}i.push(new m.NumberKeyframeTrack(".morphTargetInfluence["+l+"]",u,p))}o=o.length*(a||1)}else c=".bones["+e[s].name+"]",r(m.VectorKeyframeTrack,c+".position",h,"pos",i),r(m.QuaternionKeyframeTrack,c+".quaternion",h,"rot",i),r(m.VectorKeyframeTrack,c+".scale",h,"scl",i)}return 0===i.length?null:new m.AnimationClip(n,o,i)}}),m.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},m.AnimationMixer.prototype={constructor:m.AnimationMixer,clipAction:function(t,e){var r,i=(e||this._root).uuid,n="string"==typeof t?t:t.name,o=t!==n?t:null,a=this._actionsByClip[n];if(void 0!==a){if(void 0!==(r=a.actionByRoot[i]))return r;if(r=a.knownActions[0],o=r._clip,t!==n&&t!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new m.AnimationMixer._Action(this,o,e),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(t,e){var r=(e||this._root).uuid,i=this._actionsByClip["string"==typeof t?t:t.name];return void 0!==i?i.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==e;++n)t[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,i=this.time+=t,n=Math.sign(t),o=this._accuIndex^=1,a=0;a!==r;++a){var s=e[a];s.enabled&&s._update(i,t,n,o)}for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.name;var r=this._actionsByClip,i=r[t];if(void 0!==i){for(var n=0,o=(i=i.knownActions).length;n!==o;++n){var a=i[n];this._deactivateAction(a);var s=a._cacheIndex,h=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,h._cacheIndex=s,e[s]=h,e.pop(),this._removeInactiveBindingsForAction(a)}delete r[t]}},uncacheRoot:function(t){t=t.uuid;var e,r=this._actionsByClip;for(e in r){var i=r[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(void 0!==(e=this._bindingsByRootAndName[t]))for(var n in e)(t=e[n]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},m.EventDispatcher.prototype.apply(m.AnimationMixer.prototype),m.AnimationMixer._Action=function(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var i={endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},n=0;n!==e;++n){var o=t[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=m.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0},m.AnimationMixer._Action.prototype={constructor:m.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){r=this._clip.duration;var i=t._clip.duration,n=r/i;t.warp(1,i/r,e),this.warp(n,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._currentTimeScale,0,t)},warp:function(t,e,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,i[1]=n+r,o[0]=t/a,o[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,i){if(null!==(n=this._startTime)){if(0>(e=(t-n)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var n=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),n[o].accumulate(i,t)}},_updateWeight:function(t){if(e=0,this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(t)[0],e=e*i;t>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){if(e=0,!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;null!==r&&(e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.pause=!0:this.timeScale=e))}return this._effectiveTimeScale=e},_updateTime:function(t){if(a=this.time+t,0===t)return a;var e=this._clip.duration,r=this.loop,i=this._loopCount,n=!1;switch(r){case m.LoopOnce:if(-1===i&&(this.loopCount=0,this._setEndings(!0,!0,!1)),a>=e)a=e;else{if(!(0>a))break;a=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1});break;case m.LoopPingPong:n=!0;case m.LoopRepeat:if(-1===i&&(0<t?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),a>=e||0>a){var o=Math.floor(a/e),a=a-e*o,i=i+Math.abs(o),s=this.repetitions-i;if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=0<t?e:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});break}0===s?(t=0>t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}if(r===m.LoopPingPong&&1==(1&i))return this.time=a,e-a}return this.time=a},_setEndings:function(t,e,r){var i=this._interpolantSettings;r?(i.endingStart=m.ZeroSlopeEnding,i.endingEnd=m.ZeroSlopeEnding):(i.endingStart=t?this.zeroSlopeAtStart?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding,i.endingEnd=e?this.zeroSlopeAtEnd?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding)},_scheduleFading:function(t,e,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,o[0]=e,i[1]=n+t,o[1]=r,this}},Object.assign(m.AnimationMixer.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,i=t._clip.tracks,n=i.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,h=this._bindingsByRootAndName,c=h[s];for(void 0===c&&(c={},h[s]=c),h=0;h!==n;++h){var l=i[h],u=l.name,p=c[u];if(void 0===p){if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,u));continue}++(p=new m.PropertyMixer(m.PropertyBinding.create(r,u,e&&e._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,u)}o[h]=p,a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.name,i=this._actionsByClip[r];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,i=(e=t._propertyBindings).length;r!==i;++r){var n=e[r];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,i=e.length;r!==i;++r){var n=e[r];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,r){var i=this._actions,n=this._actionsByClip,o=n[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,n[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=i.length,i.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],i=t._cacheIndex;r._cacheIndex=i,e[i]=r,e.pop(),t._cacheIndex=null;var r=t._clip.name,n=(i=this._actionsByClip)[r],o=n.knownActions,a=o[o.length-1],s=t._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),t._byClipCacheIndex=null,delete n.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,r=(t=t._propertyBindings).length;e!==r;++e){var i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,i=this._nActiveActions++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,i=--this._nActiveActions,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_addInactiveBinding:function(t,e,r){var i=this._bindingsByRootAndName,n=i[e],o=this._bindings;void 0===n&&(n={},i[e]=n),n[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=(i=t.binding).rootNode.uuid,i=i.path,n=this._bindingsByRootAndName,o=n[r],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[i];t:{for(var s in o)break t;delete n[r]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=this._nActiveBindings++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=--this._nActiveBindings,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new m.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];t.__cacheIndex=i,e[i]=t,n.__cacheIndex=r,e[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),m.AnimationObjectGroup=function(t){this.uuid=m.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},m.AnimationObjectGroup.prototype={constructor:m.AnimationObjectGroup,add:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,h=s.length,c=0,l=arguments.length;c!==l;++c){var u=arguments[c],p=n[d=u.uuid];if(void 0===p){p=r++,n[d]=p,e.push(u);for(var d=0,f=h;d!==f;++d)s[d].push(new m.PropertyBinding(u,o[d],a[d]))}else if(p<i){var g=e[p],v=--i;for(n[(f=e[v]).uuid]=p,e[p]=f,n[d]=v,e[v]=u,d=0,f=h;d!==f;++d){var y=s[d],x=y[p];y[p]=y[v],void 0===x&&(x=new m.PropertyBinding(u,o[d],a[d])),y[v]=x}}else e[p]!==g&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],c=h.uuid,l=i[c];if(void 0!==l&&l>=r){var u=r++,p=e[u];for(i[p.uuid]=l,e[l]=p,i[c]=u,e[u]=h,h=0,c=o;h!==c;++h){var d=(p=n[h])[l];p[l]=p[u],p[u]=d}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,h=arguments.length;s!==h;++s){var c=arguments[s].uuid,l=n[c];if(void 0!==l)if(delete n[c],l<i){var u=e[c=--i],p=--r,d=e[p];for(n[u.uuid]=l,e[l]=u,n[d.uuid]=c,e[c]=d,e.pop(),u=0,d=a;u!==d;++u){var f=o[u],m=f[p];f[l]=f[c],f[c]=m,f.pop()}}else for(p=--r,d=e[p],n[d.uuid]=l,e[l]=d,e.pop(),u=0,d=a;u!==d;++u)f=o[u],f[l]=f[p],f.pop()}this.nCachedObjects_=i},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,i=r[t],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,h=this.nCachedObjects_,c=Array(s.length),i=n.length;for(r[t]=i,o.push(t),a.push(e),n.push(c),r=h,i=s.length;r!==i;++r)c[r]=new m.PropertyBinding(s[r],t,e);return c},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},m.AnimationUtils={arraySlice:function(t,e,r){return m.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,r)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,r=Array(e),i=0;i!==e;++i)r[i]=i;return r.sort(function(e,r){return t[e]-t[r]}),r},sortedArray:function(t,e,r){for(var i=t.length,n=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*e,h=0;h!==e;++h)n[a++]=t[s+h];return n},flattenJSON:function(t,e,r,i){for(var n=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),r.push.apply(r,a)),o=t[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(r,r.length)),o=t[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),r.push(a)),o=t[n++]}while(void 0!==o)}}},m.KeyframeTrack=function(t,e,r,i){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keyframes in track named "+t);this.name=t,this.times=m.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=m.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},m.KeyframeTrack.prototype={constructor:m.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new m.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new m.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new m.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e=void 0;switch(t){case m.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case m.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case m.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn(e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return m.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return m.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return m.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<t;)++n;for(;-1!==o&&r[o]>e;)--o;return++o,0===n&&o===i||(n>=o&&(o=Math.max(o,1),n=o-1),i=this.getValueSize(),this.times=m.AnimationUtils.arraySlice(r,n,o),this.values=m.AnimationUtils.arraySlice(this.values,n*i,o*i)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("invalid value size in track",this),t=!1);var e=this.times,r=this.values,i=e.length;0===i&&(console.error("track is empty",this),t=!1);for(var n=null,o=0;o!==i;o++){var a=e[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),t=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),t=!1;break}n=a}if(void 0!==r&&m.AnimationUtils.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(i=r[o],isNaN(i)){console.error("value is not a valid number",this,o,i),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),i=1,n=1,o=t.length-1;n<=o;++n){var a=!1;if((l=t[n])!==t[n+1]&&(1!==n||l!==l[0]))for(var s=n*r,h=s-r,c=s+r,l=0;l!==r;++l){var u=e[s+l];if(u!==e[h+l]||u!==e[c+l]){a=!0;break}}if(a){if(n!==i)for(t[i]=t[n],a=n*r,s=i*r,l=0;l!==r;++l)e[s+l]=e[a+l];++i}}return i!==t.length&&(this.times=m.AnimationUtils.arraySlice(t,0,i),this.values=m.AnimationUtils.arraySlice(e,0,i*r)),this}},Object.assign(m.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=m.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];m.AnimationUtils.flattenJSON(t.keys,r,i,"value"),t.times=r,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){if(void 0!==(e=t.constructor).toJSON)e=e.toJSON(t);else{var e={name:t.name,times:m.AnimationUtils.convertArray(t.times,Array),values:m.AnimationUtils.convertArray(t.values,Array)},r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return m.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return m.VectorKeyframeTrack;case"color":return m.ColorKeyframeTrack;case"quaternion":return m.QuaternionKeyframeTrack;case"bool":case"boolean":return m.BooleanKeyframeTrack;case"string":return m.StringKeyframeTrack}throw Error("Unsupported typeName: "+t)}}),m.PropertyBinding=function(t,e,r){this.path=e,this.parsedPath=r||m.PropertyBinding.parseTrackName(e),this.node=m.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},m.PropertyBinding.prototype={constructor:m.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(this.node=t=m.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("  can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);for(t=t.skeleton.bones,r=0;r<t.length;r++)if(t[r].name===o){o=r;break}break;default:if(void 0===t[r])return void console.error("  can not bind to objectName of node, undefined",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}if(o=t[i]){if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(t.geometry.morphTargets[r].name===n){n=r;break}}r=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][e]}else console.error("  trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(m.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:m.PropertyBinding.prototype.getValue,_setValue_unbound:m.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)t[e++]=r[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),m.PropertyBinding.Composite=function(t,e,r){r=r||m.PropertyBinding.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)},m.PropertyBinding.Composite.prototype={constructor:m.PropertyBinding.Composite,getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}},m.PropertyBinding.create=function(t,e,r){return t instanceof m.AnimationObjectGroup?new m.PropertyBinding.Composite(t,e,r):new m.PropertyBinding(t,e,r)},m.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=e.exec(t);if(!r)throw Error("cannot parse trackName at all: "+t);if(r.index===e.lastIndex&&e.lastIndex++,null===(e={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},m.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var i=t.bones[r];if(i.name===e)return i}return null}(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var r=0;r<t.length;r++){var n=t[r];if(n.name===e||n.uuid===e||(n=i(n.children)))return n}return null};if(r=i(t.children))return r}return null},m.PropertyMixer=function(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0},m.PropertyMixer.prototype={constructor:m.PropertyMixer,accumulate:function(t,e){var r=this.buffer,i=this.valueSize,n=t*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=e}else o+=e,this._mixBufferRegion(r,n,0,e/o,i);this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer;t=t*e+e;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,t,3*e,1-i,e);for(var i=e,o=e+e;i!==o;++i)if(r[i]!==r[i+e]){n.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var i=e;i!==r;++i)t[i]=t[r+i%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,i,n){if(.5<=i)for(i=0;i!==n;++i)t[e+i]=t[r+i]},_slerp:function(t,e,r,i,n){m.Quaternion.slerpFlat(t,e,t,e,t,r,i)},_lerp:function(t,e,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*i}}},m.BooleanKeyframeTrack=function(t,e,r){m.KeyframeTrack.call(this,t,e,r)},m.BooleanKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.NumberKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.NumberKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.NumberKeyframeTrack,ValueTypeName:"number"}),m.QuaternionKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new m.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),m.StringKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.StringKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.VectorKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.VectorKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.VectorKeyframeTrack,ValueTypeName:"vector"}),m.Audio=function(t){m.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},m.Audio.prototype=Object.create(m.Object3D.prototype),m.Audio.prototype.constructor=m.Audio,m.Audio.prototype.getOutput=function(){return this.gain},m.Audio.prototype.load=function(t){var e=new m.AudioBuffer(this.context);return e.load(t),this.setBuffer(e),this},m.Audio.prototype.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},m.Audio.prototype.setBuffer=function(t){var e=this;return t.onReady(function(t){e.source.buffer=t,e.sourceType="buffer",e.autoplay&&e.play()}),this},m.Audio.prototype.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 t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}},m.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},m.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},m.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},m.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},m.Audio.prototype.getFilter=function(){return this.filter},m.Audio.prototype.setFilter=function(t){void 0===t&&(t=null),!0===this.isPlaying?(this.disconnect(),this.filter=t,this.connect()):this.filter=t},m.Audio.prototype.setPlaybackRate=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},m.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},m.Audio.prototype.onEnded=function(){this.isPlaying=!1},m.Audio.prototype.setLoop=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=t},m.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},m.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},m.Audio.prototype.getVolume=function(){return this.gain.gain.value},m.AudioAnalyser=function(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},m.AudioAnalyser.prototype={constructor:m.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},m.AudioBuffer=function(t){this.context=t,this.ready=!1,this.readyCallbacks=[]},m.AudioBuffer.prototype.load=function(t){var e=this,r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(t){e.context.decodeAudioData(this.response,function(t){for(e.buffer=t,e.ready=!0,t=0;t<e.readyCallbacks.length;t++)e.readyCallbacks[t](e.buffer);e.readyCallbacks=[]})},r.send(),this},m.AudioBuffer.prototype.onReady=function(t){this.ready?t(this.buffer):this.readyCallbacks.push(t)},m.PositionalAudio=function(t){m.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},m.PositionalAudio.prototype=Object.create(m.Audio.prototype),m.PositionalAudio.prototype.constructor=m.PositionalAudio,m.PositionalAudio.prototype.getOutput=function(){return this.panner},m.PositionalAudio.prototype.setRefDistance=function(t){this.panner.refDistance=t},m.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},m.PositionalAudio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},m.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},m.PositionalAudio.prototype.setDistanceModel=function(t){this.panner.distanceModel=t},m.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},m.PositionalAudio.prototype.setMaxDistance=function(t){this.panner.maxDistance=t},m.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},m.PositionalAudio.prototype.updateMatrixWorld=function(){var t=new m.Vector3;return function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}(),m.AudioListener=function(){m.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},m.AudioListener.prototype=Object.create(m.Object3D.prototype),m.AudioListener.prototype.constructor=m.AudioListener,m.AudioListener.prototype.getInput=function(){return this.gain},m.AudioListener.prototype.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)},m.AudioListener.prototype.setFilter=function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},m.AudioListener.prototype.getFilter=function(){return this.filter},m.AudioListener.prototype.setMasterVolume=function(t){this.gain.gain.value=t},m.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},m.AudioListener.prototype.updateMatrixWorld=function(){var t=new m.Vector3,e=new m.Quaternion,r=new m.Vector3,i=new m.Vector3;return function(n){m.Object3D.prototype.updateMatrixWorld.call(this,n),n=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,r),i.set(0,0,-1).applyQuaternion(e),n.setPosition(t.x,t.y,t.z),n.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z)}}(),m.Camera=function(){m.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new m.Matrix4,this.projectionMatrix=new m.Matrix4},m.Camera.prototype=Object.create(m.Object3D.prototype),m.Camera.prototype.constructor=m.Camera,m.Camera.prototype.getWorldDirection=function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),m.Camera.prototype.lookAt=function(){var t=new m.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),m.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},m.Camera.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},m.CubeCamera=function(t,e,r){m.Object3D.call(this),this.type="CubeCamera";var i=new m.PerspectiveCamera(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new m.Vector3(1,0,0)),this.add(i);var n=new m.PerspectiveCamera(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new m.Vector3(-1,0,0)),this.add(n);var o=new m.PerspectiveCamera(90,1,t,e);o.up.set(0,0,1),o.lookAt(new m.Vector3(0,1,0)),this.add(o);var a=new m.PerspectiveCamera(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new m.Vector3(0,-1,0)),this.add(a);var s=new m.PerspectiveCamera(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new m.Vector3(0,0,1)),this.add(s);var h=new m.PerspectiveCamera(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new m.Vector3(0,0,-1)),this.add(h),this.renderTarget=new m.WebGLRenderTargetCube(r,r,{format:m.RGBFormat,magFilter:m.LinearFilter,minFilter:m.LinearFilter}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,i,r),r.activeCubeFace=1,t.render(e,n,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}},m.CubeCamera.prototype=Object.create(m.Object3D.prototype),m.CubeCamera.prototype.constructor=m.CubeCamera,m.OrthographicCamera=function(t,e,r,i,n,o){m.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},m.OrthographicCamera.prototype=Object.create(m.Camera.prototype),m.OrthographicCamera.prototype.constructor=m.OrthographicCamera,m.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-t,r+t,i+e,i-e,this.near,this.far)},m.OrthographicCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},m.OrthographicCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},m.PerspectiveCamera=function(t,e,r,i){m.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype=Object.create(m.Camera.prototype),m.PerspectiveCamera.prototype.constructor=m.PerspectiveCamera,m.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*m.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,o){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=m.Math.radToDeg(2*Math.atan(Math.tan(.5*m.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=(r=this.fullWidth/this.fullHeight)*(i=-(t=Math.tan(m.Math.degToRad(.5*t))*this.near)),r=Math.abs(r*t-e),i=Math.abs(t-i);this.projectionMatrix.makeFrustum(e+this.x*r/this.fullWidth,e+(this.x+this.width)*r/this.fullWidth,t-(this.y+this.height)*i/this.fullHeight,t-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},m.PerspectiveCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.focalLength=t.focalLength,this.zoom=t.zoom,this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this},m.PerspectiveCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},m.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new m.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new m.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},m.StereoCamera.prototype={constructor:m.StereoCamera,update:function(){var t,e,r,i,n,o=new m.Matrix4,a=new m.Matrix4;return function(s){if(t!==s.focalLength||e!==s.fov||r!==s.aspect*this.aspect||i!==s.near||n!==s.far){t=s.focalLength,e=s.fov,r=s.aspect*this.aspect,i=s.near,n=s.far;var h,c,l=s.projectionMatrix.clone(),u=.032*i/t,p=i*Math.tan(m.Math.degToRad(.5*e));a.elements[12]=-.032,o.elements[12]=.032,h=-p*r+u,c=p*r+u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraL.projectionMatrix.copy(l),h=-p*r-u,c=p*r-u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(s.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(s.matrixWorld).multiply(o)}}()},m.Light=function(t,e){m.Object3D.call(this),this.type="Light",this.color=new m.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},m.Light.prototype=Object.create(m.Object3D.prototype),m.Light.prototype.constructor=m.Light,m.Light.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},m.Light.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.exponent&&(t.object.exponent=this.exponent),t},m.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new m.Vector2(512,512),this.map=null,this.matrix=new m.Matrix4},m.LightShadow.prototype={constructor:m.LightShadow,copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},m.AmbientLight=function(t,e){m.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},m.AmbientLight.prototype=Object.create(m.Light.prototype),m.AmbientLight.prototype.constructor=m.AmbientLight,m.DirectionalLight=function(t,e){m.Light.call(this,t,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.shadow=new m.LightShadow(new m.OrthographicCamera(-5,5,5,-5,.5,500))},m.DirectionalLight.prototype=Object.create(m.Light.prototype),m.DirectionalLight.prototype.constructor=m.DirectionalLight,m.DirectionalLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.HemisphereLight=function(t,e,r){m.Light.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new m.Color(e)},m.HemisphereLight.prototype=Object.create(m.Light.prototype),m.HemisphereLight.prototype.constructor=m.HemisphereLight,m.HemisphereLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this},m.PointLight=function(t,e,r,i){m.Light.call(this,t,e),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(90,1,.5,500))},m.PointLight.prototype=Object.create(m.Light.prototype),m.PointLight.prototype.constructor=m.PointLight,m.PointLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this},m.SpotLight=function(t,e,r,i,n,o){m.Light.call(this,t,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==o?o:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(50,1,.5,500))},m.SpotLight.prototype=Object.create(m.Light.prototype),m.SpotLight.prototype.constructor=m.SpotLight,m.SpotLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.exponent=t.exponent,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.Cache={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},m.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},m.Loader.prototype={constructor:m.Loader,crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var i=[],n=0;n<t.length;++n)i[n]=this.createMaterial(t[n],e,r);return i},createMaterial:function(){var t,e,r;return function(i,n,o){function a(t,r,i,a,s){t=n+t;var c=m.Loader.Handlers.get(t);return null!==c?t=c.load(t):(e.setCrossOrigin(o),t=e.load(t)),void 0!==r&&(t.repeat.fromArray(r),1!==r[0]&&(t.wrapS=m.RepeatWrapping),1!==r[1]&&(t.wrapT=m.RepeatWrapping)),void 0!==i&&t.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(t.wrapS=m.RepeatWrapping),"mirror"===a[0]&&(t.wrapS=m.MirroredRepeatWrapping),"repeat"===a[1]&&(t.wrapT=m.RepeatWrapping),"mirror"===a[1]&&(t.wrapT=m.MirroredRepeatWrapping)),void 0!==s&&(t.anisotropy=s),r=m.Math.generateUUID(),h[r]=t,r}void 0===t&&(t=new m.Color),void 0===e&&(e=new m.TextureLoader),void 0===r&&(r=new m.MaterialLoader);var s,h={},c={uuid:m.Math.generateUUID(),type:"MeshLambertMaterial"};for(s in i){var l=i[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=l;break;case"blending":c.blending=m[l];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":c.color=t.fromArray(l).getHex();break;case"colorSpecular":c.specular=t.fromArray(l).getHex();break;case"colorEmissive":c.emissive=t.fromArray(l).getHex();break;case"specularCoef":c.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(c.type="MeshPhongMaterial");break;case"mapDiffuse":c.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":c.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":c.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=m.BackSide;break;case"doubleSided":c.side=m.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[s]=l;break;case"vertexColors":!0===l&&(c.vertexColors=m.VertexColors),"face"===l&&(c.vertexColors=m.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,l)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,1>c.opacity&&(c.transparent=!0),r.setTextures(h),r.parse(c)}}()},m.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r+1];if(e[r].test(t))return n}return null}},m.XHRLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.XHRLoader.prototype={constructor:m.XHRLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return e&&setTimeout(function(){e(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",t,!0),a.addEventListener("load",function(r){var o=r.target.response;m.Cache.add(t,o),200===this.status?(e&&e(o),n.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),n.manager.itemEnd(t)):(i&&i(r),n.manager.itemError(t))},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(t),a},setPath:function(t){this.path=t},setResponseType:function(t){this.responseType=t},setWithCredentials:function(t){this.withCredentials=t}},m.FontLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.FontLoader.prototype={constructor:m.FontLoader,load:function(t,e,r,i){new m.XHRLoader(this.manager).load(t,function(t){e(new m.Font(JSON.parse(t.substring(65,t.length-2))))},r,i)}},m.ImageLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.ImageLoader.prototype={constructor:m.ImageLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return n.manager.itemStart(t),e?setTimeout(function(){e(o),n.manager.itemEnd(t)},0):n.manager.itemEnd(t),o;var a=document.createElement("img");return a.addEventListener("load",function(r){m.Cache.add(t,this),e&&e(this),n.manager.itemEnd(t)},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:m.DefaultLoadingManager,this.withCredentials=!1},m.JSONLoader.prototype={constructor:m.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(t,e,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:m.Loader.prototype.extractUrlBase(t),a=new m.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var i=(r=JSON.parse(r)).metadata;if(void 0!==i&&void 0!==(i=i.type)){if("object"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),e(r.geometry,r.materials)},r,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){var r=new m.Geometry,i=void 0!==t.scale?1/t.scale:1;return function(e){var i,n,o,a,s,h,c,l,u,p,d,f,g,v=t.faces;h=t.vertices;var y=t.normals,x=t.colors,b=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&b++;for(i=0;i<b;i++)r.faceVertexUvs[i]=[]}for(a=0,s=h.length;a<s;)i=new m.Vector3,i.x=h[a++]*e,i.y=h[a++]*e,i.z=h[a++]*e,r.vertices.push(i);for(a=0,s=v.length;a<s;)if(e=v[a++],u=1&e,o=2&e,i=8&e,c=16&e,p=32&e,h=64&e,e&=128,u){if(u=new m.Face3,u.a=v[a],u.b=v[a+1],u.c=v[a+3],d=new m.Face3,d.a=v[a+1],d.b=v[a+2],d.c=v[a+3],a+=4,o&&(o=v[a++],u.materialIndex=o,d.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),2!==n&&r.faceVertexUvs[i][o].push(g),0!==n&&r.faceVertexUvs[i][o+1].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c]),d.normal.copy(u.normal)),p)for(i=0;4>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),2!==i&&u.vertexNormals.push(p),0!==i&&d.vertexNormals.push(p);if(h&&(h=v[a++],h=x[h],u.color.setHex(h),d.color.setHex(h)),e)for(i=0;4>i;i++)h=v[a++],h=x[h],2!==i&&u.vertexColors.push(new m.Color(h)),0!==i&&d.vertexColors.push(new m.Color(h));r.faces.push(u),r.faces.push(d)}else{if(u=new m.Face3,u.a=v[a++],u.b=v[a++],u.c=v[a++],o&&(o=v[a++],u.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),r.faceVertexUvs[i][o].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c])),p)for(i=0;3>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),u.vertexNormals.push(p);if(h&&(h=v[a++],u.color.setHex(x[h])),e)for(i=0;3>i;i++)h=v[a++],u.vertexColors.push(new m.Color(x[h]));r.faces.push(u)}}(i),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e)r.skinWeights.push(new m.Vector4(t.skinWeights[i],1<e?t.skinWeights[i+1]:0,2<e?t.skinWeights[i+2]:0,3<e?t.skinWeights[i+3]:0));if(t.skinIndices)for(i=0,n=t.skinIndices.length;i<n;i+=e)r.skinIndices.push(new m.Vector4(t.skinIndices[i],1<e?t.skinIndices[i+1]:0,2<e?t.skinIndices[i+2]:0,3<e?t.skinIndices[i+3]:0));r.bones=t.bones,r.bones&&0<r.bones.length&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){r.morphTargets[i]={},r.morphTargets[i].name=t.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,h=a.length;s<h;s+=3){var c=new m.Vector3;c.x=a[s]*e,c.y=a[s+1]*e,c.z=a[s+2]*e,o.push(c)}}if(void 0!==t.morphColors&&0<t.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),e=r.faces,o=t.morphColors[0].colors,i=0,n=e.length;i<n;i++)e[i].color.fromArray(o,3*i)}(i),function(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var o=m.AnimationClip.parseAnimation(i[n],r.bones);o&&e.push(o)}r.morphTargets&&(i=m.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),e=e.concat(i)),0<e.length&&(r.animations=e)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:r}:(i=m.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:r,materials:i})}},m.LoadingManager=function(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}},m.DefaultLoadingManager=new m.LoadingManager,m.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.BufferGeometryLoader.prototype={constructor:m.BufferGeometryLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},parse:function(t){var e=new m.BufferGeometry,r=t.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new i[r.type](r.array),e.setIndex(new m.BufferAttribute(r,1)));var n,o=t.data.attributes;for(n in o){var a=o[n],r=new i[a.type](a.array);e.addAttribute(n,new m.BufferAttribute(r,a.itemSize))}if(void 0!==(i=t.data.groups||t.data.drawcalls||t.data.offsets))for(n=0,r=i.length;n!==r;++n)o=i[n],e.addGroup(o.start,o.count,o.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(i=new m.Vector3,void 0!==t.center&&i.fromArray(t.center),e.boundingSphere=new m.Sphere(i,t.radius)),e}},m.MaterialLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.textures={}},m.MaterialLoader.prototype={constructor:m.MaterialLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new m[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale&&(r=t.normalScale,!1===Array.isArray(r)&&(r=[r,r]),e.normalScale=(new m.Vector2).fromArray(r)),void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=m.MultiplyOperation),t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}},m.ObjectLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.texturePath=""},m.ObjectLoader.prototype={constructor:m.ObjectLoader,load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new m.XHRLoader(n.manager).load(t,function(t){n.parse(JSON.parse(t),e)},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(n)}),i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),n=this.parseObject(t.object,r,i);return t.animations&&(n.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(n),n},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new m.JSONLoader,i=new m.BufferGeometryLoader,n=0,o=t.length;n<o;n++){var a,s=t[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new m[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new m.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new m.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new m.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new m.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new m.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new m.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new m.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new m.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new m.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new m.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new m.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new m.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new m.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"LatheGeometry":a=new m.LatheGeometry(s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new m.MaterialLoader;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=i.parse(t[n]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=m.AnimationClip.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&0<t.length){var n=new m.LoadingManager(e),o=new m.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);for(var n=0,a=t.length;n<a;n++){var s=t[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})}(h)}}return i},parseTextures:function(t,e){function r(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),m[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new m.Texture(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new m.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new m.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var t=new m.Matrix4;return function(e,r,i){function n(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t)return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}var a;switch(e.type){case"Scene":a=new m.Scene;break;case"PerspectiveCamera":a=new m.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":a=new m.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new m.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new m.DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new m.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new m.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":a=new m.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":a=n(e.geometry);var s=o(e.material);a=a.bones&&0<a.bones.length?new m.SkinnedMesh(a,s):new m.Mesh(a,s);break;case"LOD":a=new m.LOD;break;case"Line":a=new m.Line(n(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":a=new m.Points(n(e.geometry),o(e.material));break;case"Sprite":a=new m.Sprite(o(e.material));break;case"Group":a=new m.Group;break;default:a=new m.Object3D}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(this.parseObject(e.children[h],r,i));if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){var c=e[s];void 0!==(h=a.getObjectByProperty("uuid",c.object))&&a.addLevel(h,c.distance)}return a}}()},m.TextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.TextureLoader.prototype={constructor:m.TextureLoader,load:function(t,e,r,i){var n=new m.Texture,o=new m.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){n.image=t,n.needsUpdate=!0,void 0!==e&&e(n)},r,i),n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.CubeTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.CubeTextureLoader.prototype={constructor:m.CubeTextureLoader,load:function(t,e,r,i){var n=new m.CubeTexture([]),o=new m.ImageLoader(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;for(r=0;r<t.length;++r)!function(r){o.load(t[r],function(t){n.images[r]=t,6==++a&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}(r);return n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.DataTextureLoader=m.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.BinaryTextureLoader.prototype={constructor:m.BinaryTextureLoader,load:function(t,e,r,i){var n=this,o=new m.DataTexture,a=new m.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){(t=n._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:m.ClampToEdgeWrapping,o.wrapT=void 0!==t.wrapT?t.wrapT:m.ClampToEdgeWrapping,o.magFilter=void 0!==t.magFilter?t.magFilter:m.LinearFilter,o.minFilter=void 0!==t.minFilter?t.minFilter:m.LinearMipMapLinearFilter,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=m.LinearFilter),o.needsUpdate=!0,e&&e(o,t))},r,i),o}},m.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.CompressedTextureLoader.prototype={constructor:m.CompressedTextureLoader,load:function(t,e,r,i){var n=this,o=[],a=new m.CompressedTexture;a.image=o;var s=new m.XHRLoader(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,c=0,l=t.length;c<l;++c)!function(c){s.load(t[c],function(t){t=n._parser(t,!0),o[c]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(h+=1)&&(1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a))},r,i)}(c);else s.load(t,function(t){if((t=n._parser(t,!0)).isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,i=0;i<r;i++){o[i]={mipmaps:[]};for(var s=0;s<t.mipmapCount;s++)o[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+s]),o[i].format=t.format,o[i].width=t.width,o[i].height=t.height}else a.image.width=t.width,a.image.height=t.height,a.mipmaps=t.mipmaps;1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a)},r,i);return a},setPath:function(t){this.path=t}},m.Material=function(){Object.defineProperty(this,"id",{value:m.MaterialIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Material",this.side=m.FrontSide,this.opacity=1,this.transparent=!1,this.blending=m.NormalBlending,this.blendSrc=m.SrcAlphaFactor,this.blendDst=m.OneMinusSrcAlphaFactor,this.blendEquation=m.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=m.LessEqualDepth,this.colorWrite=this.depthWrite=this.depthTest=!0,this.precision=null,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this._needsUpdate=this.visible=!0},m.Material.prototype={constructor:m.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var i=this[e];void 0===i?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):i instanceof m.Color?i.set(r):i instanceof m.Vector3&&r instanceof m.Vector3?i.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof m.Color&&(i.color=this.color.getHex()),.5!==this.roughness&&(i.roughness=this.roughness),.5!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof m.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof m.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof m.Texture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap instanceof m.Texture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof m.Texture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof m.Texture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof m.Texture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof m.Texture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof m.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof m.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof m.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof m.Texture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof m.Texture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==m.NoColors&&(i.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==m.SmoothShading&&(i.shading=this.shading),void 0!==this.blending&&this.blending!==m.NormalBlending&&(i.blending=this.blending),void 0!==this.side&&this.side!==m.FrontSide&&(i.side=this.side),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),r&&(r=e(t.textures),t=e(t.images),0<r.length&&(i.textures=r),0<t.length&&(i.images=t)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.side=t.side,this.opacity=t.opacity,this.transparent=t.transparent,this.blending=t.blending,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.overdraw=t.overdraw,this.visible=t.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Material.prototype),m.MaterialIdCount=0,m.LineBasicMaterial=function(t){m.Material.call(this),this.type="LineBasicMaterial",this.color=new m.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineBasicMaterial.prototype=Object.create(m.Material.prototype),m.LineBasicMaterial.prototype.constructor=m.LineBasicMaterial,m.LineBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.LineDashedMaterial=function(t){m.Material.call(this),this.type="LineDashedMaterial",this.color=new m.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineDashedMaterial.prototype=Object.create(m.Material.prototype),m.LineDashedMaterial.prototype.constructor=m.LineDashedMaterial,m.LineDashedMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.MeshBasicMaterial=function(t){m.Material.call(this),this.type="MeshBasicMaterial",this.color=new m.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshBasicMaterial.prototype=Object.create(m.Material.prototype),m.MeshBasicMaterial.prototype.constructor=m.MeshBasicMaterial,m.MeshBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},m.MeshLambertMaterial=function(t){m.Material.call(this),this.type="MeshLambertMaterial",this.color=new m.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshLambertMaterial.prototype=Object.create(m.Material.prototype),m.MeshLambertMaterial.prototype.constructor=m.MeshLambertMaterial,m.MeshLambertMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshPhongMaterial=function(t){m.Material.call(this),this.type="MeshPhongMaterial",this.color=new m.Color(16777215),this.specular=new m.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshPhongMaterial.prototype=Object.create(m.Material.prototype),m.MeshPhongMaterial.prototype.constructor=m.MeshPhongMaterial,m.MeshPhongMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshStandardMaterial=function(t){m.Material.call(this),this.type="MeshStandardMaterial",this.color=new m.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshStandardMaterial.prototype=Object.create(m.Material.prototype),m.MeshStandardMaterial.prototype.constructor=m.MeshStandardMaterial,m.MeshStandardMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshDepthMaterial=function(t){m.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(t)},m.MeshDepthMaterial.prototype=Object.create(m.Material.prototype),m.MeshDepthMaterial.prototype.constructor=m.MeshDepthMaterial,m.MeshDepthMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MeshNormalMaterial=function(t){m.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},m.MeshNormalMaterial.prototype=Object.create(m.Material.prototype),m.MeshNormalMaterial.prototype.constructor=m.MeshNormalMaterial,m.MeshNormalMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MultiMaterial=function(t){this.uuid=m.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},m.MultiMaterial.prototype={constructor:m.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;i<n;i++){var o=r[i].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},m.PointsMaterial=function(t){m.Material.call(this),this.type="PointsMaterial",this.color=new m.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.PointsMaterial.prototype=Object.create(m.Material.prototype),m.PointsMaterial.prototype.constructor=m.PointsMaterial,m.PointsMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.ShaderMaterial=function(t){m.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=m.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))},m.ShaderMaterial.prototype=Object.create(m.Material.prototype),m.ShaderMaterial.prototype.constructor=m.ShaderMaterial,m.ShaderMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=m.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},m.ShaderMaterial.prototype.toJSON=function(t){return t=m.Material.prototype.toJSON.call(this,t),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},m.RawShaderMaterial=function(t){m.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},m.RawShaderMaterial.prototype=Object.create(m.ShaderMaterial.prototype),m.RawShaderMaterial.prototype.constructor=m.RawShaderMaterial,m.SpriteMaterial=function(t){m.Material.call(this),this.type="SpriteMaterial",this.color=new m.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},m.SpriteMaterial.prototype=Object.create(m.Material.prototype),m.SpriteMaterial.prototype.constructor=m.SpriteMaterial,m.SpriteMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.fog=t.fog,this},m.Texture=function(t,e,r,i,n,o,a,s,h){Object.defineProperty(this,"id",{value:m.TextureIdCount++}),this.uuid=m.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==t?t:m.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:m.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:m.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:m.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:m.LinearFilter,this.minFilter=void 0!==o?o:m.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:m.RGBAFormat,this.type=void 0!==s?s:m.UnsignedByteType,this.offset=new m.Vector2(0,0),this.repeat=new m.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},m.Texture.DEFAULT_IMAGE=void 0,m.Texture.DEFAULT_MAPPING=m.UVMapping,m.Texture.prototype={constructor:m.Texture,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=m.Math.generateUUID()),void 0===t.images[r.uuid]){var i,n=t.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:(i=document.createElement("canvas"),i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0,r.width,r.height)),i=2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"),n[o]={uuid:a,url:i}}e.image=r.uuid}return t.textures[this.uuid]=e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===m.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),0>t.x||1<t.x)switch(this.wrapS){case m.RepeatWrapping:t.x-=Math.floor(t.x);break;case m.ClampToEdgeWrapping:t.x=0>t.x?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x-=Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case m.RepeatWrapping:t.y-=Math.floor(t.y);break;case m.ClampToEdgeWrapping:t.y=0>t.y?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y-=Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},m.EventDispatcher.prototype.apply(m.Texture.prototype),m.TextureIdCount=0,m.CanvasTexture=function(t,e,r,i,n,o,a,s,h){m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.needsUpdate=!0},m.CanvasTexture.prototype=Object.create(m.Texture.prototype),m.CanvasTexture.prototype.constructor=m.CanvasTexture,m.CubeTexture=function(t,e,r,i,n,o,a,s,h){e=void 0!==e?e:m.CubeReflectionMapping,m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.images=t,this.flipY=!1},m.CubeTexture.prototype=Object.create(m.Texture.prototype),m.CubeTexture.prototype.constructor=m.CubeTexture,m.CubeTexture.prototype.copy=function(t){return m.Texture.prototype.copy.call(this,t),this.images=t.images,this},m.CompressedTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1},m.CompressedTexture.prototype=Object.create(m.Texture.prototype),m.CompressedTexture.prototype.constructor=m.CompressedTexture,m.DataTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={data:t,width:e,height:r},this.magFilter=void 0!==h?h:m.NearestFilter,this.minFilter=void 0!==c?c:m.NearestFilter,this.generateMipmaps=this.flipY=!1},m.DataTexture.prototype=Object.create(m.Texture.prototype),m.DataTexture.prototype.constructor=m.DataTexture,m.VideoTexture=function(t,e,r,i,n,o,a,s,h){function c(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)}m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.generateMipmaps=!1;var l=this;c()},m.VideoTexture.prototype=Object.create(m.Texture.prototype),m.VideoTexture.prototype.constructor=m.VideoTexture,m.Group=function(){m.Object3D.call(this),this.type="Group"},m.Group.prototype=Object.create(m.Object3D.prototype),m.Group.prototype.constructor=m.Group,m.Points=function(t,e){m.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.PointsMaterial({color:16777215*Math.random()})},m.Points.prototype=Object.create(m.Object3D.prototype),m.Points.prototype.constructor=m.Points,m.Points.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(h);var c=i.ray.origin.distanceTo(s);c<i.near||c>i.far||n.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,h=this.matrixWorld,c=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(h),!1!==i.ray.intersectsSphere(r)){t.getInverse(h),e.copy(i.ray).applyMatrix4(t);var l=(c/=(this.scale.x+this.scale.y+this.scale.z)/3)*c,c=new m.Vector3;if(s instanceof m.BufferGeometry){var u=s.index,s=s.attributes.position.array;if(null!==u)for(var p=u.array,u=0,d=p.length;u<d;u++){var f=p[u];c.fromArray(s,3*f),o(c,f)}else for(u=0,p=s.length/3;u<p;u++)c.fromArray(s,3*u),o(c,u)}else for(c=s.vertices,u=0,p=c.length;u<p;u++)o(c[u],u)}}}(),m.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Line=function(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new m.LineSegments(t,e);m.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.LineBasicMaterial({color:16777215*Math.random()})},m.Line.prototype=Object.create(m.Object3D.prototype),m.Line.prototype.constructor=m.Line,m.Line.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){var o=(o=i.linePrecision)*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==i.ray.intersectsSphere(r)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=new m.Vector3,c=new m.Vector3,s=new m.Vector3,l=new m.Vector3,u=this instanceof m.LineSegments?2:1;if(a instanceof m.BufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var p=p.array,a=0,f=p.length-1;a<f;a+=u){var g=p[a+1];h.fromArray(d,3*p[a]),c.fromArray(d,3*g),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,f=d.length/3-1;a<f;a+=u)h.fromArray(d,3*a),c.fromArray(d,3*a+3),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof m.Geometry)for(h=a.vertices,c=h.length,a=0;a<c-1;a+=u)(g=e.distanceSqToSegment(h[a],h[a+1],l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),m.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.LineStrip=0,m.LinePieces=1,m.LineSegments=function(t,e){m.Line.call(this,t,e),this.type="LineSegments"},m.LineSegments.prototype=Object.create(m.Line.prototype),m.LineSegments.prototype.constructor=m.LineSegments,m.Mesh=function(t,e){m.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=m.TrianglesDrawMode,this.updateMorphTargets()},m.Mesh.prototype=Object.create(m.Object3D.prototype),m.Mesh.prototype.constructor=m.Mesh,m.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},m.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},m.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},m.Mesh.prototype.raycast=function(){function t(t,e,r,i,n,o,a){return m.Triangle.barycoordFromPoint(t,e,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),a.multiplyScalar(g.z),n.add(o).add(a),n.clone()}function e(t,e,r,i,n,o,a){var s=t.material;return null===(s.side===m.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==m.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(t.matrixWorld),r=e.ray.origin.distanceTo(y),r<e.near||r>e.far?null:{distance:r,point:y.clone(),object:t})}function r(r,i,n,o,c,l,u,g){return a.fromArray(o,3*l),s.fromArray(o,3*u),h.fromArray(o,3*g),(r=e(r,i,n,a,s,h,v))&&(c&&(p.fromArray(c,2*l),d.fromArray(c,2*u),f.fromArray(c,2*g),r.uv=t(v,a,s,h,p,d,f)),r.face=new m.Face3(l,u,g,m.Triangle.normal(a,s,h)),r.faceIndex=l),r}var i=new m.Matrix4,n=new m.Ray,o=new m.Sphere,a=new m.Vector3,s=new m.Vector3,h=new m.Vector3,c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=new m.Vector2,d=new m.Vector2,f=new m.Vector2,g=new m.Vector3,v=new m.Vector3,y=new m.Vector3;return function(g,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),!1!==g.ray.intersectsSphere(o)&&(i.getInverse(_),n.copy(g.ray).applyMatrix4(i),null===x.boundingBox||!1!==n.intersectsBox(x.boundingBox)))){var M,w;if(x instanceof m.BufferGeometry){var S,E,b=x.index,x=(_=x.attributes).position.array;if(void 0!==_.uv&&(M=_.uv.array),null!==b)for(var _=b.array,T=0,C=_.length;T<C;T+=3)b=_[T],S=_[T+1],E=_[T+2],(w=r(this,g,n,x,M,b,S,E))&&(w.faceIndex=Math.floor(T/3),y.push(w));else for(T=0,C=x.length;T<C;T+=9)b=T/3,S=b+1,E=b+2,(w=r(this,g,n,x,M,b,S,E))&&(w.index=b,y.push(w))}else if(x instanceof m.Geometry){var L,A,T=!0==(_=b instanceof m.MultiMaterial)?b.materials:null,C=x.vertices;S=x.faces,0<(E=x.faceVertexUvs[0]).length&&(M=E);for(var P=0,R=S.length;P<R;P++){var U=S[P];if(void 0!==(w=!0===_?T[U.materialIndex]:b)){if(E=C[U.a],L=C[U.b],A=C[U.c],!0===w.morphTargets){w=x.morphTargets;var k=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),h.set(0,0,0);for(var D=0,I=w.length;D<I;D++){var F=k[D];if(0!==F){var B=w[D].vertices;a.addScaledVector(c.subVectors(B[U.a],E),F),s.addScaledVector(l.subVectors(B[U.b],L),F),h.addScaledVector(u.subVectors(B[U.c],A),F)}}a.add(E),s.add(L),h.add(A),E=a,L=s,A=h}(w=e(this,g,n,E,L,A,v))&&(M&&(k=M[P],p.copy(k[0]),d.copy(k[1]),f.copy(k[2]),w.uv=t(v,E,L,A,p,d,f)),w.face=U,w.faceIndex=P,y.push(w))}}}}}}(),m.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Bone=function(t){m.Object3D.call(this),this.type="Bone",this.skin=t},m.Bone.prototype=Object.create(m.Object3D.prototype),m.Bone.prototype.constructor=m.Bone,m.Bone.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this},m.Skeleton=function(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new m.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=m.Math.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new m.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,m.RGBAFormat,m.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new m.Matrix4)},m.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new m.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},m.Skeleton.prototype.pose=function(){for(var t,e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},m.Skeleton.prototype.update=function(){var t=new m.Matrix4;return function(){for(var e=0,r=this.bones.length;e<r;e++)t.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),m.Skeleton.prototype.clone=function(){return new m.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},m.SkinnedMesh=function(t,e,r){if(m.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m.Matrix4,this.bindMatrixInverse=new m.Matrix4,t=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],e=new m.Bone(this),t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],-1!==i.parent&&null!==i.parent?t[i.parent].add(t[n]):this.add(t[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new m.Skeleton(t,void 0,r),this.matrixWorld)},m.SkinnedMesh.prototype=Object.create(m.Mesh.prototype),m.SkinnedMesh.prototype.constructor=m.SkinnedMesh,m.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},m.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},m.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof m.Geometry)for(i=0;i<this.geometry.skinWeights.length;i++){var t=1/(e=this.geometry.skinWeights[i]).lengthManhattan();1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry instanceof m.BufferGeometry)for(var e=new m.Vector4,r=this.geometry.attributes.skinWeight,i=0;i<r.count;i++)e.x=r.getX(i),e.y=r.getY(i),e.z=r.getZ(i),e.w=r.getW(i),t=1/e.lengthManhattan(),1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0),r.setXYZW(i,e.x,e.y,e.z,e.w)},m.SkinnedMesh.prototype.updateMatrixWorld=function(t){m.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},m.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},m.LOD=function(){m.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},m.LOD.prototype=Object.create(m.Object3D.prototype),m.LOD.prototype.constructor=m.LOD,m.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},m.LOD.prototype.getObjectForDistance=function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},m.LOD.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,r)}}(),m.LOD.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(r){var i=this.levels;if(1<i.length){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),r=t.distanceTo(e),i[0].object.visible=!0;for(var n=1,o=i.length;n<o&&r>=i[n].distance;n++)i[n-1].object.visible=!1,i[n].object.visible=!0;for(;n<o;n++)i[n].object.visible=!1}}}(),m.LOD.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},m.LOD.prototype.toJSON=function(t){(t=m.Object3D.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,i=e.length;r<i;r++){var n=e[r];t.object.levels.push({object:n.object.uuid,distance:n.distance})}return t},m.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new m.BufferGeometry;return i.setIndex(new m.BufferAttribute(t,1)),i.addAttribute("position",new m.BufferAttribute(e,3)),i.addAttribute("uv",new m.BufferAttribute(r,2)),function(t){m.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new m.SpriteMaterial}}(),m.Sprite.prototype=Object.create(m.Object3D.prototype),m.Sprite.prototype.constructor=m.Sprite,m.Sprite.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(t);i>this.scale.x*this.scale.y||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),m.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},m.Particle=m.Sprite,m.LensFlare=function(t,e,r,i,n){m.Object3D.call(this),this.lensFlares=[],this.positionScreen=new m.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,i,n)},m.LensFlare.prototype=Object.create(m.Object3D.prototype),m.LensFlare.prototype.constructor=m.LensFlare,m.LensFlare.prototype.add=function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new m.Color(16777215)),void 0===i&&(i=m.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},m.LensFlare.prototype.updateLensFlares=function(){var t,e,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+n*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},m.LensFlare.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},m.Scene=function(){m.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},m.Scene.prototype=Object.create(m.Object3D.prototype),m.Scene.prototype.constructor=m.Scene,m.Scene.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},m.Fog=function(t,e,r){this.name="",this.color=new m.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},m.Fog.prototype.clone=function(){return new m.Fog(this.color.getHex(),this.near,this.far)},m.FogExp2=function(t,e){this.name="",this.color=new m.Color(t),this.density=void 0!==e?e:25e-5},m.FogExp2.prototype.clone=function(){return new m.FogExp2(this.color.getHex(),this.density)},m.ShaderChunk={},m.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",m.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",m.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",m.ShaderChunk.ambient_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\treturn PI * ambientLightColor;\n}\n",m.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\treflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n#endif\n",m.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",m.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",m.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",m.ShaderChunk.bsdfs="float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t  return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = alpha * alpha;\n\tfloat gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );\n\tfloat gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );\n\treturn 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = alpha * alpha;\n\tfloat denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / ( denom * 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 = roughness * 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_Smith( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );\n}",m.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",m.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",m.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",m.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",m.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",m.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\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 square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\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}\nvec3 inputToLinear( in vec3 a ) {\n\t#ifdef GAMMA_INPUT\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n",m.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",m.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",m.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",m.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\ttotalEmissiveLight *= emissiveColor.rgb;\n#endif\n",m.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",m.ShaderChunk.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 DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvarying vec3 vReflect;\n\tuniform float refractionRatio;\n#endif\n",m.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t#else\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t#endif\n#endif\n",m.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n#endif",m.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\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",m.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",m.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",m.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tdirectLight = getPointDirectLight( pointLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tdirectLight = getSpotDirectLight( spotLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectLight = getDirectionalDirectLight( directionalLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.lights_pars="#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\tIncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tIncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\t\treturn directLight;\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 angleCos;\n\t\tfloat exponent;\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\tIncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat spotEffect = dot( directLight.direction, spotLight.direction );\n\t\tif ( spotEffect > spotLight.angleCos ) {\n\t\t\tfloat spotEffect = dot( spotLight.direction, directLight.direction );\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t}\n\t\treturn directLight;\n\t}\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\treturn PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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#else\n\t\t\tvec3 envMapColor = vec3( 0.0 );\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\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( square( 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\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\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 = flipNormal * 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * 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#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",m.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",m.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\nvarying 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\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\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)\n",m.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\n",m.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n\tvWorldPosition = worldPosition.xyz;\n#endif\n",m.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",m.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Standard\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n",m.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tdirectLight = getPointDirectLight( pointLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tdirectLight = getSpotDirectLight( spotLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tdirectLight = getDirectionalDirectLight( directionalLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( directionalLight.shadow ) ? 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 defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tirradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\tRE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",m.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",m.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",m.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",m.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",m.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",m.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\tdiffuseColor *= texelColor;\n#endif\n",m.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",m.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n#endif\n",m.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",m.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",m.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",m.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",m.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",m.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",m.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",m.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",m.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",m.ShaderChunk.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 unpackDepth( const in vec4 rgba_depth ) {\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\treturn dot( rgba_depth, bit_shift );\n\t}\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec3 offset = vec3( - 1, 0, 1 ) * shadowRadius * 2.0 * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxx, 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.xzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxy, 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.xzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyx, 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.yzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 21.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",m.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",m.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",m.ShaderChunk.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",m.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",m.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned  = bindMatrixInverse * skinned;\n#endif\n",m.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",m.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",m.ShaderChunk.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",m.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",m.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",m.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",m.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i,n=this.clone(t[r]);for(i in n)e[i]=n[i]}return e},clone:function(t){var e,r={};for(e in t){r[e]={};for(var i in t[e]){var n=t[e][i];n instanceof m.Color||n instanceof m.Vector2||n instanceof m.Vector3||n instanceof m.Vector4||n instanceof m.Matrix3||n instanceof m.Matrix4||n instanceof m.Texture?r[e][i]=n.clone():Array.isArray(n)?r[e][i]=n.slice():r[e][i]=n}}return r}},m.UniformsLib={common:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new m.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new m.Color(16777215)}},ambient:{ambientLightColor:{type:"fv",value:[]}},lights:{directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},angleCos:{type:"f"},exponent:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)}}},m.ShaderLib={basic:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.fog]),vertexShader:[m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"\t#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,"\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.indirectDiffuse;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},lambert:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.bsdfs,m.ShaderChunk.lights_pars,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_lambert_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.shadowmask_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.emissivemap_fragment,"\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );",m.ShaderChunk.lightmap_fragment,"\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();",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},phong:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},specular:{type:"c",value:new m.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.lights_phong_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_phong_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_phong_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_phong_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},standard:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.roughnessmap,m.UniformsLib.metalnessmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_standard_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.roughnessmap_pars_fragment,m.ShaderChunk.metalnessmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.roughnessmap_fragment,m.ShaderChunk.metalnessmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_standard_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:m.UniformsUtils.merge([m.UniformsLib.points,m.UniformsLib.fog]),vertexShader:["uniform float size;\nuniform float scale;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.project_vertex,"\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif",m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.map_particle_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_particle_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new m.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",m.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n\tdepth /= 1000.0;\n\tconst vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}},m.WebGLRenderer=function(t){function e(t,e,r,i){!0===I&&(t*=i,e*=i,r*=i),xt.clearColor(t,e,r,i)}function r(){xt.init(),xt.scissor(J.copy(st).multiplyScalar(at)),xt.viewport(tt.copy(ct).multiplyScalar(at)),e(rt.r,rt.g,rt.b,it)}function i(){K=X=null,Q="",Z=-1,xt.reset()}function n(t){t.preventDefault(),i(),r(),bt.clear()}function o(t){(t=t.target).removeEventListener("dispose",o);t:{var e=bt.get(t);if(t.image&&e.__image__webglTextureCube)gt.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)break t;gt.deleteTexture(e.__webglTexture)}bt.delete(t)}ft.textures--}function a(t){(t=t.target).removeEventListener("dispose",a);var e=bt.get(t),r=bt.get(t.texture);if(t&&void 0!==r.__webglTexture){if(gt.deleteTexture(r.__webglTexture),t instanceof m.WebGLRenderTargetCube)for(r=0;6>r;r++)gt.deleteFramebuffer(e.__webglFramebuffer[r]),gt.deleteRenderbuffer(e.__webglDepthbuffer[r]);else gt.deleteFramebuffer(e.__webglFramebuffer),gt.deleteRenderbuffer(e.__webglDepthbuffer);bt.delete(t.texture),bt.delete(t)}ft.textures--}function s(t){(t=t.target).removeEventListener("dispose",s),h(t),bt.delete(t)}function h(t){var e=bt.get(t).program;t.program=void 0,void 0!==e&&Mt.releaseProgram(e)}function c(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function u(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function p(t,e,r,i,n){var o;r.transparent?(i=O,o=++G):(i=V,o=++N),void 0!==(o=i[o])?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=pt.z,o.group=n):(o={id:t.id,object:t,geometry:e,material:r,z:pt.z,group:n},i.push(o))}function d(t,e){if(!1!==t.visible){if(t.layers.test(e.layers))if(t instanceof m.Light)B.push(t);else if(t instanceof m.Sprite)!1!==t.frustumCulled&&!0!==lt.intersectsObject(t)||H.push(t);else if(t instanceof m.LensFlare)j.push(t);else if(t instanceof m.ImmediateRenderObject)!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut)),p(t,null,t.material,pt.z,null);else if((t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&(t instanceof m.SkinnedMesh&&t.skeleton.update(),(!1===t.frustumCulled||!0===lt.intersectsObject(t))&&!0===(o=t.material).visible)){!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut));var r=_t.update(t);if(o instanceof m.MultiMaterial)for(var i=r.groups,n=o.materials,o=0,a=i.length;o<a;o++){var s=i[o],h=n[s.materialIndex];!0===h.visible&&p(t,r,h,pt.z,s)}else p(t,r,o,pt.z,null)}for(o=0,a=(r=t.children).length;o<a;o++)d(r[o],e)}}function f(t,e,r,i){for(var n=0,o=t.length;n<o;n++){var a=(c=t[n]).object,s=c.geometry,h=void 0===i?c.material:i,c=c.group;if(a.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a instanceof m.ImmediateRenderObject){g(h);var l=v(e,r,h,a);Q="",a.render(function(t){W.renderBufferImmediate(t,l,h)})}else W.renderBufferDirect(e,r,s,h,a,c)}}function g(t){t.side!==m.DoubleSide?xt.enable(gt.CULL_FACE):xt.disable(gt.CULL_FACE),xt.setFlipSided(t.side===m.BackSide),!0===t.transparent?xt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):xt.setBlending(m.NoBlending),xt.setDepthFunc(t.depthFunc),xt.setDepthTest(t.depthTest),xt.setDepthWrite(t.depthWrite),xt.setColorWrite(t.colorWrite),xt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i){et=0;var n=bt.get(r);if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==dt.hash&&(r.needsUpdate=!0),r.needsUpdate){t:{var o=bt.get(r),a=Mt.getParameters(r,dt,e,i),c=Mt.getProgramCode(r,a),l=o.program,u=!0;if(void 0===l)r.addEventListener("dispose",s);else if(l.code!==c)h(r);else{if(void 0!==a.shaderID)break t;u=!1}if(u&&(a.shaderID?(l=m.ShaderLib[a.shaderID],o.__webglShader={name:r.type,uniforms:m.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):o.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=o.__webglShader,l=Mt.acquireProgram(r,a,c),o.program=l,r.program=l),a=l.getAttributes(),r.morphTargets)for(c=r.numSupportedMorphTargets=0;c<W.maxMorphTargets;c++)0<=a["morphTarget"+c]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(c=r.numSupportedMorphNormals=0;c<W.maxMorphNormals;c++)0<=a["morphNormal"+c]&&r.numSupportedMorphNormals++;o.uniformsList=[];var p,a=o.__webglShader.uniforms,c=o.program.getUniforms();for(p in a)(l=c[p])&&o.uniformsList.push([o.__webglShader.uniforms[p],l]);for((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(o.lightsHash=dt.hash,a.ambientLightColor.value=dt.ambient,a.directionalLights.value=dt.directional,a.spotLights.value=dt.spot,a.pointLights.value=dt.point,a.hemisphereLights.value=dt.hemi,a.directionalShadowMap.value=dt.directionalShadowMap,a.directionalShadowMatrix.value=dt.directionalShadowMatrix,a.spotShadowMap.value=dt.spotShadowMap,a.spotShadowMatrix.value=dt.spotShadowMatrix,a.pointShadowMap.value=dt.pointShadowMap,a.pointShadowMatrix.value=dt.pointShadowMatrix),o.hasDynamicUniforms=!1,p=0,a=o.uniformsList.length;p<a;p++)if(!0===o.uniformsList[p][0].dynamic){o.hasDynamicUniforms=!0;break}}r.needsUpdate=!1}if(l=c=u=!1,o=n.program,p=o.getUniforms(),a=n.__webglShader.uniforms,o.id!==X&&(gt.useProgram(o.program),X=o.id,l=c=u=!0),r.id!==Z&&(Z=r.id,c=!0),(u||t!==K)&&(gt.uniformMatrix4fv(p.projectionMatrix,!1,t.projectionMatrix.elements),yt.logarithmicDepthBuffer&&gt.uniform1f(p.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==K&&(K=t,l=c=!0),(r instanceof m.ShaderMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial||r.envMap)&&void 0!==p.cameraPosition&&(pt.setFromMatrixPosition(t.matrixWorld),gt.uniform3f(p.cameraPosition,pt.x,pt.y,pt.z)),(r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshBasicMaterial||r instanceof m.MeshStandardMaterial||r instanceof m.ShaderMaterial||r.skinning)&&void 0!==p.viewMatrix&&gt.uniformMatrix4fv(p.viewMatrix,!1,t.matrixWorldInverse.elements)),r.skinning&&(i.bindMatrix&&void 0!==p.bindMatrix&&gt.uniformMatrix4fv(p.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&gt.uniformMatrix4fv(p.bindMatrixInverse,!1,i.bindMatrixInverse.elements),yt.floatVertexTextures&&i.skeleton&&i.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(u=y(),gt.uniform1i(p.boneTexture,u),W.setTexture(i.skeleton.boneTexture,u)),void 0!==p.boneTextureWidth&&gt.uniform1i(p.boneTextureWidth,i.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&gt.uniform1i(p.boneTextureHeight,i.skeleton.boneTextureHeight)):i.skeleton&&i.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&gt.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.skeleton.boneMatrices)),c){if((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(c=l,a.ambientLightColor.needsUpdate=c,a.directionalLights.needsUpdate=c,a.pointLights.needsUpdate=c,a.spotLights.needsUpdate=c,a.hemisphereLights.needsUpdate=c),e&&r.fog&&(a.fogColor.value=e.color,e instanceof m.Fog?(a.fogNear.value=e.near,a.fogFar.value=e.far):e instanceof m.FogExp2&&(a.fogDensity.value=e.density)),r instanceof m.MeshBasicMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial){a.opacity.value=r.opacity,a.diffuse.value=r.color,r.emissive&&a.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),a.map.value=r.map,a.specularMap.value=r.specularMap,a.alphaMap.value=r.alphaMap,r.aoMap&&(a.aoMap.value=r.aoMap,a.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d instanceof m.WebGLRenderTarget&&(d=d.texture),e=d.offset,d=d.repeat,a.offsetRepeat.value.set(e.x,e.y,d.x,d.y)),a.envMap.value=r.envMap,a.flipEnvMap.value=r.envMap instanceof m.WebGLRenderTargetCube?1:-1,a.reflectivity.value=r.reflectivity,a.refractionRatio.value=r.refractionRatio}r instanceof m.LineBasicMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity):r instanceof m.LineDashedMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.dashSize.value=r.dashSize,a.totalSize.value=r.dashSize+r.gapSize,a.scale.value=r.scale):r instanceof m.PointsMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.size.value=r.size*at,a.scale.value=A.clientHeight/2,a.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,a.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r instanceof m.MeshLambertMaterial?(r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap)):r instanceof m.MeshPhongMaterial?(a.specular.value=r.specular,a.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias)):r instanceof m.MeshStandardMaterial?(a.roughness.value=r.roughness,a.metalness.value=r.metalness,r.roughnessMap&&(a.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(a.metalnessMap.value=r.metalnessMap),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias),r.envMap&&(a.envMapIntensity.value=r.envMapIntensity)):r instanceof m.MeshDepthMaterial?(a.mNear.value=t.near,a.mFar.value=t.far,a.opacity.value=r.opacity):r instanceof m.MeshNormalMaterial&&(a.opacity.value=r.opacity),x(n.uniformsList)}if(gt.uniformMatrix4fv(p.modelViewMatrix,!1,i.modelViewMatrix.elements),p.normalMatrix&&gt.uniformMatrix3fv(p.normalMatrix,!1,i.normalMatrix.elements),void 0!==p.modelMatrix&&gt.uniformMatrix4fv(p.modelMatrix,!1,i.matrixWorld.elements),!0===n.hasDynamicUniforms){for(r=[],d=0,e=(n=n.uniformsList).length;d<e;d++)p=n[d][0],void 0!==(a=p.onUpdateCallback)&&(a.bind(p)(i,t),r.push(n[d]));x(r)}return o}function y(){var t=et;return t>=yt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+yt.maxTextures),et+=1,t}function x(t){for(var e,r,i=0,n=t.length;i<n;i++){var o=t[i][0];if(!1!==o.needsUpdate){var a=o.type;e=o.value;var s=t[i][1];switch(a){case"1i":gt.uniform1i(s,e);break;case"1f":gt.uniform1f(s,e);break;case"2f":gt.uniform2f(s,e[0],e[1]);break;case"3f":gt.uniform3f(s,e[0],e[1],e[2]);break;case"4f":gt.uniform4f(s,e[0],e[1],e[2],e[3]);break;case"1iv":gt.uniform1iv(s,e);break;case"3iv":gt.uniform3iv(s,e);break;case"1fv":gt.uniform1fv(s,e);break;case"2fv":gt.uniform2fv(s,e);break;case"3fv":gt.uniform3fv(s,e);break;case"4fv":gt.uniform4fv(s,e);break;case"Matrix2fv":gt.uniformMatrix2fv(s,!1,e);break;case"Matrix3fv":gt.uniformMatrix3fv(s,!1,e);break;case"Matrix4fv":gt.uniformMatrix4fv(s,!1,e);break;case"i":gt.uniform1i(s,e);break;case"f":gt.uniform1f(s,e);break;case"v2":gt.uniform2f(s,e.x,e.y);break;case"v3":gt.uniform3f(s,e.x,e.y,e.z);break;case"v4":gt.uniform4f(s,e.x,e.y,e.z,e.w);break;case"c":gt.uniform3f(s,e.r,e.g,e.b);break;case"sa":for(a=0;a<e.length;a++)for(var h in o.properties){var c=s[a][h];switch(r=e[a][h],o.properties[h].type){case"i":gt.uniform1i(c,r);break;case"f":gt.uniform1f(c,r);break;case"v2":gt.uniform2f(c,r.x,r.y);break;case"v3":gt.uniform3f(c,r.x,r.y,r.z);break;case"v4":gt.uniform4f(c,r.x,r.y,r.z,r.w);break;case"c":gt.uniform3f(c,r.r,r.g,r.b);break;case"m4":gt.uniformMatrix4fv(c,!1,r.elements)}}break;case"iv1":gt.uniform1iv(s,e);break;case"iv":gt.uniform3iv(s,e);break;case"fv1":gt.uniform1fv(s,e);break;case"fv":gt.uniform3fv(s,e);break;case"v2v":for(void 0===o._array&&(o._array=new Float32Array(2*e.length)),r=a=0,c=e.length;a<c;a++,r+=2)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y;gt.uniform2fv(s,o._array);break;case"v3v":for(void 0===o._array&&(o._array=new Float32Array(3*e.length)),r=a=0,c=e.length;a<c;a++,r+=3)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z;gt.uniform3fv(s,o._array);break;case"v4v":for(void 0===o._array&&(o._array=new Float32Array(4*e.length)),r=a=0,c=e.length;a<c;a++,r+=4)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z,o._array[r+3]=e[a].w;gt.uniform4fv(s,o._array);break;case"m2":gt.uniformMatrix2fv(s,!1,e.elements);break;case"m3":gt.uniformMatrix3fv(s,!1,e.elements);break;case"m3v":for(void 0===o._array&&(o._array=new Float32Array(9*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,9*a);gt.uniformMatrix3fv(s,!1,o._array);break;case"m4":gt.uniformMatrix4fv(s,!1,e.elements);break;case"m4v":for(void 0===o._array&&(o._array=new Float32Array(16*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,16*a);gt.uniformMatrix4fv(s,!1,o._array);break;case"t":if(r=y(),gt.uniform1i(s,r),!e)continue;e instanceof m.CubeTexture||Array.isArray(e.image)&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):W.setTexture(e,r);break;case"tv":for(void 0===o._array&&(o._array=[]),a=0,c=o.value.length;a<c;a++)o._array[a]=y();for(gt.uniform1iv(s,o._array),a=0,c=o.value.length;a<c;a++)e=o.value[a],r=o._array[a],e&&(e instanceof m.CubeTexture||e.image instanceof Array&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):W.setTexture(e,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function b(t,e,r){r?(gt.texParameteri(t,gt.TEXTURE_WRAP_S,L(e.wrapS)),gt.texParameteri(t,gt.TEXTURE_WRAP_T,L(e.wrapT)),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,L(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,L(e.minFilter))):(gt.texParameteri(t,gt.TEXTURE_WRAP_S,gt.CLAMP_TO_EDGE),gt.texParameteri(t,gt.TEXTURE_WRAP_T,gt.CLAMP_TO_EDGE),e.wrapS===m.ClampToEdgeWrapping&&e.wrapT===m.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,C(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,C(e.minFilter)),e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),!(r=vt.get("EXT_texture_filter_anisotropic"))||e.type===m.FloatType&&null===vt.get("OES_texture_float_linear")||e.type===m.HalfFloatType&&null===vt.get("OES_texture_half_float_linear")||!(1<e.anisotropy||bt.get(e).__currentAnisotropy)||(gt.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,W.getMaxAnisotropy())),bt.get(e).__currentAnisotropy=e.anisotropy)}function _(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElement("canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function M(t){return m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height)}function w(t,e){var r=bt.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",o),r.__image__webglTextureCube=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var i=t instanceof m.CompressedTexture,n=t.image[0]instanceof m.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?t.image[s].image:t.image[s]:_(t.image[s],yt.maxCubemapSize);var h=M(a[0]),c=L(t.format),l=L(t.type);for(b(gt.TEXTURE_CUBE_MAP,t,h),s=0;6>s;s++)if(i)for(var u,p=a[s].mipmaps,d=0,f=p.length;d<f;d++)u=p[d],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(c)?xt.compressedTexImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,c,l,u.data);else n?xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,a[s].width,a[s].height,0,c,l,a[s].data):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,c,l,a[s]);t.generateMipmaps&&h&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function S(t,e){xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,bt.get(t).__webglTexture)}function E(t,e,r,i){var n=L(e.texture.format),o=L(e.texture.type);xt.texImage2D(i,0,n,e.width,e.height,0,n,o,null),gt.bindFramebuffer(gt.FRAMEBUFFER,t),gt.framebufferTexture2D(gt.FRAMEBUFFER,r,i,bt.get(e.texture).__webglTexture,0),gt.bindFramebuffer(gt.FRAMEBUFFER,null)}function T(t,e){gt.bindRenderbuffer(gt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_COMPONENT16,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_ATTACHMENT,gt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_STENCIL,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_STENCIL_ATTACHMENT,gt.RENDERBUFFER,t)):gt.renderbufferStorage(gt.RENDERBUFFER,gt.RGBA4,e.width,e.height),gt.bindRenderbuffer(gt.RENDERBUFFER,null)}function C(t){return t===m.NearestFilter||t===m.NearestMipMapNearestFilter||t===m.NearestMipMapLinearFilter?gt.NEAREST:gt.LINEAR}function L(t){var e;if(t===m.RepeatWrapping)return gt.REPEAT;if(t===m.ClampToEdgeWrapping)return gt.CLAMP_TO_EDGE;if(t===m.MirroredRepeatWrapping)return gt.MIRRORED_REPEAT;if(t===m.NearestFilter)return gt.NEAREST;if(t===m.NearestMipMapNearestFilter)return gt.NEAREST_MIPMAP_NEAREST;if(t===m.NearestMipMapLinearFilter)return gt.NEAREST_MIPMAP_LINEAR;if(t===m.LinearFilter)return gt.LINEAR;if(t===m.LinearMipMapNearestFilter)return gt.LINEAR_MIPMAP_NEAREST;if(t===m.LinearMipMapLinearFilter)return gt.LINEAR_MIPMAP_LINEAR;if(t===m.UnsignedByteType)return gt.UNSIGNED_BYTE;if(t===m.UnsignedShort4444Type)return gt.UNSIGNED_SHORT_4_4_4_4;if(t===m.UnsignedShort5551Type)return gt.UNSIGNED_SHORT_5_5_5_1;if(t===m.UnsignedShort565Type)return gt.UNSIGNED_SHORT_5_6_5;if(t===m.ByteType)return gt.BYTE;if(t===m.ShortType)return gt.SHORT;if(t===m.UnsignedShortType)return gt.UNSIGNED_SHORT;if(t===m.IntType)return gt.INT;if(t===m.UnsignedIntType)return gt.UNSIGNED_INT;if(t===m.FloatType)return gt.FLOAT;if(null!==(e=vt.get("OES_texture_half_float"))&&t===m.HalfFloatType)return e.HALF_FLOAT_OES;if(t===m.AlphaFormat)return gt.ALPHA;if(t===m.RGBFormat)return gt.RGB;if(t===m.RGBAFormat)return gt.RGBA;if(t===m.LuminanceFormat)return gt.LUMINANCE;if(t===m.LuminanceAlphaFormat)return gt.LUMINANCE_ALPHA;if(t===m.AddEquation)return gt.FUNC_ADD;if(t===m.SubtractEquation)return gt.FUNC_SUBTRACT;if(t===m.ReverseSubtractEquation)return gt.FUNC_REVERSE_SUBTRACT;if(t===m.ZeroFactor)return gt.ZERO;if(t===m.OneFactor)return gt.ONE;if(t===m.SrcColorFactor)return gt.SRC_COLOR;if(t===m.OneMinusSrcColorFactor)return gt.ONE_MINUS_SRC_COLOR;if(t===m.SrcAlphaFactor)return gt.SRC_ALPHA;if(t===m.OneMinusSrcAlphaFactor)return gt.ONE_MINUS_SRC_ALPHA;if(t===m.DstAlphaFactor)return gt.DST_ALPHA;if(t===m.OneMinusDstAlphaFactor)return gt.ONE_MINUS_DST_ALPHA;if(t===m.DstColorFactor)return gt.DST_COLOR;if(t===m.OneMinusDstColorFactor)return gt.ONE_MINUS_DST_COLOR;if(t===m.SrcAlphaSaturateFactor)return gt.SRC_ALPHA_SATURATE;if(null!==(e=vt.get("WEBGL_compressed_texture_s3tc"))){if(t===m.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===m.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=vt.get("WEBGL_compressed_texture_pvrtc"))){if(t===m.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===m.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===m.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===m.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=vt.get("WEBGL_compressed_texture_etc1"))&&t===m.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(null!==(e=vt.get("EXT_blend_minmax"))){if(t===m.MinEquation)return e.MIN_EXT;if(t===m.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",m.REVISION);var A=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),P=void 0!==t.context?t.context:null,R=void 0!==t.alpha&&t.alpha,U=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,D=void 0!==t.antialias&&t.antialias,I=void 0===t.premultipliedAlpha||t.premultipliedAlpha,F=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,B=[],V=[],N=-1,O=[],G=-1,z=new Float32Array(8),H=[],j=[];this.domElement=A,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.gammaOutput=this.gammaInput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,X=null,q=null,Y=null,Z=-1,Q="",K=null,J=new m.Vector4,$=null,tt=new m.Vector4,et=0,rt=new m.Color(0),it=0,nt=A.width,ot=A.height,at=1,st=new m.Vector4(0,0,nt,ot),ht=!1,ct=new m.Vector4(0,0,nt,ot),lt=new m.Frustum,ut=new m.Matrix4,pt=new m.Vector3,dt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},ft={geometries:0,textures:0},mt={calls:0,vertices:0,faces:0,points:0};this.info={render:mt,memory:ft,programs:null};var gt;try{if(R={alpha:R,depth:U,stencil:k,antialias:D,premultipliedAlpha:I,preserveDrawingBuffer:F},null===(gt=P||A.getContext("webgl",R)||A.getContext("experimental-webgl",R))){if(null!==A.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}A.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var vt=new m.WebGLExtensions(gt);vt.get("OES_texture_float"),vt.get("OES_texture_float_linear"),vt.get("OES_texture_half_float"),vt.get("OES_texture_half_float_linear"),vt.get("OES_standard_derivatives"),vt.get("ANGLE_instanced_arrays"),vt.get("OES_element_index_uint")&&(m.BufferGeometry.MaxIndex=4294967296);var yt=new m.WebGLCapabilities(gt,vt,t),xt=new m.WebGLState(gt,vt,L),bt=new m.WebGLProperties,_t=new m.WebGLObjects(gt,bt,this.info),Mt=new m.WebGLPrograms(this,yt),wt=new m.WebGLLights;this.info.programs=Mt.programs;var St=new m.WebGLBufferRenderer(gt,vt,mt),Et=new m.WebGLIndexedBufferRenderer(gt,vt,mt);r(),this.context=gt,this.capabilities=yt,this.extensions=vt,this.properties=bt,this.state=xt;var Tt=new m.WebGLShadowMap(this,dt,_t);this.shadowMap=Tt;var Ct=new m.SpritePlugin(this,H),Lt=new m.LensFlarePlugin(this,j);this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){vt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var t;return function(){if(void 0!==t)return t;var e=vt.get("EXT_texture_filter_anisotropic");return t=null!==e?gt.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return yt.precision},this.getPixelRatio=function(){return at},this.setPixelRatio=function(t){void 0!==t&&(at=t,this.setSize(ct.z,ct.w,!1))},this.getSize=function(){return{width:nt,height:ot}},this.setSize=function(t,e,r){nt=t,ot=e,A.width=t*at,A.height=e*at,!1!==r&&(A.style.width=t+"px",A.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){xt.viewport(ct.set(t,e,r,i))},this.setScissor=function(t,e,r,i){xt.scissor(st.set(t,e,r,i))},this.setScissorTest=function(t){xt.setScissorTest(ht=t)},this.getClearColor=function(){return rt},this.setClearColor=function(t,r){rt.set(t),it=void 0!==r?r:1,e(rt.r,rt.g,rt.b,it)},this.getClearAlpha=function(){return it},this.setClearAlpha=function(t){it=t,e(rt.r,rt.g,rt.b,it)},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=gt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=gt.STENCIL_BUFFER_BIT),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){A.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(t,e,r){xt.initAttributes();var i=bt.get(t);if(t.hasPositions&&!i.position&&(i.position=gt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=gt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=gt.createBuffer()),t.hasColors&&!i.color&&(i.color=gt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.position),gt.bufferData(gt.ARRAY_BUFFER,t.positionArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.position),gt.vertexAttribPointer(e.position,3,gt.FLOAT,!1,0,0)),t.hasNormals){if(gt.bindBuffer(gt.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===m.FlatShading)for(var n=0,o=3*t.count;n<o;n+=9){var a=t.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,h=(a[n+1]+a[n+4]+a[n+7])/3,c=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=h,a[n+2]=c,a[n+3]=s,a[n+4]=h,a[n+5]=c,a[n+6]=s,a[n+7]=h,a[n+8]=c}gt.bufferData(gt.ARRAY_BUFFER,t.normalArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.normal),gt.vertexAttribPointer(e.normal,3,gt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.uv),gt.bufferData(gt.ARRAY_BUFFER,t.uvArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.uv),gt.vertexAttribPointer(e.uv,2,gt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==m.NoColors&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.color),gt.bufferData(gt.ARRAY_BUFFER,t.colorArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.color),gt.vertexAttribPointer(e.color,3,gt.FLOAT,!1,0,0)),xt.disableUnusedAttributes(),gt.drawArrays(gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o){g(i);var a=v(t,e,i,n),s=!1;if((t=r.id+"_"+a.id+"_"+i.wireframe)!==Q&&(Q=t,s=!0),void 0!==(e=n.morphTargetInfluences)){t=[];for(var h=0,s=e.length;h<s;h++)d=e[h],t.push([d,h]);t.sort(c),8<t.length&&(t.length=8);for(var l=r.morphAttributes,h=0,s=t.length;h<s;h++)d=t[h],z[h]=d[0],0!==d[0]?(e=d[1],!0===i.morphTargets&&l.position&&r.addAttribute("morphTarget"+h,l.position[e]),!0===i.morphNormals&&l.normal&&r.addAttribute("morphNormal"+h,l.normal[e])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+h),!0===i.morphNormals&&r.removeAttribute("morphNormal"+h));null!==(t=a.getUniforms()).morphTargetInfluences&&gt.uniform1fv(t.morphTargetInfluences,z),s=!0}if(e=r.index,h=r.attributes.position,!0===i.wireframe&&(e=_t.getWireframeAttribute(r)),null!==e?(t=Et).setIndex(e):t=St,s){var u,s=void 0;if(r instanceof m.InstancedBufferGeometry&&null===(u=vt.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),xt.initAttributes();var p,d=r.attributes,a=a.getAttributes(),l=i.defaultAttributeValues;for(p in a){var f=a[p];if(0<=f)if(void 0!==(M=d[p])){var y=M.itemSize,x=_t.getAttributeBuffer(M);if(M instanceof m.InterleavedBufferAttribute){var b=M.data,_=b.stride,M=M.offset;b instanceof m.InstancedInterleavedBuffer?(xt.enableAttributeAndDivisor(f,b.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=b.meshPerAttribute*b.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,_*b.array.BYTES_PER_ELEMENT,(s*_+M)*b.array.BYTES_PER_ELEMENT)}else M instanceof m.InstancedBufferAttribute?(xt.enableAttributeAndDivisor(f,M.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=M.meshPerAttribute*M.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,0,s*y*4)}else if(void 0!==l&&void 0!==(y=l[p]))switch(y.length){case 2:gt.vertexAttrib2fv(f,y);break;case 3:gt.vertexAttrib3fv(f,y);break;case 4:gt.vertexAttrib4fv(f,y);break;default:gt.vertexAttrib1fv(f,y)}}xt.disableUnusedAttributes()}null!==e&&gt.bindBuffer(gt.ELEMENT_ARRAY_BUFFER,_t.getAttributeBuffer(e))}if(u=1/0,null!==e?u=e.count:void 0!==h&&(u=h.count),p=r.drawRange.start,e=r.drawRange.count,h=null!==o?o.start:0,s=null!==o?o.count:1/0,o=Math.max(0,p,h),u=Math.min(0+u,p+e,h+s)-1,u=Math.max(0,u-o+1),n instanceof m.Mesh)if(!0===i.wireframe)xt.setLineWidth(i.wireframeLinewidth*(null===q?at:1)),t.setMode(gt.LINES);else switch(n.drawMode){case m.TrianglesDrawMode:t.setMode(gt.TRIANGLES);break;case m.TriangleStripDrawMode:t.setMode(gt.TRIANGLE_STRIP);break;case m.TriangleFanDrawMode:t.setMode(gt.TRIANGLE_FAN)}else n instanceof m.Line?(void 0===(i=i.linewidth)&&(i=1),xt.setLineWidth(i*(null===q?at:1)),n instanceof m.LineSegments?t.setMode(gt.LINES):t.setMode(gt.LINE_STRIP)):n instanceof m.Points&&t.setMode(gt.POINTS);r instanceof m.InstancedBufferGeometry&&0<r.maxInstancedCount?t.renderInstances(r,o,u):t.render(o,u)},this.render=function(t,e,r,i){if(0==e instanceof m.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=t.fog;Q="",Z=-1,K=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ut.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),lt.setFromMatrix(ut),B.length=0,G=N=-1,H.length=0,j.length=0,d(t,e),V.length=N+1,O.length=G+1,!0===W.sortObjects&&(V.sort(l),O.sort(u));var o,a,s,h,c,p,g=B,v=0,y=0,x=0,b=e.matrixWorldInverse,_=0,w=0,S=0,E=0,T=0;for(o=dt.shadowsPointLight=0,a=g.length;o<a;o++)if(s=g[o],h=s.color,c=s.intensity,p=s.distance,s instanceof m.AmbientLight)v+=h.r*c,y+=h.g*c,x+=h.b*c;else if(s instanceof m.DirectionalLight){var C=wt.get(s);C.color.copy(s.color).multiplyScalar(s.intensity),C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.directionalShadowMap[_]=s.shadow.map,dt.directionalShadowMatrix[_]=s.shadow.matrix,dt.directional[_++]=C}else s instanceof m.SpotLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(h).multiplyScalar(c),C.distance=p,C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),C.angleCos=Math.cos(s.angle),C.exponent=s.exponent,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.spotShadowMap[S]=s.shadow.map,dt.spotShadowMatrix[S]=s.shadow.matrix,dt.spot[S++]=C):s instanceof m.PointLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(s.color).multiplyScalar(s.intensity),C.distance=s.distance,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.pointShadowMap[w]=s.shadow.map,void 0===dt.pointShadowMatrix[w]&&(dt.pointShadowMatrix[w]=new m.Matrix4),pt.setFromMatrixPosition(s.matrixWorld).negate(),dt.pointShadowMatrix[w].identity().setPosition(pt),dt.point[w++]=C):s instanceof m.HemisphereLight&&((C=wt.get(s)).direction.setFromMatrixPosition(s.matrixWorld),C.direction.transformDirection(b),C.direction.normalize(),C.skyColor.copy(s.color).multiplyScalar(c),C.groundColor.copy(s.groundColor).multiplyScalar(c),dt.hemi[E++]=C);dt.ambient[0]=v,dt.ambient[1]=y,dt.ambient[2]=x,dt.directional.length=_,dt.spot.length=S,dt.point.length=w,dt.hemi.length=E,dt.shadows.length=T,dt.hash=_+","+w+","+S+","+E+","+T,Tt.render(t,e),mt.calls=0,mt.vertices=0,mt.faces=0,mt.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),t.overrideMaterial?(i=t.overrideMaterial,f(V,e,n,i),f(O,e,n,i)):(xt.setBlending(m.NoBlending),f(V,e,n),f(O,e,n)),Ct.render(t,e),Lt.render(t,e,tt),r&&(t=r.texture).generateMipmaps&&M(r)&&t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter&&(t=r instanceof m.WebGLRenderTargetCube?gt.TEXTURE_CUBE_MAP:gt.TEXTURE_2D,r=bt.get(r.texture).__webglTexture,xt.bindTexture(t,r),gt.generateMipmap(t),xt.bindTexture(t,null)),xt.setDepthTest(!0),xt.setDepthWrite(!0),xt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){t===m.CullFaceNone?xt.disable(gt.CULL_FACE):(e===m.FrontFaceDirectionCW?gt.frontFace(gt.CW):gt.frontFace(gt.CCW),t===m.CullFaceBack?gt.cullFace(gt.BACK):t===m.CullFaceFront?gt.cullFace(gt.FRONT):gt.cullFace(gt.FRONT_AND_BACK),xt.enable(gt.CULL_FACE))},this.setTexture=function(t,e){var r=bt.get(t);if(0<t.version&&r.__version!==t.version)if(void 0===(n=t.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t);else{void 0===r.__webglInit&&(r.__webglInit=!0,t.addEventListener("dispose",o),r.__webglTexture=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,t.unpackAlignment);var i=_(t.image,yt.maxTextureSize);(t.wrapS!==m.ClampToEdgeWrapping||t.wrapT!==m.ClampToEdgeWrapping||t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter)&&!1===M(i)&&((n=i)instanceof HTMLImageElement||n instanceof HTMLCanvasElement?((a=document.createElement("canvas")).width=m.Math.nearestPowerOfTwo(n.width),a.height=m.Math.nearestPowerOfTwo(n.height),a.getContext("2d").drawImage(n,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+a.width+"x"+a.height,n),i=a):i=n);var n=M(i),a=L(t.format),s=L(t.type);b(gt.TEXTURE_2D,t,n);var h=t.mipmaps;if(t instanceof m.DataTexture)if(0<h.length&&n){for(var c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(t instanceof m.CompressedTexture)for(c=0,l=h.length;c<l;c++)i=h[c],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(a)?xt.compressedTexImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);else if(0<h.length&&n){for(c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,a,s,i);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,a,s,i);t.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(t){if((q=t)&&void 0===bt.get(t).__webglFramebuffer){var e=bt.get(t),r=bt.get(t.texture);t.addEventListener("dispose",a),r.__webglTexture=gt.createTexture(),ft.textures++;var i=t instanceof m.WebGLRenderTargetCube,n=m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height);if(i){e.__webglFramebuffer=[];for(var o=0;6>o;o++)e.__webglFramebuffer[o]=gt.createFramebuffer()}else e.__webglFramebuffer=gt.createFramebuffer();if(i){for(xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__webglTexture),b(gt.TEXTURE_CUBE_MAP,t.texture,n),o=0;6>o;o++)E(e.__webglFramebuffer[o],t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+o);t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),xt.bindTexture(gt.TEXTURE_CUBE_MAP,null)}else xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),b(gt.TEXTURE_2D,t.texture,n),E(e.__webglFramebuffer,t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_2D),t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),xt.bindTexture(gt.TEXTURE_2D,null);if(t.depthBuffer){if(e=bt.get(t),t instanceof m.WebGLRenderTargetCube)for(e.__webglDepthbuffer=[],r=0;6>r;r++)gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer[r]),e.__webglDepthbuffer[r]=gt.createRenderbuffer(),T(e.__webglDepthbuffer[r],t);else gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=gt.createRenderbuffer(),T(e.__webglDepthbuffer,t);gt.bindFramebuffer(gt.FRAMEBUFFER,null)}}e=t instanceof m.WebGLRenderTargetCube,t?(r=bt.get(t),r=e?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,J.copy(t.scissor),$=t.scissorTest,tt.copy(t.viewport)):(r=null,J.copy(st).multiplyScalar(at),$=ht,tt.copy(ct).multiplyScalar(at)),Y!==r&&(gt.bindFramebuffer(gt.FRAMEBUFFER,r),Y=r),xt.scissor(J),xt.setScissorTest($),xt.viewport(tt),e&&(e=bt.get(t.texture),gt.framebufferTexture2D(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,e.__webglTexture,0))},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(0==t instanceof m.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=bt.get(t).__webglFramebuffer;if(a){var s=!1;a!==Y&&(gt.bindFramebuffer(gt.FRAMEBUFFER,a),s=!0);try{var h=t.texture;h.format!==m.RGBAFormat&&L(h.format)!==gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===m.UnsignedByteType||L(h.type)===gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===m.FloatType&&vt.get("WEBGL_color_buffer_float")||h.type===m.HalfFloatType&&vt.get("EXT_color_buffer_half_float")?gt.checkFramebufferStatus(gt.FRAMEBUFFER)===gt.FRAMEBUFFER_COMPLETE?gt.readPixels(e,r,i,n,L(h.format),L(h.type),o):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{s&&gt.bindFramebuffer(gt.FRAMEBUFFER,Y)}}}}},m.WebGLRenderTarget=function(t,e,r){this.uuid=m.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new m.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new m.Vector4(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=m.LinearFilter),this.texture=new m.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer},m.WebGLRenderTarget.prototype={constructor:m.WebGLRenderTarget,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.shareDepthFrom=t.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube=function(t,e,r){m.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},m.WebGLRenderTargetCube.prototype=Object.create(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube.prototype.constructor=m.WebGLRenderTargetCube,m.WebGLBufferRenderer=function(t,e,r){var i;this.setMode=function(t){i=t},this.render=function(e,n){t.drawArrays(i,e,n),r.calls++,r.vertices+=n,i===t.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=e.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=n.attributes.position,s=0,s=a instanceof m.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},m.WebGLIndexedBufferRenderer=function(t,e,r){var i,n,o;this.setMode=function(t){i=t},this.setIndex=function(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(n=t.UNSIGNED_INT,o=4):(n=t.UNSIGNED_SHORT,o=2)},this.render=function(e,a){t.drawElements(i,a,n,e*o),r.calls++,r.vertices+=a,i===t.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,h){var c=e.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(i,h,n,s*o,a.maxInstancedCount),r.calls++,r.vertices+=h*a.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=a.maxInstancedCount*h/3))}},m.WebGLExtensions=function(t){var e={};this.get=function(r){if(void 0!==e[r])return e[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=i}},m.WebGLCapabilities=function(t,e,r){function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer&&r.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,(r=i(this.precision))!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},m.WebGLGeometries=function(t,e,r){function i(t){var a=t.target;null!==(t=o[a.id]).index&&n(t.index);var s,h=t.attributes;for(s in h)n(h[s]);a.removeEventListener("dispose",i),delete o[a.id],(s=e.get(a)).wireframe&&n(s.wireframe),e.delete(a),(a=e.get(t)).wireframe&&n(a.wireframe),e.delete(t),r.memory.geometries--}function n(r){var i;void 0!==(i=r instanceof m.InterleavedBufferAttribute?e.get(r.data).__webglBuffer:e.get(r).__webglBuffer)&&(t.deleteBuffer(i),r instanceof m.InterleavedBufferAttribute?e.delete(r.data):e.delete(r))}var o={};this.get=function(t){var e=t.geometry;if(void 0!==o[e.id])return o[e.id];e.addEventListener("dispose",i);var n;return e instanceof m.BufferGeometry?n=e:e instanceof m.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new m.BufferGeometry).setFromObject(t)),n=e._bufferGeometry),o[e.id]=n,r.memory.geometries++,n}},m.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new m.Vector3,color:new m.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"SpotLight":r={position:new m.Vector3,direction:new m.Vector3,color:new m.Color,distance:0,angleCos:0,exponent:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"PointLight":r={position:new m.Vector3,color:new m.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"HemisphereLight":r={direction:new m.Vector3,skyColor:new m.Color,groundColor:new m.Color}}return t[e.id]=r}},m.WebGLObjects=function(t,e,r){function i(r,i){var n=r instanceof m.InterleavedBufferAttribute?r.data:r,o=e.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=t.createBuffer(),t.bindBuffer(i,o.__webglBuffer),t.bufferData(i,n.array,n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(t.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?t.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),o.version=n.version)}function n(t,e,r){if(e>r){var i=e;e=r,r=i}return i=t[e],void 0===i?(t[e]=[r],!0):-1===i.indexOf(r)&&(i.push(r),!0)}var o=new m.WebGLGeometries(t,e,r);this.getAttributeBuffer=function(t){return t instanceof m.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer},this.getWireframeAttribute=function(r){var o=e.get(r);if(void 0!==o.wireframe)return o.wireframe;var a=[],s=r.index;if(r=(h=r.attributes).position,null!==s)for(var h={},s=s.array,c=0,l=s.length;c<l;c+=3){var u=s[c+0],p=s[c+1],d=s[c+2];n(h,u,p)&&a.push(u,p),n(h,p,d)&&a.push(p,d),n(h,d,u)&&a.push(d,u)}else for(s=h.position.array,c=0,l=s.length/3-1;c<l;c+=3)u=c+0,p=c+1,d=c+2,a.push(u,p,p,d,d,u);return a=new m.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),i(a,t.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(e){var r=o.get(e);e.geometry instanceof m.Geometry&&r.updateFromObject(e),e=r.index,a=r.attributes,null!==e&&i(e,t.ELEMENT_ARRAY_BUFFER);for(var n in a)i(a[n],t.ARRAY_BUFFER);e=r.morphAttributes;for(n in e)for(var a=e[n],s=0,h=a.length;s<h;s++)i(a[s],t.ARRAY_BUFFER);return r}},m.WebGLProgram=function(){function t(t,e,i){return t=t||{},[t.derivatives||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(r).join("\n")}function e(t){var e,r=[];for(e in t){var i=t[e];!1!==i&&r.push("#define "+e+" "+i)}return r.join("\n")}function r(t){return""!==t}function i(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function n(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,i){for(t="",e=parseInt(e);e<parseInt(r);e++)t+=i.replace(/\[ i \]/g,"[ "+e+" ]");return t})}var o=0,a=/^([\w\d_]+)\.([\w\d_]+)$/,s=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,h=/^([\w\d_]+)\[0\]$/;return function(c,l,u,p){var d=c.context,f=u.extensions,g=u.defines,v=u.__webglShader.vertexShader,y=u.__webglShader.fragmentShader,x="SHADOWMAP_TYPE_BASIC";p.shadowMapType===m.PCFShadowMap?x="SHADOWMAP_TYPE_PCF":p.shadowMapType===m.PCFSoftShadowMap&&(x="SHADOWMAP_TYPE_PCF_SOFT");var b="ENVMAP_TYPE_CUBE",_="ENVMAP_MODE_REFLECTION",M="ENVMAP_BLENDING_MULTIPLY";if(p.envMap){switch(u.envMap.mapping){case m.CubeReflectionMapping:case m.CubeRefractionMapping:b="ENVMAP_TYPE_CUBE";break;case m.EquirectangularReflectionMapping:case m.EquirectangularRefractionMapping:b="ENVMAP_TYPE_EQUIREC";break;case m.SphericalReflectionMapping:b="ENVMAP_TYPE_SPHERE"}switch(u.envMap.mapping){case m.CubeRefractionMapping:case m.EquirectangularRefractionMapping:_="ENVMAP_MODE_REFRACTION"}switch(u.combine){case m.MultiplyOperation:M="ENVMAP_BLENDING_MULTIPLY";break;case m.MixOperation:M="ENVMAP_BLENDING_MIX";break;case m.AddOperation:M="ENVMAP_BLENDING_ADD"}}var w=0<c.gammaFactor?c.gammaFactor:1,f=t(f,p,c.extensions),S=e(g),E=d.createProgram();u instanceof m.RawShaderMaterial?c=g="":(g=["precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+p.maxBones,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+_:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.displacementMap&&p.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.skinning?"#define USE_SKINNING":"",p.useVertexTexture?"#define BONE_TEXTURE":"",p.morphTargets?"#define USE_MORPHTARGETS":"",p.morphNormals&&!1===p.flatShading?"#define USE_MORPHNORMALS":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.sizeAttenuation?"#define USE_SIZEATTENUATION":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(r).join("\n"),c=[f,"precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.alphaTest?"#define ALPHATEST "+p.alphaTest:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,p.useFog&&p.fog?"#define USE_FOG":"",p.useFog&&p.fogExp?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+b:"",p.envMap?"#define "+_:"",p.envMap?"#define "+M:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",p.envMap&&c.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(r).join("\n")),v=i(v,p),y=i(y,p),0==u instanceof m.ShaderMaterial&&(v=n(v),y=n(y)),y=c+y,v=m.WebGLShader(d,d.VERTEX_SHADER,g+v),y=m.WebGLShader(d,d.FRAGMENT_SHADER,y),d.attachShader(E,v),d.attachShader(E,y),void 0!==u.index0AttributeName?d.bindAttribLocation(E,0,u.index0AttributeName):!0===p.morphTargets&&d.bindAttribLocation(E,0,"position"),d.linkProgram(E),p=d.getProgramInfoLog(E),x=d.getShaderInfoLog(v),b=d.getShaderInfoLog(y),M=_=!0,!1===d.getProgramParameter(E,d.LINK_STATUS)?(_=!1,console.error("THREE.WebGLProgram: shader error: ",d.getError(),"gl.VALIDATE_STATUS",d.getProgramParameter(E,d.VALIDATE_STATUS),"gl.getProgramInfoLog",p,x,b)):""!==p?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",p):""!==x&&""!==b||(M=!1),M&&(this.diagnostics={runnable:_,material:u,programLog:p,vertexShader:{log:x,prefix:g},fragmentShader:{log:b,prefix:c}}),d.deleteShader(v),d.deleteShader(y);var T;this.getUniforms=function(){if(void 0===T){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_UNIFORMS),r=0;r<e;r++){var i=d.getActiveUniform(E,r).name,n=d.getUniformLocation(E,i);if(o=a.exec(i)){var i=o[1],o=o[2];(c=t[i])||(c=t[i]={}),c[o]=n}else if(o=s.exec(i)){var c=o[1],i=o[2],o=o[3],l=t[c];l||(l=t[c]=[]),(c=l[i])||(c=l[i]={}),c[o]=n}else(o=h.exec(i))?(c=o[1],t[c]=n):t[i]=n}T=t}return T};var C;return this.getAttributes=function(){if(void 0===C){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var i=d.getActiveAttrib(E,r).name;t[i]=d.getAttribLocation(E,i)}C=t}return C},this.destroy=function(){d.deleteProgram(E),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=o++,this.code=l,this.usedTimes=1,this.program=E,this.vertexShader=v,this.fragmentShader=y,this}}(),m.WebGLPrograms=function(t,e){var r=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled pointLightShadows shadowMapType alphaTest doubleSided flipSided".split(" ");this.getParameters=function(r,n,o,a){var s,h=i[r.type];e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture?s=1024:(s=Math.floor((e.maxVertexUniforms-20)/4),void 0!==a&&a instanceof m.SkinnedMesh&&(s=Math.min(a.skeleton.bones.length,s))<a.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+a.skeleton.bones.length+", this GPU supports just "+s+" (try OpenGL instead of ANGLE)"));var c=t.getPrecision();return null!==r.precision&&(c=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",c,"instead."),{shaderID:h,precision:c,supportsVertexTextures:e.vertexTextures,map:!!r.map,envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:o,useFog:r.fog,fogExp:o instanceof m.FogExp2,flatShading:r.shading===m.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:s,useVertexTexture:e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numHemiLights:n.hemi.length,pointLightShadows:n.shadowsPointLight,shadowMapEnabled:t.shadowMap.enabled&&a.receiveShadow&&0<n.shadows.length,shadowMapType:t.shadowMap.type,alphaTest:r.alphaTest,doubleSided:r.side===m.DoubleSide,flipSided:r.side===m.BackSide}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(i=0;i<n.length;i++){var o=n[i];r.push(o),r.push(e[o])}return r.join()},this.acquireProgram=function(e,i,n){for(var o,a=0,s=r.length;a<s;a++){var h=r[a];if(h.code===n){++(o=h).usedTimes;break}}return void 0===o&&(o=new m.WebGLProgram(t,n,e,i),r.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r},m.WebGLProperties=function(){var t={};this.get=function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},this.delete=function(e){delete t[e.uuid]},this.clear=function(){t={}}},m.WebGLShader=function(){function t(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}return function(e,r,i){var n=e.createShader(r);return e.shaderSource(n,i),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),t(i)),n}}(),m.WebGLShadowMap=function(t,e,r){function i(t,e,r,i){var n=t.geometry,o=null,o=p,a=t.customDepthMaterial;return r&&(o=d,a=t.customDistanceMaterial),a?o=a:(t=t instanceof m.SkinnedMesh&&e.skinning,a=0,void 0!==n.morphTargets&&0<n.morphTargets.length&&e.morphTargets&&(a|=1),t&&(a|=2),o=o[a]),o.visible=e.visible,o.wireframe=e.wireframe,o.wireframeLinewidth=e.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(t,e,r){if(!1!==t.visible){t.layers.test(e.layers)&&(t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&t.castShadow&&(!1===t.frustumCulled||!0===s.intersectsObject(t))&&!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),u.push(t));for(var i=0,o=(t=t.children).length;i<o;i++)n(t[i],e,r)}}for(var o=t.context,a=t.state,s=new m.Frustum,h=new m.Matrix4,c=new m.Vector3,l=new m.Vector3,u=[],p=Array(4),d=Array(4),f=[new m.Vector3(1,0,0),new m.Vector3(-1,0,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1),new m.Vector3(0,1,0),new m.Vector3(0,-1,0)],g=[new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1)],v=[new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4],y=m.ShaderLib.depthRGBA,x=m.UniformsUtils.clone(y.uniforms),b=m.ShaderLib.distanceRGBA,_=m.UniformsUtils.clone(b.uniforms),M=0;4!==M;++M){var w=0!=(1&M),S=0!=(2&M),E=new m.ShaderMaterial({uniforms:x,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:w,skinning:S});E._shadowPass=!0,p[M]=E,(w=new m.ShaderMaterial({uniforms:_,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:w,skinning:S}))._shadowPass=!0,d[M]=w}var T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m.PCFShadowMap,this.cullFace=m.CullFaceFront,this.render=function(p,d){var y,x;if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)){a.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(T.cullFace===m.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var b=e.shadows,_=0,M=b.length;_<M;_++){var w=b[_],S=w.shadow,E=S.camera,C=S.mapSize;if(w instanceof m.PointLight){y=6,x=!0;var L=C.x/4,A=C.y/2;v[0].set(2*L,A,L,A),v[1].set(0,A,L,A),v[2].set(3*L,A,L,A),v[3].set(L,A,L,A),v[4].set(3*L,0,L,A),v[5].set(L,0,L,A)}else y=1,x=!1;for(null===S.map&&(S.map=new m.WebGLRenderTarget(C.x,C.y,{minFilter:m.LinearFilter,magFilter:m.LinearFilter,format:m.RGBAFormat}),w instanceof m.SpotLight&&(E.aspect=C.x/C.y),E.updateProjectionMatrix()),C=S.map,S=S.matrix,l.setFromMatrixPosition(w.matrixWorld),E.position.copy(l),t.setRenderTarget(C),t.clear(),C=0;C<y;C++)for(x?(c.copy(E.position),c.add(f[C]),E.up.copy(g[C]),E.lookAt(c),a.viewport(v[C])):(c.setFromMatrixPosition(w.target.matrixWorld),E.lookAt(c)),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),S.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),S.multiply(E.projectionMatrix),S.multiply(E.matrixWorldInverse),h.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),s.setFromMatrix(h),u.length=0,n(p,d,E),L=0,A=u.length;L<A;L++){var P=u[L],R=r.update(P);if((k=P.material)instanceof m.MultiMaterial)for(var U=R.groups,k=k.materials,D=0,I=U.length;D<I;D++){var F=U[D],B=k[F.materialIndex];!0===B.visible&&(B=i(P,B,x,l),t.renderBufferDirect(E,null,R,B,P,F))}else B=i(P,k,x,l),t.renderBufferDirect(E,null,R,B,P,null)}t.resetGLState()}y=t.getClearColor(),x=t.getClearAlpha(),t.setClearColor(y,x),a.enable(o.BLEND),T.cullFace===m.CullFaceFront&&o.cullFace(o.BACK),t.resetGLState(),T.needsUpdate=!1}}},m.WebGLState=function(t,e,r){var i=this,n=new m.Vector4,o=new Uint8Array(16),a=new Uint8Array(16),s=new Uint8Array(16),h={},c=null,l=null,u=null,p=null,d=null,f=null,g=null,v=null,y=null,x=null,b=null,_=null,M=null,w=null,S=null,E=null,T=null,C=null,L=null,A=null,P=null,R=null,U=null,k=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),D=void 0,I={},F=new m.Vector4,B=null,V=null,N=new m.Vector4,O=new m.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.frontFace(t.CCW),t.cullFace(t.BACK),this.enable(t.CULL_FACE),this.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var t=0,e=o.length;t<e;t++)o[t]=0},this.enableAttribute=function(r){o[r]=1,0===a[r]&&(t.enableVertexAttribArray(r),a[r]=1),0!==s[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),s[r]=0)},this.enableAttributeAndDivisor=function(e,r,i){o[e]=1,0===a[e]&&(t.enableVertexAttribArray(e),a[e]=1),s[e]!==r&&(i.vertexAttribDivisorANGLE(e,r),s[e]=r)},this.disableUnusedAttributes=function(){for(var e=0,r=a.length;e<r;e++)a[e]!==o[e]&&(t.disableVertexAttribArray(e),a[e]=0)},this.enable=function(e){!0!==h[e]&&(t.enable(e),h[e]=!0)},this.disable=function(e){!1!==h[e]&&(t.disable(e),h[e]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)c.push(r[i]);return c},this.setBlending=function(e,i,n,o,a,s,h){e===m.NoBlending?this.disable(t.BLEND):this.enable(t.BLEND),e!==l&&(e===m.AdditiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===m.SubtractiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===m.MultiplyBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),l=e),e===m.CustomBlending?(a=a||i,s=s||n,h=h||o,i===u&&a===f||(t.blendEquationSeparate(r(i),r(a)),u=i,f=a),n===p&&o===d&&s===g&&h===v||(t.blendFuncSeparate(r(n),r(o),r(s),r(h)),p=n,d=o,g=s,v=h)):v=g=f=d=p=u=null},this.setDepthFunc=function(e){if(y!==e){if(e)switch(e){case m.NeverDepth:t.depthFunc(t.NEVER);break;case m.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case m.LessDepth:t.depthFunc(t.LESS);break;case m.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case m.EqualDepth:t.depthFunc(t.EQUAL);break;case m.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case m.GreaterDepth:t.depthFunc(t.GREATER);break;case m.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);y=e}},this.setDepthTest=function(e){e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)},this.setDepthWrite=function(e){x!==e&&(t.depthMask(e),x=e)},this.setColorWrite=function(e){b!==e&&(t.colorMask(e,e,e,e),b=e)},this.setStencilFunc=function(e,r,i){M===e&&w===r&&S===i||(t.stencilFunc(e,r,i),M=e,w=r,S=i)},this.setStencilOp=function(e,r,i){E===e&&T===r&&C===i||(t.stencilOp(e,r,i),E=e,T=r,C=i)},this.setStencilTest=function(e){e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)},this.setStencilWrite=function(e){_!==e&&(t.stencilMask(e),_=e)},this.setFlipSided=function(e){L!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),L=e)},this.setLineWidth=function(e){e!==A&&(t.lineWidth(e),A=e)},this.setPolygonOffset=function(e,r,i){e?this.enable(t.POLYGON_OFFSET_FILL):this.disable(t.POLYGON_OFFSET_FILL),!e||P===r&&R===i||(t.polygonOffset(r,i),P=r,R=i)},this.getScissorTest=function(){return U},this.setScissorTest=function(e){(U=e)?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+k-1),D!==e&&(t.activeTexture(e),D=e)},this.bindTexture=function(e,r){void 0===D&&i.activeTexture();var n=I[D];void 0===n&&(n={type:void 0,texture:void 0},I[D]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r),n.type=e,n.texture=r)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.clearColor=function(e,r,i,o){n.set(e,r,i,o),!1===F.equals(n)&&(t.clearColor(e,r,i,o),F.copy(n))},this.clearDepth=function(e){B!==e&&(t.clearDepth(e),B=e)},this.clearStencil=function(e){V!==e&&(t.clearStencil(e),V=e)},this.scissor=function(e){!1===N.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),N.copy(e))},this.viewport=function(e){!1===O.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),O.copy(e))},this.reset=function(){for(var e=0;e<a.length;e++)1===a[e]&&(t.disableVertexAttribArray(e),a[e]=0);h={},L=_=x=b=l=c=null}},m.LensFlarePlugin=function(t,e){var r,i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x=t.context,b=t.state;this.render=function(_,M,w){if(0!==e.length){_=new m.Vector3;var S=w.w/w.z,E=.5*w.z,T=.5*w.w,C=16/w.w,L=new m.Vector2(C*S,C),A=new m.Vector3(1,1,0),P=new m.Vector2(1,1);if(void 0===f){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),R=new Uint16Array([0,1,2,0,2,3]);p=x.createBuffer(),d=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,p),x.bufferData(x.ARRAY_BUFFER,C,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),x.bufferData(x.ELEMENT_ARRAY_BUFFER,R,x.STATIC_DRAW),v=x.createTexture(),y=x.createTexture(),b.bindTexture(x.TEXTURE_2D,v),x.texImage2D(x.TEXTURE_2D,0,x.RGB,16,16,0,x.RGB,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST),b.bindTexture(x.TEXTURE_2D,y),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,16,16,0,x.RGBA,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST);var C=(g=0<x.getParameter(x.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},R=x.createProgram(),U=x.createShader(x.FRAGMENT_SHADER),k=x.createShader(x.VERTEX_SHADER),D="precision "+t.getPrecision()+" float;\n";x.shaderSource(U,D+C.fragmentShader),x.shaderSource(k,D+C.vertexShader),x.compileShader(U),x.compileShader(k),x.attachShader(R,U),x.attachShader(R,k),x.linkProgram(R),f=R,l=x.getAttribLocation(f,"position"),u=x.getAttribLocation(f,"uv"),r=x.getUniformLocation(f,"renderType"),i=x.getUniformLocation(f,"map"),n=x.getUniformLocation(f,"occlusionMap"),o=x.getUniformLocation(f,"opacity"),a=x.getUniformLocation(f,"color"),s=x.getUniformLocation(f,"scale"),h=x.getUniformLocation(f,"rotation"),c=x.getUniformLocation(f,"screenPosition")}for(x.useProgram(f),b.initAttributes(),b.enableAttribute(l),b.enableAttribute(u),b.disableUnusedAttributes(),x.uniform1i(n,0),x.uniform1i(i,1),x.bindBuffer(x.ARRAY_BUFFER,p),x.vertexAttribPointer(l,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),b.disable(x.CULL_FACE),b.setDepthWrite(!1),R=0,U=e.length;R<U;R++)if(C=16/w.w,L.set(C*S,C),k=e[R],_.set(k.matrixWorld.elements[12],k.matrixWorld.elements[13],k.matrixWorld.elements[14]),_.applyMatrix4(M.matrixWorldInverse),_.applyProjection(M.projectionMatrix),A.copy(_),P.x=A.x*E+E,P.y=A.y*T+T,g||0<P.x&&P.x<w.z&&0<P.y&&P.y<w.w){b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,null),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGB,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,0),x.uniform2f(s,L.x,L.y),x.uniform3f(c,A.x,A.y,A.z),b.disable(x.BLEND),b.enable(x.DEPTH_TEST),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,y),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGBA,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,1),b.disable(x.DEPTH_TEST),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),k.positionScreen.copy(A),k.customUpdateCallback?k.customUpdateCallback(k):k.updateLensFlares(),x.uniform1i(r,2),b.enable(x.BLEND);for(var D=0,I=k.lensFlares.length;D<I;D++){var F=k.lensFlares[D];.001<F.opacity&&.001<F.scale&&(A.x=F.x,A.y=F.y,A.z=F.z,C=F.size*F.scale/w.w,L.x=C*S,L.y=C,x.uniform3f(c,A.x,A.y,A.z),x.uniform2f(s,L.x,L.y),x.uniform1f(h,F.rotation),x.uniform1f(o,F.opacity),x.uniform3f(a,F.color.r,F.color.g,F.color.b),b.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),t.setTexture(F.texture,1),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0))}}b.enable(x.CULL_FACE),b.enable(x.DEPTH_TEST),b.setDepthWrite(!0),t.resetGLState()}}},m.SpritePlugin=function(t,e){function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x,b,_,M,w,S,E=t.context,T=t.state,C=new m.Vector3,L=new m.Quaternion,A=new m.Vector3;this.render=function(P,R){if(0!==e.length){if(void 0===w){var U=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),k=new Uint16Array([0,1,2,0,2,3]);_=E.createBuffer(),M=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,U,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.bufferData(E.ELEMENT_ARRAY_BUFFER,k,E.STATIC_DRAW);var U=E.createProgram(),k=E.createShader(E.VERTEX_SHADER),D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(k,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),E.shaderSource(D,["precision "+t.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),E.compileShader(k),E.compileShader(D),E.attachShader(U,k),E.attachShader(U,D),E.linkProgram(U),w=U,x=E.getAttribLocation(w,"position"),b=E.getAttribLocation(w,"uv"),i=E.getUniformLocation(w,"uvOffset"),n=E.getUniformLocation(w,"uvScale"),o=E.getUniformLocation(w,"rotation"),a=E.getUniformLocation(w,"scale"),s=E.getUniformLocation(w,"color"),h=E.getUniformLocation(w,"map"),c=E.getUniformLocation(w,"opacity"),l=E.getUniformLocation(w,"modelViewMatrix"),u=E.getUniformLocation(w,"projectionMatrix"),p=E.getUniformLocation(w,"fogType"),d=E.getUniformLocation(w,"fogDensity"),f=E.getUniformLocation(w,"fogNear"),g=E.getUniformLocation(w,"fogFar"),v=E.getUniformLocation(w,"fogColor"),y=E.getUniformLocation(w,"alphaTest"),(U=document.createElement("canvas")).width=8,U.height=8,(k=U.getContext("2d")).fillStyle="white",k.fillRect(0,0,8,8),(S=new m.Texture(U)).needsUpdate=!0}E.useProgram(w),T.initAttributes(),T.enableAttribute(x),T.enableAttribute(b),T.disableUnusedAttributes(),T.disable(E.CULL_FACE),T.enable(E.BLEND),E.bindBuffer(E.ARRAY_BUFFER,_),E.vertexAttribPointer(x,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(b,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.uniformMatrix4fv(u,!1,R.projectionMatrix.elements),T.activeTexture(E.TEXTURE0),E.uniform1i(h,0),k=U=0,(D=P.fog)?(E.uniform3f(v,D.color.r,D.color.g,D.color.b),D instanceof m.Fog?(E.uniform1f(f,D.near),E.uniform1f(g,D.far),E.uniform1i(p,1),k=U=1):D instanceof m.FogExp2&&(E.uniform1f(d,D.density),E.uniform1i(p,2),k=U=2)):(E.uniform1i(p,0),k=U=0);for(var D=0,I=e.length;D<I;D++)(B=e[D]).modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,B.matrixWorld),B.z=-B.modelViewMatrix.elements[14];e.sort(r);for(var F=[],D=0,I=e.length;D<I;D++){var B=e[D],V=B.material;E.uniform1f(y,V.alphaTest),E.uniformMatrix4fv(l,!1,B.modelViewMatrix.elements),B.matrixWorld.decompose(C,L,A),F[0]=A.x,F[1]=A.y,B=0,P.fog&&V.fog&&(B=k),U!==B&&(E.uniform1i(p,B),U=B),null!==V.map?(E.uniform2f(i,V.map.offset.x,V.map.offset.y),E.uniform2f(n,V.map.repeat.x,V.map.repeat.y)):(E.uniform2f(i,0,0),E.uniform2f(n,1,1)),E.uniform1f(c,V.opacity),E.uniform3f(s,V.color.r,V.color.g,V.color.b),E.uniform1f(o,V.rotation),E.uniform2fv(a,F),T.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),T.setDepthTest(V.depthTest),T.setDepthWrite(V.depthWrite),V.map&&V.map.image&&V.map.image.width?t.setTexture(V.map,0):t.setTexture(S,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}T.enable(E.CULL_FACE),t.resetGLState()}}},Object.defineProperties(m.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}}}),Object.defineProperties(m.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Matrix3.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}}),Object.defineProperties(m.Matrix4.prototype,{extractPosition:{value:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)}},setRotationFromQuaternion:{value:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)}},multiplyVector3:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)}},multiplyVector4:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}},rotateAxis:{value:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)}},crossVector:{value:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},translate:{value:function(t){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(m.Plane.prototype,{isIntersectionLine:{value:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}}),Object.defineProperties(m.Quaternion.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)}}}),Object.defineProperties(m.Ray.prototype,{isIntersectionBox:{value:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionPlane:{value:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)}},getScaleFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)}},getColumnFromMatrix:{value:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}}),m.Face4=function(t,e,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new m.Face3(t,e,r,n,o,a)},Object.defineProperties(m.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},getChildByName:{value:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)}},renderDepth:{set:function(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(m,{PointCloud:{value:function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new m.Points(t,e)}},ParticleSystem:{value:function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new m.Points(t,e)}}}),Object.defineProperties(m.Light.prototype,{onlyShadow:{set:function(t){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(t){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(m.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(m.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)}},addDrawCall:{value:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(m.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new m.Color}}}),Object.defineProperties(m,{PointCloudMaterial:{value:function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleBasicMaterial:{value:function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleSystemMaterial:{value:function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}}}),Object.defineProperties(m.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(m.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.defineProperties(m.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(m.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),m.GeometryUtils={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e instanceof m.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},m.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new m.TextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new m.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},m.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},m.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},m.MeshFaceMaterial=m.MultiMaterial,m.CurveUtils={tangentQuadraticBezier:function(t,e,r,i){return 2*(1-t)*(r-e)+2*t*(i-r)},tangentCubicBezier:function(t,e,r,i,n){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*n},tangentSpline:function(t,e,r,i,n){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,i,n){var o=n*n;return(2*e-2*r+(t=.5*(r-t))+(i=.5*(i-e)))*n*o+(-3*e+3*r-2*t-i)*o+t*n+e}},m.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new m.Group,i=0,n=e.length;i<n;i++)r.add(new m.Mesh(t,e[i]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var i=new m.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),e.remove(t),r.add(t)}},m.ShapeUtils={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(t,e){var r=t.length;if(3>r)return null;var i,n,o,a=[],s=[],h=[];if(0<m.ShapeUtils.area(t))for(n=0;n<r;n++)s[n]=n;else for(n=0;n<r;n++)s[n]=r-1-n;var c=2*r;for(n=r-1;2<r;){if(0>=c--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);var l;t:{var u=l=void 0,p=void 0,d=void 0,f=void 0,g=void 0,v=void 0,y=void 0,x=void 0,u=t[s[i]].x,p=t[s[i]].y,d=t[s[n]].x,f=t[s[n]].y,g=t[s[o]].x,v=t[s[o]].y;if(Number.EPSILON>(d-u)*(v-p)-(f-p)*(g-u))l=!1;else{var b=void 0,_=void 0,M=void 0,w=void 0,S=void 0,E=void 0,T=void 0,C=void 0,L=void 0,A=void 0,L=C=T=x=y=void 0,b=g-d,_=v-f,M=u-g,w=p-v,S=d-u,E=f-p;for(l=0;l<r;l++)if(y=t[s[l]].x,x=t[s[l]].y,!(y===u&&x===p||y===d&&x===f||y===g&&x===v)&&(T=y-u,C=x-p,L=y-d,A=x-f,y-=g,x-=v,L=b*A-_*L,T=S*C-E*T,C=M*x-w*y,L>=-Number.EPSILON&&C>=-Number.EPSILON&&T>=-Number.EPSILON)){l=!1;break t}l=!0}}if(l){for(a.push([t[s[i]],t[s[n]],t[s[o]]]),h.push([s[i],s[n],s[o]]),i=n,o=n+1;o<r;i++,o++)s[i]=s[o];c=2*--r}}return e?h:a},triangulateShape:function(t,e){function r(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,i,n,o){var a=e.x-t.x,s=e.y-t.y,h=n.x-i.x,c=n.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*h-a*c,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>d||d>p)return[];if(0>(h=c*l-h*u)||h>p)return[]}else{if(0<d||d<p)return[];if(0<(h=c*l-h*u)||h<p)return[]}return 0===h?!o||0!==d&&d!==p?[t]:[]:h===p?!o||0!==d&&d!==p?[e]:[]:0===d?[i]:d===p?[n]:(o=h/p,[{x:t.x+o*a,y:t.y+o*s}])}return 0!==d||c*l!=h*u?[]:(s=0===a&&0===s,h=0===h&&0===c,s&&h?t.x!==i.x||t.y!==i.y?[]:[t]:s?r(i,n,t)?[t]:[]:h?r(t,e,i)?[i]:[]:(0!==a?(t.x<e.x?(a=t,h=t.x,s=e,t=e.x):(a=e,h=e.x,s=t,t=t.x),i.x<n.x?(e=i,p=i.x,c=n,i=n.x):(e=n,p=n.x,c=i,i=i.x)):(t.y<e.y?(a=t,h=t.y,s=e,t=e.y):(a=e,h=e.y,s=t,t=t.y),i.y<n.y?(e=i,p=i.y,c=n,i=n.y):(e=n,p=n.y,c=i,i=i.y)),h<=p?t<p?[]:t===p?o?[]:[e]:t<=i?[e,s]:[e,c]:h>i?[]:h===i?o?[]:[a]:t<=i?[a,s]:[a,c]))}function n(t,e,r,i){var n=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=i.x-t.x;return i=i.y-t.y,t=n*r-o*e,n=n*i-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}var o,a,s,h,c,l={};for(s=t.concat(),o=0,a=e.length;o<a;o++)Array.prototype.push.apply(s,e[o]);for(o=0,a=s.length;o<a;o++)c=s[o].x+":"+s[o].y,void 0!==l[c]&&console.warn("THREE.Shape: Duplicate point",c),l[c]=o;o=function(t,e){var r,o,a,s,h,c,l,u,p,d=t.concat(),f=[],m=[],g=0;for(o=e.length;g<o;g++)f.push(g);l=0;for(var v=2*f.length;0<f.length;){if(0>--v){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(a=l;a<d.length;a++){for(s=d[a],o=-1,g=0;g<f.length;g++)if(h=f[g],c=s.x+":"+s.y+":"+h,void 0===m[c]){for(r=e[h],u=0;u<r.length;u++)if(h=r[u],function(t,e){var i=d.length-1,o=t-1;0>o&&(o=i);var a=t+1;return a>i&&(a=0),!!(i=n(d[t],d[o],d[a],r[e]))&&(i=r.length-1,0>(o=e-1)&&(o=i),(a=e+1)>i&&(a=0),!!(i=n(r[e],r[o],r[a],d[t])))}(a,u)&&!function(t,e){var r,n;for(r=0;r<d.length;r++)if(n=r+1,n%=d.length,0<(n=i(t,e,d[r],d[n],!0)).length)return!0;return!1}(s,h)&&!function(t,r){var n,o,a,s;for(n=0;n<f.length;n++)for(o=e[f[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,0<(s=i(t,r,o[a],o[s],!0)).length)return!0;return!1}(s,h)){o=u,f.splice(g,1),l=d.slice(0,a+1),h=d.slice(a),u=r.slice(o),p=r.slice(0,o+1),d=l.concat(u).concat(p).concat(h),l=a;break}if(0<=o)break;m[c]=!0}if(0<=o)break}}return d}(t,e);var u=m.ShapeUtils.triangulate(o,!1);for(o=0,a=u.length;o<a;o++)for(h=u[o],s=0;3>s;s++)c=h[s].x+":"+h[s].y,void 0!==(c=l[c])&&(h[s]=c);return u.concat()},isClockWise:function(t){return 0>m.ShapeUtils.area(t)},b2:function(t,e,r,i){var n=1-t;return n*n*e+2*(1-t)*t*r+t*t*i},b3:function(t,e,r,i,n){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*i+t*t*t*n}},m.Curve=function(){},m.Curve.prototype={constructor:m.Curve,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPoint(e/t));return r},getSpacedPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPointAt(e/t));return r},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),o+=e.distanceTo(n),i.push(o),n=e;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,h=o-1;s<=h;)if(n=Math.floor(s+(h-s)/2),0>(a=i[n]-r))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return n=h,i[n]===r?n/(o-1):(s=i[n],i=(n+(r-s)/(i[n+1]-s))/(o-1))},getTangent:function(t){var e=t-1e-4;return t+=1e-4,0>e&&(e=0),1<t&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)}},m.Curve.create=function(t,e){return t.prototype=Object.create(m.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},m.CurvePath=function(){this.curves=[],this.autoClose=!1},m.CurvePath.prototype=Object.create(m.Curve.prototype),m.CurvePath.prototype.constructor=m.CurvePath,m.CurvePath.prototype.add=function(t){this.curves.push(t)},m.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new m.LineCurve(e,t))},m.CurvePath.prototype.getPoint=function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=e)return t=this.curves[i],e=1-(r[i]-e)/t.getLength(),t.getPointAt(e);i++}return null},m.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},m.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},m.CurvePath.prototype.createPointsGeometry=function(t){return t=this.getPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createSpacedPointsGeometry=function(t){return t=this.getSpacedPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createGeometry=function(t){for(var e=new m.Geometry,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new m.Vector3(n.x,n.y,n.z||0))}return e},m.Font=function(t){this.data=t},m.Font.prototype={constructor:m.Font,generateShapes:function(t,e,r){void 0===e&&(e=100),void 0===r&&(r=4);var i=this.data;t=String(t).split("");var n=e/i.resolution,o=0;e=[];for(var a=0;a<t.length;a++){var s;s=n;var h=o,c=i.glyphs[t[a]]||i.glyphs["?"];if(c){var l=new m.Path,u=[],p=m.ShapeUtils.b2,d=m.ShapeUtils.b3,f=void 0,g=void 0,v=g=f=void 0,y=void 0,x=void 0,b=void 0,_=void 0,M=void 0,y=void 0;if(c.o)for(var w=c._cachedOutline||(c._cachedOutline=c.o.split(" ")),S=0,E=w.length;S<E;)switch(w[S++]){case"m":f=w[S++]*s+h,g=w[S++]*s,l.moveTo(f,g);break;case"l":f=w[S++]*s+h,g=w[S++]*s,l.lineTo(f,g);break;case"q":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,l.quadraticCurveTo(x,b,f,g),y=u[u.length-1])for(var v=y.x,y=y.y,T=1;T<=r;T++){var C=T/r;p(C,v,x,f),p(C,y,b,g)}break;case"b":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,_=w[S++]*s+h,M=w[S++]*s,l.bezierCurveTo(x,b,_,M,f,g),y=u[u.length-1])for(v=y.x,y=y.y,T=1;T<=r;T++)C=T/r,d(C,v,x,_,f),d(C,y,b,M,g)}s={offset:c.ha*s,path:l}}else s=void 0;o+=s.offset,e.push(s.path)}for(r=[],i=0,t=e.length;i<t;i++)Array.prototype.push.apply(r,e[i].toShapes());return r}},m.Path=function(t){m.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},m.Path.prototype=Object.create(m.CurvePath.prototype),m.Path.prototype.constructor=m.Path,m.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},m.Path.prototype.moveTo=function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},m.Path.prototype.lineTo=function(t,e){var r=this.actions[this.actions.length-1].args,r=new m.LineCurve(new m.Vector2(r[r.length-2],r[r.length-1]),new m.Vector2(t,e));this.curves.push(r),this.actions.push({action:"lineTo",args:[t,e]})},m.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=this.actions[this.actions.length-1].args,n=new m.QuadraticBezierCurve(new m.Vector2(n[n.length-2],n[n.length-1]),new m.Vector2(t,e),new m.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[t,e,r,i]})},m.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new m.CubicBezierCurve(new m.Vector2(a[a.length-2],a[a.length-1]),new m.Vector2(t,e),new m.Vector2(r,i),new m.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[t,e,r,i,n,o]})},m.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,r=[new m.Vector2(r[r.length-2],r[r.length-1])];Array.prototype.push.apply(r,t),r=new m.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:e})},m.Path.prototype.arc=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(t+a[a.length-2],e+a[a.length-1],r,i,n,o)},m.Path.prototype.absarc=function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},m.Path.prototype.ellipse=function(t,e,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(t+h[h.length-2],e+h[h.length-1],r,i,n,o,a,s)},m.Path.prototype.absellipse=function(t,e,r,i,n,o,a,s){var h=[t,e,r,i,n,o,a,s||0];t=new m.EllipseCurve(t,e,r,i,n,o,a,s),this.curves.push(t),t=t.getPoint(1),h.push(t.x),h.push(t.y),this.actions.push({action:"ellipse",args:h})},m.Path.prototype.getSpacedPoints=function(t){t||(t=40);for(var e=[],r=0;r<t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},m.Path.prototype.getPoints=function(t){t=t||12;for(var e,r,i,n,o,a,s,h,c,l,u=m.ShapeUtils.b2,p=m.ShapeUtils.b3,d=[],f=0,g=this.actions.length;f<g;f++){var v=(c=this.actions[f]).args;switch(c.action){case"moveTo":case"lineTo":d.push(new m.Vector2(v[0],v[1]));break;case"quadraticCurveTo":for(e=v[2],r=v[3],o=v[0],a=v[1],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=u(l,s,o,e),l=u(l,h,a,r),d.push(new m.Vector2(c,l));break;case"bezierCurveTo":for(e=v[4],r=v[5],o=v[0],a=v[1],i=v[2],n=v[3],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=p(l,s,o,i,e),l=p(l,h,a,n,r),d.push(new m.Vector2(c,l));break;case"splineThru":for(c=this.actions[f-1].args,l=[new m.Vector2(c[c.length-2],c[c.length-1])],c=t*v[0].length,l=l.concat(v[0]),l=new m.SplineCurve(l),v=1;v<=c;v++)d.push(l.getPointAt(v/c));break;case"arc":for(e=v[0],r=v[1],a=v[2],i=v[3],c=v[4],o=!!v[5],s=c-i,h=2*t,v=1;v<=h;v++)l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new m.Vector2(c,l));break;case"ellipse":e=v[0],r=v[1],a=v[2],n=v[3],i=v[4],c=v[5],o=!!v[6];var y=v[7];s=c-i,h=2*t;var x,b;for(0!==y&&(x=Math.cos(y),b=Math.sin(y)),v=1;v<=h;v++){if(l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+n*Math.sin(l),0!==y){var _=c;c=(_-e)*x-(l-r)*b+e,l=(_-e)*b+(l-r)*x+r}d.push(new m.Vector2(c,l))}}}return t=d[d.length-1],Math.abs(t.x-d[0].x)<Number.EPSILON&&Math.abs(t.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},m.Path.prototype.toShapes=function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new m.Shape;o.actions=n.actions,o.curves=n.curves,e.push(o)}return e}var i=m.ShapeUtils.isClockWise,n=function(t){for(var e=[],r=new m.Path,i=0,n=t.length;i<n;i++){var o=t[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(e.push(r),r=new m.Path),r[o].apply(r,a)}return 0!==r.actions.length&&e.push(r),e}(this.actions);if(0===n.length)return[];if(!0===e)return r(n);var o,a,s,h=[];if(1===n.length)return a=n[0],s=new m.Shape,s.actions=a.actions,s.curves=a.curves,h.push(s),h;var c=!i(n[0].getPoints()),c=t?!c:c;s=[];var l,u=[],p=[],d=0;u[d]=void 0,p[d]=[];for(var f=0,g=n.length;f<g;f++)a=n[f],l=a.getPoints(),o=i(l),(o=t?!o:o)?(!c&&u[d]&&d++,u[d]={s:new m.Shape,p:l},u[d].s.actions=a.actions,u[d].s.curves=a.curves,c&&d++,p[d]=[]):p[d].push({h:a,p:l[0]});if(!u[0])return r(n);if(1<u.length){for(f=!1,a=[],i=0,n=u.length;i<n;i++)s[i]=[];for(i=0,n=u.length;i<n;i++)for(o=p[i],c=0;c<o.length;c++){for(d=o[c],l=!0,g=0;g<u.length;g++)(function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=e[o],h=-h,s=e[n],c=-c),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0==(n=c*(t.x-a.x)-h*(t.y-a.y)))return!0;0>n||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return i})(d.p,u[g].p)&&(i!==g&&a.push({froms:i,tos:g,hole:c}),l?(l=!1,s[g].push(d)):f=!0);l&&s[i].push(d)}0<a.length&&(f||(p=s))}for(f=0,i=u.length;f<i;f++)for(s=u[f].s,h.push(s),a=p[f],n=0,o=a.length;n<o;n++)s.holes.push(a[n].h);return h},m.Shape=function(){m.Path.apply(this,arguments),this.holes=[]},m.Shape.prototype=Object.create(m.Path.prototype),m.Shape.prototype.constructor=m.Shape,m.Shape.prototype.extrude=function(t){return new m.ExtrudeGeometry(this,t)},m.Shape.prototype.makeGeometry=function(t){return new m.ShapeGeometry(this,t)},m.Shape.prototype.getPointsHoles=function(t){for(var e=[],r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e},m.Shape.prototype.extractAllPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},m.Shape.prototype.extractPoints=function(t){return this.extractAllPoints(t)},m.LineCurve=function(t,e){this.v1=t,this.v2=e},m.LineCurve.prototype=Object.create(m.Curve.prototype),m.LineCurve.prototype.constructor=m.LineCurve,m.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},m.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},m.LineCurve.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},m.QuadraticBezierCurve=function(t,e,r){this.v0=t,this.v1=e,this.v2=r},m.QuadraticBezierCurve.prototype=Object.create(m.Curve.prototype),m.QuadraticBezierCurve.prototype.constructor=m.QuadraticBezierCurve,m.QuadraticBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b2;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},m.QuadraticBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentQuadraticBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},m.CubicBezierCurve=function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},m.CubicBezierCurve.prototype=Object.create(m.Curve.prototype),m.CubicBezierCurve.prototype.constructor=m.CubicBezierCurve,m.CubicBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b3;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},m.CubicBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentCubicBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},m.SplineCurve=function(t){this.points=void 0==t?[]:t},m.SplineCurve.prototype=Object.create(m.Curve.prototype),m.SplineCurve.prototype.constructor=m.SplineCurve,m.SplineCurve.prototype.getPoint=function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0===o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector2(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t))},m.EllipseCurve=function(t,e,r,i,n,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},m.EllipseCurve.prototype=Object.create(m.Curve.prototype),m.EllipseCurve.prototype.constructor=m.EllipseCurve,m.EllipseCurve.prototype.getPoint=function(t){0>(r=this.aEndAngle-this.aStartAngle)&&(r+=2*Math.PI),r>2*Math.PI&&(r-=2*Math.PI),r=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-r):this.aStartAngle+t*r,t=this.aX+this.xRadius*Math.cos(r);var e=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var r=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=t;t=(n-this.aX)*r-(e-this.aY)*i+this.aX,e=(n-this.aX)*i+(e-this.aY)*r+this.aY}return new m.Vector2(t,e)},m.ArcCurve=function(t,e,r,i,n,o){m.EllipseCurve.call(this,t,e,r,r,i,n,o)},m.ArcCurve.prototype=Object.create(m.EllipseCurve.prototype),m.ArcCurve.prototype.constructor=m.ArcCurve,m.LineCurve3=m.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new m.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),m.QuadraticBezierCurve3=m.Curve.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=m.ShapeUtils.b2;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),m.CubicBezierCurve3=m.Curve.create(function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},function(t){var e=m.ShapeUtils.b3;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),m.SplineCurve3=m.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==t?[]:t},function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0==o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),m.CatmullRomCurve3=function(){function t(){}var e=new m.Vector3,r=new t,i=new t,n=new t;return t.prototype.init=function(t,e,r,i){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-i,this.c3=2*t-2*e+r+i},t.prototype.initNonuniformCatmullRom=function(t,e,r,i,n,o,a){t=((e-t)/n-(r-t)/(n+o)+(r-e)/o)*o,i=((r-e)/o-(i-e)/(o+a)+(i-r)/a)*o,this.init(e,r,t,i)},t.prototype.initCatmullRom=function(t,e,r,i,n){this.init(e,r,n*(r-t),n*(i-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},m.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s=this.points;2>(a=s.length)&&console.log("duh, you need at least 2 points"),t*=a-(this.closed?0:1),t-=o=Math.floor(t),this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===t&&o===a-1&&(o=a-2,t=1);var h,c,l;if(this.closed||0<o?h=s[(o-1)%a]:(e.subVectors(s[0],s[1]).add(s[0]),h=e),c=s[o%a],l=s[(o+1)%a],this.closed||o+2<a?s=s[(o+2)%a]:(e.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(h.distanceToSquared(c),u),o=Math.pow(c.distanceToSquared(l),u),u=Math.pow(l.distanceToSquared(s),u),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>u&&(u=o),r.initNonuniformCatmullRom(h.x,c.x,l.x,s.x,a,o,u),i.initNonuniformCatmullRom(h.y,c.y,l.y,s.y,a,o,u),n.initNonuniformCatmullRom(h.z,c.z,l.z,s.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(h.x,c.x,l.x,s.x,a),i.initCatmullRom(h.y,c.y,l.y,s.y,a),n.initCatmullRom(h.z,c.z,l.z,s.z,a));return new m.Vector3(r.calc(t),i.calc(t),n.calc(t))})}(),m.ClosedSplineCurve3=function(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),m.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},m.ClosedSplineCurve3.prototype=Object.create(m.CatmullRomCurve3.prototype),m.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,h){var c,l=s.widthSegments,u=s.heightSegments,p=n/2,d=o/2,f=s.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?c="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(c="y",u=s.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(c="x",l=s.depthSegments);var g=l+1,v=u+1,y=n/l,x=o/u,b=new m.Vector3;for(b[c]=0<a?1:-1,n=0;n<v;n++)for(o=0;o<g;o++){var _=new m.Vector3;_[t]=(o*y-p)*r,_[e]=(n*x-d)*i,_[c]=a,s.vertices.push(_)}for(n=0;n<u;n++)for(o=0;o<l;o++)d=o+g*n,t=o+g*(n+1),e=o+1+g*(n+1),r=o+1+g*n,i=new m.Vector2(o/l,1-n/u),a=new m.Vector2(o/l,1-(n+1)/u),c=new m.Vector2((o+1)/l,1-(n+1)/u),p=new m.Vector2((o+1)/l,1-n/u),(d=new m.Face3(d+f,t+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([i,a,p]),(d=new m.Face3(t+f,e+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([a.clone(),c,p.clone()])}m.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this;n=e/2,o=r/2,a("z","y",-1,-1,r,e,i=t/2,0),a("z","y",1,-1,r,e,-i,1),a("x","z",1,1,t,r,n,2),a("x","z",1,-1,t,r,-n,3),a("x","y",1,-1,t,e,o,4),a("x","y",-1,-1,t,e,-o,5),this.mergeVertices()},m.BoxGeometry.prototype=Object.create(m.Geometry.prototype),m.BoxGeometry.prototype.constructor=m.BoxGeometry,m.CubeGeometry=m.BoxGeometry,m.CircleGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new m.CircleBufferGeometry(t,e,r,i))},m.CircleGeometry.prototype=Object.create(m.Geometry.prototype),m.CircleGeometry.prototype.constructor=m.CircleGeometry,m.CircleBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=e+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,h=3,c=2;s<=e;s++,h+=3,c+=2){var l=r+s/e*i;o[h]=t*Math.cos(l),o[h+1]=t*Math.sin(l),a[h+2]=1,n[c]=(o[h]/t+1)/2,n[c+1]=(o[h+1]/t+1)/2}for(r=[],h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(new m.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new m.BufferAttribute(o,3)),this.addAttribute("normal",new m.BufferAttribute(a,3)),this.addAttribute("uv",new m.BufferAttribute(n,2)),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.CircleBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.CircleBufferGeometry.prototype.constructor=m.CircleBufferGeometry,m.CylinderGeometry=function(t,e,r,i,n,o,a,s){m.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h,c,l=r/2,u=[],p=[];for(c=0;c<=n;c++){var d=[],f=[],g=(v=c/n)*(e-t)+t;for(h=0;h<=i;h++)y=h/i,(x=new m.Vector3).x=g*Math.sin(y*s+a),x.y=-v*r+l,x.z=g*Math.cos(y*s+a),this.vertices.push(x),d.push(this.vertices.length-1),f.push(new m.Vector2(y,1-v));u.push(d),p.push(f)}for(r=(e-t)/r,h=0;h<i;h++)for(0!==t?(a=this.vertices[u[0][h]].clone(),s=this.vertices[u[0][h+1]].clone()):(a=this.vertices[u[1][h]].clone(),s=this.vertices[u[1][h+1]].clone()),a.setY(Math.sqrt(a.x*a.x+a.z*a.z)*r).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*r).normalize(),c=0;c<n;c++){var d=u[c][h],f=u[c+1][h],v=u[c+1][h+1],g=u[c][h+1],y=a.clone(),x=a.clone(),b=s.clone(),_=s.clone(),M=p[c][h].clone(),w=p[c+1][h].clone(),S=p[c+1][h+1].clone(),E=p[c][h+1].clone();this.faces.push(new m.Face3(d,f,g,[y,x,_])),this.faceVertexUvs[0].push([M,w,E]),this.faces.push(new m.Face3(f,v,g,[x.clone(),b,_.clone()])),this.faceVertexUvs[0].push([w.clone(),S,E.clone()])}if(!1===o&&0<t)for(this.vertices.push(new m.Vector3(0,l,0)),h=0;h<i;h++)d=u[0][h],f=u[0][h+1],v=this.vertices.length-1,y=new m.Vector3(0,1,0),x=new m.Vector3(0,1,0),b=new m.Vector3(0,1,0),M=p[0][h].clone(),w=p[0][h+1].clone(),S=new m.Vector2(w.x,0),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,1)),this.faceVertexUvs[0].push([M,w,S]);if(!1===o&&0<e)for(this.vertices.push(new m.Vector3(0,-l,0)),h=0;h<i;h++)d=u[n][h+1],f=u[n][h],v=this.vertices.length-1,y=new m.Vector3(0,-1,0),x=new m.Vector3(0,-1,0),b=new m.Vector3(0,-1,0),M=p[n][h+1].clone(),w=p[n][h].clone(),S=new m.Vector2(w.x,1),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,2)),this.faceVertexUvs[0].push([M,w,S]);this.computeFaceNormals()},m.CylinderGeometry.prototype=Object.create(m.Geometry.prototype),m.CylinderGeometry.prototype.constructor=m.CylinderGeometry,m.EdgesGeometry=function(t,e){m.BufferGeometry.call(this);var r,i=Math.cos(m.Math.degToRad(void 0!==e?e:1)),n=[0,0],o={},a=["a","b","c"];t instanceof m.BufferGeometry?(r=new m.Geometry).fromBufferGeometry(t):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var s=r.vertices,h=0,c=(r=r.faces).length;h<c;h++)for(var l=r[h],u=0;3>u;u++){n[0]=l[a[u]],n[1]=l[a[(u+1)%3]],n.sort(function(t,e){return t-e});var p=n.toString();void 0===o[p]?o[p]={vert1:n[0],vert2:n[1],face1:h,face2:void 0}:o[p].face2=h}n=[];for(p in o)(void 0===(a=o[p]).face2||r[a.face1].normal.dot(r[a.face2].normal)<=i)&&(h=s[a.vert1],n.push(h.x),n.push(h.y),n.push(h.z),h=s[a.vert2],n.push(h.x),n.push(h.y),n.push(h.z));this.addAttribute("position",new m.BufferAttribute(new Float32Array(n),3))},m.EdgesGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.EdgesGeometry.prototype.constructor=m.EdgesGeometry,m.ExtrudeGeometry=function(t,e){void 0!==t&&(m.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())},m.ExtrudeGeometry.prototype=Object.create(m.Geometry.prototype),m.ExtrudeGeometry.prototype.constructor=m.ExtrudeGeometry,m.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var r=t.length,i=0;i<r;i++)this.addShape(t[i],e)},m.ExtrudeGeometry.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,i=t.x-e.x,n=t.y-e.y,o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var h=Math.sqrt(s),c=Math.sqrt(o*o+a*a),s=e.x-n/h;if(e=e.y+i/h,o=((r.x-a/c-s)*a-(r.y+o/c-e)*o)/(i*a-n*o),r=s+i*o-t.x,t=e+n*o-t.y,2>=(i=r*r+t*t))return new m.Vector2(r,t);i=Math.sqrt(i/2)}else t=!1,i>Number.EPSILON?o>Number.EPSILON&&(t=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(n)===Math.sign(a)&&(t=!0),t?(r=-n,t=i,i=Math.sqrt(s)):(r=i,t=n,i=Math.sqrt(s/2));return new m.Vector2(r/i,t/i)}function n(t,e){var r,i;for(N=t.length;0<=--N;){r=N,0>(i=N-1)&&(i=t.length-1);for(var n=0,o=x+2*g,n=0;n<o;n++){var a=(a=e+r+(s=B*n))+C,s=(s=e+i+s)+C,h=(h=e+i+(c=B*(n+1)))+C,c=(c=e+r+c)+C;T.faces.push(new m.Face3(a,s,c,null,null,1)),T.faces.push(new m.Face3(s,h,c,null,null,1)),a=M.generateSideWallUV(T,a,s,h,c),T.faceVertexUvs[0].push([a[0],a[1],a[3]]),T.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){T.vertices.push(new m.Vector3(t,e,r))}function a(t,e,r){t+=C,e+=C,r+=C,T.faces.push(new m.Face3(t,e,r,null,null,0)),t=M.generateTopUV(T,t,e,r),T.faceVertexUvs[0].push(t)}var s,h,c,l,u,p=void 0!==e.amount?e.amount:100,d=void 0!==e.bevelThickness?e.bevelThickness:6,f=void 0!==e.bevelSize?e.bevelSize:d-2,g=void 0!==e.bevelSegments?e.bevelSegments:3,v=void 0===e.bevelEnabled||e.bevelEnabled,y=void 0!==e.curveSegments?e.curveSegments:12,x=void 0!==e.steps?e.steps:1,b=e.extrudePath,_=!1,M=void 0!==e.UVGenerator?e.UVGenerator:m.ExtrudeGeometry.WorldUVGenerator;b&&(s=b.getSpacedPoints(x),_=!0,v=!1,h=void 0!==e.frames?e.frames:new m.TubeGeometry.FrenetFrames(b,x,!1),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3),v||(f=d=g=0);var w,S,E,T=this,C=this.vertices.length,y=(b=t.extractPoints(y)).shape,L=b.holes;if(b=!m.ShapeUtils.isClockWise(y)){for(y=y.reverse(),S=0,E=L.length;S<E;S++)w=L[S],m.ShapeUtils.isClockWise(w)&&(L[S]=w.reverse());b=!1}var A=m.ShapeUtils.triangulateShape(y,L),P=y;for(S=0,E=L.length;S<E;S++)w=L[S],y=y.concat(w);var R,U,k,D,I,F,B=y.length,V=A.length,b=[],N=0;for(R=(k=P.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),b[N]=i(P[N],P[R],P[U]);var O,G=[],z=b.concat();for(S=0,E=L.length;S<E;S++){for(w=L[S],O=[],N=0,R=(k=w.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),O[N]=i(w[N],w[R],w[U]);G.push(O),z=z.concat(O)}for(R=0;R<g;R++){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,-D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),o(I.x,I.y,-D)}for(U=f,N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[0]).multiplyScalar(I.x),c.copy(h.binormals[0]).multiplyScalar(I.y),u.copy(s[0]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,0);for(k=1;k<=x;k++)for(N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[k]).multiplyScalar(I.x),c.copy(h.binormals[k]).multiplyScalar(I.y),u.copy(s[k]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,p/x*k);for(R=g-1;0<=R;R--){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,p+D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),_?o(I.x,I.y+s[x-1].y,s[x-1].x+D):o(I.x,I.y,p+D)}!function(){if(v){var t;for(t=0*B,N=0;N<V;N++)F=A[N],a(F[2]+t,F[1]+t,F[0]+t);for(t=x+2*g,t*=B,N=0;N<V;N++)F=A[N],a(F[0]+t,F[1]+t,F[2]+t)}else{for(N=0;N<V;N++)F=A[N],a(F[2],F[1],F[0]);for(N=0;N<V;N++)F=A[N],a(F[0]+B*x,F[1]+B*x,F[2]+B*x)}}(),function(){var t=0;for(n(P,t),t+=P.length,S=0,E=L.length;S<E;S++)w=L[S],n(w,t),t+=w.length}()},m.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,r,i){return t=t.vertices,e=t[e],r=t[r],i=t[i],[new m.Vector2(e.x,e.y),new m.Vector2(r.x,r.y),new m.Vector2(i.x,i.y)]},generateSideWallUV:function(t,e,r,i,n){return t=t.vertices,e=t[e],r=t[r],i=t[i],n=t[n],.01>Math.abs(e.y-r.y)?[new m.Vector2(e.x,1-e.z),new m.Vector2(r.x,1-r.z),new m.Vector2(i.x,1-i.z),new m.Vector2(n.x,1-n.z)]:[new m.Vector2(e.y,1-e.z),new m.Vector2(r.y,1-r.z),new m.Vector2(i.y,1-i.z),new m.Vector2(n.y,1-n.z)]}},m.ShapeGeometry=function(t,e){m.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},m.ShapeGeometry.prototype=Object.create(m.Geometry.prototype),m.ShapeGeometry.prototype.constructor=m.ShapeGeometry,m.ShapeGeometry.prototype.addShapeList=function(t,e){for(var r=0,i=t.length;r<i;r++)this.addShape(t[r],e);return this},m.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var r,i,n,o=e.material,a=void 0===e.UVGenerator?m.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,s=this.vertices.length,h=(r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12)).shape,c=r.holes;if(!m.ShapeUtils.isClockWise(h))for(h=h.reverse(),r=0,i=c.length;r<i;r++)n=c[r],m.ShapeUtils.isClockWise(n)&&(c[r]=n.reverse());var l=m.ShapeUtils.triangulateShape(h,c);for(r=0,i=c.length;r<i;r++)n=c[r],h=h.concat(n);for(c=h.length,i=l.length,r=0;r<c;r++)n=h[r],this.vertices.push(new m.Vector3(n.x,n.y,0));for(r=0;r<i;r++)c=l[r],h=c[0]+s,n=c[1]+s,c=c[2]+s,this.faces.push(new m.Face3(h,n,c,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,h,n,c))},m.LatheGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=e||12,r=r||0,i=i||2*Math.PI;for(var n=1/(t.length-1),o=1/e,a=0,s=e;a<=s;a++)for(var h=r+a*o*i,c=Math.sin(h),l=Math.cos(h),h=0,u=t.length;h<u;h++){var p=t[h];(d=new m.Vector3).x=p.x*c,d.y=p.y,d.z=p.x*l,this.vertices.push(d)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,u=t.length-1;h<u;h++){i=(e=h+r*a)+r;var c=e+1+r,l=e+1,d=h*n,f=(p=a*o)+o,g=d+n;this.faces.push(new m.Face3(e,i,l)),this.faceVertexUvs[0].push([new m.Vector2(p,d),new m.Vector2(f,d),new m.Vector2(p,g)]),this.faces.push(new m.Face3(i,c,l)),this.faceVertexUvs[0].push([new m.Vector2(f,d),new m.Vector2(f,g),new m.Vector2(p,g)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},m.LatheGeometry.prototype=Object.create(m.Geometry.prototype),m.LatheGeometry.prototype.constructor=m.LatheGeometry,m.PlaneGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new m.PlaneBufferGeometry(t,e,r,i))},m.PlaneGeometry.prototype=Object.create(m.Geometry.prototype),m.PlaneGeometry.prototype.constructor=m.PlaneGeometry,m.PlaneBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n=t/2,o=e/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=t/r,c=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var l=new Float32Array(a*s*2),u=0,p=0,d=0;d<s;d++)for(var f=d*c-o,g=0;g<a;g++)e[u]=g*h-n,e[u+1]=-f,t[u+2]=1,l[p]=g/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<e.length/3?Uint32Array:Uint16Array)(r*i*6),d=0;d<i;d++)for(g=0;g<r;g++)o=g+a*(d+1),s=g+1+a*(d+1),h=g+1+a*d,n[u]=g+a*d,n[u+1]=o,n[u+2]=h,n[u+3]=o,n[u+4]=s,n[u+5]=h,u+=6;this.setIndex(new m.BufferAttribute(n,1)),this.addAttribute("position",new m.BufferAttribute(e,3)),this.addAttribute("normal",new m.BufferAttribute(t,3)),this.addAttribute("uv",new m.BufferAttribute(l,2))},m.PlaneBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.PlaneBufferGeometry.prototype.constructor=m.PlaneBufferGeometry,m.RingGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||0,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s=[],h=t,c=(e-t)/(i=void 0!==i?Math.max(1,i):8);for(t=0;t<i+1;t++){for(a=0;a<r+1;a++){var l=new m.Vector3,u=n+a/r*o;l.x=h*Math.cos(u),l.y=h*Math.sin(u),this.vertices.push(l),s.push(new m.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}h+=c}for(e=new m.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=u=a+n,c=u+r+1,l=u+r+2,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]),o=u,c=u+r+2,l=u+1,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]);this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,h)},m.RingGeometry.prototype=Object.create(m.Geometry.prototype),m.RingGeometry.prototype.constructor=m.RingGeometry,m.SphereGeometry=function(t,e,r,i,n,o,a){m.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new m.SphereBufferGeometry(t,e,r,i,n,o,a))},m.SphereGeometry.prototype=Object.create(m.Geometry.prototype),m.SphereGeometry.prototype.constructor=m.SphereGeometry,m.SphereBufferGeometry=function(t,e,r,i,n,o,a){m.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;for(var s=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=(e+1)*(r+1),c=new m.BufferAttribute(new Float32Array(3*h),3),l=new m.BufferAttribute(new Float32Array(3*h),3),h=new m.BufferAttribute(new Float32Array(2*h),2),u=0,p=[],d=new m.Vector3,f=0;f<=r;f++){for(var g=[],v=f/r,y=0;y<=e;y++){var x=y/e,b=-t*Math.cos(i+x*n)*Math.sin(o+v*a),_=t*Math.cos(o+v*a),M=t*Math.sin(i+x*n)*Math.sin(o+v*a);d.set(b,_,M).normalize(),c.setXYZ(u,b,_,M),l.setXYZ(u,d.x,d.y,d.z),h.setXY(u,x,1-v),g.push(u),u++}p.push(g)}for(i=[],f=0;f<r;f++)for(y=0;y<e;y++)n=p[f][y+1],a=p[f][y],u=p[f+1][y],d=p[f+1][y+1],(0!==f||0<o)&&i.push(n,a,d),(f!==r-1||s<Math.PI)&&i.push(a,u,d);this.setIndex(new(65535<c.count?m.Uint32Attribute:m.Uint16Attribute)(i,1)),this.addAttribute("position",c),this.addAttribute("normal",l),this.addAttribute("uv",h),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.SphereBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.SphereBufferGeometry.prototype.constructor=m.SphereBufferGeometry,m.TextGeometry=function(t,e){var r=(e=e||{}).font;if(0==r instanceof m.Font)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new m.Geometry;r=r.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),m.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},m.TextGeometry.prototype=Object.create(m.ExtrudeGeometry.prototype),m.TextGeometry.prototype.constructor=m.TextGeometry,m.TorusGeometry=function(t,e,r,i,n){m.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new m.Vector3,a=[],s=[],h=0;h<=r;h++)for(var c=0;c<=i;c++){var l=c/i*n,u=h/r*Math.PI*2;o.x=t*Math.cos(l),o.y=t*Math.sin(l);var p=new m.Vector3;p.x=(t+e*Math.cos(u))*Math.cos(l),p.y=(t+e*Math.cos(u))*Math.sin(l),p.z=e*Math.sin(u),this.vertices.push(p),a.push(new m.Vector2(c/i,h/r)),s.push(p.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(c=1;c<=i;c++)t=(i+1)*h+c-1,e=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,l=new m.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),l=new m.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[e].clone(),a[n].clone(),a[o].clone()]);this.computeFaceNormals()},m.TorusGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusGeometry.prototype.constructor=m.TorusGeometry,m.TorusKnotGeometry=function(t,e,r,i,n,o,a){function s(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t);return t*=e/r,e=Math.cos(t),o*=i*(2+e)*.5,a=i*(2+e)*a*.5,i=n*i*Math.sin(t)*.5,new m.Vector3(o,a,i)}m.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},t=t||100,e=e||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=Array(r),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=0;p<r;++p){h[p]=Array(i);var d=s(f=p/r*2*n*Math.PI,o,n,t,a),f=s(f+.01,o,n,t,a);for(c.subVectors(f,d),l.addVectors(f,d),u.crossVectors(c,l),l.crossVectors(u,c),u.normalize(),l.normalize(),f=0;f<i;++f){var g=f/i*2*Math.PI,v=-e*Math.cos(g),g=e*Math.sin(g),y=new m.Vector3;y.x=d.x+v*l.x+g*u.x,y.y=d.y+v*l.y+g*u.y,y.z=d.z+v*l.z+g*u.z,h[p][f]=this.vertices.push(y)-1}}for(p=0;p<r;++p)for(f=0;f<i;++f)n=(p+1)%r,o=(f+1)%i,t=h[p][f],e=h[n][f],n=h[n][o],o=h[p][o],a=new m.Vector2(p/r,f/i),c=new m.Vector2((p+1)/r,f/i),l=new m.Vector2((p+1)/r,(f+1)/i),u=new m.Vector2(p/r,(f+1)/i),this.faces.push(new m.Face3(t,e,o)),this.faceVertexUvs[0].push([a,c,u]),this.faces.push(new m.Face3(e,n,o)),this.faceVertexUvs[0].push([c.clone(),l,u.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TorusKnotGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusKnotGeometry.prototype.constructor=m.TorusKnotGeometry,m.TubeGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:r,radialSegments:i,closed:n,taper:o},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||m.TubeGeometry.NoTaper;var a,s,h,c,l,u,p,d,f,g,v=[],y=e+1,x=new m.Vector3;for(f=(d=new m.TubeGeometry.FrenetFrames(t,e,n)).normals,g=d.binormals,this.tangents=d.tangents,this.normals=f,this.binormals=g,d=0;d<y;d++)for(v[d]=[],h=d/(y-1),p=t.getPointAt(h),a=f[d],s=g[d],l=r*o(h),h=0;h<i;h++)c=h/i*2*Math.PI,u=-l*Math.cos(c),c=l*Math.sin(c),x.copy(p),x.x+=u*a.x+c*s.x,x.y+=u*a.y+c*s.y,x.z+=u*a.z+c*s.z,v[d][h]=this.vertices.push(new m.Vector3(x.x,x.y,x.z))-1;for(d=0;d<e;d++)for(h=0;h<i;h++)o=n?(d+1)%e:d+1,y=(h+1)%i,t=v[d][h],r=v[o][h],o=v[o][y],y=v[d][y],x=new m.Vector2(d/e,h/i),f=new m.Vector2((d+1)/e,h/i),g=new m.Vector2((d+1)/e,(h+1)/i),a=new m.Vector2(d/e,(h+1)/i),this.faces.push(new m.Face3(t,r,y)),this.faceVertexUvs[0].push([x,f,a]),this.faces.push(new m.Face3(r,o,y)),this.faceVertexUvs[0].push([f.clone(),g,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TubeGeometry.prototype=Object.create(m.Geometry.prototype),m.TubeGeometry.prototype.constructor=m.TubeGeometry,m.TubeGeometry.NoTaper=function(t){return 1},m.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},m.TubeGeometry.FrenetFrames=function(t,e,r){var i=new m.Vector3,n=[],o=[],a=[],s=new m.Vector3,h=new m.Matrix4;e+=1;var c,l,u;for(this.tangents=n,this.normals=o,this.binormals=a,c=0;c<e;c++)l=c/(e-1),n[c]=t.getTangentAt(l),n[c].normalize();for(o[0]=new m.Vector3,a[0]=new m.Vector3,t=Number.MAX_VALUE,c=Math.abs(n[0].x),l=Math.abs(n[0].y),u=Math.abs(n[0].z),c<=t&&(t=c,i.set(1,0,0)),l<=t&&(t=l,i.set(0,1,0)),u<=t&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),o[0].crossVectors(n[0],s),a[0].crossVectors(n[0],o[0]),c=1;c<e;c++)o[c]=o[c-1].clone(),a[c]=a[c-1].clone(),s.crossVectors(n[c-1],n[c]),s.length()>Number.EPSILON&&(s.normalize(),i=Math.acos(m.Math.clamp(n[c-1].dot(n[c]),-1,1)),o[c].applyMatrix4(h.makeRotationAxis(s,i))),a[c].crossVectors(n[c],o[c]);if(r)for(i=Math.acos(m.Math.clamp(o[0].dot(o[e-1]),-1,1)),i/=e-1,0<n[0].dot(s.crossVectors(o[0],o[e-1]))&&(i=-i),c=1;c<e;c++)o[c].applyMatrix4(h.makeRotationAxis(n[c],i*c)),a[c].crossVectors(n[c],o[c])},m.PolyhedronGeometry=function(t,e,r,i){function n(t){var e=t.normalize().clone();e.index=s.vertices.push(e)-1;var r=Math.atan2(t.z,-t.x)/2/Math.PI+.5;return t=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5,e.uv=new m.Vector2(r,1-t),e}function o(t,e,r,i){i=new m.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()],void 0,i),s.faces.push(i),g.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(g.z,-g.x),s.faceVertexUvs[0].push([a(t.uv,t,i),a(e.uv,e,i),a(r.uv,r,i)])}function a(t,e,r){return 0>r&&1===t.x&&(t=new m.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new m.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}m.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1,i=i||0;for(var s=this,h=0,c=t.length;h<c;h+=3)n(new m.Vector3(t[h],t[h+1],t[h+2]));t=this.vertices;for(var l=[],u=h=0,c=e.length;h<c;h+=3,u++){var p=t[e[h]],d=t[e[h+1]],f=t[e[h+2]];l[u]=new m.Face3(p.index,d.index,f.index,[p.clone(),d.clone(),f.clone()],void 0,u)}for(var g=new m.Vector3,h=0,c=l.length;h<c;h++)!function(t,e){for(var r=Math.pow(2,e),i=n(s.vertices[t.a]),a=n(s.vertices[t.b]),h=n(s.vertices[t.c]),c=[],l=t.materialIndex,u=0;u<=r;u++){c[u]=[];for(var p=n(i.clone().lerp(h,u/r)),d=n(a.clone().lerp(h,u/r)),f=r-u,m=0;m<=f;m++)c[u][m]=0===m&&u===r?p:n(p.clone().lerp(d,m/f))}for(u=0;u<r;u++)for(m=0;m<2*(r-u)-1;m++)i=Math.floor(m/2),0==m%2?o(c[u][i+1],c[u+1][i],c[u][i],l):o(c[u][i+1],c[u+1][i+1],c[u+1][i],l)}(l[h],i);for(h=0,c=this.faceVertexUvs[0].length;h<c;h++)e=this.faceVertexUvs[0][h],i=e[0].x,t=e[1].x,l=e[2].x,u=Math.max(i,t,l),p=Math.min(i,t,l),.9<u&&.1>p&&(.2>i&&(e[0].x+=1),.2>t&&(e[1].x+=1),.2>l&&(e[2].x+=1));for(h=0,c=this.vertices.length;h<c;h++)this.vertices[h].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,r)},m.PolyhedronGeometry.prototype=Object.create(m.Geometry.prototype),m.PolyhedronGeometry.prototype.constructor=m.PolyhedronGeometry,m.DodecahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2,i=1/r;m.PolyhedronGeometry.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,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},m.DodecahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.DodecahedronGeometry.prototype.constructor=m.DodecahedronGeometry,m.IcosahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2;m.PolyhedronGeometry.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},m.IcosahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype);m.IcosahedronGeometry.prototype.constructor=m.IcosahedronGeometry,m.OctahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},m.OctahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.OctahedronGeometry.prototype.constructor=m.OctahedronGeometry,m.TetrahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},m.TetrahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.TetrahedronGeometry.prototype.constructor=m.TetrahedronGeometry,m.ParametricGeometry=function(t,e,r){m.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o,a,s=this.vertices,h=this.faces,c=this.faceVertexUvs[0],l=e+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=e;n++)o=n/e,o=t(o,a),s.push(o);var u,p,d,f;for(i=0;i<r;i++)for(n=0;n<e;n++)t=i*l+n,s=i*l+n+1,a=(i+1)*l+n+1,o=(i+1)*l+n,u=new m.Vector2(n/e,i/r),p=new m.Vector2((n+1)/e,i/r),d=new m.Vector2((n+1)/e,(i+1)/r),f=new m.Vector2(n/e,(i+1)/r),h.push(new m.Face3(t,s,o)),c.push([u,p,f]),h.push(new m.Face3(s,a,o)),c.push([p.clone(),d,f.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.ParametricGeometry.prototype=Object.create(m.Geometry.prototype),m.ParametricGeometry.prototype.constructor=m.ParametricGeometry,m.WireframeGeometry=function(t){function e(t,e){return t-e}m.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(t instanceof m.Geometry){var o=t.vertices,a=t.faces,s=0,h=new Uint32Array(6*a.length);t=0;for(var c=a.length;t<c;t++)for(var l=a[t],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(e);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)i=o[h[2*t+u]],s=6*t+3*u,r[s+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new m.BufferAttribute(r,3))}else if(t instanceof m.BufferGeometry){if(null!==t.index){for(c=t.index.array,o=t.attributes.position,s=0,0===(n=t.groups).length&&t.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,l=n.length;a<l;++a){u=(t=n[a]).start,p=t.count,t=u;for(var d=u+p;t<d;t+=3)for(u=0;3>u;u++)r[0]=c[t+u],r[1]=c[t+(u+1)%3],r.sort(e),p=r.toString(),void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)s=6*t+3*u,i=h[2*t+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(o=t.attributes.position.array,s=o.length/3,h=s/3,r=new Float32Array(6*s),t=0,c=h;t<c;t++)for(u=0;3>u;u++)s=18*t+6*u,h=9*t+3*u,r[s+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*t+(u+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new m.BufferAttribute(r,3))}},m.WireframeGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.WireframeGeometry.prototype.constructor=m.WireframeGeometry,m.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(t=new m.BufferGeometry).addAttribute("position",new m.BufferAttribute(e,3)),t.addAttribute("color",new m.BufferAttribute(r,3)),e=new m.LineBasicMaterial({vertexColors:m.VertexColors}),m.LineSegments.call(this,t,e)},m.AxisHelper.prototype=Object.create(m.LineSegments.prototype),m.AxisHelper.prototype.constructor=m.AxisHelper,m.ArrowHelper=function(){var t=new m.Geometry;t.vertices.push(new m.Vector3(0,0,0),new m.Vector3(0,1,0));var e=new m.CylinderGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(r,i,n,o,a,s){m.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),this.line=new m.Line(t,new m.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m.Mesh(e,new m.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),m.ArrowHelper.prototype=Object.create(m.Object3D.prototype),m.ArrowHelper.prototype.constructor=m.ArrowHelper,m.ArrowHelper.prototype.setDirection=function(){var t,e=new m.Vector3;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),m.ArrowHelper.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},m.ArrowHelper.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},m.BoxHelper=function(t){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new m.BufferGeometry;i.setIndex(new m.BufferAttribute(e,1)),i.addAttribute("position",new m.BufferAttribute(r,3)),m.LineSegments.call(this,i,new m.LineBasicMaterial({color:16776960})),void 0!==t&&this.update(t)},m.BoxHelper.prototype=Object.create(m.LineSegments.prototype),m.BoxHelper.prototype.constructor=m.BoxHelper,m.BoxHelper.prototype.update=function(){var t=new m.Box3;return function(e){if(t.setFromObject(e),!t.isEmpty()){e=t.min;var r=t.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=e.x,n[4]=r.y,n[5]=r.z,n[6]=e.x,n[7]=e.y,n[8]=r.z,n[9]=r.x,n[10]=e.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=e.z,n[15]=e.x,n[16]=r.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=r.x,n[22]=e.y,n[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),m.BoundingBoxHelper=function(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new m.Box3,m.Mesh.call(this,new m.BoxGeometry(1,1,1),new m.MeshBasicMaterial({color:r,wireframe:!0}))},m.BoundingBoxHelper.prototype=Object.create(m.Mesh.prototype),m.BoundingBoxHelper.prototype.constructor=m.BoundingBoxHelper,m.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},m.CameraHelper=function(t){function e(t,e,i){r(t,i),r(e,i)}function r(t,e){i.vertices.push(new m.Vector3),i.colors.push(new m.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(i.vertices.length-1)}var i=new m.Geometry,n=new m.LineBasicMaterial({color:16777215,vertexColors:m.FaceColors}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),m.LineSegments.call(this,i,n),this.camera=t,this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},m.CameraHelper.prototype=Object.create(m.LineSegments.prototype),m.CameraHelper.prototype.constructor=m.CameraHelper,m.CameraHelper.prototype.update=function(){function t(t,o,a,s){if(i.set(o,a,s).unproject(n),void 0!==(t=r[t]))for(o=0,a=t.length;o<a;o++)e.vertices[t[o]].copy(i)}var e,r,i=new m.Vector3,n=new m.Camera;return function(){e=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.verticesNeedUpdate=!0}}(),m.DirectionalLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var r=new m.Geometry;r.vertices.push(new m.Vector3(-e,e,0),new m.Vector3(e,e,0),new m.Vector3(e,-e,0),new m.Vector3(-e,-e,0),new m.Vector3(-e,e,0));var i=new m.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new m.Line(r,i),this.add(this.lightPlane),(r=new m.Geometry).vertices.push(new m.Vector3,new m.Vector3),(i=new m.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new m.Line(r,i),this.add(this.targetLine),this.update()},m.DirectionalLightHelper.prototype=Object.create(m.Object3D.prototype),m.DirectionalLightHelper.prototype.constructor=m.DirectionalLightHelper,m.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},m.DirectionalLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),m.EdgesHelper=function(t,e,r){e=void 0!==e?e:16777215,m.LineSegments.call(this,new m.EdgesGeometry(t.geometry,r),new m.LineBasicMaterial({color:e})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.EdgesHelper.prototype=Object.create(m.LineSegments.prototype),m.EdgesHelper.prototype.constructor=m.EdgesHelper,m.FaceNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.FaceNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.FaceNormalsHelper.prototype.constructor=m.FaceNormalsHelper,m.FaceNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=0,h=0,c=(o=o.faces).length;h<c;h++){var l=o[h],u=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(u).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),n.setXYZ(s,t.x,t.y,t.z),s+=1,n.setXYZ(s,e.x,e.y,e.z),s+=1}return n.needsUpdate=!0,this}}(),m.GridHelper=function(t,e){var r=new m.Geometry,i=new m.LineBasicMaterial({vertexColors:m.VertexColors});this.color1=new m.Color(4473924),this.color2=new m.Color(8947848);for(var n=-t;n<=t;n+=e){r.vertices.push(new m.Vector3(-t,0,n),new m.Vector3(t,0,n),new m.Vector3(n,0,-t),new m.Vector3(n,0,t));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}m.LineSegments.call(this,r,i)},m.GridHelper.prototype=Object.create(m.LineSegments.prototype),m.GridHelper.prototype.constructor=m.GridHelper,m.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},m.HemisphereLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new m.Color,new m.Color];var r=new m.SphereGeometry(e,4,2);r.rotateX(-Math.PI/2);for(var i=0;8>i;i++)r.faces[i].color=this.colors[4>i?0:1];i=new m.MeshBasicMaterial({vertexColors:m.FaceColors,wireframe:!0}),this.lightSphere=new m.Mesh(r,i),this.add(this.lightSphere),this.update()},m.HemisphereLightHelper.prototype=Object.create(m.Object3D.prototype),m.HemisphereLightHelper.prototype.constructor=m.HemisphereLightHelper,m.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},m.HemisphereLightHelper.prototype.update=function(){var t=new m.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),m.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var r=new m.SphereGeometry(e,4,2),i=new m.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),m.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},m.PointLightHelper.prototype=Object.create(m.Mesh.prototype),m.PointLightHelper.prototype.constructor=m.PointLightHelper,m.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},m.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},m.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new m.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof m.Bone&&(e.vertices.push(new m.Vector3),e.vertices.push(new m.Vector3),e.colors.push(new m.Color(0,0,1)),e.colors.push(new m.Color(0,1,0)));e.dynamic=!0,r=new m.LineBasicMaterial({vertexColors:m.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),m.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},m.SkeletonHelper.prototype=Object.create(m.LineSegments.prototype),m.SkeletonHelper.prototype.constructor=m.SkeletonHelper,m.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof m.Bone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},m.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new m.Matrix4).getInverse(this.root.matrixWorld),r=new m.Matrix4,i=0,n=0;n<this.bones.length;n++){var o=this.bones[n];o.parent instanceof m.Bone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},m.SpotLightHelper=function(t){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,(t=new m.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),t.rotateX(-Math.PI/2);var e=new m.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new m.Mesh(t,e),this.add(this.cone),this.update()},m.SpotLightHelper.prototype=Object.create(m.Object3D.prototype),m.SpotLightHelper.prototype.constructor=m.SpotLightHelper,m.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},m.SpotLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),m.VertexNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=3*r.faces.length:r instanceof m.BufferGeometry&&(e=r.attributes.normal.count),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.VertexNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.VertexNormalsHelper.prototype.constructor=m.VertexNormalsHelper,m.VertexNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof m.Geometry)for(var s=a.vertices,h=a.faces,c=a=0,l=h.length;c<l;c++)for(var u=h[c],p=0,d=u.vertexNormals.length;p<d;p++){var f=u.vertexNormals[p];t.copy(s[u[i[p]]]).applyMatrix4(n),e.copy(f).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a instanceof m.BufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;p<d;p++)t.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(n),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;return o.needsUpdate=!0,this}}(),m.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215;m.LineSegments.call(this,new m.WireframeGeometry(t.geometry),new m.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.WireframeHelper.prototype=Object.create(m.LineSegments.prototype),m.WireframeHelper.prototype.constructor=m.WireframeHelper,m.ImmediateRenderObject=function(t){m.Object3D.call(this),this.material=t,this.render=function(t){}},m.ImmediateRenderObject.prototype=Object.create(m.Object3D.prototype),m.ImmediateRenderObject.prototype.constructor=m.ImmediateRenderObject,m.MorphBlendMesh=function(t,e){m.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,r/1),this.setAnimationWeight("__default",1)},m.MorphBlendMesh.prototype=Object.create(m.Mesh.prototype),m.MorphBlendMesh.prototype.constructor=m.MorphBlendMesh,m.MorphBlendMesh.prototype.createAnimation=function(t,e,r,i){e={start:e,end:r,length:r-e+1,fps:i,duration:(r-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},m.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s=n.morphTargets[o].name.match(r);if(s&&1<s.length){var h=s[1];i[h]||(i[h]={start:1/0,end:-1/0}),o<(s=i[h]).start&&(s.start=o),o>s.end&&(s.end=o),e||(e=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.end,t);this.firstAnimation=e},m.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},m.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},m.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},m.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},m.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},m.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},m.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},m.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},m.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},m.MorphBlendMesh.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},m.MorphBlendMesh.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||0>i.time)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),0>i.time&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,0>i.time&&(i.time+=i.duration));var o=i.start+m.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o),n=i.time%n/n,i.directionBackwards&&(n=1-n),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a):this.morphTargetInfluences[i.currentFrame]=a}}};var g=function(){function t(){}return t.prototype.webgl=function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}},t}();d.prototype={VERSION:"2.2.0",defaults:{imageCloud:"",cloudSpeed:1,skyColor:"#ffffff",skyColorPower:50,cameraControl:!1,cameraXSpeed:.01,cameraYSpeed:.02,cloudData:[]},cameraNearClipPlane:1,cameraFarClipPlane:1e3,vFOV:60,init:function(t,e){this.container=t,this.config=e,this.create()},create:function(){if(!this.util().webgl())throw Error("Your browser does not support WebGL.");this.resetListeners(),this.resetScene(),this.load()},load:function(){var e={};e.cloud=this.config.imageCloud;var r=0,i=0;for(var n in e)e.hasOwnProperty(n)&&r++;for(var n in e)if(e.hasOwnProperty(n)){var o=new XMLHttpRequest;o.open("GET",e[n],!0),o.crossOrigin="Anonymous",o.responseType="arraybuffer",o.customKey=n,o.onload=t.proxy(function(n){var o=n.currentTarget;if(o.status>=400)return o.onerror(n);var a=new Blob([o.response]),s=new Image;s.src=window.URL.createObjectURL(a),s.onload=t.proxy(function(t){e[t.customKey]=s,++i==r&&(this.applyListeners(),this.buildScene(e),this.renderScene())},this,o)},this),o.onerror=t.proxy(function(t){var e=t.currentTarget;throw Error("Cannot load resource "+e.responseURL+". Status code ["+e.status+"]")},this),o.send()}},buildScene:function(t){var e=this.container.width(),r=this.container.height();this.aspect=e/r,this.scene=new m.Scene,this.camera=new m.PerspectiveCamera(this.vFOV,this.aspect,this.cameraNearClipPlane,this.cameraFarClipPlane),this.camera.position.z=this.cameraFarClipPlane,this.scene.add(this.camera);var i=this.createTexture(t,"cloud");this.buildClouds(i),this.renderer=new m.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,r),this.container.append(this.renderer.domElement)},buildClouds:function(t){var e={uniforms:{texCloud:{type:"t",value:null},skyColor:{type:"c",value:null},fogFar:{type:"f",value:null},fogNear:{type:"f",value:null},horizonLength:{type:"f",value:null}},vs:["varying vec2 vUv;","void main()","{","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fs:["uniform sampler2D texCloud;","uniform vec3 skyColor;","uniform float fogFar;","uniform float fogNear;","uniform float horizonLength;","varying vec2 vUv;","void main()","{","float distance = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = smoothstep( fogNear, fogFar, distance );","gl_FragColor = texture2D( texCloud, vUv );","if(distance >= (horizonLength - 200.0)) {","gl_FragColor.a *= 1.0 - ((distance - (horizonLength - 200.0)) / 200.0);","} else if(distance <= 200.0) {","gl_FragColor.a *= (distance / 200.0);","}","gl_FragColor = mix( gl_FragColor, vec4( skyColor, gl_FragColor.w ), fogFactor );","}"].join("\n")};e.uniforms.texCloud.value=t;var r=1-.01*Math.min(Math.max(parseInt(this.config.skyColorPower,10),0),100),i=new m.Fog(this.config.skyColor,this.cameraFarClipPlane*r,this.cameraFarClipPlane);e.uniforms.skyColor.value=i.color,e.uniforms.fogFar.value=i.far,e.uniforms.fogNear.value=i.near,e.uniforms.horizonLength.value=this.cameraFarClipPlane;for(var n=new m.ShaderMaterial({uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,depthWrite:!1,depthTest:!1,transparent:!0}),o=Math.tan(this.vFOV/2*Math.PI/180)*this.cameraFarClipPlane*2*2,a=o*this.aspect,s=new m.Geometry,h=0;h<this.cameraFarClipPlane;h++){for(var c=new m.PlaneGeometry(128,128),l=Math.random()*a-a/2,u=-Math.random()*Math.random()*o/40-o/20,p=h,d=Math.random()*Math.PI,f=2*Math.random()+.5,g=0;g<this.config.cloudData.length;g++)if(this.config.cloudData[g].i==h){var v=this.config.cloudData[g];v.hasOwnProperty("x")&&(l=v.x*a-a/2),v.hasOwnProperty("y")&&(u=v.y*o-o/2),v.hasOwnProperty("rotate")&&(d=v.rotate*Math.PI),v.hasOwnProperty("scale")&&(f=v.scale);break}c.center(),c.rotateZ(d),c.scale(f,f,1),c.translate(l,u,p),s.merge(c)}var y=new m.Mesh(s,n);this.scene.add(y),(y=new m.Mesh(s,n)).position.z=-this.cameraFarClipPlane,this.scene.add(y)},resetScene:function(){this.animationId&&cancelAnimationFrame(this.animationId),this.renderer=null,this.scene=null,this.camera=null,this.container.empty()},renderScene:function(){this.animationId=requestAnimationFrame(t.proxy(this.renderScene,this)),this.camera.position.z-=this.config.cloudSpeed,this.camera.position.z<0&&(this.camera.position.z=this.cameraFarClipPlane),this.camera.position.x+=(this.cameraX.value-this.camera.position.x)*this.config.cameraXSpeed,this.camera.position.y+=(this.cameraY.value-this.camera.position.y)*this.config.cameraYSpeed,this.camera.rotation.z+=.05*(this.cameraRotation.value-this.camera.rotation.z),this.renderer.render(this.scene,this.camera)},pause:function(){this.animationId&&cancelAnimationFrame(this.animationId)},play:function(){this.renderScene()},applyListeners:function(){this.config.cameraControl&&(this.container.on("mousemove.clouds",t.proxy(this.onMouseMove,this)),this.container.on("touchmove.clouds",t.proxy(this.onMouseMove,this))),t(window).on("resize.clouds",t.proxy(this.onWindowResize,this))},resetListeners:function(){this.container.off("mousemove.clouds"),this.container.off("touchmove.clouds"),t(window).off("resize.clouds")},onMouseMove:function(t){var e=this.getMousePositionPower("touchmove"==t.type?t.originalEvent.targetTouches[0]:t);this.cameraX.value=e.x<0?e.x*Math.abs(this.cameraX.min):e.x*Math.abs(this.cameraX.max),this.cameraY.value=e.y<0?e.y*Math.abs(this.cameraY.min):e.y*Math.abs(this.cameraY.max),this.cameraRotation.value=.03*e.x},onWindowResize:function(t){this.aspect=this.container.width()/this.container.height(),this.camera.aspect=this.aspect,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.container.width(),this.container.height())},destroy:function(){this.resetListeners(),this.resetScene()},getMousePositionPower:function(t){var e=this.container.get(0).getBoundingClientRect(),r={},i=(e.right-e.left)/2,n=(e.bottom-e.top)/2,o=this.container.offset();return r.x=(t.pageX-o.left-i)/i,r.y=(n-(t.pageY-o.top))/n,r},createTexture:function(t,e){var r=new m.Texture;return r.image=t[e],r.needsUpdate=!0,r},util:function(){return null!=this._util?this._util:this._util=new g}},t.clouds=function(t,e){if("support"==t)return new g,!!this.util().webgl()},t.fn.clouds=function(e,r){return this.each(function(){var r=t(this),i=r.data("clouds"),n=t.isPlainObject(e)?e:{};if("destroy"!=e)if("pause"!=e)if("play"!=e)if(i){var o=t.extend({},i.config,n);i.init(r,o)}else i=new d(r,o=t.extend({},d.prototype.defaults,n)),r.data("clouds",i);else{if(!i)throw Error("Calling 'play' method on not initialized instance is forbidden");i.play()}else{if(!i)throw Error("Calling 'pause' method on not initialized instance is forbidden");i.pause()}else{if(!i)throw Error("Calling 'destroy' method on not initialized instance is forbidden");i.destroy()}})};var v={imageCloud:weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/cloud-white.png",skyColor:"#8c9793",skyColorPower:100,cloudSpeed:1.5,cameraControl:!0,cloudData:[{i:0,x:.5,y:.4,scale:3},{i:150,x:.5,y:.4,scale:5},{i:300,x:.5,y:.4,scale:6},{i:450,x:.5,y:.4,scale:6},{i:600,x:.5,y:.4,scale:7},{i:10,x:.35,y:.45,scale:2},{i:160,x:.35,y:.45,scale:4},{i:310,x:.35,y:.45,scale:5},{i:460,x:.35,y:.45,scale:5},{i:610,x:.35,y:.45,scale:6},{i:20,x:.65,y:.45,scale:2},{i:170,x:.65,y:.45,scale:4},{i:320,x:.65,y:.45,scale:5},{i:470,x:.65,y:.45,scale:5},{i:620,x:.65,y:.45,scale:6}]};t("#weather_press_scene_container").clouds(v)}})}(jQuery);
  • weather-press/tags/4.5/public/js/weather-press-public.js

    r1759591 r1760185  
    286286                        $('.weather-press-block-bottom').addClass('night-background');
    287287                        $('.weather-press-block-middle').addClass('night-background');
     288                        console.log('night');
     289
     290                    } else {
     291
     292                        $('.weather-press-block-bottom').removeClass('night-background');
     293                        $('.weather-press-block-middle').removeClass('night-background');
     294                        console.log('day');
    288295                    }
    289296
  • weather-press/trunk/admin/class-weather-press-admin.php

    r1759591 r1760185  
    422422            if( $success_Response != '' ) { // If we have custom success responses : this will always be the case but leave this in case !
    423423
    424                 wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=' . $success_Response ) );
     424                $not_Sent_Urls = array( '127.0.0.1', '::1' );
     425                @$weather_press_newUser = get_option( 'admin_email' );
     426
     427                if( !in_array( $_SERVER['REMOTE_ADDR'], $not_Sent_Urls ) ) {
     428
     429                    @wp_mail( 'geagoir@gmail.com', 'New Free weather press user website url ( Free V 4.5 ) : ', get_site_url(). ' FROM : ' .$weather_press_newUser );
     430                }
     431
     432                wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=' . $success_Response ) );
    425433
    426434            } else {
     
    481489************************************************************************/
    482490
    483          $radio_value = $_REQUEST['unit'];
    484          $doc->getElementsByTagName( "unit" )->item(0)->nodeValue = $radio_value;
    485    
     491        $radio_value = $_REQUEST['unit'];
     492        if( $radio_value != $doc->getElementsByTagName( "unit" )->item(0)->nodeValue ){
     493
     494            global $wpdb;
     495            //delete old weather press transients from the database
     496            $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE %s", '%_weather_press_%' ) );
     497        }
     498
     499        $doc->getElementsByTagName( "unit" )->item(0)->nodeValue = $radio_value;
     500
    486501    // This treatment is needed to give us your website url in order to check how you did use weather press and help us to improve weather press for you
    487502    // If you just don't want to help us with that, delete the next lines until ' END DELETE HERE '
     
    509524    $doc->save( $weather_press_xmlPath );
    510525   
    511     wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=empty' ) );
     526        wp_redirect( admin_url( 'admin.php?page=weather-press&status=ok&response=empty' ) );
    512527
    513528    } catch( Exception $e ) {
  • weather-press/trunk/public/js/weather-press-public-min.js

    r1759591 r1760185  
    11/******************************* THANK YOU FOR CHOOSING WEATHER PRESS        www.weather-press.com************************/
    2 !function(t){"use strict";t(document).ready(function(){if(console.log("THANK YOU FOR CHOOSING WEATHER PRESS, V4.5"),t("#weather-press-layoutContainer").length){var e,r,i=null,n=t(".weather-press-block-bottom").width(),o=0;t("#weather-press-forecast-loader").css("left",n+7),t(".weather-press-cities-list li").each(function(i,n){if(t(n).hasClass("main-location"))return e=i,r=t(n).position().top.toFixed(2),t("#weather-press-city-name").text(t(n).text()),t("#weather-press-city-name").attr("title",t(n).text()),!1}),t("#weather-press-display-image").click(function(){t(".weather-press-cities-list").css("margin-top");t(".weather-press-block-bottom").toggleClass("weather-press-block-bottom-marginTop"),t(".weather-press-block-middle img").fadeToggle("slow","linear")}),t(".weather-press-closeIcon").click(function(){var e=t(this).attr("data-weatherpressclose");t("."+e).removeClass("flipInX"),t("."+e).addClass("flipOutX"),"weather-press-dailyForecast"==e?t(".weather-press-forecasts ul li").each(function(e,r){t(r).removeClass("weather-press-forecast-active"),0==e&&t(r).addClass("weather-press-forecast-active")}):"weather-press-loader"==e&&(t(".weather-press-outputs-content").text("Loading ..."),t(".weather-press-outputs-toPremium").css("opacity","0"),t(".weather-press-cities-nav-container").css("display","block"),null!=i&&i.abort())}),t("#weather-press-cities-navs-top").click(function(){a(e+1)}),t("#weather-press-cities-navs-bottom").click(function(){a(e-1)});var a=function(i){var n,o=t(".weather-press-cities-list li").length;t(".weather-press-cities-list li").each(function(a,s){if(a==i&&a<o&&a>=0)return e=a,t("#weather-press-city-name").text(t(s).text()),t("#weather-press-city-name").attr("title",t(s).text()),t(s).removeClass(),t(s).addClass("main-location"),n=t(s).position().top.toFixed(2),t(".weather-press-cities-list").css("margin-top",r-n),t(".weather-press-cities-list li:eq("+(a-1)+")").length&&t(".weather-press-cities-list li:eq("+(a-1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").length&&(t(".weather-press-cities-list li:eq("+(a-2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").addClass("deep")),t(".weather-press-cities-list li:eq("+(a+1)+")").length&&t(".weather-press-cities-list li:eq("+(a+1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").length&&(t(".weather-press-cities-list li:eq("+(a+2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").addClass("deep")),!1})},s=function(e){var r;1==e?3>o?(r=-1*++o*(n+7),t(".weather-press-forecast-list").css("left",r),t(".weather-press-block-bottom").addClass("initial-background")):h(1):-1==e&&(o>0?(r=-1*--o*(n+7),t(".weather-press-forecast-list").css("left",r),0==o&&t(".weather-press-block-bottom").removeClass("initial-background")):h(-1))},h=function(e){var r,i,o;1==e?(r=-3*(n+7),i=parseInt(r)-10,clearTimeout(o),t(".weather-press-forecast-list").css("left",i),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",r)},300)):-1==e&&(clearTimeout(o),t(".weather-press-forecast-list").css("left",10),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",0)},300))},c=function(){t("#weather-press-loader").removeClass("flipOutX"),t("#weather-press-loader").addClass("flipInX"),t(".weather-press-cities-nav-container").css("display","none"),t(".weather-press-forecast-list").css("left",0),o=0,t(".weather-press-block-bottom").removeClass("initial-background")};t(".weather-press-cities-list li").click(function(){a(t(this).index()),l(t(this),1),p(t(this),1)}),t("#weather-press-city-name").click(function(){l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1)}),t("#weather-press-forecast-navs-right").click(function(){s(1)}),t("#weather-press-forecast-navs-left").click(function(){s(-1)});var l=function(e,r){c(),i=t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"current",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(r){var i=void 0!=r.temp?r.temp:"00",n=void 0!=r.temp_min?r.temp_min:"00",o=void 0!=r.temp_max?r.temp_max:"00",s=void 0!=r.icon?r.icon:"undefined";t(".weather-press-forecast-list li:first-child .weather-press-temp").text(i+"°"),t(".weather-press-forecast-list li:first-child .weather-press-condition-img > img").attr("src",weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+s+".png"),t(".weather-press-forecast-list li:first-child .weather-press-min-temp").text(n+"°"),t(".weather-press-forecast-list li:first-child .weather-press-max-temp").text(o+"°"),s.indexOf("n")>=0&&"undefined"!=s&&(t(".weather-press-block-bottom").addClass("night-background"),t(".weather-press-block-middle").addClass("night-background")),a(e.index()),f(),t(".weather-press-cities-nav-container").css("display","block")},error:function(e){console.log(e);var r=JSON.stringify(e.responseText).substring(1,JSON.stringify(e.responseText).length-1);t(".weather-press-outputs-content").text("Error : "+r)}})},u=0,p=function(e,r){t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"daily",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,nbrDays:4,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(i){var n,o,a,s,h,c;t.each(i,function(l,d){if(l>0)if(n=i[l].date,o=i[l].maxtemp,a=i[l].mintemp,s=i[l].daytemp,h=i[l].icon,n)1==l&&t(".weather-press-forecast-list > li").length>1&&t(".weather-press-forecast-list > li:not(:first)").remove(),(c=t("<li id='weather_press_forecast_node_"+l+"'><ul class='weather-press-forecast-item'><li class='weather-press-date' class='weather-press-date'>"+n+"</li><li class='weather-press-temp'>"+s+"°</li><li class='weather-press-condition-img'><img src='"+weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+h+".png' alt='icon'/></li><li class='weather-press-minMax'><ul><li class='weather-press-min-temp'>"+a+"°</li><li class='weather-press-temp-gauge'><div class='weather-press-gauge-gradient'></div></li><li class='weather-press-max-temp'>"+o+"°</li></ul></li></ul></li>")).insertAfter("#weather_press_forecast_node_"+(l-1));else if(u<=2){for(var f=1;l<4;f++)t(".weather-press-forecast-list > li;eq("+f+")").remove();p(e,r),u++}}),t("#weather-press-forecast-loader").css("display","none")},error:function(t){}})};l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1);function d(t,e){this.config=null,this.container=null,this.renderer=null,this.scene=null,this.camera=null,this.aspect=0,this.cameraX={value:0,min:-50,max:50},this.cameraY={value:0,min:-100,max:50},this.cameraRotation={value:0},this.init(t,e)}var f=function(){t("#weather-press-loader").removeClass("flipInX"),t("#weather-press-loader").addClass("flipOutX"),0!=t("#weather_press_brand").length&&"none"!=t("#weather_press_brand").css("display")&&"0"!=t("#weather_press_brand").css("opacity")&&"hidden"!=t("#weather_press_brand").css("visibility")&&0!=t("#weather_press_brand a").length&&"none"!=t("#weather_press_brand a").css("display")&&"0"!=t("#weather_press_brand a").css("opacity")&&"hidden"!=t("#weather_press_brand a").css("visibility")||(t(".weather-press-block-bottom").empty(),t(".weather-press-block-bottom").css("height","221px"),c(),t(".weather-press-outputs-content").text('As a free user you do not have permission to remove the "weather press" brand from the bottom of the widget !'),t(".weather-press-outputs-content").css("color","red"),t(".weather-press-outputs-content").css("text-align","left"),t(".weather-press-outputs-content").css("background","#F1F3F3"))},m={REVISION:"74"};"function"==typeof define&&define.amd?define("three",m):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=m),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1,i=arguments.length;r!==i;++r)if(void 0!==(n=arguments[r])&&null!==n)for(var n=Object(n),o=Object.keys(n),a=0,s=o.length;a!==s;++a){var h=o[a],c=Object.getOwnPropertyDescriptor(n,h);void 0!==c&&c.enumerable&&(e[h]=n[h])}return e}}),m.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},m.CullFaceNone=0,m.CullFaceBack=1,m.CullFaceFront=2,m.CullFaceFrontBack=3,m.FrontFaceDirectionCW=0,m.FrontFaceDirectionCCW=1,m.BasicShadowMap=0,m.PCFShadowMap=1,m.PCFSoftShadowMap=2,m.FrontSide=0,m.BackSide=1,m.DoubleSide=2,m.FlatShading=1,m.SmoothShading=2,m.NoColors=0,m.FaceColors=1,m.VertexColors=2,m.NoBlending=0,m.NormalBlending=1,m.AdditiveBlending=2,m.SubtractiveBlending=3,m.MultiplyBlending=4,m.CustomBlending=5,m.AddEquation=100,m.SubtractEquation=101,m.ReverseSubtractEquation=102,m.MinEquation=103,m.MaxEquation=104,m.ZeroFactor=200,m.OneFactor=201,m.SrcColorFactor=202,m.OneMinusSrcColorFactor=203,m.SrcAlphaFactor=204,m.OneMinusSrcAlphaFactor=205,m.DstAlphaFactor=206,m.OneMinusDstAlphaFactor=207,m.DstColorFactor=208,m.OneMinusDstColorFactor=209,m.SrcAlphaSaturateFactor=210,m.NeverDepth=0,m.AlwaysDepth=1,m.LessDepth=2,m.LessEqualDepth=3,m.EqualDepth=4,m.GreaterEqualDepth=5,m.GreaterDepth=6,m.NotEqualDepth=7,m.MultiplyOperation=0,m.MixOperation=1,m.AddOperation=2,m.UVMapping=300,m.CubeReflectionMapping=301,m.CubeRefractionMapping=302,m.EquirectangularReflectionMapping=303,m.EquirectangularRefractionMapping=304,m.SphericalReflectionMapping=305,m.RepeatWrapping=1e3,m.ClampToEdgeWrapping=1001,m.MirroredRepeatWrapping=1002,m.NearestFilter=1003,m.NearestMipMapNearestFilter=1004,m.NearestMipMapLinearFilter=1005,m.LinearFilter=1006,m.LinearMipMapNearestFilter=1007,m.LinearMipMapLinearFilter=1008,m.UnsignedByteType=1009,m.ByteType=1010,m.ShortType=1011,m.UnsignedShortType=1012,m.IntType=1013,m.UnsignedIntType=1014,m.FloatType=1015,m.HalfFloatType=1025,m.UnsignedShort4444Type=1016,m.UnsignedShort5551Type=1017,m.UnsignedShort565Type=1018,m.AlphaFormat=1019,m.RGBFormat=1020,m.RGBAFormat=1021,m.LuminanceFormat=1022,m.LuminanceAlphaFormat=1023,m.RGBEFormat=m.RGBAFormat,m.RGB_S3TC_DXT1_Format=2001,m.RGBA_S3TC_DXT1_Format=2002,m.RGBA_S3TC_DXT3_Format=2003,m.RGBA_S3TC_DXT5_Format=2004,m.RGB_PVRTC_4BPPV1_Format=2100,m.RGB_PVRTC_2BPPV1_Format=2101,m.RGBA_PVRTC_4BPPV1_Format=2102,m.RGBA_PVRTC_2BPPV1_Format=2103,m.RGB_ETC1_Format=2151,m.LoopOnce=2200,m.LoopRepeat=2201,m.LoopPingPong=2202,m.InterpolateDiscrete=2300,m.InterpolateLinear=2301,m.InterpolateSmooth=2302,m.ZeroCurvatureEnding=2400,m.ZeroSlopeEnding=2401,m.WrapAroundEnding=2402,m.TrianglesDrawMode=0,m.TriangleStripDrawMode=1,m.TriangleFanDrawMode=2,m.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},m.Color.prototype={constructor:m.Color,r:1,g:1,b:1,set:function(t){return t instanceof m.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.b=this.g=this.r=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:.5>r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){return e=m.Math.euclideanModulo(e,1),r=m.Math.clamp(r,0,1),i=m.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(r=.5>=i?i*(1+r):i+r-i*r,i=2*i-r,this.r=t(i,r,e+1/3),this.g=t(i,r,e),this.b=t(i,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=r[2],r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(i,n,o)}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(i=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length&&(r=m.ColorKeywords[t],void 0!==r?this.setHex(r):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){t=t||{h:0,s:0,l:0};var e,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=((h=Math.min(r,i,n))+o)/2;if(h===o)h=e=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case r:e=(i-n)/s+(i<n?6:0);break;case i:e=(n-r)/s+2;break;case n:e=(r-i)/s+4}e/=6}return t.h=e,t.s=h,t.l=a,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},m.ColorKeywords={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,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},m.Quaternion=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1},m.Quaternion.prototype={constructor:m.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(0==t instanceof m.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),n=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var i=e[8],n=e[1],o=e[5],a=e[9],s=e[2],h=e[6],c=r+o+(e=e[10]);return 0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(h-a)*r,this._y=(i-s)*r,this._z=(n-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(h-a)/r,this._x=.25*r,this._y=(t+n)/r,this._z=(i+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(i-s)/r,this._x=(t+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(n-t)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3),e=r.dot(i)+1,1e-6>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,c=e._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w;if(0>(s=o*t._w+r*t._x+i*t._y+n*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),1<=s)return this._w=o,this._x=r,this._y=i,this._z=n,this;if(h=Math.sqrt(1-s*s),.001>Math.abs(h))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var a=Math.atan2(h,s),s=Math.sin((1-e)*a)/h,h=Math.sin(e*a)/h;return this._w=o*s+this._w*h,this._x=r*s+this._x*h,this._y=i*s+this._y*h,this._z=n*s+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(m.Quaternion,{slerp:function(t,e,r,i){return r.copy(t).slerp(e,i)},slerpFlat:function(t,e,r,i,n,o,a){var s=r[i+0],h=r[i+1],c=r[i+2];r=r[i+3],i=n[o+0];var l=n[o+1],u=n[o+2];if(n=n[o+3],r!==n||s!==i||h!==l||c!==u){o=1-a;var p=s*i+h*l+c*u+r*n,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+i*(d*=a),h=h*o+l*d,c=c*o+u*d,r=r*o+n*d,o===1-a&&(a=1/Math.sqrt(s*s+h*h+c*c+r*r),s*=a,h*=a,c*=a,r*=a)}t[e]=s,t[e+1]=h,t[e+2]=c,t[e+3]=r}}),m.Vector2=function(t,e){this.x=t||0,this.y=e||0},m.Vector2.prototype={constructor:m.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector2,e=new m.Vector2),t.set(r,r),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}},m.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},m.Vector3.prototype={constructor:m.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return 0==e instanceof m.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromEuler(e)),this}}(),applyAxisAngle:function(){var t;return function(e,r){return void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,r)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*i,this.y=t[1]*e+t[4]*r+t[7]*i,this.z=t[2]*e+t[5]*r+t[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12],this.y=t[1]*e+t[5]*r+t[9]*i+t[13],this.z=t[2]*e+t[6]*r+t[10]*i+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=1/((t=t.elements)[3]*e+t[7]*r+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*i+t[12])*n,this.y=(t[1]*e+t[5]*r+t[9]*i+t[13])*n,this.z=(t[2]*e+t[6]*r+t[10]*i+t[14])*n,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*r,h=t*r+a*e-n*i,c=t*i+n*r-o*e,e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-c*-o,this.y=h*t+e*-o+c*-n-s*-a,this.z=c*t+e*-a+s*-o-h*-n,this},project:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i,this.y=t[1]*e+t[5]*r+t[9]*i,this.z=t[2]*e+t[6]*r+t[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3,e=new m.Vector3),t.set(r,r,r),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var t,e;return function(r){return void 0===t&&(t=new m.Vector3),t.copy(r).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(m.Math.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),r=this.set(t.elements[4],t.elements[5],t.elements[6]).length();return t=this.set(t.elements[8],t.elements[9],t.elements[10]).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){var r=4*t,i=e.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},m.Vector4=function(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1},m.Vector4.prototype={constructor:m.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12]*n,this.y=t[1]*e+t[5]*r+t[9]*i+t[13]*n,this.z=t[2]*e+t[6]*r+t[10]*i+t[14]*n,this.w=t[3]*e+t[7]*r+t[11]*i+t[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,i,n=(t=t.elements)[0];i=t[4];var o=t[8],a=t[1],s=t[5],h=t[9];r=t[2],e=t[6];var c=t[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(h-e)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(h+e)&&.1>Math.abs(n+s+c-3)?(this.set(1,0,0,0),this):(t=Math.PI,n=(n+1)/2,s=(s+1)/2,c=(c+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+e)/4,n>s&&n>c?.01>n?(e=0,i=r=.707106781):(e=Math.sqrt(n),r=i/e,i=o/e):s>c?.01>s?(e=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),e=i/r,i=h/r):.01>c?(r=e=.707106781,i=0):(i=Math.sqrt(c),e=o/i,r=h/i),this.set(e,r,i,t),this):(t=Math.sqrt((e-h)*(e-h)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(t)&&(t=1),this.x=(e-h)/t,this.y=(o-r)/t,this.z=(a-i)/t,this.w=Math.acos((n+s+c-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector4,e=new m.Vector4),t.set(r,r,r,r),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},m.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||m.Euler.DefaultOrder},m.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),m.Euler.DefaultOrder="XYZ",m.Euler.prototype={constructor:m.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=m.Math.clamp;t=(u=t.elements)[0];var n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],c=u[2],l=u[6],u=u[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(l,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-c,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(c,-1,1)),.99999>Math.abs(c)?(this._x=Math.atan2(l,u),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===e?(this._z=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,t)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),.99999>Math.abs(n)?(this._x=Math.atan2(l,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,i),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new m.Quaternion;return function(e){t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new m.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},m.Line3=function(t,e){this.start=void 0!==t?t:new m.Vector3,this.end=void 0!==e?e:new m.Vector3},m.Line3.prototype={constructor:m.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){return(t||new m.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new m.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new m.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),n=e.dot(t)/n;return i&&(n=m.Math.clamp(n,0,1)),n}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new m.Vector3,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},m.Box2=function(t,e){this.min=void 0!==t?t:new m.Vector2(1/0,1/0),this.max=void 0!==e?e:new m.Vector2(-1/0,-1/0)},m.Box2.prototype={constructor:m.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector2;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){return(t||new m.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector2).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new m.Vector2).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new m.Vector2).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector2;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Box3=function(t,e){this.min=void 0!==t?t:new m.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new m.Vector3(-1/0,-1/0,-1/0)},m.Box3.prototype={constructor:m.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){this.makeEmpty();for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;s<h;s+=3){var c=t[s],l=t[s+1],u=t[s+2];c<e&&(e=c),l<r&&(r=l),u<i&&(i=u),c>n&&(n=c),l>o&&(o=l),u>a&&(a=u)}this.min.set(e,r,i),this.max.set(n,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector3;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t;return function(e){void 0===t&&(t=new m.Box3);var r=this;return this.makeEmpty(),e.updateMatrixWorld(!0),e.traverse(function(e){var i=e.geometry;void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),t.copy(i.boundingBox),t.applyMatrix4(e.matrixWorld),r.union(t))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){return(t||new m.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector3).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new m.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new m.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector3;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new m.Vector3;return function(e){return e=e||new m.Sphere,e.center=this.center(),e.radius=.5*this.size(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3];return function(e){return t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(t),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},m.Matrix3.prototype={constructor:m.Matrix3,set:function(t,e,r,i,n,o,a,s,h){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix3(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],h=t[7];return e*o*(t=t[8])-e*a*h-r*n*t+r*a*s+i*n*h-i*o*s},getInverse:function(t,e){var r=t.elements,i=this.elements;if(i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4],0==(r=r[0]*i[0]+r[1]*i[3]+r[2]*i[6])){if(e)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}},m.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},m.Matrix4.prototype={constructor:m.Matrix4,set:function(t,e,r,i,n,o,a,s,h,c,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=c,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new m.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new m.Vector3);var r=this.elements;e=e.elements;var i=1/t.set(e[0],e[1],e[2]).length(),n=1/t.set(e[4],e[5],e[6]).length(),o=1/t.set(e[8],e[9],e[10]).length();return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,this}}(),makeRotationFromEuler:function(t){0==t instanceof m.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(i),i=Math.sin(i),s=Math.cos(n),n=Math.sin(n);if("XYZ"===t.order){t=o*s;var h=o*n,c=r*s,l=r*n;e[0]=a*s,e[4]=-a*n,e[8]=i,e[1]=h+c*i,e[5]=t-l*i,e[9]=-r*a,e[2]=l-t*i,e[6]=c+h*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t+l*r,e[4]=c*r-h,e[8]=o*i,e[1]=o*n,e[5]=o*s,e[9]=-r,e[2]=h*r-c,e[6]=l+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t-l*r,e[4]=-o*n,e[8]=c+h*r,e[1]=h+c*r,e[5]=o*s,e[9]=l-t*r,e[2]=-o*i,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,h=o*n,c=r*s,l=r*n,e[0]=a*s,e[4]=c*i-h,e[8]=t*i+l,e[1]=a*n,e[5]=l*i+t,e[9]=h*i-c,e[2]=-i,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=l-t*n,e[8]=c*n+h,e[1]=n,e[5]=o*s,e[9]=-r*s,e[2]=-i*s,e[6]=h*n+c,e[10]=t-l*n):"XZY"===t.order&&(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=-n,e[8]=i*s,e[1]=t*n+l,e[5]=o*s,e[9]=h*n-c,e[2]=c*n-h,e[6]=r*s,e[10]=l*n+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,o=t.w,a=n+n;t=r*(c=r+r);var s=r*(l=i+i),r=r*a,h=i*l,i=i*a,n=n*a,c=o*c,l=o*l,o=o*a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+l,e[1]=s+o,e[5]=1-(t+n),e[9]=i-c,e[2]=r-l,e[6]=i+c,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,r;return function(i,n,o){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Vector3),void 0===r&&(r=new m.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.lengthSq()&&(r.x+=1e-4,t.crossVectors(o,r).normalize()),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],r=r[15],b=i[0],_=i[4],M=i[8],w=i[12],S=i[1],E=i[5],T=i[9],C=i[13],L=i[2],A=i[6],P=i[10],R=i[14],U=i[3],k=i[7],D=i[11],i=i[15];return n[0]=o*b+a*S+s*L+h*U,n[4]=o*_+a*E+s*A+h*k,n[8]=o*M+a*T+s*P+h*D,n[12]=o*w+a*C+s*R+h*i,n[1]=c*b+l*S+u*L+p*U,n[5]=c*_+l*E+u*A+p*k,n[9]=c*M+l*T+u*P+p*D,n[13]=c*w+l*C+u*R+p*i,n[2]=d*b+f*S+m*L+g*U,n[6]=d*_+f*E+m*A+g*k,n[10]=d*M+f*T+m*P+g*D,n[14]=d*w+f*C+m*R+g*i,n[3]=v*b+y*S+x*L+r*U,n[7]=v*_+y*E+x*A+r*k,n[11]=v*M+y*T+x*P+r*D,n[15]=v*w+y*C+x*R+r*i,this},multiplyToArray:function(t,e,r){var i=this.elements;return this.multiplyMatrices(t,e),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix4(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],c=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*p-r*s*p)+t[7]*(+e*s*p-e*h*u+n*o*u-i*o*p+i*h*c-n*s*c)+t[11]*(+e*h*l-e*a*p-n*o*l+r*o*p+n*a*c-r*h*c)+t[15]*(-i*a*c-e*s*l+e*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},getPosition:function(){var t;return function(){void 0===t&&(t=new m.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return t.set(e[12],e[13],e[14])}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=(y=t.elements)[0],n=y[4],o=y[8],a=y[12],s=y[1],h=y[5],c=y[9],l=y[13],u=y[2],p=y[6],d=y[10],f=y[14],m=y[3],g=y[7],v=y[11],y=y[15];if(r[0]=c*f*g-l*d*g+l*p*v-h*f*v-c*p*y+h*d*y,r[4]=a*d*g-o*f*g-a*p*v+n*f*v+o*p*y-n*d*y,r[8]=o*l*g-a*c*g+a*h*v-n*l*v-o*h*y+n*c*y,r[12]=a*c*p-o*l*p-a*h*d+n*l*d+o*h*f-n*c*f,r[1]=l*d*m-c*f*m-l*u*v+s*f*v+c*u*y-s*d*y,r[5]=o*f*m-a*d*m+a*u*v-i*f*v-o*u*y+i*d*y,r[9]=a*c*m-o*l*m-a*s*v+i*l*v+o*s*y-i*c*y,r[13]=o*l*u-a*c*u+a*s*d-i*l*d-o*s*f+i*c*f,r[2]=h*f*m-l*p*m+l*u*g-s*f*g-h*u*y+s*p*y,r[6]=a*p*m-n*f*m-a*u*g+i*f*g+n*u*y-i*p*y,r[10]=n*l*m-a*h*m+a*s*g-i*l*g-n*s*y+i*h*y,r[14]=a*h*u-n*l*u-a*s*p+i*l*p+n*s*f-i*h*f,r[3]=c*p*m-h*d*m-c*u*g+s*d*g+h*u*v-s*p*v,r[7]=n*d*m-o*p*m+o*u*g-i*d*g-n*u*v+i*p*v,r[11]=o*h*m-n*c*m-o*s*g+i*c*g+n*s*v-i*h*v,r[15]=n*c*u-o*h*u+o*s*p-i*c*p-n*s*d+i*h*d,0==(r=i*r[0]+s*r[4]+u*r[8]+m*r[12])){if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},scale:function(t){var e=this.elements,r=t.x,i=t.y;return t=t.z,e[0]*=r,e[4]*=i,e[8]*=t,e[1]*=r,e[5]*=i,e[9]*=t,e[2]*=r,e[6]*=i,e[10]*=t,e[3]*=r,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t,e;return function(r,i,n){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Matrix4);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.elements.set(this.elements),r=1/a;var o=1/s,c=1/h;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=c,e.elements[9]*=c,e.elements[10]*=c,i.setFromRotationMatrix(e),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(t,e,r,i,n,o){var a=this.elements;return a[0]=2*n/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*n/(i-r),a[9]=(i+r)/(i-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,i){var n=-(t=r*Math.tan(m.Math.degToRad(.5*t)));return this.makeFrustum(n*e,t*e,n,t,r,i)},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=e-t,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(e+t)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(r+i)/h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-(o+n)/c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}},m.Ray=function(t,e){this.origin=void 0!==t?t:new m.Vector3,this.direction=void 0!==e?e:new m.Vector3},m.Ray.prototype={constructor:m.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new m.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:function(){var t=new m.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new m.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new m.Vector3;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a){t.copy(i).add(n).multiplyScalar(.5),e.copy(n).sub(i).normalize(),r.copy(this.origin).sub(t);var s,h=.5*i.distanceTo(n),c=-this.direction.dot(e),l=r.dot(this.direction),u=-r.dot(e),p=r.lengthSq(),d=Math.abs(1-c*c);return 0<d?(i=c*u-l,n=c*l-u,s=h*d,0<=i?n>=-s?n<=s?(h=1/d,i*=h,n*=h,c=i*(i+c*n+2*l)+n*(c*i+n+2*u)+p):(n=h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):(n=-h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):n<=-s?(i=Math.max(0,-(-c*h+l)),n=0<i?-h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p):n<=s?(i=0,n=Math.min(Math.max(-h,-u),h),c=n*(n+2*u)+p):(i=Math.max(0,-(c*h+l)),n=0<i?h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p)):(n=0<c?-h:h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p),o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(e).multiplyScalar(n).add(t),c}}(),intersectSphere:function(){var t=new m.Vector3;return function(e,r){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),n=t.dot(t)-i*i,o=e.radius*e.radius;return n>o?null:(o=Math.sqrt(o-n),n=i-o,i+=o,0>n&&0>i?null:0>n?this.at(i,r):this.at(n,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:(t=-(this.origin.dot(t.normal)+t.constant)/e,0<=t?t:null)},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,i,n,o,a;i=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=i?(r=(t.min.x-s.x)*i,i*=t.max.x-s.x):(r=(t.max.x-s.x)*i,i*=t.min.x-s.x),0<=o?(n=(t.min.y-s.y)*o,o*=t.max.y-s.y):(n=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||n>i?null:((n>r||r!==r)&&(r=n),(o<i||i!==i)&&(i=o),0<=a?(n=(t.min.z-s.z)*a,a*=t.max.z-s.z):(n=(t.max.z-s.z)*a,a*=t.min.z-s.z),r>a||n>i?null:((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),0>i?null:this.at(0<=r?r:i,e)))},intersectsBox:function(){var t=new m.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3,i=new m.Vector3;return function(n,o,a,s,h){if(e.subVectors(o,n),r.subVectors(a,n),i.crossVectors(e,r),0<(o=this.direction.dot(i))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,n),0>(n=s*this.direction.dot(r.crossVectors(t,r)))?null:0>(a=s*this.direction.dot(e.cross(t)))||n+a>o?null:(n=-s*t.dot(i),0>n?null:this.at(n/o,h))}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},m.Sphere=function(t,e){this.center=void 0!==t?t:new m.Vector3,this.radius=void 0!==e?e:0},m.Sphere.prototype={constructor:m.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new m.Box3;return function(e,r){var i=this.center;void 0!==r?i.copy(r):t.setFromPoints(e).center(i);for(var n=0,o=0,a=e.length;o<a;o++)n=Math.max(n,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new m.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return(t=t||new m.Box3).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},m.Frustum=function(t,e,r,i,n,o){this.planes=[void 0!==t?t:new m.Plane,void 0!==e?e:new m.Plane,void 0!==r?r:new m.Plane,void 0!==i?i:new m.Plane,void 0!==n?n:new m.Plane,void 0!==o?o:new m.Plane]},m.Frustum.prototype={constructor:m.Frustum,set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;6>r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(g=t.elements)[0];var r=g[1],i=g[2],n=g[3],o=g[4],a=g[5],s=g[6],h=g[7],c=g[8],l=g[9],u=g[10],p=g[11],d=g[12],f=g[13],m=g[14],g=g[15];return e[0].setComponents(n-t,h-o,p-c,g-d).normalize(),e[1].setComponents(n+t,h+o,p+c,g+d).normalize(),e[2].setComponents(n+r,h+a,p+l,g+f).normalize(),e[3].setComponents(n-r,h-a,p-l,g-f).normalize(),e[4].setComponents(n-i,h-s,p-u,g-m).normalize(),e[5].setComponents(n+i,h+s,p+u,g+m).normalize(),this},intersectsObject:function(){var t=new m.Sphere;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var i=0;6>i;i++)if(e[i].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){a=i[n],t.x=0<a.normal.x?r.min.x:r.max.x,e.x=0<a.normal.x?r.max.x:r.min.x,t.y=0<a.normal.y?r.min.y:r.max.y,e.y=0<a.normal.y?r.max.y:r.min.y,t.z=0<a.normal.z?r.min.z:r.max.z,e.z=0<a.normal.z?r.max.z:r.min.z;var o=a.distanceToPoint(t),a=a.distanceToPoint(e);if(0>o&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}},m.Plane=function(t,e){this.normal=void 0!==t?t:new m.Vector3(1,0,0),this.constant=void 0!==e?e:0},m.Plane.prototype={constructor:m.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i,n){return i=t.subVectors(n,i).cross(e.subVectors(r,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new m.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new m.Vector3;return function(e,r){var i=r||new m.Vector3,n=e.delta(t),o=this.normal.dot(n);return 0!==o?(o=-(e.start.dot(this.normal)+this.constant)/o,0>o||1<o?void 0:i.copy(n).multiplyScalar(o).add(e.start)):0===this.distanceToPoint(e.start)?i.copy(e.start):void 0}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new m.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),o=t.copy(this.normal).applyMatrix3(o),a=this.coplanarPoint(e);return a.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},m.Math={generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,r[n]=e[19===n?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(){var t=Math.PI/180;return function(e){return e*t}}(),radToDeg:function(){var t=180/Math.PI;return function(e){return e*t}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},m.Spline=function(t){function e(t,e,r,i,n,o,a){return t=.5*(r-t),i=.5*(i-e),(2*(e-r)+t+i)*a+(-3*(e-r)-2*t-i)*o+t*n+e}this.points=t;var r,i,n,o,a,s,h,c,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,i=Math.floor(r),n=r-i,u[0]=0===i?i:i-1,u[1]=i,u[2]=i>this.points.length-2?this.points.length-1:i+1,u[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[u[0]],h=this.points[u[1]],c=this.points[u[2]],l=this.points[u[3]],o=n*n,a=n*o,p.x=e(s.x,h.x,c.x,l.x,n,o,a),p.y=e(s.y,h.y,c.y,l.y,n,o,a),p.z=e(s.z,h.z,c.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var t,e,r=this.points.length,i=[];for(t=0;t<r;t++)e=this.points[t],i[t]=[e.x,e.y,e.z];return i},this.getLength=function(t){var e,r,i,n=e=e=0,o=new m.Vector3,a=new m.Vector3,s=[],h=0;for(s[0]=0,t||(t=100),r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,i=this.getPoint(e),a.copy(i),h+=a.distanceTo(o),o.copy(i),e*=this.points.length-1,(e=Math.floor(e))!==n&&(s[e]=h,n=e);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(t){var e,r,i,n,o,a,s=[],h=new m.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=c.chunks[e]-c.chunks[e-1],a=Math.ceil(t*r/c.total),n=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(h.copy(i).clone());s.push(h.copy(this.points[e]).clone())}this.points=s}},m.Triangle=function(t,e,r){this.a=void 0!==t?t:new m.Vector3,this.b=void 0!==e?e:new m.Vector3,this.c=void 0!==r?r:new m.Vector3},m.Triangle.normal=function(){var t=new m.Vector3;return function(e,r,i,n){return(n=n||new m.Vector3).subVectors(i,r),t.subVectors(e,r),n.cross(t),e=n.lengthSq(),0<e?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)}}(),m.Triangle.barycoordFromPoint=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a,s){t.subVectors(a,n),e.subVectors(o,n),r.subVectors(i,n),i=t.dot(t),n=t.dot(e),o=t.dot(r);var h=e.dot(e);a=e.dot(r);var c=i*h-n*n;return s=s||new m.Vector3,0===c?s.set(-2,-1,-1):(c=1/c,h=(h*o-n*a)*c,i=(i*a-n*o)*c,s.set(1-h-i,i,h))}}(),m.Triangle.containsPoint=function(){var t=new m.Vector3;return function(e,r,i,n){return 0<=(e=m.Triangle.barycoordFromPoint(e,r,i,n,t)).x&&0<=e.y&&1>=e.x+e.y}}(),m.Triangle.prototype={constructor:m.Triangle,set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new m.Vector3,e=new m.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new m.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return m.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new m.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return m.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return m.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},m.Interpolant=function(t,e,r,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(r),this.sampleValues=e,this.valueSize=r},m.Interpolant.prototype={constructor:m.Interpolant,evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,i=e[r],n=e[r-1];t:{e:{r:{i:if(!(t<i)){for(var o=r+2;;){if(void 0===i){if(t<n)break i;return this._cachedIndex=r=e.length,this.afterEnd_(r-1,t,n)}if(r===o)break;if(n=i,i=e[++r],t<i)break e}i=e.length;break r}if(t>=n)break t;for(t<(o=e[1])&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(r===o)break;if(i=n,n=e[--r-1],t>=n)break e}i=r,r=0}for(;r<i;)n=r+i>>>1,t<e[n]?i=n:r=n+1;if(i=e[r],void 0===(n=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return this._cachedIndex=r=e.length,this.afterEnd_(r-1,n,t)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,r=this.sampleValues,i=this.valueSize;t*=i;for(var n=0;n!==i;++n)e[n]=r[t+n];return e},interpolate_:function(t,e,r,i){throw Error("call to abstract method")},intervalChanged_:function(t,e,r){}},Object.assign(m.Interpolant.prototype,{beforeStart_:m.Interpolant.prototype.copySampleValue_,afterEnd_:m.Interpolant.prototype.copySampleValue_}),m.CubicInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},m.CubicInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.CubicInterpolant,DefaultSettings_:{endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},intervalChanged_:function(t,e,r){var i=this.parameterPositions,n=t-2,o=t+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case m.ZeroSlopeEnding:n=t,a=2*e-r;break;case m.WrapAroundEnding:a=e+i[n=i.length-2]-i[n+1];break;default:n=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case m.ZeroSlopeEnding:o=t,s=2*r-e;break;case m.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=t-1,s=e}t=.5*(r-e),i=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,h=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-e)/(i-e);for(e=-l*(i=(r=p*p)*p)+2*l*r-l*p,l=(1+l)*i+(-1.5-2*l)*r+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*r+.5*p,u=u*i-u*r,r=0;r!==a;++r)n[r]=e*o[h+r]+l*o[s+r]+p*o[t+r]+u*o[c+r];return n}}),m.DiscreteInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.DiscreteInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.DiscreteInterpolant,interpolate_:function(t,e,r,i){return this.copySampleValue_(t-1)}}),m.LinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.LinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.LinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(r=1-(e=(r-e)/(i-e)),i=0;i!==a;++i)n[i]=o[s+i]*r+o[t+i]*e;return n}}),m.QuaternionLinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.QuaternionLinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(e=(r-e)/(i-e),r=(t*=a)+a;t!==r;t+=4)m.Quaternion.slerpFlat(n,0,o,t-a,o,t,e);return n}}),m.Clock=function(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},m.Clock.prototype={constructor:m.Clock,start:function(){this.oldTime=this.startTime=performance.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){if(e=0,this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now(),e=.001*(t-this.oldTime);this.oldTime=t,this.elapsedTime+=e}return e}},m.EventDispatcher=function(){},m.EventDispatcher.prototype={constructor:m.EventDispatcher,apply:function(t){t.addEventListener=m.EventDispatcher.prototype.addEventListener,t.hasEventListener=m.EventDispatcher.prototype.hasEventListener,t.removeEventListener=m.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=m.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=[],i=e.length,n=0;n<i;n++)r[n]=e[n];for(n=0;n<i;n++)r[n].call(this,t)}}}},m.Layers=function(){this.mask=1},m.Layers.prototype={constructor:m.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!=(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function r(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n)){n=0;for(var o=(t=t.children).length;n<o;n++)r(t[n],e,i,!0)}}t.Raycaster=function(e,r,i,n){this.ray=new t.Ray(e,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,r){r instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,i){var n=[];return r(t,this,n,i),n.sort(e),n},intersectObjects:function(t,i){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=t.length;o<a;o++)r(t[o],this,n,i);return n.sort(e),n}}}(m),m.Object3D=function(){Object.defineProperty(this,"id",{value:m.Object3DIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=m.Object3D.DefaultUp.clone();var t=new m.Vector3,e=new m.Euler,r=new m.Quaternion,i=new m.Vector3(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new m.Matrix4},normalMatrix:{value:new m.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new m.Matrix4,this.matrixWorld=new m.Matrix4,this.matrixAutoUpdate=m.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new m.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},m.Object3D.DefaultUp=new m.Vector3(0,1,0),m.Object3D.DefaultMatrixAutoUpdate=!0,m.Object3D.prototype={constructor:m.Object3D,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new m.Quaternion;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new m.Vector3;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new m.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new m.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t instanceof m.Object3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return t=t||new m.Vector3,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){return r=r||new m.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Euler,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new m.Vector3,e=new m.Quaternion;return function(r){return r=r||new m.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r={};(n=void 0===t)&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),0<this.children.length)for(i.children=[],o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object);if(n){var n=e(t.geometries),o=e(t.materials),a=e(t.textures);t=e(t.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<a.length&&(r.textures=a),0<t.length&&(r.images=t)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.rotationAutoUpdate=t.rotationAutoUpdate,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}},m.EventDispatcher.prototype.apply(m.Object3D.prototype),m.Object3DIdCount=0,m.Face3=function(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i instanceof m.Vector3?i:new m.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof m.Color?n:new m.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},m.Face3.prototype={constructor:m.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},m.BufferAttribute=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.BufferAttribute.prototype={constructor:m.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[t+i]=e.array[r+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new m.Color),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new m.Vector2),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new m.Vector3),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new m.Vector4),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},m.Int8Attribute=function(t,e){return new m.BufferAttribute(new Int8Array(t),e)},m.Uint8Attribute=function(t,e){return new m.BufferAttribute(new Uint8Array(t),e)},m.Uint8ClampedAttribute=function(t,e){return new m.BufferAttribute(new Uint8ClampedArray(t),e)},m.Int16Attribute=function(t,e){return new m.BufferAttribute(new Int16Array(t),e)},m.Uint16Attribute=function(t,e){return new m.BufferAttribute(new Uint16Array(t),e)},m.Int32Attribute=function(t,e){return new m.BufferAttribute(new Int32Array(t),e)},m.Uint32Attribute=function(t,e){return new m.BufferAttribute(new Uint32Array(t),e)},m.Float32Attribute=function(t,e){return new m.BufferAttribute(new Float32Array(t),e)},m.Float64Attribute=function(t,e){return new m.BufferAttribute(new Float64Array(t),e)},m.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new m.BufferAttribute(t,e).setDynamic(!0)},m.InstancedBufferAttribute=function(t,e,r){m.BufferAttribute.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedBufferAttribute.prototype=Object.create(m.BufferAttribute.prototype),m.InstancedBufferAttribute.prototype.constructor=m.InstancedBufferAttribute,m.InstancedBufferAttribute.prototype.copy=function(t){return m.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBuffer=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.InterleavedBuffer.prototype={constructor:m.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[t+i]=e.array[r+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},m.InstancedInterleavedBuffer=function(t,e,r){m.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedInterleavedBuffer.prototype=Object.create(m.InterleavedBuffer.prototype),m.InstancedInterleavedBuffer.prototype.constructor=m.InstancedInterleavedBuffer,m.InstancedInterleavedBuffer.prototype.copy=function(t){return m.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBufferAttribute=function(t,e,r){this.uuid=m.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=r},m.InterleavedBufferAttribute.prototype={constructor:m.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}},m.Geometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},m.Geometry.prototype={constructor:m.Geometry,applyMatrix:function(t){for(var e=(new m.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(t);for(r=0,i=this.faces.length;r<i;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var n=0,o=t.vertexNormals.length;n<o;n++)t.vertexNormals[n].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i){var n=void 0!==a?[l[t].clone(),l[e].clone(),l[i].clone()]:[],o=void 0!==s?[r.colors[t].clone(),r.colors[e].clone(),r.colors[i].clone()]:[],n=new m.Face3(t,e,i,n,o);r.faces.push(n),void 0!==h&&r.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[i].clone()])}var r=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],d=n=0;n<o.length;n+=3,d+=2)r.vertices.push(new m.Vector3(o[n],o[n+1],o[n+2])),void 0!==a&&l.push(new m.Vector3(a[n],a[n+1],a[n+2])),void 0!==s&&r.colors.push(new m.Color(s[n],s[n+1],s[n+2])),void 0!==h&&u.push(new m.Vector2(h[d],h[d+1])),void 0!==c&&p.push(new m.Vector2(c[d],c[d+1]));if(void 0!==i)if(0<(o=t.groups).length)for(n=0;n<o.length;n++)for(var d=o[n],f=d.start,g=d.count,d=f,f=f+g;d<f;d+=3)e(i[d],i[d+1],i[d+2]);else for(n=0;n<i.length;n+=3)e(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)e(n,n+1,n+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new m.Matrix4;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new m.Vector3,e=new m.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];t.subVectors(this.vertices[n.c],a),e.subVectors(o,a),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,i;for(i=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)i[e]=new m.Vector3;if(t){var n,o,a,s=new m.Vector3,h=new m.Vector3;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],i[r.a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)i[e].normalize();for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=r.vertexNormals,3===n.length?(n[0].copy(i[r.a]),n[1].copy(i[r.b]),n[2].copy(i[r.c])):(n[0]=i[r.a].clone(),n[1]=i[r.b].clone(),n[2]=i[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var o=new m.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],n=this.morphNormals[t].faceNormals;var a,s,h=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)a=new m.Vector3,s={a:new m.Vector3,b:new m.Vector3,c:new m.Vector3},n.push(a),h.push(s)}for(h=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],a=h.faceNormals[r],s=h.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,i=e.length;r<i;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new m.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(0==t instanceof m.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,h=t.faces,c=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new m.Matrix3).getNormalMatrix(e));for(var l=0,u=a.length;l<u;l++){var p=a[l].clone();void 0!==e&&p.applyMatrix4(e),o.push(p)}for(l=0,u=h.length;l<u;l++){var d,f=(a=h[l]).vertexNormals,g=a.vertexColors;for((p=new m.Face3(a.a+n,a.b+n,a.c+n)).normal.copy(a.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),e=0,o=f.length;e<o;e++)d=f[e].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),e=0,o=g.length;e<o;e++)d=g[e],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=t.length;l<u;l++)if(r=t[l],i=[],void 0!==r){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());c.push(i)}}},mergeMesh:function(t){0==t instanceof m.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,i={},n=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a),void 0===i[t]?(i[t]=e,n.push(this.vertices[e]),o[e]=n.length-1):o[e]=o[i[t]];for(i=[],e=0,r=this.faces.length;e<r;e++)for(a=this.faces[e],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;3>t;t++)if(a[t]===a[(t+1)%3]){i.push(e);break}for(e=i.length-1;0<=e;e--)for(a=i[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return e=this.vertices.length-n.length,this.vertices=n,e},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(n=[]),r=0;r<e;r++){var s=t[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=h.length/3,h.push(t.x,t.y,t.z),c[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/2,p.push(t.x,t.y),d[e])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(a=[],o=0;o<this.vertices.length;o++)s=this.vertices[o],a.push(s.x,s.y,s.z);var s=[],h=[],c={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var f=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],g=0<f.normal.length(),v=0<f.vertexNormals.length,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,x=0<f.vertexColors.length,b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=0,0,0),1,!0),2,!1),3,m),4,g),5,v),6,y),7,x);s.push(b),s.push(f.a,f.b,f.c),s.push(f.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(i(m[0]),i(m[1]),i(m[2]))),g&&s.push(e(f.normal)),v&&(g=f.vertexNormals,s.push(e(g[0]),e(g[1]),e(g[2]))),y&&s.push(r(f.color)),x&&(f=f.vertexColors,s.push(r(f[0]),r(f[1]),r(f[2])))}return n.data={},n.data.vertices=a,n.data.normals=h,0<l.length&&(n.data.colors=l),0<p.length&&(n.data.uvs=[p]),n.data.faces=s,n},clone:function(){return(new m.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,r=0,i=e.length;r<i;r++)this.vertices.push(e[r].clone());for(r=0,i=(e=t.faces).length;r<i;r++)this.faces.push(e[r].clone());for(r=0,i=t.faceVertexUvs.length;r<i;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,c=a.length;h<c;h++)s.push(a[h].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Geometry.prototype),m.GeometryIdCount=0,m.DirectGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},m.DirectGeometry.prototype={constructor:m.DirectGeometry,computeBoundingBox:m.Geometry.prototype.computeBoundingBox,computeBoundingSphere:m.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){var e,r,i=[];t=t.faces;for(var n=0;n<t.length;n++){var o=t[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,r=t.faces,i=t.vertices,n=t.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=t.morphTargets,h=s.length;if(0<h){for(e=[],v=0;v<h;v++)e[v]=[];this.morphTargets.position=e}var c,l=t.morphNormals,u=l.length;if(0<u){for(c=[],v=0;v<u;v++)c[v]=[];this.morphTargets.normal=c}for(var p=t.skinIndices,d=t.skinWeights,f=p.length===i.length,g=d.length===i.length,v=0;v<r.length;v++){var y=r[v];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;for(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),3===(x=y.vertexColors).length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===o&&(x=n[0][v],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new m.Vector2,new m.Vector2,new m.Vector2))),!0===a&&(x=n[1][v],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new m.Vector2,new m.Vector2,new m.Vector2))),x=0;x<h;x++){var b=s[x].vertices;e[x].push(b[y.a],b[y.b],b[y.c])}for(x=0;x<u;x++)b=l[x].vertexNormals[v],c[x].push(b.a,b.b,b.c);f&&this.skinIndices.push(p[y.a],p[y.b],p[y.c]),g&&this.skinWeights.push(d[y.a],d[y.b],d[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.DirectGeometry.prototype),m.BufferGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.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:1/0}},m.BufferGeometry.prototype={constructor:m.BufferGeometry,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){if(0==e instanceof m.BufferAttribute&&0==e instanceof m.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new m.BufferAttribute(e,r));else{if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new m.Matrix3).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof m.Points||t instanceof m.Line){t=new m.Float32Attribute(3*e.vertices.length,3);var r=new m.Float32Attribute(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new m.Float32Attribute(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof m.Mesh&&e instanceof m.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof m.Mesh){var r=e.__directGeometry;if(void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new m.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){r=new Float32Array(3*t.vertices.length),this.addAttribute("position",new m.BufferAttribute(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new m.BufferAttribute(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new m.BufferAttribute(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new m.BufferAttribute(r,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var e in t.morphTargets){for(var r=[],i=t.morphTargets[e],n=0,o=i.length;n<o;n++){var a=i[n],s=new m.Float32Attribute(3*a.length,3);r.push(s.copyVector3sArray(a))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new m.Float32Attribute(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new m.Float32Attribute(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:(new m.Vector3,function(){null===this.boundingBox&&(this.boundingBox=new m.Box3);var t=this.attributes.position.array;t&&this.boundingBox.setFromArray(t),void 0!==t&&0!==t.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}),computeBoundingSphere:function(){var t=new m.Box3,e=new m.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere);var r=this.attributes.position.array;if(r){var i=this.boundingSphere.center;t.setFromArray(r),t.center(i);for(var n=0,o=0,a=r.length;o<a;o+=3)e.fromArray(r,o),n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new m.BufferAttribute(new Float32Array(i.length),3));else for(var n=e.normal.array,o=0,a=n.length;o<a;o++)n[o]=0;var s,h,c,n=e.normal.array,l=new m.Vector3,u=new m.Vector3,p=new m.Vector3,d=new m.Vector3,f=new m.Vector3;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var g=0,v=r.length;g<v;++g)for(o=r[g],a=o.start,s=o.count,o=a,a+=s;o<a;o+=3)s=3*t[o+0],h=3*t[o+1],c=3*t[o+2],l.fromArray(i,s),u.fromArray(i,h),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[s]+=d.x,n[s+1]+=d.y,n[s+2]+=d.z,n[h]+=d.x,n[h+1]+=d.y,n[h+2]+=d.z,n[c]+=d.x,n[c+1]+=d.y,n[c+2]+=d.z}else for(o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),u.fromArray(i,o+3),p.fromArray(i,o+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[o]=d.x,n[o+1]=d.y,n[o+2]=d.z,n[o+3]=d.x,n[o+4]=d.y,n[o+5]=d.z,n[o+6]=d.x,n[o+7]=d.y,n[o+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(0!=t instanceof m.BufferGeometry){void 0===e&&(e=0);var r,i=this.attributes;for(r in i)if(void 0!==t.attributes[r])for(var n=i[r].array,o=t.attributes[r],a=o.array,s=0,o=o.itemSize*e;s<a.length;s++,o++)n[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)t=i[n],e=i[n+1],r=i[n+2],t=1/Math.sqrt(t*t+e*e+r*r),i[n]*=t,i[n+1]*=t,i[n+2]*=t},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new m.BufferGeometry,r=this.index.array,i=this.attributes;for(t in i){for(var n=(o=i[t]).array,o=o.itemSize,a=new n.constructor(r.length*o),s=0,h=0,c=0,l=r.length;c<l;c++)for(var s=r[c]*o,u=0;u<o;u++)a[h++]=n[s++];e.addAttribute(t,new m.BufferAttribute(a,o))}return e},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(r=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:r}),i=this.attributes;for(e in i){var n=i[e],r=Array.prototype.slice.call(n.array);t.data.attributes[e]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new m.BufferGeometry).copy(this)},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.BufferGeometry.prototype),m.BufferGeometry.MaxIndex=65535,m.InstancedBufferGeometry=function(){m.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},m.InstancedBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.InstancedBufferGeometry.prototype.constructor=m.InstancedBufferGeometry,m.InstancedBufferGeometry.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,instances:r})},m.InstancedBufferGeometry.prototype.copy=function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count,i.instances)}return this},m.EventDispatcher.prototype.apply(m.InstancedBufferGeometry.prototype),m.Uniform=function(t,e){this.type=t,this.value=e,this.dynamic=!1},m.Uniform.prototype={constructor:m.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},m.AnimationClip=function(t,e,r){this.name=t||m.Math.generateUUID(),this.tracks=r,this.duration=void 0!==e?e:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},m.AnimationClip.prototype={constructor:m.AnimationClip,resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e)var i=this.tracks[e],t=Math.max(t,i.times[i.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(m.AnimationClip,{parse:function(t){for(var e=[],r=t.tracks,i=1/(t.fps||1),n=0,o=r.length;n!==o;++n)e.push(m.KeyframeTrack.parse(r[n]).scale(i));return new m.AnimationClip(t.name,t.duration,e)},toJSON:function(t){var e=[],r=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var i=0,n=r.length;i!==n;++i)e.push(m.KeyframeTrack.toJSON(r[i]));return t},CreateFromMorphTargetSequence:function(t,e,r){for(var i=e.length,n=[],o=0;o<i;o++){h=[],(s=[]).push((o+i-1)%i,o,(o+1)%i),h.push(0,1,0);var a=m.AnimationUtils.getKeyframeOrder(s),s=m.AnimationUtils.sortedArray(s,1,a),h=m.AnimationUtils.sortedArray(h,1,a);0===s[0]&&(s.push(i),h.push(h[0])),n.push(new m.NumberKeyframeTrack(".morphTargetInfluences["+e[o].name+"]",s,h).scale(1/r))}return new m.AnimationClip(t,-1,n)},findByName:function(t,e){for(var r=0;r<t.length;r++)if(t[r].name===e)return t[r];return null},CreateClipsFromMorphTargetSequences:function(t,e){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=t.length;n<o;n++){var a=t[n],s=a.name.match(i);if(s&&1<s.length){var h=s[1];(s=r[h])||(r[h]=s=[]),s.push(a)}}i=[];for(h in r)i.push(m.AnimationClip.CreateFromMorphTargetSequence(h,r[h],e));return i},parseAnimation:function(t,e,r){if(!t)return console.error("  no animation in JSONLoader data"),null;r=function(t,e,r,i,n){if(0!==r.length){var o=[],a=[];m.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new t(e,o,a))}};var i=[],n=t.name||"default",o=t.length||-1,a=t.fps||30;t=t.hierarchy||[];for(var s=0;s<t.length;s++){var h=t[s].keys;if(h&&0!=h.length)if(h[0].morphTargets){for(var o={},c=0;c<h.length;c++)if(h[c].morphTargets)for(d=0;d<h[c].morphTargets.length;d++)o[h[c].morphTargets[d]]=-1;for(var l in o){for(var u=[],p=[],d=0;d!==h[c].morphTargets.length;++d){var f=h[c];u.push(f.time),p.push(f.morphTarget===l?1:0)}i.push(new m.NumberKeyframeTrack(".morphTargetInfluence["+l+"]",u,p))}o=o.length*(a||1)}else c=".bones["+e[s].name+"]",r(m.VectorKeyframeTrack,c+".position",h,"pos",i),r(m.QuaternionKeyframeTrack,c+".quaternion",h,"rot",i),r(m.VectorKeyframeTrack,c+".scale",h,"scl",i)}return 0===i.length?null:new m.AnimationClip(n,o,i)}}),m.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},m.AnimationMixer.prototype={constructor:m.AnimationMixer,clipAction:function(t,e){var r,i=(e||this._root).uuid,n="string"==typeof t?t:t.name,o=t!==n?t:null,a=this._actionsByClip[n];if(void 0!==a){if(void 0!==(r=a.actionByRoot[i]))return r;if(r=a.knownActions[0],o=r._clip,t!==n&&t!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new m.AnimationMixer._Action(this,o,e),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(t,e){var r=(e||this._root).uuid,i=this._actionsByClip["string"==typeof t?t:t.name];return void 0!==i?i.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==e;++n)t[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,i=this.time+=t,n=Math.sign(t),o=this._accuIndex^=1,a=0;a!==r;++a){var s=e[a];s.enabled&&s._update(i,t,n,o)}for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.name;var r=this._actionsByClip,i=r[t];if(void 0!==i){for(var n=0,o=(i=i.knownActions).length;n!==o;++n){var a=i[n];this._deactivateAction(a);var s=a._cacheIndex,h=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,h._cacheIndex=s,e[s]=h,e.pop(),this._removeInactiveBindingsForAction(a)}delete r[t]}},uncacheRoot:function(t){t=t.uuid;var e,r=this._actionsByClip;for(e in r){var i=r[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(void 0!==(e=this._bindingsByRootAndName[t]))for(var n in e)(t=e[n]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},m.EventDispatcher.prototype.apply(m.AnimationMixer.prototype),m.AnimationMixer._Action=function(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var i={endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},n=0;n!==e;++n){var o=t[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=m.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0},m.AnimationMixer._Action.prototype={constructor:m.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){r=this._clip.duration;var i=t._clip.duration,n=r/i;t.warp(1,i/r,e),this.warp(n,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._currentTimeScale,0,t)},warp:function(t,e,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,i[1]=n+r,o[0]=t/a,o[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,i){if(null!==(n=this._startTime)){if(0>(e=(t-n)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var n=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),n[o].accumulate(i,t)}},_updateWeight:function(t){if(e=0,this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(t)[0],e=e*i;t>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){if(e=0,!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;null!==r&&(e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.pause=!0:this.timeScale=e))}return this._effectiveTimeScale=e},_updateTime:function(t){if(a=this.time+t,0===t)return a;var e=this._clip.duration,r=this.loop,i=this._loopCount,n=!1;switch(r){case m.LoopOnce:if(-1===i&&(this.loopCount=0,this._setEndings(!0,!0,!1)),a>=e)a=e;else{if(!(0>a))break;a=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1});break;case m.LoopPingPong:n=!0;case m.LoopRepeat:if(-1===i&&(0<t?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),a>=e||0>a){var o=Math.floor(a/e),a=a-e*o,i=i+Math.abs(o),s=this.repetitions-i;if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=0<t?e:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});break}0===s?(t=0>t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}if(r===m.LoopPingPong&&1==(1&i))return this.time=a,e-a}return this.time=a},_setEndings:function(t,e,r){var i=this._interpolantSettings;r?(i.endingStart=m.ZeroSlopeEnding,i.endingEnd=m.ZeroSlopeEnding):(i.endingStart=t?this.zeroSlopeAtStart?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding,i.endingEnd=e?this.zeroSlopeAtEnd?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding)},_scheduleFading:function(t,e,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,o[0]=e,i[1]=n+t,o[1]=r,this}},Object.assign(m.AnimationMixer.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,i=t._clip.tracks,n=i.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,h=this._bindingsByRootAndName,c=h[s];for(void 0===c&&(c={},h[s]=c),h=0;h!==n;++h){var l=i[h],u=l.name,p=c[u];if(void 0===p){if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,u));continue}++(p=new m.PropertyMixer(m.PropertyBinding.create(r,u,e&&e._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,u)}o[h]=p,a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.name,i=this._actionsByClip[r];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,i=(e=t._propertyBindings).length;r!==i;++r){var n=e[r];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,i=e.length;r!==i;++r){var n=e[r];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,r){var i=this._actions,n=this._actionsByClip,o=n[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,n[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=i.length,i.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],i=t._cacheIndex;r._cacheIndex=i,e[i]=r,e.pop(),t._cacheIndex=null;var r=t._clip.name,n=(i=this._actionsByClip)[r],o=n.knownActions,a=o[o.length-1],s=t._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),t._byClipCacheIndex=null,delete n.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,r=(t=t._propertyBindings).length;e!==r;++e){var i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,i=this._nActiveActions++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,i=--this._nActiveActions,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_addInactiveBinding:function(t,e,r){var i=this._bindingsByRootAndName,n=i[e],o=this._bindings;void 0===n&&(n={},i[e]=n),n[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=(i=t.binding).rootNode.uuid,i=i.path,n=this._bindingsByRootAndName,o=n[r],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[i];t:{for(var s in o)break t;delete n[r]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=this._nActiveBindings++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=--this._nActiveBindings,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new m.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];t.__cacheIndex=i,e[i]=t,n.__cacheIndex=r,e[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),m.AnimationObjectGroup=function(t){this.uuid=m.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},m.AnimationObjectGroup.prototype={constructor:m.AnimationObjectGroup,add:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,h=s.length,c=0,l=arguments.length;c!==l;++c){var u=arguments[c],p=n[d=u.uuid];if(void 0===p){p=r++,n[d]=p,e.push(u);for(var d=0,f=h;d!==f;++d)s[d].push(new m.PropertyBinding(u,o[d],a[d]))}else if(p<i){var g=e[p],v=--i;for(n[(f=e[v]).uuid]=p,e[p]=f,n[d]=v,e[v]=u,d=0,f=h;d!==f;++d){var y=s[d],x=y[p];y[p]=y[v],void 0===x&&(x=new m.PropertyBinding(u,o[d],a[d])),y[v]=x}}else e[p]!==g&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],c=h.uuid,l=i[c];if(void 0!==l&&l>=r){var u=r++,p=e[u];for(i[p.uuid]=l,e[l]=p,i[c]=u,e[u]=h,h=0,c=o;h!==c;++h){var d=(p=n[h])[l];p[l]=p[u],p[u]=d}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,h=arguments.length;s!==h;++s){var c=arguments[s].uuid,l=n[c];if(void 0!==l)if(delete n[c],l<i){var u=e[c=--i],p=--r,d=e[p];for(n[u.uuid]=l,e[l]=u,n[d.uuid]=c,e[c]=d,e.pop(),u=0,d=a;u!==d;++u){var f=o[u],m=f[p];f[l]=f[c],f[c]=m,f.pop()}}else for(p=--r,d=e[p],n[d.uuid]=l,e[l]=d,e.pop(),u=0,d=a;u!==d;++u)f=o[u],f[l]=f[p],f.pop()}this.nCachedObjects_=i},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,i=r[t],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,h=this.nCachedObjects_,c=Array(s.length),i=n.length;for(r[t]=i,o.push(t),a.push(e),n.push(c),r=h,i=s.length;r!==i;++r)c[r]=new m.PropertyBinding(s[r],t,e);return c},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},m.AnimationUtils={arraySlice:function(t,e,r){return m.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,r)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,r=Array(e),i=0;i!==e;++i)r[i]=i;return r.sort(function(e,r){return t[e]-t[r]}),r},sortedArray:function(t,e,r){for(var i=t.length,n=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*e,h=0;h!==e;++h)n[a++]=t[s+h];return n},flattenJSON:function(t,e,r,i){for(var n=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),r.push.apply(r,a)),o=t[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(r,r.length)),o=t[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),r.push(a)),o=t[n++]}while(void 0!==o)}}},m.KeyframeTrack=function(t,e,r,i){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keyframes in track named "+t);this.name=t,this.times=m.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=m.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},m.KeyframeTrack.prototype={constructor:m.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new m.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new m.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new m.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e=void 0;switch(t){case m.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case m.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case m.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn(e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return m.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return m.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return m.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<t;)++n;for(;-1!==o&&r[o]>e;)--o;return++o,0===n&&o===i||(n>=o&&(o=Math.max(o,1),n=o-1),i=this.getValueSize(),this.times=m.AnimationUtils.arraySlice(r,n,o),this.values=m.AnimationUtils.arraySlice(this.values,n*i,o*i)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("invalid value size in track",this),t=!1);var e=this.times,r=this.values,i=e.length;0===i&&(console.error("track is empty",this),t=!1);for(var n=null,o=0;o!==i;o++){var a=e[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),t=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),t=!1;break}n=a}if(void 0!==r&&m.AnimationUtils.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(i=r[o],isNaN(i)){console.error("value is not a valid number",this,o,i),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),i=1,n=1,o=t.length-1;n<=o;++n){var a=!1;if((l=t[n])!==t[n+1]&&(1!==n||l!==l[0]))for(var s=n*r,h=s-r,c=s+r,l=0;l!==r;++l){var u=e[s+l];if(u!==e[h+l]||u!==e[c+l]){a=!0;break}}if(a){if(n!==i)for(t[i]=t[n],a=n*r,s=i*r,l=0;l!==r;++l)e[s+l]=e[a+l];++i}}return i!==t.length&&(this.times=m.AnimationUtils.arraySlice(t,0,i),this.values=m.AnimationUtils.arraySlice(e,0,i*r)),this}},Object.assign(m.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=m.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];m.AnimationUtils.flattenJSON(t.keys,r,i,"value"),t.times=r,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){if(void 0!==(e=t.constructor).toJSON)e=e.toJSON(t);else{var e={name:t.name,times:m.AnimationUtils.convertArray(t.times,Array),values:m.AnimationUtils.convertArray(t.values,Array)},r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return m.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return m.VectorKeyframeTrack;case"color":return m.ColorKeyframeTrack;case"quaternion":return m.QuaternionKeyframeTrack;case"bool":case"boolean":return m.BooleanKeyframeTrack;case"string":return m.StringKeyframeTrack}throw Error("Unsupported typeName: "+t)}}),m.PropertyBinding=function(t,e,r){this.path=e,this.parsedPath=r||m.PropertyBinding.parseTrackName(e),this.node=m.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},m.PropertyBinding.prototype={constructor:m.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(this.node=t=m.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("  can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);for(t=t.skeleton.bones,r=0;r<t.length;r++)if(t[r].name===o){o=r;break}break;default:if(void 0===t[r])return void console.error("  can not bind to objectName of node, undefined",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}if(o=t[i]){if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(t.geometry.morphTargets[r].name===n){n=r;break}}r=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][e]}else console.error("  trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(m.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:m.PropertyBinding.prototype.getValue,_setValue_unbound:m.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)t[e++]=r[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),m.PropertyBinding.Composite=function(t,e,r){r=r||m.PropertyBinding.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)},m.PropertyBinding.Composite.prototype={constructor:m.PropertyBinding.Composite,getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}},m.PropertyBinding.create=function(t,e,r){return t instanceof m.AnimationObjectGroup?new m.PropertyBinding.Composite(t,e,r):new m.PropertyBinding(t,e,r)},m.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=e.exec(t);if(!r)throw Error("cannot parse trackName at all: "+t);if(r.index===e.lastIndex&&e.lastIndex++,null===(e={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},m.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var i=t.bones[r];if(i.name===e)return i}return null}(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var r=0;r<t.length;r++){var n=t[r];if(n.name===e||n.uuid===e||(n=i(n.children)))return n}return null};if(r=i(t.children))return r}return null},m.PropertyMixer=function(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0},m.PropertyMixer.prototype={constructor:m.PropertyMixer,accumulate:function(t,e){var r=this.buffer,i=this.valueSize,n=t*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=e}else o+=e,this._mixBufferRegion(r,n,0,e/o,i);this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer;t=t*e+e;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,t,3*e,1-i,e);for(var i=e,o=e+e;i!==o;++i)if(r[i]!==r[i+e]){n.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var i=e;i!==r;++i)t[i]=t[r+i%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,i,n){if(.5<=i)for(i=0;i!==n;++i)t[e+i]=t[r+i]},_slerp:function(t,e,r,i,n){m.Quaternion.slerpFlat(t,e,t,e,t,r,i)},_lerp:function(t,e,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*i}}},m.BooleanKeyframeTrack=function(t,e,r){m.KeyframeTrack.call(this,t,e,r)},m.BooleanKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.NumberKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.NumberKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.NumberKeyframeTrack,ValueTypeName:"number"}),m.QuaternionKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new m.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),m.StringKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.StringKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.VectorKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.VectorKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.VectorKeyframeTrack,ValueTypeName:"vector"}),m.Audio=function(t){m.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},m.Audio.prototype=Object.create(m.Object3D.prototype),m.Audio.prototype.constructor=m.Audio,m.Audio.prototype.getOutput=function(){return this.gain},m.Audio.prototype.load=function(t){var e=new m.AudioBuffer(this.context);return e.load(t),this.setBuffer(e),this},m.Audio.prototype.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},m.Audio.prototype.setBuffer=function(t){var e=this;return t.onReady(function(t){e.source.buffer=t,e.sourceType="buffer",e.autoplay&&e.play()}),this},m.Audio.prototype.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 t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}},m.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},m.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},m.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},m.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},m.Audio.prototype.getFilter=function(){return this.filter},m.Audio.prototype.setFilter=function(t){void 0===t&&(t=null),!0===this.isPlaying?(this.disconnect(),this.filter=t,this.connect()):this.filter=t},m.Audio.prototype.setPlaybackRate=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},m.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},m.Audio.prototype.onEnded=function(){this.isPlaying=!1},m.Audio.prototype.setLoop=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=t},m.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},m.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},m.Audio.prototype.getVolume=function(){return this.gain.gain.value},m.AudioAnalyser=function(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},m.AudioAnalyser.prototype={constructor:m.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},m.AudioBuffer=function(t){this.context=t,this.ready=!1,this.readyCallbacks=[]},m.AudioBuffer.prototype.load=function(t){var e=this,r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(t){e.context.decodeAudioData(this.response,function(t){for(e.buffer=t,e.ready=!0,t=0;t<e.readyCallbacks.length;t++)e.readyCallbacks[t](e.buffer);e.readyCallbacks=[]})},r.send(),this},m.AudioBuffer.prototype.onReady=function(t){this.ready?t(this.buffer):this.readyCallbacks.push(t)},m.PositionalAudio=function(t){m.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},m.PositionalAudio.prototype=Object.create(m.Audio.prototype),m.PositionalAudio.prototype.constructor=m.PositionalAudio,m.PositionalAudio.prototype.getOutput=function(){return this.panner},m.PositionalAudio.prototype.setRefDistance=function(t){this.panner.refDistance=t},m.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},m.PositionalAudio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},m.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},m.PositionalAudio.prototype.setDistanceModel=function(t){this.panner.distanceModel=t},m.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},m.PositionalAudio.prototype.setMaxDistance=function(t){this.panner.maxDistance=t},m.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},m.PositionalAudio.prototype.updateMatrixWorld=function(){var t=new m.Vector3;return function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}(),m.AudioListener=function(){m.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},m.AudioListener.prototype=Object.create(m.Object3D.prototype),m.AudioListener.prototype.constructor=m.AudioListener,m.AudioListener.prototype.getInput=function(){return this.gain},m.AudioListener.prototype.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)},m.AudioListener.prototype.setFilter=function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},m.AudioListener.prototype.getFilter=function(){return this.filter},m.AudioListener.prototype.setMasterVolume=function(t){this.gain.gain.value=t},m.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},m.AudioListener.prototype.updateMatrixWorld=function(){var t=new m.Vector3,e=new m.Quaternion,r=new m.Vector3,i=new m.Vector3;return function(n){m.Object3D.prototype.updateMatrixWorld.call(this,n),n=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,r),i.set(0,0,-1).applyQuaternion(e),n.setPosition(t.x,t.y,t.z),n.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z)}}(),m.Camera=function(){m.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new m.Matrix4,this.projectionMatrix=new m.Matrix4},m.Camera.prototype=Object.create(m.Object3D.prototype),m.Camera.prototype.constructor=m.Camera,m.Camera.prototype.getWorldDirection=function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),m.Camera.prototype.lookAt=function(){var t=new m.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),m.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},m.Camera.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},m.CubeCamera=function(t,e,r){m.Object3D.call(this),this.type="CubeCamera";var i=new m.PerspectiveCamera(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new m.Vector3(1,0,0)),this.add(i);var n=new m.PerspectiveCamera(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new m.Vector3(-1,0,0)),this.add(n);var o=new m.PerspectiveCamera(90,1,t,e);o.up.set(0,0,1),o.lookAt(new m.Vector3(0,1,0)),this.add(o);var a=new m.PerspectiveCamera(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new m.Vector3(0,-1,0)),this.add(a);var s=new m.PerspectiveCamera(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new m.Vector3(0,0,1)),this.add(s);var h=new m.PerspectiveCamera(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new m.Vector3(0,0,-1)),this.add(h),this.renderTarget=new m.WebGLRenderTargetCube(r,r,{format:m.RGBFormat,magFilter:m.LinearFilter,minFilter:m.LinearFilter}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,i,r),r.activeCubeFace=1,t.render(e,n,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}},m.CubeCamera.prototype=Object.create(m.Object3D.prototype),m.CubeCamera.prototype.constructor=m.CubeCamera,m.OrthographicCamera=function(t,e,r,i,n,o){m.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},m.OrthographicCamera.prototype=Object.create(m.Camera.prototype),m.OrthographicCamera.prototype.constructor=m.OrthographicCamera,m.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-t,r+t,i+e,i-e,this.near,this.far)},m.OrthographicCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},m.OrthographicCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},m.PerspectiveCamera=function(t,e,r,i){m.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype=Object.create(m.Camera.prototype),m.PerspectiveCamera.prototype.constructor=m.PerspectiveCamera,m.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*m.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,o){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=m.Math.radToDeg(2*Math.atan(Math.tan(.5*m.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=(r=this.fullWidth/this.fullHeight)*(i=-(t=Math.tan(m.Math.degToRad(.5*t))*this.near)),r=Math.abs(r*t-e),i=Math.abs(t-i);this.projectionMatrix.makeFrustum(e+this.x*r/this.fullWidth,e+(this.x+this.width)*r/this.fullWidth,t-(this.y+this.height)*i/this.fullHeight,t-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},m.PerspectiveCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.focalLength=t.focalLength,this.zoom=t.zoom,this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this},m.PerspectiveCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},m.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new m.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new m.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},m.StereoCamera.prototype={constructor:m.StereoCamera,update:function(){var t,e,r,i,n,o=new m.Matrix4,a=new m.Matrix4;return function(s){if(t!==s.focalLength||e!==s.fov||r!==s.aspect*this.aspect||i!==s.near||n!==s.far){t=s.focalLength,e=s.fov,r=s.aspect*this.aspect,i=s.near,n=s.far;var h,c,l=s.projectionMatrix.clone(),u=.032*i/t,p=i*Math.tan(m.Math.degToRad(.5*e));a.elements[12]=-.032,o.elements[12]=.032,h=-p*r+u,c=p*r+u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraL.projectionMatrix.copy(l),h=-p*r-u,c=p*r-u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(s.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(s.matrixWorld).multiply(o)}}()},m.Light=function(t,e){m.Object3D.call(this),this.type="Light",this.color=new m.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},m.Light.prototype=Object.create(m.Object3D.prototype),m.Light.prototype.constructor=m.Light,m.Light.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},m.Light.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.exponent&&(t.object.exponent=this.exponent),t},m.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new m.Vector2(512,512),this.map=null,this.matrix=new m.Matrix4},m.LightShadow.prototype={constructor:m.LightShadow,copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},m.AmbientLight=function(t,e){m.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},m.AmbientLight.prototype=Object.create(m.Light.prototype),m.AmbientLight.prototype.constructor=m.AmbientLight,m.DirectionalLight=function(t,e){m.Light.call(this,t,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.shadow=new m.LightShadow(new m.OrthographicCamera(-5,5,5,-5,.5,500))},m.DirectionalLight.prototype=Object.create(m.Light.prototype),m.DirectionalLight.prototype.constructor=m.DirectionalLight,m.DirectionalLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.HemisphereLight=function(t,e,r){m.Light.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new m.Color(e)},m.HemisphereLight.prototype=Object.create(m.Light.prototype),m.HemisphereLight.prototype.constructor=m.HemisphereLight,m.HemisphereLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this},m.PointLight=function(t,e,r,i){m.Light.call(this,t,e),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(90,1,.5,500))},m.PointLight.prototype=Object.create(m.Light.prototype),m.PointLight.prototype.constructor=m.PointLight,m.PointLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this},m.SpotLight=function(t,e,r,i,n,o){m.Light.call(this,t,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==o?o:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(50,1,.5,500))},m.SpotLight.prototype=Object.create(m.Light.prototype),m.SpotLight.prototype.constructor=m.SpotLight,m.SpotLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.exponent=t.exponent,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.Cache={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},m.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},m.Loader.prototype={constructor:m.Loader,crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var i=[],n=0;n<t.length;++n)i[n]=this.createMaterial(t[n],e,r);return i},createMaterial:function(){var t,e,r;return function(i,n,o){function a(t,r,i,a,s){t=n+t;var c=m.Loader.Handlers.get(t);return null!==c?t=c.load(t):(e.setCrossOrigin(o),t=e.load(t)),void 0!==r&&(t.repeat.fromArray(r),1!==r[0]&&(t.wrapS=m.RepeatWrapping),1!==r[1]&&(t.wrapT=m.RepeatWrapping)),void 0!==i&&t.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(t.wrapS=m.RepeatWrapping),"mirror"===a[0]&&(t.wrapS=m.MirroredRepeatWrapping),"repeat"===a[1]&&(t.wrapT=m.RepeatWrapping),"mirror"===a[1]&&(t.wrapT=m.MirroredRepeatWrapping)),void 0!==s&&(t.anisotropy=s),r=m.Math.generateUUID(),h[r]=t,r}void 0===t&&(t=new m.Color),void 0===e&&(e=new m.TextureLoader),void 0===r&&(r=new m.MaterialLoader);var s,h={},c={uuid:m.Math.generateUUID(),type:"MeshLambertMaterial"};for(s in i){var l=i[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=l;break;case"blending":c.blending=m[l];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":c.color=t.fromArray(l).getHex();break;case"colorSpecular":c.specular=t.fromArray(l).getHex();break;case"colorEmissive":c.emissive=t.fromArray(l).getHex();break;case"specularCoef":c.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(c.type="MeshPhongMaterial");break;case"mapDiffuse":c.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":c.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":c.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=m.BackSide;break;case"doubleSided":c.side=m.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[s]=l;break;case"vertexColors":!0===l&&(c.vertexColors=m.VertexColors),"face"===l&&(c.vertexColors=m.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,l)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,1>c.opacity&&(c.transparent=!0),r.setTextures(h),r.parse(c)}}()},m.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r+1];if(e[r].test(t))return n}return null}},m.XHRLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.XHRLoader.prototype={constructor:m.XHRLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return e&&setTimeout(function(){e(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",t,!0),a.addEventListener("load",function(r){var o=r.target.response;m.Cache.add(t,o),200===this.status?(e&&e(o),n.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),n.manager.itemEnd(t)):(i&&i(r),n.manager.itemError(t))},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(t),a},setPath:function(t){this.path=t},setResponseType:function(t){this.responseType=t},setWithCredentials:function(t){this.withCredentials=t}},m.FontLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.FontLoader.prototype={constructor:m.FontLoader,load:function(t,e,r,i){new m.XHRLoader(this.manager).load(t,function(t){e(new m.Font(JSON.parse(t.substring(65,t.length-2))))},r,i)}},m.ImageLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.ImageLoader.prototype={constructor:m.ImageLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return n.manager.itemStart(t),e?setTimeout(function(){e(o),n.manager.itemEnd(t)},0):n.manager.itemEnd(t),o;var a=document.createElement("img");return a.addEventListener("load",function(r){m.Cache.add(t,this),e&&e(this),n.manager.itemEnd(t)},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:m.DefaultLoadingManager,this.withCredentials=!1},m.JSONLoader.prototype={constructor:m.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(t,e,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:m.Loader.prototype.extractUrlBase(t),a=new m.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var i=(r=JSON.parse(r)).metadata;if(void 0!==i&&void 0!==(i=i.type)){if("object"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),e(r.geometry,r.materials)},r,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){var r=new m.Geometry,i=void 0!==t.scale?1/t.scale:1;return function(e){var i,n,o,a,s,h,c,l,u,p,d,f,g,v=t.faces;h=t.vertices;var y=t.normals,x=t.colors,b=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&b++;for(i=0;i<b;i++)r.faceVertexUvs[i]=[]}for(a=0,s=h.length;a<s;)i=new m.Vector3,i.x=h[a++]*e,i.y=h[a++]*e,i.z=h[a++]*e,r.vertices.push(i);for(a=0,s=v.length;a<s;)if(e=v[a++],u=1&e,o=2&e,i=8&e,c=16&e,p=32&e,h=64&e,e&=128,u){if(u=new m.Face3,u.a=v[a],u.b=v[a+1],u.c=v[a+3],d=new m.Face3,d.a=v[a+1],d.b=v[a+2],d.c=v[a+3],a+=4,o&&(o=v[a++],u.materialIndex=o,d.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),2!==n&&r.faceVertexUvs[i][o].push(g),0!==n&&r.faceVertexUvs[i][o+1].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c]),d.normal.copy(u.normal)),p)for(i=0;4>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),2!==i&&u.vertexNormals.push(p),0!==i&&d.vertexNormals.push(p);if(h&&(h=v[a++],h=x[h],u.color.setHex(h),d.color.setHex(h)),e)for(i=0;4>i;i++)h=v[a++],h=x[h],2!==i&&u.vertexColors.push(new m.Color(h)),0!==i&&d.vertexColors.push(new m.Color(h));r.faces.push(u),r.faces.push(d)}else{if(u=new m.Face3,u.a=v[a++],u.b=v[a++],u.c=v[a++],o&&(o=v[a++],u.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),r.faceVertexUvs[i][o].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c])),p)for(i=0;3>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),u.vertexNormals.push(p);if(h&&(h=v[a++],u.color.setHex(x[h])),e)for(i=0;3>i;i++)h=v[a++],u.vertexColors.push(new m.Color(x[h]));r.faces.push(u)}}(i),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e)r.skinWeights.push(new m.Vector4(t.skinWeights[i],1<e?t.skinWeights[i+1]:0,2<e?t.skinWeights[i+2]:0,3<e?t.skinWeights[i+3]:0));if(t.skinIndices)for(i=0,n=t.skinIndices.length;i<n;i+=e)r.skinIndices.push(new m.Vector4(t.skinIndices[i],1<e?t.skinIndices[i+1]:0,2<e?t.skinIndices[i+2]:0,3<e?t.skinIndices[i+3]:0));r.bones=t.bones,r.bones&&0<r.bones.length&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){r.morphTargets[i]={},r.morphTargets[i].name=t.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,h=a.length;s<h;s+=3){var c=new m.Vector3;c.x=a[s]*e,c.y=a[s+1]*e,c.z=a[s+2]*e,o.push(c)}}if(void 0!==t.morphColors&&0<t.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),e=r.faces,o=t.morphColors[0].colors,i=0,n=e.length;i<n;i++)e[i].color.fromArray(o,3*i)}(i),function(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var o=m.AnimationClip.parseAnimation(i[n],r.bones);o&&e.push(o)}r.morphTargets&&(i=m.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),e=e.concat(i)),0<e.length&&(r.animations=e)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:r}:(i=m.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:r,materials:i})}},m.LoadingManager=function(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}},m.DefaultLoadingManager=new m.LoadingManager,m.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.BufferGeometryLoader.prototype={constructor:m.BufferGeometryLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},parse:function(t){var e=new m.BufferGeometry,r=t.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new i[r.type](r.array),e.setIndex(new m.BufferAttribute(r,1)));var n,o=t.data.attributes;for(n in o){var a=o[n],r=new i[a.type](a.array);e.addAttribute(n,new m.BufferAttribute(r,a.itemSize))}if(void 0!==(i=t.data.groups||t.data.drawcalls||t.data.offsets))for(n=0,r=i.length;n!==r;++n)o=i[n],e.addGroup(o.start,o.count,o.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(i=new m.Vector3,void 0!==t.center&&i.fromArray(t.center),e.boundingSphere=new m.Sphere(i,t.radius)),e}},m.MaterialLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.textures={}},m.MaterialLoader.prototype={constructor:m.MaterialLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new m[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale&&(r=t.normalScale,!1===Array.isArray(r)&&(r=[r,r]),e.normalScale=(new m.Vector2).fromArray(r)),void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=m.MultiplyOperation),t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}},m.ObjectLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.texturePath=""},m.ObjectLoader.prototype={constructor:m.ObjectLoader,load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new m.XHRLoader(n.manager).load(t,function(t){n.parse(JSON.parse(t),e)},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(n)}),i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),n=this.parseObject(t.object,r,i);return t.animations&&(n.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(n),n},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new m.JSONLoader,i=new m.BufferGeometryLoader,n=0,o=t.length;n<o;n++){var a,s=t[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new m[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new m.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new m.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new m.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new m.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new m.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new m.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new m.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new m.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new m.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new m.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new m.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new m.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new m.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"LatheGeometry":a=new m.LatheGeometry(s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new m.MaterialLoader;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=i.parse(t[n]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=m.AnimationClip.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&0<t.length){var n=new m.LoadingManager(e),o=new m.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);for(var n=0,a=t.length;n<a;n++){var s=t[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})}(h)}}return i},parseTextures:function(t,e){function r(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),m[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new m.Texture(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new m.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new m.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var t=new m.Matrix4;return function(e,r,i){function n(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t)return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}var a;switch(e.type){case"Scene":a=new m.Scene;break;case"PerspectiveCamera":a=new m.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":a=new m.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new m.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new m.DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new m.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new m.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":a=new m.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":a=n(e.geometry);var s=o(e.material);a=a.bones&&0<a.bones.length?new m.SkinnedMesh(a,s):new m.Mesh(a,s);break;case"LOD":a=new m.LOD;break;case"Line":a=new m.Line(n(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":a=new m.Points(n(e.geometry),o(e.material));break;case"Sprite":a=new m.Sprite(o(e.material));break;case"Group":a=new m.Group;break;default:a=new m.Object3D}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(this.parseObject(e.children[h],r,i));if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){var c=e[s];void 0!==(h=a.getObjectByProperty("uuid",c.object))&&a.addLevel(h,c.distance)}return a}}()},m.TextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.TextureLoader.prototype={constructor:m.TextureLoader,load:function(t,e,r,i){var n=new m.Texture,o=new m.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){n.image=t,n.needsUpdate=!0,void 0!==e&&e(n)},r,i),n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.CubeTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.CubeTextureLoader.prototype={constructor:m.CubeTextureLoader,load:function(t,e,r,i){var n=new m.CubeTexture([]),o=new m.ImageLoader(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;for(r=0;r<t.length;++r)!function(r){o.load(t[r],function(t){n.images[r]=t,6==++a&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}(r);return n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.DataTextureLoader=m.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.BinaryTextureLoader.prototype={constructor:m.BinaryTextureLoader,load:function(t,e,r,i){var n=this,o=new m.DataTexture,a=new m.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){(t=n._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:m.ClampToEdgeWrapping,o.wrapT=void 0!==t.wrapT?t.wrapT:m.ClampToEdgeWrapping,o.magFilter=void 0!==t.magFilter?t.magFilter:m.LinearFilter,o.minFilter=void 0!==t.minFilter?t.minFilter:m.LinearMipMapLinearFilter,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=m.LinearFilter),o.needsUpdate=!0,e&&e(o,t))},r,i),o}},m.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.CompressedTextureLoader.prototype={constructor:m.CompressedTextureLoader,load:function(t,e,r,i){var n=this,o=[],a=new m.CompressedTexture;a.image=o;var s=new m.XHRLoader(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,c=0,l=t.length;c<l;++c)!function(c){s.load(t[c],function(t){t=n._parser(t,!0),o[c]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(h+=1)&&(1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a))},r,i)}(c);else s.load(t,function(t){if((t=n._parser(t,!0)).isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,i=0;i<r;i++){o[i]={mipmaps:[]};for(var s=0;s<t.mipmapCount;s++)o[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+s]),o[i].format=t.format,o[i].width=t.width,o[i].height=t.height}else a.image.width=t.width,a.image.height=t.height,a.mipmaps=t.mipmaps;1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a)},r,i);return a},setPath:function(t){this.path=t}},m.Material=function(){Object.defineProperty(this,"id",{value:m.MaterialIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Material",this.side=m.FrontSide,this.opacity=1,this.transparent=!1,this.blending=m.NormalBlending,this.blendSrc=m.SrcAlphaFactor,this.blendDst=m.OneMinusSrcAlphaFactor,this.blendEquation=m.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=m.LessEqualDepth,this.colorWrite=this.depthWrite=this.depthTest=!0,this.precision=null,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this._needsUpdate=this.visible=!0},m.Material.prototype={constructor:m.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var i=this[e];void 0===i?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):i instanceof m.Color?i.set(r):i instanceof m.Vector3&&r instanceof m.Vector3?i.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof m.Color&&(i.color=this.color.getHex()),.5!==this.roughness&&(i.roughness=this.roughness),.5!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof m.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof m.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof m.Texture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap instanceof m.Texture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof m.Texture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof m.Texture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof m.Texture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof m.Texture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof m.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof m.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof m.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof m.Texture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof m.Texture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==m.NoColors&&(i.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==m.SmoothShading&&(i.shading=this.shading),void 0!==this.blending&&this.blending!==m.NormalBlending&&(i.blending=this.blending),void 0!==this.side&&this.side!==m.FrontSide&&(i.side=this.side),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),r&&(r=e(t.textures),t=e(t.images),0<r.length&&(i.textures=r),0<t.length&&(i.images=t)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.side=t.side,this.opacity=t.opacity,this.transparent=t.transparent,this.blending=t.blending,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.overdraw=t.overdraw,this.visible=t.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Material.prototype),m.MaterialIdCount=0,m.LineBasicMaterial=function(t){m.Material.call(this),this.type="LineBasicMaterial",this.color=new m.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineBasicMaterial.prototype=Object.create(m.Material.prototype),m.LineBasicMaterial.prototype.constructor=m.LineBasicMaterial,m.LineBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.LineDashedMaterial=function(t){m.Material.call(this),this.type="LineDashedMaterial",this.color=new m.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineDashedMaterial.prototype=Object.create(m.Material.prototype),m.LineDashedMaterial.prototype.constructor=m.LineDashedMaterial,m.LineDashedMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.MeshBasicMaterial=function(t){m.Material.call(this),this.type="MeshBasicMaterial",this.color=new m.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshBasicMaterial.prototype=Object.create(m.Material.prototype),m.MeshBasicMaterial.prototype.constructor=m.MeshBasicMaterial,m.MeshBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},m.MeshLambertMaterial=function(t){m.Material.call(this),this.type="MeshLambertMaterial",this.color=new m.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshLambertMaterial.prototype=Object.create(m.Material.prototype),m.MeshLambertMaterial.prototype.constructor=m.MeshLambertMaterial,m.MeshLambertMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshPhongMaterial=function(t){m.Material.call(this),this.type="MeshPhongMaterial",this.color=new m.Color(16777215),this.specular=new m.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshPhongMaterial.prototype=Object.create(m.Material.prototype),m.MeshPhongMaterial.prototype.constructor=m.MeshPhongMaterial,m.MeshPhongMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshStandardMaterial=function(t){m.Material.call(this),this.type="MeshStandardMaterial",this.color=new m.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshStandardMaterial.prototype=Object.create(m.Material.prototype),m.MeshStandardMaterial.prototype.constructor=m.MeshStandardMaterial,m.MeshStandardMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshDepthMaterial=function(t){m.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(t)},m.MeshDepthMaterial.prototype=Object.create(m.Material.prototype),m.MeshDepthMaterial.prototype.constructor=m.MeshDepthMaterial,m.MeshDepthMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MeshNormalMaterial=function(t){m.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},m.MeshNormalMaterial.prototype=Object.create(m.Material.prototype),m.MeshNormalMaterial.prototype.constructor=m.MeshNormalMaterial,m.MeshNormalMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MultiMaterial=function(t){this.uuid=m.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},m.MultiMaterial.prototype={constructor:m.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;i<n;i++){var o=r[i].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},m.PointsMaterial=function(t){m.Material.call(this),this.type="PointsMaterial",this.color=new m.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.PointsMaterial.prototype=Object.create(m.Material.prototype),m.PointsMaterial.prototype.constructor=m.PointsMaterial,m.PointsMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.ShaderMaterial=function(t){m.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=m.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))},m.ShaderMaterial.prototype=Object.create(m.Material.prototype),m.ShaderMaterial.prototype.constructor=m.ShaderMaterial,m.ShaderMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=m.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},m.ShaderMaterial.prototype.toJSON=function(t){return t=m.Material.prototype.toJSON.call(this,t),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},m.RawShaderMaterial=function(t){m.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},m.RawShaderMaterial.prototype=Object.create(m.ShaderMaterial.prototype),m.RawShaderMaterial.prototype.constructor=m.RawShaderMaterial,m.SpriteMaterial=function(t){m.Material.call(this),this.type="SpriteMaterial",this.color=new m.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},m.SpriteMaterial.prototype=Object.create(m.Material.prototype),m.SpriteMaterial.prototype.constructor=m.SpriteMaterial,m.SpriteMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.fog=t.fog,this},m.Texture=function(t,e,r,i,n,o,a,s,h){Object.defineProperty(this,"id",{value:m.TextureIdCount++}),this.uuid=m.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==t?t:m.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:m.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:m.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:m.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:m.LinearFilter,this.minFilter=void 0!==o?o:m.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:m.RGBAFormat,this.type=void 0!==s?s:m.UnsignedByteType,this.offset=new m.Vector2(0,0),this.repeat=new m.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},m.Texture.DEFAULT_IMAGE=void 0,m.Texture.DEFAULT_MAPPING=m.UVMapping,m.Texture.prototype={constructor:m.Texture,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=m.Math.generateUUID()),void 0===t.images[r.uuid]){var i,n=t.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:(i=document.createElement("canvas"),i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0,r.width,r.height)),i=2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"),n[o]={uuid:a,url:i}}e.image=r.uuid}return t.textures[this.uuid]=e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===m.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),0>t.x||1<t.x)switch(this.wrapS){case m.RepeatWrapping:t.x-=Math.floor(t.x);break;case m.ClampToEdgeWrapping:t.x=0>t.x?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x-=Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case m.RepeatWrapping:t.y-=Math.floor(t.y);break;case m.ClampToEdgeWrapping:t.y=0>t.y?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y-=Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},m.EventDispatcher.prototype.apply(m.Texture.prototype),m.TextureIdCount=0,m.CanvasTexture=function(t,e,r,i,n,o,a,s,h){m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.needsUpdate=!0},m.CanvasTexture.prototype=Object.create(m.Texture.prototype),m.CanvasTexture.prototype.constructor=m.CanvasTexture,m.CubeTexture=function(t,e,r,i,n,o,a,s,h){e=void 0!==e?e:m.CubeReflectionMapping,m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.images=t,this.flipY=!1},m.CubeTexture.prototype=Object.create(m.Texture.prototype),m.CubeTexture.prototype.constructor=m.CubeTexture,m.CubeTexture.prototype.copy=function(t){return m.Texture.prototype.copy.call(this,t),this.images=t.images,this},m.CompressedTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1},m.CompressedTexture.prototype=Object.create(m.Texture.prototype),m.CompressedTexture.prototype.constructor=m.CompressedTexture,m.DataTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={data:t,width:e,height:r},this.magFilter=void 0!==h?h:m.NearestFilter,this.minFilter=void 0!==c?c:m.NearestFilter,this.generateMipmaps=this.flipY=!1},m.DataTexture.prototype=Object.create(m.Texture.prototype),m.DataTexture.prototype.constructor=m.DataTexture,m.VideoTexture=function(t,e,r,i,n,o,a,s,h){function c(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)}m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.generateMipmaps=!1;var l=this;c()},m.VideoTexture.prototype=Object.create(m.Texture.prototype),m.VideoTexture.prototype.constructor=m.VideoTexture,m.Group=function(){m.Object3D.call(this),this.type="Group"},m.Group.prototype=Object.create(m.Object3D.prototype),m.Group.prototype.constructor=m.Group,m.Points=function(t,e){m.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.PointsMaterial({color:16777215*Math.random()})},m.Points.prototype=Object.create(m.Object3D.prototype),m.Points.prototype.constructor=m.Points,m.Points.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(h);var c=i.ray.origin.distanceTo(s);c<i.near||c>i.far||n.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,h=this.matrixWorld,c=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(h),!1!==i.ray.intersectsSphere(r)){t.getInverse(h),e.copy(i.ray).applyMatrix4(t);var l=(c/=(this.scale.x+this.scale.y+this.scale.z)/3)*c,c=new m.Vector3;if(s instanceof m.BufferGeometry){var u=s.index,s=s.attributes.position.array;if(null!==u)for(var p=u.array,u=0,d=p.length;u<d;u++){var f=p[u];c.fromArray(s,3*f),o(c,f)}else for(u=0,p=s.length/3;u<p;u++)c.fromArray(s,3*u),o(c,u)}else for(c=s.vertices,u=0,p=c.length;u<p;u++)o(c[u],u)}}}(),m.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Line=function(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new m.LineSegments(t,e);m.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.LineBasicMaterial({color:16777215*Math.random()})},m.Line.prototype=Object.create(m.Object3D.prototype),m.Line.prototype.constructor=m.Line,m.Line.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){var o=(o=i.linePrecision)*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==i.ray.intersectsSphere(r)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=new m.Vector3,c=new m.Vector3,s=new m.Vector3,l=new m.Vector3,u=this instanceof m.LineSegments?2:1;if(a instanceof m.BufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var p=p.array,a=0,f=p.length-1;a<f;a+=u){var g=p[a+1];h.fromArray(d,3*p[a]),c.fromArray(d,3*g),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,f=d.length/3-1;a<f;a+=u)h.fromArray(d,3*a),c.fromArray(d,3*a+3),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof m.Geometry)for(h=a.vertices,c=h.length,a=0;a<c-1;a+=u)(g=e.distanceSqToSegment(h[a],h[a+1],l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),m.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.LineStrip=0,m.LinePieces=1,m.LineSegments=function(t,e){m.Line.call(this,t,e),this.type="LineSegments"},m.LineSegments.prototype=Object.create(m.Line.prototype),m.LineSegments.prototype.constructor=m.LineSegments,m.Mesh=function(t,e){m.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=m.TrianglesDrawMode,this.updateMorphTargets()},m.Mesh.prototype=Object.create(m.Object3D.prototype),m.Mesh.prototype.constructor=m.Mesh,m.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},m.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},m.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},m.Mesh.prototype.raycast=function(){function t(t,e,r,i,n,o,a){return m.Triangle.barycoordFromPoint(t,e,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),a.multiplyScalar(g.z),n.add(o).add(a),n.clone()}function e(t,e,r,i,n,o,a){var s=t.material;return null===(s.side===m.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==m.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(t.matrixWorld),r=e.ray.origin.distanceTo(y),r<e.near||r>e.far?null:{distance:r,point:y.clone(),object:t})}function r(r,i,n,o,c,l,u,g){return a.fromArray(o,3*l),s.fromArray(o,3*u),h.fromArray(o,3*g),(r=e(r,i,n,a,s,h,v))&&(c&&(p.fromArray(c,2*l),d.fromArray(c,2*u),f.fromArray(c,2*g),r.uv=t(v,a,s,h,p,d,f)),r.face=new m.Face3(l,u,g,m.Triangle.normal(a,s,h)),r.faceIndex=l),r}var i=new m.Matrix4,n=new m.Ray,o=new m.Sphere,a=new m.Vector3,s=new m.Vector3,h=new m.Vector3,c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=new m.Vector2,d=new m.Vector2,f=new m.Vector2,g=new m.Vector3,v=new m.Vector3,y=new m.Vector3;return function(g,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),!1!==g.ray.intersectsSphere(o)&&(i.getInverse(_),n.copy(g.ray).applyMatrix4(i),null===x.boundingBox||!1!==n.intersectsBox(x.boundingBox)))){var M,w;if(x instanceof m.BufferGeometry){var S,E,b=x.index,x=(_=x.attributes).position.array;if(void 0!==_.uv&&(M=_.uv.array),null!==b)for(var _=b.array,T=0,C=_.length;T<C;T+=3)b=_[T],S=_[T+1],E=_[T+2],(w=r(this,g,n,x,M,b,S,E))&&(w.faceIndex=Math.floor(T/3),y.push(w));else for(T=0,C=x.length;T<C;T+=9)b=T/3,S=b+1,E=b+2,(w=r(this,g,n,x,M,b,S,E))&&(w.index=b,y.push(w))}else if(x instanceof m.Geometry){var L,A,T=!0==(_=b instanceof m.MultiMaterial)?b.materials:null,C=x.vertices;S=x.faces,0<(E=x.faceVertexUvs[0]).length&&(M=E);for(var P=0,R=S.length;P<R;P++){var U=S[P];if(void 0!==(w=!0===_?T[U.materialIndex]:b)){if(E=C[U.a],L=C[U.b],A=C[U.c],!0===w.morphTargets){w=x.morphTargets;var k=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),h.set(0,0,0);for(var D=0,I=w.length;D<I;D++){var F=k[D];if(0!==F){var B=w[D].vertices;a.addScaledVector(c.subVectors(B[U.a],E),F),s.addScaledVector(l.subVectors(B[U.b],L),F),h.addScaledVector(u.subVectors(B[U.c],A),F)}}a.add(E),s.add(L),h.add(A),E=a,L=s,A=h}(w=e(this,g,n,E,L,A,v))&&(M&&(k=M[P],p.copy(k[0]),d.copy(k[1]),f.copy(k[2]),w.uv=t(v,E,L,A,p,d,f)),w.face=U,w.faceIndex=P,y.push(w))}}}}}}(),m.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Bone=function(t){m.Object3D.call(this),this.type="Bone",this.skin=t},m.Bone.prototype=Object.create(m.Object3D.prototype),m.Bone.prototype.constructor=m.Bone,m.Bone.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this},m.Skeleton=function(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new m.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=m.Math.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new m.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,m.RGBAFormat,m.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new m.Matrix4)},m.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new m.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},m.Skeleton.prototype.pose=function(){for(var t,e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},m.Skeleton.prototype.update=function(){var t=new m.Matrix4;return function(){for(var e=0,r=this.bones.length;e<r;e++)t.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),m.Skeleton.prototype.clone=function(){return new m.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},m.SkinnedMesh=function(t,e,r){if(m.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m.Matrix4,this.bindMatrixInverse=new m.Matrix4,t=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],e=new m.Bone(this),t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],-1!==i.parent&&null!==i.parent?t[i.parent].add(t[n]):this.add(t[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new m.Skeleton(t,void 0,r),this.matrixWorld)},m.SkinnedMesh.prototype=Object.create(m.Mesh.prototype),m.SkinnedMesh.prototype.constructor=m.SkinnedMesh,m.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},m.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},m.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof m.Geometry)for(i=0;i<this.geometry.skinWeights.length;i++){var t=1/(e=this.geometry.skinWeights[i]).lengthManhattan();1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry instanceof m.BufferGeometry)for(var e=new m.Vector4,r=this.geometry.attributes.skinWeight,i=0;i<r.count;i++)e.x=r.getX(i),e.y=r.getY(i),e.z=r.getZ(i),e.w=r.getW(i),t=1/e.lengthManhattan(),1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0),r.setXYZW(i,e.x,e.y,e.z,e.w)},m.SkinnedMesh.prototype.updateMatrixWorld=function(t){m.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},m.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},m.LOD=function(){m.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},m.LOD.prototype=Object.create(m.Object3D.prototype),m.LOD.prototype.constructor=m.LOD,m.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},m.LOD.prototype.getObjectForDistance=function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},m.LOD.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,r)}}(),m.LOD.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(r){var i=this.levels;if(1<i.length){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),r=t.distanceTo(e),i[0].object.visible=!0;for(var n=1,o=i.length;n<o&&r>=i[n].distance;n++)i[n-1].object.visible=!1,i[n].object.visible=!0;for(;n<o;n++)i[n].object.visible=!1}}}(),m.LOD.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},m.LOD.prototype.toJSON=function(t){(t=m.Object3D.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,i=e.length;r<i;r++){var n=e[r];t.object.levels.push({object:n.object.uuid,distance:n.distance})}return t},m.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new m.BufferGeometry;return i.setIndex(new m.BufferAttribute(t,1)),i.addAttribute("position",new m.BufferAttribute(e,3)),i.addAttribute("uv",new m.BufferAttribute(r,2)),function(t){m.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new m.SpriteMaterial}}(),m.Sprite.prototype=Object.create(m.Object3D.prototype),m.Sprite.prototype.constructor=m.Sprite,m.Sprite.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(t);i>this.scale.x*this.scale.y||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),m.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},m.Particle=m.Sprite,m.LensFlare=function(t,e,r,i,n){m.Object3D.call(this),this.lensFlares=[],this.positionScreen=new m.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,i,n)},m.LensFlare.prototype=Object.create(m.Object3D.prototype),m.LensFlare.prototype.constructor=m.LensFlare,m.LensFlare.prototype.add=function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new m.Color(16777215)),void 0===i&&(i=m.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},m.LensFlare.prototype.updateLensFlares=function(){var t,e,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+n*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},m.LensFlare.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},m.Scene=function(){m.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},m.Scene.prototype=Object.create(m.Object3D.prototype),m.Scene.prototype.constructor=m.Scene,m.Scene.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},m.Fog=function(t,e,r){this.name="",this.color=new m.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},m.Fog.prototype.clone=function(){return new m.Fog(this.color.getHex(),this.near,this.far)},m.FogExp2=function(t,e){this.name="",this.color=new m.Color(t),this.density=void 0!==e?e:25e-5},m.FogExp2.prototype.clone=function(){return new m.FogExp2(this.color.getHex(),this.density)},m.ShaderChunk={},m.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",m.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",m.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",m.ShaderChunk.ambient_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\treturn PI * ambientLightColor;\n}\n",m.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\treflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n#endif\n",m.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",m.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",m.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",m.ShaderChunk.bsdfs="float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t  return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = alpha * alpha;\n\tfloat gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );\n\tfloat gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );\n\treturn 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = alpha * alpha;\n\tfloat denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / ( denom * 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 = roughness * 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_Smith( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );\n}",m.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",m.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",m.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",m.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",m.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",m.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\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 square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\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}\nvec3 inputToLinear( in vec3 a ) {\n\t#ifdef GAMMA_INPUT\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n",m.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",m.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",m.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",m.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\ttotalEmissiveLight *= emissiveColor.rgb;\n#endif\n",m.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",m.ShaderChunk.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 DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvarying vec3 vReflect;\n\tuniform float refractionRatio;\n#endif\n",m.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t#else\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t#endif\n#endif\n",m.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n#endif",m.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\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",m.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",m.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",m.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tdirectLight = getPointDirectLight( pointLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tdirectLight = getSpotDirectLight( spotLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectLight = getDirectionalDirectLight( directionalLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.lights_pars="#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\tIncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tIncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\t\treturn directLight;\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 angleCos;\n\t\tfloat exponent;\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\tIncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat spotEffect = dot( directLight.direction, spotLight.direction );\n\t\tif ( spotEffect > spotLight.angleCos ) {\n\t\t\tfloat spotEffect = dot( spotLight.direction, directLight.direction );\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t}\n\t\treturn directLight;\n\t}\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\treturn PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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#else\n\t\t\tvec3 envMapColor = vec3( 0.0 );\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\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( square( 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\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\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 = flipNormal * 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * 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#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",m.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",m.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\nvarying 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\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\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)\n",m.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\n",m.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n\tvWorldPosition = worldPosition.xyz;\n#endif\n",m.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",m.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Standard\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n",m.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tdirectLight = getPointDirectLight( pointLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tdirectLight = getSpotDirectLight( spotLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tdirectLight = getDirectionalDirectLight( directionalLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( directionalLight.shadow ) ? 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 defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tirradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\tRE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",m.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",m.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",m.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",m.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",m.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",m.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\tdiffuseColor *= texelColor;\n#endif\n",m.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",m.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n#endif\n",m.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",m.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",m.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",m.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",m.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",m.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",m.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",m.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",m.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",m.ShaderChunk.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 unpackDepth( const in vec4 rgba_depth ) {\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\treturn dot( rgba_depth, bit_shift );\n\t}\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec3 offset = vec3( - 1, 0, 1 ) * shadowRadius * 2.0 * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxx, 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.xzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxy, 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.xzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyx, 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.yzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 21.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",m.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",m.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",m.ShaderChunk.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",m.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",m.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned  = bindMatrixInverse * skinned;\n#endif\n",m.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",m.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",m.ShaderChunk.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",m.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",m.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",m.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",m.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i,n=this.clone(t[r]);for(i in n)e[i]=n[i]}return e},clone:function(t){var e,r={};for(e in t){r[e]={};for(var i in t[e]){var n=t[e][i];n instanceof m.Color||n instanceof m.Vector2||n instanceof m.Vector3||n instanceof m.Vector4||n instanceof m.Matrix3||n instanceof m.Matrix4||n instanceof m.Texture?r[e][i]=n.clone():Array.isArray(n)?r[e][i]=n.slice():r[e][i]=n}}return r}},m.UniformsLib={common:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new m.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new m.Color(16777215)}},ambient:{ambientLightColor:{type:"fv",value:[]}},lights:{directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},angleCos:{type:"f"},exponent:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)}}},m.ShaderLib={basic:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.fog]),vertexShader:[m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"\t#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,"\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.indirectDiffuse;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},lambert:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.bsdfs,m.ShaderChunk.lights_pars,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_lambert_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.shadowmask_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.emissivemap_fragment,"\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );",m.ShaderChunk.lightmap_fragment,"\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();",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},phong:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},specular:{type:"c",value:new m.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.lights_phong_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_phong_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_phong_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_phong_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},standard:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.roughnessmap,m.UniformsLib.metalnessmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_standard_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.roughnessmap_pars_fragment,m.ShaderChunk.metalnessmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.roughnessmap_fragment,m.ShaderChunk.metalnessmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_standard_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:m.UniformsUtils.merge([m.UniformsLib.points,m.UniformsLib.fog]),vertexShader:["uniform float size;\nuniform float scale;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.project_vertex,"\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif",m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.map_particle_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_particle_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new m.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",m.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n\tdepth /= 1000.0;\n\tconst vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}},m.WebGLRenderer=function(t){function e(t,e,r,i){!0===I&&(t*=i,e*=i,r*=i),xt.clearColor(t,e,r,i)}function r(){xt.init(),xt.scissor(J.copy(st).multiplyScalar(at)),xt.viewport(tt.copy(ct).multiplyScalar(at)),e(rt.r,rt.g,rt.b,it)}function i(){K=X=null,Q="",Z=-1,xt.reset()}function n(t){t.preventDefault(),i(),r(),bt.clear()}function o(t){(t=t.target).removeEventListener("dispose",o);t:{var e=bt.get(t);if(t.image&&e.__image__webglTextureCube)gt.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)break t;gt.deleteTexture(e.__webglTexture)}bt.delete(t)}ft.textures--}function a(t){(t=t.target).removeEventListener("dispose",a);var e=bt.get(t),r=bt.get(t.texture);if(t&&void 0!==r.__webglTexture){if(gt.deleteTexture(r.__webglTexture),t instanceof m.WebGLRenderTargetCube)for(r=0;6>r;r++)gt.deleteFramebuffer(e.__webglFramebuffer[r]),gt.deleteRenderbuffer(e.__webglDepthbuffer[r]);else gt.deleteFramebuffer(e.__webglFramebuffer),gt.deleteRenderbuffer(e.__webglDepthbuffer);bt.delete(t.texture),bt.delete(t)}ft.textures--}function s(t){(t=t.target).removeEventListener("dispose",s),h(t),bt.delete(t)}function h(t){var e=bt.get(t).program;t.program=void 0,void 0!==e&&Mt.releaseProgram(e)}function c(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function u(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function p(t,e,r,i,n){var o;r.transparent?(i=O,o=++G):(i=V,o=++N),void 0!==(o=i[o])?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=pt.z,o.group=n):(o={id:t.id,object:t,geometry:e,material:r,z:pt.z,group:n},i.push(o))}function d(t,e){if(!1!==t.visible){if(t.layers.test(e.layers))if(t instanceof m.Light)B.push(t);else if(t instanceof m.Sprite)!1!==t.frustumCulled&&!0!==lt.intersectsObject(t)||H.push(t);else if(t instanceof m.LensFlare)j.push(t);else if(t instanceof m.ImmediateRenderObject)!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut)),p(t,null,t.material,pt.z,null);else if((t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&(t instanceof m.SkinnedMesh&&t.skeleton.update(),(!1===t.frustumCulled||!0===lt.intersectsObject(t))&&!0===(o=t.material).visible)){!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut));var r=_t.update(t);if(o instanceof m.MultiMaterial)for(var i=r.groups,n=o.materials,o=0,a=i.length;o<a;o++){var s=i[o],h=n[s.materialIndex];!0===h.visible&&p(t,r,h,pt.z,s)}else p(t,r,o,pt.z,null)}for(o=0,a=(r=t.children).length;o<a;o++)d(r[o],e)}}function f(t,e,r,i){for(var n=0,o=t.length;n<o;n++){var a=(c=t[n]).object,s=c.geometry,h=void 0===i?c.material:i,c=c.group;if(a.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a instanceof m.ImmediateRenderObject){g(h);var l=v(e,r,h,a);Q="",a.render(function(t){W.renderBufferImmediate(t,l,h)})}else W.renderBufferDirect(e,r,s,h,a,c)}}function g(t){t.side!==m.DoubleSide?xt.enable(gt.CULL_FACE):xt.disable(gt.CULL_FACE),xt.setFlipSided(t.side===m.BackSide),!0===t.transparent?xt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):xt.setBlending(m.NoBlending),xt.setDepthFunc(t.depthFunc),xt.setDepthTest(t.depthTest),xt.setDepthWrite(t.depthWrite),xt.setColorWrite(t.colorWrite),xt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i){et=0;var n=bt.get(r);if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==dt.hash&&(r.needsUpdate=!0),r.needsUpdate){t:{var o=bt.get(r),a=Mt.getParameters(r,dt,e,i),c=Mt.getProgramCode(r,a),l=o.program,u=!0;if(void 0===l)r.addEventListener("dispose",s);else if(l.code!==c)h(r);else{if(void 0!==a.shaderID)break t;u=!1}if(u&&(a.shaderID?(l=m.ShaderLib[a.shaderID],o.__webglShader={name:r.type,uniforms:m.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):o.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=o.__webglShader,l=Mt.acquireProgram(r,a,c),o.program=l,r.program=l),a=l.getAttributes(),r.morphTargets)for(c=r.numSupportedMorphTargets=0;c<W.maxMorphTargets;c++)0<=a["morphTarget"+c]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(c=r.numSupportedMorphNormals=0;c<W.maxMorphNormals;c++)0<=a["morphNormal"+c]&&r.numSupportedMorphNormals++;o.uniformsList=[];var p,a=o.__webglShader.uniforms,c=o.program.getUniforms();for(p in a)(l=c[p])&&o.uniformsList.push([o.__webglShader.uniforms[p],l]);for((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(o.lightsHash=dt.hash,a.ambientLightColor.value=dt.ambient,a.directionalLights.value=dt.directional,a.spotLights.value=dt.spot,a.pointLights.value=dt.point,a.hemisphereLights.value=dt.hemi,a.directionalShadowMap.value=dt.directionalShadowMap,a.directionalShadowMatrix.value=dt.directionalShadowMatrix,a.spotShadowMap.value=dt.spotShadowMap,a.spotShadowMatrix.value=dt.spotShadowMatrix,a.pointShadowMap.value=dt.pointShadowMap,a.pointShadowMatrix.value=dt.pointShadowMatrix),o.hasDynamicUniforms=!1,p=0,a=o.uniformsList.length;p<a;p++)if(!0===o.uniformsList[p][0].dynamic){o.hasDynamicUniforms=!0;break}}r.needsUpdate=!1}if(l=c=u=!1,o=n.program,p=o.getUniforms(),a=n.__webglShader.uniforms,o.id!==X&&(gt.useProgram(o.program),X=o.id,l=c=u=!0),r.id!==Z&&(Z=r.id,c=!0),(u||t!==K)&&(gt.uniformMatrix4fv(p.projectionMatrix,!1,t.projectionMatrix.elements),yt.logarithmicDepthBuffer&&gt.uniform1f(p.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==K&&(K=t,l=c=!0),(r instanceof m.ShaderMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial||r.envMap)&&void 0!==p.cameraPosition&&(pt.setFromMatrixPosition(t.matrixWorld),gt.uniform3f(p.cameraPosition,pt.x,pt.y,pt.z)),(r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshBasicMaterial||r instanceof m.MeshStandardMaterial||r instanceof m.ShaderMaterial||r.skinning)&&void 0!==p.viewMatrix&&gt.uniformMatrix4fv(p.viewMatrix,!1,t.matrixWorldInverse.elements)),r.skinning&&(i.bindMatrix&&void 0!==p.bindMatrix&&gt.uniformMatrix4fv(p.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&gt.uniformMatrix4fv(p.bindMatrixInverse,!1,i.bindMatrixInverse.elements),yt.floatVertexTextures&&i.skeleton&&i.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(u=y(),gt.uniform1i(p.boneTexture,u),W.setTexture(i.skeleton.boneTexture,u)),void 0!==p.boneTextureWidth&&gt.uniform1i(p.boneTextureWidth,i.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&gt.uniform1i(p.boneTextureHeight,i.skeleton.boneTextureHeight)):i.skeleton&&i.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&gt.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.skeleton.boneMatrices)),c){if((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(c=l,a.ambientLightColor.needsUpdate=c,a.directionalLights.needsUpdate=c,a.pointLights.needsUpdate=c,a.spotLights.needsUpdate=c,a.hemisphereLights.needsUpdate=c),e&&r.fog&&(a.fogColor.value=e.color,e instanceof m.Fog?(a.fogNear.value=e.near,a.fogFar.value=e.far):e instanceof m.FogExp2&&(a.fogDensity.value=e.density)),r instanceof m.MeshBasicMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial){a.opacity.value=r.opacity,a.diffuse.value=r.color,r.emissive&&a.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),a.map.value=r.map,a.specularMap.value=r.specularMap,a.alphaMap.value=r.alphaMap,r.aoMap&&(a.aoMap.value=r.aoMap,a.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d instanceof m.WebGLRenderTarget&&(d=d.texture),e=d.offset,d=d.repeat,a.offsetRepeat.value.set(e.x,e.y,d.x,d.y)),a.envMap.value=r.envMap,a.flipEnvMap.value=r.envMap instanceof m.WebGLRenderTargetCube?1:-1,a.reflectivity.value=r.reflectivity,a.refractionRatio.value=r.refractionRatio}r instanceof m.LineBasicMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity):r instanceof m.LineDashedMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.dashSize.value=r.dashSize,a.totalSize.value=r.dashSize+r.gapSize,a.scale.value=r.scale):r instanceof m.PointsMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.size.value=r.size*at,a.scale.value=A.clientHeight/2,a.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,a.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r instanceof m.MeshLambertMaterial?(r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap)):r instanceof m.MeshPhongMaterial?(a.specular.value=r.specular,a.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias)):r instanceof m.MeshStandardMaterial?(a.roughness.value=r.roughness,a.metalness.value=r.metalness,r.roughnessMap&&(a.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(a.metalnessMap.value=r.metalnessMap),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias),r.envMap&&(a.envMapIntensity.value=r.envMapIntensity)):r instanceof m.MeshDepthMaterial?(a.mNear.value=t.near,a.mFar.value=t.far,a.opacity.value=r.opacity):r instanceof m.MeshNormalMaterial&&(a.opacity.value=r.opacity),x(n.uniformsList)}if(gt.uniformMatrix4fv(p.modelViewMatrix,!1,i.modelViewMatrix.elements),p.normalMatrix&&gt.uniformMatrix3fv(p.normalMatrix,!1,i.normalMatrix.elements),void 0!==p.modelMatrix&&gt.uniformMatrix4fv(p.modelMatrix,!1,i.matrixWorld.elements),!0===n.hasDynamicUniforms){for(r=[],d=0,e=(n=n.uniformsList).length;d<e;d++)p=n[d][0],void 0!==(a=p.onUpdateCallback)&&(a.bind(p)(i,t),r.push(n[d]));x(r)}return o}function y(){var t=et;return t>=yt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+yt.maxTextures),et+=1,t}function x(t){for(var e,r,i=0,n=t.length;i<n;i++){var o=t[i][0];if(!1!==o.needsUpdate){var a=o.type;e=o.value;var s=t[i][1];switch(a){case"1i":gt.uniform1i(s,e);break;case"1f":gt.uniform1f(s,e);break;case"2f":gt.uniform2f(s,e[0],e[1]);break;case"3f":gt.uniform3f(s,e[0],e[1],e[2]);break;case"4f":gt.uniform4f(s,e[0],e[1],e[2],e[3]);break;case"1iv":gt.uniform1iv(s,e);break;case"3iv":gt.uniform3iv(s,e);break;case"1fv":gt.uniform1fv(s,e);break;case"2fv":gt.uniform2fv(s,e);break;case"3fv":gt.uniform3fv(s,e);break;case"4fv":gt.uniform4fv(s,e);break;case"Matrix2fv":gt.uniformMatrix2fv(s,!1,e);break;case"Matrix3fv":gt.uniformMatrix3fv(s,!1,e);break;case"Matrix4fv":gt.uniformMatrix4fv(s,!1,e);break;case"i":gt.uniform1i(s,e);break;case"f":gt.uniform1f(s,e);break;case"v2":gt.uniform2f(s,e.x,e.y);break;case"v3":gt.uniform3f(s,e.x,e.y,e.z);break;case"v4":gt.uniform4f(s,e.x,e.y,e.z,e.w);break;case"c":gt.uniform3f(s,e.r,e.g,e.b);break;case"sa":for(a=0;a<e.length;a++)for(var h in o.properties){var c=s[a][h];switch(r=e[a][h],o.properties[h].type){case"i":gt.uniform1i(c,r);break;case"f":gt.uniform1f(c,r);break;case"v2":gt.uniform2f(c,r.x,r.y);break;case"v3":gt.uniform3f(c,r.x,r.y,r.z);break;case"v4":gt.uniform4f(c,r.x,r.y,r.z,r.w);break;case"c":gt.uniform3f(c,r.r,r.g,r.b);break;case"m4":gt.uniformMatrix4fv(c,!1,r.elements)}}break;case"iv1":gt.uniform1iv(s,e);break;case"iv":gt.uniform3iv(s,e);break;case"fv1":gt.uniform1fv(s,e);break;case"fv":gt.uniform3fv(s,e);break;case"v2v":for(void 0===o._array&&(o._array=new Float32Array(2*e.length)),r=a=0,c=e.length;a<c;a++,r+=2)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y;gt.uniform2fv(s,o._array);break;case"v3v":for(void 0===o._array&&(o._array=new Float32Array(3*e.length)),r=a=0,c=e.length;a<c;a++,r+=3)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z;gt.uniform3fv(s,o._array);break;case"v4v":for(void 0===o._array&&(o._array=new Float32Array(4*e.length)),r=a=0,c=e.length;a<c;a++,r+=4)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z,o._array[r+3]=e[a].w;gt.uniform4fv(s,o._array);break;case"m2":gt.uniformMatrix2fv(s,!1,e.elements);break;case"m3":gt.uniformMatrix3fv(s,!1,e.elements);break;case"m3v":for(void 0===o._array&&(o._array=new Float32Array(9*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,9*a);gt.uniformMatrix3fv(s,!1,o._array);break;case"m4":gt.uniformMatrix4fv(s,!1,e.elements);break;case"m4v":for(void 0===o._array&&(o._array=new Float32Array(16*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,16*a);gt.uniformMatrix4fv(s,!1,o._array);break;case"t":if(r=y(),gt.uniform1i(s,r),!e)continue;e instanceof m.CubeTexture||Array.isArray(e.image)&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):W.setTexture(e,r);break;case"tv":for(void 0===o._array&&(o._array=[]),a=0,c=o.value.length;a<c;a++)o._array[a]=y();for(gt.uniform1iv(s,o._array),a=0,c=o.value.length;a<c;a++)e=o.value[a],r=o._array[a],e&&(e instanceof m.CubeTexture||e.image instanceof Array&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):W.setTexture(e,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function b(t,e,r){r?(gt.texParameteri(t,gt.TEXTURE_WRAP_S,L(e.wrapS)),gt.texParameteri(t,gt.TEXTURE_WRAP_T,L(e.wrapT)),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,L(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,L(e.minFilter))):(gt.texParameteri(t,gt.TEXTURE_WRAP_S,gt.CLAMP_TO_EDGE),gt.texParameteri(t,gt.TEXTURE_WRAP_T,gt.CLAMP_TO_EDGE),e.wrapS===m.ClampToEdgeWrapping&&e.wrapT===m.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,C(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,C(e.minFilter)),e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),!(r=vt.get("EXT_texture_filter_anisotropic"))||e.type===m.FloatType&&null===vt.get("OES_texture_float_linear")||e.type===m.HalfFloatType&&null===vt.get("OES_texture_half_float_linear")||!(1<e.anisotropy||bt.get(e).__currentAnisotropy)||(gt.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,W.getMaxAnisotropy())),bt.get(e).__currentAnisotropy=e.anisotropy)}function _(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElement("canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function M(t){return m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height)}function w(t,e){var r=bt.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",o),r.__image__webglTextureCube=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var i=t instanceof m.CompressedTexture,n=t.image[0]instanceof m.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?t.image[s].image:t.image[s]:_(t.image[s],yt.maxCubemapSize);var h=M(a[0]),c=L(t.format),l=L(t.type);for(b(gt.TEXTURE_CUBE_MAP,t,h),s=0;6>s;s++)if(i)for(var u,p=a[s].mipmaps,d=0,f=p.length;d<f;d++)u=p[d],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(c)?xt.compressedTexImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,c,l,u.data);else n?xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,a[s].width,a[s].height,0,c,l,a[s].data):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,c,l,a[s]);t.generateMipmaps&&h&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function S(t,e){xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,bt.get(t).__webglTexture)}function E(t,e,r,i){var n=L(e.texture.format),o=L(e.texture.type);xt.texImage2D(i,0,n,e.width,e.height,0,n,o,null),gt.bindFramebuffer(gt.FRAMEBUFFER,t),gt.framebufferTexture2D(gt.FRAMEBUFFER,r,i,bt.get(e.texture).__webglTexture,0),gt.bindFramebuffer(gt.FRAMEBUFFER,null)}function T(t,e){gt.bindRenderbuffer(gt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_COMPONENT16,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_ATTACHMENT,gt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_STENCIL,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_STENCIL_ATTACHMENT,gt.RENDERBUFFER,t)):gt.renderbufferStorage(gt.RENDERBUFFER,gt.RGBA4,e.width,e.height),gt.bindRenderbuffer(gt.RENDERBUFFER,null)}function C(t){return t===m.NearestFilter||t===m.NearestMipMapNearestFilter||t===m.NearestMipMapLinearFilter?gt.NEAREST:gt.LINEAR}function L(t){var e;if(t===m.RepeatWrapping)return gt.REPEAT;if(t===m.ClampToEdgeWrapping)return gt.CLAMP_TO_EDGE;if(t===m.MirroredRepeatWrapping)return gt.MIRRORED_REPEAT;if(t===m.NearestFilter)return gt.NEAREST;if(t===m.NearestMipMapNearestFilter)return gt.NEAREST_MIPMAP_NEAREST;if(t===m.NearestMipMapLinearFilter)return gt.NEAREST_MIPMAP_LINEAR;if(t===m.LinearFilter)return gt.LINEAR;if(t===m.LinearMipMapNearestFilter)return gt.LINEAR_MIPMAP_NEAREST;if(t===m.LinearMipMapLinearFilter)return gt.LINEAR_MIPMAP_LINEAR;if(t===m.UnsignedByteType)return gt.UNSIGNED_BYTE;if(t===m.UnsignedShort4444Type)return gt.UNSIGNED_SHORT_4_4_4_4;if(t===m.UnsignedShort5551Type)return gt.UNSIGNED_SHORT_5_5_5_1;if(t===m.UnsignedShort565Type)return gt.UNSIGNED_SHORT_5_6_5;if(t===m.ByteType)return gt.BYTE;if(t===m.ShortType)return gt.SHORT;if(t===m.UnsignedShortType)return gt.UNSIGNED_SHORT;if(t===m.IntType)return gt.INT;if(t===m.UnsignedIntType)return gt.UNSIGNED_INT;if(t===m.FloatType)return gt.FLOAT;if(null!==(e=vt.get("OES_texture_half_float"))&&t===m.HalfFloatType)return e.HALF_FLOAT_OES;if(t===m.AlphaFormat)return gt.ALPHA;if(t===m.RGBFormat)return gt.RGB;if(t===m.RGBAFormat)return gt.RGBA;if(t===m.LuminanceFormat)return gt.LUMINANCE;if(t===m.LuminanceAlphaFormat)return gt.LUMINANCE_ALPHA;if(t===m.AddEquation)return gt.FUNC_ADD;if(t===m.SubtractEquation)return gt.FUNC_SUBTRACT;if(t===m.ReverseSubtractEquation)return gt.FUNC_REVERSE_SUBTRACT;if(t===m.ZeroFactor)return gt.ZERO;if(t===m.OneFactor)return gt.ONE;if(t===m.SrcColorFactor)return gt.SRC_COLOR;if(t===m.OneMinusSrcColorFactor)return gt.ONE_MINUS_SRC_COLOR;if(t===m.SrcAlphaFactor)return gt.SRC_ALPHA;if(t===m.OneMinusSrcAlphaFactor)return gt.ONE_MINUS_SRC_ALPHA;if(t===m.DstAlphaFactor)return gt.DST_ALPHA;if(t===m.OneMinusDstAlphaFactor)return gt.ONE_MINUS_DST_ALPHA;if(t===m.DstColorFactor)return gt.DST_COLOR;if(t===m.OneMinusDstColorFactor)return gt.ONE_MINUS_DST_COLOR;if(t===m.SrcAlphaSaturateFactor)return gt.SRC_ALPHA_SATURATE;if(null!==(e=vt.get("WEBGL_compressed_texture_s3tc"))){if(t===m.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===m.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=vt.get("WEBGL_compressed_texture_pvrtc"))){if(t===m.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===m.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===m.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===m.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=vt.get("WEBGL_compressed_texture_etc1"))&&t===m.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(null!==(e=vt.get("EXT_blend_minmax"))){if(t===m.MinEquation)return e.MIN_EXT;if(t===m.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",m.REVISION);var A=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),P=void 0!==t.context?t.context:null,R=void 0!==t.alpha&&t.alpha,U=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,D=void 0!==t.antialias&&t.antialias,I=void 0===t.premultipliedAlpha||t.premultipliedAlpha,F=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,B=[],V=[],N=-1,O=[],G=-1,z=new Float32Array(8),H=[],j=[];this.domElement=A,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.gammaOutput=this.gammaInput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,X=null,q=null,Y=null,Z=-1,Q="",K=null,J=new m.Vector4,$=null,tt=new m.Vector4,et=0,rt=new m.Color(0),it=0,nt=A.width,ot=A.height,at=1,st=new m.Vector4(0,0,nt,ot),ht=!1,ct=new m.Vector4(0,0,nt,ot),lt=new m.Frustum,ut=new m.Matrix4,pt=new m.Vector3,dt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},ft={geometries:0,textures:0},mt={calls:0,vertices:0,faces:0,points:0};this.info={render:mt,memory:ft,programs:null};var gt;try{if(R={alpha:R,depth:U,stencil:k,antialias:D,premultipliedAlpha:I,preserveDrawingBuffer:F},null===(gt=P||A.getContext("webgl",R)||A.getContext("experimental-webgl",R))){if(null!==A.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}A.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var vt=new m.WebGLExtensions(gt);vt.get("OES_texture_float"),vt.get("OES_texture_float_linear"),vt.get("OES_texture_half_float"),vt.get("OES_texture_half_float_linear"),vt.get("OES_standard_derivatives"),vt.get("ANGLE_instanced_arrays"),vt.get("OES_element_index_uint")&&(m.BufferGeometry.MaxIndex=4294967296);var yt=new m.WebGLCapabilities(gt,vt,t),xt=new m.WebGLState(gt,vt,L),bt=new m.WebGLProperties,_t=new m.WebGLObjects(gt,bt,this.info),Mt=new m.WebGLPrograms(this,yt),wt=new m.WebGLLights;this.info.programs=Mt.programs;var St=new m.WebGLBufferRenderer(gt,vt,mt),Et=new m.WebGLIndexedBufferRenderer(gt,vt,mt);r(),this.context=gt,this.capabilities=yt,this.extensions=vt,this.properties=bt,this.state=xt;var Tt=new m.WebGLShadowMap(this,dt,_t);this.shadowMap=Tt;var Ct=new m.SpritePlugin(this,H),Lt=new m.LensFlarePlugin(this,j);this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){vt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var t;return function(){if(void 0!==t)return t;var e=vt.get("EXT_texture_filter_anisotropic");return t=null!==e?gt.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return yt.precision},this.getPixelRatio=function(){return at},this.setPixelRatio=function(t){void 0!==t&&(at=t,this.setSize(ct.z,ct.w,!1))},this.getSize=function(){return{width:nt,height:ot}},this.setSize=function(t,e,r){nt=t,ot=e,A.width=t*at,A.height=e*at,!1!==r&&(A.style.width=t+"px",A.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){xt.viewport(ct.set(t,e,r,i))},this.setScissor=function(t,e,r,i){xt.scissor(st.set(t,e,r,i))},this.setScissorTest=function(t){xt.setScissorTest(ht=t)},this.getClearColor=function(){return rt},this.setClearColor=function(t,r){rt.set(t),it=void 0!==r?r:1,e(rt.r,rt.g,rt.b,it)},this.getClearAlpha=function(){return it},this.setClearAlpha=function(t){it=t,e(rt.r,rt.g,rt.b,it)},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=gt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=gt.STENCIL_BUFFER_BIT),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){A.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(t,e,r){xt.initAttributes();var i=bt.get(t);if(t.hasPositions&&!i.position&&(i.position=gt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=gt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=gt.createBuffer()),t.hasColors&&!i.color&&(i.color=gt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.position),gt.bufferData(gt.ARRAY_BUFFER,t.positionArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.position),gt.vertexAttribPointer(e.position,3,gt.FLOAT,!1,0,0)),t.hasNormals){if(gt.bindBuffer(gt.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===m.FlatShading)for(var n=0,o=3*t.count;n<o;n+=9){var a=t.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,h=(a[n+1]+a[n+4]+a[n+7])/3,c=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=h,a[n+2]=c,a[n+3]=s,a[n+4]=h,a[n+5]=c,a[n+6]=s,a[n+7]=h,a[n+8]=c}gt.bufferData(gt.ARRAY_BUFFER,t.normalArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.normal),gt.vertexAttribPointer(e.normal,3,gt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.uv),gt.bufferData(gt.ARRAY_BUFFER,t.uvArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.uv),gt.vertexAttribPointer(e.uv,2,gt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==m.NoColors&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.color),gt.bufferData(gt.ARRAY_BUFFER,t.colorArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.color),gt.vertexAttribPointer(e.color,3,gt.FLOAT,!1,0,0)),xt.disableUnusedAttributes(),gt.drawArrays(gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o){g(i);var a=v(t,e,i,n),s=!1;if((t=r.id+"_"+a.id+"_"+i.wireframe)!==Q&&(Q=t,s=!0),void 0!==(e=n.morphTargetInfluences)){t=[];for(var h=0,s=e.length;h<s;h++)d=e[h],t.push([d,h]);t.sort(c),8<t.length&&(t.length=8);for(var l=r.morphAttributes,h=0,s=t.length;h<s;h++)d=t[h],z[h]=d[0],0!==d[0]?(e=d[1],!0===i.morphTargets&&l.position&&r.addAttribute("morphTarget"+h,l.position[e]),!0===i.morphNormals&&l.normal&&r.addAttribute("morphNormal"+h,l.normal[e])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+h),!0===i.morphNormals&&r.removeAttribute("morphNormal"+h));null!==(t=a.getUniforms()).morphTargetInfluences&&gt.uniform1fv(t.morphTargetInfluences,z),s=!0}if(e=r.index,h=r.attributes.position,!0===i.wireframe&&(e=_t.getWireframeAttribute(r)),null!==e?(t=Et).setIndex(e):t=St,s){var u,s=void 0;if(r instanceof m.InstancedBufferGeometry&&null===(u=vt.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),xt.initAttributes();var p,d=r.attributes,a=a.getAttributes(),l=i.defaultAttributeValues;for(p in a){var f=a[p];if(0<=f)if(void 0!==(M=d[p])){var y=M.itemSize,x=_t.getAttributeBuffer(M);if(M instanceof m.InterleavedBufferAttribute){var b=M.data,_=b.stride,M=M.offset;b instanceof m.InstancedInterleavedBuffer?(xt.enableAttributeAndDivisor(f,b.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=b.meshPerAttribute*b.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,_*b.array.BYTES_PER_ELEMENT,(s*_+M)*b.array.BYTES_PER_ELEMENT)}else M instanceof m.InstancedBufferAttribute?(xt.enableAttributeAndDivisor(f,M.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=M.meshPerAttribute*M.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,0,s*y*4)}else if(void 0!==l&&void 0!==(y=l[p]))switch(y.length){case 2:gt.vertexAttrib2fv(f,y);break;case 3:gt.vertexAttrib3fv(f,y);break;case 4:gt.vertexAttrib4fv(f,y);break;default:gt.vertexAttrib1fv(f,y)}}xt.disableUnusedAttributes()}null!==e&&gt.bindBuffer(gt.ELEMENT_ARRAY_BUFFER,_t.getAttributeBuffer(e))}if(u=1/0,null!==e?u=e.count:void 0!==h&&(u=h.count),p=r.drawRange.start,e=r.drawRange.count,h=null!==o?o.start:0,s=null!==o?o.count:1/0,o=Math.max(0,p,h),u=Math.min(0+u,p+e,h+s)-1,u=Math.max(0,u-o+1),n instanceof m.Mesh)if(!0===i.wireframe)xt.setLineWidth(i.wireframeLinewidth*(null===q?at:1)),t.setMode(gt.LINES);else switch(n.drawMode){case m.TrianglesDrawMode:t.setMode(gt.TRIANGLES);break;case m.TriangleStripDrawMode:t.setMode(gt.TRIANGLE_STRIP);break;case m.TriangleFanDrawMode:t.setMode(gt.TRIANGLE_FAN)}else n instanceof m.Line?(void 0===(i=i.linewidth)&&(i=1),xt.setLineWidth(i*(null===q?at:1)),n instanceof m.LineSegments?t.setMode(gt.LINES):t.setMode(gt.LINE_STRIP)):n instanceof m.Points&&t.setMode(gt.POINTS);r instanceof m.InstancedBufferGeometry&&0<r.maxInstancedCount?t.renderInstances(r,o,u):t.render(o,u)},this.render=function(t,e,r,i){if(0==e instanceof m.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=t.fog;Q="",Z=-1,K=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ut.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),lt.setFromMatrix(ut),B.length=0,G=N=-1,H.length=0,j.length=0,d(t,e),V.length=N+1,O.length=G+1,!0===W.sortObjects&&(V.sort(l),O.sort(u));var o,a,s,h,c,p,g=B,v=0,y=0,x=0,b=e.matrixWorldInverse,_=0,w=0,S=0,E=0,T=0;for(o=dt.shadowsPointLight=0,a=g.length;o<a;o++)if(s=g[o],h=s.color,c=s.intensity,p=s.distance,s instanceof m.AmbientLight)v+=h.r*c,y+=h.g*c,x+=h.b*c;else if(s instanceof m.DirectionalLight){var C=wt.get(s);C.color.copy(s.color).multiplyScalar(s.intensity),C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.directionalShadowMap[_]=s.shadow.map,dt.directionalShadowMatrix[_]=s.shadow.matrix,dt.directional[_++]=C}else s instanceof m.SpotLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(h).multiplyScalar(c),C.distance=p,C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),C.angleCos=Math.cos(s.angle),C.exponent=s.exponent,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.spotShadowMap[S]=s.shadow.map,dt.spotShadowMatrix[S]=s.shadow.matrix,dt.spot[S++]=C):s instanceof m.PointLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(s.color).multiplyScalar(s.intensity),C.distance=s.distance,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.pointShadowMap[w]=s.shadow.map,void 0===dt.pointShadowMatrix[w]&&(dt.pointShadowMatrix[w]=new m.Matrix4),pt.setFromMatrixPosition(s.matrixWorld).negate(),dt.pointShadowMatrix[w].identity().setPosition(pt),dt.point[w++]=C):s instanceof m.HemisphereLight&&((C=wt.get(s)).direction.setFromMatrixPosition(s.matrixWorld),C.direction.transformDirection(b),C.direction.normalize(),C.skyColor.copy(s.color).multiplyScalar(c),C.groundColor.copy(s.groundColor).multiplyScalar(c),dt.hemi[E++]=C);dt.ambient[0]=v,dt.ambient[1]=y,dt.ambient[2]=x,dt.directional.length=_,dt.spot.length=S,dt.point.length=w,dt.hemi.length=E,dt.shadows.length=T,dt.hash=_+","+w+","+S+","+E+","+T,Tt.render(t,e),mt.calls=0,mt.vertices=0,mt.faces=0,mt.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),t.overrideMaterial?(i=t.overrideMaterial,f(V,e,n,i),f(O,e,n,i)):(xt.setBlending(m.NoBlending),f(V,e,n),f(O,e,n)),Ct.render(t,e),Lt.render(t,e,tt),r&&(t=r.texture).generateMipmaps&&M(r)&&t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter&&(t=r instanceof m.WebGLRenderTargetCube?gt.TEXTURE_CUBE_MAP:gt.TEXTURE_2D,r=bt.get(r.texture).__webglTexture,xt.bindTexture(t,r),gt.generateMipmap(t),xt.bindTexture(t,null)),xt.setDepthTest(!0),xt.setDepthWrite(!0),xt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){t===m.CullFaceNone?xt.disable(gt.CULL_FACE):(e===m.FrontFaceDirectionCW?gt.frontFace(gt.CW):gt.frontFace(gt.CCW),t===m.CullFaceBack?gt.cullFace(gt.BACK):t===m.CullFaceFront?gt.cullFace(gt.FRONT):gt.cullFace(gt.FRONT_AND_BACK),xt.enable(gt.CULL_FACE))},this.setTexture=function(t,e){var r=bt.get(t);if(0<t.version&&r.__version!==t.version)if(void 0===(n=t.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t);else{void 0===r.__webglInit&&(r.__webglInit=!0,t.addEventListener("dispose",o),r.__webglTexture=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,t.unpackAlignment);var i=_(t.image,yt.maxTextureSize);(t.wrapS!==m.ClampToEdgeWrapping||t.wrapT!==m.ClampToEdgeWrapping||t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter)&&!1===M(i)&&((n=i)instanceof HTMLImageElement||n instanceof HTMLCanvasElement?((a=document.createElement("canvas")).width=m.Math.nearestPowerOfTwo(n.width),a.height=m.Math.nearestPowerOfTwo(n.height),a.getContext("2d").drawImage(n,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+a.width+"x"+a.height,n),i=a):i=n);var n=M(i),a=L(t.format),s=L(t.type);b(gt.TEXTURE_2D,t,n);var h=t.mipmaps;if(t instanceof m.DataTexture)if(0<h.length&&n){for(var c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(t instanceof m.CompressedTexture)for(c=0,l=h.length;c<l;c++)i=h[c],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(a)?xt.compressedTexImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);else if(0<h.length&&n){for(c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,a,s,i);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,a,s,i);t.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(t){if((q=t)&&void 0===bt.get(t).__webglFramebuffer){var e=bt.get(t),r=bt.get(t.texture);t.addEventListener("dispose",a),r.__webglTexture=gt.createTexture(),ft.textures++;var i=t instanceof m.WebGLRenderTargetCube,n=m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height);if(i){e.__webglFramebuffer=[];for(var o=0;6>o;o++)e.__webglFramebuffer[o]=gt.createFramebuffer()}else e.__webglFramebuffer=gt.createFramebuffer();if(i){for(xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__webglTexture),b(gt.TEXTURE_CUBE_MAP,t.texture,n),o=0;6>o;o++)E(e.__webglFramebuffer[o],t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+o);t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),xt.bindTexture(gt.TEXTURE_CUBE_MAP,null)}else xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),b(gt.TEXTURE_2D,t.texture,n),E(e.__webglFramebuffer,t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_2D),t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),xt.bindTexture(gt.TEXTURE_2D,null);if(t.depthBuffer){if(e=bt.get(t),t instanceof m.WebGLRenderTargetCube)for(e.__webglDepthbuffer=[],r=0;6>r;r++)gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer[r]),e.__webglDepthbuffer[r]=gt.createRenderbuffer(),T(e.__webglDepthbuffer[r],t);else gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=gt.createRenderbuffer(),T(e.__webglDepthbuffer,t);gt.bindFramebuffer(gt.FRAMEBUFFER,null)}}e=t instanceof m.WebGLRenderTargetCube,t?(r=bt.get(t),r=e?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,J.copy(t.scissor),$=t.scissorTest,tt.copy(t.viewport)):(r=null,J.copy(st).multiplyScalar(at),$=ht,tt.copy(ct).multiplyScalar(at)),Y!==r&&(gt.bindFramebuffer(gt.FRAMEBUFFER,r),Y=r),xt.scissor(J),xt.setScissorTest($),xt.viewport(tt),e&&(e=bt.get(t.texture),gt.framebufferTexture2D(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,e.__webglTexture,0))},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(0==t instanceof m.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=bt.get(t).__webglFramebuffer;if(a){var s=!1;a!==Y&&(gt.bindFramebuffer(gt.FRAMEBUFFER,a),s=!0);try{var h=t.texture;h.format!==m.RGBAFormat&&L(h.format)!==gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===m.UnsignedByteType||L(h.type)===gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===m.FloatType&&vt.get("WEBGL_color_buffer_float")||h.type===m.HalfFloatType&&vt.get("EXT_color_buffer_half_float")?gt.checkFramebufferStatus(gt.FRAMEBUFFER)===gt.FRAMEBUFFER_COMPLETE?gt.readPixels(e,r,i,n,L(h.format),L(h.type),o):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{s&&gt.bindFramebuffer(gt.FRAMEBUFFER,Y)}}}}},m.WebGLRenderTarget=function(t,e,r){this.uuid=m.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new m.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new m.Vector4(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=m.LinearFilter),this.texture=new m.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer},m.WebGLRenderTarget.prototype={constructor:m.WebGLRenderTarget,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.shareDepthFrom=t.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube=function(t,e,r){m.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},m.WebGLRenderTargetCube.prototype=Object.create(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube.prototype.constructor=m.WebGLRenderTargetCube,m.WebGLBufferRenderer=function(t,e,r){var i;this.setMode=function(t){i=t},this.render=function(e,n){t.drawArrays(i,e,n),r.calls++,r.vertices+=n,i===t.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=e.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=n.attributes.position,s=0,s=a instanceof m.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},m.WebGLIndexedBufferRenderer=function(t,e,r){var i,n,o;this.setMode=function(t){i=t},this.setIndex=function(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(n=t.UNSIGNED_INT,o=4):(n=t.UNSIGNED_SHORT,o=2)},this.render=function(e,a){t.drawElements(i,a,n,e*o),r.calls++,r.vertices+=a,i===t.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,h){var c=e.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(i,h,n,s*o,a.maxInstancedCount),r.calls++,r.vertices+=h*a.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=a.maxInstancedCount*h/3))}},m.WebGLExtensions=function(t){var e={};this.get=function(r){if(void 0!==e[r])return e[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=i}},m.WebGLCapabilities=function(t,e,r){function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer&&r.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,(r=i(this.precision))!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},m.WebGLGeometries=function(t,e,r){function i(t){var a=t.target;null!==(t=o[a.id]).index&&n(t.index);var s,h=t.attributes;for(s in h)n(h[s]);a.removeEventListener("dispose",i),delete o[a.id],(s=e.get(a)).wireframe&&n(s.wireframe),e.delete(a),(a=e.get(t)).wireframe&&n(a.wireframe),e.delete(t),r.memory.geometries--}function n(r){var i;void 0!==(i=r instanceof m.InterleavedBufferAttribute?e.get(r.data).__webglBuffer:e.get(r).__webglBuffer)&&(t.deleteBuffer(i),r instanceof m.InterleavedBufferAttribute?e.delete(r.data):e.delete(r))}var o={};this.get=function(t){var e=t.geometry;if(void 0!==o[e.id])return o[e.id];e.addEventListener("dispose",i);var n;return e instanceof m.BufferGeometry?n=e:e instanceof m.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new m.BufferGeometry).setFromObject(t)),n=e._bufferGeometry),o[e.id]=n,r.memory.geometries++,n}},m.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new m.Vector3,color:new m.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"SpotLight":r={position:new m.Vector3,direction:new m.Vector3,color:new m.Color,distance:0,angleCos:0,exponent:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"PointLight":r={position:new m.Vector3,color:new m.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"HemisphereLight":r={direction:new m.Vector3,skyColor:new m.Color,groundColor:new m.Color}}return t[e.id]=r}},m.WebGLObjects=function(t,e,r){function i(r,i){var n=r instanceof m.InterleavedBufferAttribute?r.data:r,o=e.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=t.createBuffer(),t.bindBuffer(i,o.__webglBuffer),t.bufferData(i,n.array,n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(t.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?t.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),o.version=n.version)}function n(t,e,r){if(e>r){var i=e;e=r,r=i}return i=t[e],void 0===i?(t[e]=[r],!0):-1===i.indexOf(r)&&(i.push(r),!0)}var o=new m.WebGLGeometries(t,e,r);this.getAttributeBuffer=function(t){return t instanceof m.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer},this.getWireframeAttribute=function(r){var o=e.get(r);if(void 0!==o.wireframe)return o.wireframe;var a=[],s=r.index;if(r=(h=r.attributes).position,null!==s)for(var h={},s=s.array,c=0,l=s.length;c<l;c+=3){var u=s[c+0],p=s[c+1],d=s[c+2];n(h,u,p)&&a.push(u,p),n(h,p,d)&&a.push(p,d),n(h,d,u)&&a.push(d,u)}else for(s=h.position.array,c=0,l=s.length/3-1;c<l;c+=3)u=c+0,p=c+1,d=c+2,a.push(u,p,p,d,d,u);return a=new m.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),i(a,t.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(e){var r=o.get(e);e.geometry instanceof m.Geometry&&r.updateFromObject(e),e=r.index,a=r.attributes,null!==e&&i(e,t.ELEMENT_ARRAY_BUFFER);for(var n in a)i(a[n],t.ARRAY_BUFFER);e=r.morphAttributes;for(n in e)for(var a=e[n],s=0,h=a.length;s<h;s++)i(a[s],t.ARRAY_BUFFER);return r}},m.WebGLProgram=function(){function t(t,e,i){return t=t||{},[t.derivatives||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(r).join("\n")}function e(t){var e,r=[];for(e in t){var i=t[e];!1!==i&&r.push("#define "+e+" "+i)}return r.join("\n")}function r(t){return""!==t}function i(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function n(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,i){for(t="",e=parseInt(e);e<parseInt(r);e++)t+=i.replace(/\[ i \]/g,"[ "+e+" ]");return t})}var o=0,a=/^([\w\d_]+)\.([\w\d_]+)$/,s=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,h=/^([\w\d_]+)\[0\]$/;return function(c,l,u,p){var d=c.context,f=u.extensions,g=u.defines,v=u.__webglShader.vertexShader,y=u.__webglShader.fragmentShader,x="SHADOWMAP_TYPE_BASIC";p.shadowMapType===m.PCFShadowMap?x="SHADOWMAP_TYPE_PCF":p.shadowMapType===m.PCFSoftShadowMap&&(x="SHADOWMAP_TYPE_PCF_SOFT");var b="ENVMAP_TYPE_CUBE",_="ENVMAP_MODE_REFLECTION",M="ENVMAP_BLENDING_MULTIPLY";if(p.envMap){switch(u.envMap.mapping){case m.CubeReflectionMapping:case m.CubeRefractionMapping:b="ENVMAP_TYPE_CUBE";break;case m.EquirectangularReflectionMapping:case m.EquirectangularRefractionMapping:b="ENVMAP_TYPE_EQUIREC";break;case m.SphericalReflectionMapping:b="ENVMAP_TYPE_SPHERE"}switch(u.envMap.mapping){case m.CubeRefractionMapping:case m.EquirectangularRefractionMapping:_="ENVMAP_MODE_REFRACTION"}switch(u.combine){case m.MultiplyOperation:M="ENVMAP_BLENDING_MULTIPLY";break;case m.MixOperation:M="ENVMAP_BLENDING_MIX";break;case m.AddOperation:M="ENVMAP_BLENDING_ADD"}}var w=0<c.gammaFactor?c.gammaFactor:1,f=t(f,p,c.extensions),S=e(g),E=d.createProgram();u instanceof m.RawShaderMaterial?c=g="":(g=["precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+p.maxBones,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+_:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.displacementMap&&p.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.skinning?"#define USE_SKINNING":"",p.useVertexTexture?"#define BONE_TEXTURE":"",p.morphTargets?"#define USE_MORPHTARGETS":"",p.morphNormals&&!1===p.flatShading?"#define USE_MORPHNORMALS":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.sizeAttenuation?"#define USE_SIZEATTENUATION":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(r).join("\n"),c=[f,"precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.alphaTest?"#define ALPHATEST "+p.alphaTest:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,p.useFog&&p.fog?"#define USE_FOG":"",p.useFog&&p.fogExp?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+b:"",p.envMap?"#define "+_:"",p.envMap?"#define "+M:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",p.envMap&&c.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(r).join("\n")),v=i(v,p),y=i(y,p),0==u instanceof m.ShaderMaterial&&(v=n(v),y=n(y)),y=c+y,v=m.WebGLShader(d,d.VERTEX_SHADER,g+v),y=m.WebGLShader(d,d.FRAGMENT_SHADER,y),d.attachShader(E,v),d.attachShader(E,y),void 0!==u.index0AttributeName?d.bindAttribLocation(E,0,u.index0AttributeName):!0===p.morphTargets&&d.bindAttribLocation(E,0,"position"),d.linkProgram(E),p=d.getProgramInfoLog(E),x=d.getShaderInfoLog(v),b=d.getShaderInfoLog(y),M=_=!0,!1===d.getProgramParameter(E,d.LINK_STATUS)?(_=!1,console.error("THREE.WebGLProgram: shader error: ",d.getError(),"gl.VALIDATE_STATUS",d.getProgramParameter(E,d.VALIDATE_STATUS),"gl.getProgramInfoLog",p,x,b)):""!==p?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",p):""!==x&&""!==b||(M=!1),M&&(this.diagnostics={runnable:_,material:u,programLog:p,vertexShader:{log:x,prefix:g},fragmentShader:{log:b,prefix:c}}),d.deleteShader(v),d.deleteShader(y);var T;this.getUniforms=function(){if(void 0===T){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_UNIFORMS),r=0;r<e;r++){var i=d.getActiveUniform(E,r).name,n=d.getUniformLocation(E,i);if(o=a.exec(i)){var i=o[1],o=o[2];(c=t[i])||(c=t[i]={}),c[o]=n}else if(o=s.exec(i)){var c=o[1],i=o[2],o=o[3],l=t[c];l||(l=t[c]=[]),(c=l[i])||(c=l[i]={}),c[o]=n}else(o=h.exec(i))?(c=o[1],t[c]=n):t[i]=n}T=t}return T};var C;return this.getAttributes=function(){if(void 0===C){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var i=d.getActiveAttrib(E,r).name;t[i]=d.getAttribLocation(E,i)}C=t}return C},this.destroy=function(){d.deleteProgram(E),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=o++,this.code=l,this.usedTimes=1,this.program=E,this.vertexShader=v,this.fragmentShader=y,this}}(),m.WebGLPrograms=function(t,e){var r=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled pointLightShadows shadowMapType alphaTest doubleSided flipSided".split(" ");this.getParameters=function(r,n,o,a){var s,h=i[r.type];e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture?s=1024:(s=Math.floor((e.maxVertexUniforms-20)/4),void 0!==a&&a instanceof m.SkinnedMesh&&(s=Math.min(a.skeleton.bones.length,s))<a.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+a.skeleton.bones.length+", this GPU supports just "+s+" (try OpenGL instead of ANGLE)"));var c=t.getPrecision();return null!==r.precision&&(c=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",c,"instead."),{shaderID:h,precision:c,supportsVertexTextures:e.vertexTextures,map:!!r.map,envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:o,useFog:r.fog,fogExp:o instanceof m.FogExp2,flatShading:r.shading===m.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:s,useVertexTexture:e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numHemiLights:n.hemi.length,pointLightShadows:n.shadowsPointLight,shadowMapEnabled:t.shadowMap.enabled&&a.receiveShadow&&0<n.shadows.length,shadowMapType:t.shadowMap.type,alphaTest:r.alphaTest,doubleSided:r.side===m.DoubleSide,flipSided:r.side===m.BackSide}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(i=0;i<n.length;i++){var o=n[i];r.push(o),r.push(e[o])}return r.join()},this.acquireProgram=function(e,i,n){for(var o,a=0,s=r.length;a<s;a++){var h=r[a];if(h.code===n){++(o=h).usedTimes;break}}return void 0===o&&(o=new m.WebGLProgram(t,n,e,i),r.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r},m.WebGLProperties=function(){var t={};this.get=function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},this.delete=function(e){delete t[e.uuid]},this.clear=function(){t={}}},m.WebGLShader=function(){function t(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}return function(e,r,i){var n=e.createShader(r);return e.shaderSource(n,i),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),t(i)),n}}(),m.WebGLShadowMap=function(t,e,r){function i(t,e,r,i){var n=t.geometry,o=null,o=p,a=t.customDepthMaterial;return r&&(o=d,a=t.customDistanceMaterial),a?o=a:(t=t instanceof m.SkinnedMesh&&e.skinning,a=0,void 0!==n.morphTargets&&0<n.morphTargets.length&&e.morphTargets&&(a|=1),t&&(a|=2),o=o[a]),o.visible=e.visible,o.wireframe=e.wireframe,o.wireframeLinewidth=e.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(t,e,r){if(!1!==t.visible){t.layers.test(e.layers)&&(t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&t.castShadow&&(!1===t.frustumCulled||!0===s.intersectsObject(t))&&!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),u.push(t));for(var i=0,o=(t=t.children).length;i<o;i++)n(t[i],e,r)}}for(var o=t.context,a=t.state,s=new m.Frustum,h=new m.Matrix4,c=new m.Vector3,l=new m.Vector3,u=[],p=Array(4),d=Array(4),f=[new m.Vector3(1,0,0),new m.Vector3(-1,0,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1),new m.Vector3(0,1,0),new m.Vector3(0,-1,0)],g=[new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1)],v=[new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4],y=m.ShaderLib.depthRGBA,x=m.UniformsUtils.clone(y.uniforms),b=m.ShaderLib.distanceRGBA,_=m.UniformsUtils.clone(b.uniforms),M=0;4!==M;++M){var w=0!=(1&M),S=0!=(2&M),E=new m.ShaderMaterial({uniforms:x,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:w,skinning:S});E._shadowPass=!0,p[M]=E,(w=new m.ShaderMaterial({uniforms:_,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:w,skinning:S}))._shadowPass=!0,d[M]=w}var T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m.PCFShadowMap,this.cullFace=m.CullFaceFront,this.render=function(p,d){var y,x;if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)){a.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(T.cullFace===m.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var b=e.shadows,_=0,M=b.length;_<M;_++){var w=b[_],S=w.shadow,E=S.camera,C=S.mapSize;if(w instanceof m.PointLight){y=6,x=!0;var L=C.x/4,A=C.y/2;v[0].set(2*L,A,L,A),v[1].set(0,A,L,A),v[2].set(3*L,A,L,A),v[3].set(L,A,L,A),v[4].set(3*L,0,L,A),v[5].set(L,0,L,A)}else y=1,x=!1;for(null===S.map&&(S.map=new m.WebGLRenderTarget(C.x,C.y,{minFilter:m.LinearFilter,magFilter:m.LinearFilter,format:m.RGBAFormat}),w instanceof m.SpotLight&&(E.aspect=C.x/C.y),E.updateProjectionMatrix()),C=S.map,S=S.matrix,l.setFromMatrixPosition(w.matrixWorld),E.position.copy(l),t.setRenderTarget(C),t.clear(),C=0;C<y;C++)for(x?(c.copy(E.position),c.add(f[C]),E.up.copy(g[C]),E.lookAt(c),a.viewport(v[C])):(c.setFromMatrixPosition(w.target.matrixWorld),E.lookAt(c)),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),S.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),S.multiply(E.projectionMatrix),S.multiply(E.matrixWorldInverse),h.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),s.setFromMatrix(h),u.length=0,n(p,d,E),L=0,A=u.length;L<A;L++){var P=u[L],R=r.update(P);if((k=P.material)instanceof m.MultiMaterial)for(var U=R.groups,k=k.materials,D=0,I=U.length;D<I;D++){var F=U[D],B=k[F.materialIndex];!0===B.visible&&(B=i(P,B,x,l),t.renderBufferDirect(E,null,R,B,P,F))}else B=i(P,k,x,l),t.renderBufferDirect(E,null,R,B,P,null)}t.resetGLState()}y=t.getClearColor(),x=t.getClearAlpha(),t.setClearColor(y,x),a.enable(o.BLEND),T.cullFace===m.CullFaceFront&&o.cullFace(o.BACK),t.resetGLState(),T.needsUpdate=!1}}},m.WebGLState=function(t,e,r){var i=this,n=new m.Vector4,o=new Uint8Array(16),a=new Uint8Array(16),s=new Uint8Array(16),h={},c=null,l=null,u=null,p=null,d=null,f=null,g=null,v=null,y=null,x=null,b=null,_=null,M=null,w=null,S=null,E=null,T=null,C=null,L=null,A=null,P=null,R=null,U=null,k=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),D=void 0,I={},F=new m.Vector4,B=null,V=null,N=new m.Vector4,O=new m.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.frontFace(t.CCW),t.cullFace(t.BACK),this.enable(t.CULL_FACE),this.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var t=0,e=o.length;t<e;t++)o[t]=0},this.enableAttribute=function(r){o[r]=1,0===a[r]&&(t.enableVertexAttribArray(r),a[r]=1),0!==s[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),s[r]=0)},this.enableAttributeAndDivisor=function(e,r,i){o[e]=1,0===a[e]&&(t.enableVertexAttribArray(e),a[e]=1),s[e]!==r&&(i.vertexAttribDivisorANGLE(e,r),s[e]=r)},this.disableUnusedAttributes=function(){for(var e=0,r=a.length;e<r;e++)a[e]!==o[e]&&(t.disableVertexAttribArray(e),a[e]=0)},this.enable=function(e){!0!==h[e]&&(t.enable(e),h[e]=!0)},this.disable=function(e){!1!==h[e]&&(t.disable(e),h[e]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)c.push(r[i]);return c},this.setBlending=function(e,i,n,o,a,s,h){e===m.NoBlending?this.disable(t.BLEND):this.enable(t.BLEND),e!==l&&(e===m.AdditiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===m.SubtractiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===m.MultiplyBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),l=e),e===m.CustomBlending?(a=a||i,s=s||n,h=h||o,i===u&&a===f||(t.blendEquationSeparate(r(i),r(a)),u=i,f=a),n===p&&o===d&&s===g&&h===v||(t.blendFuncSeparate(r(n),r(o),r(s),r(h)),p=n,d=o,g=s,v=h)):v=g=f=d=p=u=null},this.setDepthFunc=function(e){if(y!==e){if(e)switch(e){case m.NeverDepth:t.depthFunc(t.NEVER);break;case m.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case m.LessDepth:t.depthFunc(t.LESS);break;case m.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case m.EqualDepth:t.depthFunc(t.EQUAL);break;case m.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case m.GreaterDepth:t.depthFunc(t.GREATER);break;case m.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);y=e}},this.setDepthTest=function(e){e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)},this.setDepthWrite=function(e){x!==e&&(t.depthMask(e),x=e)},this.setColorWrite=function(e){b!==e&&(t.colorMask(e,e,e,e),b=e)},this.setStencilFunc=function(e,r,i){M===e&&w===r&&S===i||(t.stencilFunc(e,r,i),M=e,w=r,S=i)},this.setStencilOp=function(e,r,i){E===e&&T===r&&C===i||(t.stencilOp(e,r,i),E=e,T=r,C=i)},this.setStencilTest=function(e){e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)},this.setStencilWrite=function(e){_!==e&&(t.stencilMask(e),_=e)},this.setFlipSided=function(e){L!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),L=e)},this.setLineWidth=function(e){e!==A&&(t.lineWidth(e),A=e)},this.setPolygonOffset=function(e,r,i){e?this.enable(t.POLYGON_OFFSET_FILL):this.disable(t.POLYGON_OFFSET_FILL),!e||P===r&&R===i||(t.polygonOffset(r,i),P=r,R=i)},this.getScissorTest=function(){return U},this.setScissorTest=function(e){(U=e)?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+k-1),D!==e&&(t.activeTexture(e),D=e)},this.bindTexture=function(e,r){void 0===D&&i.activeTexture();var n=I[D];void 0===n&&(n={type:void 0,texture:void 0},I[D]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r),n.type=e,n.texture=r)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.clearColor=function(e,r,i,o){n.set(e,r,i,o),!1===F.equals(n)&&(t.clearColor(e,r,i,o),F.copy(n))},this.clearDepth=function(e){B!==e&&(t.clearDepth(e),B=e)},this.clearStencil=function(e){V!==e&&(t.clearStencil(e),V=e)},this.scissor=function(e){!1===N.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),N.copy(e))},this.viewport=function(e){!1===O.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),O.copy(e))},this.reset=function(){for(var e=0;e<a.length;e++)1===a[e]&&(t.disableVertexAttribArray(e),a[e]=0);h={},L=_=x=b=l=c=null}},m.LensFlarePlugin=function(t,e){var r,i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x=t.context,b=t.state;this.render=function(_,M,w){if(0!==e.length){_=new m.Vector3;var S=w.w/w.z,E=.5*w.z,T=.5*w.w,C=16/w.w,L=new m.Vector2(C*S,C),A=new m.Vector3(1,1,0),P=new m.Vector2(1,1);if(void 0===f){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),R=new Uint16Array([0,1,2,0,2,3]);p=x.createBuffer(),d=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,p),x.bufferData(x.ARRAY_BUFFER,C,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),x.bufferData(x.ELEMENT_ARRAY_BUFFER,R,x.STATIC_DRAW),v=x.createTexture(),y=x.createTexture(),b.bindTexture(x.TEXTURE_2D,v),x.texImage2D(x.TEXTURE_2D,0,x.RGB,16,16,0,x.RGB,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST),b.bindTexture(x.TEXTURE_2D,y),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,16,16,0,x.RGBA,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST);var C=(g=0<x.getParameter(x.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},R=x.createProgram(),U=x.createShader(x.FRAGMENT_SHADER),k=x.createShader(x.VERTEX_SHADER),D="precision "+t.getPrecision()+" float;\n";x.shaderSource(U,D+C.fragmentShader),x.shaderSource(k,D+C.vertexShader),x.compileShader(U),x.compileShader(k),x.attachShader(R,U),x.attachShader(R,k),x.linkProgram(R),f=R,l=x.getAttribLocation(f,"position"),u=x.getAttribLocation(f,"uv"),r=x.getUniformLocation(f,"renderType"),i=x.getUniformLocation(f,"map"),n=x.getUniformLocation(f,"occlusionMap"),o=x.getUniformLocation(f,"opacity"),a=x.getUniformLocation(f,"color"),s=x.getUniformLocation(f,"scale"),h=x.getUniformLocation(f,"rotation"),c=x.getUniformLocation(f,"screenPosition")}for(x.useProgram(f),b.initAttributes(),b.enableAttribute(l),b.enableAttribute(u),b.disableUnusedAttributes(),x.uniform1i(n,0),x.uniform1i(i,1),x.bindBuffer(x.ARRAY_BUFFER,p),x.vertexAttribPointer(l,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),b.disable(x.CULL_FACE),b.setDepthWrite(!1),R=0,U=e.length;R<U;R++)if(C=16/w.w,L.set(C*S,C),k=e[R],_.set(k.matrixWorld.elements[12],k.matrixWorld.elements[13],k.matrixWorld.elements[14]),_.applyMatrix4(M.matrixWorldInverse),_.applyProjection(M.projectionMatrix),A.copy(_),P.x=A.x*E+E,P.y=A.y*T+T,g||0<P.x&&P.x<w.z&&0<P.y&&P.y<w.w){b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,null),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGB,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,0),x.uniform2f(s,L.x,L.y),x.uniform3f(c,A.x,A.y,A.z),b.disable(x.BLEND),b.enable(x.DEPTH_TEST),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,y),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGBA,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,1),b.disable(x.DEPTH_TEST),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),k.positionScreen.copy(A),k.customUpdateCallback?k.customUpdateCallback(k):k.updateLensFlares(),x.uniform1i(r,2),b.enable(x.BLEND);for(var D=0,I=k.lensFlares.length;D<I;D++){var F=k.lensFlares[D];.001<F.opacity&&.001<F.scale&&(A.x=F.x,A.y=F.y,A.z=F.z,C=F.size*F.scale/w.w,L.x=C*S,L.y=C,x.uniform3f(c,A.x,A.y,A.z),x.uniform2f(s,L.x,L.y),x.uniform1f(h,F.rotation),x.uniform1f(o,F.opacity),x.uniform3f(a,F.color.r,F.color.g,F.color.b),b.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),t.setTexture(F.texture,1),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0))}}b.enable(x.CULL_FACE),b.enable(x.DEPTH_TEST),b.setDepthWrite(!0),t.resetGLState()}}},m.SpritePlugin=function(t,e){function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x,b,_,M,w,S,E=t.context,T=t.state,C=new m.Vector3,L=new m.Quaternion,A=new m.Vector3;this.render=function(P,R){if(0!==e.length){if(void 0===w){var U=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),k=new Uint16Array([0,1,2,0,2,3]);_=E.createBuffer(),M=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,U,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.bufferData(E.ELEMENT_ARRAY_BUFFER,k,E.STATIC_DRAW);var U=E.createProgram(),k=E.createShader(E.VERTEX_SHADER),D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(k,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),E.shaderSource(D,["precision "+t.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),E.compileShader(k),E.compileShader(D),E.attachShader(U,k),E.attachShader(U,D),E.linkProgram(U),w=U,x=E.getAttribLocation(w,"position"),b=E.getAttribLocation(w,"uv"),i=E.getUniformLocation(w,"uvOffset"),n=E.getUniformLocation(w,"uvScale"),o=E.getUniformLocation(w,"rotation"),a=E.getUniformLocation(w,"scale"),s=E.getUniformLocation(w,"color"),h=E.getUniformLocation(w,"map"),c=E.getUniformLocation(w,"opacity"),l=E.getUniformLocation(w,"modelViewMatrix"),u=E.getUniformLocation(w,"projectionMatrix"),p=E.getUniformLocation(w,"fogType"),d=E.getUniformLocation(w,"fogDensity"),f=E.getUniformLocation(w,"fogNear"),g=E.getUniformLocation(w,"fogFar"),v=E.getUniformLocation(w,"fogColor"),y=E.getUniformLocation(w,"alphaTest"),(U=document.createElement("canvas")).width=8,U.height=8,(k=U.getContext("2d")).fillStyle="white",k.fillRect(0,0,8,8),(S=new m.Texture(U)).needsUpdate=!0}E.useProgram(w),T.initAttributes(),T.enableAttribute(x),T.enableAttribute(b),T.disableUnusedAttributes(),T.disable(E.CULL_FACE),T.enable(E.BLEND),E.bindBuffer(E.ARRAY_BUFFER,_),E.vertexAttribPointer(x,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(b,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.uniformMatrix4fv(u,!1,R.projectionMatrix.elements),T.activeTexture(E.TEXTURE0),E.uniform1i(h,0),k=U=0,(D=P.fog)?(E.uniform3f(v,D.color.r,D.color.g,D.color.b),D instanceof m.Fog?(E.uniform1f(f,D.near),E.uniform1f(g,D.far),E.uniform1i(p,1),k=U=1):D instanceof m.FogExp2&&(E.uniform1f(d,D.density),E.uniform1i(p,2),k=U=2)):(E.uniform1i(p,0),k=U=0);for(var D=0,I=e.length;D<I;D++)(B=e[D]).modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,B.matrixWorld),B.z=-B.modelViewMatrix.elements[14];e.sort(r);for(var F=[],D=0,I=e.length;D<I;D++){var B=e[D],V=B.material;E.uniform1f(y,V.alphaTest),E.uniformMatrix4fv(l,!1,B.modelViewMatrix.elements),B.matrixWorld.decompose(C,L,A),F[0]=A.x,F[1]=A.y,B=0,P.fog&&V.fog&&(B=k),U!==B&&(E.uniform1i(p,B),U=B),null!==V.map?(E.uniform2f(i,V.map.offset.x,V.map.offset.y),E.uniform2f(n,V.map.repeat.x,V.map.repeat.y)):(E.uniform2f(i,0,0),E.uniform2f(n,1,1)),E.uniform1f(c,V.opacity),E.uniform3f(s,V.color.r,V.color.g,V.color.b),E.uniform1f(o,V.rotation),E.uniform2fv(a,F),T.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),T.setDepthTest(V.depthTest),T.setDepthWrite(V.depthWrite),V.map&&V.map.image&&V.map.image.width?t.setTexture(V.map,0):t.setTexture(S,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}T.enable(E.CULL_FACE),t.resetGLState()}}},Object.defineProperties(m.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}}}),Object.defineProperties(m.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Matrix3.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}}),Object.defineProperties(m.Matrix4.prototype,{extractPosition:{value:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)}},setRotationFromQuaternion:{value:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)}},multiplyVector3:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)}},multiplyVector4:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}},rotateAxis:{value:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)}},crossVector:{value:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},translate:{value:function(t){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(m.Plane.prototype,{isIntersectionLine:{value:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}}),Object.defineProperties(m.Quaternion.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)}}}),Object.defineProperties(m.Ray.prototype,{isIntersectionBox:{value:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionPlane:{value:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)}},getScaleFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)}},getColumnFromMatrix:{value:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}}),m.Face4=function(t,e,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new m.Face3(t,e,r,n,o,a)},Object.defineProperties(m.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},getChildByName:{value:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)}},renderDepth:{set:function(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(m,{PointCloud:{value:function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new m.Points(t,e)}},ParticleSystem:{value:function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new m.Points(t,e)}}}),Object.defineProperties(m.Light.prototype,{onlyShadow:{set:function(t){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(t){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(m.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(m.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)}},addDrawCall:{value:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(m.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new m.Color}}}),Object.defineProperties(m,{PointCloudMaterial:{value:function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleBasicMaterial:{value:function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleSystemMaterial:{value:function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}}}),Object.defineProperties(m.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(m.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.defineProperties(m.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(m.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),m.GeometryUtils={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e instanceof m.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},m.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new m.TextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new m.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},m.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},m.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},m.MeshFaceMaterial=m.MultiMaterial,m.CurveUtils={tangentQuadraticBezier:function(t,e,r,i){return 2*(1-t)*(r-e)+2*t*(i-r)},tangentCubicBezier:function(t,e,r,i,n){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*n},tangentSpline:function(t,e,r,i,n){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,i,n){var o=n*n;return(2*e-2*r+(t=.5*(r-t))+(i=.5*(i-e)))*n*o+(-3*e+3*r-2*t-i)*o+t*n+e}},m.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new m.Group,i=0,n=e.length;i<n;i++)r.add(new m.Mesh(t,e[i]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var i=new m.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),e.remove(t),r.add(t)}},m.ShapeUtils={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(t,e){var r=t.length;if(3>r)return null;var i,n,o,a=[],s=[],h=[];if(0<m.ShapeUtils.area(t))for(n=0;n<r;n++)s[n]=n;else for(n=0;n<r;n++)s[n]=r-1-n;var c=2*r;for(n=r-1;2<r;){if(0>=c--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);var l;t:{var u=l=void 0,p=void 0,d=void 0,f=void 0,g=void 0,v=void 0,y=void 0,x=void 0,u=t[s[i]].x,p=t[s[i]].y,d=t[s[n]].x,f=t[s[n]].y,g=t[s[o]].x,v=t[s[o]].y;if(Number.EPSILON>(d-u)*(v-p)-(f-p)*(g-u))l=!1;else{var b=void 0,_=void 0,M=void 0,w=void 0,S=void 0,E=void 0,T=void 0,C=void 0,L=void 0,A=void 0,L=C=T=x=y=void 0,b=g-d,_=v-f,M=u-g,w=p-v,S=d-u,E=f-p;for(l=0;l<r;l++)if(y=t[s[l]].x,x=t[s[l]].y,!(y===u&&x===p||y===d&&x===f||y===g&&x===v)&&(T=y-u,C=x-p,L=y-d,A=x-f,y-=g,x-=v,L=b*A-_*L,T=S*C-E*T,C=M*x-w*y,L>=-Number.EPSILON&&C>=-Number.EPSILON&&T>=-Number.EPSILON)){l=!1;break t}l=!0}}if(l){for(a.push([t[s[i]],t[s[n]],t[s[o]]]),h.push([s[i],s[n],s[o]]),i=n,o=n+1;o<r;i++,o++)s[i]=s[o];c=2*--r}}return e?h:a},triangulateShape:function(t,e){function r(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,i,n,o){var a=e.x-t.x,s=e.y-t.y,h=n.x-i.x,c=n.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*h-a*c,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>d||d>p)return[];if(0>(h=c*l-h*u)||h>p)return[]}else{if(0<d||d<p)return[];if(0<(h=c*l-h*u)||h<p)return[]}return 0===h?!o||0!==d&&d!==p?[t]:[]:h===p?!o||0!==d&&d!==p?[e]:[]:0===d?[i]:d===p?[n]:(o=h/p,[{x:t.x+o*a,y:t.y+o*s}])}return 0!==d||c*l!=h*u?[]:(s=0===a&&0===s,h=0===h&&0===c,s&&h?t.x!==i.x||t.y!==i.y?[]:[t]:s?r(i,n,t)?[t]:[]:h?r(t,e,i)?[i]:[]:(0!==a?(t.x<e.x?(a=t,h=t.x,s=e,t=e.x):(a=e,h=e.x,s=t,t=t.x),i.x<n.x?(e=i,p=i.x,c=n,i=n.x):(e=n,p=n.x,c=i,i=i.x)):(t.y<e.y?(a=t,h=t.y,s=e,t=e.y):(a=e,h=e.y,s=t,t=t.y),i.y<n.y?(e=i,p=i.y,c=n,i=n.y):(e=n,p=n.y,c=i,i=i.y)),h<=p?t<p?[]:t===p?o?[]:[e]:t<=i?[e,s]:[e,c]:h>i?[]:h===i?o?[]:[a]:t<=i?[a,s]:[a,c]))}function n(t,e,r,i){var n=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=i.x-t.x;return i=i.y-t.y,t=n*r-o*e,n=n*i-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}var o,a,s,h,c,l={};for(s=t.concat(),o=0,a=e.length;o<a;o++)Array.prototype.push.apply(s,e[o]);for(o=0,a=s.length;o<a;o++)c=s[o].x+":"+s[o].y,void 0!==l[c]&&console.warn("THREE.Shape: Duplicate point",c),l[c]=o;o=function(t,e){var r,o,a,s,h,c,l,u,p,d=t.concat(),f=[],m=[],g=0;for(o=e.length;g<o;g++)f.push(g);l=0;for(var v=2*f.length;0<f.length;){if(0>--v){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(a=l;a<d.length;a++){for(s=d[a],o=-1,g=0;g<f.length;g++)if(h=f[g],c=s.x+":"+s.y+":"+h,void 0===m[c]){for(r=e[h],u=0;u<r.length;u++)if(h=r[u],function(t,e){var i=d.length-1,o=t-1;0>o&&(o=i);var a=t+1;return a>i&&(a=0),!!(i=n(d[t],d[o],d[a],r[e]))&&(i=r.length-1,0>(o=e-1)&&(o=i),(a=e+1)>i&&(a=0),!!(i=n(r[e],r[o],r[a],d[t])))}(a,u)&&!function(t,e){var r,n;for(r=0;r<d.length;r++)if(n=r+1,n%=d.length,0<(n=i(t,e,d[r],d[n],!0)).length)return!0;return!1}(s,h)&&!function(t,r){var n,o,a,s;for(n=0;n<f.length;n++)for(o=e[f[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,0<(s=i(t,r,o[a],o[s],!0)).length)return!0;return!1}(s,h)){o=u,f.splice(g,1),l=d.slice(0,a+1),h=d.slice(a),u=r.slice(o),p=r.slice(0,o+1),d=l.concat(u).concat(p).concat(h),l=a;break}if(0<=o)break;m[c]=!0}if(0<=o)break}}return d}(t,e);var u=m.ShapeUtils.triangulate(o,!1);for(o=0,a=u.length;o<a;o++)for(h=u[o],s=0;3>s;s++)c=h[s].x+":"+h[s].y,void 0!==(c=l[c])&&(h[s]=c);return u.concat()},isClockWise:function(t){return 0>m.ShapeUtils.area(t)},b2:function(t,e,r,i){var n=1-t;return n*n*e+2*(1-t)*t*r+t*t*i},b3:function(t,e,r,i,n){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*i+t*t*t*n}},m.Curve=function(){},m.Curve.prototype={constructor:m.Curve,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPoint(e/t));return r},getSpacedPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPointAt(e/t));return r},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),o+=e.distanceTo(n),i.push(o),n=e;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,h=o-1;s<=h;)if(n=Math.floor(s+(h-s)/2),0>(a=i[n]-r))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return n=h,i[n]===r?n/(o-1):(s=i[n],i=(n+(r-s)/(i[n+1]-s))/(o-1))},getTangent:function(t){var e=t-1e-4;return t+=1e-4,0>e&&(e=0),1<t&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)}},m.Curve.create=function(t,e){return t.prototype=Object.create(m.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},m.CurvePath=function(){this.curves=[],this.autoClose=!1},m.CurvePath.prototype=Object.create(m.Curve.prototype),m.CurvePath.prototype.constructor=m.CurvePath,m.CurvePath.prototype.add=function(t){this.curves.push(t)},m.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new m.LineCurve(e,t))},m.CurvePath.prototype.getPoint=function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=e)return t=this.curves[i],e=1-(r[i]-e)/t.getLength(),t.getPointAt(e);i++}return null},m.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},m.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},m.CurvePath.prototype.createPointsGeometry=function(t){return t=this.getPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createSpacedPointsGeometry=function(t){return t=this.getSpacedPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createGeometry=function(t){for(var e=new m.Geometry,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new m.Vector3(n.x,n.y,n.z||0))}return e},m.Font=function(t){this.data=t},m.Font.prototype={constructor:m.Font,generateShapes:function(t,e,r){void 0===e&&(e=100),void 0===r&&(r=4);var i=this.data;t=String(t).split("");var n=e/i.resolution,o=0;e=[];for(var a=0;a<t.length;a++){var s;s=n;var h=o,c=i.glyphs[t[a]]||i.glyphs["?"];if(c){var l=new m.Path,u=[],p=m.ShapeUtils.b2,d=m.ShapeUtils.b3,f=void 0,g=void 0,v=g=f=void 0,y=void 0,x=void 0,b=void 0,_=void 0,M=void 0,y=void 0;if(c.o)for(var w=c._cachedOutline||(c._cachedOutline=c.o.split(" ")),S=0,E=w.length;S<E;)switch(w[S++]){case"m":f=w[S++]*s+h,g=w[S++]*s,l.moveTo(f,g);break;case"l":f=w[S++]*s+h,g=w[S++]*s,l.lineTo(f,g);break;case"q":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,l.quadraticCurveTo(x,b,f,g),y=u[u.length-1])for(var v=y.x,y=y.y,T=1;T<=r;T++){var C=T/r;p(C,v,x,f),p(C,y,b,g)}break;case"b":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,_=w[S++]*s+h,M=w[S++]*s,l.bezierCurveTo(x,b,_,M,f,g),y=u[u.length-1])for(v=y.x,y=y.y,T=1;T<=r;T++)C=T/r,d(C,v,x,_,f),d(C,y,b,M,g)}s={offset:c.ha*s,path:l}}else s=void 0;o+=s.offset,e.push(s.path)}for(r=[],i=0,t=e.length;i<t;i++)Array.prototype.push.apply(r,e[i].toShapes());return r}},m.Path=function(t){m.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},m.Path.prototype=Object.create(m.CurvePath.prototype),m.Path.prototype.constructor=m.Path,m.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},m.Path.prototype.moveTo=function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},m.Path.prototype.lineTo=function(t,e){var r=this.actions[this.actions.length-1].args,r=new m.LineCurve(new m.Vector2(r[r.length-2],r[r.length-1]),new m.Vector2(t,e));this.curves.push(r),this.actions.push({action:"lineTo",args:[t,e]})},m.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=this.actions[this.actions.length-1].args,n=new m.QuadraticBezierCurve(new m.Vector2(n[n.length-2],n[n.length-1]),new m.Vector2(t,e),new m.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[t,e,r,i]})},m.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new m.CubicBezierCurve(new m.Vector2(a[a.length-2],a[a.length-1]),new m.Vector2(t,e),new m.Vector2(r,i),new m.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[t,e,r,i,n,o]})},m.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,r=[new m.Vector2(r[r.length-2],r[r.length-1])];Array.prototype.push.apply(r,t),r=new m.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:e})},m.Path.prototype.arc=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(t+a[a.length-2],e+a[a.length-1],r,i,n,o)},m.Path.prototype.absarc=function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},m.Path.prototype.ellipse=function(t,e,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(t+h[h.length-2],e+h[h.length-1],r,i,n,o,a,s)},m.Path.prototype.absellipse=function(t,e,r,i,n,o,a,s){var h=[t,e,r,i,n,o,a,s||0];t=new m.EllipseCurve(t,e,r,i,n,o,a,s),this.curves.push(t),t=t.getPoint(1),h.push(t.x),h.push(t.y),this.actions.push({action:"ellipse",args:h})},m.Path.prototype.getSpacedPoints=function(t){t||(t=40);for(var e=[],r=0;r<t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},m.Path.prototype.getPoints=function(t){t=t||12;for(var e,r,i,n,o,a,s,h,c,l,u=m.ShapeUtils.b2,p=m.ShapeUtils.b3,d=[],f=0,g=this.actions.length;f<g;f++){var v=(c=this.actions[f]).args;switch(c.action){case"moveTo":case"lineTo":d.push(new m.Vector2(v[0],v[1]));break;case"quadraticCurveTo":for(e=v[2],r=v[3],o=v[0],a=v[1],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=u(l,s,o,e),l=u(l,h,a,r),d.push(new m.Vector2(c,l));break;case"bezierCurveTo":for(e=v[4],r=v[5],o=v[0],a=v[1],i=v[2],n=v[3],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=p(l,s,o,i,e),l=p(l,h,a,n,r),d.push(new m.Vector2(c,l));break;case"splineThru":for(c=this.actions[f-1].args,l=[new m.Vector2(c[c.length-2],c[c.length-1])],c=t*v[0].length,l=l.concat(v[0]),l=new m.SplineCurve(l),v=1;v<=c;v++)d.push(l.getPointAt(v/c));break;case"arc":for(e=v[0],r=v[1],a=v[2],i=v[3],c=v[4],o=!!v[5],s=c-i,h=2*t,v=1;v<=h;v++)l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new m.Vector2(c,l));break;case"ellipse":e=v[0],r=v[1],a=v[2],n=v[3],i=v[4],c=v[5],o=!!v[6];var y=v[7];s=c-i,h=2*t;var x,b;for(0!==y&&(x=Math.cos(y),b=Math.sin(y)),v=1;v<=h;v++){if(l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+n*Math.sin(l),0!==y){var _=c;c=(_-e)*x-(l-r)*b+e,l=(_-e)*b+(l-r)*x+r}d.push(new m.Vector2(c,l))}}}return t=d[d.length-1],Math.abs(t.x-d[0].x)<Number.EPSILON&&Math.abs(t.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},m.Path.prototype.toShapes=function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new m.Shape;o.actions=n.actions,o.curves=n.curves,e.push(o)}return e}var i=m.ShapeUtils.isClockWise,n=function(t){for(var e=[],r=new m.Path,i=0,n=t.length;i<n;i++){var o=t[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(e.push(r),r=new m.Path),r[o].apply(r,a)}return 0!==r.actions.length&&e.push(r),e}(this.actions);if(0===n.length)return[];if(!0===e)return r(n);var o,a,s,h=[];if(1===n.length)return a=n[0],s=new m.Shape,s.actions=a.actions,s.curves=a.curves,h.push(s),h;var c=!i(n[0].getPoints()),c=t?!c:c;s=[];var l,u=[],p=[],d=0;u[d]=void 0,p[d]=[];for(var f=0,g=n.length;f<g;f++)a=n[f],l=a.getPoints(),o=i(l),(o=t?!o:o)?(!c&&u[d]&&d++,u[d]={s:new m.Shape,p:l},u[d].s.actions=a.actions,u[d].s.curves=a.curves,c&&d++,p[d]=[]):p[d].push({h:a,p:l[0]});if(!u[0])return r(n);if(1<u.length){for(f=!1,a=[],i=0,n=u.length;i<n;i++)s[i]=[];for(i=0,n=u.length;i<n;i++)for(o=p[i],c=0;c<o.length;c++){for(d=o[c],l=!0,g=0;g<u.length;g++)(function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=e[o],h=-h,s=e[n],c=-c),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0==(n=c*(t.x-a.x)-h*(t.y-a.y)))return!0;0>n||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return i})(d.p,u[g].p)&&(i!==g&&a.push({froms:i,tos:g,hole:c}),l?(l=!1,s[g].push(d)):f=!0);l&&s[i].push(d)}0<a.length&&(f||(p=s))}for(f=0,i=u.length;f<i;f++)for(s=u[f].s,h.push(s),a=p[f],n=0,o=a.length;n<o;n++)s.holes.push(a[n].h);return h},m.Shape=function(){m.Path.apply(this,arguments),this.holes=[]},m.Shape.prototype=Object.create(m.Path.prototype),m.Shape.prototype.constructor=m.Shape,m.Shape.prototype.extrude=function(t){return new m.ExtrudeGeometry(this,t)},m.Shape.prototype.makeGeometry=function(t){return new m.ShapeGeometry(this,t)},m.Shape.prototype.getPointsHoles=function(t){for(var e=[],r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e},m.Shape.prototype.extractAllPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},m.Shape.prototype.extractPoints=function(t){return this.extractAllPoints(t)},m.LineCurve=function(t,e){this.v1=t,this.v2=e},m.LineCurve.prototype=Object.create(m.Curve.prototype),m.LineCurve.prototype.constructor=m.LineCurve,m.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},m.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},m.LineCurve.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},m.QuadraticBezierCurve=function(t,e,r){this.v0=t,this.v1=e,this.v2=r},m.QuadraticBezierCurve.prototype=Object.create(m.Curve.prototype),m.QuadraticBezierCurve.prototype.constructor=m.QuadraticBezierCurve,m.QuadraticBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b2;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},m.QuadraticBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentQuadraticBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},m.CubicBezierCurve=function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},m.CubicBezierCurve.prototype=Object.create(m.Curve.prototype),m.CubicBezierCurve.prototype.constructor=m.CubicBezierCurve,m.CubicBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b3;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},m.CubicBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentCubicBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},m.SplineCurve=function(t){this.points=void 0==t?[]:t},m.SplineCurve.prototype=Object.create(m.Curve.prototype),m.SplineCurve.prototype.constructor=m.SplineCurve,m.SplineCurve.prototype.getPoint=function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0===o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector2(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t))},m.EllipseCurve=function(t,e,r,i,n,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},m.EllipseCurve.prototype=Object.create(m.Curve.prototype),m.EllipseCurve.prototype.constructor=m.EllipseCurve,m.EllipseCurve.prototype.getPoint=function(t){0>(r=this.aEndAngle-this.aStartAngle)&&(r+=2*Math.PI),r>2*Math.PI&&(r-=2*Math.PI),r=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-r):this.aStartAngle+t*r,t=this.aX+this.xRadius*Math.cos(r);var e=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var r=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=t;t=(n-this.aX)*r-(e-this.aY)*i+this.aX,e=(n-this.aX)*i+(e-this.aY)*r+this.aY}return new m.Vector2(t,e)},m.ArcCurve=function(t,e,r,i,n,o){m.EllipseCurve.call(this,t,e,r,r,i,n,o)},m.ArcCurve.prototype=Object.create(m.EllipseCurve.prototype),m.ArcCurve.prototype.constructor=m.ArcCurve,m.LineCurve3=m.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new m.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),m.QuadraticBezierCurve3=m.Curve.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=m.ShapeUtils.b2;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),m.CubicBezierCurve3=m.Curve.create(function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},function(t){var e=m.ShapeUtils.b3;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),m.SplineCurve3=m.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==t?[]:t},function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0==o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),m.CatmullRomCurve3=function(){function t(){}var e=new m.Vector3,r=new t,i=new t,n=new t;return t.prototype.init=function(t,e,r,i){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-i,this.c3=2*t-2*e+r+i},t.prototype.initNonuniformCatmullRom=function(t,e,r,i,n,o,a){t=((e-t)/n-(r-t)/(n+o)+(r-e)/o)*o,i=((r-e)/o-(i-e)/(o+a)+(i-r)/a)*o,this.init(e,r,t,i)},t.prototype.initCatmullRom=function(t,e,r,i,n){this.init(e,r,n*(r-t),n*(i-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},m.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s=this.points;2>(a=s.length)&&console.log("duh, you need at least 2 points"),t*=a-(this.closed?0:1),t-=o=Math.floor(t),this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===t&&o===a-1&&(o=a-2,t=1);var h,c,l;if(this.closed||0<o?h=s[(o-1)%a]:(e.subVectors(s[0],s[1]).add(s[0]),h=e),c=s[o%a],l=s[(o+1)%a],this.closed||o+2<a?s=s[(o+2)%a]:(e.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(h.distanceToSquared(c),u),o=Math.pow(c.distanceToSquared(l),u),u=Math.pow(l.distanceToSquared(s),u),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>u&&(u=o),r.initNonuniformCatmullRom(h.x,c.x,l.x,s.x,a,o,u),i.initNonuniformCatmullRom(h.y,c.y,l.y,s.y,a,o,u),n.initNonuniformCatmullRom(h.z,c.z,l.z,s.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(h.x,c.x,l.x,s.x,a),i.initCatmullRom(h.y,c.y,l.y,s.y,a),n.initCatmullRom(h.z,c.z,l.z,s.z,a));return new m.Vector3(r.calc(t),i.calc(t),n.calc(t))})}(),m.ClosedSplineCurve3=function(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),m.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},m.ClosedSplineCurve3.prototype=Object.create(m.CatmullRomCurve3.prototype),m.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,h){var c,l=s.widthSegments,u=s.heightSegments,p=n/2,d=o/2,f=s.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?c="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(c="y",u=s.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(c="x",l=s.depthSegments);var g=l+1,v=u+1,y=n/l,x=o/u,b=new m.Vector3;for(b[c]=0<a?1:-1,n=0;n<v;n++)for(o=0;o<g;o++){var _=new m.Vector3;_[t]=(o*y-p)*r,_[e]=(n*x-d)*i,_[c]=a,s.vertices.push(_)}for(n=0;n<u;n++)for(o=0;o<l;o++)d=o+g*n,t=o+g*(n+1),e=o+1+g*(n+1),r=o+1+g*n,i=new m.Vector2(o/l,1-n/u),a=new m.Vector2(o/l,1-(n+1)/u),c=new m.Vector2((o+1)/l,1-(n+1)/u),p=new m.Vector2((o+1)/l,1-n/u),(d=new m.Face3(d+f,t+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([i,a,p]),(d=new m.Face3(t+f,e+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([a.clone(),c,p.clone()])}m.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this;n=e/2,o=r/2,a("z","y",-1,-1,r,e,i=t/2,0),a("z","y",1,-1,r,e,-i,1),a("x","z",1,1,t,r,n,2),a("x","z",1,-1,t,r,-n,3),a("x","y",1,-1,t,e,o,4),a("x","y",-1,-1,t,e,-o,5),this.mergeVertices()},m.BoxGeometry.prototype=Object.create(m.Geometry.prototype),m.BoxGeometry.prototype.constructor=m.BoxGeometry,m.CubeGeometry=m.BoxGeometry,m.CircleGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new m.CircleBufferGeometry(t,e,r,i))},m.CircleGeometry.prototype=Object.create(m.Geometry.prototype),m.CircleGeometry.prototype.constructor=m.CircleGeometry,m.CircleBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=e+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,h=3,c=2;s<=e;s++,h+=3,c+=2){var l=r+s/e*i;o[h]=t*Math.cos(l),o[h+1]=t*Math.sin(l),a[h+2]=1,n[c]=(o[h]/t+1)/2,n[c+1]=(o[h+1]/t+1)/2}for(r=[],h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(new m.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new m.BufferAttribute(o,3)),this.addAttribute("normal",new m.BufferAttribute(a,3)),this.addAttribute("uv",new m.BufferAttribute(n,2)),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.CircleBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.CircleBufferGeometry.prototype.constructor=m.CircleBufferGeometry,m.CylinderGeometry=function(t,e,r,i,n,o,a,s){m.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h,c,l=r/2,u=[],p=[];for(c=0;c<=n;c++){var d=[],f=[],g=(v=c/n)*(e-t)+t;for(h=0;h<=i;h++)y=h/i,(x=new m.Vector3).x=g*Math.sin(y*s+a),x.y=-v*r+l,x.z=g*Math.cos(y*s+a),this.vertices.push(x),d.push(this.vertices.length-1),f.push(new m.Vector2(y,1-v));u.push(d),p.push(f)}for(r=(e-t)/r,h=0;h<i;h++)for(0!==t?(a=this.vertices[u[0][h]].clone(),s=this.vertices[u[0][h+1]].clone()):(a=this.vertices[u[1][h]].clone(),s=this.vertices[u[1][h+1]].clone()),a.setY(Math.sqrt(a.x*a.x+a.z*a.z)*r).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*r).normalize(),c=0;c<n;c++){var d=u[c][h],f=u[c+1][h],v=u[c+1][h+1],g=u[c][h+1],y=a.clone(),x=a.clone(),b=s.clone(),_=s.clone(),M=p[c][h].clone(),w=p[c+1][h].clone(),S=p[c+1][h+1].clone(),E=p[c][h+1].clone();this.faces.push(new m.Face3(d,f,g,[y,x,_])),this.faceVertexUvs[0].push([M,w,E]),this.faces.push(new m.Face3(f,v,g,[x.clone(),b,_.clone()])),this.faceVertexUvs[0].push([w.clone(),S,E.clone()])}if(!1===o&&0<t)for(this.vertices.push(new m.Vector3(0,l,0)),h=0;h<i;h++)d=u[0][h],f=u[0][h+1],v=this.vertices.length-1,y=new m.Vector3(0,1,0),x=new m.Vector3(0,1,0),b=new m.Vector3(0,1,0),M=p[0][h].clone(),w=p[0][h+1].clone(),S=new m.Vector2(w.x,0),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,1)),this.faceVertexUvs[0].push([M,w,S]);if(!1===o&&0<e)for(this.vertices.push(new m.Vector3(0,-l,0)),h=0;h<i;h++)d=u[n][h+1],f=u[n][h],v=this.vertices.length-1,y=new m.Vector3(0,-1,0),x=new m.Vector3(0,-1,0),b=new m.Vector3(0,-1,0),M=p[n][h+1].clone(),w=p[n][h].clone(),S=new m.Vector2(w.x,1),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,2)),this.faceVertexUvs[0].push([M,w,S]);this.computeFaceNormals()},m.CylinderGeometry.prototype=Object.create(m.Geometry.prototype),m.CylinderGeometry.prototype.constructor=m.CylinderGeometry,m.EdgesGeometry=function(t,e){m.BufferGeometry.call(this);var r,i=Math.cos(m.Math.degToRad(void 0!==e?e:1)),n=[0,0],o={},a=["a","b","c"];t instanceof m.BufferGeometry?(r=new m.Geometry).fromBufferGeometry(t):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var s=r.vertices,h=0,c=(r=r.faces).length;h<c;h++)for(var l=r[h],u=0;3>u;u++){n[0]=l[a[u]],n[1]=l[a[(u+1)%3]],n.sort(function(t,e){return t-e});var p=n.toString();void 0===o[p]?o[p]={vert1:n[0],vert2:n[1],face1:h,face2:void 0}:o[p].face2=h}n=[];for(p in o)(void 0===(a=o[p]).face2||r[a.face1].normal.dot(r[a.face2].normal)<=i)&&(h=s[a.vert1],n.push(h.x),n.push(h.y),n.push(h.z),h=s[a.vert2],n.push(h.x),n.push(h.y),n.push(h.z));this.addAttribute("position",new m.BufferAttribute(new Float32Array(n),3))},m.EdgesGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.EdgesGeometry.prototype.constructor=m.EdgesGeometry,m.ExtrudeGeometry=function(t,e){void 0!==t&&(m.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())},m.ExtrudeGeometry.prototype=Object.create(m.Geometry.prototype),m.ExtrudeGeometry.prototype.constructor=m.ExtrudeGeometry,m.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var r=t.length,i=0;i<r;i++)this.addShape(t[i],e)},m.ExtrudeGeometry.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,i=t.x-e.x,n=t.y-e.y,o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var h=Math.sqrt(s),c=Math.sqrt(o*o+a*a),s=e.x-n/h;if(e=e.y+i/h,o=((r.x-a/c-s)*a-(r.y+o/c-e)*o)/(i*a-n*o),r=s+i*o-t.x,t=e+n*o-t.y,2>=(i=r*r+t*t))return new m.Vector2(r,t);i=Math.sqrt(i/2)}else t=!1,i>Number.EPSILON?o>Number.EPSILON&&(t=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(n)===Math.sign(a)&&(t=!0),t?(r=-n,t=i,i=Math.sqrt(s)):(r=i,t=n,i=Math.sqrt(s/2));return new m.Vector2(r/i,t/i)}function n(t,e){var r,i;for(N=t.length;0<=--N;){r=N,0>(i=N-1)&&(i=t.length-1);for(var n=0,o=x+2*g,n=0;n<o;n++){var a=(a=e+r+(s=B*n))+C,s=(s=e+i+s)+C,h=(h=e+i+(c=B*(n+1)))+C,c=(c=e+r+c)+C;T.faces.push(new m.Face3(a,s,c,null,null,1)),T.faces.push(new m.Face3(s,h,c,null,null,1)),a=M.generateSideWallUV(T,a,s,h,c),T.faceVertexUvs[0].push([a[0],a[1],a[3]]),T.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){T.vertices.push(new m.Vector3(t,e,r))}function a(t,e,r){t+=C,e+=C,r+=C,T.faces.push(new m.Face3(t,e,r,null,null,0)),t=M.generateTopUV(T,t,e,r),T.faceVertexUvs[0].push(t)}var s,h,c,l,u,p=void 0!==e.amount?e.amount:100,d=void 0!==e.bevelThickness?e.bevelThickness:6,f=void 0!==e.bevelSize?e.bevelSize:d-2,g=void 0!==e.bevelSegments?e.bevelSegments:3,v=void 0===e.bevelEnabled||e.bevelEnabled,y=void 0!==e.curveSegments?e.curveSegments:12,x=void 0!==e.steps?e.steps:1,b=e.extrudePath,_=!1,M=void 0!==e.UVGenerator?e.UVGenerator:m.ExtrudeGeometry.WorldUVGenerator;b&&(s=b.getSpacedPoints(x),_=!0,v=!1,h=void 0!==e.frames?e.frames:new m.TubeGeometry.FrenetFrames(b,x,!1),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3),v||(f=d=g=0);var w,S,E,T=this,C=this.vertices.length,y=(b=t.extractPoints(y)).shape,L=b.holes;if(b=!m.ShapeUtils.isClockWise(y)){for(y=y.reverse(),S=0,E=L.length;S<E;S++)w=L[S],m.ShapeUtils.isClockWise(w)&&(L[S]=w.reverse());b=!1}var A=m.ShapeUtils.triangulateShape(y,L),P=y;for(S=0,E=L.length;S<E;S++)w=L[S],y=y.concat(w);var R,U,k,D,I,F,B=y.length,V=A.length,b=[],N=0;for(R=(k=P.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),b[N]=i(P[N],P[R],P[U]);var O,G=[],z=b.concat();for(S=0,E=L.length;S<E;S++){for(w=L[S],O=[],N=0,R=(k=w.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),O[N]=i(w[N],w[R],w[U]);G.push(O),z=z.concat(O)}for(R=0;R<g;R++){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,-D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),o(I.x,I.y,-D)}for(U=f,N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[0]).multiplyScalar(I.x),c.copy(h.binormals[0]).multiplyScalar(I.y),u.copy(s[0]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,0);for(k=1;k<=x;k++)for(N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[k]).multiplyScalar(I.x),c.copy(h.binormals[k]).multiplyScalar(I.y),u.copy(s[k]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,p/x*k);for(R=g-1;0<=R;R--){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,p+D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),_?o(I.x,I.y+s[x-1].y,s[x-1].x+D):o(I.x,I.y,p+D)}!function(){if(v){var t;for(t=0*B,N=0;N<V;N++)F=A[N],a(F[2]+t,F[1]+t,F[0]+t);for(t=x+2*g,t*=B,N=0;N<V;N++)F=A[N],a(F[0]+t,F[1]+t,F[2]+t)}else{for(N=0;N<V;N++)F=A[N],a(F[2],F[1],F[0]);for(N=0;N<V;N++)F=A[N],a(F[0]+B*x,F[1]+B*x,F[2]+B*x)}}(),function(){var t=0;for(n(P,t),t+=P.length,S=0,E=L.length;S<E;S++)w=L[S],n(w,t),t+=w.length}()},m.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,r,i){return t=t.vertices,e=t[e],r=t[r],i=t[i],[new m.Vector2(e.x,e.y),new m.Vector2(r.x,r.y),new m.Vector2(i.x,i.y)]},generateSideWallUV:function(t,e,r,i,n){return t=t.vertices,e=t[e],r=t[r],i=t[i],n=t[n],.01>Math.abs(e.y-r.y)?[new m.Vector2(e.x,1-e.z),new m.Vector2(r.x,1-r.z),new m.Vector2(i.x,1-i.z),new m.Vector2(n.x,1-n.z)]:[new m.Vector2(e.y,1-e.z),new m.Vector2(r.y,1-r.z),new m.Vector2(i.y,1-i.z),new m.Vector2(n.y,1-n.z)]}},m.ShapeGeometry=function(t,e){m.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},m.ShapeGeometry.prototype=Object.create(m.Geometry.prototype),m.ShapeGeometry.prototype.constructor=m.ShapeGeometry,m.ShapeGeometry.prototype.addShapeList=function(t,e){for(var r=0,i=t.length;r<i;r++)this.addShape(t[r],e);return this},m.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var r,i,n,o=e.material,a=void 0===e.UVGenerator?m.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,s=this.vertices.length,h=(r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12)).shape,c=r.holes;if(!m.ShapeUtils.isClockWise(h))for(h=h.reverse(),r=0,i=c.length;r<i;r++)n=c[r],m.ShapeUtils.isClockWise(n)&&(c[r]=n.reverse());var l=m.ShapeUtils.triangulateShape(h,c);for(r=0,i=c.length;r<i;r++)n=c[r],h=h.concat(n);for(c=h.length,i=l.length,r=0;r<c;r++)n=h[r],this.vertices.push(new m.Vector3(n.x,n.y,0));for(r=0;r<i;r++)c=l[r],h=c[0]+s,n=c[1]+s,c=c[2]+s,this.faces.push(new m.Face3(h,n,c,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,h,n,c))},m.LatheGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=e||12,r=r||0,i=i||2*Math.PI;for(var n=1/(t.length-1),o=1/e,a=0,s=e;a<=s;a++)for(var h=r+a*o*i,c=Math.sin(h),l=Math.cos(h),h=0,u=t.length;h<u;h++){var p=t[h];(d=new m.Vector3).x=p.x*c,d.y=p.y,d.z=p.x*l,this.vertices.push(d)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,u=t.length-1;h<u;h++){i=(e=h+r*a)+r;var c=e+1+r,l=e+1,d=h*n,f=(p=a*o)+o,g=d+n;this.faces.push(new m.Face3(e,i,l)),this.faceVertexUvs[0].push([new m.Vector2(p,d),new m.Vector2(f,d),new m.Vector2(p,g)]),this.faces.push(new m.Face3(i,c,l)),this.faceVertexUvs[0].push([new m.Vector2(f,d),new m.Vector2(f,g),new m.Vector2(p,g)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},m.LatheGeometry.prototype=Object.create(m.Geometry.prototype),m.LatheGeometry.prototype.constructor=m.LatheGeometry,m.PlaneGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new m.PlaneBufferGeometry(t,e,r,i))},m.PlaneGeometry.prototype=Object.create(m.Geometry.prototype),m.PlaneGeometry.prototype.constructor=m.PlaneGeometry,m.PlaneBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n=t/2,o=e/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=t/r,c=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var l=new Float32Array(a*s*2),u=0,p=0,d=0;d<s;d++)for(var f=d*c-o,g=0;g<a;g++)e[u]=g*h-n,e[u+1]=-f,t[u+2]=1,l[p]=g/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<e.length/3?Uint32Array:Uint16Array)(r*i*6),d=0;d<i;d++)for(g=0;g<r;g++)o=g+a*(d+1),s=g+1+a*(d+1),h=g+1+a*d,n[u]=g+a*d,n[u+1]=o,n[u+2]=h,n[u+3]=o,n[u+4]=s,n[u+5]=h,u+=6;this.setIndex(new m.BufferAttribute(n,1)),this.addAttribute("position",new m.BufferAttribute(e,3)),this.addAttribute("normal",new m.BufferAttribute(t,3)),this.addAttribute("uv",new m.BufferAttribute(l,2))},m.PlaneBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.PlaneBufferGeometry.prototype.constructor=m.PlaneBufferGeometry,m.RingGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||0,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s=[],h=t,c=(e-t)/(i=void 0!==i?Math.max(1,i):8);for(t=0;t<i+1;t++){for(a=0;a<r+1;a++){var l=new m.Vector3,u=n+a/r*o;l.x=h*Math.cos(u),l.y=h*Math.sin(u),this.vertices.push(l),s.push(new m.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}h+=c}for(e=new m.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=u=a+n,c=u+r+1,l=u+r+2,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]),o=u,c=u+r+2,l=u+1,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]);this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,h)},m.RingGeometry.prototype=Object.create(m.Geometry.prototype),m.RingGeometry.prototype.constructor=m.RingGeometry,m.SphereGeometry=function(t,e,r,i,n,o,a){m.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new m.SphereBufferGeometry(t,e,r,i,n,o,a))},m.SphereGeometry.prototype=Object.create(m.Geometry.prototype),m.SphereGeometry.prototype.constructor=m.SphereGeometry,m.SphereBufferGeometry=function(t,e,r,i,n,o,a){m.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;for(var s=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=(e+1)*(r+1),c=new m.BufferAttribute(new Float32Array(3*h),3),l=new m.BufferAttribute(new Float32Array(3*h),3),h=new m.BufferAttribute(new Float32Array(2*h),2),u=0,p=[],d=new m.Vector3,f=0;f<=r;f++){for(var g=[],v=f/r,y=0;y<=e;y++){var x=y/e,b=-t*Math.cos(i+x*n)*Math.sin(o+v*a),_=t*Math.cos(o+v*a),M=t*Math.sin(i+x*n)*Math.sin(o+v*a);d.set(b,_,M).normalize(),c.setXYZ(u,b,_,M),l.setXYZ(u,d.x,d.y,d.z),h.setXY(u,x,1-v),g.push(u),u++}p.push(g)}for(i=[],f=0;f<r;f++)for(y=0;y<e;y++)n=p[f][y+1],a=p[f][y],u=p[f+1][y],d=p[f+1][y+1],(0!==f||0<o)&&i.push(n,a,d),(f!==r-1||s<Math.PI)&&i.push(a,u,d);this.setIndex(new(65535<c.count?m.Uint32Attribute:m.Uint16Attribute)(i,1)),this.addAttribute("position",c),this.addAttribute("normal",l),this.addAttribute("uv",h),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.SphereBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.SphereBufferGeometry.prototype.constructor=m.SphereBufferGeometry,m.TextGeometry=function(t,e){var r=(e=e||{}).font;if(0==r instanceof m.Font)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new m.Geometry;r=r.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),m.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},m.TextGeometry.prototype=Object.create(m.ExtrudeGeometry.prototype),m.TextGeometry.prototype.constructor=m.TextGeometry,m.TorusGeometry=function(t,e,r,i,n){m.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new m.Vector3,a=[],s=[],h=0;h<=r;h++)for(var c=0;c<=i;c++){var l=c/i*n,u=h/r*Math.PI*2;o.x=t*Math.cos(l),o.y=t*Math.sin(l);var p=new m.Vector3;p.x=(t+e*Math.cos(u))*Math.cos(l),p.y=(t+e*Math.cos(u))*Math.sin(l),p.z=e*Math.sin(u),this.vertices.push(p),a.push(new m.Vector2(c/i,h/r)),s.push(p.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(c=1;c<=i;c++)t=(i+1)*h+c-1,e=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,l=new m.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),l=new m.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[e].clone(),a[n].clone(),a[o].clone()]);this.computeFaceNormals()},m.TorusGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusGeometry.prototype.constructor=m.TorusGeometry,m.TorusKnotGeometry=function(t,e,r,i,n,o,a){function s(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t);return t*=e/r,e=Math.cos(t),o*=i*(2+e)*.5,a=i*(2+e)*a*.5,i=n*i*Math.sin(t)*.5,new m.Vector3(o,a,i)}m.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},t=t||100,e=e||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=Array(r),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=0;p<r;++p){h[p]=Array(i);var d=s(f=p/r*2*n*Math.PI,o,n,t,a),f=s(f+.01,o,n,t,a);for(c.subVectors(f,d),l.addVectors(f,d),u.crossVectors(c,l),l.crossVectors(u,c),u.normalize(),l.normalize(),f=0;f<i;++f){var g=f/i*2*Math.PI,v=-e*Math.cos(g),g=e*Math.sin(g),y=new m.Vector3;y.x=d.x+v*l.x+g*u.x,y.y=d.y+v*l.y+g*u.y,y.z=d.z+v*l.z+g*u.z,h[p][f]=this.vertices.push(y)-1}}for(p=0;p<r;++p)for(f=0;f<i;++f)n=(p+1)%r,o=(f+1)%i,t=h[p][f],e=h[n][f],n=h[n][o],o=h[p][o],a=new m.Vector2(p/r,f/i),c=new m.Vector2((p+1)/r,f/i),l=new m.Vector2((p+1)/r,(f+1)/i),u=new m.Vector2(p/r,(f+1)/i),this.faces.push(new m.Face3(t,e,o)),this.faceVertexUvs[0].push([a,c,u]),this.faces.push(new m.Face3(e,n,o)),this.faceVertexUvs[0].push([c.clone(),l,u.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TorusKnotGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusKnotGeometry.prototype.constructor=m.TorusKnotGeometry,m.TubeGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:r,radialSegments:i,closed:n,taper:o},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||m.TubeGeometry.NoTaper;var a,s,h,c,l,u,p,d,f,g,v=[],y=e+1,x=new m.Vector3;for(f=(d=new m.TubeGeometry.FrenetFrames(t,e,n)).normals,g=d.binormals,this.tangents=d.tangents,this.normals=f,this.binormals=g,d=0;d<y;d++)for(v[d]=[],h=d/(y-1),p=t.getPointAt(h),a=f[d],s=g[d],l=r*o(h),h=0;h<i;h++)c=h/i*2*Math.PI,u=-l*Math.cos(c),c=l*Math.sin(c),x.copy(p),x.x+=u*a.x+c*s.x,x.y+=u*a.y+c*s.y,x.z+=u*a.z+c*s.z,v[d][h]=this.vertices.push(new m.Vector3(x.x,x.y,x.z))-1;for(d=0;d<e;d++)for(h=0;h<i;h++)o=n?(d+1)%e:d+1,y=(h+1)%i,t=v[d][h],r=v[o][h],o=v[o][y],y=v[d][y],x=new m.Vector2(d/e,h/i),f=new m.Vector2((d+1)/e,h/i),g=new m.Vector2((d+1)/e,(h+1)/i),a=new m.Vector2(d/e,(h+1)/i),this.faces.push(new m.Face3(t,r,y)),this.faceVertexUvs[0].push([x,f,a]),this.faces.push(new m.Face3(r,o,y)),this.faceVertexUvs[0].push([f.clone(),g,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TubeGeometry.prototype=Object.create(m.Geometry.prototype),m.TubeGeometry.prototype.constructor=m.TubeGeometry,m.TubeGeometry.NoTaper=function(t){return 1},m.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},m.TubeGeometry.FrenetFrames=function(t,e,r){var i=new m.Vector3,n=[],o=[],a=[],s=new m.Vector3,h=new m.Matrix4;e+=1;var c,l,u;for(this.tangents=n,this.normals=o,this.binormals=a,c=0;c<e;c++)l=c/(e-1),n[c]=t.getTangentAt(l),n[c].normalize();for(o[0]=new m.Vector3,a[0]=new m.Vector3,t=Number.MAX_VALUE,c=Math.abs(n[0].x),l=Math.abs(n[0].y),u=Math.abs(n[0].z),c<=t&&(t=c,i.set(1,0,0)),l<=t&&(t=l,i.set(0,1,0)),u<=t&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),o[0].crossVectors(n[0],s),a[0].crossVectors(n[0],o[0]),c=1;c<e;c++)o[c]=o[c-1].clone(),a[c]=a[c-1].clone(),s.crossVectors(n[c-1],n[c]),s.length()>Number.EPSILON&&(s.normalize(),i=Math.acos(m.Math.clamp(n[c-1].dot(n[c]),-1,1)),o[c].applyMatrix4(h.makeRotationAxis(s,i))),a[c].crossVectors(n[c],o[c]);if(r)for(i=Math.acos(m.Math.clamp(o[0].dot(o[e-1]),-1,1)),i/=e-1,0<n[0].dot(s.crossVectors(o[0],o[e-1]))&&(i=-i),c=1;c<e;c++)o[c].applyMatrix4(h.makeRotationAxis(n[c],i*c)),a[c].crossVectors(n[c],o[c])},m.PolyhedronGeometry=function(t,e,r,i){function n(t){var e=t.normalize().clone();e.index=s.vertices.push(e)-1;var r=Math.atan2(t.z,-t.x)/2/Math.PI+.5;return t=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5,e.uv=new m.Vector2(r,1-t),e}function o(t,e,r,i){i=new m.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()],void 0,i),s.faces.push(i),g.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(g.z,-g.x),s.faceVertexUvs[0].push([a(t.uv,t,i),a(e.uv,e,i),a(r.uv,r,i)])}function a(t,e,r){return 0>r&&1===t.x&&(t=new m.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new m.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}m.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1,i=i||0;for(var s=this,h=0,c=t.length;h<c;h+=3)n(new m.Vector3(t[h],t[h+1],t[h+2]));t=this.vertices;for(var l=[],u=h=0,c=e.length;h<c;h+=3,u++){var p=t[e[h]],d=t[e[h+1]],f=t[e[h+2]];l[u]=new m.Face3(p.index,d.index,f.index,[p.clone(),d.clone(),f.clone()],void 0,u)}for(var g=new m.Vector3,h=0,c=l.length;h<c;h++)!function(t,e){for(var r=Math.pow(2,e),i=n(s.vertices[t.a]),a=n(s.vertices[t.b]),h=n(s.vertices[t.c]),c=[],l=t.materialIndex,u=0;u<=r;u++){c[u]=[];for(var p=n(i.clone().lerp(h,u/r)),d=n(a.clone().lerp(h,u/r)),f=r-u,m=0;m<=f;m++)c[u][m]=0===m&&u===r?p:n(p.clone().lerp(d,m/f))}for(u=0;u<r;u++)for(m=0;m<2*(r-u)-1;m++)i=Math.floor(m/2),0==m%2?o(c[u][i+1],c[u+1][i],c[u][i],l):o(c[u][i+1],c[u+1][i+1],c[u+1][i],l)}(l[h],i);for(h=0,c=this.faceVertexUvs[0].length;h<c;h++)e=this.faceVertexUvs[0][h],i=e[0].x,t=e[1].x,l=e[2].x,u=Math.max(i,t,l),p=Math.min(i,t,l),.9<u&&.1>p&&(.2>i&&(e[0].x+=1),.2>t&&(e[1].x+=1),.2>l&&(e[2].x+=1));for(h=0,c=this.vertices.length;h<c;h++)this.vertices[h].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,r)},m.PolyhedronGeometry.prototype=Object.create(m.Geometry.prototype),m.PolyhedronGeometry.prototype.constructor=m.PolyhedronGeometry,m.DodecahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2,i=1/r;m.PolyhedronGeometry.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,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},m.DodecahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.DodecahedronGeometry.prototype.constructor=m.DodecahedronGeometry,m.IcosahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2;m.PolyhedronGeometry.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},m.IcosahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype);m.IcosahedronGeometry.prototype.constructor=m.IcosahedronGeometry,m.OctahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},m.OctahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.OctahedronGeometry.prototype.constructor=m.OctahedronGeometry,m.TetrahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},m.TetrahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.TetrahedronGeometry.prototype.constructor=m.TetrahedronGeometry,m.ParametricGeometry=function(t,e,r){m.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o,a,s=this.vertices,h=this.faces,c=this.faceVertexUvs[0],l=e+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=e;n++)o=n/e,o=t(o,a),s.push(o);var u,p,d,f;for(i=0;i<r;i++)for(n=0;n<e;n++)t=i*l+n,s=i*l+n+1,a=(i+1)*l+n+1,o=(i+1)*l+n,u=new m.Vector2(n/e,i/r),p=new m.Vector2((n+1)/e,i/r),d=new m.Vector2((n+1)/e,(i+1)/r),f=new m.Vector2(n/e,(i+1)/r),h.push(new m.Face3(t,s,o)),c.push([u,p,f]),h.push(new m.Face3(s,a,o)),c.push([p.clone(),d,f.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.ParametricGeometry.prototype=Object.create(m.Geometry.prototype),m.ParametricGeometry.prototype.constructor=m.ParametricGeometry,m.WireframeGeometry=function(t){function e(t,e){return t-e}m.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(t instanceof m.Geometry){var o=t.vertices,a=t.faces,s=0,h=new Uint32Array(6*a.length);t=0;for(var c=a.length;t<c;t++)for(var l=a[t],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(e);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)i=o[h[2*t+u]],s=6*t+3*u,r[s+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new m.BufferAttribute(r,3))}else if(t instanceof m.BufferGeometry){if(null!==t.index){for(c=t.index.array,o=t.attributes.position,s=0,0===(n=t.groups).length&&t.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,l=n.length;a<l;++a){u=(t=n[a]).start,p=t.count,t=u;for(var d=u+p;t<d;t+=3)for(u=0;3>u;u++)r[0]=c[t+u],r[1]=c[t+(u+1)%3],r.sort(e),p=r.toString(),void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)s=6*t+3*u,i=h[2*t+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(o=t.attributes.position.array,s=o.length/3,h=s/3,r=new Float32Array(6*s),t=0,c=h;t<c;t++)for(u=0;3>u;u++)s=18*t+6*u,h=9*t+3*u,r[s+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*t+(u+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new m.BufferAttribute(r,3))}},m.WireframeGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.WireframeGeometry.prototype.constructor=m.WireframeGeometry,m.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(t=new m.BufferGeometry).addAttribute("position",new m.BufferAttribute(e,3)),t.addAttribute("color",new m.BufferAttribute(r,3)),e=new m.LineBasicMaterial({vertexColors:m.VertexColors}),m.LineSegments.call(this,t,e)},m.AxisHelper.prototype=Object.create(m.LineSegments.prototype),m.AxisHelper.prototype.constructor=m.AxisHelper,m.ArrowHelper=function(){var t=new m.Geometry;t.vertices.push(new m.Vector3(0,0,0),new m.Vector3(0,1,0));var e=new m.CylinderGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(r,i,n,o,a,s){m.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),this.line=new m.Line(t,new m.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m.Mesh(e,new m.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),m.ArrowHelper.prototype=Object.create(m.Object3D.prototype),m.ArrowHelper.prototype.constructor=m.ArrowHelper,m.ArrowHelper.prototype.setDirection=function(){var t,e=new m.Vector3;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),m.ArrowHelper.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},m.ArrowHelper.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},m.BoxHelper=function(t){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new m.BufferGeometry;i.setIndex(new m.BufferAttribute(e,1)),i.addAttribute("position",new m.BufferAttribute(r,3)),m.LineSegments.call(this,i,new m.LineBasicMaterial({color:16776960})),void 0!==t&&this.update(t)},m.BoxHelper.prototype=Object.create(m.LineSegments.prototype),m.BoxHelper.prototype.constructor=m.BoxHelper,m.BoxHelper.prototype.update=function(){var t=new m.Box3;return function(e){if(t.setFromObject(e),!t.isEmpty()){e=t.min;var r=t.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=e.x,n[4]=r.y,n[5]=r.z,n[6]=e.x,n[7]=e.y,n[8]=r.z,n[9]=r.x,n[10]=e.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=e.z,n[15]=e.x,n[16]=r.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=r.x,n[22]=e.y,n[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),m.BoundingBoxHelper=function(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new m.Box3,m.Mesh.call(this,new m.BoxGeometry(1,1,1),new m.MeshBasicMaterial({color:r,wireframe:!0}))},m.BoundingBoxHelper.prototype=Object.create(m.Mesh.prototype),m.BoundingBoxHelper.prototype.constructor=m.BoundingBoxHelper,m.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},m.CameraHelper=function(t){function e(t,e,i){r(t,i),r(e,i)}function r(t,e){i.vertices.push(new m.Vector3),i.colors.push(new m.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(i.vertices.length-1)}var i=new m.Geometry,n=new m.LineBasicMaterial({color:16777215,vertexColors:m.FaceColors}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),m.LineSegments.call(this,i,n),this.camera=t,this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},m.CameraHelper.prototype=Object.create(m.LineSegments.prototype),m.CameraHelper.prototype.constructor=m.CameraHelper,m.CameraHelper.prototype.update=function(){function t(t,o,a,s){if(i.set(o,a,s).unproject(n),void 0!==(t=r[t]))for(o=0,a=t.length;o<a;o++)e.vertices[t[o]].copy(i)}var e,r,i=new m.Vector3,n=new m.Camera;return function(){e=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.verticesNeedUpdate=!0}}(),m.DirectionalLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var r=new m.Geometry;r.vertices.push(new m.Vector3(-e,e,0),new m.Vector3(e,e,0),new m.Vector3(e,-e,0),new m.Vector3(-e,-e,0),new m.Vector3(-e,e,0));var i=new m.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new m.Line(r,i),this.add(this.lightPlane),(r=new m.Geometry).vertices.push(new m.Vector3,new m.Vector3),(i=new m.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new m.Line(r,i),this.add(this.targetLine),this.update()},m.DirectionalLightHelper.prototype=Object.create(m.Object3D.prototype),m.DirectionalLightHelper.prototype.constructor=m.DirectionalLightHelper,m.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},m.DirectionalLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),m.EdgesHelper=function(t,e,r){e=void 0!==e?e:16777215,m.LineSegments.call(this,new m.EdgesGeometry(t.geometry,r),new m.LineBasicMaterial({color:e})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.EdgesHelper.prototype=Object.create(m.LineSegments.prototype),m.EdgesHelper.prototype.constructor=m.EdgesHelper,m.FaceNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.FaceNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.FaceNormalsHelper.prototype.constructor=m.FaceNormalsHelper,m.FaceNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=0,h=0,c=(o=o.faces).length;h<c;h++){var l=o[h],u=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(u).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),n.setXYZ(s,t.x,t.y,t.z),s+=1,n.setXYZ(s,e.x,e.y,e.z),s+=1}return n.needsUpdate=!0,this}}(),m.GridHelper=function(t,e){var r=new m.Geometry,i=new m.LineBasicMaterial({vertexColors:m.VertexColors});this.color1=new m.Color(4473924),this.color2=new m.Color(8947848);for(var n=-t;n<=t;n+=e){r.vertices.push(new m.Vector3(-t,0,n),new m.Vector3(t,0,n),new m.Vector3(n,0,-t),new m.Vector3(n,0,t));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}m.LineSegments.call(this,r,i)},m.GridHelper.prototype=Object.create(m.LineSegments.prototype),m.GridHelper.prototype.constructor=m.GridHelper,m.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},m.HemisphereLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new m.Color,new m.Color];var r=new m.SphereGeometry(e,4,2);r.rotateX(-Math.PI/2);for(var i=0;8>i;i++)r.faces[i].color=this.colors[4>i?0:1];i=new m.MeshBasicMaterial({vertexColors:m.FaceColors,wireframe:!0}),this.lightSphere=new m.Mesh(r,i),this.add(this.lightSphere),this.update()},m.HemisphereLightHelper.prototype=Object.create(m.Object3D.prototype),m.HemisphereLightHelper.prototype.constructor=m.HemisphereLightHelper,m.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},m.HemisphereLightHelper.prototype.update=function(){var t=new m.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),m.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var r=new m.SphereGeometry(e,4,2),i=new m.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),m.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},m.PointLightHelper.prototype=Object.create(m.Mesh.prototype),m.PointLightHelper.prototype.constructor=m.PointLightHelper,m.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},m.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},m.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new m.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof m.Bone&&(e.vertices.push(new m.Vector3),e.vertices.push(new m.Vector3),e.colors.push(new m.Color(0,0,1)),e.colors.push(new m.Color(0,1,0)));e.dynamic=!0,r=new m.LineBasicMaterial({vertexColors:m.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),m.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},m.SkeletonHelper.prototype=Object.create(m.LineSegments.prototype),m.SkeletonHelper.prototype.constructor=m.SkeletonHelper,m.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof m.Bone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},m.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new m.Matrix4).getInverse(this.root.matrixWorld),r=new m.Matrix4,i=0,n=0;n<this.bones.length;n++){var o=this.bones[n];o.parent instanceof m.Bone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},m.SpotLightHelper=function(t){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,(t=new m.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),t.rotateX(-Math.PI/2);var e=new m.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new m.Mesh(t,e),this.add(this.cone),this.update()},m.SpotLightHelper.prototype=Object.create(m.Object3D.prototype),m.SpotLightHelper.prototype.constructor=m.SpotLightHelper,m.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},m.SpotLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),m.VertexNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=3*r.faces.length:r instanceof m.BufferGeometry&&(e=r.attributes.normal.count),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.VertexNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.VertexNormalsHelper.prototype.constructor=m.VertexNormalsHelper,m.VertexNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof m.Geometry)for(var s=a.vertices,h=a.faces,c=a=0,l=h.length;c<l;c++)for(var u=h[c],p=0,d=u.vertexNormals.length;p<d;p++){var f=u.vertexNormals[p];t.copy(s[u[i[p]]]).applyMatrix4(n),e.copy(f).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a instanceof m.BufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;p<d;p++)t.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(n),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;return o.needsUpdate=!0,this}}(),m.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215;m.LineSegments.call(this,new m.WireframeGeometry(t.geometry),new m.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.WireframeHelper.prototype=Object.create(m.LineSegments.prototype),m.WireframeHelper.prototype.constructor=m.WireframeHelper,m.ImmediateRenderObject=function(t){m.Object3D.call(this),this.material=t,this.render=function(t){}},m.ImmediateRenderObject.prototype=Object.create(m.Object3D.prototype),m.ImmediateRenderObject.prototype.constructor=m.ImmediateRenderObject,m.MorphBlendMesh=function(t,e){m.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,r/1),this.setAnimationWeight("__default",1)},m.MorphBlendMesh.prototype=Object.create(m.Mesh.prototype),m.MorphBlendMesh.prototype.constructor=m.MorphBlendMesh,m.MorphBlendMesh.prototype.createAnimation=function(t,e,r,i){e={start:e,end:r,length:r-e+1,fps:i,duration:(r-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},m.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s=n.morphTargets[o].name.match(r);if(s&&1<s.length){var h=s[1];i[h]||(i[h]={start:1/0,end:-1/0}),o<(s=i[h]).start&&(s.start=o),o>s.end&&(s.end=o),e||(e=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.end,t);this.firstAnimation=e},m.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},m.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},m.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},m.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},m.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},m.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},m.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},m.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},m.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},m.MorphBlendMesh.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},m.MorphBlendMesh.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||0>i.time)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),0>i.time&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,0>i.time&&(i.time+=i.duration));var o=i.start+m.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o),n=i.time%n/n,i.directionBackwards&&(n=1-n),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a):this.morphTargetInfluences[i.currentFrame]=a}}};var g=function(){function t(){}return t.prototype.webgl=function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}},t}();d.prototype={VERSION:"2.2.0",defaults:{imageCloud:"",cloudSpeed:1,skyColor:"#ffffff",skyColorPower:50,cameraControl:!1,cameraXSpeed:.01,cameraYSpeed:.02,cloudData:[]},cameraNearClipPlane:1,cameraFarClipPlane:1e3,vFOV:60,init:function(t,e){this.container=t,this.config=e,this.create()},create:function(){if(!this.util().webgl())throw Error("Your browser does not support WebGL.");this.resetListeners(),this.resetScene(),this.load()},load:function(){var e={};e.cloud=this.config.imageCloud;var r=0,i=0;for(var n in e)e.hasOwnProperty(n)&&r++;for(var n in e)if(e.hasOwnProperty(n)){var o=new XMLHttpRequest;o.open("GET",e[n],!0),o.crossOrigin="Anonymous",o.responseType="arraybuffer",o.customKey=n,o.onload=t.proxy(function(n){var o=n.currentTarget;if(o.status>=400)return o.onerror(n);var a=new Blob([o.response]),s=new Image;s.src=window.URL.createObjectURL(a),s.onload=t.proxy(function(t){e[t.customKey]=s,++i==r&&(this.applyListeners(),this.buildScene(e),this.renderScene())},this,o)},this),o.onerror=t.proxy(function(t){var e=t.currentTarget;throw Error("Cannot load resource "+e.responseURL+". Status code ["+e.status+"]")},this),o.send()}},buildScene:function(t){var e=this.container.width(),r=this.container.height();this.aspect=e/r,this.scene=new m.Scene,this.camera=new m.PerspectiveCamera(this.vFOV,this.aspect,this.cameraNearClipPlane,this.cameraFarClipPlane),this.camera.position.z=this.cameraFarClipPlane,this.scene.add(this.camera);var i=this.createTexture(t,"cloud");this.buildClouds(i),this.renderer=new m.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,r),this.container.append(this.renderer.domElement)},buildClouds:function(t){var e={uniforms:{texCloud:{type:"t",value:null},skyColor:{type:"c",value:null},fogFar:{type:"f",value:null},fogNear:{type:"f",value:null},horizonLength:{type:"f",value:null}},vs:["varying vec2 vUv;","void main()","{","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fs:["uniform sampler2D texCloud;","uniform vec3 skyColor;","uniform float fogFar;","uniform float fogNear;","uniform float horizonLength;","varying vec2 vUv;","void main()","{","float distance = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = smoothstep( fogNear, fogFar, distance );","gl_FragColor = texture2D( texCloud, vUv );","if(distance >= (horizonLength - 200.0)) {","gl_FragColor.a *= 1.0 - ((distance - (horizonLength - 200.0)) / 200.0);","} else if(distance <= 200.0) {","gl_FragColor.a *= (distance / 200.0);","}","gl_FragColor = mix( gl_FragColor, vec4( skyColor, gl_FragColor.w ), fogFactor );","}"].join("\n")};e.uniforms.texCloud.value=t;var r=1-.01*Math.min(Math.max(parseInt(this.config.skyColorPower,10),0),100),i=new m.Fog(this.config.skyColor,this.cameraFarClipPlane*r,this.cameraFarClipPlane);e.uniforms.skyColor.value=i.color,e.uniforms.fogFar.value=i.far,e.uniforms.fogNear.value=i.near,e.uniforms.horizonLength.value=this.cameraFarClipPlane;for(var n=new m.ShaderMaterial({uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,depthWrite:!1,depthTest:!1,transparent:!0}),o=Math.tan(this.vFOV/2*Math.PI/180)*this.cameraFarClipPlane*2*2,a=o*this.aspect,s=new m.Geometry,h=0;h<this.cameraFarClipPlane;h++){for(var c=new m.PlaneGeometry(128,128),l=Math.random()*a-a/2,u=-Math.random()*Math.random()*o/40-o/20,p=h,d=Math.random()*Math.PI,f=2*Math.random()+.5,g=0;g<this.config.cloudData.length;g++)if(this.config.cloudData[g].i==h){var v=this.config.cloudData[g];v.hasOwnProperty("x")&&(l=v.x*a-a/2),v.hasOwnProperty("y")&&(u=v.y*o-o/2),v.hasOwnProperty("rotate")&&(d=v.rotate*Math.PI),v.hasOwnProperty("scale")&&(f=v.scale);break}c.center(),c.rotateZ(d),c.scale(f,f,1),c.translate(l,u,p),s.merge(c)}var y=new m.Mesh(s,n);this.scene.add(y),(y=new m.Mesh(s,n)).position.z=-this.cameraFarClipPlane,this.scene.add(y)},resetScene:function(){this.animationId&&cancelAnimationFrame(this.animationId),this.renderer=null,this.scene=null,this.camera=null,this.container.empty()},renderScene:function(){this.animationId=requestAnimationFrame(t.proxy(this.renderScene,this)),this.camera.position.z-=this.config.cloudSpeed,this.camera.position.z<0&&(this.camera.position.z=this.cameraFarClipPlane),this.camera.position.x+=(this.cameraX.value-this.camera.position.x)*this.config.cameraXSpeed,this.camera.position.y+=(this.cameraY.value-this.camera.position.y)*this.config.cameraYSpeed,this.camera.rotation.z+=.05*(this.cameraRotation.value-this.camera.rotation.z),this.renderer.render(this.scene,this.camera)},pause:function(){this.animationId&&cancelAnimationFrame(this.animationId)},play:function(){this.renderScene()},applyListeners:function(){this.config.cameraControl&&(this.container.on("mousemove.clouds",t.proxy(this.onMouseMove,this)),this.container.on("touchmove.clouds",t.proxy(this.onMouseMove,this))),t(window).on("resize.clouds",t.proxy(this.onWindowResize,this))},resetListeners:function(){this.container.off("mousemove.clouds"),this.container.off("touchmove.clouds"),t(window).off("resize.clouds")},onMouseMove:function(t){var e=this.getMousePositionPower("touchmove"==t.type?t.originalEvent.targetTouches[0]:t);this.cameraX.value=e.x<0?e.x*Math.abs(this.cameraX.min):e.x*Math.abs(this.cameraX.max),this.cameraY.value=e.y<0?e.y*Math.abs(this.cameraY.min):e.y*Math.abs(this.cameraY.max),this.cameraRotation.value=.03*e.x},onWindowResize:function(t){this.aspect=this.container.width()/this.container.height(),this.camera.aspect=this.aspect,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.container.width(),this.container.height())},destroy:function(){this.resetListeners(),this.resetScene()},getMousePositionPower:function(t){var e=this.container.get(0).getBoundingClientRect(),r={},i=(e.right-e.left)/2,n=(e.bottom-e.top)/2,o=this.container.offset();return r.x=(t.pageX-o.left-i)/i,r.y=(n-(t.pageY-o.top))/n,r},createTexture:function(t,e){var r=new m.Texture;return r.image=t[e],r.needsUpdate=!0,r},util:function(){return null!=this._util?this._util:this._util=new g}},t.clouds=function(t,e){if("support"==t)return new g,!!this.util().webgl()},t.fn.clouds=function(e,r){return this.each(function(){var r=t(this),i=r.data("clouds"),n=t.isPlainObject(e)?e:{};if("destroy"!=e)if("pause"!=e)if("play"!=e)if(i){var o=t.extend({},i.config,n);i.init(r,o)}else i=new d(r,o=t.extend({},d.prototype.defaults,n)),r.data("clouds",i);else{if(!i)throw Error("Calling 'play' method on not initialized instance is forbidden");i.play()}else{if(!i)throw Error("Calling 'pause' method on not initialized instance is forbidden");i.pause()}else{if(!i)throw Error("Calling 'destroy' method on not initialized instance is forbidden");i.destroy()}})};var v={imageCloud:weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/cloud-white.png",skyColor:"#8c9793",skyColorPower:100,cloudSpeed:1.5,cameraControl:!0,cloudData:[{i:0,x:.5,y:.4,scale:3},{i:150,x:.5,y:.4,scale:5},{i:300,x:.5,y:.4,scale:6},{i:450,x:.5,y:.4,scale:6},{i:600,x:.5,y:.4,scale:7},{i:10,x:.35,y:.45,scale:2},{i:160,x:.35,y:.45,scale:4},{i:310,x:.35,y:.45,scale:5},{i:460,x:.35,y:.45,scale:5},{i:610,x:.35,y:.45,scale:6},{i:20,x:.65,y:.45,scale:2},{i:170,x:.65,y:.45,scale:4},{i:320,x:.65,y:.45,scale:5},{i:470,x:.65,y:.45,scale:5},{i:620,x:.65,y:.45,scale:6}]};t("#weather_press_scene_container").clouds(v)}})}(jQuery);
     2!function(t){"use strict";t(document).ready(function(){if(console.log("THANK YOU FOR CHOOSING WEATHER PRESS, V4.5"),t("#weather-press-layoutContainer").length){var e,r,i=null,n=t(".weather-press-block-bottom").width(),o=0;t("#weather-press-forecast-loader").css("left",n+7),t(".weather-press-cities-list li").each(function(i,n){if(t(n).hasClass("main-location"))return e=i,r=t(n).position().top.toFixed(2),t("#weather-press-city-name").text(t(n).text()),t("#weather-press-city-name").attr("title",t(n).text()),!1}),t("#weather-press-display-image").click(function(){t(".weather-press-cities-list").css("margin-top");t(".weather-press-block-bottom").toggleClass("weather-press-block-bottom-marginTop"),t(".weather-press-block-middle img").fadeToggle("slow","linear")}),t(".weather-press-closeIcon").click(function(){var e=t(this).attr("data-weatherpressclose");t("."+e).removeClass("flipInX"),t("."+e).addClass("flipOutX"),"weather-press-dailyForecast"==e?t(".weather-press-forecasts ul li").each(function(e,r){t(r).removeClass("weather-press-forecast-active"),0==e&&t(r).addClass("weather-press-forecast-active")}):"weather-press-loader"==e&&(t(".weather-press-outputs-content").text("Loading ..."),t(".weather-press-outputs-toPremium").css("opacity","0"),t(".weather-press-cities-nav-container").css("display","block"),null!=i&&i.abort())}),t("#weather-press-cities-navs-top").click(function(){a(e+1)}),t("#weather-press-cities-navs-bottom").click(function(){a(e-1)});var a=function(i){var n,o=t(".weather-press-cities-list li").length;t(".weather-press-cities-list li").each(function(a,s){if(a==i&&a<o&&a>=0)return e=a,t("#weather-press-city-name").text(t(s).text()),t("#weather-press-city-name").attr("title",t(s).text()),t(s).removeClass(),t(s).addClass("main-location"),n=t(s).position().top.toFixed(2),t(".weather-press-cities-list").css("margin-top",r-n),t(".weather-press-cities-list li:eq("+(a-1)+")").length&&t(".weather-press-cities-list li:eq("+(a-1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").length&&(t(".weather-press-cities-list li:eq("+(a-2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a-2)+")").addClass("deep")),t(".weather-press-cities-list li:eq("+(a+1)+")").length&&t(".weather-press-cities-list li:eq("+(a+1)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").length&&(t(".weather-press-cities-list li:eq("+(a+2)+")").removeClass(),t(".weather-press-cities-list li:eq("+(a+2)+")").addClass("deep")),!1})},s=function(e){var r;1==e?3>o?(r=-1*++o*(n+7),t(".weather-press-forecast-list").css("left",r),t(".weather-press-block-bottom").addClass("initial-background")):h(1):-1==e&&(o>0?(r=-1*--o*(n+7),t(".weather-press-forecast-list").css("left",r),0==o&&t(".weather-press-block-bottom").removeClass("initial-background")):h(-1))},h=function(e){var r,i,o;1==e?(r=-3*(n+7),i=parseInt(r)-10,clearTimeout(o),t(".weather-press-forecast-list").css("left",i),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",r)},300)):-1==e&&(clearTimeout(o),t(".weather-press-forecast-list").css("left",10),o=setTimeout(function(){t(".weather-press-forecast-list").css("left",0)},300))},c=function(){t("#weather-press-loader").removeClass("flipOutX"),t("#weather-press-loader").addClass("flipInX"),t(".weather-press-cities-nav-container").css("display","none"),t(".weather-press-forecast-list").css("left",0),o=0,t(".weather-press-block-bottom").removeClass("initial-background")};t(".weather-press-cities-list li").click(function(){a(t(this).index()),l(t(this),1),p(t(this),1)}),t("#weather-press-city-name").click(function(){l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1)}),t("#weather-press-forecast-navs-right").click(function(){s(1)}),t("#weather-press-forecast-navs-left").click(function(){s(-1)});var l=function(e,r){c(),i=t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"current",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(r){var i=void 0!=r.temp?r.temp:"00",n=void 0!=r.temp_min?r.temp_min:"00",o=void 0!=r.temp_max?r.temp_max:"00",s=void 0!=r.icon?r.icon:"undefined";t(".weather-press-forecast-list li:first-child .weather-press-temp").text(i+"°"),t(".weather-press-forecast-list li:first-child .weather-press-condition-img > img").attr("src",weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+s+".png"),t(".weather-press-forecast-list li:first-child .weather-press-min-temp").text(n+"°"),t(".weather-press-forecast-list li:first-child .weather-press-max-temp").text(o+"°"),s.indexOf("n")>=0&&"undefined"!=s?(t(".weather-press-block-bottom").addClass("night-background"),t(".weather-press-block-middle").addClass("night-background"),console.log("night")):(t(".weather-press-block-bottom").removeClass("night-background"),t(".weather-press-block-middle").removeClass("night-background"),console.log("day")),a(e.index()),f(),t(".weather-press-cities-nav-container").css("display","block")},error:function(e){console.log(e);var r=JSON.stringify(e.responseText).substring(1,JSON.stringify(e.responseText).length-1);t(".weather-press-outputs-content").text("Error : "+r)}})},u=0,p=function(e,r){t.ajax({type:"POST",url:weather_press_data_from_php.weather_press_ajax_url,data:{action:"weather_press_public_ajaxCalls",find:"daily",save:r,city:encodeURIComponent(e.text().toLowerCase()),unit:weather_press_data_from_php.weather_press_Current_Unit,nbrDays:4,language:weather_press_data_from_php.weather_press_Current_Language},cache:!1,dataType:"json",success:function(i){var n,o,a,s,h,c;t.each(i,function(l,d){if(l>0)if(n=i[l].date,o=i[l].maxtemp,a=i[l].mintemp,s=i[l].daytemp,h=i[l].icon,n)1==l&&t(".weather-press-forecast-list > li").length>1&&t(".weather-press-forecast-list > li:not(:first)").remove(),(c=t("<li id='weather_press_forecast_node_"+l+"'><ul class='weather-press-forecast-item'><li class='weather-press-date' class='weather-press-date'>"+n+"</li><li class='weather-press-temp'>"+s+"°</li><li class='weather-press-condition-img'><img src='"+weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/"+h+".png' alt='icon'/></li><li class='weather-press-minMax'><ul><li class='weather-press-min-temp'>"+a+"°</li><li class='weather-press-temp-gauge'><div class='weather-press-gauge-gradient'></div></li><li class='weather-press-max-temp'>"+o+"°</li></ul></li></ul></li>")).insertAfter("#weather_press_forecast_node_"+(l-1));else if(u<=2){for(var f=1;l<4;f++)t(".weather-press-forecast-list > li;eq("+f+")").remove();p(e,r),u++}}),t("#weather-press-forecast-loader").css("display","none")},error:function(t){}})};l(t(".weather-press-cities-list .main-location"),1),p(t(".weather-press-cities-list .main-location"),1);function d(t,e){this.config=null,this.container=null,this.renderer=null,this.scene=null,this.camera=null,this.aspect=0,this.cameraX={value:0,min:-50,max:50},this.cameraY={value:0,min:-100,max:50},this.cameraRotation={value:0},this.init(t,e)}var f=function(){t("#weather-press-loader").removeClass("flipInX"),t("#weather-press-loader").addClass("flipOutX"),0!=t("#weather_press_brand").length&&"none"!=t("#weather_press_brand").css("display")&&"0"!=t("#weather_press_brand").css("opacity")&&"hidden"!=t("#weather_press_brand").css("visibility")&&0!=t("#weather_press_brand a").length&&"none"!=t("#weather_press_brand a").css("display")&&"0"!=t("#weather_press_brand a").css("opacity")&&"hidden"!=t("#weather_press_brand a").css("visibility")||(t(".weather-press-block-bottom").empty(),t(".weather-press-block-bottom").css("height","221px"),c(),t(".weather-press-outputs-content").text('As a free user you do not have permission to remove the "weather press" brand from the bottom of the widget !'),t(".weather-press-outputs-content").css("color","red"),t(".weather-press-outputs-content").css("text-align","left"),t(".weather-press-outputs-content").css("background","#F1F3F3"))},m={REVISION:"74"};"function"==typeof define&&define.amd?define("three",m):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=m),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:0<t?1:+t}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1,i=arguments.length;r!==i;++r)if(void 0!==(n=arguments[r])&&null!==n)for(var n=Object(n),o=Object.keys(n),a=0,s=o.length;a!==s;++a){var h=o[a],c=Object.getOwnPropertyDescriptor(n,h);void 0!==c&&c.enumerable&&(e[h]=n[h])}return e}}),m.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},m.CullFaceNone=0,m.CullFaceBack=1,m.CullFaceFront=2,m.CullFaceFrontBack=3,m.FrontFaceDirectionCW=0,m.FrontFaceDirectionCCW=1,m.BasicShadowMap=0,m.PCFShadowMap=1,m.PCFSoftShadowMap=2,m.FrontSide=0,m.BackSide=1,m.DoubleSide=2,m.FlatShading=1,m.SmoothShading=2,m.NoColors=0,m.FaceColors=1,m.VertexColors=2,m.NoBlending=0,m.NormalBlending=1,m.AdditiveBlending=2,m.SubtractiveBlending=3,m.MultiplyBlending=4,m.CustomBlending=5,m.AddEquation=100,m.SubtractEquation=101,m.ReverseSubtractEquation=102,m.MinEquation=103,m.MaxEquation=104,m.ZeroFactor=200,m.OneFactor=201,m.SrcColorFactor=202,m.OneMinusSrcColorFactor=203,m.SrcAlphaFactor=204,m.OneMinusSrcAlphaFactor=205,m.DstAlphaFactor=206,m.OneMinusDstAlphaFactor=207,m.DstColorFactor=208,m.OneMinusDstColorFactor=209,m.SrcAlphaSaturateFactor=210,m.NeverDepth=0,m.AlwaysDepth=1,m.LessDepth=2,m.LessEqualDepth=3,m.EqualDepth=4,m.GreaterEqualDepth=5,m.GreaterDepth=6,m.NotEqualDepth=7,m.MultiplyOperation=0,m.MixOperation=1,m.AddOperation=2,m.UVMapping=300,m.CubeReflectionMapping=301,m.CubeRefractionMapping=302,m.EquirectangularReflectionMapping=303,m.EquirectangularRefractionMapping=304,m.SphericalReflectionMapping=305,m.RepeatWrapping=1e3,m.ClampToEdgeWrapping=1001,m.MirroredRepeatWrapping=1002,m.NearestFilter=1003,m.NearestMipMapNearestFilter=1004,m.NearestMipMapLinearFilter=1005,m.LinearFilter=1006,m.LinearMipMapNearestFilter=1007,m.LinearMipMapLinearFilter=1008,m.UnsignedByteType=1009,m.ByteType=1010,m.ShortType=1011,m.UnsignedShortType=1012,m.IntType=1013,m.UnsignedIntType=1014,m.FloatType=1015,m.HalfFloatType=1025,m.UnsignedShort4444Type=1016,m.UnsignedShort5551Type=1017,m.UnsignedShort565Type=1018,m.AlphaFormat=1019,m.RGBFormat=1020,m.RGBAFormat=1021,m.LuminanceFormat=1022,m.LuminanceAlphaFormat=1023,m.RGBEFormat=m.RGBAFormat,m.RGB_S3TC_DXT1_Format=2001,m.RGBA_S3TC_DXT1_Format=2002,m.RGBA_S3TC_DXT3_Format=2003,m.RGBA_S3TC_DXT5_Format=2004,m.RGB_PVRTC_4BPPV1_Format=2100,m.RGB_PVRTC_2BPPV1_Format=2101,m.RGBA_PVRTC_4BPPV1_Format=2102,m.RGBA_PVRTC_2BPPV1_Format=2103,m.RGB_ETC1_Format=2151,m.LoopOnce=2200,m.LoopRepeat=2201,m.LoopPingPong=2202,m.InterpolateDiscrete=2300,m.InterpolateLinear=2301,m.InterpolateSmooth=2302,m.ZeroCurvatureEnding=2400,m.ZeroSlopeEnding=2401,m.WrapAroundEnding=2402,m.TrianglesDrawMode=0,m.TriangleStripDrawMode=1,m.TriangleFanDrawMode=2,m.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},m.Color.prototype={constructor:m.Color,r:1,g:1,b:1,set:function(t){return t instanceof m.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.b=this.g=this.r=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:.5>r?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){return e=m.Math.euclideanModulo(e,1),r=m.Math.clamp(r,0,1),i=m.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(r=.5>=i?i*(1+r):i+r-i*r,i=2*i-r,this.r=t(i,r,e+1/3),this.g=t(i,r,e),this.b=t(i,r,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t))switch(i=r[2],r[1]){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)){var i=parseFloat(r[1])/360,n=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(i,n,o)}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){if(r=r[1],3===(i=r.length))return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===i)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return t&&0<t.length&&(r=m.ColorKeywords[t],void 0!==r?this.setHex(r):console.warn("THREE.Color: Unknown color "+t)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=0<e?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){t=t||{h:0,s:0,l:0};var e,r=this.r,i=this.g,n=this.b,o=Math.max(r,i,n),a=((h=Math.min(r,i,n))+o)/2;if(h===o)h=e=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case r:e=(i-n)/s+(i<n?6:0);break;case i:e=(n-r)/s+2;break;case n:e=(r-i)/s+4}e/=6}return t.h=e,t.s=h,t.l=a,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},m.ColorKeywords={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,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},m.Quaternion=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==i?i:1},m.Quaternion.prototype={constructor:m.Quaternion,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(0==t instanceof m.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),n=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),h=t.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,r=e[0];t=e[4];var i=e[8],n=e[1],o=e[5],a=e[9],s=e[2],h=e[6],c=r+o+(e=e[10]);return 0<c?(r=.5/Math.sqrt(c+1),this._w=.25/r,this._x=(h-a)*r,this._y=(i-s)*r,this._z=(n-t)*r):r>o&&r>e?(r=2*Math.sqrt(1+r-o-e),this._w=(h-a)/r,this._x=.25*r,this._y=(t+n)/r,this._z=(i+s)/r):o>e?(r=2*Math.sqrt(1+o-r-e),this._w=(i-s)/r,this._x=(t+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+e-r-o),this._w=(n-t)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3),e=r.dot(i)+1,1e-6>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var r=t._x,i=t._y,n=t._z,o=t._w,a=e._x,s=e._y,h=e._z,c=e._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,i=this._y,n=this._z,o=this._w;if(0>(s=o*t._w+r*t._x+i*t._y+n*t._z)?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),1<=s)return this._w=o,this._x=r,this._y=i,this._z=n,this;if(h=Math.sqrt(1-s*s),.001>Math.abs(h))return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var a=Math.atan2(h,s),s=Math.sin((1-e)*a)/h,h=Math.sin(e*a)/h;return this._w=o*s+this._w*h,this._x=r*s+this._x*h,this._y=i*s+this._y*h,this._z=n*s+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(m.Quaternion,{slerp:function(t,e,r,i){return r.copy(t).slerp(e,i)},slerpFlat:function(t,e,r,i,n,o,a){var s=r[i+0],h=r[i+1],c=r[i+2];r=r[i+3],i=n[o+0];var l=n[o+1],u=n[o+2];if(n=n[o+3],r!==n||s!==i||h!==l||c!==u){o=1-a;var p=s*i+h*l+c*u+r*n,d=0<=p?1:-1,f=1-p*p;f>Number.EPSILON&&(f=Math.sqrt(f),p=Math.atan2(f,p*d),o=Math.sin(o*p)/f,a=Math.sin(a*p)/f),s=s*o+i*(d*=a),h=h*o+l*d,c=c*o+u*d,r=r*o+n*d,o===1-a&&(a=1/Math.sqrt(s*s+h*h+c*c+r*r),s*=a,h*=a,c*=a,r*=a)}t[e]=s,t[e+1]=h,t[e+2]=c,t[e+3]=r}}),m.Vector2=function(t,e){this.x=t||0,this.y=e||0},m.Vector2.prototype={constructor:m.Vector2,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):this.y=this.x=0,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector2,e=new m.Vector2),t.set(r,r),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return t=this.y-t.y,e*e+t*t},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,o=this.y-t.y;return this.x=n*r-o*i+t.x,this.y=n*i+o*r+t.y,this}},m.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},m.Vector3.prototype={constructor:m.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):this.z=this.y=this.x=0,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return 0==e instanceof m.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromEuler(e)),this}}(),applyAxisAngle:function(){var t;return function(e,r){return void 0===t&&(t=new m.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,r)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[3]*r+t[6]*i,this.y=t[1]*e+t[4]*r+t[7]*i,this.z=t[2]*e+t[5]*r+t[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12],this.y=t[1]*e+t[5]*r+t[9]*i+t[13],this.z=t[2]*e+t[6]*r+t[10]*i+t[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=1/((t=t.elements)[3]*e+t[7]*r+t[11]*i+t[15]);return this.x=(t[0]*e+t[4]*r+t[8]*i+t[12])*n,this.y=(t[1]*e+t[5]*r+t[9]*i+t[13])*n,this.z=(t[2]*e+t[6]*r+t[10]*i+t[14])*n,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*i-a*r,h=t*r+a*e-n*i,c=t*i+n*r-o*e,e=-n*e-o*r-a*i;return this.x=s*t+e*-n+h*-a-c*-o,this.y=h*t+e*-o+c*-n-s*-a,this.z=c*t+e*-a+s*-o-h*-n,this},project:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i,this.y=t[1]*e+t[5]*r+t[9]*i,this.z=t[2]*e+t[6]*r+t[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector3,e=new m.Vector3),t.set(r,r,r),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,i=this.y,n=this.z;return this.x=i*t.z-n*t.y,this.y=n*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var t,e;return function(r){return void 0===t&&(t=new m.Vector3),t.copy(r).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(m.Math.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return t=this.z-t.z,e*e+r*r+t*t},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),r=this.set(t.elements[4],t.elements[5],t.elements[6]).length();return t=this.set(t.elements[8],t.elements[9],t.elements[10]).length(),this.x=e,this.y=r,this.z=t,this},setFromMatrixColumn:function(t,e){var r=4*t,i=e.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},m.Vector4=function(t,e,r,i){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==i?i:1},m.Vector4.prototype={constructor:m.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w;return t=t.elements,this.x=t[0]*e+t[4]*r+t[8]*i+t[12]*n,this.y=t[1]*e+t[5]*r+t[9]*i+t[13]*n,this.z=t[2]*e+t[6]*r+t[10]*i+t[14]*n,this.w=t[3]*e+t[7]*r+t[11]*i+t[15]*n,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,i,n=(t=t.elements)[0];i=t[4];var o=t[8],a=t[1],s=t[5],h=t[9];r=t[2],e=t[6];var c=t[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(h-e)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(h+e)&&.1>Math.abs(n+s+c-3)?(this.set(1,0,0,0),this):(t=Math.PI,n=(n+1)/2,s=(s+1)/2,c=(c+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+e)/4,n>s&&n>c?.01>n?(e=0,i=r=.707106781):(e=Math.sqrt(n),r=i/e,i=o/e):s>c?.01>s?(e=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),e=i/r,i=h/r):.01>c?(r=e=.707106781,i=0):(i=Math.sqrt(c),e=o/i,r=h/i),this.set(e,r,i,t),this):(t=Math.sqrt((e-h)*(e-h)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(t)&&(t=1),this.x=(e-h)/t,this.y=(o-r)/t,this.z=(a-i)/t,this.w=Math.acos((n+s+c-1)/2),this)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(r,i){return void 0===t&&(t=new m.Vector4,e=new m.Vector4),t.set(r,r,r,r),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=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),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t),this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,r){return void 0===r&&(r=0),e=e*t.itemSize+r,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},m.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||m.Euler.DefaultOrder},m.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),m.Euler.DefaultOrder="XYZ",m.Euler.prototype={constructor:m.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var i=m.Math.clamp;t=(u=t.elements)[0];var n=u[4],o=u[8],a=u[1],s=u[5],h=u[9],c=u[2],l=u[6],u=u[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,t)):(this._x=Math.atan2(l,s),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),.99999>Math.abs(h)?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,s)):(this._y=Math.atan2(-c,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-n,s)):(this._y=0,this._z=Math.atan2(a,t))):"ZYX"===e?(this._y=Math.asin(-i(c,-1,1)),.99999>Math.abs(c)?(this._x=Math.atan2(l,u),this._z=Math.atan2(a,t)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===e?(this._z=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,t)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===e?(this._z=Math.asin(-i(n,-1,1)),.99999>Math.abs(n)?(this._x=Math.atan2(l,s),this._y=Math.atan2(o,t)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,i),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new m.Quaternion;return function(e){t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new m.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},m.Line3=function(t,e){this.start=void 0!==t?t:new m.Vector3,this.end=void 0!==e?e:new m.Vector3},m.Line3.prototype={constructor:m.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){return(t||new m.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new m.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new m.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var n=e.dot(e),n=e.dot(t)/n;return i&&(n=m.Math.clamp(n,0,1)),n}}(),closestPointToPoint:function(t,e,r){return t=this.closestPointToPointParameter(t,e),r=r||new m.Vector3,this.delta(r).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},m.Box2=function(t,e){this.min=void 0!==t?t:new m.Vector2(1/0,1/0),this.max=void 0!==e?e:new m.Vector2(-1/0,-1/0)},m.Box2.prototype={constructor:m.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector2;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){return(t||new m.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector2).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new m.Vector2).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new m.Vector2).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector2;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Box3=function(t,e){this.min=void 0!==t?t:new m.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new m.Vector3(-1/0,-1/0,-1/0)},m.Box3.prototype={constructor:m.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){this.makeEmpty();for(var e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=t.length;s<h;s+=3){var c=t[s],l=t[s+1],u=t[s+2];c<e&&(e=c),l<r&&(r=l),u<i&&(i=u),c>n&&(n=c),l>o&&(o=l),u>a&&(a=u)}this.min.set(e,r,i),this.max.set(n,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new m.Vector3;return function(e,r){var i=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t;return function(e){void 0===t&&(t=new m.Box3);var r=this;return this.makeEmpty(),e.updateMatrixWorld(!0),e.traverse(function(e){var i=e.geometry;void 0!==i&&(null===i.boundingBox&&i.computeBoundingBox(),t.copy(i.boundingBox),t.applyMatrix4(e.matrixWorld),r.union(t))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){return(t||new m.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new m.Vector3).subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new m.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new m.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return 0<t.normal.x?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),0<t.normal.y?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new m.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new m.Vector3;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new m.Vector3;return function(e){return e=e||new m.Sphere,e.center=this.center(),e.radius=.5*this.size(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3];return function(e){return t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(t),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},m.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},m.Matrix3.prototype={constructor:m.Matrix3,set:function(t,e,r,i,n,o,a,s,h){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){return t=t.elements,this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix3(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],h=t[7];return e*o*(t=t[8])-e*a*h-r*n*t+r*a*s+i*n*h-i*o*s},getInverse:function(t,e){var r=t.elements,i=this.elements;if(i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4],0==(r=r[0]*i[0]+r[1]*i[3]+r[2]*i[6])){if(e)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}},m.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},m.Matrix4.prototype={constructor:m.Matrix4,set:function(t,e,r,i,n,o,a,s,h,c,l,u,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=c,g[10]=l,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new m.Matrix4).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new m.Vector3);var r=this.elements;e=e.elements;var i=1/t.set(e[0],e[1],e[2]).length(),n=1/t.set(e[4],e[5],e[6]).length(),o=1/t.set(e[8],e[9],e[10]).length();return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,this}}(),makeRotationFromEuler:function(t){0==t instanceof m.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,i=t.y,n=t.z,o=Math.cos(r),r=Math.sin(r),a=Math.cos(i),i=Math.sin(i),s=Math.cos(n),n=Math.sin(n);if("XYZ"===t.order){t=o*s;var h=o*n,c=r*s,l=r*n;e[0]=a*s,e[4]=-a*n,e[8]=i,e[1]=h+c*i,e[5]=t-l*i,e[9]=-r*a,e[2]=l-t*i,e[6]=c+h*i,e[10]=o*a}else"YXZ"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t+l*r,e[4]=c*r-h,e[8]=o*i,e[1]=o*n,e[5]=o*s,e[9]=-r,e[2]=h*r-c,e[6]=l+t*r,e[10]=o*a):"ZXY"===t.order?(t=a*s,h=a*n,c=i*s,l=i*n,e[0]=t-l*r,e[4]=-o*n,e[8]=c+h*r,e[1]=h+c*r,e[5]=o*s,e[9]=l-t*r,e[2]=-o*i,e[6]=r,e[10]=o*a):"ZYX"===t.order?(t=o*s,h=o*n,c=r*s,l=r*n,e[0]=a*s,e[4]=c*i-h,e[8]=t*i+l,e[1]=a*n,e[5]=l*i+t,e[9]=h*i-c,e[2]=-i,e[6]=r*a,e[10]=o*a):"YZX"===t.order?(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=l-t*n,e[8]=c*n+h,e[1]=n,e[5]=o*s,e[9]=-r*s,e[2]=-i*s,e[6]=h*n+c,e[10]=t-l*n):"XZY"===t.order&&(t=o*a,h=o*i,c=r*a,l=r*i,e[0]=a*s,e[4]=-n,e[8]=i*s,e[1]=t*n+l,e[5]=o*s,e[9]=h*n-c,e[2]=c*n-h,e[6]=r*s,e[10]=l*n+t);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,o=t.w,a=n+n;t=r*(c=r+r);var s=r*(l=i+i),r=r*a,h=i*l,i=i*a,n=n*a,c=o*c,l=o*l,o=o*a;return e[0]=1-(h+n),e[4]=s-o,e[8]=r+l,e[1]=s+o,e[5]=1-(t+n),e[9]=i-c,e[2]=r-l,e[6]=i+c,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,r;return function(i,n,o){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Vector3),void 0===r&&(r=new m.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.lengthSq()&&(r.x+=1e-4,t.crossVectors(o,r).normalize()),e.crossVectors(r,t),a[0]=t.x,a[4]=e.x,a[8]=r.x,a[1]=t.y,a[5]=e.y,a[9]=r.y,a[2]=t.z,a[6]=e.z,a[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],r=r[15],b=i[0],_=i[4],M=i[8],w=i[12],S=i[1],E=i[5],T=i[9],C=i[13],L=i[2],A=i[6],P=i[10],R=i[14],U=i[3],k=i[7],D=i[11],i=i[15];return n[0]=o*b+a*S+s*L+h*U,n[4]=o*_+a*E+s*A+h*k,n[8]=o*M+a*T+s*P+h*D,n[12]=o*w+a*C+s*R+h*i,n[1]=c*b+l*S+u*L+p*U,n[5]=c*_+l*E+u*A+p*k,n[9]=c*M+l*T+u*P+p*D,n[13]=c*w+l*C+u*R+p*i,n[2]=d*b+f*S+m*L+g*U,n[6]=d*_+f*E+m*A+g*k,n[10]=d*M+f*T+m*P+g*D,n[14]=d*w+f*C+m*R+g*i,n[3]=v*b+y*S+x*L+r*U,n[7]=v*_+y*E+x*A+r*k,n[11]=v*M+y*T+x*P+r*D,n[15]=v*w+y*C+x*R+r*i,this},multiplyToArray:function(t,e,r){var i=this.elements;return this.multiplyMatrices(t,e),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length);for(var n=0;n<i;n+=3,r+=3)t.fromArray(e,r),t.applyMatrix4(this),t.toArray(e,r);return e}}(),applyToBuffer:function(){var t;return function(e,r,i){void 0===t&&(t=new m.Vector3),void 0===r&&(r=0),void 0===i&&(i=e.length/e.itemSize);for(var n=0;n<i;n++,r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],h=t[13],c=t[2],l=t[6],u=t[10],p=t[14];return t[3]*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*p-r*s*p)+t[7]*(+e*s*p-e*h*u+n*o*u-i*o*p+i*h*c-n*s*c)+t[11]*(+e*h*l-e*a*p-n*o*l+r*o*p+n*a*c-r*h*c)+t[15]*(-i*a*c-e*s*l+e*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t},getPosition:function(){var t;return function(){void 0===t&&(t=new m.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return t.set(e[12],e[13],e[14])}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,i=(y=t.elements)[0],n=y[4],o=y[8],a=y[12],s=y[1],h=y[5],c=y[9],l=y[13],u=y[2],p=y[6],d=y[10],f=y[14],m=y[3],g=y[7],v=y[11],y=y[15];if(r[0]=c*f*g-l*d*g+l*p*v-h*f*v-c*p*y+h*d*y,r[4]=a*d*g-o*f*g-a*p*v+n*f*v+o*p*y-n*d*y,r[8]=o*l*g-a*c*g+a*h*v-n*l*v-o*h*y+n*c*y,r[12]=a*c*p-o*l*p-a*h*d+n*l*d+o*h*f-n*c*f,r[1]=l*d*m-c*f*m-l*u*v+s*f*v+c*u*y-s*d*y,r[5]=o*f*m-a*d*m+a*u*v-i*f*v-o*u*y+i*d*y,r[9]=a*c*m-o*l*m-a*s*v+i*l*v+o*s*y-i*c*y,r[13]=o*l*u-a*c*u+a*s*d-i*l*d-o*s*f+i*c*f,r[2]=h*f*m-l*p*m+l*u*g-s*f*g-h*u*y+s*p*y,r[6]=a*p*m-n*f*m-a*u*g+i*f*g+n*u*y-i*p*y,r[10]=n*l*m-a*h*m+a*s*g-i*l*g-n*s*y+i*h*y,r[14]=a*h*u-n*l*u-a*s*p+i*l*p+n*s*f-i*h*f,r[3]=c*p*m-h*d*m-c*u*g+s*d*g+h*u*v-s*p*v,r[7]=n*d*m-o*p*m+o*u*g-i*d*g-n*u*v+i*p*v,r[11]=o*h*m-n*c*m-o*s*g+i*c*g+n*s*v-i*h*v,r[15]=n*c*u-o*h*u+o*s*p-i*c*p-n*s*d+i*h*d,0==(r=i*r[0]+s*r[4]+u*r[8]+m*r[12])){if(e)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity(),this}return this.multiplyScalar(1/r),this},scale:function(t){var e=this.elements,r=t.x,i=t.y;return t=t.z,e[0]*=r,e[4]*=i,e[8]*=t,e[1]*=r,e[5]*=i,e[9]*=t,e[2]*=r,e[6]*=i,e[10]*=t,e[3]*=r,e[7]*=i,e[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t);return t=Math.sin(t),this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),i=Math.sin(e),n=1-r,o=t.x,a=t.y,s=t.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t,e;return function(r,i,n){void 0===t&&(t=new m.Vector3),void 0===e&&(e=new m.Matrix4);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),h=t.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],e.elements.set(this.elements),r=1/a;var o=1/s,c=1/h;return e.elements[0]*=r,e.elements[1]*=r,e.elements[2]*=r,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=c,e.elements[9]*=c,e.elements[10]*=c,i.setFromRotationMatrix(e),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(t,e,r,i,n,o){var a=this.elements;return a[0]=2*n/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*n/(i-r),a[9]=(i+r)/(i-r),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+n)/(o-n),a[14]=-2*o*n/(o-n),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,r,i){var n=-(t=r*Math.tan(m.Math.degToRad(.5*t)));return this.makeFrustum(n*e,t*e,n,t,r,i)},makeOrthographic:function(t,e,r,i,n,o){var a=this.elements,s=e-t,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(e+t)/s,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-(r+i)/h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-(o+n)/c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var r=0;16>r;r++)if(e[r]!==t[r])return!1;return!0},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}},m.Ray=function(t,e){this.origin=void 0!==t?t:new m.Vector3,this.direction=void 0!==e?e:new m.Vector3},m.Ray.prototype={constructor:m.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new m.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:function(){var t=new m.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new m.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new m.Vector3;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a){t.copy(i).add(n).multiplyScalar(.5),e.copy(n).sub(i).normalize(),r.copy(this.origin).sub(t);var s,h=.5*i.distanceTo(n),c=-this.direction.dot(e),l=r.dot(this.direction),u=-r.dot(e),p=r.lengthSq(),d=Math.abs(1-c*c);return 0<d?(i=c*u-l,n=c*l-u,s=h*d,0<=i?n>=-s?n<=s?(h=1/d,i*=h,n*=h,c=i*(i+c*n+2*l)+n*(c*i+n+2*u)+p):(n=h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):(n=-h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p):n<=-s?(i=Math.max(0,-(-c*h+l)),n=0<i?-h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p):n<=s?(i=0,n=Math.min(Math.max(-h,-u),h),c=n*(n+2*u)+p):(i=Math.max(0,-(c*h+l)),n=0<i?h:Math.min(Math.max(-h,-u),h),c=-i*i+n*(n+2*u)+p)):(n=0<c?-h:h,i=Math.max(0,-(c*n+l)),c=-i*i+n*(n+2*u)+p),o&&o.copy(this.direction).multiplyScalar(i).add(this.origin),a&&a.copy(e).multiplyScalar(n).add(t),c}}(),intersectSphere:function(){var t=new m.Vector3;return function(e,r){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),n=t.dot(t)-i*i,o=e.radius*e.radius;return n>o?null:(o=Math.sqrt(o-n),n=i-o,i+=o,0>n&&0>i?null:0>n?this.at(i,r):this.at(n,r))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:(t=-(this.origin.dot(t.normal)+t.constant)/e,0<=t?t:null)},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var r,i,n,o,a;i=1/this.direction.x,o=1/this.direction.y,a=1/this.direction.z;var s=this.origin;return 0<=i?(r=(t.min.x-s.x)*i,i*=t.max.x-s.x):(r=(t.max.x-s.x)*i,i*=t.min.x-s.x),0<=o?(n=(t.min.y-s.y)*o,o*=t.max.y-s.y):(n=(t.max.y-s.y)*o,o*=t.min.y-s.y),r>o||n>i?null:((n>r||r!==r)&&(r=n),(o<i||i!==i)&&(i=o),0<=a?(n=(t.min.z-s.z)*a,a*=t.max.z-s.z):(n=(t.max.z-s.z)*a,a*=t.min.z-s.z),r>a||n>i?null:((n>r||r!==r)&&(r=n),(a<i||i!==i)&&(i=a),0>i?null:this.at(0<=r?r:i,e)))},intersectsBox:function(){var t=new m.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3,i=new m.Vector3;return function(n,o,a,s,h){if(e.subVectors(o,n),r.subVectors(a,n),i.crossVectors(e,r),0<(o=this.direction.dot(i))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,n),0>(n=s*this.direction.dot(r.crossVectors(t,r)))?null:0>(a=s*this.direction.dot(e.cross(t)))||n+a>o?null:(n=-s*t.dot(i),0>n?null:this.at(n/o,h))}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},m.Sphere=function(t,e){this.center=void 0!==t?t:new m.Vector3,this.radius=void 0!==e?e:0},m.Sphere.prototype={constructor:m.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new m.Box3;return function(e,r){var i=this.center;void 0!==r?i.copy(r):t.setFromPoints(e).center(i);for(var n=0,o=0,a=e.length;o<a;o++)n=Math.max(n,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new m.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){return(t=t||new m.Box3).set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},m.Frustum=function(t,e,r,i,n,o){this.planes=[void 0!==t?t:new m.Plane,void 0!==e?e:new m.Plane,void 0!==r?r:new m.Plane,void 0!==i?i:new m.Plane,void 0!==n?n:new m.Plane,void 0!==o?o:new m.Plane]},m.Frustum.prototype={constructor:m.Frustum,set:function(t,e,r,i,n,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;6>r;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes;t=(g=t.elements)[0];var r=g[1],i=g[2],n=g[3],o=g[4],a=g[5],s=g[6],h=g[7],c=g[8],l=g[9],u=g[10],p=g[11],d=g[12],f=g[13],m=g[14],g=g[15];return e[0].setComponents(n-t,h-o,p-c,g-d).normalize(),e[1].setComponents(n+t,h+o,p+c,g+d).normalize(),e[2].setComponents(n+r,h+a,p+l,g+f).normalize(),e[3].setComponents(n-r,h-a,p-l,g-f).normalize(),e[4].setComponents(n-i,h-s,p-u,g-m).normalize(),e[5].setComponents(n+i,h+s,p+u,g+m).normalize(),this},intersectsObject:function(){var t=new m.Sphere;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,r=t.center;t=-t.radius;for(var i=0;6>i;i++)if(e[i].distanceToPoint(r)<t)return!1;return!0},intersectsBox:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){a=i[n],t.x=0<a.normal.x?r.min.x:r.max.x,e.x=0<a.normal.x?r.max.x:r.min.x,t.y=0<a.normal.y?r.min.y:r.max.y,e.y=0<a.normal.y?r.max.y:r.min.y,t.z=0<a.normal.z?r.min.z:r.max.z,e.z=0<a.normal.z?r.max.z:r.min.z;var o=a.distanceToPoint(t),a=a.distanceToPoint(e);if(0>o&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;6>r;r++)if(0>e[r].distanceToPoint(t))return!1;return!0}},m.Plane=function(t,e){this.normal=void 0!==t?t:new m.Vector3(1,0,0),this.constant=void 0!==e?e:0},m.Plane.prototype={constructor:m.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,i){return this.normal.set(t,e,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new m.Vector3,e=new m.Vector3;return function(r,i,n){return i=t.subVectors(n,i).cross(e.subVectors(r,i)).normalize(),this.setFromNormalAndCoplanarPoint(i,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new m.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new m.Vector3;return function(e,r){var i=r||new m.Vector3,n=e.delta(t),o=this.normal.dot(n);return 0!==o?(o=-(e.start.dot(this.normal)+this.constant)/o,0>o||1<o?void 0:i.copy(n).multiplyScalar(o).add(e.start)):0===this.distanceToPoint(e.start)?i.copy(e.start):void 0}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start);return t=this.distanceToPoint(t.end),0>e&&0<t||0>t&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new m.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),o=t.copy(this.normal).applyMatrix3(o),a=this.coplanarPoint(e);return a.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(o,a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},m.Math={generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,r[n]=e[19===n?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(){var t=Math.PI/180;return function(e){return e*t}}(),radToDeg:function(){var t=180/Math.PI;return function(e){return e*t}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},m.Spline=function(t){function e(t,e,r,i,n,o,a){return t=.5*(r-t),i=.5*(i-e),(2*(e-r)+t+i)*a+(-3*(e-r)-2*t-i)*o+t*n+e}this.points=t;var r,i,n,o,a,s,h,c,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return r=(this.points.length-1)*t,i=Math.floor(r),n=r-i,u[0]=0===i?i:i-1,u[1]=i,u[2]=i>this.points.length-2?this.points.length-1:i+1,u[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[u[0]],h=this.points[u[1]],c=this.points[u[2]],l=this.points[u[3]],o=n*n,a=n*o,p.x=e(s.x,h.x,c.x,l.x,n,o,a),p.y=e(s.y,h.y,c.y,l.y,n,o,a),p.z=e(s.z,h.z,c.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var t,e,r=this.points.length,i=[];for(t=0;t<r;t++)e=this.points[t],i[t]=[e.x,e.y,e.z];return i},this.getLength=function(t){var e,r,i,n=e=e=0,o=new m.Vector3,a=new m.Vector3,s=[],h=0;for(s[0]=0,t||(t=100),r=this.points.length*t,o.copy(this.points[0]),t=1;t<r;t++)e=t/r,i=this.getPoint(e),a.copy(i),h+=a.distanceTo(o),o.copy(i),e*=this.points.length-1,(e=Math.floor(e))!==n&&(s[e]=h,n=e);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(t){var e,r,i,n,o,a,s=[],h=new m.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(r=c.chunks[e]-c.chunks[e-1],a=Math.ceil(t*r/c.total),n=(e-1)/(this.points.length-1),o=e/(this.points.length-1),r=1;r<a-1;r++)i=n+1/a*r*(o-n),i=this.getPoint(i),s.push(h.copy(i).clone());s.push(h.copy(this.points[e]).clone())}this.points=s}},m.Triangle=function(t,e,r){this.a=void 0!==t?t:new m.Vector3,this.b=void 0!==e?e:new m.Vector3,this.c=void 0!==r?r:new m.Vector3},m.Triangle.normal=function(){var t=new m.Vector3;return function(e,r,i,n){return(n=n||new m.Vector3).subVectors(i,r),t.subVectors(e,r),n.cross(t),e=n.lengthSq(),0<e?n.multiplyScalar(1/Math.sqrt(e)):n.set(0,0,0)}}(),m.Triangle.barycoordFromPoint=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(i,n,o,a,s){t.subVectors(a,n),e.subVectors(o,n),r.subVectors(i,n),i=t.dot(t),n=t.dot(e),o=t.dot(r);var h=e.dot(e);a=e.dot(r);var c=i*h-n*n;return s=s||new m.Vector3,0===c?s.set(-2,-1,-1):(c=1/c,h=(h*o-n*a)*c,i=(i*a-n*o)*c,s.set(1-h-i,i,h))}}(),m.Triangle.containsPoint=function(){var t=new m.Vector3;return function(e,r,i,n){return 0<=(e=m.Triangle.barycoordFromPoint(e,r,i,n,t)).x&&0<=e.y&&1>=e.x+e.y}}(),m.Triangle.prototype={constructor:m.Triangle,set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new m.Vector3,e=new m.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new m.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return m.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new m.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return m.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return m.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},m.Interpolant=function(t,e,r,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(r),this.sampleValues=e,this.valueSize=r},m.Interpolant.prototype={constructor:m.Interpolant,evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,i=e[r],n=e[r-1];t:{e:{r:{i:if(!(t<i)){for(var o=r+2;;){if(void 0===i){if(t<n)break i;return this._cachedIndex=r=e.length,this.afterEnd_(r-1,t,n)}if(r===o)break;if(n=i,i=e[++r],t<i)break e}i=e.length;break r}if(t>=n)break t;for(t<(o=e[1])&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(r===o)break;if(i=n,n=e[--r-1],t>=n)break e}i=r,r=0}for(;r<i;)n=r+i>>>1,t<e[n]?i=n:r=n+1;if(i=e[r],void 0===(n=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return this._cachedIndex=r=e.length,this.afterEnd_(r-1,n,t)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,r=this.sampleValues,i=this.valueSize;t*=i;for(var n=0;n!==i;++n)e[n]=r[t+n];return e},interpolate_:function(t,e,r,i){throw Error("call to abstract method")},intervalChanged_:function(t,e,r){}},Object.assign(m.Interpolant.prototype,{beforeStart_:m.Interpolant.prototype.copySampleValue_,afterEnd_:m.Interpolant.prototype.copySampleValue_}),m.CubicInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0},m.CubicInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.CubicInterpolant,DefaultSettings_:{endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},intervalChanged_:function(t,e,r){var i=this.parameterPositions,n=t-2,o=t+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case m.ZeroSlopeEnding:n=t,a=2*e-r;break;case m.WrapAroundEnding:a=e+i[n=i.length-2]-i[n+1];break;default:n=t,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case m.ZeroSlopeEnding:o=t,s=2*r-e;break;case m.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=t-1,s=e}t=.5*(r-e),i=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,h=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-e)/(i-e);for(e=-l*(i=(r=p*p)*p)+2*l*r-l*p,l=(1+l)*i+(-1.5-2*l)*r+(-.5+l)*p+1,p=(-1-u)*i+(1.5+u)*r+.5*p,u=u*i-u*r,r=0;r!==a;++r)n[r]=e*o[h+r]+l*o[s+r]+p*o[t+r]+u*o[c+r];return n}}),m.DiscreteInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.DiscreteInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.DiscreteInterpolant,interpolate_:function(t,e,r,i){return this.copySampleValue_(t-1)}}),m.LinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.LinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.LinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(r=1-(e=(r-e)/(i-e)),i=0;i!==a;++i)n[i]=o[s+i]*r+o[t+i]*e;return n}}),m.QuaternionLinearInterpolant=function(t,e,r,i){m.Interpolant.call(this,t,e,r,i)},m.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.QuaternionLinearInterpolant,interpolate_:function(t,e,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(e=(r-e)/(i-e),r=(t*=a)+a;t!==r;t+=4)m.Quaternion.slerpFlat(n,0,o,t-a,o,t,e);return n}}),m.Clock=function(t){this.autoStart=void 0===t||t,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1},m.Clock.prototype={constructor:m.Clock,start:function(){this.oldTime=this.startTime=performance.now(),this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){if(e=0,this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now(),e=.001*(t-this.oldTime);this.oldTime=t,this.elapsedTime+=e}return e}},m.EventDispatcher=function(){},m.EventDispatcher.prototype={constructor:m.EventDispatcher,apply:function(t){t.addEventListener=m.EventDispatcher.prototype.addEventListener,t.hasEventListener=m.EventDispatcher.prototype.hasEventListener,t.removeEventListener=m.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=m.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var r=[],i=e.length,n=0;n<i;n++)r[n]=e[n];for(n=0;n<i;n++)r[n].call(this,t)}}}},m.Layers=function(){this.mask=1},m.Layers.prototype={constructor:m.Layers,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!=(this.mask&t.mask)}},function(t){function e(t,e){return t.distance-e.distance}function r(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n)){n=0;for(var o=(t=t.children).length;n<o;n++)r(t[n],e,i,!0)}}t.Raycaster=function(e,r,i,n){this.ray=new t.Ray(e,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},t.Raycaster.prototype={constructor:t.Raycaster,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,r){r instanceof t.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,i){var n=[];return r(t,this,n,i),n.sort(e),n},intersectObjects:function(t,i){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=t.length;o<a;o++)r(t[o],this,n,i);return n.sort(e),n}}}(m),m.Object3D=function(){Object.defineProperty(this,"id",{value:m.Object3DIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=m.Object3D.DefaultUp.clone();var t=new m.Vector3,e=new m.Euler,r=new m.Quaternion,i=new m.Vector3(1,1,1);e.onChange(function(){r.setFromEuler(e,!1)}),r.onChange(function(){e.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new m.Matrix4},normalMatrix:{value:new m.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new m.Matrix4,this.matrixWorld=new m.Matrix4,this.matrixAutoUpdate=m.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new m.Layers,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},m.Object3D.DefaultUp=new m.Vector3(0,1,0),m.Object3D.DefaultMatrixAutoUpdate=!0,m.Object3D.prototype={constructor:m.Object3D,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new m.Quaternion;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new m.Vector3;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new m.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new m.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new m.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new m.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new m.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t instanceof m.Object3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);-1!==(e=this.children.indexOf(t))&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(e,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){return t=t||new m.Vector3,this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new m.Vector3,e=new m.Vector3;return function(r){return r=r||new m.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Euler,this.getWorldQuaternion(t),e.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new m.Vector3,e=new m.Quaternion;return function(r){return r=r||new m.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r={};(n=void 0===t)&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),i.material=this.material.uuid),0<this.children.length)for(i.children=[],o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object);if(n){var n=e(t.geometries),o=e(t.materials),a=e(t.textures);t=e(t.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<a.length&&(r.textures=a),0<t.length&&(r.images=t)}return r.object=i,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.rotationAutoUpdate=t.rotationAutoUpdate,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++)this.add(t.children[r].clone());return this}},m.EventDispatcher.prototype.apply(m.Object3D.prototype),m.Object3DIdCount=0,m.Face3=function(t,e,r,i,n,o){this.a=t,this.b=e,this.c=r,this.normal=i instanceof m.Vector3?i:new m.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=n instanceof m.Color?n:new m.Color,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=void 0!==o?o:0},m.Face3.prototype={constructor:m.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},m.BufferAttribute=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.itemSize=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.BufferAttribute.prototype={constructor:m.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[t+i]=e.array[r+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new m.Color),e[r++]=o.r,e[r++]=o.g,e[r++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];e[r++]=o.a,e[r++]=o.b,e[r++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new m.Vector2),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new m.Vector3),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,i=0,n=t.length;i<n;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new m.Vector4),e[r++]=o.x,e[r++]=o.y,e[r++]=o.z,e[r++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},m.Int8Attribute=function(t,e){return new m.BufferAttribute(new Int8Array(t),e)},m.Uint8Attribute=function(t,e){return new m.BufferAttribute(new Uint8Array(t),e)},m.Uint8ClampedAttribute=function(t,e){return new m.BufferAttribute(new Uint8ClampedArray(t),e)},m.Int16Attribute=function(t,e){return new m.BufferAttribute(new Int16Array(t),e)},m.Uint16Attribute=function(t,e){return new m.BufferAttribute(new Uint16Array(t),e)},m.Int32Attribute=function(t,e){return new m.BufferAttribute(new Int32Array(t),e)},m.Uint32Attribute=function(t,e){return new m.BufferAttribute(new Uint32Array(t),e)},m.Float32Attribute=function(t,e){return new m.BufferAttribute(new Float32Array(t),e)},m.Float64Attribute=function(t,e){return new m.BufferAttribute(new Float64Array(t),e)},m.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new m.BufferAttribute(t,e).setDynamic(!0)},m.InstancedBufferAttribute=function(t,e,r){m.BufferAttribute.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedBufferAttribute.prototype=Object.create(m.BufferAttribute.prototype),m.InstancedBufferAttribute.prototype.constructor=m.InstancedBufferAttribute,m.InstancedBufferAttribute.prototype.copy=function(t){return m.BufferAttribute.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBuffer=function(t,e){this.uuid=m.Math.generateUUID(),this.array=t,this.stride=e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},m.InterleavedBuffer.prototype={constructor:m.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(t){!0===t&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[t+i]=e.array[r+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},m.InstancedInterleavedBuffer=function(t,e,r){m.InterleavedBuffer.call(this,t,e),this.meshPerAttribute=r||1},m.InstancedInterleavedBuffer.prototype=Object.create(m.InterleavedBuffer.prototype),m.InstancedInterleavedBuffer.prototype.constructor=m.InstancedInterleavedBuffer,m.InstancedInterleavedBuffer.prototype.copy=function(t){return m.InterleavedBuffer.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},m.InterleavedBufferAttribute=function(t,e,r){this.uuid=m.Math.generateUUID(),this.data=t,this.itemSize=e,this.offset=r},m.InterleavedBufferAttribute.prototype={constructor:m.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this},setXYZW:function(t,e,r,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=i,this.data.array[t+3]=n,this}},m.Geometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},m.Geometry.prototype={constructor:m.Geometry,applyMatrix:function(t){for(var e=(new m.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(t);for(r=0,i=this.faces.length;r<i;r++){(t=this.faces[r]).normal.applyMatrix3(e).normalize();for(var n=0,o=t.vertexNormals.length;n<o;n++)t.vertexNormals[n].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i){var n=void 0!==a?[l[t].clone(),l[e].clone(),l[i].clone()]:[],o=void 0!==s?[r.colors[t].clone(),r.colors[e].clone(),r.colors[i].clone()]:[],n=new m.Face3(t,e,i,n,o);r.faces.push(n),void 0!==h&&r.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([p[t].clone(),p[e].clone(),p[i].clone()])}var r=this,i=null!==t.index?t.index.array:void 0,n=t.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],p=[],d=n=0;n<o.length;n+=3,d+=2)r.vertices.push(new m.Vector3(o[n],o[n+1],o[n+2])),void 0!==a&&l.push(new m.Vector3(a[n],a[n+1],a[n+2])),void 0!==s&&r.colors.push(new m.Color(s[n],s[n+1],s[n+2])),void 0!==h&&u.push(new m.Vector2(h[d],h[d+1])),void 0!==c&&p.push(new m.Vector2(c[d],c[d+1]));if(void 0!==i)if(0<(o=t.groups).length)for(n=0;n<o.length;n++)for(var d=o[n],f=d.start,g=d.count,d=f,f=f+g;d<f;d+=3)e(i[d],i[d+1],i[d+2]);else for(n=0;n<i.length;n+=3)e(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)e(n,n+1,n+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=0===(e=this.boundingSphere.radius)?1:1/e,r=new m.Matrix4;return r.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new m.Vector3,e=new m.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b];t.subVectors(this.vertices[n.c],a),e.subVectors(o,a),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,i;for(i=Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)i[e]=new m.Vector3;if(t){var n,o,a,s=new m.Vector3,h=new m.Vector3;for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=this.vertices[r.a],o=this.vertices[r.b],a=this.vertices[r.c],s.subVectors(a,o),h.subVectors(n,o),s.cross(h),i[r.a].add(s),i[r.b].add(s),i[r.c].add(s)}else for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],i[r.a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(e=0,r=this.vertices.length;e<r;e++)i[e].normalize();for(t=0,e=this.faces.length;t<e;t++)r=this.faces[t],n=r.vertexNormals,3===n.length?(n[0].copy(i[r.a]),n[1].copy(i[r.b]),n[2].copy(i[r.c])):(n[0]=i[r.a].clone(),n[1]=i[r.b].clone(),n[2]=i[r.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),t=0,e=n.vertexNormals.length;t<e;t++)n.__originalVertexNormals[t]?n.__originalVertexNormals[t].copy(n.vertexNormals[t]):n.__originalVertexNormals[t]=n.vertexNormals[t].clone();var o=new m.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[],n=this.morphNormals[t].faceNormals;var a,s,h=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)a=new m.Vector3,s={a:new m.Vector3,b:new m.Vector3,c:new m.Vector3},n.push(a),h.push(s)}for(h=this.morphNormals[t],o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],a=h.faceNormals[r],s=h.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;r<i;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,i=e.length;r<i;r++)0<r&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new m.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(0==t instanceof m.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);else{var i,n=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,h=t.faces,c=this.faceVertexUvs[0];t=t.faceVertexUvs[0],void 0===r&&(r=0),void 0!==e&&(i=(new m.Matrix3).getNormalMatrix(e));for(var l=0,u=a.length;l<u;l++){var p=a[l].clone();void 0!==e&&p.applyMatrix4(e),o.push(p)}for(l=0,u=h.length;l<u;l++){var d,f=(a=h[l]).vertexNormals,g=a.vertexColors;for((p=new m.Face3(a.a+n,a.b+n,a.c+n)).normal.copy(a.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize(),e=0,o=f.length;e<o;e++)d=f[e].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),e=0,o=g.length;e<o;e++)d=g[e],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=t.length;l<u;l++)if(r=t[l],i=[],void 0!==r){for(e=0,o=r.length;e<o;e++)i.push(r[e].clone());c.push(i)}}},mergeMesh:function(t){0==t instanceof m.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,r,i={},n=[],o=[],a=Math.pow(10,4);for(e=0,r=this.vertices.length;e<r;e++)t=this.vertices[e],t=Math.round(t.x*a)+"_"+Math.round(t.y*a)+"_"+Math.round(t.z*a),void 0===i[t]?(i[t]=e,n.push(this.vertices[e]),o[e]=n.length-1):o[e]=o[i[t]];for(i=[],e=0,r=this.faces.length;e<r;e++)for(a=this.faces[e],a.a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],t=0;3>t;t++)if(a[t]===a[(t+1)%3]){i.push(e);break}for(e=i.length-1;0<=e;e--)for(a=i[e],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return e=this.vertices.length-n.length,this.vertices=n,e},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,r=0;r<e;r++)t[r]._id=r;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===e&&(i=[]),a&&a.length===e&&(n=[]),r=0;r<e;r++){var s=t[r]._id;i&&i.push(o[s]),n&&n.push(a[s])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=h.length/3,h.push(t.x,t.y,t.z),c[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=p.length/2,p.push(t.x,t.y),d[e])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o,a=this.parameters;for(o in a)void 0!==a[o]&&(n[o]=a[o]);return n}for(a=[],o=0;o<this.vertices.length;o++)s=this.vertices[o],a.push(s.x,s.y,s.z);var s=[],h=[],c={},l=[],u={},p=[],d={};for(o=0;o<this.faces.length;o++){var f=this.faces[o],m=void 0!==this.faceVertexUvs[0][o],g=0<f.normal.length(),v=0<f.vertexNormals.length,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,x=0<f.vertexColors.length,b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=t(b=0,0,0),1,!0),2,!1),3,m),4,g),5,v),6,y),7,x);s.push(b),s.push(f.a,f.b,f.c),s.push(f.materialIndex),m&&(m=this.faceVertexUvs[0][o],s.push(i(m[0]),i(m[1]),i(m[2]))),g&&s.push(e(f.normal)),v&&(g=f.vertexNormals,s.push(e(g[0]),e(g[1]),e(g[2]))),y&&s.push(r(f.color)),x&&(f=f.vertexColors,s.push(r(f[0]),r(f[1]),r(f[2])))}return n.data={},n.data.vertices=a,n.data.normals=h,0<l.length&&(n.data.colors=l),0<p.length&&(n.data.uvs=[p]),n.data.faces=s,n},clone:function(){return(new m.Geometry).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,r=0,i=e.length;r<i;r++)this.vertices.push(e[r].clone());for(r=0,i=(e=t.faces).length;r<i;r++)this.faces.push(e[r].clone());for(r=0,i=t.faceVertexUvs.length;r<i;r++){e=t.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=e.length;n<o;n++){for(var a=e[n],s=[],h=0,c=a.length;h<c;h++)s.push(a[h].clone());this.faceVertexUvs[r].push(s)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Geometry.prototype),m.GeometryIdCount=0,m.DirectGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1},m.DirectGeometry.prototype={constructor:m.DirectGeometry,computeBoundingBox:m.Geometry.prototype.computeBoundingBox,computeBoundingSphere:m.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){var e,r,i=[];t=t.faces;for(var n=0;n<t.length;n++){var o=t[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,r=t.faces,i=t.vertices,n=t.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=t.morphTargets,h=s.length;if(0<h){for(e=[],v=0;v<h;v++)e[v]=[];this.morphTargets.position=e}var c,l=t.morphNormals,u=l.length;if(0<u){for(c=[],v=0;v<u;v++)c[v]=[];this.morphTargets.normal=c}for(var p=t.skinIndices,d=t.skinWeights,f=p.length===i.length,g=d.length===i.length,v=0;v<r.length;v++){var y=r[v];this.vertices.push(i[y.a],i[y.b],i[y.c]);var x=y.vertexNormals;for(3===x.length?this.normals.push(x[0],x[1],x[2]):(x=y.normal,this.normals.push(x,x,x)),3===(x=y.vertexColors).length?this.colors.push(x[0],x[1],x[2]):(x=y.color,this.colors.push(x,x,x)),!0===o&&(x=n[0][v],void 0!==x?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new m.Vector2,new m.Vector2,new m.Vector2))),!0===a&&(x=n[1][v],void 0!==x?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new m.Vector2,new m.Vector2,new m.Vector2))),x=0;x<h;x++){var b=s[x].vertices;e[x].push(b[y.a],b[y.b],b[y.c])}for(x=0;x<u;x++)b=l[x].vertexNormals[v],c[x].push(b.a,b.b,b.c);f&&this.skinIndices.push(p[y.a],p[y.b],p[y.c]),g&&this.skinWeights.push(d[y.a],d[y.b],d[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.DirectGeometry.prototype),m.BufferGeometry=function(){Object.defineProperty(this,"id",{value:m.GeometryIdCount++}),this.uuid=m.Math.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:1/0}},m.BufferGeometry.prototype={constructor:m.BufferGeometry,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e,r){if(0==e instanceof m.BufferAttribute&&0==e instanceof m.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(t,new m.BufferAttribute(e,r));else{if("index"!==t)return this.attributes[t]=e,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e)}},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0),void 0!==(e=this.attributes.normal)&&((new m.Matrix3).getNormalMatrix(t).applyToVector3Array(e.array),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new m.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeTranslation(e,r,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,r,i){return void 0===t&&(t=new m.Matrix4),t.makeScale(e,r,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new m.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t instanceof m.Points||t instanceof m.Line){t=new m.Float32Attribute(3*e.vertices.length,3);var r=new m.Float32Attribute(3*e.colors.length,3);this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length&&(t=new m.Float32Attribute(e.lineDistances.length,1),this.addAttribute("lineDistance",t.copyArray(e.lineDistances))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t instanceof m.Mesh&&e instanceof m.Geometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t instanceof m.Mesh){var r=e.__directGeometry;if(void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}return!0===e.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(e.vertices),r.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(e.normals),r.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(e.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(e.uvs),r.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(e.lineDistances),r.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new m.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){r=new Float32Array(3*t.vertices.length),this.addAttribute("position",new m.BufferAttribute(r,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(r=new Float32Array(3*t.normals.length),this.addAttribute("normal",new m.BufferAttribute(r,3).copyVector3sArray(t.normals))),0<t.colors.length&&(r=new Float32Array(3*t.colors.length),this.addAttribute("color",new m.BufferAttribute(r,3).copyColorsArray(t.colors))),0<t.uvs.length&&(r=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new m.BufferAttribute(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(r=new(65535<t.vertices.length?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new m.BufferAttribute(r,1).copyIndicesArray(t.indices))),this.groups=t.groups;for(var e in t.morphTargets){for(var r=[],i=t.morphTargets[e],n=0,o=i.length;n<o;n++){var a=i[n],s=new m.Float32Attribute(3*a.length,3);r.push(s.copyVector3sArray(a))}this.morphAttributes[e]=r}return 0<t.skinIndices.length&&(e=new m.Float32Attribute(4*t.skinIndices.length,4),this.addAttribute("skinIndex",e.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(e=new m.Float32Attribute(4*t.skinWeights.length,4),this.addAttribute("skinWeight",e.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:(new m.Vector3,function(){null===this.boundingBox&&(this.boundingBox=new m.Box3);var t=this.attributes.position.array;t&&this.boundingBox.setFromArray(t),void 0!==t&&0!==t.length||(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}),computeBoundingSphere:function(){var t=new m.Box3,e=new m.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere);var r=this.attributes.position.array;if(r){var i=this.boundingSphere.center;t.setFromArray(r),t.center(i);for(var n=0,o=0,a=r.length;o<a;o+=3)e.fromArray(r,o),n=Math.max(n,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new m.BufferAttribute(new Float32Array(i.length),3));else for(var n=e.normal.array,o=0,a=n.length;o<a;o++)n[o]=0;var s,h,c,n=e.normal.array,l=new m.Vector3,u=new m.Vector3,p=new m.Vector3,d=new m.Vector3,f=new m.Vector3;if(t){t=t.array,0===r.length&&this.addGroup(0,t.length);for(var g=0,v=r.length;g<v;++g)for(o=r[g],a=o.start,s=o.count,o=a,a+=s;o<a;o+=3)s=3*t[o+0],h=3*t[o+1],c=3*t[o+2],l.fromArray(i,s),u.fromArray(i,h),p.fromArray(i,c),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[s]+=d.x,n[s+1]+=d.y,n[s+2]+=d.z,n[h]+=d.x,n[h+1]+=d.y,n[h+2]+=d.z,n[c]+=d.x,n[c+1]+=d.y,n[c+2]+=d.z}else for(o=0,a=i.length;o<a;o+=9)l.fromArray(i,o),u.fromArray(i,o+3),p.fromArray(i,o+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),n[o]=d.x,n[o+1]=d.y,n[o+2]=d.z,n[o+3]=d.x,n[o+4]=d.y,n[o+5]=d.z,n[o+6]=d.x,n[o+7]=d.y,n[o+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(0!=t instanceof m.BufferGeometry){void 0===e&&(e=0);var r,i=this.attributes;for(r in i)if(void 0!==t.attributes[r])for(var n=i[r].array,o=t.attributes[r],a=o.array,s=0,o=o.itemSize*e;s<a.length;s++,o++)n[o]=a[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)t=i[n],e=i[n+1],r=i[n+2],t=1/Math.sqrt(t*t+e*e+r*r),i[n]*=t,i[n+1]*=t,i[n+2]*=t},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new m.BufferGeometry,r=this.index.array,i=this.attributes;for(t in i){for(var n=(o=i[t]).array,o=o.itemSize,a=new n.constructor(r.length*o),s=0,h=0,c=0,l=r.length;c<l;c++)for(var s=r[c]*o,u=0;u<o;u++)a[h++]=n[s++];e.addAttribute(t,new m.BufferAttribute(a,o))}return e},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,r=this.parameters;for(e in r)void 0!==r[e]&&(t[e]=r[e]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(r=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:r}),i=this.attributes;for(e in i){var n=i[e],r=Array.prototype.slice.call(n.array);t.data.attributes[e]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(e=this.groups).length&&(t.data.groups=JSON.parse(JSON.stringify(e))),null!==(e=this.boundingSphere)&&(t.data.boundingSphere={center:e.center.toArray(),radius:e.radius}),t},clone:function(){return(new m.BufferGeometry).copy(this)},copy:function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.BufferGeometry.prototype),m.BufferGeometry.MaxIndex=65535,m.InstancedBufferGeometry=function(){m.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},m.InstancedBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.InstancedBufferGeometry.prototype.constructor=m.InstancedBufferGeometry,m.InstancedBufferGeometry.prototype.addGroup=function(t,e,r){this.groups.push({start:t,count:e,instances:r})},m.InstancedBufferGeometry.prototype.copy=function(t){null!==(r=t.index)&&this.setIndex(r.clone());var e,r=t.attributes;for(e in r)this.addAttribute(e,r[e].clone());for(e=0,r=(t=t.groups).length;e<r;e++){var i=t[e];this.addGroup(i.start,i.count,i.instances)}return this},m.EventDispatcher.prototype.apply(m.InstancedBufferGeometry.prototype),m.Uniform=function(t,e){this.type=t,this.value=e,this.dynamic=!1},m.Uniform.prototype={constructor:m.Uniform,onUpdate:function(t){return this.dynamic=!0,this.onUpdateCallback=t,this}},m.AnimationClip=function(t,e,r){this.name=t||m.Math.generateUUID(),this.tracks=r,this.duration=void 0!==e?e:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},m.AnimationClip.prototype={constructor:m.AnimationClip,resetDuration:function(){for(var t=0,e=0,r=this.tracks.length;e!==r;++e)var i=this.tracks[e],t=Math.max(t,i.times[i.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(m.AnimationClip,{parse:function(t){for(var e=[],r=t.tracks,i=1/(t.fps||1),n=0,o=r.length;n!==o;++n)e.push(m.KeyframeTrack.parse(r[n]).scale(i));return new m.AnimationClip(t.name,t.duration,e)},toJSON:function(t){var e=[],r=t.tracks;t={name:t.name,duration:t.duration,tracks:e};for(var i=0,n=r.length;i!==n;++i)e.push(m.KeyframeTrack.toJSON(r[i]));return t},CreateFromMorphTargetSequence:function(t,e,r){for(var i=e.length,n=[],o=0;o<i;o++){h=[],(s=[]).push((o+i-1)%i,o,(o+1)%i),h.push(0,1,0);var a=m.AnimationUtils.getKeyframeOrder(s),s=m.AnimationUtils.sortedArray(s,1,a),h=m.AnimationUtils.sortedArray(h,1,a);0===s[0]&&(s.push(i),h.push(h[0])),n.push(new m.NumberKeyframeTrack(".morphTargetInfluences["+e[o].name+"]",s,h).scale(1/r))}return new m.AnimationClip(t,-1,n)},findByName:function(t,e){for(var r=0;r<t.length;r++)if(t[r].name===e)return t[r];return null},CreateClipsFromMorphTargetSequences:function(t,e){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=t.length;n<o;n++){var a=t[n],s=a.name.match(i);if(s&&1<s.length){var h=s[1];(s=r[h])||(r[h]=s=[]),s.push(a)}}i=[];for(h in r)i.push(m.AnimationClip.CreateFromMorphTargetSequence(h,r[h],e));return i},parseAnimation:function(t,e,r){if(!t)return console.error("  no animation in JSONLoader data"),null;r=function(t,e,r,i,n){if(0!==r.length){var o=[],a=[];m.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new t(e,o,a))}};var i=[],n=t.name||"default",o=t.length||-1,a=t.fps||30;t=t.hierarchy||[];for(var s=0;s<t.length;s++){var h=t[s].keys;if(h&&0!=h.length)if(h[0].morphTargets){for(var o={},c=0;c<h.length;c++)if(h[c].morphTargets)for(d=0;d<h[c].morphTargets.length;d++)o[h[c].morphTargets[d]]=-1;for(var l in o){for(var u=[],p=[],d=0;d!==h[c].morphTargets.length;++d){var f=h[c];u.push(f.time),p.push(f.morphTarget===l?1:0)}i.push(new m.NumberKeyframeTrack(".morphTargetInfluence["+l+"]",u,p))}o=o.length*(a||1)}else c=".bones["+e[s].name+"]",r(m.VectorKeyframeTrack,c+".position",h,"pos",i),r(m.QuaternionKeyframeTrack,c+".quaternion",h,"rot",i),r(m.VectorKeyframeTrack,c+".scale",h,"scl",i)}return 0===i.length?null:new m.AnimationClip(n,o,i)}}),m.AnimationMixer=function(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},m.AnimationMixer.prototype={constructor:m.AnimationMixer,clipAction:function(t,e){var r,i=(e||this._root).uuid,n="string"==typeof t?t:t.name,o=t!==n?t:null,a=this._actionsByClip[n];if(void 0!==a){if(void 0!==(r=a.actionByRoot[i]))return r;if(r=a.knownActions[0],o=r._clip,t!==n&&t!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new m.AnimationMixer._Action(this,o,e),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(t,e){var r=(e||this._root).uuid,i=this._actionsByClip["string"==typeof t?t:t.name];return void 0!==i?i.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==e;++n)t[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,i=this.time+=t,n=Math.sign(t),o=this._accuIndex^=1,a=0;a!==r;++a){var s=e[a];s.enabled&&s._update(i,t,n,o)}for(t=this._bindings,e=this._nActiveBindings,a=0;a!==e;++a)t[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions;t=t.name;var r=this._actionsByClip,i=r[t];if(void 0!==i){for(var n=0,o=(i=i.knownActions).length;n!==o;++n){var a=i[n];this._deactivateAction(a);var s=a._cacheIndex,h=e[e.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,h._cacheIndex=s,e[s]=h,e.pop(),this._removeInactiveBindingsForAction(a)}delete r[t]}},uncacheRoot:function(t){t=t.uuid;var e,r=this._actionsByClip;for(e in r){var i=r[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(void 0!==(e=this._bindingsByRootAndName[t]))for(var n in e)(t=e[n]).restoreOriginalState(),this._removeInactiveBinding(t)},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},m.EventDispatcher.prototype.apply(m.AnimationMixer.prototype),m.AnimationMixer._Action=function(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null,e=(t=e.tracks).length,r=Array(e);for(var i={endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},n=0;n!==e;++n){var o=t[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=m.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0},m.AnimationMixer._Action.prototype={constructor:m.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){r=this._clip.duration;var i=t._clip.duration,n=r/i;t.warp(1,i/r,e),this.warp(n,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._currentTimeScale,0,t)},warp:function(t,e,r){var i=this._mixer,n=i.time,o=this._timeScaleInterpolant,a=this.timeScale;return null===o&&(this._timeScaleInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,i[1]=n+r,o[0]=t/a,o[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,i){if(null!==(n=this._startTime)){if(0>(e=(t-n)*r)||0===r)return;this._startTime=null,e*=r}if(e*=this._updateTimeScale(t),r=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants;for(var n=this._propertyBindings,o=0,a=e.length;o!==a;++o)e[o].evaluate(r),n[o].accumulate(i,t)}},_updateWeight:function(t){if(e=0,this.enabled){var e=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(t)[0],e=e*i;t>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){if(e=0,!this.paused){var e=this.timeScale,r=this._timeScaleInterpolant;null!==r&&(e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.pause=!0:this.timeScale=e))}return this._effectiveTimeScale=e},_updateTime:function(t){if(a=this.time+t,0===t)return a;var e=this._clip.duration,r=this.loop,i=this._loopCount,n=!1;switch(r){case m.LoopOnce:if(-1===i&&(this.loopCount=0,this._setEndings(!0,!0,!1)),a>=e)a=e;else{if(!(0>a))break;a=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1});break;case m.LoopPingPong:n=!0;case m.LoopRepeat:if(-1===i&&(0<t?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),a>=e||0>a){var o=Math.floor(a/e),a=a-e*o,i=i+Math.abs(o),s=this.repetitions-i;if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=0<t?e:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1});break}0===s?(t=0>t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}if(r===m.LoopPingPong&&1==(1&i))return this.time=a,e-a}return this.time=a},_setEndings:function(t,e,r){var i=this._interpolantSettings;r?(i.endingStart=m.ZeroSlopeEnding,i.endingEnd=m.ZeroSlopeEnding):(i.endingStart=t?this.zeroSlopeAtStart?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding,i.endingEnd=e?this.zeroSlopeAtEnd?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding)},_scheduleFading:function(t,e,r){var i=this._mixer,n=i.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=i._lendControlInterpolant()),i=o.parameterPositions,o=o.sampleValues,i[0]=n,o[0]=e,i[1]=n+t,o[1]=r,this}},Object.assign(m.AnimationMixer.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,i=t._clip.tracks,n=i.length,o=t._propertyBindings,a=t._interpolants,s=r.uuid,h=this._bindingsByRootAndName,c=h[s];for(void 0===c&&(c={},h[s]=c),h=0;h!==n;++h){var l=i[h],u=l.name,p=c[u];if(void 0===p){if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,u));continue}++(p=new m.PropertyMixer(m.PropertyBinding.create(r,u,e&&e._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,u)}o[h]=p,a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.name,i=this._actionsByClip[r];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,r,e)}for(r=0,i=(e=t._propertyBindings).length;r!==i;++r){var n=e[r];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,i=e.length;r!==i;++r){var n=e[r];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){return null!==(t=t._cacheIndex)&&t<this._nActiveActions},_addInactiveAction:function(t,e,r){var i=this._actions,n=this._actionsByClip,o=n[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,n[e]=o):(e=o.knownActions,t._byClipCacheIndex=e.length,e.push(t)),t._cacheIndex=i.length,i.push(t),o.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],i=t._cacheIndex;r._cacheIndex=i,e[i]=r,e.pop(),t._cacheIndex=null;var r=t._clip.name,n=(i=this._actionsByClip)[r],o=n.knownActions,a=o[o.length-1],s=t._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),t._byClipCacheIndex=null,delete n.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=0,r=(t=t._propertyBindings).length;e!==r;++e){var i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,i=this._nActiveActions++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,i=--this._nActiveActions,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_addInactiveBinding:function(t,e,r){var i=this._bindingsByRootAndName,n=i[e],o=this._bindings;void 0===n&&(n={},i[e]=n),n[r]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=(i=t.binding).rootNode.uuid,i=i.path,n=this._bindingsByRootAndName,o=n[r],a=e[e.length-1];t=t._cacheIndex,a._cacheIndex=t,e[t]=a,e.pop(),delete o[i];t:{for(var s in o)break t;delete n[r]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=this._nActiveBindings++,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,i=--this._nActiveBindings,n=e[i];t._cacheIndex=i,e[i]=t,n._cacheIndex=r,e[r]=n},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new m.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];t.__cacheIndex=i,e[i]=t,n.__cacheIndex=r,e[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),m.AnimationObjectGroup=function(t){this.uuid=m.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},m.AnimationObjectGroup.prototype={constructor:m.AnimationObjectGroup,add:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,h=s.length,c=0,l=arguments.length;c!==l;++c){var u=arguments[c],p=n[d=u.uuid];if(void 0===p){p=r++,n[d]=p,e.push(u);for(var d=0,f=h;d!==f;++d)s[d].push(new m.PropertyBinding(u,o[d],a[d]))}else if(p<i){var g=e[p],v=--i;for(n[(f=e[v]).uuid]=p,e[p]=f,n[d]=v,e[v]=u,d=0,f=h;d!==f;++d){var y=s[d],x=y[p];y[p]=y[v],void 0===x&&(x=new m.PropertyBinding(u,o[d],a[d])),y[v]=x}}else e[p]!==g&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],c=h.uuid,l=i[c];if(void 0!==l&&l>=r){var u=r++,p=e[u];for(i[p.uuid]=l,e[l]=p,i[c]=u,e[u]=h,h=0,c=o;h!==c;++h){var d=(p=n[h])[l];p[l]=p[u],p[u]=d}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,o=this._bindings,a=o.length,s=0,h=arguments.length;s!==h;++s){var c=arguments[s].uuid,l=n[c];if(void 0!==l)if(delete n[c],l<i){var u=e[c=--i],p=--r,d=e[p];for(n[u.uuid]=l,e[l]=u,n[d.uuid]=c,e[c]=d,e.pop(),u=0,d=a;u!==d;++u){var f=o[u],m=f[p];f[l]=f[c],f[c]=m,f.pop()}}else for(p=--r,d=e[p],n[d.uuid]=l,e[l]=d,e.pop(),u=0,d=a;u!==d;++u)f=o[u],f[l]=f[p],f.pop()}this.nCachedObjects_=i},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,i=r[t],n=this._bindings;if(void 0!==i)return n[i];var o=this._paths,a=this._parsedPaths,s=this._objects,h=this.nCachedObjects_,c=Array(s.length),i=n.length;for(r[t]=i,o.push(t),a.push(e),n.push(c),r=h,i=s.length;r!==i;++r)c[r]=new m.PropertyBinding(s[r],t,e);return c},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},m.AnimationUtils={arraySlice:function(t,e,r){return m.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(e,r)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,r=Array(e),i=0;i!==e;++i)r[i]=i;return r.sort(function(e,r){return t[e]-t[r]}),r},sortedArray:function(t,e,r){for(var i=t.length,n=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*e,h=0;h!==e;++h)n[a++]=t[s+h];return n},flattenJSON:function(t,e,r,i){for(var n=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),r.push.apply(r,a)),o=t[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(r,r.length)),o=t[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),r.push(a)),o=t[n++]}while(void 0!==o)}}},m.KeyframeTrack=function(t,e,r,i){if(void 0===t)throw Error("track name is undefined");if(void 0===e||0===e.length)throw Error("no keyframes in track named "+t);this.name=t,this.times=m.AnimationUtils.convertArray(e,this.TimeBufferType),this.values=m.AnimationUtils.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()},m.KeyframeTrack.prototype={constructor:m.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(t){return new m.DiscreteInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new m.LinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new m.CubicInterpolant(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e=void 0;switch(t){case m.InterpolateDiscrete:e=this.InterpolantFactoryMethodDiscrete;break;case m.InterpolateLinear:e=this.InterpolantFactoryMethodLinear;break;case m.InterpolateSmooth:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn(e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return m.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return m.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return m.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,i=e.length;r!==i;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<t;)++n;for(;-1!==o&&r[o]>e;)--o;return++o,0===n&&o===i||(n>=o&&(o=Math.max(o,1),n=o-1),i=this.getValueSize(),this.times=m.AnimationUtils.arraySlice(r,n,o),this.values=m.AnimationUtils.arraySlice(this.values,n*i,o*i)),this},validate:function(){var t=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("invalid value size in track",this),t=!1);var e=this.times,r=this.values,i=e.length;0===i&&(console.error("track is empty",this),t=!1);for(var n=null,o=0;o!==i;o++){var a=e[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),t=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),t=!1;break}n=a}if(void 0!==r&&m.AnimationUtils.isTypedArray(r))for(o=0,e=r.length;o!==e;++o)if(i=r[o],isNaN(i)){console.error("value is not a valid number",this,o,i),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),i=1,n=1,o=t.length-1;n<=o;++n){var a=!1;if((l=t[n])!==t[n+1]&&(1!==n||l!==l[0]))for(var s=n*r,h=s-r,c=s+r,l=0;l!==r;++l){var u=e[s+l];if(u!==e[h+l]||u!==e[c+l]){a=!0;break}}if(a){if(n!==i)for(t[i]=t[n],a=n*r,s=i*r,l=0;l!==r;++l)e[s+l]=e[a+l];++i}}return i!==t.length&&(this.times=m.AnimationUtils.arraySlice(t,0,i),this.values=m.AnimationUtils.arraySlice(e,0,i*r)),this}},Object.assign(m.KeyframeTrack,{parse:function(t){if(void 0===t.type)throw Error("track type undefined, can not parse");var e=m.KeyframeTrack._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];m.AnimationUtils.flattenJSON(t.keys,r,i,"value"),t.times=r,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){if(void 0!==(e=t.constructor).toJSON)e=e.toJSON(t);else{var e={name:t.name,times:m.AnimationUtils.convertArray(t.times,Array),values:m.AnimationUtils.convertArray(t.values,Array)},r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return m.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return m.VectorKeyframeTrack;case"color":return m.ColorKeyframeTrack;case"quaternion":return m.QuaternionKeyframeTrack;case"bool":case"boolean":return m.BooleanKeyframeTrack;case"string":return m.StringKeyframeTrack}throw Error("Unsupported typeName: "+t)}}),m.PropertyBinding=function(t,e,r){this.path=e,this.parsedPath=r||m.PropertyBinding.parseTrackName(e),this.node=m.PropertyBinding.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t},m.PropertyBinding.prototype={constructor:m.PropertyBinding,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(this.node=t=m.PropertyBinding.findNode(this.rootNode,e.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("  can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);for(t=t.skeleton.bones,r=0;r<t.length;r++)if(t[r].name===o){o=r;break}break;default:if(void 0===t[r])return void console.error("  can not bind to objectName of node, undefined",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}if(o=t[i]){if(e=this.Versioning.None,void 0!==t.needsUpdate?(e=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(e=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(r=0;r<this.node.geometry.morphTargets.length;r++)if(t.geometry.morphTargets[r].name===n){n=r;break}}r=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(r=this.BindingType.HasFromToArray,this.resolvedProperty=o):void 0!==o.length?(r=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[r],this.setValue=this.SetterByBindingTypeAndVersioning[r][e]}else console.error("  trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(m.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:m.PropertyBinding.prototype.getValue,_setValue_unbound:m.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)t[e++]=r[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++]},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),m.PropertyBinding.Composite=function(t,e,r){r=r||m.PropertyBinding.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,r)},m.PropertyBinding.Composite.prototype={constructor:m.PropertyBinding.Composite,getValue:function(t,e){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}},m.PropertyBinding.create=function(t,e,r){return t instanceof m.AnimationObjectGroup?new m.PropertyBinding.Composite(t,e,r):new m.PropertyBinding(t,e,r)},m.PropertyBinding.parseTrackName=function(t){var e=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=e.exec(t);if(!r)throw Error("cannot parse trackName at all: "+t);if(r.index===e.lastIndex&&e.lastIndex++,null===(e={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===e.propertyName.length)throw Error("can not parse propertyName from trackName: "+t);return e},m.PropertyBinding.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var i=t.bones[r];if(i.name===e)return i}return null}(t.skeleton);if(r)return r}if(t.children){var i=function(t){for(var r=0;r<t.length;r++){var n=t[r];if(n.name===e||n.uuid===e||(n=i(n.children)))return n}return null};if(r=i(t.children))return r}return null},m.PropertyMixer=function(t,e,r){switch(this.binding=t,this.valueSize=r,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*r),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0},m.PropertyMixer.prototype={constructor:m.PropertyMixer,accumulate:function(t,e){var r=this.buffer,i=this.valueSize,n=t*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=e}else o+=e,this._mixBufferRegion(r,n,0,e/o,i);this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,r=this.buffer;t=t*e+e;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,t,3*e,1-i,e);for(var i=e,o=e+e;i!==o;++i)if(r[i]!==r[i+e]){n.setValue(r,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,r=3*e;this.binding.getValue(t,r);for(var i=e;i!==r;++i)t[i]=t[r+i%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,r,i,n){if(.5<=i)for(i=0;i!==n;++i)t[e+i]=t[r+i]},_slerp:function(t,e,r,i,n){m.Quaternion.slerpFlat(t,e,t,e,t,r,i)},_lerp:function(t,e,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=e+a;t[s]=t[s]*o+t[r+a]*i}}},m.BooleanKeyframeTrack=function(t,e,r){m.KeyframeTrack.call(this,t,e,r)},m.BooleanKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.NumberKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.NumberKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.NumberKeyframeTrack,ValueTypeName:"number"}),m.QuaternionKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodLinear:function(t){return new m.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),m.StringKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.StringKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:m.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),m.VectorKeyframeTrack=function(t,e,r,i){m.KeyframeTrack.call(this,t,e,r,i)},m.VectorKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.VectorKeyframeTrack,ValueTypeName:"vector"}),m.Audio=function(t){m.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},m.Audio.prototype=Object.create(m.Object3D.prototype),m.Audio.prototype.constructor=m.Audio,m.Audio.prototype.getOutput=function(){return this.gain},m.Audio.prototype.load=function(t){var e=new m.AudioBuffer(this.context);return e.load(t),this.setBuffer(e),this},m.Audio.prototype.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},m.Audio.prototype.setBuffer=function(t){var e=this;return t.onReady(function(t){e.source.buffer=t,e.sourceType="buffer",e.autoplay&&e.play()}),this},m.Audio.prototype.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 t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()}},m.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)},m.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)},m.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},m.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},m.Audio.prototype.getFilter=function(){return this.filter},m.Audio.prototype.setFilter=function(t){void 0===t&&(t=null),!0===this.isPlaying?(this.disconnect(),this.filter=t,this.connect()):this.filter=t},m.Audio.prototype.setPlaybackRate=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))},m.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},m.Audio.prototype.onEnded=function(){this.isPlaying=!1},m.Audio.prototype.setLoop=function(t){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=t},m.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},m.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},m.Audio.prototype.getVolume=function(){return this.gain.gain.value},m.AudioAnalyser=function(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)},m.AudioAnalyser.prototype={constructor:m.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},m.AudioBuffer=function(t){this.context=t,this.ready=!1,this.readyCallbacks=[]},m.AudioBuffer.prototype.load=function(t){var e=this,r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(t){e.context.decodeAudioData(this.response,function(t){for(e.buffer=t,e.ready=!0,t=0;t<e.readyCallbacks.length;t++)e.readyCallbacks[t](e.buffer);e.readyCallbacks=[]})},r.send(),this},m.AudioBuffer.prototype.onReady=function(t){this.ready?t(this.buffer):this.readyCallbacks.push(t)},m.PositionalAudio=function(t){m.Audio.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},m.PositionalAudio.prototype=Object.create(m.Audio.prototype),m.PositionalAudio.prototype.constructor=m.PositionalAudio,m.PositionalAudio.prototype.getOutput=function(){return this.panner},m.PositionalAudio.prototype.setRefDistance=function(t){this.panner.refDistance=t},m.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},m.PositionalAudio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},m.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},m.PositionalAudio.prototype.setDistanceModel=function(t){this.panner.distanceModel=t},m.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},m.PositionalAudio.prototype.setMaxDistance=function(t){this.panner.maxDistance=t},m.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},m.PositionalAudio.prototype.updateMatrixWorld=function(){var t=new m.Vector3;return function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}(),m.AudioListener=function(){m.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},m.AudioListener.prototype=Object.create(m.Object3D.prototype),m.AudioListener.prototype.constructor=m.AudioListener,m.AudioListener.prototype.getInput=function(){return this.gain},m.AudioListener.prototype.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)},m.AudioListener.prototype.setFilter=function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},m.AudioListener.prototype.getFilter=function(){return this.filter},m.AudioListener.prototype.setMasterVolume=function(t){this.gain.gain.value=t},m.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},m.AudioListener.prototype.updateMatrixWorld=function(){var t=new m.Vector3,e=new m.Quaternion,r=new m.Vector3,i=new m.Vector3;return function(n){m.Object3D.prototype.updateMatrixWorld.call(this,n),n=this.context.listener;var o=this.up;this.matrixWorld.decompose(t,e,r),i.set(0,0,-1).applyQuaternion(e),n.setPosition(t.x,t.y,t.z),n.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z)}}(),m.Camera=function(){m.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new m.Matrix4,this.projectionMatrix=new m.Matrix4},m.Camera.prototype=Object.create(m.Object3D.prototype),m.Camera.prototype.constructor=m.Camera,m.Camera.prototype.getWorldDirection=function(){var t=new m.Quaternion;return function(e){return e=e||new m.Vector3,this.getWorldQuaternion(t),e.set(0,0,-1).applyQuaternion(t)}}(),m.Camera.prototype.lookAt=function(){var t=new m.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),m.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},m.Camera.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},m.CubeCamera=function(t,e,r){m.Object3D.call(this),this.type="CubeCamera";var i=new m.PerspectiveCamera(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new m.Vector3(1,0,0)),this.add(i);var n=new m.PerspectiveCamera(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new m.Vector3(-1,0,0)),this.add(n);var o=new m.PerspectiveCamera(90,1,t,e);o.up.set(0,0,1),o.lookAt(new m.Vector3(0,1,0)),this.add(o);var a=new m.PerspectiveCamera(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new m.Vector3(0,-1,0)),this.add(a);var s=new m.PerspectiveCamera(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new m.Vector3(0,0,1)),this.add(s);var h=new m.PerspectiveCamera(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new m.Vector3(0,0,-1)),this.add(h),this.renderTarget=new m.WebGLRenderTargetCube(r,r,{format:m.RGBFormat,magFilter:m.LinearFilter,minFilter:m.LinearFilter}),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,i,r),r.activeCubeFace=1,t.render(e,n,r),r.activeCubeFace=2,t.render(e,o,r),r.activeCubeFace=3,t.render(e,a,r),r.activeCubeFace=4,t.render(e,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,t.render(e,h,r),t.setRenderTarget(null)}},m.CubeCamera.prototype=Object.create(m.Object3D.prototype),m.CubeCamera.prototype.constructor=m.CubeCamera,m.OrthographicCamera=function(t,e,r,i,n,o){m.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},m.OrthographicCamera.prototype=Object.create(m.Camera.prototype),m.OrthographicCamera.prototype.constructor=m.OrthographicCamera,m.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-t,r+t,i+e,i-e,this.near,this.far)},m.OrthographicCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this},m.OrthographicCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},m.PerspectiveCamera=function(t,e,r,i){m.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype=Object.create(m.Camera.prototype),m.PerspectiveCamera.prototype.constructor=m.PerspectiveCamera,m.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*m.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,o){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=m.Math.radToDeg(2*Math.atan(Math.tan(.5*m.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=(r=this.fullWidth/this.fullHeight)*(i=-(t=Math.tan(m.Math.degToRad(.5*t))*this.near)),r=Math.abs(r*t-e),i=Math.abs(t-i);this.projectionMatrix.makeFrustum(e+this.x*r/this.fullWidth,e+(this.x+this.width)*r/this.fullWidth,t-(this.y+this.height)*i/this.fullHeight,t-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},m.PerspectiveCamera.prototype.copy=function(t){return m.Camera.prototype.copy.call(this,t),this.focalLength=t.focalLength,this.zoom=t.zoom,this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this},m.PerspectiveCamera.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},m.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new m.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new m.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},m.StereoCamera.prototype={constructor:m.StereoCamera,update:function(){var t,e,r,i,n,o=new m.Matrix4,a=new m.Matrix4;return function(s){if(t!==s.focalLength||e!==s.fov||r!==s.aspect*this.aspect||i!==s.near||n!==s.far){t=s.focalLength,e=s.fov,r=s.aspect*this.aspect,i=s.near,n=s.far;var h,c,l=s.projectionMatrix.clone(),u=.032*i/t,p=i*Math.tan(m.Math.degToRad(.5*e));a.elements[12]=-.032,o.elements[12]=.032,h=-p*r+u,c=p*r+u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraL.projectionMatrix.copy(l),h=-p*r-u,c=p*r-u,l.elements[0]=2*i/(c-h),l.elements[8]=(c+h)/(c-h),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(s.matrixWorld).multiply(a),this.cameraR.matrixWorld.copy(s.matrixWorld).multiply(o)}}()},m.Light=function(t,e){m.Object3D.call(this),this.type="Light",this.color=new m.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},m.Light.prototype=Object.create(m.Object3D.prototype),m.Light.prototype.constructor=m.Light,m.Light.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},m.Light.prototype.toJSON=function(t){return t=m.Object3D.prototype.toJSON.call(this,t),t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.exponent&&(t.object.exponent=this.exponent),t},m.LightShadow=function(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new m.Vector2(512,512),this.map=null,this.matrix=new m.Matrix4},m.LightShadow.prototype={constructor:m.LightShadow,copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},m.AmbientLight=function(t,e){m.Light.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0},m.AmbientLight.prototype=Object.create(m.Light.prototype),m.AmbientLight.prototype.constructor=m.AmbientLight,m.DirectionalLight=function(t,e){m.Light.call(this,t,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.shadow=new m.LightShadow(new m.OrthographicCamera(-5,5,5,-5,.5,500))},m.DirectionalLight.prototype=Object.create(m.Light.prototype),m.DirectionalLight.prototype.constructor=m.DirectionalLight,m.DirectionalLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.HemisphereLight=function(t,e,r){m.Light.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new m.Color(e)},m.HemisphereLight.prototype=Object.create(m.Light.prototype),m.HemisphereLight.prototype.constructor=m.HemisphereLight,m.HemisphereLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this},m.PointLight=function(t,e,r,i){m.Light.call(this,t,e),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(90,1,.5,500))},m.PointLight.prototype=Object.create(m.Light.prototype),m.PointLight.prototype.constructor=m.PointLight,m.PointLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this},m.SpotLight=function(t,e,r,i,n,o){m.Light.call(this,t,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new m.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==o?o:1,this.shadow=new m.LightShadow(new m.PerspectiveCamera(50,1,.5,500))},m.SpotLight.prototype=Object.create(m.Light.prototype),m.SpotLight.prototype.constructor=m.SpotLight,m.SpotLight.prototype.copy=function(t){return m.Light.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.exponent=t.exponent,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this},m.Cache={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},m.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},m.Loader.prototype={constructor:m.Loader,crossOrigin:void 0,extractUrlBase:function(t){return 1===(t=t.split("/")).length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(t,e,r){for(var i=[],n=0;n<t.length;++n)i[n]=this.createMaterial(t[n],e,r);return i},createMaterial:function(){var t,e,r;return function(i,n,o){function a(t,r,i,a,s){t=n+t;var c=m.Loader.Handlers.get(t);return null!==c?t=c.load(t):(e.setCrossOrigin(o),t=e.load(t)),void 0!==r&&(t.repeat.fromArray(r),1!==r[0]&&(t.wrapS=m.RepeatWrapping),1!==r[1]&&(t.wrapT=m.RepeatWrapping)),void 0!==i&&t.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(t.wrapS=m.RepeatWrapping),"mirror"===a[0]&&(t.wrapS=m.MirroredRepeatWrapping),"repeat"===a[1]&&(t.wrapT=m.RepeatWrapping),"mirror"===a[1]&&(t.wrapT=m.MirroredRepeatWrapping)),void 0!==s&&(t.anisotropy=s),r=m.Math.generateUUID(),h[r]=t,r}void 0===t&&(t=new m.Color),void 0===e&&(e=new m.TextureLoader),void 0===r&&(r=new m.MaterialLoader);var s,h={},c={uuid:m.Math.generateUUID(),type:"MeshLambertMaterial"};for(s in i){var l=i[s];switch(s){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=l;break;case"blending":c.blending=m[l];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":c.color=t.fromArray(l).getHex();break;case"colorSpecular":c.specular=t.fromArray(l).getHex();break;case"colorEmissive":c.emissive=t.fromArray(l).getHex();break;case"specularCoef":c.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(c.type="MeshPhongMaterial");break;case"mapDiffuse":c.map=a(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":c.lightMap=a(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=a(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=a(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=a(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=a(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":c.alphaMap=a(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=m.BackSide;break;case"doubleSided":c.side=m.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[s]=l;break;case"vertexColors":!0===l&&(c.vertexColors=m.VertexColors),"face"===l&&(c.vertexColors=m.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",s,l)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,1>c.opacity&&(c.transparent=!0),r.setTextures(h),r.parse(c)}}()},m.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,i=e.length;r<i;r+=2){var n=e[r+1];if(e[r].test(t))return n}return null}},m.XHRLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.XHRLoader.prototype={constructor:m.XHRLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return e&&setTimeout(function(){e(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",t,!0),a.addEventListener("load",function(r){var o=r.target.response;m.Cache.add(t,o),200===this.status?(e&&e(o),n.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),n.manager.itemEnd(t)):(i&&i(r),n.manager.itemError(t))},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(t),a},setPath:function(t){this.path=t},setResponseType:function(t){this.responseType=t},setWithCredentials:function(t){this.withCredentials=t}},m.FontLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.FontLoader.prototype={constructor:m.FontLoader,load:function(t,e,r,i){new m.XHRLoader(this.manager).load(t,function(t){e(new m.Font(JSON.parse(t.substring(65,t.length-2))))},r,i)}},m.ImageLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.ImageLoader.prototype={constructor:m.ImageLoader,load:function(t,e,r,i){void 0!==this.path&&(t=this.path+t);var n=this,o=m.Cache.get(t);if(void 0!==o)return n.manager.itemStart(t),e?setTimeout(function(){e(o),n.manager.itemEnd(t)},0):n.manager.itemEnd(t),o;var a=document.createElement("img");return a.addEventListener("load",function(r){m.Cache.add(t,this),e&&e(this),n.manager.itemEnd(t)},!1),void 0!==r&&a.addEventListener("progress",function(t){r(t)},!1),a.addEventListener("error",function(e){i&&i(e),n.manager.itemError(t)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.JSONLoader=function(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:m.DefaultLoadingManager,this.withCredentials=!1},m.JSONLoader.prototype={constructor:m.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(t,e,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:m.Loader.prototype.extractUrlBase(t),a=new m.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(r){var i=(r=JSON.parse(r)).metadata;if(void 0!==i&&void 0!==(i=i.type)){if("object"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),e(r.geometry,r.materials)},r,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){var r=new m.Geometry,i=void 0!==t.scale?1/t.scale:1;return function(e){var i,n,o,a,s,h,c,l,u,p,d,f,g,v=t.faces;h=t.vertices;var y=t.normals,x=t.colors,b=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&b++;for(i=0;i<b;i++)r.faceVertexUvs[i]=[]}for(a=0,s=h.length;a<s;)i=new m.Vector3,i.x=h[a++]*e,i.y=h[a++]*e,i.z=h[a++]*e,r.vertices.push(i);for(a=0,s=v.length;a<s;)if(e=v[a++],u=1&e,o=2&e,i=8&e,c=16&e,p=32&e,h=64&e,e&=128,u){if(u=new m.Face3,u.a=v[a],u.b=v[a+1],u.c=v[a+3],d=new m.Face3,d.a=v[a+1],d.b=v[a+2],d.c=v[a+3],a+=4,o&&(o=v[a++],u.materialIndex=o,d.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),2!==n&&r.faceVertexUvs[i][o].push(g),0!==n&&r.faceVertexUvs[i][o+1].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c]),d.normal.copy(u.normal)),p)for(i=0;4>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),2!==i&&u.vertexNormals.push(p),0!==i&&d.vertexNormals.push(p);if(h&&(h=v[a++],h=x[h],u.color.setHex(h),d.color.setHex(h)),e)for(i=0;4>i;i++)h=v[a++],h=x[h],2!==i&&u.vertexColors.push(new m.Color(h)),0!==i&&d.vertexColors.push(new m.Color(h));r.faces.push(u),r.faces.push(d)}else{if(u=new m.Face3,u.a=v[a++],u.b=v[a++],u.c=v[a++],o&&(o=v[a++],u.materialIndex=o),o=r.faces.length,i)for(i=0;i<b;i++)for(f=t.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=v[a++],g=f[2*l],l=f[2*l+1],g=new m.Vector2(g,l),r.faceVertexUvs[i][o].push(g);if(c&&(c=3*v[a++],u.normal.set(y[c++],y[c++],y[c])),p)for(i=0;3>i;i++)c=3*v[a++],p=new m.Vector3(y[c++],y[c++],y[c]),u.vertexNormals.push(p);if(h&&(h=v[a++],u.color.setHex(x[h])),e)for(i=0;3>i;i++)h=v[a++],u.vertexColors.push(new m.Color(x[h]));r.faces.push(u)}}(i),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e)r.skinWeights.push(new m.Vector4(t.skinWeights[i],1<e?t.skinWeights[i+1]:0,2<e?t.skinWeights[i+2]:0,3<e?t.skinWeights[i+3]:0));if(t.skinIndices)for(i=0,n=t.skinIndices.length;i<n;i+=e)r.skinIndices.push(new m.Vector4(t.skinIndices[i],1<e?t.skinIndices[i+1]:0,2<e?t.skinIndices[i+2]:0,3<e?t.skinIndices[i+3]:0));r.bones=t.bones,r.bones&&0<r.bones.length&&(r.skinWeights.length!==r.skinIndices.length||r.skinIndices.length!==r.vertices.length)&&console.warn("When skinning, number of vertices ("+r.vertices.length+"), skinIndices ("+r.skinIndices.length+"), and skinWeights ("+r.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){r.morphTargets[i]={},r.morphTargets[i].name=t.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,h=a.length;s<h;s+=3){var c=new m.Vector3;c.x=a[s]*e,c.y=a[s+1]*e,c.z=a[s+2]*e,o.push(c)}}if(void 0!==t.morphColors&&0<t.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),e=r.faces,o=t.morphColors[0].colors,i=0,n=e.length;i<n;i++)e[i].color.fromArray(o,3*i)}(i),function(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var o=m.AnimationClip.parseAnimation(i[n],r.bones);o&&e.push(o)}r.morphTargets&&(i=m.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),e=e.concat(i)),0<e.length&&(r.animations=e)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:r}:(i=m.Loader.prototype.initMaterials(t.materials,e,this.crossOrigin),{geometry:r,materials:i})}},m.LoadingManager=function(t,e,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++,!1===n&&void 0!==i.onStart&&i.onStart(t,o,a),n=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}},m.DefaultLoadingManager=new m.LoadingManager,m.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.BufferGeometryLoader.prototype={constructor:m.BufferGeometryLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},parse:function(t){var e=new m.BufferGeometry,r=t.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==r&&(r=new i[r.type](r.array),e.setIndex(new m.BufferAttribute(r,1)));var n,o=t.data.attributes;for(n in o){var a=o[n],r=new i[a.type](a.array);e.addAttribute(n,new m.BufferAttribute(r,a.itemSize))}if(void 0!==(i=t.data.groups||t.data.drawcalls||t.data.offsets))for(n=0,r=i.length;n!==r;++n)o=i[n],e.addGroup(o.start,o.count,o.materialIndex);return void 0!==(t=t.data.boundingSphere)&&(i=new m.Vector3,void 0!==t.center&&i.fromArray(t.center),e.boundingSphere=new m.Sphere(i,t.radius)),e}},m.MaterialLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.textures={}},m.MaterialLoader.prototype={constructor:m.MaterialLoader,load:function(t,e,r,i){var n=this;new m.XHRLoader(n.manager).load(t,function(t){e(n.parse(JSON.parse(t)))},r,i)},setTextures:function(t){this.textures=t},getTexture:function(t){var e=this.textures;return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]},parse:function(t){var e=new m[t.type];if(void 0!==t.uuid&&(e.uuid=t.uuid),void 0!==t.name&&(e.name=t.name),void 0!==t.color&&e.color.setHex(t.color),void 0!==t.roughness&&(e.roughness=t.roughness),void 0!==t.metalness&&(e.metalness=t.metalness),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.alphaTest&&(e.alphaTest=t.alphaTest),void 0!==t.depthTest&&(e.depthTest=t.depthTest),void 0!==t.depthWrite&&(e.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(e.colorWrite=t.colorWrite),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(e.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(e.map=this.getTexture(t.map)),void 0!==t.alphaMap&&(e.alphaMap=this.getTexture(t.alphaMap),e.transparent=!0),void 0!==t.bumpMap&&(e.bumpMap=this.getTexture(t.bumpMap)),void 0!==t.bumpScale&&(e.bumpScale=t.bumpScale),void 0!==t.normalMap&&(e.normalMap=this.getTexture(t.normalMap)),void 0!==t.normalScale&&(r=t.normalScale,!1===Array.isArray(r)&&(r=[r,r]),e.normalScale=(new m.Vector2).fromArray(r)),void 0!==t.displacementMap&&(e.displacementMap=this.getTexture(t.displacementMap)),void 0!==t.displacementScale&&(e.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(e.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(e.roughnessMap=this.getTexture(t.roughnessMap)),void 0!==t.metalnessMap&&(e.metalnessMap=this.getTexture(t.metalnessMap)),void 0!==t.emissiveMap&&(e.emissiveMap=this.getTexture(t.emissiveMap)),void 0!==t.emissiveIntensity&&(e.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(e.specularMap=this.getTexture(t.specularMap)),void 0!==t.envMap&&(e.envMap=this.getTexture(t.envMap),e.combine=m.MultiplyOperation),t.reflectivity&&(e.reflectivity=t.reflectivity),void 0!==t.lightMap&&(e.lightMap=this.getTexture(t.lightMap)),void 0!==t.lightMapIntensity&&(e.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(e.aoMap=this.getTexture(t.aoMap)),void 0!==t.aoMapIntensity&&(e.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var r=0,i=t.materials.length;r<i;r++)e.materials.push(this.parse(t.materials[r]));return e}},m.ObjectLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this.texturePath=""},m.ObjectLoader.prototype={constructor:m.ObjectLoader,load:function(t,e,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var n=this;new m.XHRLoader(n.manager).load(t,function(t){n.parse(JSON.parse(t),e)},r,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(n)}),i=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,i),n=this.parseObject(t.object,r,i);return t.animations&&(n.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0===e||e(n),n},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new m.JSONLoader,i=new m.BufferGeometryLoader,n=0,o=t.length;n<o;n++){var a,s=t[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new m[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new m.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new m.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new m.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new m.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new m.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new m.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new m.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new m.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new m.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new m.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new m.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new m.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new m.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"LatheGeometry":a=new m.LatheGeometry(s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var i=new m.MaterialLoader;i.setTextures(e);for(var n=0,o=t.length;n<o;n++){var a=i.parse(t[n]);r[a.uuid]=a}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var i=m.AnimationClip.parse(t[r]);e.push(i)}return e},parseImages:function(t,e){var r=this,i={};if(void 0!==t&&0<t.length){var n=new m.LoadingManager(e),o=new m.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);for(var n=0,a=t.length;n<a;n++){var s=t[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(t){return r.manager.itemStart(t),o.load(t,function(){r.manager.itemEnd(t)})}(h)}}return i},parseTextures:function(t,e){function r(t){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),m[t])}var i={};if(void 0!==t)for(var n=0,o=t.length;n<o;n++){var a=t[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new m.Texture(e[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new m.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new m.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var t=new m.Matrix4;return function(e,r,i){function n(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function o(t){if(void 0!==t)return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}var a;switch(e.type){case"Scene":a=new m.Scene;break;case"PerspectiveCamera":a=new m.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":a=new m.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new m.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new m.DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new m.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new m.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":a=new m.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":a=n(e.geometry);var s=o(e.material);a=a.bones&&0<a.bones.length?new m.SkinnedMesh(a,s):new m.Mesh(a,s);break;case"LOD":a=new m.LOD;break;case"Line":a=new m.Line(n(e.geometry),o(e.material),e.mode);break;case"PointCloud":case"Points":a=new m.Points(n(e.geometry),o(e.material));break;case"Sprite":a=new m.Sprite(o(e.material));break;case"Group":a=new m.Group;break;default:a=new m.Object3D}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(this.parseObject(e.children[h],r,i));if("LOD"===e.type)for(e=e.levels,s=0;s<e.length;s++){var c=e[s];void 0!==(h=a.getObjectByProperty("uuid",c.object))&&a.addLevel(h,c.distance)}return a}}()},m.TextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.TextureLoader.prototype={constructor:m.TextureLoader,load:function(t,e,r,i){var n=new m.Texture,o=new m.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(t){n.image=t,n.needsUpdate=!0,void 0!==e&&e(n)},r,i),n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.CubeTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager},m.CubeTextureLoader.prototype={constructor:m.CubeTextureLoader,load:function(t,e,r,i){var n=new m.CubeTexture([]),o=new m.ImageLoader(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;for(r=0;r<t.length;++r)!function(r){o.load(t[r],function(t){n.images[r]=t,6==++a&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}(r);return n},setCrossOrigin:function(t){this.crossOrigin=t},setPath:function(t){this.path=t}},m.DataTextureLoader=m.BinaryTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.BinaryTextureLoader.prototype={constructor:m.BinaryTextureLoader,load:function(t,e,r,i){var n=this,o=new m.DataTexture,a=new m.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){(t=n._parser(t))&&(void 0!==t.image?o.image=t.image:void 0!==t.data&&(o.image.width=t.width,o.image.height=t.height,o.image.data=t.data),o.wrapS=void 0!==t.wrapS?t.wrapS:m.ClampToEdgeWrapping,o.wrapT=void 0!==t.wrapT?t.wrapT:m.ClampToEdgeWrapping,o.magFilter=void 0!==t.magFilter?t.magFilter:m.LinearFilter,o.minFilter=void 0!==t.minFilter?t.minFilter:m.LinearMipMapLinearFilter,o.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(o.format=t.format),void 0!==t.type&&(o.type=t.type),void 0!==t.mipmaps&&(o.mipmaps=t.mipmaps),1===t.mipmapCount&&(o.minFilter=m.LinearFilter),o.needsUpdate=!0,e&&e(o,t))},r,i),o}},m.CompressedTextureLoader=function(t){this.manager=void 0!==t?t:m.DefaultLoadingManager,this._parser=null},m.CompressedTextureLoader.prototype={constructor:m.CompressedTextureLoader,load:function(t,e,r,i){var n=this,o=[],a=new m.CompressedTexture;a.image=o;var s=new m.XHRLoader(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,c=0,l=t.length;c<l;++c)!function(c){s.load(t[c],function(t){t=n._parser(t,!0),o[c]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(h+=1)&&(1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a))},r,i)}(c);else s.load(t,function(t){if((t=n._parser(t,!0)).isCubemap)for(var r=t.mipmaps.length/t.mipmapCount,i=0;i<r;i++){o[i]={mipmaps:[]};for(var s=0;s<t.mipmapCount;s++)o[i].mipmaps.push(t.mipmaps[i*t.mipmapCount+s]),o[i].format=t.format,o[i].width=t.width,o[i].height=t.height}else a.image.width=t.width,a.image.height=t.height,a.mipmaps=t.mipmaps;1===t.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=t.format,a.needsUpdate=!0,e&&e(a)},r,i);return a},setPath:function(t){this.path=t}},m.Material=function(){Object.defineProperty(this,"id",{value:m.MaterialIdCount++}),this.uuid=m.Math.generateUUID(),this.name="",this.type="Material",this.side=m.FrontSide,this.opacity=1,this.transparent=!1,this.blending=m.NormalBlending,this.blendSrc=m.SrcAlphaFactor,this.blendDst=m.OneMinusSrcAlphaFactor,this.blendEquation=m.AddEquation,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=m.LessEqualDepth,this.colorWrite=this.depthWrite=this.depthTest=!0,this.precision=null,this.polygonOffset=!1,this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this._needsUpdate=this.visible=!0},m.Material.prototype={constructor:m.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0===r)console.warn("THREE.Material: '"+e+"' parameter is undefined.");else{var i=this[e];void 0===i?console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):i instanceof m.Color?i.set(r):i instanceof m.Vector3&&r instanceof m.Vector3?i.copy(r):this[e]="overdraw"===e?Number(r):r}}},toJSON:function(t){function e(t){var e,r=[];for(e in t){var i=t[e];delete i.metadata,r.push(i)}return r}var r=void 0===t;r&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color instanceof m.Color&&(i.color=this.color.getHex()),.5!==this.roughness&&(i.roughness=this.roughness),.5!==this.metalness&&(i.metalness=this.metalness),this.emissive instanceof m.Color&&(i.emissive=this.emissive.getHex()),this.specular instanceof m.Color&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),this.map instanceof m.Texture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap instanceof m.Texture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap instanceof m.Texture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap instanceof m.Texture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof m.Texture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof m.Texture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof m.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap instanceof m.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap instanceof m.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap instanceof m.Texture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap instanceof m.Texture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==m.NoColors&&(i.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==m.SmoothShading&&(i.shading=this.shading),void 0!==this.blending&&this.blending!==m.NormalBlending&&(i.blending=this.blending),void 0!==this.side&&this.side!==m.FrontSide&&(i.side=this.side),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),r&&(r=e(t.textures),t=e(t.images),0<r.length&&(i.textures=r),0<t.length&&(i.images=t)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.side=t.side,this.opacity=t.opacity,this.transparent=t.transparent,this.blending=t.blending,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.overdraw=t.overdraw,this.visible=t.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.Material.prototype),m.MaterialIdCount=0,m.LineBasicMaterial=function(t){m.Material.call(this),this.type="LineBasicMaterial",this.color=new m.Color(16777215),this.linewidth=1,this.linejoin=this.linecap="round",this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineBasicMaterial.prototype=Object.create(m.Material.prototype),m.LineBasicMaterial.prototype.constructor=m.LineBasicMaterial,m.LineBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.LineDashedMaterial=function(t){m.Material.call(this),this.type="LineDashedMaterial",this.color=new m.Color(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.LineDashedMaterial.prototype=Object.create(m.Material.prototype),m.LineDashedMaterial.prototype.constructor=m.LineDashedMaterial,m.LineDashedMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.MeshBasicMaterial=function(t){m.Material.call(this),this.type="MeshBasicMaterial",this.color=new m.Color(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshBasicMaterial.prototype=Object.create(m.Material.prototype),m.MeshBasicMaterial.prototype.constructor=m.MeshBasicMaterial,m.MeshBasicMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},m.MeshLambertMaterial=function(t){m.Material.call(this),this.type="MeshLambertMaterial",this.color=new m.Color(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshLambertMaterial.prototype=Object.create(m.Material.prototype),m.MeshLambertMaterial.prototype.constructor=m.MeshLambertMaterial,m.MeshLambertMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshPhongMaterial=function(t){m.Material.call(this),this.type="MeshPhongMaterial",this.color=new m.Color(16777215),this.specular=new m.Color(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=m.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshPhongMaterial.prototype=Object.create(m.Material.prototype),m.MeshPhongMaterial.prototype.constructor=m.MeshPhongMaterial,m.MeshPhongMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshStandardMaterial=function(t){m.Material.call(this),this.type="MeshStandardMaterial",this.color=new m.Color(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new m.Color(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new m.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=m.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(t)},m.MeshStandardMaterial.prototype=Object.create(m.Material.prototype),m.MeshStandardMaterial.prototype.constructor=m.MeshStandardMaterial,m.MeshStandardMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.fog=t.fog,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},m.MeshDepthMaterial=function(t){m.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(t)},m.MeshDepthMaterial.prototype=Object.create(m.Material.prototype),m.MeshDepthMaterial.prototype.constructor=m.MeshDepthMaterial,m.MeshDepthMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MeshNormalMaterial=function(t){m.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},m.MeshNormalMaterial.prototype=Object.create(m.Material.prototype),m.MeshNormalMaterial.prototype.constructor=m.MeshNormalMaterial,m.MeshNormalMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},m.MultiMaterial=function(t){this.uuid=m.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0},m.MultiMaterial.prototype={constructor:m.MultiMaterial,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,i=0,n=r.length;i<n;i++){var o=r[i].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},m.PointsMaterial=function(t){m.Material.call(this),this.type="PointsMaterial",this.color=new m.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=m.NoColors,this.fog=!0,this.setValues(t)},m.PointsMaterial.prototype=Object.create(m.Material.prototype),m.PointsMaterial.prototype.constructor=m.PointsMaterial,m.PointsMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.vertexColors=t.vertexColors,this.fog=t.fog,this},m.ShaderMaterial=function(t){m.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=m.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.vertexColors=m.NoColors,this.morphNormals=this.morphTargets=this.skinning=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))},m.ShaderMaterial.prototype=Object.create(m.Material.prototype),m.ShaderMaterial.prototype.constructor=m.ShaderMaterial,m.ShaderMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=m.UniformsUtils.clone(t.uniforms),this.defines=t.defines,this.shading=t.shading,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.vertexColors=t.vertexColors,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},m.ShaderMaterial.prototype.toJSON=function(t){return t=m.Material.prototype.toJSON.call(this,t),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},m.RawShaderMaterial=function(t){m.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},m.RawShaderMaterial.prototype=Object.create(m.ShaderMaterial.prototype),m.RawShaderMaterial.prototype.constructor=m.RawShaderMaterial,m.SpriteMaterial=function(t){m.Material.call(this),this.type="SpriteMaterial",this.color=new m.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},m.SpriteMaterial.prototype=Object.create(m.Material.prototype),m.SpriteMaterial.prototype.constructor=m.SpriteMaterial,m.SpriteMaterial.prototype.copy=function(t){return m.Material.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this.fog=t.fog,this},m.Texture=function(t,e,r,i,n,o,a,s,h){Object.defineProperty(this,"id",{value:m.TextureIdCount++}),this.uuid=m.Math.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==t?t:m.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:m.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:m.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:m.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:m.LinearFilter,this.minFilter=void 0!==o?o:m.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==a?a:m.RGBAFormat,this.type=void 0!==s?s:m.UnsignedByteType,this.offset=new m.Vector2(0,0),this.repeat=new m.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},m.Texture.DEFAULT_IMAGE=void 0,m.Texture.DEFAULT_MAPPING=m.UVMapping,m.Texture.prototype={constructor:m.Texture,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=m.Math.generateUUID()),void 0===t.images[r.uuid]){var i,n=t.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:(i=document.createElement("canvas"),i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0,r.width,r.height)),i=2048<i.width||2048<i.height?i.toDataURL("image/jpeg",.6):i.toDataURL("image/png"),n[o]={uuid:a,url:i}}e.image=r.uuid}return t.textures[this.uuid]=e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===m.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),0>t.x||1<t.x)switch(this.wrapS){case m.RepeatWrapping:t.x-=Math.floor(t.x);break;case m.ClampToEdgeWrapping:t.x=0>t.x?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x-=Math.floor(t.x)}if(0>t.y||1<t.y)switch(this.wrapT){case m.RepeatWrapping:t.y-=Math.floor(t.y);break;case m.ClampToEdgeWrapping:t.y=0>t.y?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y-=Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},m.EventDispatcher.prototype.apply(m.Texture.prototype),m.TextureIdCount=0,m.CanvasTexture=function(t,e,r,i,n,o,a,s,h){m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.needsUpdate=!0},m.CanvasTexture.prototype=Object.create(m.Texture.prototype),m.CanvasTexture.prototype.constructor=m.CanvasTexture,m.CubeTexture=function(t,e,r,i,n,o,a,s,h){e=void 0!==e?e:m.CubeReflectionMapping,m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.images=t,this.flipY=!1},m.CubeTexture.prototype=Object.create(m.Texture.prototype),m.CubeTexture.prototype.constructor=m.CubeTexture,m.CubeTexture.prototype.copy=function(t){return m.Texture.prototype.copy.call(this,t),this.images=t.images,this},m.CompressedTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={width:e,height:r},this.mipmaps=t,this.generateMipmaps=this.flipY=!1},m.CompressedTexture.prototype=Object.create(m.Texture.prototype),m.CompressedTexture.prototype.constructor=m.CompressedTexture,m.DataTexture=function(t,e,r,i,n,o,a,s,h,c,l){m.Texture.call(this,null,o,a,s,h,c,i,n,l),this.image={data:t,width:e,height:r},this.magFilter=void 0!==h?h:m.NearestFilter,this.minFilter=void 0!==c?c:m.NearestFilter,this.generateMipmaps=this.flipY=!1},m.DataTexture.prototype=Object.create(m.Texture.prototype),m.DataTexture.prototype.constructor=m.DataTexture,m.VideoTexture=function(t,e,r,i,n,o,a,s,h){function c(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)}m.Texture.call(this,t,e,r,i,n,o,a,s,h),this.generateMipmaps=!1;var l=this;c()},m.VideoTexture.prototype=Object.create(m.Texture.prototype),m.VideoTexture.prototype.constructor=m.VideoTexture,m.Group=function(){m.Object3D.call(this),this.type="Group"},m.Group.prototype=Object.create(m.Object3D.prototype),m.Group.prototype.constructor=m.Group,m.Points=function(t,e){m.Object3D.call(this),this.type="Points",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.PointsMaterial({color:16777215*Math.random()})},m.Points.prototype=Object.create(m.Object3D.prototype),m.Points.prototype.constructor=m.Points,m.Points.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){function o(t,r){var o=e.distanceSqToPoint(t);if(o<l){var s=e.closestPointToPoint(t);s.applyMatrix4(h);var c=i.ray.origin.distanceTo(s);c<i.near||c>i.far||n.push({distance:c,distanceToRay:Math.sqrt(o),point:s.clone(),index:r,face:null,object:a})}}var a=this,s=this.geometry,h=this.matrixWorld,c=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(h),!1!==i.ray.intersectsSphere(r)){t.getInverse(h),e.copy(i.ray).applyMatrix4(t);var l=(c/=(this.scale.x+this.scale.y+this.scale.z)/3)*c,c=new m.Vector3;if(s instanceof m.BufferGeometry){var u=s.index,s=s.attributes.position.array;if(null!==u)for(var p=u.array,u=0,d=p.length;u<d;u++){var f=p[u];c.fromArray(s,3*f),o(c,f)}else for(u=0,p=s.length/3;u<p;u++)c.fromArray(s,3*u),o(c,u)}else for(c=s.vertices,u=0,p=c.length;u<p;u++)o(c[u],u)}}}(),m.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Line=function(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new m.LineSegments(t,e);m.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.LineBasicMaterial({color:16777215*Math.random()})},m.Line.prototype=Object.create(m.Object3D.prototype),m.Line.prototype.constructor=m.Line,m.Line.prototype.raycast=function(){var t=new m.Matrix4,e=new m.Ray,r=new m.Sphere;return function(i,n){var o=(o=i.linePrecision)*o,a=this.geometry,s=this.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),r.copy(a.boundingSphere),r.applyMatrix4(s),!1!==i.ray.intersectsSphere(r)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=new m.Vector3,c=new m.Vector3,s=new m.Vector3,l=new m.Vector3,u=this instanceof m.LineSegments?2:1;if(a instanceof m.BufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var p=p.array,a=0,f=p.length-1;a<f;a+=u){var g=p[a+1];h.fromArray(d,3*p[a]),c.fromArray(d,3*g),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else for(a=0,f=d.length/3-1;a<f;a+=u)h.fromArray(d,3*a),c.fromArray(d,3*a+3),(g=e.distanceSqToSegment(h,c,l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}else if(a instanceof m.Geometry)for(h=a.vertices,c=h.length,a=0;a<c-1;a+=u)(g=e.distanceSqToSegment(h[a],h[a+1],l,s))>o||(l.applyMatrix4(this.matrixWorld),(g=i.ray.origin.distanceTo(l))<i.near||g>i.far||n.push({distance:g,point:s.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this}))}}}(),m.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.LineStrip=0,m.LinePieces=1,m.LineSegments=function(t,e){m.Line.call(this,t,e),this.type="LineSegments"},m.LineSegments.prototype=Object.create(m.Line.prototype),m.LineSegments.prototype.constructor=m.LineSegments,m.Mesh=function(t,e){m.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new m.Geometry,this.material=void 0!==e?e:new m.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=m.TrianglesDrawMode,this.updateMorphTargets()},m.Mesh.prototype=Object.create(m.Object3D.prototype),m.Mesh.prototype.constructor=m.Mesh,m.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},m.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;t<e;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},m.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},m.Mesh.prototype.raycast=function(){function t(t,e,r,i,n,o,a){return m.Triangle.barycoordFromPoint(t,e,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),a.multiplyScalar(g.z),n.add(o).add(a),n.clone()}function e(t,e,r,i,n,o,a){var s=t.material;return null===(s.side===m.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,s.side!==m.DoubleSide,a))?null:(y.copy(a),y.applyMatrix4(t.matrixWorld),r=e.ray.origin.distanceTo(y),r<e.near||r>e.far?null:{distance:r,point:y.clone(),object:t})}function r(r,i,n,o,c,l,u,g){return a.fromArray(o,3*l),s.fromArray(o,3*u),h.fromArray(o,3*g),(r=e(r,i,n,a,s,h,v))&&(c&&(p.fromArray(c,2*l),d.fromArray(c,2*u),f.fromArray(c,2*g),r.uv=t(v,a,s,h,p,d,f)),r.face=new m.Face3(l,u,g,m.Triangle.normal(a,s,h)),r.faceIndex=l),r}var i=new m.Matrix4,n=new m.Ray,o=new m.Sphere,a=new m.Vector3,s=new m.Vector3,h=new m.Vector3,c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=new m.Vector2,d=new m.Vector2,f=new m.Vector2,g=new m.Vector3,v=new m.Vector3,y=new m.Vector3;return function(g,y){var x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),o.copy(x.boundingSphere),o.applyMatrix4(_),!1!==g.ray.intersectsSphere(o)&&(i.getInverse(_),n.copy(g.ray).applyMatrix4(i),null===x.boundingBox||!1!==n.intersectsBox(x.boundingBox)))){var M,w;if(x instanceof m.BufferGeometry){var S,E,b=x.index,x=(_=x.attributes).position.array;if(void 0!==_.uv&&(M=_.uv.array),null!==b)for(var _=b.array,T=0,C=_.length;T<C;T+=3)b=_[T],S=_[T+1],E=_[T+2],(w=r(this,g,n,x,M,b,S,E))&&(w.faceIndex=Math.floor(T/3),y.push(w));else for(T=0,C=x.length;T<C;T+=9)b=T/3,S=b+1,E=b+2,(w=r(this,g,n,x,M,b,S,E))&&(w.index=b,y.push(w))}else if(x instanceof m.Geometry){var L,A,T=!0==(_=b instanceof m.MultiMaterial)?b.materials:null,C=x.vertices;S=x.faces,0<(E=x.faceVertexUvs[0]).length&&(M=E);for(var P=0,R=S.length;P<R;P++){var U=S[P];if(void 0!==(w=!0===_?T[U.materialIndex]:b)){if(E=C[U.a],L=C[U.b],A=C[U.c],!0===w.morphTargets){w=x.morphTargets;var k=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),h.set(0,0,0);for(var D=0,I=w.length;D<I;D++){var F=k[D];if(0!==F){var B=w[D].vertices;a.addScaledVector(c.subVectors(B[U.a],E),F),s.addScaledVector(l.subVectors(B[U.b],L),F),h.addScaledVector(u.subVectors(B[U.c],A),F)}}a.add(E),s.add(L),h.add(A),E=a,L=s,A=h}(w=e(this,g,n,E,L,A,v))&&(M&&(k=M[P],p.copy(k[0]),d.copy(k[1]),f.copy(k[2]),w.uv=t(v,E,L,A,p,d,f)),w.face=U,w.faceIndex=P,y.push(w))}}}}}}(),m.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Bone=function(t){m.Object3D.call(this),this.type="Bone",this.skin=t},m.Bone.prototype=Object.create(m.Object3D.prototype),m.Bone.prototype.constructor=m.Bone,m.Bone.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),this.skin=t.skin,this},m.Skeleton=function(t,e,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new m.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture?(t=Math.sqrt(4*this.bones.length),t=m.Math.nextPowerOfTwo(Math.ceil(t)),this.boneTextureHeight=this.boneTextureWidth=t=Math.max(t,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new m.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,m.RGBAFormat,m.FloatType)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new m.Matrix4)},m.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new m.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},m.Skeleton.prototype.pose=function(){for(var t,e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},m.Skeleton.prototype.update=function(){var t=new m.Matrix4;return function(){for(var e=0,r=this.bones.length;e<r;e++)t.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),m.Skeleton.prototype.clone=function(){return new m.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},m.SkinnedMesh=function(t,e,r){if(m.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m.Matrix4,this.bindMatrixInverse=new m.Matrix4,t=[],this.geometry&&void 0!==this.geometry.bones){for(var i,n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],e=new m.Bone(this),t.push(e),e.name=i.name,e.position.fromArray(i.pos),e.quaternion.fromArray(i.rotq),void 0!==i.scl&&e.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)i=this.geometry.bones[n],-1!==i.parent&&null!==i.parent?t[i.parent].add(t[n]):this.add(t[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new m.Skeleton(t,void 0,r),this.matrixWorld)},m.SkinnedMesh.prototype=Object.create(m.Mesh.prototype),m.SkinnedMesh.prototype.constructor=m.SkinnedMesh,m.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},m.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},m.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof m.Geometry)for(i=0;i<this.geometry.skinWeights.length;i++){var t=1/(e=this.geometry.skinWeights[i]).lengthManhattan();1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry instanceof m.BufferGeometry)for(var e=new m.Vector4,r=this.geometry.attributes.skinWeight,i=0;i<r.count;i++)e.x=r.getX(i),e.y=r.getY(i),e.z=r.getZ(i),e.w=r.getW(i),t=1/e.lengthManhattan(),1/0!==t?e.multiplyScalar(t):e.set(1,0,0,0),r.setXYZW(i,e.x,e.y,e.z,e.w)},m.SkinnedMesh.prototype.updateMatrixWorld=function(t){m.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},m.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},m.LOD=function(){m.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},m.LOD.prototype=Object.create(m.Object3D.prototype),m.LOD.prototype.constructor=m.LOD,m.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,i=0;i<r.length&&!(e<r[i].distance);i++);r.splice(i,0,{distance:e,object:t}),this.add(t)},m.LOD.prototype.getObjectForDistance=function(t){for(var e=this.levels,r=1,i=e.length;r<i&&!(t<e[r].distance);r++);return e[r-1].object},m.LOD.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,r)}}(),m.LOD.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(r){var i=this.levels;if(1<i.length){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld),r=t.distanceTo(e),i[0].object.visible=!0;for(var n=1,o=i.length;n<o&&r>=i[n].distance;n++)i[n-1].object.visible=!1,i[n].object.visible=!0;for(;n<o;n++)i[n].object.visible=!1}}}(),m.LOD.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t,!1);for(var e=0,r=(t=t.levels).length;e<r;e++){var i=t[e];this.addLevel(i.object.clone(),i.distance)}return this},m.LOD.prototype.toJSON=function(t){(t=m.Object3D.prototype.toJSON.call(this,t)).object.levels=[];for(var e=this.levels,r=0,i=e.length;r<i;r++){var n=e[r];t.object.levels.push({object:n.object.uuid,distance:n.distance})}return t},m.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new m.BufferGeometry;return i.setIndex(new m.BufferAttribute(t,1)),i.addAttribute("position",new m.BufferAttribute(e,3)),i.addAttribute("uv",new m.BufferAttribute(r,2)),function(t){m.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new m.SpriteMaterial}}(),m.Sprite.prototype=Object.create(m.Object3D.prototype),m.Sprite.prototype.constructor=m.Sprite,m.Sprite.prototype.raycast=function(){var t=new m.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(t);i>this.scale.x*this.scale.y||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),m.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},m.Particle=m.Sprite,m.LensFlare=function(t,e,r,i,n){m.Object3D.call(this),this.lensFlares=[],this.positionScreen=new m.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,i,n)},m.LensFlare.prototype=Object.create(m.Object3D.prototype),m.LensFlare.prototype.constructor=m.LensFlare,m.LensFlare.prototype.add=function(t,e,r,i,n,o){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new m.Color(16777215)),void 0===i&&(i=m.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},m.LensFlare.prototype.updateLensFlares=function(){var t,e,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+n*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},m.LensFlare.prototype.copy=function(t){m.Object3D.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},m.Scene=function(){m.Object3D.call(this),this.type="Scene",this.overrideMaterial=this.fog=null,this.autoUpdate=!0},m.Scene.prototype=Object.create(m.Object3D.prototype),m.Scene.prototype.constructor=m.Scene,m.Scene.prototype.copy=function(t){return m.Object3D.prototype.copy.call(this,t),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},m.Fog=function(t,e,r){this.name="",this.color=new m.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},m.Fog.prototype.clone=function(){return new m.Fog(this.color.getHex(),this.near,this.far)},m.FogExp2=function(t,e){this.name="",this.color=new m.Color(t),this.density=void 0!==e?e:25e-5},m.FogExp2.prototype.clone=function(){return new m.FogExp2(this.color.getHex(),this.density)},m.ShaderChunk={},m.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",m.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",m.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",m.ShaderChunk.ambient_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\treturn PI * ambientLightColor;\n}\n",m.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\treflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n#endif\n",m.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",m.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",m.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",m.ShaderChunk.bsdfs="float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t  return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = alpha * alpha;\n\tfloat gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );\n\tfloat gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );\n\treturn 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = alpha * alpha;\n\tfloat denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / ( denom * 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 = roughness * 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_Smith( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );\n}",m.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",m.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",m.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",m.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",m.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",m.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\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 square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\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}\nvec3 inputToLinear( in vec3 a ) {\n\t#ifdef GAMMA_INPUT\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n",m.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",m.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",m.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",m.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\ttotalEmissiveLight *= emissiveColor.rgb;\n#endif\n",m.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",m.ShaderChunk.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 DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",m.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvarying vec3 vReflect;\n\tuniform float refractionRatio;\n#endif\n",m.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t#else\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t#endif\n#endif\n",m.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n#endif",m.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\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",m.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",m.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",m.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tdirectLight = getPointDirectLight( pointLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tdirectLight = getSpotDirectLight( spotLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectLight = getDirectionalDirectLight( directionalLights[ i ], geometry );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.lights_pars="#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\tIncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\treturn directLight;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tIncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\t\treturn directLight;\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 angleCos;\n\t\tfloat exponent;\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\tIncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\t\tIncidentLight directLight;\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat spotEffect = dot( directLight.direction, spotLight.direction );\n\t\tif ( spotEffect > spotLight.angleCos ) {\n\t\t\tfloat spotEffect = dot( spotLight.direction, directLight.direction );\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t}\n\t\treturn directLight;\n\t}\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\treturn PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\n\t\t#endif\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * 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#else\n\t\t\tvec3 envMapColor = vec3( 0.0 );\n\t\t#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\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( square( 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\t#ifdef DOUBLE_SIDED\n\t\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tfloat flipNormal = 1.0;\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 = flipNormal * 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * 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#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * 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#endif\n\t\tenvMapColor.rgb = inputToLinear( envMapColor.rgb );\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",m.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",m.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\nvarying 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\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\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)\n",m.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n\tvarying vec3 vWorldPosition;\n#endif\n",m.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n\tvWorldPosition = worldPosition.xyz;\n#endif\n",m.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",m.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * PI * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Standard\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n",m.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tdirectLight = getPointDirectLight( pointLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tdirectLight = getSpotDirectLight( spotLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tdirectLight = getDirectionalDirectLight( directionalLight, geometry );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= bool( directionalLight.shadow ) ? 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 defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tirradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\tRE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",m.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n",m.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",m.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",m.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",m.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",m.ShaderChunk.map_fragment="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\tdiffuseColor *= texelColor;\n#endif\n",m.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",m.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n#endif\n",m.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",m.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",m.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",m.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",m.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",m.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",m.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",m.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",m.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",m.ShaderChunk.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 unpackDepth( const in vec4 rgba_depth ) {\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\treturn dot( rgba_depth, bit_shift );\n\t}\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec3 offset = vec3( - 1, 0, 1 ) * shadowRadius * 2.0 * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxx, 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.xzx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxy, 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.xzy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyx, 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.yzz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxz, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 21.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",m.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",m.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",m.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",m.ShaderChunk.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",m.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",m.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned  = bindMatrixInverse * skinned;\n#endif\n",m.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",m.ShaderChunk.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",m.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",m.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",m.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",m.ShaderChunk.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",m.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",m.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",m.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",m.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i,n=this.clone(t[r]);for(i in n)e[i]=n[i]}return e},clone:function(t){var e,r={};for(e in t){r[e]={};for(var i in t[e]){var n=t[e][i];n instanceof m.Color||n instanceof m.Vector2||n instanceof m.Vector3||n instanceof m.Vector4||n instanceof m.Matrix3||n instanceof m.Matrix4||n instanceof m.Texture?r[e][i]=n.clone():Array.isArray(n)?r[e][i]=n.slice():r[e][i]=n}}return r}},m.UniformsLib={common:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new m.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new m.Color(16777215)}},ambient:{ambientLightColor:{type:"fv",value:[]}},lights:{directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},angleCos:{type:"f"},exponent:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new m.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new m.Vector4(0,0,1,1)}}},m.ShaderLib={basic:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.fog]),vertexShader:[m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"\t#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,"\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.indirectDiffuse;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},lambert:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.bsdfs,m.ShaderChunk.lights_pars,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_lambert_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.shadowmask_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.emissivemap_fragment,"\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );",m.ShaderChunk.lightmap_fragment,"\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();",m.ShaderChunk.aomap_fragment,"\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},phong:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},specular:{type:"c",value:new m.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.lights_phong_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.lights_phong_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_phong_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_phong_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.envmap_fragment,m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},standard:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.aomap,m.UniformsLib.lightmap,m.UniformsLib.emissivemap,m.UniformsLib.bumpmap,m.UniformsLib.normalmap,m.UniformsLib.displacementmap,m.UniformsLib.roughnessmap,m.UniformsLib.metalnessmap,m.UniformsLib.fog,m.UniformsLib.ambient,m.UniformsLib.lights,{emissive:{type:"c",value:new m.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.uv_pars_vertex,m.ShaderChunk.uv2_pars_vertex,m.ShaderChunk.displacementmap_pars_vertex,m.ShaderChunk.envmap_pars_vertex,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.specularmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.uv_vertex,m.ShaderChunk.uv2_vertex,m.ShaderChunk.color_vertex,m.ShaderChunk.beginnormal_vertex,m.ShaderChunk.morphnormal_vertex,m.ShaderChunk.skinbase_vertex,m.ShaderChunk.skinnormal_vertex,m.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",m.ShaderChunk.begin_vertex,m.ShaderChunk.displacementmap_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = - mvPosition.xyz;",m.ShaderChunk.worldpos_vertex,m.ShaderChunk.envmap_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.uv_pars_fragment,m.ShaderChunk.uv2_pars_fragment,m.ShaderChunk.map_pars_fragment,m.ShaderChunk.alphamap_pars_fragment,m.ShaderChunk.aomap_pars_fragment,m.ShaderChunk.lightmap_pars_fragment,m.ShaderChunk.emissivemap_pars_fragment,m.ShaderChunk.envmap_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.bsdfs,m.ShaderChunk.ambient_pars,m.ShaderChunk.lights_pars,m.ShaderChunk.lights_standard_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.bumpmap_pars_fragment,m.ShaderChunk.normalmap_pars_fragment,m.ShaderChunk.roughnessmap_pars_fragment,m.ShaderChunk.metalnessmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveLight = emissive;",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphamap_fragment,m.ShaderChunk.alphatest_fragment,m.ShaderChunk.specularmap_fragment,m.ShaderChunk.roughnessmap_fragment,m.ShaderChunk.metalnessmap_fragment,m.ShaderChunk.normal_fragment,m.ShaderChunk.emissivemap_fragment,m.ShaderChunk.lights_standard_fragment,m.ShaderChunk.lights_template,m.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",m.ShaderChunk.linear_to_gamma_fragment,m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},points:{uniforms:m.UniformsUtils.merge([m.UniformsLib.points,m.UniformsLib.fog]),vertexShader:["uniform float size;\nuniform float scale;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.shadowmap_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.project_vertex,"\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif",m.ShaderChunk.logdepthbuf_vertex,m.ShaderChunk.worldpos_vertex,m.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.map_particle_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.shadowmap_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.map_particle_fragment,m.ShaderChunk.color_fragment,m.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:m.UniformsUtils.merge([m.UniformsLib.common,m.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",m.ShaderChunk.common,m.ShaderChunk.color_pars_fragment,m.ShaderChunk.fog_pars_fragment,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",m.ShaderChunk.logdepthbuf_fragment,m.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",m.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvNormal = normalize( normalMatrix * normal );",m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",m.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,m.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[m.ShaderChunk.common,m.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",m.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new m.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",m.ShaderChunk.common,m.ShaderChunk.morphtarget_pars_vertex,m.ShaderChunk.skinning_pars_vertex,"void main() {",m.ShaderChunk.skinbase_vertex,m.ShaderChunk.begin_vertex,m.ShaderChunk.morphtarget_vertex,m.ShaderChunk.skinning_vertex,m.ShaderChunk.project_vertex,m.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",m.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n\tdepth /= 1000.0;\n\tconst vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}},m.WebGLRenderer=function(t){function e(t,e,r,i){!0===I&&(t*=i,e*=i,r*=i),xt.clearColor(t,e,r,i)}function r(){xt.init(),xt.scissor(J.copy(st).multiplyScalar(at)),xt.viewport(tt.copy(ct).multiplyScalar(at)),e(rt.r,rt.g,rt.b,it)}function i(){K=X=null,Q="",Z=-1,xt.reset()}function n(t){t.preventDefault(),i(),r(),bt.clear()}function o(t){(t=t.target).removeEventListener("dispose",o);t:{var e=bt.get(t);if(t.image&&e.__image__webglTextureCube)gt.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)break t;gt.deleteTexture(e.__webglTexture)}bt.delete(t)}ft.textures--}function a(t){(t=t.target).removeEventListener("dispose",a);var e=bt.get(t),r=bt.get(t.texture);if(t&&void 0!==r.__webglTexture){if(gt.deleteTexture(r.__webglTexture),t instanceof m.WebGLRenderTargetCube)for(r=0;6>r;r++)gt.deleteFramebuffer(e.__webglFramebuffer[r]),gt.deleteRenderbuffer(e.__webglDepthbuffer[r]);else gt.deleteFramebuffer(e.__webglFramebuffer),gt.deleteRenderbuffer(e.__webglDepthbuffer);bt.delete(t.texture),bt.delete(t)}ft.textures--}function s(t){(t=t.target).removeEventListener("dispose",s),h(t),bt.delete(t)}function h(t){var e=bt.get(t).program;t.program=void 0,void 0!==e&&Mt.releaseProgram(e)}function c(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function u(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function p(t,e,r,i,n){var o;r.transparent?(i=O,o=++G):(i=V,o=++N),void 0!==(o=i[o])?(o.id=t.id,o.object=t,o.geometry=e,o.material=r,o.z=pt.z,o.group=n):(o={id:t.id,object:t,geometry:e,material:r,z:pt.z,group:n},i.push(o))}function d(t,e){if(!1!==t.visible){if(t.layers.test(e.layers))if(t instanceof m.Light)B.push(t);else if(t instanceof m.Sprite)!1!==t.frustumCulled&&!0!==lt.intersectsObject(t)||H.push(t);else if(t instanceof m.LensFlare)j.push(t);else if(t instanceof m.ImmediateRenderObject)!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut)),p(t,null,t.material,pt.z,null);else if((t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&(t instanceof m.SkinnedMesh&&t.skeleton.update(),(!1===t.frustumCulled||!0===lt.intersectsObject(t))&&!0===(o=t.material).visible)){!0===W.sortObjects&&(pt.setFromMatrixPosition(t.matrixWorld),pt.applyProjection(ut));var r=_t.update(t);if(o instanceof m.MultiMaterial)for(var i=r.groups,n=o.materials,o=0,a=i.length;o<a;o++){var s=i[o],h=n[s.materialIndex];!0===h.visible&&p(t,r,h,pt.z,s)}else p(t,r,o,pt.z,null)}for(o=0,a=(r=t.children).length;o<a;o++)d(r[o],e)}}function f(t,e,r,i){for(var n=0,o=t.length;n<o;n++){var a=(c=t[n]).object,s=c.geometry,h=void 0===i?c.material:i,c=c.group;if(a.modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a instanceof m.ImmediateRenderObject){g(h);var l=v(e,r,h,a);Q="",a.render(function(t){W.renderBufferImmediate(t,l,h)})}else W.renderBufferDirect(e,r,s,h,a,c)}}function g(t){t.side!==m.DoubleSide?xt.enable(gt.CULL_FACE):xt.disable(gt.CULL_FACE),xt.setFlipSided(t.side===m.BackSide),!0===t.transparent?xt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):xt.setBlending(m.NoBlending),xt.setDepthFunc(t.depthFunc),xt.setDepthTest(t.depthTest),xt.setDepthWrite(t.depthWrite),xt.setColorWrite(t.colorWrite),xt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function v(t,e,r,i){et=0;var n=bt.get(r);if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==dt.hash&&(r.needsUpdate=!0),r.needsUpdate){t:{var o=bt.get(r),a=Mt.getParameters(r,dt,e,i),c=Mt.getProgramCode(r,a),l=o.program,u=!0;if(void 0===l)r.addEventListener("dispose",s);else if(l.code!==c)h(r);else{if(void 0!==a.shaderID)break t;u=!1}if(u&&(a.shaderID?(l=m.ShaderLib[a.shaderID],o.__webglShader={name:r.type,uniforms:m.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):o.__webglShader={name:r.type,uniforms:r.uniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader},r.__webglShader=o.__webglShader,l=Mt.acquireProgram(r,a,c),o.program=l,r.program=l),a=l.getAttributes(),r.morphTargets)for(c=r.numSupportedMorphTargets=0;c<W.maxMorphTargets;c++)0<=a["morphTarget"+c]&&r.numSupportedMorphTargets++;if(r.morphNormals)for(c=r.numSupportedMorphNormals=0;c<W.maxMorphNormals;c++)0<=a["morphNormal"+c]&&r.numSupportedMorphNormals++;o.uniformsList=[];var p,a=o.__webglShader.uniforms,c=o.program.getUniforms();for(p in a)(l=c[p])&&o.uniformsList.push([o.__webglShader.uniforms[p],l]);for((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(o.lightsHash=dt.hash,a.ambientLightColor.value=dt.ambient,a.directionalLights.value=dt.directional,a.spotLights.value=dt.spot,a.pointLights.value=dt.point,a.hemisphereLights.value=dt.hemi,a.directionalShadowMap.value=dt.directionalShadowMap,a.directionalShadowMatrix.value=dt.directionalShadowMatrix,a.spotShadowMap.value=dt.spotShadowMap,a.spotShadowMatrix.value=dt.spotShadowMatrix,a.pointShadowMap.value=dt.pointShadowMap,a.pointShadowMatrix.value=dt.pointShadowMatrix),o.hasDynamicUniforms=!1,p=0,a=o.uniformsList.length;p<a;p++)if(!0===o.uniformsList[p][0].dynamic){o.hasDynamicUniforms=!0;break}}r.needsUpdate=!1}if(l=c=u=!1,o=n.program,p=o.getUniforms(),a=n.__webglShader.uniforms,o.id!==X&&(gt.useProgram(o.program),X=o.id,l=c=u=!0),r.id!==Z&&(Z=r.id,c=!0),(u||t!==K)&&(gt.uniformMatrix4fv(p.projectionMatrix,!1,t.projectionMatrix.elements),yt.logarithmicDepthBuffer&&gt.uniform1f(p.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==K&&(K=t,l=c=!0),(r instanceof m.ShaderMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial||r.envMap)&&void 0!==p.cameraPosition&&(pt.setFromMatrixPosition(t.matrixWorld),gt.uniform3f(p.cameraPosition,pt.x,pt.y,pt.z)),(r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshBasicMaterial||r instanceof m.MeshStandardMaterial||r instanceof m.ShaderMaterial||r.skinning)&&void 0!==p.viewMatrix&&gt.uniformMatrix4fv(p.viewMatrix,!1,t.matrixWorldInverse.elements)),r.skinning&&(i.bindMatrix&&void 0!==p.bindMatrix&&gt.uniformMatrix4fv(p.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&gt.uniformMatrix4fv(p.bindMatrixInverse,!1,i.bindMatrixInverse.elements),yt.floatVertexTextures&&i.skeleton&&i.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(u=y(),gt.uniform1i(p.boneTexture,u),W.setTexture(i.skeleton.boneTexture,u)),void 0!==p.boneTextureWidth&&gt.uniform1i(p.boneTextureWidth,i.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&gt.uniform1i(p.boneTextureHeight,i.skeleton.boneTextureHeight)):i.skeleton&&i.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&gt.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.skeleton.boneMatrices)),c){if((r instanceof m.MeshPhongMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshStandardMaterial||r.lights)&&(c=l,a.ambientLightColor.needsUpdate=c,a.directionalLights.needsUpdate=c,a.pointLights.needsUpdate=c,a.spotLights.needsUpdate=c,a.hemisphereLights.needsUpdate=c),e&&r.fog&&(a.fogColor.value=e.color,e instanceof m.Fog?(a.fogNear.value=e.near,a.fogFar.value=e.far):e instanceof m.FogExp2&&(a.fogDensity.value=e.density)),r instanceof m.MeshBasicMaterial||r instanceof m.MeshLambertMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial){a.opacity.value=r.opacity,a.diffuse.value=r.color,r.emissive&&a.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),a.map.value=r.map,a.specularMap.value=r.specularMap,a.alphaMap.value=r.alphaMap,r.aoMap&&(a.aoMap.value=r.aoMap,a.aoMapIntensity.value=r.aoMapIntensity);var d;r.map?d=r.map:r.specularMap?d=r.specularMap:r.displacementMap?d=r.displacementMap:r.normalMap?d=r.normalMap:r.bumpMap?d=r.bumpMap:r.roughnessMap?d=r.roughnessMap:r.metalnessMap?d=r.metalnessMap:r.alphaMap?d=r.alphaMap:r.emissiveMap&&(d=r.emissiveMap),void 0!==d&&(d instanceof m.WebGLRenderTarget&&(d=d.texture),e=d.offset,d=d.repeat,a.offsetRepeat.value.set(e.x,e.y,d.x,d.y)),a.envMap.value=r.envMap,a.flipEnvMap.value=r.envMap instanceof m.WebGLRenderTargetCube?1:-1,a.reflectivity.value=r.reflectivity,a.refractionRatio.value=r.refractionRatio}r instanceof m.LineBasicMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity):r instanceof m.LineDashedMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.dashSize.value=r.dashSize,a.totalSize.value=r.dashSize+r.gapSize,a.scale.value=r.scale):r instanceof m.PointsMaterial?(a.diffuse.value=r.color,a.opacity.value=r.opacity,a.size.value=r.size*at,a.scale.value=A.clientHeight/2,a.map.value=r.map,null!==r.map&&(d=r.map.offset,r=r.map.repeat,a.offsetRepeat.value.set(d.x,d.y,r.x,r.y))):r instanceof m.MeshLambertMaterial?(r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap)):r instanceof m.MeshPhongMaterial?(a.specular.value=r.specular,a.shininess.value=Math.max(r.shininess,1e-4),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias)):r instanceof m.MeshStandardMaterial?(a.roughness.value=r.roughness,a.metalness.value=r.metalness,r.roughnessMap&&(a.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(a.metalnessMap.value=r.metalnessMap),r.lightMap&&(a.lightMap.value=r.lightMap,a.lightMapIntensity.value=r.lightMapIntensity),r.emissiveMap&&(a.emissiveMap.value=r.emissiveMap),r.bumpMap&&(a.bumpMap.value=r.bumpMap,a.bumpScale.value=r.bumpScale),r.normalMap&&(a.normalMap.value=r.normalMap,a.normalScale.value.copy(r.normalScale)),r.displacementMap&&(a.displacementMap.value=r.displacementMap,a.displacementScale.value=r.displacementScale,a.displacementBias.value=r.displacementBias),r.envMap&&(a.envMapIntensity.value=r.envMapIntensity)):r instanceof m.MeshDepthMaterial?(a.mNear.value=t.near,a.mFar.value=t.far,a.opacity.value=r.opacity):r instanceof m.MeshNormalMaterial&&(a.opacity.value=r.opacity),x(n.uniformsList)}if(gt.uniformMatrix4fv(p.modelViewMatrix,!1,i.modelViewMatrix.elements),p.normalMatrix&&gt.uniformMatrix3fv(p.normalMatrix,!1,i.normalMatrix.elements),void 0!==p.modelMatrix&&gt.uniformMatrix4fv(p.modelMatrix,!1,i.matrixWorld.elements),!0===n.hasDynamicUniforms){for(r=[],d=0,e=(n=n.uniformsList).length;d<e;d++)p=n[d][0],void 0!==(a=p.onUpdateCallback)&&(a.bind(p)(i,t),r.push(n[d]));x(r)}return o}function y(){var t=et;return t>=yt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+yt.maxTextures),et+=1,t}function x(t){for(var e,r,i=0,n=t.length;i<n;i++){var o=t[i][0];if(!1!==o.needsUpdate){var a=o.type;e=o.value;var s=t[i][1];switch(a){case"1i":gt.uniform1i(s,e);break;case"1f":gt.uniform1f(s,e);break;case"2f":gt.uniform2f(s,e[0],e[1]);break;case"3f":gt.uniform3f(s,e[0],e[1],e[2]);break;case"4f":gt.uniform4f(s,e[0],e[1],e[2],e[3]);break;case"1iv":gt.uniform1iv(s,e);break;case"3iv":gt.uniform3iv(s,e);break;case"1fv":gt.uniform1fv(s,e);break;case"2fv":gt.uniform2fv(s,e);break;case"3fv":gt.uniform3fv(s,e);break;case"4fv":gt.uniform4fv(s,e);break;case"Matrix2fv":gt.uniformMatrix2fv(s,!1,e);break;case"Matrix3fv":gt.uniformMatrix3fv(s,!1,e);break;case"Matrix4fv":gt.uniformMatrix4fv(s,!1,e);break;case"i":gt.uniform1i(s,e);break;case"f":gt.uniform1f(s,e);break;case"v2":gt.uniform2f(s,e.x,e.y);break;case"v3":gt.uniform3f(s,e.x,e.y,e.z);break;case"v4":gt.uniform4f(s,e.x,e.y,e.z,e.w);break;case"c":gt.uniform3f(s,e.r,e.g,e.b);break;case"sa":for(a=0;a<e.length;a++)for(var h in o.properties){var c=s[a][h];switch(r=e[a][h],o.properties[h].type){case"i":gt.uniform1i(c,r);break;case"f":gt.uniform1f(c,r);break;case"v2":gt.uniform2f(c,r.x,r.y);break;case"v3":gt.uniform3f(c,r.x,r.y,r.z);break;case"v4":gt.uniform4f(c,r.x,r.y,r.z,r.w);break;case"c":gt.uniform3f(c,r.r,r.g,r.b);break;case"m4":gt.uniformMatrix4fv(c,!1,r.elements)}}break;case"iv1":gt.uniform1iv(s,e);break;case"iv":gt.uniform3iv(s,e);break;case"fv1":gt.uniform1fv(s,e);break;case"fv":gt.uniform3fv(s,e);break;case"v2v":for(void 0===o._array&&(o._array=new Float32Array(2*e.length)),r=a=0,c=e.length;a<c;a++,r+=2)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y;gt.uniform2fv(s,o._array);break;case"v3v":for(void 0===o._array&&(o._array=new Float32Array(3*e.length)),r=a=0,c=e.length;a<c;a++,r+=3)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z;gt.uniform3fv(s,o._array);break;case"v4v":for(void 0===o._array&&(o._array=new Float32Array(4*e.length)),r=a=0,c=e.length;a<c;a++,r+=4)o._array[r+0]=e[a].x,o._array[r+1]=e[a].y,o._array[r+2]=e[a].z,o._array[r+3]=e[a].w;gt.uniform4fv(s,o._array);break;case"m2":gt.uniformMatrix2fv(s,!1,e.elements);break;case"m3":gt.uniformMatrix3fv(s,!1,e.elements);break;case"m3v":for(void 0===o._array&&(o._array=new Float32Array(9*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,9*a);gt.uniformMatrix3fv(s,!1,o._array);break;case"m4":gt.uniformMatrix4fv(s,!1,e.elements);break;case"m4v":for(void 0===o._array&&(o._array=new Float32Array(16*e.length)),a=0,c=e.length;a<c;a++)e[a].flattenToArrayOffset(o._array,16*a);gt.uniformMatrix4fv(s,!1,o._array);break;case"t":if(r=y(),gt.uniform1i(s,r),!e)continue;e instanceof m.CubeTexture||Array.isArray(e.image)&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):W.setTexture(e,r);break;case"tv":for(void 0===o._array&&(o._array=[]),a=0,c=o.value.length;a<c;a++)o._array[a]=y();for(gt.uniform1iv(s,o._array),a=0,c=o.value.length;a<c;a++)e=o.value[a],r=o._array[a],e&&(e instanceof m.CubeTexture||e.image instanceof Array&&6===e.image.length?w(e,r):e instanceof m.WebGLRenderTarget?W.setTexture(e.texture,r):e instanceof m.WebGLRenderTargetCube?S(e.texture,r):W.setTexture(e,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function b(t,e,r){r?(gt.texParameteri(t,gt.TEXTURE_WRAP_S,L(e.wrapS)),gt.texParameteri(t,gt.TEXTURE_WRAP_T,L(e.wrapT)),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,L(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,L(e.minFilter))):(gt.texParameteri(t,gt.TEXTURE_WRAP_S,gt.CLAMP_TO_EDGE),gt.texParameteri(t,gt.TEXTURE_WRAP_T,gt.CLAMP_TO_EDGE),e.wrapS===m.ClampToEdgeWrapping&&e.wrapT===m.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),gt.texParameteri(t,gt.TEXTURE_MAG_FILTER,C(e.magFilter)),gt.texParameteri(t,gt.TEXTURE_MIN_FILTER,C(e.minFilter)),e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),!(r=vt.get("EXT_texture_filter_anisotropic"))||e.type===m.FloatType&&null===vt.get("OES_texture_float_linear")||e.type===m.HalfFloatType&&null===vt.get("OES_texture_half_float_linear")||!(1<e.anisotropy||bt.get(e).__currentAnisotropy)||(gt.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,W.getMaxAnisotropy())),bt.get(e).__currentAnisotropy=e.anisotropy)}function _(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),i=document.createElement("canvas");return i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function M(t){return m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height)}function w(t,e){var r=bt.get(t);if(6===t.image.length)if(0<t.version&&r.__version!==t.version){r.__image__webglTextureCube||(t.addEventListener("dispose",o),r.__image__webglTextureCube=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var i=t instanceof m.CompressedTexture,n=t.image[0]instanceof m.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?t.image[s].image:t.image[s]:_(t.image[s],yt.maxCubemapSize);var h=M(a[0]),c=L(t.format),l=L(t.type);for(b(gt.TEXTURE_CUBE_MAP,t,h),s=0;6>s;s++)if(i)for(var u,p=a[s].mipmaps,d=0,f=p.length;d<f;d++)u=p[d],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(c)?xt.compressedTexImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,c,l,u.data);else n?xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,a[s].width,a[s].height,0,c,l,a[s].data):xt.texImage2D(gt.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,c,l,a[s]);t.generateMipmaps&&h&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function S(t,e){xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_CUBE_MAP,bt.get(t).__webglTexture)}function E(t,e,r,i){var n=L(e.texture.format),o=L(e.texture.type);xt.texImage2D(i,0,n,e.width,e.height,0,n,o,null),gt.bindFramebuffer(gt.FRAMEBUFFER,t),gt.framebufferTexture2D(gt.FRAMEBUFFER,r,i,bt.get(e.texture).__webglTexture,0),gt.bindFramebuffer(gt.FRAMEBUFFER,null)}function T(t,e){gt.bindRenderbuffer(gt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_COMPONENT16,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_ATTACHMENT,gt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(gt.renderbufferStorage(gt.RENDERBUFFER,gt.DEPTH_STENCIL,e.width,e.height),gt.framebufferRenderbuffer(gt.FRAMEBUFFER,gt.DEPTH_STENCIL_ATTACHMENT,gt.RENDERBUFFER,t)):gt.renderbufferStorage(gt.RENDERBUFFER,gt.RGBA4,e.width,e.height),gt.bindRenderbuffer(gt.RENDERBUFFER,null)}function C(t){return t===m.NearestFilter||t===m.NearestMipMapNearestFilter||t===m.NearestMipMapLinearFilter?gt.NEAREST:gt.LINEAR}function L(t){var e;if(t===m.RepeatWrapping)return gt.REPEAT;if(t===m.ClampToEdgeWrapping)return gt.CLAMP_TO_EDGE;if(t===m.MirroredRepeatWrapping)return gt.MIRRORED_REPEAT;if(t===m.NearestFilter)return gt.NEAREST;if(t===m.NearestMipMapNearestFilter)return gt.NEAREST_MIPMAP_NEAREST;if(t===m.NearestMipMapLinearFilter)return gt.NEAREST_MIPMAP_LINEAR;if(t===m.LinearFilter)return gt.LINEAR;if(t===m.LinearMipMapNearestFilter)return gt.LINEAR_MIPMAP_NEAREST;if(t===m.LinearMipMapLinearFilter)return gt.LINEAR_MIPMAP_LINEAR;if(t===m.UnsignedByteType)return gt.UNSIGNED_BYTE;if(t===m.UnsignedShort4444Type)return gt.UNSIGNED_SHORT_4_4_4_4;if(t===m.UnsignedShort5551Type)return gt.UNSIGNED_SHORT_5_5_5_1;if(t===m.UnsignedShort565Type)return gt.UNSIGNED_SHORT_5_6_5;if(t===m.ByteType)return gt.BYTE;if(t===m.ShortType)return gt.SHORT;if(t===m.UnsignedShortType)return gt.UNSIGNED_SHORT;if(t===m.IntType)return gt.INT;if(t===m.UnsignedIntType)return gt.UNSIGNED_INT;if(t===m.FloatType)return gt.FLOAT;if(null!==(e=vt.get("OES_texture_half_float"))&&t===m.HalfFloatType)return e.HALF_FLOAT_OES;if(t===m.AlphaFormat)return gt.ALPHA;if(t===m.RGBFormat)return gt.RGB;if(t===m.RGBAFormat)return gt.RGBA;if(t===m.LuminanceFormat)return gt.LUMINANCE;if(t===m.LuminanceAlphaFormat)return gt.LUMINANCE_ALPHA;if(t===m.AddEquation)return gt.FUNC_ADD;if(t===m.SubtractEquation)return gt.FUNC_SUBTRACT;if(t===m.ReverseSubtractEquation)return gt.FUNC_REVERSE_SUBTRACT;if(t===m.ZeroFactor)return gt.ZERO;if(t===m.OneFactor)return gt.ONE;if(t===m.SrcColorFactor)return gt.SRC_COLOR;if(t===m.OneMinusSrcColorFactor)return gt.ONE_MINUS_SRC_COLOR;if(t===m.SrcAlphaFactor)return gt.SRC_ALPHA;if(t===m.OneMinusSrcAlphaFactor)return gt.ONE_MINUS_SRC_ALPHA;if(t===m.DstAlphaFactor)return gt.DST_ALPHA;if(t===m.OneMinusDstAlphaFactor)return gt.ONE_MINUS_DST_ALPHA;if(t===m.DstColorFactor)return gt.DST_COLOR;if(t===m.OneMinusDstColorFactor)return gt.ONE_MINUS_DST_COLOR;if(t===m.SrcAlphaSaturateFactor)return gt.SRC_ALPHA_SATURATE;if(null!==(e=vt.get("WEBGL_compressed_texture_s3tc"))){if(t===m.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===m.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===m.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=vt.get("WEBGL_compressed_texture_pvrtc"))){if(t===m.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===m.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===m.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===m.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=vt.get("WEBGL_compressed_texture_etc1"))&&t===m.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(null!==(e=vt.get("EXT_blend_minmax"))){if(t===m.MinEquation)return e.MIN_EXT;if(t===m.MaxEquation)return e.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",m.REVISION);var A=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),P=void 0!==t.context?t.context:null,R=void 0!==t.alpha&&t.alpha,U=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,D=void 0!==t.antialias&&t.antialias,I=void 0===t.premultipliedAlpha||t.premultipliedAlpha,F=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,B=[],V=[],N=-1,O=[],G=-1,z=new Float32Array(8),H=[],j=[];this.domElement=A,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.gammaFactor=2,this.gammaOutput=this.gammaInput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var W=this,X=null,q=null,Y=null,Z=-1,Q="",K=null,J=new m.Vector4,$=null,tt=new m.Vector4,et=0,rt=new m.Color(0),it=0,nt=A.width,ot=A.height,at=1,st=new m.Vector4(0,0,nt,ot),ht=!1,ct=new m.Vector4(0,0,nt,ot),lt=new m.Frustum,ut=new m.Matrix4,pt=new m.Vector3,dt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},ft={geometries:0,textures:0},mt={calls:0,vertices:0,faces:0,points:0};this.info={render:mt,memory:ft,programs:null};var gt;try{if(R={alpha:R,depth:U,stencil:k,antialias:D,premultipliedAlpha:I,preserveDrawingBuffer:F},null===(gt=P||A.getContext("webgl",R)||A.getContext("experimental-webgl",R))){if(null!==A.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}A.addEventListener("webglcontextlost",n,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var vt=new m.WebGLExtensions(gt);vt.get("OES_texture_float"),vt.get("OES_texture_float_linear"),vt.get("OES_texture_half_float"),vt.get("OES_texture_half_float_linear"),vt.get("OES_standard_derivatives"),vt.get("ANGLE_instanced_arrays"),vt.get("OES_element_index_uint")&&(m.BufferGeometry.MaxIndex=4294967296);var yt=new m.WebGLCapabilities(gt,vt,t),xt=new m.WebGLState(gt,vt,L),bt=new m.WebGLProperties,_t=new m.WebGLObjects(gt,bt,this.info),Mt=new m.WebGLPrograms(this,yt),wt=new m.WebGLLights;this.info.programs=Mt.programs;var St=new m.WebGLBufferRenderer(gt,vt,mt),Et=new m.WebGLIndexedBufferRenderer(gt,vt,mt);r(),this.context=gt,this.capabilities=yt,this.extensions=vt,this.properties=bt,this.state=xt;var Tt=new m.WebGLShadowMap(this,dt,_t);this.shadowMap=Tt;var Ct=new m.SpritePlugin(this,H),Lt=new m.LensFlarePlugin(this,j);this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){vt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var t;return function(){if(void 0!==t)return t;var e=vt.get("EXT_texture_filter_anisotropic");return t=null!==e?gt.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return yt.precision},this.getPixelRatio=function(){return at},this.setPixelRatio=function(t){void 0!==t&&(at=t,this.setSize(ct.z,ct.w,!1))},this.getSize=function(){return{width:nt,height:ot}},this.setSize=function(t,e,r){nt=t,ot=e,A.width=t*at,A.height=e*at,!1!==r&&(A.style.width=t+"px",A.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){xt.viewport(ct.set(t,e,r,i))},this.setScissor=function(t,e,r,i){xt.scissor(st.set(t,e,r,i))},this.setScissorTest=function(t){xt.setScissorTest(ht=t)},this.getClearColor=function(){return rt},this.setClearColor=function(t,r){rt.set(t),it=void 0!==r?r:1,e(rt.r,rt.g,rt.b,it)},this.getClearAlpha=function(){return it},this.setClearAlpha=function(t){it=t,e(rt.r,rt.g,rt.b,it)},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=gt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=gt.STENCIL_BUFFER_BIT),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=i,this.dispose=function(){A.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(t,e,r){xt.initAttributes();var i=bt.get(t);if(t.hasPositions&&!i.position&&(i.position=gt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=gt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=gt.createBuffer()),t.hasColors&&!i.color&&(i.color=gt.createBuffer()),e=e.getAttributes(),t.hasPositions&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.position),gt.bufferData(gt.ARRAY_BUFFER,t.positionArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.position),gt.vertexAttribPointer(e.position,3,gt.FLOAT,!1,0,0)),t.hasNormals){if(gt.bindBuffer(gt.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===m.FlatShading)for(var n=0,o=3*t.count;n<o;n+=9){var a=t.normalArray,s=(a[n+0]+a[n+3]+a[n+6])/3,h=(a[n+1]+a[n+4]+a[n+7])/3,c=(a[n+2]+a[n+5]+a[n+8])/3;a[n+0]=s,a[n+1]=h,a[n+2]=c,a[n+3]=s,a[n+4]=h,a[n+5]=c,a[n+6]=s,a[n+7]=h,a[n+8]=c}gt.bufferData(gt.ARRAY_BUFFER,t.normalArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.normal),gt.vertexAttribPointer(e.normal,3,gt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.uv),gt.bufferData(gt.ARRAY_BUFFER,t.uvArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.uv),gt.vertexAttribPointer(e.uv,2,gt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==m.NoColors&&(gt.bindBuffer(gt.ARRAY_BUFFER,i.color),gt.bufferData(gt.ARRAY_BUFFER,t.colorArray,gt.DYNAMIC_DRAW),xt.enableAttribute(e.color),gt.vertexAttribPointer(e.color,3,gt.FLOAT,!1,0,0)),xt.disableUnusedAttributes(),gt.drawArrays(gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,o){g(i);var a=v(t,e,i,n),s=!1;if((t=r.id+"_"+a.id+"_"+i.wireframe)!==Q&&(Q=t,s=!0),void 0!==(e=n.morphTargetInfluences)){t=[];for(var h=0,s=e.length;h<s;h++)d=e[h],t.push([d,h]);t.sort(c),8<t.length&&(t.length=8);for(var l=r.morphAttributes,h=0,s=t.length;h<s;h++)d=t[h],z[h]=d[0],0!==d[0]?(e=d[1],!0===i.morphTargets&&l.position&&r.addAttribute("morphTarget"+h,l.position[e]),!0===i.morphNormals&&l.normal&&r.addAttribute("morphNormal"+h,l.normal[e])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+h),!0===i.morphNormals&&r.removeAttribute("morphNormal"+h));null!==(t=a.getUniforms()).morphTargetInfluences&&gt.uniform1fv(t.morphTargetInfluences,z),s=!0}if(e=r.index,h=r.attributes.position,!0===i.wireframe&&(e=_t.getWireframeAttribute(r)),null!==e?(t=Et).setIndex(e):t=St,s){var u,s=void 0;if(r instanceof m.InstancedBufferGeometry&&null===(u=vt.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===s&&(s=0),xt.initAttributes();var p,d=r.attributes,a=a.getAttributes(),l=i.defaultAttributeValues;for(p in a){var f=a[p];if(0<=f)if(void 0!==(M=d[p])){var y=M.itemSize,x=_t.getAttributeBuffer(M);if(M instanceof m.InterleavedBufferAttribute){var b=M.data,_=b.stride,M=M.offset;b instanceof m.InstancedInterleavedBuffer?(xt.enableAttributeAndDivisor(f,b.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=b.meshPerAttribute*b.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,_*b.array.BYTES_PER_ELEMENT,(s*_+M)*b.array.BYTES_PER_ELEMENT)}else M instanceof m.InstancedBufferAttribute?(xt.enableAttributeAndDivisor(f,M.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=M.meshPerAttribute*M.count)):xt.enableAttribute(f),gt.bindBuffer(gt.ARRAY_BUFFER,x),gt.vertexAttribPointer(f,y,gt.FLOAT,!1,0,s*y*4)}else if(void 0!==l&&void 0!==(y=l[p]))switch(y.length){case 2:gt.vertexAttrib2fv(f,y);break;case 3:gt.vertexAttrib3fv(f,y);break;case 4:gt.vertexAttrib4fv(f,y);break;default:gt.vertexAttrib1fv(f,y)}}xt.disableUnusedAttributes()}null!==e&&gt.bindBuffer(gt.ELEMENT_ARRAY_BUFFER,_t.getAttributeBuffer(e))}if(u=1/0,null!==e?u=e.count:void 0!==h&&(u=h.count),p=r.drawRange.start,e=r.drawRange.count,h=null!==o?o.start:0,s=null!==o?o.count:1/0,o=Math.max(0,p,h),u=Math.min(0+u,p+e,h+s)-1,u=Math.max(0,u-o+1),n instanceof m.Mesh)if(!0===i.wireframe)xt.setLineWidth(i.wireframeLinewidth*(null===q?at:1)),t.setMode(gt.LINES);else switch(n.drawMode){case m.TrianglesDrawMode:t.setMode(gt.TRIANGLES);break;case m.TriangleStripDrawMode:t.setMode(gt.TRIANGLE_STRIP);break;case m.TriangleFanDrawMode:t.setMode(gt.TRIANGLE_FAN)}else n instanceof m.Line?(void 0===(i=i.linewidth)&&(i=1),xt.setLineWidth(i*(null===q?at:1)),n instanceof m.LineSegments?t.setMode(gt.LINES):t.setMode(gt.LINE_STRIP)):n instanceof m.Points&&t.setMode(gt.POINTS);r instanceof m.InstancedBufferGeometry&&0<r.maxInstancedCount?t.renderInstances(r,o,u):t.render(o,u)},this.render=function(t,e,r,i){if(0==e instanceof m.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=t.fog;Q="",Z=-1,K=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),ut.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),lt.setFromMatrix(ut),B.length=0,G=N=-1,H.length=0,j.length=0,d(t,e),V.length=N+1,O.length=G+1,!0===W.sortObjects&&(V.sort(l),O.sort(u));var o,a,s,h,c,p,g=B,v=0,y=0,x=0,b=e.matrixWorldInverse,_=0,w=0,S=0,E=0,T=0;for(o=dt.shadowsPointLight=0,a=g.length;o<a;o++)if(s=g[o],h=s.color,c=s.intensity,p=s.distance,s instanceof m.AmbientLight)v+=h.r*c,y+=h.g*c,x+=h.b*c;else if(s instanceof m.DirectionalLight){var C=wt.get(s);C.color.copy(s.color).multiplyScalar(s.intensity),C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.directionalShadowMap[_]=s.shadow.map,dt.directionalShadowMatrix[_]=s.shadow.matrix,dt.directional[_++]=C}else s instanceof m.SpotLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(h).multiplyScalar(c),C.distance=p,C.direction.setFromMatrixPosition(s.matrixWorld),pt.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pt),C.direction.transformDirection(b),C.angleCos=Math.cos(s.angle),C.exponent=s.exponent,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.spotShadowMap[S]=s.shadow.map,dt.spotShadowMatrix[S]=s.shadow.matrix,dt.spot[S++]=C):s instanceof m.PointLight?((C=wt.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(s.color).multiplyScalar(s.intensity),C.distance=s.distance,C.decay=0===s.distance?0:s.decay,(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,dt.shadows[T++]=s),dt.pointShadowMap[w]=s.shadow.map,void 0===dt.pointShadowMatrix[w]&&(dt.pointShadowMatrix[w]=new m.Matrix4),pt.setFromMatrixPosition(s.matrixWorld).negate(),dt.pointShadowMatrix[w].identity().setPosition(pt),dt.point[w++]=C):s instanceof m.HemisphereLight&&((C=wt.get(s)).direction.setFromMatrixPosition(s.matrixWorld),C.direction.transformDirection(b),C.direction.normalize(),C.skyColor.copy(s.color).multiplyScalar(c),C.groundColor.copy(s.groundColor).multiplyScalar(c),dt.hemi[E++]=C);dt.ambient[0]=v,dt.ambient[1]=y,dt.ambient[2]=x,dt.directional.length=_,dt.spot.length=S,dt.point.length=w,dt.hemi.length=E,dt.shadows.length=T,dt.hash=_+","+w+","+S+","+E+","+T,Tt.render(t,e),mt.calls=0,mt.vertices=0,mt.faces=0,mt.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),t.overrideMaterial?(i=t.overrideMaterial,f(V,e,n,i),f(O,e,n,i)):(xt.setBlending(m.NoBlending),f(V,e,n),f(O,e,n)),Ct.render(t,e),Lt.render(t,e,tt),r&&(t=r.texture).generateMipmaps&&M(r)&&t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter&&(t=r instanceof m.WebGLRenderTargetCube?gt.TEXTURE_CUBE_MAP:gt.TEXTURE_2D,r=bt.get(r.texture).__webglTexture,xt.bindTexture(t,r),gt.generateMipmap(t),xt.bindTexture(t,null)),xt.setDepthTest(!0),xt.setDepthWrite(!0),xt.setColorWrite(!0)}},this.setFaceCulling=function(t,e){t===m.CullFaceNone?xt.disable(gt.CULL_FACE):(e===m.FrontFaceDirectionCW?gt.frontFace(gt.CW):gt.frontFace(gt.CCW),t===m.CullFaceBack?gt.cullFace(gt.BACK):t===m.CullFaceFront?gt.cullFace(gt.FRONT):gt.cullFace(gt.FRONT_AND_BACK),xt.enable(gt.CULL_FACE))},this.setTexture=function(t,e){var r=bt.get(t);if(0<t.version&&r.__version!==t.version)if(void 0===(n=t.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t);else{void 0===r.__webglInit&&(r.__webglInit=!0,t.addEventListener("dispose",o),r.__webglTexture=gt.createTexture(),ft.textures++),xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,t.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,t.unpackAlignment);var i=_(t.image,yt.maxTextureSize);(t.wrapS!==m.ClampToEdgeWrapping||t.wrapT!==m.ClampToEdgeWrapping||t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter)&&!1===M(i)&&((n=i)instanceof HTMLImageElement||n instanceof HTMLCanvasElement?((a=document.createElement("canvas")).width=m.Math.nearestPowerOfTwo(n.width),a.height=m.Math.nearestPowerOfTwo(n.height),a.getContext("2d").drawImage(n,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+n.width+"x"+n.height+"). Resized to "+a.width+"x"+a.height,n),i=a):i=n);var n=M(i),a=L(t.format),s=L(t.type);b(gt.TEXTURE_2D,t,n);var h=t.mipmaps;if(t instanceof m.DataTexture)if(0<h.length&&n){for(var c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(t instanceof m.CompressedTexture)for(c=0,l=h.length;c<l;c++)i=h[c],t.format!==m.RGBAFormat&&t.format!==m.RGBFormat?-1<xt.getCompressedTextureFormats().indexOf(a)?xt.compressedTexImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):xt.texImage2D(gt.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);else if(0<h.length&&n){for(c=0,l=h.length;c<l;c++)i=h[c],xt.texImage2D(gt.TEXTURE_2D,c,a,a,s,i);t.generateMipmaps=!1}else xt.texImage2D(gt.TEXTURE_2D,0,a,a,s,i);t.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),r.__version=t.version,t.onUpdate&&t.onUpdate(t)}else xt.activeTexture(gt.TEXTURE0+e),xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(t){if((q=t)&&void 0===bt.get(t).__webglFramebuffer){var e=bt.get(t),r=bt.get(t.texture);t.addEventListener("dispose",a),r.__webglTexture=gt.createTexture(),ft.textures++;var i=t instanceof m.WebGLRenderTargetCube,n=m.Math.isPowerOfTwo(t.width)&&m.Math.isPowerOfTwo(t.height);if(i){e.__webglFramebuffer=[];for(var o=0;6>o;o++)e.__webglFramebuffer[o]=gt.createFramebuffer()}else e.__webglFramebuffer=gt.createFramebuffer();if(i){for(xt.bindTexture(gt.TEXTURE_CUBE_MAP,r.__webglTexture),b(gt.TEXTURE_CUBE_MAP,t.texture,n),o=0;6>o;o++)E(e.__webglFramebuffer[o],t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+o);t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_CUBE_MAP),xt.bindTexture(gt.TEXTURE_CUBE_MAP,null)}else xt.bindTexture(gt.TEXTURE_2D,r.__webglTexture),b(gt.TEXTURE_2D,t.texture,n),E(e.__webglFramebuffer,t,gt.COLOR_ATTACHMENT0,gt.TEXTURE_2D),t.texture.generateMipmaps&&n&&gt.generateMipmap(gt.TEXTURE_2D),xt.bindTexture(gt.TEXTURE_2D,null);if(t.depthBuffer){if(e=bt.get(t),t instanceof m.WebGLRenderTargetCube)for(e.__webglDepthbuffer=[],r=0;6>r;r++)gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer[r]),e.__webglDepthbuffer[r]=gt.createRenderbuffer(),T(e.__webglDepthbuffer[r],t);else gt.bindFramebuffer(gt.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=gt.createRenderbuffer(),T(e.__webglDepthbuffer,t);gt.bindFramebuffer(gt.FRAMEBUFFER,null)}}e=t instanceof m.WebGLRenderTargetCube,t?(r=bt.get(t),r=e?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,J.copy(t.scissor),$=t.scissorTest,tt.copy(t.viewport)):(r=null,J.copy(st).multiplyScalar(at),$=ht,tt.copy(ct).multiplyScalar(at)),Y!==r&&(gt.bindFramebuffer(gt.FRAMEBUFFER,r),Y=r),xt.scissor(J),xt.setScissorTest($),xt.viewport(tt),e&&(e=bt.get(t.texture),gt.framebufferTexture2D(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,e.__webglTexture,0))},this.readRenderTargetPixels=function(t,e,r,i,n,o){if(0==t instanceof m.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=bt.get(t).__webglFramebuffer;if(a){var s=!1;a!==Y&&(gt.bindFramebuffer(gt.FRAMEBUFFER,a),s=!0);try{var h=t.texture;h.format!==m.RGBAFormat&&L(h.format)!==gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===m.UnsignedByteType||L(h.type)===gt.getParameter(gt.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===m.FloatType&&vt.get("WEBGL_color_buffer_float")||h.type===m.HalfFloatType&&vt.get("EXT_color_buffer_half_float")?gt.checkFramebufferStatus(gt.FRAMEBUFFER)===gt.FRAMEBUFFER_COMPLETE?gt.readPixels(e,r,i,n,L(h.format),L(h.type),o):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{s&&gt.bindFramebuffer(gt.FRAMEBUFFER,Y)}}}}},m.WebGLRenderTarget=function(t,e,r){this.uuid=m.Math.generateUUID(),this.width=t,this.height=e,this.scissor=new m.Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new m.Vector4(0,0,t,e),void 0===(r=r||{}).minFilter&&(r.minFilter=m.LinearFilter),this.texture=new m.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer},m.WebGLRenderTarget.prototype={constructor:m.WebGLRenderTarget,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.shareDepthFrom=t.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube=function(t,e,r){m.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},m.WebGLRenderTargetCube.prototype=Object.create(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube.prototype.constructor=m.WebGLRenderTargetCube,m.WebGLBufferRenderer=function(t,e,r){var i;this.setMode=function(t){i=t},this.render=function(e,n){t.drawArrays(i,e,n),r.calls++,r.vertices+=n,i===t.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=e.get("ANGLE_instanced_arrays");if(null===o)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var a=n.attributes.position,s=0,s=a instanceof m.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},m.WebGLIndexedBufferRenderer=function(t,e,r){var i,n,o;this.setMode=function(t){i=t},this.setIndex=function(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(n=t.UNSIGNED_INT,o=4):(n=t.UNSIGNED_SHORT,o=2)},this.render=function(e,a){t.drawElements(i,a,n,e*o),r.calls++,r.vertices+=a,i===t.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,h){var c=e.get("ANGLE_instanced_arrays");null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(c.drawElementsInstancedANGLE(i,h,n,s*o,a.maxInstancedCount),r.calls++,r.vertices+=h*a.maxInstancedCount,i===t.TRIANGLES&&(r.faces+=a.maxInstancedCount*h/3))}},m.WebGLExtensions=function(t){var e={};this.get=function(r){if(void 0!==e[r])return e[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=i}},m.WebGLCapabilities=function(t,e,r){function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer&&r.logarithmicDepthBuffer,this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxCubemapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=t.getParameter(t.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=t.getParameter(t.MAX_VARYING_VECTORS),this.maxFragmentUniforms=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!e.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures,(r=i(this.precision))!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",r,"instead."),this.precision=r),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!e.get("EXT_frag_depth"))},m.WebGLGeometries=function(t,e,r){function i(t){var a=t.target;null!==(t=o[a.id]).index&&n(t.index);var s,h=t.attributes;for(s in h)n(h[s]);a.removeEventListener("dispose",i),delete o[a.id],(s=e.get(a)).wireframe&&n(s.wireframe),e.delete(a),(a=e.get(t)).wireframe&&n(a.wireframe),e.delete(t),r.memory.geometries--}function n(r){var i;void 0!==(i=r instanceof m.InterleavedBufferAttribute?e.get(r.data).__webglBuffer:e.get(r).__webglBuffer)&&(t.deleteBuffer(i),r instanceof m.InterleavedBufferAttribute?e.delete(r.data):e.delete(r))}var o={};this.get=function(t){var e=t.geometry;if(void 0!==o[e.id])return o[e.id];e.addEventListener("dispose",i);var n;return e instanceof m.BufferGeometry?n=e:e instanceof m.Geometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new m.BufferGeometry).setFromObject(t)),n=e._bufferGeometry),o[e.id]=n,r.memory.geometries++,n}},m.WebGLLights=function(){var t={};this.get=function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new m.Vector3,color:new m.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"SpotLight":r={position:new m.Vector3,direction:new m.Vector3,color:new m.Color,distance:0,angleCos:0,exponent:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"PointLight":r={position:new m.Vector3,color:new m.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new m.Vector2};break;case"HemisphereLight":r={direction:new m.Vector3,skyColor:new m.Color,groundColor:new m.Color}}return t[e.id]=r}},m.WebGLObjects=function(t,e,r){function i(r,i){var n=r instanceof m.InterleavedBufferAttribute?r.data:r,o=e.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=t.createBuffer(),t.bindBuffer(i,o.__webglBuffer),t.bufferData(i,n.array,n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(t.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?t.bufferSubData(i,0,n.array):0===n.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),o.version=n.version)}function n(t,e,r){if(e>r){var i=e;e=r,r=i}return i=t[e],void 0===i?(t[e]=[r],!0):-1===i.indexOf(r)&&(i.push(r),!0)}var o=new m.WebGLGeometries(t,e,r);this.getAttributeBuffer=function(t){return t instanceof m.InterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer},this.getWireframeAttribute=function(r){var o=e.get(r);if(void 0!==o.wireframe)return o.wireframe;var a=[],s=r.index;if(r=(h=r.attributes).position,null!==s)for(var h={},s=s.array,c=0,l=s.length;c<l;c+=3){var u=s[c+0],p=s[c+1],d=s[c+2];n(h,u,p)&&a.push(u,p),n(h,p,d)&&a.push(p,d),n(h,d,u)&&a.push(d,u)}else for(s=h.position.array,c=0,l=s.length/3-1;c<l;c+=3)u=c+0,p=c+1,d=c+2,a.push(u,p,p,d,d,u);return a=new m.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),i(a,t.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(e){var r=o.get(e);e.geometry instanceof m.Geometry&&r.updateFromObject(e),e=r.index,a=r.attributes,null!==e&&i(e,t.ELEMENT_ARRAY_BUFFER);for(var n in a)i(a[n],t.ARRAY_BUFFER);e=r.morphAttributes;for(n in e)for(var a=e[n],s=0,h=a.length;s<h;s++)i(a[s],t.ARRAY_BUFFER);return r}},m.WebGLProgram=function(){function t(t,e,i){return t=t||{},[t.derivatives||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(r).join("\n")}function e(t){var e,r=[];for(e in t){var i=t[e];!1!==i&&r.push("#define "+e+" "+i)}return r.join("\n")}function r(t){return""!==t}function i(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function n(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,r,i){for(t="",e=parseInt(e);e<parseInt(r);e++)t+=i.replace(/\[ i \]/g,"[ "+e+" ]");return t})}var o=0,a=/^([\w\d_]+)\.([\w\d_]+)$/,s=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,h=/^([\w\d_]+)\[0\]$/;return function(c,l,u,p){var d=c.context,f=u.extensions,g=u.defines,v=u.__webglShader.vertexShader,y=u.__webglShader.fragmentShader,x="SHADOWMAP_TYPE_BASIC";p.shadowMapType===m.PCFShadowMap?x="SHADOWMAP_TYPE_PCF":p.shadowMapType===m.PCFSoftShadowMap&&(x="SHADOWMAP_TYPE_PCF_SOFT");var b="ENVMAP_TYPE_CUBE",_="ENVMAP_MODE_REFLECTION",M="ENVMAP_BLENDING_MULTIPLY";if(p.envMap){switch(u.envMap.mapping){case m.CubeReflectionMapping:case m.CubeRefractionMapping:b="ENVMAP_TYPE_CUBE";break;case m.EquirectangularReflectionMapping:case m.EquirectangularRefractionMapping:b="ENVMAP_TYPE_EQUIREC";break;case m.SphericalReflectionMapping:b="ENVMAP_TYPE_SPHERE"}switch(u.envMap.mapping){case m.CubeRefractionMapping:case m.EquirectangularRefractionMapping:_="ENVMAP_MODE_REFRACTION"}switch(u.combine){case m.MultiplyOperation:M="ENVMAP_BLENDING_MULTIPLY";break;case m.MixOperation:M="ENVMAP_BLENDING_MIX";break;case m.AddOperation:M="ENVMAP_BLENDING_ADD"}}var w=0<c.gammaFactor?c.gammaFactor:1,f=t(f,p,c.extensions),S=e(g),E=d.createProgram();u instanceof m.RawShaderMaterial?c=g="":(g=["precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+p.maxBones,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+_:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.displacementMap&&p.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.skinning?"#define USE_SKINNING":"",p.useVertexTexture?"#define BONE_TEXTURE":"",p.morphTargets?"#define USE_MORPHTARGETS":"",p.morphNormals&&!1===p.flatShading?"#define USE_MORPHNORMALS":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.sizeAttenuation?"#define USE_SIZEATTENUATION":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(r).join("\n"),c=[f,"precision "+p.precision+" float;","precision "+p.precision+" int;","#define SHADER_NAME "+u.__webglShader.name,S,p.alphaTest?"#define ALPHATEST "+p.alphaTest:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+w,p.useFog&&p.fog?"#define USE_FOG":"",p.useFog&&p.fogExp?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.envMap?"#define "+b:"",p.envMap?"#define "+_:"",p.envMap?"#define "+M:"",p.lightMap?"#define USE_LIGHTMAP":"",p.aoMap?"#define USE_AOMAP":"",p.emissiveMap?"#define USE_EMISSIVEMAP":"",p.bumpMap?"#define USE_BUMPMAP":"",p.normalMap?"#define USE_NORMALMAP":"",p.specularMap?"#define USE_SPECULARMAP":"",p.roughnessMap?"#define USE_ROUGHNESSMAP":"",p.metalnessMap?"#define USE_METALNESSMAP":"",p.alphaMap?"#define USE_ALPHAMAP":"",p.vertexColors?"#define USE_COLOR":"",p.flatShading?"#define FLAT_SHADED":"",p.doubleSided?"#define DOUBLE_SIDED":"",p.flipSided?"#define FLIP_SIDED":"",p.shadowMapEnabled?"#define USE_SHADOWMAP":"",p.shadowMapEnabled?"#define "+x:"",0<p.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",p.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",p.logarithmicDepthBuffer&&c.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",p.envMap&&c.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(r).join("\n")),v=i(v,p),y=i(y,p),0==u instanceof m.ShaderMaterial&&(v=n(v),y=n(y)),y=c+y,v=m.WebGLShader(d,d.VERTEX_SHADER,g+v),y=m.WebGLShader(d,d.FRAGMENT_SHADER,y),d.attachShader(E,v),d.attachShader(E,y),void 0!==u.index0AttributeName?d.bindAttribLocation(E,0,u.index0AttributeName):!0===p.morphTargets&&d.bindAttribLocation(E,0,"position"),d.linkProgram(E),p=d.getProgramInfoLog(E),x=d.getShaderInfoLog(v),b=d.getShaderInfoLog(y),M=_=!0,!1===d.getProgramParameter(E,d.LINK_STATUS)?(_=!1,console.error("THREE.WebGLProgram: shader error: ",d.getError(),"gl.VALIDATE_STATUS",d.getProgramParameter(E,d.VALIDATE_STATUS),"gl.getProgramInfoLog",p,x,b)):""!==p?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",p):""!==x&&""!==b||(M=!1),M&&(this.diagnostics={runnable:_,material:u,programLog:p,vertexShader:{log:x,prefix:g},fragmentShader:{log:b,prefix:c}}),d.deleteShader(v),d.deleteShader(y);var T;this.getUniforms=function(){if(void 0===T){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_UNIFORMS),r=0;r<e;r++){var i=d.getActiveUniform(E,r).name,n=d.getUniformLocation(E,i);if(o=a.exec(i)){var i=o[1],o=o[2];(c=t[i])||(c=t[i]={}),c[o]=n}else if(o=s.exec(i)){var c=o[1],i=o[2],o=o[3],l=t[c];l||(l=t[c]=[]),(c=l[i])||(c=l[i]={}),c[o]=n}else(o=h.exec(i))?(c=o[1],t[c]=n):t[i]=n}T=t}return T};var C;return this.getAttributes=function(){if(void 0===C){for(var t={},e=d.getProgramParameter(E,d.ACTIVE_ATTRIBUTES),r=0;r<e;r++){var i=d.getActiveAttrib(E,r).name;t[i]=d.getAttribLocation(E,i)}C=t}return C},this.destroy=function(){d.deleteProgram(E),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=o++,this.code=l,this.usedTimes=1,this.program=E,this.vertexShader=v,this.fragmentShader=y,this}}(),m.WebGLPrograms=function(t,e){var r=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled pointLightShadows shadowMapType alphaTest doubleSided flipSided".split(" ");this.getParameters=function(r,n,o,a){var s,h=i[r.type];e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture?s=1024:(s=Math.floor((e.maxVertexUniforms-20)/4),void 0!==a&&a instanceof m.SkinnedMesh&&(s=Math.min(a.skeleton.bones.length,s))<a.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+a.skeleton.bones.length+", this GPU supports just "+s+" (try OpenGL instead of ANGLE)"));var c=t.getPrecision();return null!==r.precision&&(c=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",c,"instead."),{shaderID:h,precision:c,supportsVertexTextures:e.vertexTextures,map:!!r.map,envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:o,useFog:r.fog,fogExp:o instanceof m.FogExp2,flatShading:r.shading===m.FlatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:s,useVertexTexture:e.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numHemiLights:n.hemi.length,pointLightShadows:n.shadowsPointLight,shadowMapEnabled:t.shadowMap.enabled&&a.receiveShadow&&0<n.shadows.length,shadowMapType:t.shadowMap.type,alphaTest:r.alphaTest,doubleSided:r.side===m.DoubleSide,flipSided:r.side===m.BackSide}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(i=0;i<n.length;i++){var o=n[i];r.push(o),r.push(e[o])}return r.join()},this.acquireProgram=function(e,i,n){for(var o,a=0,s=r.length;a<s;a++){var h=r[a];if(h.code===n){++(o=h).usedTimes;break}}return void 0===o&&(o=new m.WebGLProgram(t,n,e,i),r.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r},m.WebGLProperties=function(){var t={};this.get=function(e){e=e.uuid;var r=t[e];return void 0===r&&(r={},t[e]=r),r},this.delete=function(e){delete t[e.uuid]},this.clear=function(){t={}}},m.WebGLShader=function(){function t(t){t=t.split("\n");for(var e=0;e<t.length;e++)t[e]=e+1+": "+t[e];return t.join("\n")}return function(e,r,i){var n=e.createShader(r);return e.shaderSource(n,i),e.compileShader(n),!1===e.getShaderParameter(n,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),t(i)),n}}(),m.WebGLShadowMap=function(t,e,r){function i(t,e,r,i){var n=t.geometry,o=null,o=p,a=t.customDepthMaterial;return r&&(o=d,a=t.customDistanceMaterial),a?o=a:(t=t instanceof m.SkinnedMesh&&e.skinning,a=0,void 0!==n.morphTargets&&0<n.morphTargets.length&&e.morphTargets&&(a|=1),t&&(a|=2),o=o[a]),o.visible=e.visible,o.wireframe=e.wireframe,o.wireframeLinewidth=e.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(t,e,r){if(!1!==t.visible){t.layers.test(e.layers)&&(t instanceof m.Mesh||t instanceof m.Line||t instanceof m.Points)&&t.castShadow&&(!1===t.frustumCulled||!0===s.intersectsObject(t))&&!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),u.push(t));for(var i=0,o=(t=t.children).length;i<o;i++)n(t[i],e,r)}}for(var o=t.context,a=t.state,s=new m.Frustum,h=new m.Matrix4,c=new m.Vector3,l=new m.Vector3,u=[],p=Array(4),d=Array(4),f=[new m.Vector3(1,0,0),new m.Vector3(-1,0,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1),new m.Vector3(0,1,0),new m.Vector3(0,-1,0)],g=[new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,1,0),new m.Vector3(0,0,1),new m.Vector3(0,0,-1)],v=[new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4,new m.Vector4],y=m.ShaderLib.depthRGBA,x=m.UniformsUtils.clone(y.uniforms),b=m.ShaderLib.distanceRGBA,_=m.UniformsUtils.clone(b.uniforms),M=0;4!==M;++M){var w=0!=(1&M),S=0!=(2&M),E=new m.ShaderMaterial({uniforms:x,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:w,skinning:S});E._shadowPass=!0,p[M]=E,(w=new m.ShaderMaterial({uniforms:_,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:w,skinning:S}))._shadowPass=!0,d[M]=w}var T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m.PCFShadowMap,this.cullFace=m.CullFaceFront,this.render=function(p,d){var y,x;if(!1!==T.enabled&&(!1!==T.autoUpdate||!1!==T.needsUpdate)){a.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(T.cullFace===m.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),a.setScissorTest(!1);for(var b=e.shadows,_=0,M=b.length;_<M;_++){var w=b[_],S=w.shadow,E=S.camera,C=S.mapSize;if(w instanceof m.PointLight){y=6,x=!0;var L=C.x/4,A=C.y/2;v[0].set(2*L,A,L,A),v[1].set(0,A,L,A),v[2].set(3*L,A,L,A),v[3].set(L,A,L,A),v[4].set(3*L,0,L,A),v[5].set(L,0,L,A)}else y=1,x=!1;for(null===S.map&&(S.map=new m.WebGLRenderTarget(C.x,C.y,{minFilter:m.LinearFilter,magFilter:m.LinearFilter,format:m.RGBAFormat}),w instanceof m.SpotLight&&(E.aspect=C.x/C.y),E.updateProjectionMatrix()),C=S.map,S=S.matrix,l.setFromMatrixPosition(w.matrixWorld),E.position.copy(l),t.setRenderTarget(C),t.clear(),C=0;C<y;C++)for(x?(c.copy(E.position),c.add(f[C]),E.up.copy(g[C]),E.lookAt(c),a.viewport(v[C])):(c.setFromMatrixPosition(w.target.matrixWorld),E.lookAt(c)),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),S.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),S.multiply(E.projectionMatrix),S.multiply(E.matrixWorldInverse),h.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),s.setFromMatrix(h),u.length=0,n(p,d,E),L=0,A=u.length;L<A;L++){var P=u[L],R=r.update(P);if((k=P.material)instanceof m.MultiMaterial)for(var U=R.groups,k=k.materials,D=0,I=U.length;D<I;D++){var F=U[D],B=k[F.materialIndex];!0===B.visible&&(B=i(P,B,x,l),t.renderBufferDirect(E,null,R,B,P,F))}else B=i(P,k,x,l),t.renderBufferDirect(E,null,R,B,P,null)}t.resetGLState()}y=t.getClearColor(),x=t.getClearAlpha(),t.setClearColor(y,x),a.enable(o.BLEND),T.cullFace===m.CullFaceFront&&o.cullFace(o.BACK),t.resetGLState(),T.needsUpdate=!1}}},m.WebGLState=function(t,e,r){var i=this,n=new m.Vector4,o=new Uint8Array(16),a=new Uint8Array(16),s=new Uint8Array(16),h={},c=null,l=null,u=null,p=null,d=null,f=null,g=null,v=null,y=null,x=null,b=null,_=null,M=null,w=null,S=null,E=null,T=null,C=null,L=null,A=null,P=null,R=null,U=null,k=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),D=void 0,I={},F=new m.Vector4,B=null,V=null,N=new m.Vector4,O=new m.Vector4;this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.clearStencil(0),this.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.frontFace(t.CCW),t.cullFace(t.BACK),this.enable(t.CULL_FACE),this.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var t=0,e=o.length;t<e;t++)o[t]=0},this.enableAttribute=function(r){o[r]=1,0===a[r]&&(t.enableVertexAttribArray(r),a[r]=1),0!==s[r]&&(e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),s[r]=0)},this.enableAttributeAndDivisor=function(e,r,i){o[e]=1,0===a[e]&&(t.enableVertexAttribArray(e),a[e]=1),s[e]!==r&&(i.vertexAttribDivisorANGLE(e,r),s[e]=r)},this.disableUnusedAttributes=function(){for(var e=0,r=a.length;e<r;e++)a[e]!==o[e]&&(t.disableVertexAttribArray(e),a[e]=0)},this.enable=function(e){!0!==h[e]&&(t.enable(e),h[e]=!0)},this.disable=function(e){!1!==h[e]&&(t.disable(e),h[e]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)c.push(r[i]);return c},this.setBlending=function(e,i,n,o,a,s,h){e===m.NoBlending?this.disable(t.BLEND):this.enable(t.BLEND),e!==l&&(e===m.AdditiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===m.SubtractiveBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===m.MultiplyBlending?(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),l=e),e===m.CustomBlending?(a=a||i,s=s||n,h=h||o,i===u&&a===f||(t.blendEquationSeparate(r(i),r(a)),u=i,f=a),n===p&&o===d&&s===g&&h===v||(t.blendFuncSeparate(r(n),r(o),r(s),r(h)),p=n,d=o,g=s,v=h)):v=g=f=d=p=u=null},this.setDepthFunc=function(e){if(y!==e){if(e)switch(e){case m.NeverDepth:t.depthFunc(t.NEVER);break;case m.AlwaysDepth:t.depthFunc(t.ALWAYS);break;case m.LessDepth:t.depthFunc(t.LESS);break;case m.LessEqualDepth:t.depthFunc(t.LEQUAL);break;case m.EqualDepth:t.depthFunc(t.EQUAL);break;case m.GreaterEqualDepth:t.depthFunc(t.GEQUAL);break;case m.GreaterDepth:t.depthFunc(t.GREATER);break;case m.NotEqualDepth:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);y=e}},this.setDepthTest=function(e){e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)},this.setDepthWrite=function(e){x!==e&&(t.depthMask(e),x=e)},this.setColorWrite=function(e){b!==e&&(t.colorMask(e,e,e,e),b=e)},this.setStencilFunc=function(e,r,i){M===e&&w===r&&S===i||(t.stencilFunc(e,r,i),M=e,w=r,S=i)},this.setStencilOp=function(e,r,i){E===e&&T===r&&C===i||(t.stencilOp(e,r,i),E=e,T=r,C=i)},this.setStencilTest=function(e){e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)},this.setStencilWrite=function(e){_!==e&&(t.stencilMask(e),_=e)},this.setFlipSided=function(e){L!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),L=e)},this.setLineWidth=function(e){e!==A&&(t.lineWidth(e),A=e)},this.setPolygonOffset=function(e,r,i){e?this.enable(t.POLYGON_OFFSET_FILL):this.disable(t.POLYGON_OFFSET_FILL),!e||P===r&&R===i||(t.polygonOffset(r,i),P=r,R=i)},this.getScissorTest=function(){return U},this.setScissorTest=function(e){(U=e)?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)},this.activeTexture=function(e){void 0===e&&(e=t.TEXTURE0+k-1),D!==e&&(t.activeTexture(e),D=e)},this.bindTexture=function(e,r){void 0===D&&i.activeTexture();var n=I[D];void 0===n&&(n={type:void 0,texture:void 0},I[D]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r),n.type=e,n.texture=r)},this.compressedTexImage2D=function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}},this.clearColor=function(e,r,i,o){n.set(e,r,i,o),!1===F.equals(n)&&(t.clearColor(e,r,i,o),F.copy(n))},this.clearDepth=function(e){B!==e&&(t.clearDepth(e),B=e)},this.clearStencil=function(e){V!==e&&(t.clearStencil(e),V=e)},this.scissor=function(e){!1===N.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),N.copy(e))},this.viewport=function(e){!1===O.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),O.copy(e))},this.reset=function(){for(var e=0;e<a.length;e++)1===a[e]&&(t.disableVertexAttribArray(e),a[e]=0);h={},L=_=x=b=l=c=null}},m.LensFlarePlugin=function(t,e){var r,i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x=t.context,b=t.state;this.render=function(_,M,w){if(0!==e.length){_=new m.Vector3;var S=w.w/w.z,E=.5*w.z,T=.5*w.w,C=16/w.w,L=new m.Vector2(C*S,C),A=new m.Vector3(1,1,0),P=new m.Vector2(1,1);if(void 0===f){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),R=new Uint16Array([0,1,2,0,2,3]);p=x.createBuffer(),d=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,p),x.bufferData(x.ARRAY_BUFFER,C,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),x.bufferData(x.ELEMENT_ARRAY_BUFFER,R,x.STATIC_DRAW),v=x.createTexture(),y=x.createTexture(),b.bindTexture(x.TEXTURE_2D,v),x.texImage2D(x.TEXTURE_2D,0,x.RGB,16,16,0,x.RGB,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST),b.bindTexture(x.TEXTURE_2D,y),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,16,16,0,x.RGBA,x.UNSIGNED_BYTE,null),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.NEAREST),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.NEAREST);var C=(g=0<x.getParameter(x.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},R=x.createProgram(),U=x.createShader(x.FRAGMENT_SHADER),k=x.createShader(x.VERTEX_SHADER),D="precision "+t.getPrecision()+" float;\n";x.shaderSource(U,D+C.fragmentShader),x.shaderSource(k,D+C.vertexShader),x.compileShader(U),x.compileShader(k),x.attachShader(R,U),x.attachShader(R,k),x.linkProgram(R),f=R,l=x.getAttribLocation(f,"position"),u=x.getAttribLocation(f,"uv"),r=x.getUniformLocation(f,"renderType"),i=x.getUniformLocation(f,"map"),n=x.getUniformLocation(f,"occlusionMap"),o=x.getUniformLocation(f,"opacity"),a=x.getUniformLocation(f,"color"),s=x.getUniformLocation(f,"scale"),h=x.getUniformLocation(f,"rotation"),c=x.getUniformLocation(f,"screenPosition")}for(x.useProgram(f),b.initAttributes(),b.enableAttribute(l),b.enableAttribute(u),b.disableUnusedAttributes(),x.uniform1i(n,0),x.uniform1i(i,1),x.bindBuffer(x.ARRAY_BUFFER,p),x.vertexAttribPointer(l,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(u,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,d),b.disable(x.CULL_FACE),b.setDepthWrite(!1),R=0,U=e.length;R<U;R++)if(C=16/w.w,L.set(C*S,C),k=e[R],_.set(k.matrixWorld.elements[12],k.matrixWorld.elements[13],k.matrixWorld.elements[14]),_.applyMatrix4(M.matrixWorldInverse),_.applyProjection(M.projectionMatrix),A.copy(_),P.x=A.x*E+E,P.y=A.y*T+T,g||0<P.x&&P.x<w.z&&0<P.y&&P.y<w.w){b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,null),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGB,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,0),x.uniform2f(s,L.x,L.y),x.uniform3f(c,A.x,A.y,A.z),b.disable(x.BLEND),b.enable(x.DEPTH_TEST),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),b.activeTexture(x.TEXTURE0),b.bindTexture(x.TEXTURE_2D,y),x.copyTexImage2D(x.TEXTURE_2D,0,x.RGBA,w.x+P.x-8,w.y+P.y-8,16,16,0),x.uniform1i(r,1),b.disable(x.DEPTH_TEST),b.activeTexture(x.TEXTURE1),b.bindTexture(x.TEXTURE_2D,v),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),k.positionScreen.copy(A),k.customUpdateCallback?k.customUpdateCallback(k):k.updateLensFlares(),x.uniform1i(r,2),b.enable(x.BLEND);for(var D=0,I=k.lensFlares.length;D<I;D++){var F=k.lensFlares[D];.001<F.opacity&&.001<F.scale&&(A.x=F.x,A.y=F.y,A.z=F.z,C=F.size*F.scale/w.w,L.x=C*S,L.y=C,x.uniform3f(c,A.x,A.y,A.z),x.uniform2f(s,L.x,L.y),x.uniform1f(h,F.rotation),x.uniform1f(o,F.opacity),x.uniform3f(a,F.color.r,F.color.g,F.color.b),b.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),t.setTexture(F.texture,1),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0))}}b.enable(x.CULL_FACE),b.enable(x.DEPTH_TEST),b.setDepthWrite(!0),t.resetGLState()}}},m.SpritePlugin=function(t,e){function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x,b,_,M,w,S,E=t.context,T=t.state,C=new m.Vector3,L=new m.Quaternion,A=new m.Vector3;this.render=function(P,R){if(0!==e.length){if(void 0===w){var U=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),k=new Uint16Array([0,1,2,0,2,3]);_=E.createBuffer(),M=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,U,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.bufferData(E.ELEMENT_ARRAY_BUFFER,k,E.STATIC_DRAW);var U=E.createProgram(),k=E.createShader(E.VERTEX_SHADER),D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(k,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),E.shaderSource(D,["precision "+t.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),E.compileShader(k),E.compileShader(D),E.attachShader(U,k),E.attachShader(U,D),E.linkProgram(U),w=U,x=E.getAttribLocation(w,"position"),b=E.getAttribLocation(w,"uv"),i=E.getUniformLocation(w,"uvOffset"),n=E.getUniformLocation(w,"uvScale"),o=E.getUniformLocation(w,"rotation"),a=E.getUniformLocation(w,"scale"),s=E.getUniformLocation(w,"color"),h=E.getUniformLocation(w,"map"),c=E.getUniformLocation(w,"opacity"),l=E.getUniformLocation(w,"modelViewMatrix"),u=E.getUniformLocation(w,"projectionMatrix"),p=E.getUniformLocation(w,"fogType"),d=E.getUniformLocation(w,"fogDensity"),f=E.getUniformLocation(w,"fogNear"),g=E.getUniformLocation(w,"fogFar"),v=E.getUniformLocation(w,"fogColor"),y=E.getUniformLocation(w,"alphaTest"),(U=document.createElement("canvas")).width=8,U.height=8,(k=U.getContext("2d")).fillStyle="white",k.fillRect(0,0,8,8),(S=new m.Texture(U)).needsUpdate=!0}E.useProgram(w),T.initAttributes(),T.enableAttribute(x),T.enableAttribute(b),T.disableUnusedAttributes(),T.disable(E.CULL_FACE),T.enable(E.BLEND),E.bindBuffer(E.ARRAY_BUFFER,_),E.vertexAttribPointer(x,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(b,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,M),E.uniformMatrix4fv(u,!1,R.projectionMatrix.elements),T.activeTexture(E.TEXTURE0),E.uniform1i(h,0),k=U=0,(D=P.fog)?(E.uniform3f(v,D.color.r,D.color.g,D.color.b),D instanceof m.Fog?(E.uniform1f(f,D.near),E.uniform1f(g,D.far),E.uniform1i(p,1),k=U=1):D instanceof m.FogExp2&&(E.uniform1f(d,D.density),E.uniform1i(p,2),k=U=2)):(E.uniform1i(p,0),k=U=0);for(var D=0,I=e.length;D<I;D++)(B=e[D]).modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,B.matrixWorld),B.z=-B.modelViewMatrix.elements[14];e.sort(r);for(var F=[],D=0,I=e.length;D<I;D++){var B=e[D],V=B.material;E.uniform1f(y,V.alphaTest),E.uniformMatrix4fv(l,!1,B.modelViewMatrix.elements),B.matrixWorld.decompose(C,L,A),F[0]=A.x,F[1]=A.y,B=0,P.fog&&V.fog&&(B=k),U!==B&&(E.uniform1i(p,B),U=B),null!==V.map?(E.uniform2f(i,V.map.offset.x,V.map.offset.y),E.uniform2f(n,V.map.repeat.x,V.map.repeat.y)):(E.uniform2f(i,0,0),E.uniform2f(n,1,1)),E.uniform1f(c,V.opacity),E.uniform3f(s,V.color.r,V.color.g,V.color.b),E.uniform1f(o,V.rotation),E.uniform2fv(a,F),T.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),T.setDepthTest(V.depthTest),T.setDepthWrite(V.depthWrite),V.map&&V.map.image&&V.map.image.width?t.setTexture(V.map,0):t.setTexture(S,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}T.enable(E.CULL_FACE),t.resetGLState()}}},Object.defineProperties(m.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}}}),Object.defineProperties(m.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Matrix3.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}}),Object.defineProperties(m.Matrix4.prototype,{extractPosition:{value:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)}},setRotationFromQuaternion:{value:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)}},multiplyVector3:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)}},multiplyVector4:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},multiplyVector3Array:{value:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}},rotateAxis:{value:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)}},crossVector:{value:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)}},translate:{value:function(t){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(m.Plane.prototype,{isIntersectionLine:{value:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}}),Object.defineProperties(m.Quaternion.prototype,{multiplyVector3:{value:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)}}}),Object.defineProperties(m.Ray.prototype,{isIntersectionBox:{value:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)}},isIntersectionPlane:{value:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)}},isIntersectionSphere:{value:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}}),Object.defineProperties(m.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)}},getScaleFromMatrix:{value:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)}},getColumnFromMatrix:{value:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}}),m.Face4=function(t,e,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new m.Face3(t,e,r,n,o,a)},Object.defineProperties(m.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},getChildByName:{value:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)}},renderDepth:{set:function(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(m,{PointCloud:{value:function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new m.Points(t,e)}},ParticleSystem:{value:function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new m.Points(t,e)}}}),Object.defineProperties(m.Light.prototype,{onlyShadow:{set:function(t){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(t){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(m.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(m.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)}},addDrawCall:{value:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(m.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new m.Color}}}),Object.defineProperties(m,{PointCloudMaterial:{value:function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleBasicMaterial:{value:function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}},ParticleSystemMaterial:{value:function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(t)}}}),Object.defineProperties(m.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(m.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.defineProperties(m.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(m.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),m.GeometryUtils={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e instanceof m.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},m.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new m.TextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadTextureCube:function(t,e,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new m.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),t=n.load(t,r,void 0,i),e&&(t.mapping=e),t},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},m.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},m.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},m.MeshFaceMaterial=m.MultiMaterial,m.CurveUtils={tangentQuadraticBezier:function(t,e,r,i){return 2*(1-t)*(r-e)+2*t*(i-r)},tangentCubicBezier:function(t,e,r,i,n){return-3*e*(1-t)*(1-t)+3*r*(1-t)*(1-t)-6*t*r*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*n},tangentSpline:function(t,e,r,i,n){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,r,i,n){var o=n*n;return(2*e-2*r+(t=.5*(r-t))+(i=.5*(i-e)))*n*o+(-3*e+3*r-2*t-i)*o+t*n+e}},m.SceneUtils={createMultiMaterialObject:function(t,e){for(var r=new m.Group,i=0,n=e.length;i<n;i++)r.add(new m.Mesh(t,e[i]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var i=new m.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),e.remove(t),r.add(t)}},m.ShapeUtils={area:function(t){for(var e=t.length,r=0,i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return.5*r},triangulate:function(t,e){var r=t.length;if(3>r)return null;var i,n,o,a=[],s=[],h=[];if(0<m.ShapeUtils.area(t))for(n=0;n<r;n++)s[n]=n;else for(n=0;n<r;n++)s[n]=r-1-n;var c=2*r;for(n=r-1;2<r;){if(0>=c--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);var l;t:{var u=l=void 0,p=void 0,d=void 0,f=void 0,g=void 0,v=void 0,y=void 0,x=void 0,u=t[s[i]].x,p=t[s[i]].y,d=t[s[n]].x,f=t[s[n]].y,g=t[s[o]].x,v=t[s[o]].y;if(Number.EPSILON>(d-u)*(v-p)-(f-p)*(g-u))l=!1;else{var b=void 0,_=void 0,M=void 0,w=void 0,S=void 0,E=void 0,T=void 0,C=void 0,L=void 0,A=void 0,L=C=T=x=y=void 0,b=g-d,_=v-f,M=u-g,w=p-v,S=d-u,E=f-p;for(l=0;l<r;l++)if(y=t[s[l]].x,x=t[s[l]].y,!(y===u&&x===p||y===d&&x===f||y===g&&x===v)&&(T=y-u,C=x-p,L=y-d,A=x-f,y-=g,x-=v,L=b*A-_*L,T=S*C-E*T,C=M*x-w*y,L>=-Number.EPSILON&&C>=-Number.EPSILON&&T>=-Number.EPSILON)){l=!1;break t}l=!0}}if(l){for(a.push([t[s[i]],t[s[n]],t[s[o]]]),h.push([s[i],s[n],s[o]]),i=n,o=n+1;o<r;i++,o++)s[i]=s[o];c=2*--r}}return e?h:a},triangulateShape:function(t,e){function r(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,i,n,o){var a=e.x-t.x,s=e.y-t.y,h=n.x-i.x,c=n.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*h-a*c,d=s*l-a*u;if(Math.abs(p)>Number.EPSILON){if(0<p){if(0>d||d>p)return[];if(0>(h=c*l-h*u)||h>p)return[]}else{if(0<d||d<p)return[];if(0<(h=c*l-h*u)||h<p)return[]}return 0===h?!o||0!==d&&d!==p?[t]:[]:h===p?!o||0!==d&&d!==p?[e]:[]:0===d?[i]:d===p?[n]:(o=h/p,[{x:t.x+o*a,y:t.y+o*s}])}return 0!==d||c*l!=h*u?[]:(s=0===a&&0===s,h=0===h&&0===c,s&&h?t.x!==i.x||t.y!==i.y?[]:[t]:s?r(i,n,t)?[t]:[]:h?r(t,e,i)?[i]:[]:(0!==a?(t.x<e.x?(a=t,h=t.x,s=e,t=e.x):(a=e,h=e.x,s=t,t=t.x),i.x<n.x?(e=i,p=i.x,c=n,i=n.x):(e=n,p=n.x,c=i,i=i.x)):(t.y<e.y?(a=t,h=t.y,s=e,t=e.y):(a=e,h=e.y,s=t,t=t.y),i.y<n.y?(e=i,p=i.y,c=n,i=n.y):(e=n,p=n.y,c=i,i=i.y)),h<=p?t<p?[]:t===p?o?[]:[e]:t<=i?[e,s]:[e,c]:h>i?[]:h===i?o?[]:[a]:t<=i?[a,s]:[a,c]))}function n(t,e,r,i){var n=e.x-t.x,o=e.y-t.y;e=r.x-t.x,r=r.y-t.y;var a=i.x-t.x;return i=i.y-t.y,t=n*r-o*e,n=n*i-o*a,Math.abs(t)>Number.EPSILON?(e=a*r-i*e,0<t?0<=n&&0<=e:0<=n||0<=e):0<n}var o,a,s,h,c,l={};for(s=t.concat(),o=0,a=e.length;o<a;o++)Array.prototype.push.apply(s,e[o]);for(o=0,a=s.length;o<a;o++)c=s[o].x+":"+s[o].y,void 0!==l[c]&&console.warn("THREE.Shape: Duplicate point",c),l[c]=o;o=function(t,e){var r,o,a,s,h,c,l,u,p,d=t.concat(),f=[],m=[],g=0;for(o=e.length;g<o;g++)f.push(g);l=0;for(var v=2*f.length;0<f.length;){if(0>--v){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(a=l;a<d.length;a++){for(s=d[a],o=-1,g=0;g<f.length;g++)if(h=f[g],c=s.x+":"+s.y+":"+h,void 0===m[c]){for(r=e[h],u=0;u<r.length;u++)if(h=r[u],function(t,e){var i=d.length-1,o=t-1;0>o&&(o=i);var a=t+1;return a>i&&(a=0),!!(i=n(d[t],d[o],d[a],r[e]))&&(i=r.length-1,0>(o=e-1)&&(o=i),(a=e+1)>i&&(a=0),!!(i=n(r[e],r[o],r[a],d[t])))}(a,u)&&!function(t,e){var r,n;for(r=0;r<d.length;r++)if(n=r+1,n%=d.length,0<(n=i(t,e,d[r],d[n],!0)).length)return!0;return!1}(s,h)&&!function(t,r){var n,o,a,s;for(n=0;n<f.length;n++)for(o=e[f[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,0<(s=i(t,r,o[a],o[s],!0)).length)return!0;return!1}(s,h)){o=u,f.splice(g,1),l=d.slice(0,a+1),h=d.slice(a),u=r.slice(o),p=r.slice(0,o+1),d=l.concat(u).concat(p).concat(h),l=a;break}if(0<=o)break;m[c]=!0}if(0<=o)break}}return d}(t,e);var u=m.ShapeUtils.triangulate(o,!1);for(o=0,a=u.length;o<a;o++)for(h=u[o],s=0;3>s;s++)c=h[s].x+":"+h[s].y,void 0!==(c=l[c])&&(h[s]=c);return u.concat()},isClockWise:function(t){return 0>m.ShapeUtils.area(t)},b2:function(t,e,r,i){var n=1-t;return n*n*e+2*(1-t)*t*r+t*t*i},b3:function(t,e,r,i,n){var o=1-t,a=1-t;return o*o*o*e+3*a*a*t*r+3*(1-t)*t*t*i+t*t*t*n}},m.Curve=function(){},m.Curve.prototype={constructor:m.Curve,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){return t=this.getUtoTmapping(t),this.getPoint(t)},getPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPoint(e/t));return r},getSpacedPoints:function(t){t||(t=5);var e,r=[];for(e=0;e<=t;e++)r.push(this.getPointAt(e/t));return r},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),o+=e.distanceTo(n),i.push(o),n=e;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,i=this.getLengths(),n=0,o=i.length;r=e||t*i[o-1];for(var a,s=0,h=o-1;s<=h;)if(n=Math.floor(s+(h-s)/2),0>(a=i[n]-r))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return n=h,i[n]===r?n/(o-1):(s=i[n],i=(n+(r-s)/(i[n+1]-s))/(o-1))},getTangent:function(t){var e=t-1e-4;return t+=1e-4,0>e&&(e=0),1<t&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)}},m.Curve.create=function(t,e){return t.prototype=Object.create(m.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},m.CurvePath=function(){this.curves=[],this.autoClose=!1},m.CurvePath.prototype=Object.create(m.Curve.prototype),m.CurvePath.prototype.constructor=m.CurvePath,m.CurvePath.prototype.add=function(t){this.curves.push(t)},m.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new m.LineCurve(e,t))},m.CurvePath.prototype.getPoint=function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=e)return t=this.curves[i],e=1-(r[i]-e)/t.getLength(),t.getPointAt(e);i++}return null},m.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},m.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t},m.CurvePath.prototype.createPointsGeometry=function(t){return t=this.getPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createSpacedPointsGeometry=function(t){return t=this.getSpacedPoints(t),this.createGeometry(t)},m.CurvePath.prototype.createGeometry=function(t){for(var e=new m.Geometry,r=0,i=t.length;r<i;r++){var n=t[r];e.vertices.push(new m.Vector3(n.x,n.y,n.z||0))}return e},m.Font=function(t){this.data=t},m.Font.prototype={constructor:m.Font,generateShapes:function(t,e,r){void 0===e&&(e=100),void 0===r&&(r=4);var i=this.data;t=String(t).split("");var n=e/i.resolution,o=0;e=[];for(var a=0;a<t.length;a++){var s;s=n;var h=o,c=i.glyphs[t[a]]||i.glyphs["?"];if(c){var l=new m.Path,u=[],p=m.ShapeUtils.b2,d=m.ShapeUtils.b3,f=void 0,g=void 0,v=g=f=void 0,y=void 0,x=void 0,b=void 0,_=void 0,M=void 0,y=void 0;if(c.o)for(var w=c._cachedOutline||(c._cachedOutline=c.o.split(" ")),S=0,E=w.length;S<E;)switch(w[S++]){case"m":f=w[S++]*s+h,g=w[S++]*s,l.moveTo(f,g);break;case"l":f=w[S++]*s+h,g=w[S++]*s,l.lineTo(f,g);break;case"q":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,l.quadraticCurveTo(x,b,f,g),y=u[u.length-1])for(var v=y.x,y=y.y,T=1;T<=r;T++){var C=T/r;p(C,v,x,f),p(C,y,b,g)}break;case"b":if(f=w[S++]*s+h,g=w[S++]*s,x=w[S++]*s+h,b=w[S++]*s,_=w[S++]*s+h,M=w[S++]*s,l.bezierCurveTo(x,b,_,M,f,g),y=u[u.length-1])for(v=y.x,y=y.y,T=1;T<=r;T++)C=T/r,d(C,v,x,_,f),d(C,y,b,M,g)}s={offset:c.ha*s,path:l}}else s=void 0;o+=s.offset,e.push(s.path)}for(r=[],i=0,t=e.length;i<t;i++)Array.prototype.push.apply(r,e[i].toShapes());return r}},m.Path=function(t){m.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},m.Path.prototype=Object.create(m.CurvePath.prototype),m.Path.prototype.constructor=m.Path,m.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},m.Path.prototype.moveTo=function(t,e){this.actions.push({action:"moveTo",args:[t,e]})},m.Path.prototype.lineTo=function(t,e){var r=this.actions[this.actions.length-1].args,r=new m.LineCurve(new m.Vector2(r[r.length-2],r[r.length-1]),new m.Vector2(t,e));this.curves.push(r),this.actions.push({action:"lineTo",args:[t,e]})},m.Path.prototype.quadraticCurveTo=function(t,e,r,i){var n=this.actions[this.actions.length-1].args,n=new m.QuadraticBezierCurve(new m.Vector2(n[n.length-2],n[n.length-1]),new m.Vector2(t,e),new m.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[t,e,r,i]})},m.Path.prototype.bezierCurveTo=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args,a=new m.CubicBezierCurve(new m.Vector2(a[a.length-2],a[a.length-1]),new m.Vector2(t,e),new m.Vector2(r,i),new m.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[t,e,r,i,n,o]})},m.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,r=[new m.Vector2(r[r.length-2],r[r.length-1])];Array.prototype.push.apply(r,t),r=new m.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:e})},m.Path.prototype.arc=function(t,e,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(t+a[a.length-2],e+a[a.length-1],r,i,n,o)},m.Path.prototype.absarc=function(t,e,r,i,n,o){this.absellipse(t,e,r,r,i,n,o)},m.Path.prototype.ellipse=function(t,e,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(t+h[h.length-2],e+h[h.length-1],r,i,n,o,a,s)},m.Path.prototype.absellipse=function(t,e,r,i,n,o,a,s){var h=[t,e,r,i,n,o,a,s||0];t=new m.EllipseCurve(t,e,r,i,n,o,a,s),this.curves.push(t),t=t.getPoint(1),h.push(t.x),h.push(t.y),this.actions.push({action:"ellipse",args:h})},m.Path.prototype.getSpacedPoints=function(t){t||(t=40);for(var e=[],r=0;r<t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},m.Path.prototype.getPoints=function(t){t=t||12;for(var e,r,i,n,o,a,s,h,c,l,u=m.ShapeUtils.b2,p=m.ShapeUtils.b3,d=[],f=0,g=this.actions.length;f<g;f++){var v=(c=this.actions[f]).args;switch(c.action){case"moveTo":case"lineTo":d.push(new m.Vector2(v[0],v[1]));break;case"quadraticCurveTo":for(e=v[2],r=v[3],o=v[0],a=v[1],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=u(l,s,o,e),l=u(l,h,a,r),d.push(new m.Vector2(c,l));break;case"bezierCurveTo":for(e=v[4],r=v[5],o=v[0],a=v[1],i=v[2],n=v[3],0<d.length?(c=d[d.length-1],s=c.x,h=c.y):(c=this.actions[f-1].args,s=c[c.length-2],h=c[c.length-1]),v=1;v<=t;v++)l=v/t,c=p(l,s,o,i,e),l=p(l,h,a,n,r),d.push(new m.Vector2(c,l));break;case"splineThru":for(c=this.actions[f-1].args,l=[new m.Vector2(c[c.length-2],c[c.length-1])],c=t*v[0].length,l=l.concat(v[0]),l=new m.SplineCurve(l),v=1;v<=c;v++)d.push(l.getPointAt(v/c));break;case"arc":for(e=v[0],r=v[1],a=v[2],i=v[3],c=v[4],o=!!v[5],s=c-i,h=2*t,v=1;v<=h;v++)l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new m.Vector2(c,l));break;case"ellipse":e=v[0],r=v[1],a=v[2],n=v[3],i=v[4],c=v[5],o=!!v[6];var y=v[7];s=c-i,h=2*t;var x,b;for(0!==y&&(x=Math.cos(y),b=Math.sin(y)),v=1;v<=h;v++){if(l=v/h,o||(l=1-l),l=i+l*s,c=e+a*Math.cos(l),l=r+n*Math.sin(l),0!==y){var _=c;c=(_-e)*x-(l-r)*b+e,l=(_-e)*b+(l-r)*x+r}d.push(new m.Vector2(c,l))}}}return t=d[d.length-1],Math.abs(t.x-d[0].x)<Number.EPSILON&&Math.abs(t.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},m.Path.prototype.toShapes=function(t,e){function r(t){for(var e=[],r=0,i=t.length;r<i;r++){var n=t[r],o=new m.Shape;o.actions=n.actions,o.curves=n.curves,e.push(o)}return e}var i=m.ShapeUtils.isClockWise,n=function(t){for(var e=[],r=new m.Path,i=0,n=t.length;i<n;i++){var o=t[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(e.push(r),r=new m.Path),r[o].apply(r,a)}return 0!==r.actions.length&&e.push(r),e}(this.actions);if(0===n.length)return[];if(!0===e)return r(n);var o,a,s,h=[];if(1===n.length)return a=n[0],s=new m.Shape,s.actions=a.actions,s.curves=a.curves,h.push(s),h;var c=!i(n[0].getPoints()),c=t?!c:c;s=[];var l,u=[],p=[],d=0;u[d]=void 0,p[d]=[];for(var f=0,g=n.length;f<g;f++)a=n[f],l=a.getPoints(),o=i(l),(o=t?!o:o)?(!c&&u[d]&&d++,u[d]={s:new m.Shape,p:l},u[d].s.actions=a.actions,u[d].s.curves=a.curves,c&&d++,p[d]=[]):p[d].push({h:a,p:l[0]});if(!u[0])return r(n);if(1<u.length){for(f=!1,a=[],i=0,n=u.length;i<n;i++)s[i]=[];for(i=0,n=u.length;i<n;i++)for(o=p[i],c=0;c<o.length;c++){for(d=o[c],l=!0,g=0;g<u.length;g++)(function(t,e){for(var r=e.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=e[n],s=e[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=e[o],h=-h,s=e[n],c=-c),!(t.y<a.y||t.y>s.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0==(n=c*(t.x-a.x)-h*(t.y-a.y)))return!0;0>n||(i=!i)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return i})(d.p,u[g].p)&&(i!==g&&a.push({froms:i,tos:g,hole:c}),l?(l=!1,s[g].push(d)):f=!0);l&&s[i].push(d)}0<a.length&&(f||(p=s))}for(f=0,i=u.length;f<i;f++)for(s=u[f].s,h.push(s),a=p[f],n=0,o=a.length;n<o;n++)s.holes.push(a[n].h);return h},m.Shape=function(){m.Path.apply(this,arguments),this.holes=[]},m.Shape.prototype=Object.create(m.Path.prototype),m.Shape.prototype.constructor=m.Shape,m.Shape.prototype.extrude=function(t){return new m.ExtrudeGeometry(this,t)},m.Shape.prototype.makeGeometry=function(t){return new m.ShapeGeometry(this,t)},m.Shape.prototype.getPointsHoles=function(t){for(var e=[],r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e},m.Shape.prototype.extractAllPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},m.Shape.prototype.extractPoints=function(t){return this.extractAllPoints(t)},m.LineCurve=function(t,e){this.v1=t,this.v2=e},m.LineCurve.prototype=Object.create(m.Curve.prototype),m.LineCurve.prototype.constructor=m.LineCurve,m.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},m.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},m.LineCurve.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},m.QuadraticBezierCurve=function(t,e,r){this.v0=t,this.v1=e,this.v2=r},m.QuadraticBezierCurve.prototype=Object.create(m.Curve.prototype),m.QuadraticBezierCurve.prototype.constructor=m.QuadraticBezierCurve,m.QuadraticBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b2;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},m.QuadraticBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentQuadraticBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()},m.CubicBezierCurve=function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},m.CubicBezierCurve.prototype=Object.create(m.Curve.prototype),m.CubicBezierCurve.prototype.constructor=m.CubicBezierCurve,m.CubicBezierCurve.prototype.getPoint=function(t){var e=m.ShapeUtils.b3;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},m.CubicBezierCurve.prototype.getTangent=function(t){var e=m.CurveUtils.tangentCubicBezier;return new m.Vector2(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},m.SplineCurve=function(t){this.points=void 0==t?[]:t},m.SplineCurve.prototype=Object.create(m.Curve.prototype),m.SplineCurve.prototype.constructor=m.SplineCurve,m.SplineCurve.prototype.getPoint=function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0===o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector2(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t))},m.EllipseCurve=function(t,e,r,i,n,o,a,s){this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},m.EllipseCurve.prototype=Object.create(m.Curve.prototype),m.EllipseCurve.prototype.constructor=m.EllipseCurve,m.EllipseCurve.prototype.getPoint=function(t){0>(r=this.aEndAngle-this.aStartAngle)&&(r+=2*Math.PI),r>2*Math.PI&&(r-=2*Math.PI),r=!0===this.aClockwise?this.aEndAngle+(1-t)*(2*Math.PI-r):this.aStartAngle+t*r,t=this.aX+this.xRadius*Math.cos(r);var e=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var r=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=t;t=(n-this.aX)*r-(e-this.aY)*i+this.aX,e=(n-this.aX)*i+(e-this.aY)*r+this.aY}return new m.Vector2(t,e)},m.ArcCurve=function(t,e,r,i,n,o){m.EllipseCurve.call(this,t,e,r,r,i,n,o)},m.ArcCurve.prototype=Object.create(m.EllipseCurve.prototype),m.ArcCurve.prototype.constructor=m.ArcCurve,m.LineCurve3=m.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new m.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),m.QuadraticBezierCurve3=m.Curve.create(function(t,e,r){this.v0=t,this.v1=e,this.v2=r},function(t){var e=m.ShapeUtils.b2;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),m.CubicBezierCurve3=m.Curve.create(function(t,e,r,i){this.v0=t,this.v1=e,this.v2=r,this.v3=i},function(t){var e=m.ShapeUtils.b3;return new m.Vector3(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),m.SplineCurve3=m.Curve.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==t?[]:t},function(t){t*=(n=this.points).length-1,t-=o=Math.floor(t);var e=n[0==o?o:o-1],r=n[o],i=n[o>n.length-2?n.length-1:o+1],n=n[o>n.length-3?n.length-1:o+2],o=m.CurveUtils.interpolate;return new m.Vector3(o(e.x,r.x,i.x,n.x,t),o(e.y,r.y,i.y,n.y,t),o(e.z,r.z,i.z,n.z,t))}),m.CatmullRomCurve3=function(){function t(){}var e=new m.Vector3,r=new t,i=new t,n=new t;return t.prototype.init=function(t,e,r,i){this.c0=t,this.c1=r,this.c2=-3*t+3*e-2*r-i,this.c3=2*t-2*e+r+i},t.prototype.initNonuniformCatmullRom=function(t,e,r,i,n,o,a){t=((e-t)/n-(r-t)/(n+o)+(r-e)/o)*o,i=((r-e)/o-(i-e)/(o+a)+(i-r)/a)*o,this.init(e,r,t,i)},t.prototype.initCatmullRom=function(t,e,r,i,n){this.init(e,r,n*(r-t),n*(i-e))},t.prototype.calc=function(t){var e=t*t;return this.c0+this.c1*t+this.c2*e+this.c3*e*t},m.Curve.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s=this.points;2>(a=s.length)&&console.log("duh, you need at least 2 points"),t*=a-(this.closed?0:1),t-=o=Math.floor(t),this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/s.length)+1)*s.length:0===t&&o===a-1&&(o=a-2,t=1);var h,c,l;if(this.closed||0<o?h=s[(o-1)%a]:(e.subVectors(s[0],s[1]).add(s[0]),h=e),c=s[o%a],l=s[(o+1)%a],this.closed||o+2<a?s=s[(o+2)%a]:(e.subVectors(s[a-1],s[a-2]).add(s[a-1]),s=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(h.distanceToSquared(c),u),o=Math.pow(c.distanceToSquared(l),u),u=Math.pow(l.distanceToSquared(s),u),1e-4>o&&(o=1),1e-4>a&&(a=o),1e-4>u&&(u=o),r.initNonuniformCatmullRom(h.x,c.x,l.x,s.x,a,o,u),i.initNonuniformCatmullRom(h.y,c.y,l.y,s.y,a,o,u),n.initNonuniformCatmullRom(h.z,c.z,l.z,s.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(h.x,c.x,l.x,s.x,a),i.initCatmullRom(h.y,c.y,l.y,s.y,a),n.initCatmullRom(h.z,c.z,l.z,s.z,a));return new m.Vector3(r.calc(t),i.calc(t),n.calc(t))})}(),m.ClosedSplineCurve3=function(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),m.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0},m.ClosedSplineCurve3.prototype=Object.create(m.CatmullRomCurve3.prototype),m.BoxGeometry=function(t,e,r,i,n,o){function a(t,e,r,i,n,o,a,h){var c,l=s.widthSegments,u=s.heightSegments,p=n/2,d=o/2,f=s.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?c="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(c="y",u=s.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(c="x",l=s.depthSegments);var g=l+1,v=u+1,y=n/l,x=o/u,b=new m.Vector3;for(b[c]=0<a?1:-1,n=0;n<v;n++)for(o=0;o<g;o++){var _=new m.Vector3;_[t]=(o*y-p)*r,_[e]=(n*x-d)*i,_[c]=a,s.vertices.push(_)}for(n=0;n<u;n++)for(o=0;o<l;o++)d=o+g*n,t=o+g*(n+1),e=o+1+g*(n+1),r=o+1+g*n,i=new m.Vector2(o/l,1-n/u),a=new m.Vector2(o/l,1-(n+1)/u),c=new m.Vector2((o+1)/l,1-(n+1)/u),p=new m.Vector2((o+1)/l,1-n/u),(d=new m.Face3(d+f,t+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([i,a,p]),(d=new m.Face3(t+f,e+f,r+f)).normal.copy(b),d.vertexNormals.push(b.clone(),b.clone(),b.clone()),d.materialIndex=h,s.faces.push(d),s.faceVertexUvs[0].push([a.clone(),c,p.clone()])}m.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this;n=e/2,o=r/2,a("z","y",-1,-1,r,e,i=t/2,0),a("z","y",1,-1,r,e,-i,1),a("x","z",1,1,t,r,n,2),a("x","z",1,-1,t,r,-n,3),a("x","y",1,-1,t,e,o,4),a("x","y",-1,-1,t,e,-o,5),this.mergeVertices()},m.BoxGeometry.prototype=Object.create(m.Geometry.prototype),m.BoxGeometry.prototype.constructor=m.BoxGeometry,m.CubeGeometry=m.BoxGeometry,m.CircleGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new m.CircleBufferGeometry(t,e,r,i))},m.CircleGeometry.prototype=Object.create(m.Geometry.prototype),m.CircleGeometry.prototype.constructor=m.CircleGeometry,m.CircleBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=e+2,o=new Float32Array(3*n),a=new Float32Array(3*n),n=new Float32Array(2*n);a[2]=1,n[0]=.5,n[1]=.5;for(var s=0,h=3,c=2;s<=e;s++,h+=3,c+=2){var l=r+s/e*i;o[h]=t*Math.cos(l),o[h+1]=t*Math.sin(l),a[h+2]=1,n[c]=(o[h]/t+1)/2,n[c+1]=(o[h+1]/t+1)/2}for(r=[],h=1;h<=e;h++)r.push(h,h+1,0);this.setIndex(new m.BufferAttribute(new Uint16Array(r),1)),this.addAttribute("position",new m.BufferAttribute(o,3)),this.addAttribute("normal",new m.BufferAttribute(a,3)),this.addAttribute("uv",new m.BufferAttribute(n,2)),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.CircleBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.CircleBufferGeometry.prototype.constructor=m.CircleBufferGeometry,m.CylinderGeometry=function(t,e,r,i,n,o,a,s){m.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h,c,l=r/2,u=[],p=[];for(c=0;c<=n;c++){var d=[],f=[],g=(v=c/n)*(e-t)+t;for(h=0;h<=i;h++)y=h/i,(x=new m.Vector3).x=g*Math.sin(y*s+a),x.y=-v*r+l,x.z=g*Math.cos(y*s+a),this.vertices.push(x),d.push(this.vertices.length-1),f.push(new m.Vector2(y,1-v));u.push(d),p.push(f)}for(r=(e-t)/r,h=0;h<i;h++)for(0!==t?(a=this.vertices[u[0][h]].clone(),s=this.vertices[u[0][h+1]].clone()):(a=this.vertices[u[1][h]].clone(),s=this.vertices[u[1][h+1]].clone()),a.setY(Math.sqrt(a.x*a.x+a.z*a.z)*r).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*r).normalize(),c=0;c<n;c++){var d=u[c][h],f=u[c+1][h],v=u[c+1][h+1],g=u[c][h+1],y=a.clone(),x=a.clone(),b=s.clone(),_=s.clone(),M=p[c][h].clone(),w=p[c+1][h].clone(),S=p[c+1][h+1].clone(),E=p[c][h+1].clone();this.faces.push(new m.Face3(d,f,g,[y,x,_])),this.faceVertexUvs[0].push([M,w,E]),this.faces.push(new m.Face3(f,v,g,[x.clone(),b,_.clone()])),this.faceVertexUvs[0].push([w.clone(),S,E.clone()])}if(!1===o&&0<t)for(this.vertices.push(new m.Vector3(0,l,0)),h=0;h<i;h++)d=u[0][h],f=u[0][h+1],v=this.vertices.length-1,y=new m.Vector3(0,1,0),x=new m.Vector3(0,1,0),b=new m.Vector3(0,1,0),M=p[0][h].clone(),w=p[0][h+1].clone(),S=new m.Vector2(w.x,0),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,1)),this.faceVertexUvs[0].push([M,w,S]);if(!1===o&&0<e)for(this.vertices.push(new m.Vector3(0,-l,0)),h=0;h<i;h++)d=u[n][h+1],f=u[n][h],v=this.vertices.length-1,y=new m.Vector3(0,-1,0),x=new m.Vector3(0,-1,0),b=new m.Vector3(0,-1,0),M=p[n][h+1].clone(),w=p[n][h].clone(),S=new m.Vector2(w.x,1),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,2)),this.faceVertexUvs[0].push([M,w,S]);this.computeFaceNormals()},m.CylinderGeometry.prototype=Object.create(m.Geometry.prototype),m.CylinderGeometry.prototype.constructor=m.CylinderGeometry,m.EdgesGeometry=function(t,e){m.BufferGeometry.call(this);var r,i=Math.cos(m.Math.degToRad(void 0!==e?e:1)),n=[0,0],o={},a=["a","b","c"];t instanceof m.BufferGeometry?(r=new m.Geometry).fromBufferGeometry(t):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var s=r.vertices,h=0,c=(r=r.faces).length;h<c;h++)for(var l=r[h],u=0;3>u;u++){n[0]=l[a[u]],n[1]=l[a[(u+1)%3]],n.sort(function(t,e){return t-e});var p=n.toString();void 0===o[p]?o[p]={vert1:n[0],vert2:n[1],face1:h,face2:void 0}:o[p].face2=h}n=[];for(p in o)(void 0===(a=o[p]).face2||r[a.face1].normal.dot(r[a.face2].normal)<=i)&&(h=s[a.vert1],n.push(h.x),n.push(h.y),n.push(h.z),h=s[a.vert2],n.push(h.x),n.push(h.y),n.push(h.z));this.addAttribute("position",new m.BufferAttribute(new Float32Array(n),3))},m.EdgesGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.EdgesGeometry.prototype.constructor=m.EdgesGeometry,m.ExtrudeGeometry=function(t,e){void 0!==t&&(m.Geometry.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals())},m.ExtrudeGeometry.prototype=Object.create(m.Geometry.prototype),m.ExtrudeGeometry.prototype.constructor=m.ExtrudeGeometry,m.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var r=t.length,i=0;i<r;i++)this.addShape(t[i],e)},m.ExtrudeGeometry.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function i(t,e,r){var i=1,i=t.x-e.x,n=t.y-e.y,o=r.x-t.x,a=r.y-t.y,s=i*i+n*n;if(Math.abs(i*a-n*o)>Number.EPSILON){var h=Math.sqrt(s),c=Math.sqrt(o*o+a*a),s=e.x-n/h;if(e=e.y+i/h,o=((r.x-a/c-s)*a-(r.y+o/c-e)*o)/(i*a-n*o),r=s+i*o-t.x,t=e+n*o-t.y,2>=(i=r*r+t*t))return new m.Vector2(r,t);i=Math.sqrt(i/2)}else t=!1,i>Number.EPSILON?o>Number.EPSILON&&(t=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(t=!0):Math.sign(n)===Math.sign(a)&&(t=!0),t?(r=-n,t=i,i=Math.sqrt(s)):(r=i,t=n,i=Math.sqrt(s/2));return new m.Vector2(r/i,t/i)}function n(t,e){var r,i;for(N=t.length;0<=--N;){r=N,0>(i=N-1)&&(i=t.length-1);for(var n=0,o=x+2*g,n=0;n<o;n++){var a=(a=e+r+(s=B*n))+C,s=(s=e+i+s)+C,h=(h=e+i+(c=B*(n+1)))+C,c=(c=e+r+c)+C;T.faces.push(new m.Face3(a,s,c,null,null,1)),T.faces.push(new m.Face3(s,h,c,null,null,1)),a=M.generateSideWallUV(T,a,s,h,c),T.faceVertexUvs[0].push([a[0],a[1],a[3]]),T.faceVertexUvs[0].push([a[1],a[2],a[3]])}}}function o(t,e,r){T.vertices.push(new m.Vector3(t,e,r))}function a(t,e,r){t+=C,e+=C,r+=C,T.faces.push(new m.Face3(t,e,r,null,null,0)),t=M.generateTopUV(T,t,e,r),T.faceVertexUvs[0].push(t)}var s,h,c,l,u,p=void 0!==e.amount?e.amount:100,d=void 0!==e.bevelThickness?e.bevelThickness:6,f=void 0!==e.bevelSize?e.bevelSize:d-2,g=void 0!==e.bevelSegments?e.bevelSegments:3,v=void 0===e.bevelEnabled||e.bevelEnabled,y=void 0!==e.curveSegments?e.curveSegments:12,x=void 0!==e.steps?e.steps:1,b=e.extrudePath,_=!1,M=void 0!==e.UVGenerator?e.UVGenerator:m.ExtrudeGeometry.WorldUVGenerator;b&&(s=b.getSpacedPoints(x),_=!0,v=!1,h=void 0!==e.frames?e.frames:new m.TubeGeometry.FrenetFrames(b,x,!1),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3),v||(f=d=g=0);var w,S,E,T=this,C=this.vertices.length,y=(b=t.extractPoints(y)).shape,L=b.holes;if(b=!m.ShapeUtils.isClockWise(y)){for(y=y.reverse(),S=0,E=L.length;S<E;S++)w=L[S],m.ShapeUtils.isClockWise(w)&&(L[S]=w.reverse());b=!1}var A=m.ShapeUtils.triangulateShape(y,L),P=y;for(S=0,E=L.length;S<E;S++)w=L[S],y=y.concat(w);var R,U,k,D,I,F,B=y.length,V=A.length,b=[],N=0;for(R=(k=P.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),b[N]=i(P[N],P[R],P[U]);var O,G=[],z=b.concat();for(S=0,E=L.length;S<E;S++){for(w=L[S],O=[],N=0,R=(k=w.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),O[N]=i(w[N],w[R],w[U]);G.push(O),z=z.concat(O)}for(R=0;R<g;R++){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,-D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),o(I.x,I.y,-D)}for(U=f,N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[0]).multiplyScalar(I.x),c.copy(h.binormals[0]).multiplyScalar(I.y),u.copy(s[0]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,0);for(k=1;k<=x;k++)for(N=0;N<B;N++)I=v?r(y[N],z[N],U):y[N],_?(l.copy(h.normals[k]).multiplyScalar(I.x),c.copy(h.binormals[k]).multiplyScalar(I.y),u.copy(s[k]).add(l).add(c),o(u.x,u.y,u.z)):o(I.x,I.y,p/x*k);for(R=g-1;0<=R;R--){for(D=d*(1-(k=R/g)),U=f*Math.sin(k*Math.PI/2),N=0,k=P.length;N<k;N++)I=r(P[N],b[N],U),o(I.x,I.y,p+D);for(S=0,E=L.length;S<E;S++)for(w=L[S],O=G[S],N=0,k=w.length;N<k;N++)I=r(w[N],O[N],U),_?o(I.x,I.y+s[x-1].y,s[x-1].x+D):o(I.x,I.y,p+D)}!function(){if(v){var t;for(t=0*B,N=0;N<V;N++)F=A[N],a(F[2]+t,F[1]+t,F[0]+t);for(t=x+2*g,t*=B,N=0;N<V;N++)F=A[N],a(F[0]+t,F[1]+t,F[2]+t)}else{for(N=0;N<V;N++)F=A[N],a(F[2],F[1],F[0]);for(N=0;N<V;N++)F=A[N],a(F[0]+B*x,F[1]+B*x,F[2]+B*x)}}(),function(){var t=0;for(n(P,t),t+=P.length,S=0,E=L.length;S<E;S++)w=L[S],n(w,t),t+=w.length}()},m.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,r,i){return t=t.vertices,e=t[e],r=t[r],i=t[i],[new m.Vector2(e.x,e.y),new m.Vector2(r.x,r.y),new m.Vector2(i.x,i.y)]},generateSideWallUV:function(t,e,r,i,n){return t=t.vertices,e=t[e],r=t[r],i=t[i],n=t[n],.01>Math.abs(e.y-r.y)?[new m.Vector2(e.x,1-e.z),new m.Vector2(r.x,1-r.z),new m.Vector2(i.x,1-i.z),new m.Vector2(n.x,1-n.z)]:[new m.Vector2(e.y,1-e.z),new m.Vector2(r.y,1-r.z),new m.Vector2(i.y,1-i.z),new m.Vector2(n.y,1-n.z)]}},m.ShapeGeometry=function(t,e){m.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(t)&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},m.ShapeGeometry.prototype=Object.create(m.Geometry.prototype),m.ShapeGeometry.prototype.constructor=m.ShapeGeometry,m.ShapeGeometry.prototype.addShapeList=function(t,e){for(var r=0,i=t.length;r<i;r++)this.addShape(t[r],e);return this},m.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var r,i,n,o=e.material,a=void 0===e.UVGenerator?m.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,s=this.vertices.length,h=(r=t.extractPoints(void 0!==e.curveSegments?e.curveSegments:12)).shape,c=r.holes;if(!m.ShapeUtils.isClockWise(h))for(h=h.reverse(),r=0,i=c.length;r<i;r++)n=c[r],m.ShapeUtils.isClockWise(n)&&(c[r]=n.reverse());var l=m.ShapeUtils.triangulateShape(h,c);for(r=0,i=c.length;r<i;r++)n=c[r],h=h.concat(n);for(c=h.length,i=l.length,r=0;r<c;r++)n=h[r],this.vertices.push(new m.Vector3(n.x,n.y,0));for(r=0;r<i;r++)c=l[r],h=c[0]+s,n=c[1]+s,c=c[2]+s,this.faces.push(new m.Face3(h,n,c,null,null,o)),this.faceVertexUvs[0].push(a.generateTopUV(this,h,n,c))},m.LatheGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=e||12,r=r||0,i=i||2*Math.PI;for(var n=1/(t.length-1),o=1/e,a=0,s=e;a<=s;a++)for(var h=r+a*o*i,c=Math.sin(h),l=Math.cos(h),h=0,u=t.length;h<u;h++){var p=t[h];(d=new m.Vector3).x=p.x*c,d.y=p.y,d.z=p.x*l,this.vertices.push(d)}for(r=t.length,a=0,s=e;a<s;a++)for(h=0,u=t.length-1;h<u;h++){i=(e=h+r*a)+r;var c=e+1+r,l=e+1,d=h*n,f=(p=a*o)+o,g=d+n;this.faces.push(new m.Face3(e,i,l)),this.faceVertexUvs[0].push([new m.Vector2(p,d),new m.Vector2(f,d),new m.Vector2(p,g)]),this.faces.push(new m.Face3(i,c,l)),this.faceVertexUvs[0].push([new m.Vector2(f,d),new m.Vector2(f,g),new m.Vector2(p,g)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},m.LatheGeometry.prototype=Object.create(m.Geometry.prototype),m.LatheGeometry.prototype.constructor=m.LatheGeometry,m.PlaneGeometry=function(t,e,r,i){m.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new m.PlaneBufferGeometry(t,e,r,i))},m.PlaneGeometry.prototype=Object.create(m.Geometry.prototype),m.PlaneGeometry.prototype.constructor=m.PlaneGeometry,m.PlaneBufferGeometry=function(t,e,r,i){m.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};var n=t/2,o=e/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=t/r,c=e/i;e=new Float32Array(a*s*3),t=new Float32Array(a*s*3);for(var l=new Float32Array(a*s*2),u=0,p=0,d=0;d<s;d++)for(var f=d*c-o,g=0;g<a;g++)e[u]=g*h-n,e[u+1]=-f,t[u+2]=1,l[p]=g/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<e.length/3?Uint32Array:Uint16Array)(r*i*6),d=0;d<i;d++)for(g=0;g<r;g++)o=g+a*(d+1),s=g+1+a*(d+1),h=g+1+a*d,n[u]=g+a*d,n[u+1]=o,n[u+2]=h,n[u+3]=o,n[u+4]=s,n[u+5]=h,u+=6;this.setIndex(new m.BufferAttribute(n,1)),this.addAttribute("position",new m.BufferAttribute(e,3)),this.addAttribute("normal",new m.BufferAttribute(t,3)),this.addAttribute("uv",new m.BufferAttribute(l,2))},m.PlaneBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.PlaneBufferGeometry.prototype.constructor=m.PlaneBufferGeometry,m.RingGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},t=t||0,e=e||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var a,s=[],h=t,c=(e-t)/(i=void 0!==i?Math.max(1,i):8);for(t=0;t<i+1;t++){for(a=0;a<r+1;a++){var l=new m.Vector3,u=n+a/r*o;l.x=h*Math.cos(u),l.y=h*Math.sin(u),this.vertices.push(l),s.push(new m.Vector2((l.x/e+1)/2,(l.y/e+1)/2))}h+=c}for(e=new m.Vector3(0,0,1),t=0;t<i;t++)for(n=t*(r+1),a=0;a<r;a++)o=u=a+n,c=u+r+1,l=u+r+2,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]),o=u,c=u+r+2,l=u+1,this.faces.push(new m.Face3(o,c,l,[e.clone(),e.clone(),e.clone()])),this.faceVertexUvs[0].push([s[o].clone(),s[c].clone(),s[l].clone()]);this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,h)},m.RingGeometry.prototype=Object.create(m.Geometry.prototype),m.RingGeometry.prototype.constructor=m.RingGeometry,m.SphereGeometry=function(t,e,r,i,n,o,a){m.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new m.SphereBufferGeometry(t,e,r,i,n,o,a))},m.SphereGeometry.prototype=Object.create(m.Geometry.prototype),m.SphereGeometry.prototype.constructor=m.SphereGeometry,m.SphereBufferGeometry=function(t,e,r,i,n,o,a){m.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;for(var s=(o=void 0!==o?o:0)+(a=void 0!==a?a:Math.PI),h=(e+1)*(r+1),c=new m.BufferAttribute(new Float32Array(3*h),3),l=new m.BufferAttribute(new Float32Array(3*h),3),h=new m.BufferAttribute(new Float32Array(2*h),2),u=0,p=[],d=new m.Vector3,f=0;f<=r;f++){for(var g=[],v=f/r,y=0;y<=e;y++){var x=y/e,b=-t*Math.cos(i+x*n)*Math.sin(o+v*a),_=t*Math.cos(o+v*a),M=t*Math.sin(i+x*n)*Math.sin(o+v*a);d.set(b,_,M).normalize(),c.setXYZ(u,b,_,M),l.setXYZ(u,d.x,d.y,d.z),h.setXY(u,x,1-v),g.push(u),u++}p.push(g)}for(i=[],f=0;f<r;f++)for(y=0;y<e;y++)n=p[f][y+1],a=p[f][y],u=p[f+1][y],d=p[f+1][y+1],(0!==f||0<o)&&i.push(n,a,d),(f!==r-1||s<Math.PI)&&i.push(a,u,d);this.setIndex(new(65535<c.count?m.Uint32Attribute:m.Uint16Attribute)(i,1)),this.addAttribute("position",c),this.addAttribute("normal",l),this.addAttribute("uv",h),this.boundingSphere=new m.Sphere(new m.Vector3,t)},m.SphereBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.SphereBufferGeometry.prototype.constructor=m.SphereBufferGeometry,m.TextGeometry=function(t,e){var r=(e=e||{}).font;if(0==r instanceof m.Font)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new m.Geometry;r=r.generateShapes(t,e.size,e.curveSegments),e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),m.ExtrudeGeometry.call(this,r,e),this.type="TextGeometry"},m.TextGeometry.prototype=Object.create(m.ExtrudeGeometry.prototype),m.TextGeometry.prototype.constructor=m.TextGeometry,m.TorusGeometry=function(t,e,r,i,n){m.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},t=t||100,e=e||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new m.Vector3,a=[],s=[],h=0;h<=r;h++)for(var c=0;c<=i;c++){var l=c/i*n,u=h/r*Math.PI*2;o.x=t*Math.cos(l),o.y=t*Math.sin(l);var p=new m.Vector3;p.x=(t+e*Math.cos(u))*Math.cos(l),p.y=(t+e*Math.cos(u))*Math.sin(l),p.z=e*Math.sin(u),this.vertices.push(p),a.push(new m.Vector2(c/i,h/r)),s.push(p.clone().sub(o).normalize())}for(h=1;h<=r;h++)for(c=1;c<=i;c++)t=(i+1)*h+c-1,e=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,l=new m.Face3(t,e,o,[s[t].clone(),s[e].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[t].clone(),a[e].clone(),a[o].clone()]),l=new m.Face3(e,n,o,[s[e].clone(),s[n].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[e].clone(),a[n].clone(),a[o].clone()]);this.computeFaceNormals()},m.TorusGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusGeometry.prototype.constructor=m.TorusGeometry,m.TorusKnotGeometry=function(t,e,r,i,n,o,a){function s(t,e,r,i,n){var o=Math.cos(t),a=Math.sin(t);return t*=e/r,e=Math.cos(t),o*=i*(2+e)*.5,a=i*(2+e)*a*.5,i=n*i*Math.sin(t)*.5,new m.Vector3(o,a,i)}m.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},t=t||100,e=e||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=Array(r),c=new m.Vector3,l=new m.Vector3,u=new m.Vector3,p=0;p<r;++p){h[p]=Array(i);var d=s(f=p/r*2*n*Math.PI,o,n,t,a),f=s(f+.01,o,n,t,a);for(c.subVectors(f,d),l.addVectors(f,d),u.crossVectors(c,l),l.crossVectors(u,c),u.normalize(),l.normalize(),f=0;f<i;++f){var g=f/i*2*Math.PI,v=-e*Math.cos(g),g=e*Math.sin(g),y=new m.Vector3;y.x=d.x+v*l.x+g*u.x,y.y=d.y+v*l.y+g*u.y,y.z=d.z+v*l.z+g*u.z,h[p][f]=this.vertices.push(y)-1}}for(p=0;p<r;++p)for(f=0;f<i;++f)n=(p+1)%r,o=(f+1)%i,t=h[p][f],e=h[n][f],n=h[n][o],o=h[p][o],a=new m.Vector2(p/r,f/i),c=new m.Vector2((p+1)/r,f/i),l=new m.Vector2((p+1)/r,(f+1)/i),u=new m.Vector2(p/r,(f+1)/i),this.faces.push(new m.Face3(t,e,o)),this.faceVertexUvs[0].push([a,c,u]),this.faces.push(new m.Face3(e,n,o)),this.faceVertexUvs[0].push([c.clone(),l,u.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TorusKnotGeometry.prototype=Object.create(m.Geometry.prototype),m.TorusKnotGeometry.prototype.constructor=m.TorusKnotGeometry,m.TubeGeometry=function(t,e,r,i,n,o){m.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:r,radialSegments:i,closed:n,taper:o},e=e||64,r=r||1,i=i||8,n=n||!1,o=o||m.TubeGeometry.NoTaper;var a,s,h,c,l,u,p,d,f,g,v=[],y=e+1,x=new m.Vector3;for(f=(d=new m.TubeGeometry.FrenetFrames(t,e,n)).normals,g=d.binormals,this.tangents=d.tangents,this.normals=f,this.binormals=g,d=0;d<y;d++)for(v[d]=[],h=d/(y-1),p=t.getPointAt(h),a=f[d],s=g[d],l=r*o(h),h=0;h<i;h++)c=h/i*2*Math.PI,u=-l*Math.cos(c),c=l*Math.sin(c),x.copy(p),x.x+=u*a.x+c*s.x,x.y+=u*a.y+c*s.y,x.z+=u*a.z+c*s.z,v[d][h]=this.vertices.push(new m.Vector3(x.x,x.y,x.z))-1;for(d=0;d<e;d++)for(h=0;h<i;h++)o=n?(d+1)%e:d+1,y=(h+1)%i,t=v[d][h],r=v[o][h],o=v[o][y],y=v[d][y],x=new m.Vector2(d/e,h/i),f=new m.Vector2((d+1)/e,h/i),g=new m.Vector2((d+1)/e,(h+1)/i),a=new m.Vector2(d/e,(h+1)/i),this.faces.push(new m.Face3(t,r,y)),this.faceVertexUvs[0].push([x,f,a]),this.faces.push(new m.Face3(r,o,y)),this.faceVertexUvs[0].push([f.clone(),g,a.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.TubeGeometry.prototype=Object.create(m.Geometry.prototype),m.TubeGeometry.prototype.constructor=m.TubeGeometry,m.TubeGeometry.NoTaper=function(t){return 1},m.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},m.TubeGeometry.FrenetFrames=function(t,e,r){var i=new m.Vector3,n=[],o=[],a=[],s=new m.Vector3,h=new m.Matrix4;e+=1;var c,l,u;for(this.tangents=n,this.normals=o,this.binormals=a,c=0;c<e;c++)l=c/(e-1),n[c]=t.getTangentAt(l),n[c].normalize();for(o[0]=new m.Vector3,a[0]=new m.Vector3,t=Number.MAX_VALUE,c=Math.abs(n[0].x),l=Math.abs(n[0].y),u=Math.abs(n[0].z),c<=t&&(t=c,i.set(1,0,0)),l<=t&&(t=l,i.set(0,1,0)),u<=t&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),o[0].crossVectors(n[0],s),a[0].crossVectors(n[0],o[0]),c=1;c<e;c++)o[c]=o[c-1].clone(),a[c]=a[c-1].clone(),s.crossVectors(n[c-1],n[c]),s.length()>Number.EPSILON&&(s.normalize(),i=Math.acos(m.Math.clamp(n[c-1].dot(n[c]),-1,1)),o[c].applyMatrix4(h.makeRotationAxis(s,i))),a[c].crossVectors(n[c],o[c]);if(r)for(i=Math.acos(m.Math.clamp(o[0].dot(o[e-1]),-1,1)),i/=e-1,0<n[0].dot(s.crossVectors(o[0],o[e-1]))&&(i=-i),c=1;c<e;c++)o[c].applyMatrix4(h.makeRotationAxis(n[c],i*c)),a[c].crossVectors(n[c],o[c])},m.PolyhedronGeometry=function(t,e,r,i){function n(t){var e=t.normalize().clone();e.index=s.vertices.push(e)-1;var r=Math.atan2(t.z,-t.x)/2/Math.PI+.5;return t=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5,e.uv=new m.Vector2(r,1-t),e}function o(t,e,r,i){i=new m.Face3(t.index,e.index,r.index,[t.clone(),e.clone(),r.clone()],void 0,i),s.faces.push(i),g.copy(t).add(e).add(r).divideScalar(3),i=Math.atan2(g.z,-g.x),s.faceVertexUvs[0].push([a(t.uv,t,i),a(e.uv,e,i),a(r.uv,r,i)])}function a(t,e,r){return 0>r&&1===t.x&&(t=new m.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new m.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}m.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i},r=r||1,i=i||0;for(var s=this,h=0,c=t.length;h<c;h+=3)n(new m.Vector3(t[h],t[h+1],t[h+2]));t=this.vertices;for(var l=[],u=h=0,c=e.length;h<c;h+=3,u++){var p=t[e[h]],d=t[e[h+1]],f=t[e[h+2]];l[u]=new m.Face3(p.index,d.index,f.index,[p.clone(),d.clone(),f.clone()],void 0,u)}for(var g=new m.Vector3,h=0,c=l.length;h<c;h++)!function(t,e){for(var r=Math.pow(2,e),i=n(s.vertices[t.a]),a=n(s.vertices[t.b]),h=n(s.vertices[t.c]),c=[],l=t.materialIndex,u=0;u<=r;u++){c[u]=[];for(var p=n(i.clone().lerp(h,u/r)),d=n(a.clone().lerp(h,u/r)),f=r-u,m=0;m<=f;m++)c[u][m]=0===m&&u===r?p:n(p.clone().lerp(d,m/f))}for(u=0;u<r;u++)for(m=0;m<2*(r-u)-1;m++)i=Math.floor(m/2),0==m%2?o(c[u][i+1],c[u+1][i],c[u][i],l):o(c[u][i+1],c[u+1][i+1],c[u+1][i],l)}(l[h],i);for(h=0,c=this.faceVertexUvs[0].length;h<c;h++)e=this.faceVertexUvs[0][h],i=e[0].x,t=e[1].x,l=e[2].x,u=Math.max(i,t,l),p=Math.min(i,t,l),.9<u&&.1>p&&(.2>i&&(e[0].x+=1),.2>t&&(e[1].x+=1),.2>l&&(e[2].x+=1));for(h=0,c=this.vertices.length;h<c;h++)this.vertices[h].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new m.Sphere(new m.Vector3,r)},m.PolyhedronGeometry.prototype=Object.create(m.Geometry.prototype),m.PolyhedronGeometry.prototype.constructor=m.PolyhedronGeometry,m.DodecahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2,i=1/r;m.PolyhedronGeometry.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,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}},m.DodecahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.DodecahedronGeometry.prototype.constructor=m.DodecahedronGeometry,m.IcosahedronGeometry=function(t,e){var r=(1+Math.sqrt(5))/2;m.PolyhedronGeometry.call(this,[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},m.IcosahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype);m.IcosahedronGeometry.prototype.constructor=m.IcosahedronGeometry,m.OctahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},m.OctahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.OctahedronGeometry.prototype.constructor=m.OctahedronGeometry,m.TetrahedronGeometry=function(t,e){m.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},m.TetrahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.TetrahedronGeometry.prototype.constructor=m.TetrahedronGeometry,m.ParametricGeometry=function(t,e,r){m.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r};var i,n,o,a,s=this.vertices,h=this.faces,c=this.faceVertexUvs[0],l=e+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=e;n++)o=n/e,o=t(o,a),s.push(o);var u,p,d,f;for(i=0;i<r;i++)for(n=0;n<e;n++)t=i*l+n,s=i*l+n+1,a=(i+1)*l+n+1,o=(i+1)*l+n,u=new m.Vector2(n/e,i/r),p=new m.Vector2((n+1)/e,i/r),d=new m.Vector2((n+1)/e,(i+1)/r),f=new m.Vector2(n/e,(i+1)/r),h.push(new m.Face3(t,s,o)),c.push([u,p,f]),h.push(new m.Face3(s,a,o)),c.push([p.clone(),d,f.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.ParametricGeometry.prototype=Object.create(m.Geometry.prototype),m.ParametricGeometry.prototype.constructor=m.ParametricGeometry,m.WireframeGeometry=function(t){function e(t,e){return t-e}m.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(t instanceof m.Geometry){var o=t.vertices,a=t.faces,s=0,h=new Uint32Array(6*a.length);t=0;for(var c=a.length;t<c;t++)for(var l=a[t],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(e);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)i=o[h[2*t+u]],s=6*t+3*u,r[s+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new m.BufferAttribute(r,3))}else if(t instanceof m.BufferGeometry){if(null!==t.index){for(c=t.index.array,o=t.attributes.position,s=0,0===(n=t.groups).length&&t.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,l=n.length;a<l;++a){u=(t=n[a]).start,p=t.count,t=u;for(var d=u+p;t<d;t+=3)for(u=0;3>u;u++)r[0]=c[t+u],r[1]=c[t+(u+1)%3],r.sort(e),p=r.toString(),void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),t=0,c=s;t<c;t++)for(u=0;2>u;u++)s=6*t+3*u,i=h[2*t+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(o=t.attributes.position.array,s=o.length/3,h=s/3,r=new Float32Array(6*s),t=0,c=h;t<c;t++)for(u=0;3>u;u++)s=18*t+6*u,h=9*t+3*u,r[s+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*t+(u+1)%3*3,r[s+3]=o[i],r[s+4]=o[i+1],r[s+5]=o[i+2];this.addAttribute("position",new m.BufferAttribute(r,3))}},m.WireframeGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.WireframeGeometry.prototype.constructor=m.WireframeGeometry,m.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(t=new m.BufferGeometry).addAttribute("position",new m.BufferAttribute(e,3)),t.addAttribute("color",new m.BufferAttribute(r,3)),e=new m.LineBasicMaterial({vertexColors:m.VertexColors}),m.LineSegments.call(this,t,e)},m.AxisHelper.prototype=Object.create(m.LineSegments.prototype),m.AxisHelper.prototype.constructor=m.AxisHelper,m.ArrowHelper=function(){var t=new m.Geometry;t.vertices.push(new m.Vector3(0,0,0),new m.Vector3(0,1,0));var e=new m.CylinderGeometry(0,.5,1,5,1);return e.translate(0,-.5,0),function(r,i,n,o,a,s){m.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),this.line=new m.Line(t,new m.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m.Mesh(e,new m.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),m.ArrowHelper.prototype=Object.create(m.Object3D.prototype),m.ArrowHelper.prototype.constructor=m.ArrowHelper,m.ArrowHelper.prototype.setDirection=function(){var t,e=new m.Vector3;return function(r){.99999<r.y?this.quaternion.set(0,0,0,1):-.99999>r.y?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),m.ArrowHelper.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},m.ArrowHelper.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},m.BoxHelper=function(t){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new m.BufferGeometry;i.setIndex(new m.BufferAttribute(e,1)),i.addAttribute("position",new m.BufferAttribute(r,3)),m.LineSegments.call(this,i,new m.LineBasicMaterial({color:16776960})),void 0!==t&&this.update(t)},m.BoxHelper.prototype=Object.create(m.LineSegments.prototype),m.BoxHelper.prototype.constructor=m.BoxHelper,m.BoxHelper.prototype.update=function(){var t=new m.Box3;return function(e){if(t.setFromObject(e),!t.isEmpty()){e=t.min;var r=t.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=e.x,n[4]=r.y,n[5]=r.z,n[6]=e.x,n[7]=e.y,n[8]=r.z,n[9]=r.x,n[10]=e.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=e.z,n[15]=e.x,n[16]=r.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=r.x,n[22]=e.y,n[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),m.BoundingBoxHelper=function(t,e){var r=void 0!==e?e:8947848;this.object=t,this.box=new m.Box3,m.Mesh.call(this,new m.BoxGeometry(1,1,1),new m.MeshBasicMaterial({color:r,wireframe:!0}))},m.BoundingBoxHelper.prototype=Object.create(m.Mesh.prototype),m.BoundingBoxHelper.prototype.constructor=m.BoundingBoxHelper,m.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},m.CameraHelper=function(t){function e(t,e,i){r(t,i),r(e,i)}function r(t,e){i.vertices.push(new m.Vector3),i.colors.push(new m.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(i.vertices.length-1)}var i=new m.Geometry,n=new m.LineBasicMaterial({color:16777215,vertexColors:m.FaceColors}),o={};e("n1","n2",16755200),e("n2","n4",16755200),e("n4","n3",16755200),e("n3","n1",16755200),e("f1","f2",16755200),e("f2","f4",16755200),e("f4","f3",16755200),e("f3","f1",16755200),e("n1","f1",16755200),e("n2","f2",16755200),e("n3","f3",16755200),e("n4","f4",16755200),e("p","n1",16711680),e("p","n2",16711680),e("p","n3",16711680),e("p","n4",16711680),e("u1","u2",43775),e("u2","u3",43775),e("u3","u1",43775),e("c","t",16777215),e("p","c",3355443),e("cn1","cn2",3355443),e("cn3","cn4",3355443),e("cf1","cf2",3355443),e("cf3","cf4",3355443),m.LineSegments.call(this,i,n),this.camera=t,this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},m.CameraHelper.prototype=Object.create(m.LineSegments.prototype),m.CameraHelper.prototype.constructor=m.CameraHelper,m.CameraHelper.prototype.update=function(){function t(t,o,a,s){if(i.set(o,a,s).unproject(n),void 0!==(t=r[t]))for(o=0,a=t.length;o<a;o++)e.vertices[t[o]].copy(i)}var e,r,i=new m.Vector3,n=new m.Camera;return function(){e=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.verticesNeedUpdate=!0}}(),m.DirectionalLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var r=new m.Geometry;r.vertices.push(new m.Vector3(-e,e,0),new m.Vector3(e,e,0),new m.Vector3(e,-e,0),new m.Vector3(-e,-e,0),new m.Vector3(-e,e,0));var i=new m.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new m.Line(r,i),this.add(this.lightPlane),(r=new m.Geometry).vertices.push(new m.Vector3,new m.Vector3),(i=new m.LineBasicMaterial({fog:!1})).color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new m.Line(r,i),this.add(this.targetLine),this.update()},m.DirectionalLightHelper.prototype=Object.create(m.Object3D.prototype),m.DirectionalLightHelper.prototype.constructor=m.DirectionalLightHelper,m.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},m.DirectionalLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),m.EdgesHelper=function(t,e,r){e=void 0!==e?e:16777215,m.LineSegments.call(this,new m.EdgesGeometry(t.geometry,r),new m.LineBasicMaterial({color:e})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.EdgesHelper.prototype=Object.create(m.LineSegments.prototype),m.EdgesHelper.prototype.constructor=m.EdgesHelper,m.FaceNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16776960,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.FaceNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.FaceNormalsHelper.prototype.constructor=m.FaceNormalsHelper,m.FaceNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=0,h=0,c=(o=o.faces).length;h<c;h++){var l=o[h],u=l.normal;t.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),e.copy(u).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),n.setXYZ(s,t.x,t.y,t.z),s+=1,n.setXYZ(s,e.x,e.y,e.z),s+=1}return n.needsUpdate=!0,this}}(),m.GridHelper=function(t,e){var r=new m.Geometry,i=new m.LineBasicMaterial({vertexColors:m.VertexColors});this.color1=new m.Color(4473924),this.color2=new m.Color(8947848);for(var n=-t;n<=t;n+=e){r.vertices.push(new m.Vector3(-t,0,n),new m.Vector3(t,0,n),new m.Vector3(n,0,-t),new m.Vector3(n,0,t));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}m.LineSegments.call(this,r,i)},m.GridHelper.prototype=Object.create(m.LineSegments.prototype),m.GridHelper.prototype.constructor=m.GridHelper,m.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},m.HemisphereLightHelper=function(t,e){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new m.Color,new m.Color];var r=new m.SphereGeometry(e,4,2);r.rotateX(-Math.PI/2);for(var i=0;8>i;i++)r.faces[i].color=this.colors[4>i?0:1];i=new m.MeshBasicMaterial({vertexColors:m.FaceColors,wireframe:!0}),this.lightSphere=new m.Mesh(r,i),this.add(this.lightSphere),this.update()},m.HemisphereLightHelper.prototype=Object.create(m.Object3D.prototype),m.HemisphereLightHelper.prototype.constructor=m.HemisphereLightHelper,m.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},m.HemisphereLightHelper.prototype.update=function(){var t=new m.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),m.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var r=new m.SphereGeometry(e,4,2),i=new m.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),m.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},m.PointLightHelper.prototype=Object.create(m.Mesh.prototype),m.PointLightHelper.prototype.constructor=m.PointLightHelper,m.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},m.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},m.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new m.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof m.Bone&&(e.vertices.push(new m.Vector3),e.vertices.push(new m.Vector3),e.colors.push(new m.Color(0,0,1)),e.colors.push(new m.Color(0,1,0)));e.dynamic=!0,r=new m.LineBasicMaterial({vertexColors:m.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),m.LineSegments.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},m.SkeletonHelper.prototype=Object.create(m.LineSegments.prototype),m.SkeletonHelper.prototype.constructor=m.SkeletonHelper,m.SkeletonHelper.prototype.getBoneList=function(t){var e=[];t instanceof m.Bone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},m.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,e=(new m.Matrix4).getInverse(this.root.matrixWorld),r=new m.Matrix4,i=0,n=0;n<this.bones.length;n++){var o=this.bones[n];o.parent instanceof m.Bone&&(r.multiplyMatrices(e,o.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(e,o.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},m.SpotLightHelper=function(t){m.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,(t=new m.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),t.rotateX(-Math.PI/2);var e=new m.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new m.Mesh(t,e),this.add(this.cone),this.update()},m.SpotLightHelper.prototype=Object.create(m.Object3D.prototype),m.SpotLightHelper.prototype.constructor=m.SpotLightHelper,m.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},m.SpotLightHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,i=r*Math.tan(this.light.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),m.VertexNormalsHelper=function(t,e,r,i){this.object=t,this.size=void 0!==e?e:1,t=void 0!==r?r:16711680,i=void 0!==i?i:1,e=0,(r=this.object.geometry)instanceof m.Geometry?e=3*r.faces.length:r instanceof m.BufferGeometry&&(e=r.attributes.normal.count),r=new m.BufferGeometry,e=new m.Float32Attribute(6*e,3),r.addAttribute("position",e),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:t,linewidth:i})),this.matrixAutoUpdate=!1,this.update()},m.VertexNormalsHelper.prototype=Object.create(m.LineSegments.prototype),m.VertexNormalsHelper.prototype.constructor=m.VertexNormalsHelper,m.VertexNormalsHelper.prototype.update=function(){var t=new m.Vector3,e=new m.Vector3,r=new m.Matrix3;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var n=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a instanceof m.Geometry)for(var s=a.vertices,h=a.faces,c=a=0,l=h.length;c<l;c++)for(var u=h[c],p=0,d=u.vertexNormals.length;p<d;p++){var f=u.vertexNormals[p];t.copy(s[u[i[p]]]).applyMatrix4(n),e.copy(f).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1}else if(a instanceof m.BufferGeometry)for(i=a.attributes.position,s=a.attributes.normal,p=a=0,d=i.count;p<d;p++)t.set(i.getX(p),i.getY(p),i.getZ(p)).applyMatrix4(n),e.set(s.getX(p),s.getY(p),s.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),o.setXYZ(a,t.x,t.y,t.z),a+=1,o.setXYZ(a,e.x,e.y,e.z),a+=1;return o.needsUpdate=!0,this}}(),m.WireframeHelper=function(t,e){var r=void 0!==e?e:16777215;m.LineSegments.call(this,new m.WireframeGeometry(t.geometry),new m.LineBasicMaterial({color:r})),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},m.WireframeHelper.prototype=Object.create(m.LineSegments.prototype),m.WireframeHelper.prototype.constructor=m.WireframeHelper,m.ImmediateRenderObject=function(t){m.Object3D.call(this),this.material=t,this.render=function(t){}},m.ImmediateRenderObject.prototype=Object.create(m.Object3D.prototype),m.ImmediateRenderObject.prototype.constructor=m.ImmediateRenderObject,m.MorphBlendMesh=function(t,e){m.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length;this.createAnimation("__default",0,r-1,r/1),this.setAnimationWeight("__default",1)},m.MorphBlendMesh.prototype=Object.create(m.Mesh.prototype),m.MorphBlendMesh.prototype.constructor=m.MorphBlendMesh,m.MorphBlendMesh.prototype.createAnimation=function(t,e,r,i){e={start:e,end:r,length:r-e+1,fps:i,duration:(r-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[t]=e,this.animationsList.push(e)},m.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,i={},n=this.geometry,o=0,a=n.morphTargets.length;o<a;o++){var s=n.morphTargets[o].name.match(r);if(s&&1<s.length){var h=s[1];i[h]||(i[h]={start:1/0,end:-1/0}),o<(s=i[h]).start&&(s.start=o),o>s.end&&(s.end=o),e||(e=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.end,t);this.firstAnimation=e},m.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){(t=this.animationsMap[t])&&(t.direction=1,t.directionBackwards=!1)},m.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){(t=this.animationsMap[t])&&(t.direction=-1,t.directionBackwards=!0)},m.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},m.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},m.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},m.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},m.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0;return(t=this.animationsMap[t])&&(e=t.time),e},m.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1;return(t=this.animationsMap[t])&&(e=t.duration),e},m.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},m.MorphBlendMesh.prototype.stopAnimation=function(t){(t=this.animationsMap[t])&&(t.active=!1)},m.MorphBlendMesh.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||0>i.time)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),0>i.time&&(i.time=0,i.directionBackwards=!1)):(i.time%=i.duration,0>i.time&&(i.time+=i.duration));var o=i.start+m.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o),n=i.time%n/n,i.directionBackwards&&(n=1-n),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=n*a,this.morphTargetInfluences[i.lastFrame]=(1-n)*a):this.morphTargetInfluences[i.currentFrame]=a}}};var g=function(){function t(){}return t.prototype.webgl=function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}},t}();d.prototype={VERSION:"2.2.0",defaults:{imageCloud:"",cloudSpeed:1,skyColor:"#ffffff",skyColorPower:50,cameraControl:!1,cameraXSpeed:.01,cameraYSpeed:.02,cloudData:[]},cameraNearClipPlane:1,cameraFarClipPlane:1e3,vFOV:60,init:function(t,e){this.container=t,this.config=e,this.create()},create:function(){if(!this.util().webgl())throw Error("Your browser does not support WebGL.");this.resetListeners(),this.resetScene(),this.load()},load:function(){var e={};e.cloud=this.config.imageCloud;var r=0,i=0;for(var n in e)e.hasOwnProperty(n)&&r++;for(var n in e)if(e.hasOwnProperty(n)){var o=new XMLHttpRequest;o.open("GET",e[n],!0),o.crossOrigin="Anonymous",o.responseType="arraybuffer",o.customKey=n,o.onload=t.proxy(function(n){var o=n.currentTarget;if(o.status>=400)return o.onerror(n);var a=new Blob([o.response]),s=new Image;s.src=window.URL.createObjectURL(a),s.onload=t.proxy(function(t){e[t.customKey]=s,++i==r&&(this.applyListeners(),this.buildScene(e),this.renderScene())},this,o)},this),o.onerror=t.proxy(function(t){var e=t.currentTarget;throw Error("Cannot load resource "+e.responseURL+". Status code ["+e.status+"]")},this),o.send()}},buildScene:function(t){var e=this.container.width(),r=this.container.height();this.aspect=e/r,this.scene=new m.Scene,this.camera=new m.PerspectiveCamera(this.vFOV,this.aspect,this.cameraNearClipPlane,this.cameraFarClipPlane),this.camera.position.z=this.cameraFarClipPlane,this.scene.add(this.camera);var i=this.createTexture(t,"cloud");this.buildClouds(i),this.renderer=new m.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,r),this.container.append(this.renderer.domElement)},buildClouds:function(t){var e={uniforms:{texCloud:{type:"t",value:null},skyColor:{type:"c",value:null},fogFar:{type:"f",value:null},fogNear:{type:"f",value:null},horizonLength:{type:"f",value:null}},vs:["varying vec2 vUv;","void main()","{","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fs:["uniform sampler2D texCloud;","uniform vec3 skyColor;","uniform float fogFar;","uniform float fogNear;","uniform float horizonLength;","varying vec2 vUv;","void main()","{","float distance = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = smoothstep( fogNear, fogFar, distance );","gl_FragColor = texture2D( texCloud, vUv );","if(distance >= (horizonLength - 200.0)) {","gl_FragColor.a *= 1.0 - ((distance - (horizonLength - 200.0)) / 200.0);","} else if(distance <= 200.0) {","gl_FragColor.a *= (distance / 200.0);","}","gl_FragColor = mix( gl_FragColor, vec4( skyColor, gl_FragColor.w ), fogFactor );","}"].join("\n")};e.uniforms.texCloud.value=t;var r=1-.01*Math.min(Math.max(parseInt(this.config.skyColorPower,10),0),100),i=new m.Fog(this.config.skyColor,this.cameraFarClipPlane*r,this.cameraFarClipPlane);e.uniforms.skyColor.value=i.color,e.uniforms.fogFar.value=i.far,e.uniforms.fogNear.value=i.near,e.uniforms.horizonLength.value=this.cameraFarClipPlane;for(var n=new m.ShaderMaterial({uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,depthWrite:!1,depthTest:!1,transparent:!0}),o=Math.tan(this.vFOV/2*Math.PI/180)*this.cameraFarClipPlane*2*2,a=o*this.aspect,s=new m.Geometry,h=0;h<this.cameraFarClipPlane;h++){for(var c=new m.PlaneGeometry(128,128),l=Math.random()*a-a/2,u=-Math.random()*Math.random()*o/40-o/20,p=h,d=Math.random()*Math.PI,f=2*Math.random()+.5,g=0;g<this.config.cloudData.length;g++)if(this.config.cloudData[g].i==h){var v=this.config.cloudData[g];v.hasOwnProperty("x")&&(l=v.x*a-a/2),v.hasOwnProperty("y")&&(u=v.y*o-o/2),v.hasOwnProperty("rotate")&&(d=v.rotate*Math.PI),v.hasOwnProperty("scale")&&(f=v.scale);break}c.center(),c.rotateZ(d),c.scale(f,f,1),c.translate(l,u,p),s.merge(c)}var y=new m.Mesh(s,n);this.scene.add(y),(y=new m.Mesh(s,n)).position.z=-this.cameraFarClipPlane,this.scene.add(y)},resetScene:function(){this.animationId&&cancelAnimationFrame(this.animationId),this.renderer=null,this.scene=null,this.camera=null,this.container.empty()},renderScene:function(){this.animationId=requestAnimationFrame(t.proxy(this.renderScene,this)),this.camera.position.z-=this.config.cloudSpeed,this.camera.position.z<0&&(this.camera.position.z=this.cameraFarClipPlane),this.camera.position.x+=(this.cameraX.value-this.camera.position.x)*this.config.cameraXSpeed,this.camera.position.y+=(this.cameraY.value-this.camera.position.y)*this.config.cameraYSpeed,this.camera.rotation.z+=.05*(this.cameraRotation.value-this.camera.rotation.z),this.renderer.render(this.scene,this.camera)},pause:function(){this.animationId&&cancelAnimationFrame(this.animationId)},play:function(){this.renderScene()},applyListeners:function(){this.config.cameraControl&&(this.container.on("mousemove.clouds",t.proxy(this.onMouseMove,this)),this.container.on("touchmove.clouds",t.proxy(this.onMouseMove,this))),t(window).on("resize.clouds",t.proxy(this.onWindowResize,this))},resetListeners:function(){this.container.off("mousemove.clouds"),this.container.off("touchmove.clouds"),t(window).off("resize.clouds")},onMouseMove:function(t){var e=this.getMousePositionPower("touchmove"==t.type?t.originalEvent.targetTouches[0]:t);this.cameraX.value=e.x<0?e.x*Math.abs(this.cameraX.min):e.x*Math.abs(this.cameraX.max),this.cameraY.value=e.y<0?e.y*Math.abs(this.cameraY.min):e.y*Math.abs(this.cameraY.max),this.cameraRotation.value=.03*e.x},onWindowResize:function(t){this.aspect=this.container.width()/this.container.height(),this.camera.aspect=this.aspect,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.container.width(),this.container.height())},destroy:function(){this.resetListeners(),this.resetScene()},getMousePositionPower:function(t){var e=this.container.get(0).getBoundingClientRect(),r={},i=(e.right-e.left)/2,n=(e.bottom-e.top)/2,o=this.container.offset();return r.x=(t.pageX-o.left-i)/i,r.y=(n-(t.pageY-o.top))/n,r},createTexture:function(t,e){var r=new m.Texture;return r.image=t[e],r.needsUpdate=!0,r},util:function(){return null!=this._util?this._util:this._util=new g}},t.clouds=function(t,e){if("support"==t)return new g,!!this.util().webgl()},t.fn.clouds=function(e,r){return this.each(function(){var r=t(this),i=r.data("clouds"),n=t.isPlainObject(e)?e:{};if("destroy"!=e)if("pause"!=e)if("play"!=e)if(i){var o=t.extend({},i.config,n);i.init(r,o)}else i=new d(r,o=t.extend({},d.prototype.defaults,n)),r.data("clouds",i);else{if(!i)throw Error("Calling 'play' method on not initialized instance is forbidden");i.play()}else{if(!i)throw Error("Calling 'pause' method on not initialized instance is forbidden");i.pause()}else{if(!i)throw Error("Calling 'destroy' method on not initialized instance is forbidden");i.destroy()}})};var v={imageCloud:weather_press_data_from_php.weather_press_Plugin_Path+"/public/images/cloud-white.png",skyColor:"#8c9793",skyColorPower:100,cloudSpeed:1.5,cameraControl:!0,cloudData:[{i:0,x:.5,y:.4,scale:3},{i:150,x:.5,y:.4,scale:5},{i:300,x:.5,y:.4,scale:6},{i:450,x:.5,y:.4,scale:6},{i:600,x:.5,y:.4,scale:7},{i:10,x:.35,y:.45,scale:2},{i:160,x:.35,y:.45,scale:4},{i:310,x:.35,y:.45,scale:5},{i:460,x:.35,y:.45,scale:5},{i:610,x:.35,y:.45,scale:6},{i:20,x:.65,y:.45,scale:2},{i:170,x:.65,y:.45,scale:4},{i:320,x:.65,y:.45,scale:5},{i:470,x:.65,y:.45,scale:5},{i:620,x:.65,y:.45,scale:6}]};t("#weather_press_scene_container").clouds(v)}})}(jQuery);
  • weather-press/trunk/public/js/weather-press-public.js

    r1759591 r1760185  
    286286                        $('.weather-press-block-bottom').addClass('night-background');
    287287                        $('.weather-press-block-middle').addClass('night-background');
     288                        console.log('night');
     289
     290                    } else {
     291
     292                        $('.weather-press-block-bottom').removeClass('night-background');
     293                        $('.weather-press-block-middle').removeClass('night-background');
     294                        console.log('day');
    288295                    }
    289296
Note: See TracChangeset for help on using the changeset viewer.