Plugin Directory

Changeset 1820020


Ignore:
Timestamp:
02/11/2018 04:08:53 PM (8 years ago)
Author:
geagoir
Message:

V 4.6 trunk

Location:
weather-press/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • weather-press/trunk/README.txt

    r1796617 r1820020  
    44Tags: weather, forecast, widgets, local weather, world weather
    55Requires at least: 3.3
    6 Tested up to: 4.9.1
    7 Stable tag: 4.5
     6Tested up to: 4.9.4
     7Stable tag: 4.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    180180== Changelog ==
    181181
     182= 4.6 =
     183* Performance improvement
     184
    182185= 4.5 =
    183186* Get The All New weather press Layout !
     
    229232== Upgrade Notice ==
    230233
     234= 4.6 =
     235* If you update to this version you must generate a NEW XML configuration file !
     236
    231237= 4.5 =
    232238important update, Get The All New weather press Layout !
  • weather-press/trunk/admin/class-weather-press-admin.php

    r1760185 r1820020  
    427427                if( !in_array( $_SERVER['REMOTE_ADDR'], $not_Sent_Urls ) ) {
    428428
    429                     @wp_mail( 'geagoir@gmail.com', 'New Free weather press user website url ( Free V 4.5 ) : ', get_site_url(). ' FROM : ' .$weather_press_newUser );
     429                    @wp_mail( 'geagoir@gmail.com', 'New Free weather press user website url ( Free V 4.6 ) : ', get_site_url(). ' FROM : ' .$weather_press_newUser );
    430430                }
    431431
  • weather-press/trunk/includes/class-weather-press-fetcher.php

    r1759591 r1820020  
    7373        $this->appid = '80c0790d1b594ea812167776d6215ecd';// since 4.0 rises
    7474       
    75         $this->weatherurl = 'http://api.openweathermap.org/data/2.5/weather?q=';
    76 
    77         $this->weather_press_dailyForecast_url = 'http://api.openweathermap.org/data/2.5/forecast/daily?q=';
    78 
    79         $this->weatherforecastsurl = 'http://api.openweathermap.org/data/2.5/forecast?q=';
     75        $this->weatherurl = 'http://api.openweathermap.org/data/2.5/weather';
     76
     77        $this->weather_press_dailyForecast_url = 'http://api.openweathermap.org/data/2.5/forecast/daily';
     78
     79        $this->weatherforecastsurl = 'http://api.openweathermap.org/data/2.5/forecast';
    8080    }
    8181
     
    8787     * @param      string    $city    Get the current weather data for a specific city.
    8888     */
    89     public function getCurrentWeatherData( $city, $unit = 'metric' ) {
     89    public function getCurrentWeatherData( $city, $unit = 'metric', $id ) {
    9090
    9191        $weatherurl = $this->weatherurl;
     
    9595          {
    9696            //  isValidUrl() return the weather data that we need or  a custom error message
    97             $data = $this->isValidUrl( $weatherurl, $city, $unit, $nbrDays = 1 );
     97            $data = $this->isValidUrl( $weatherurl, $city, $unit, $nbrDays = 1, $id );
    9898            $city=$data['name'];
    9999            //current weather temperature and icon             
     
    111111        catch (Exception $e)
    112112          {
    113             return $this->isValidUrl( $weatherurl, $city, $unit, $nbrDays = 1 );
     113            return $this->isValidUrl( $weatherurl, $city, $unit, $nbrDays = 1, $id );
    114114          }             
    115115    }
     
    123123     * @param      string    $city    Get the weather forecast data for a specific city and for a specific number of days : 1 <= $nbrDays <= 16.
    124124     */     
    125     public function getWeatherDailyForecast( $city, $unit='metric', $nbrDays = 1, $lang ) {
     125    public function getWeatherDailyForecast( $city, $unit='metric', $nbrDays = 1, $lang, $id ) {
    126126
    127127        $weather_press_dailyForecast_url = $this->weather_press_dailyForecast_url;
     
    131131        try  {
    132132
    133             $data = $this->isValidUrl( $weather_press_dailyForecast_url, $city, $unit, $nbrDays );
     133            $data = $this->isValidUrl( $weather_press_dailyForecast_url, $city, $unit, $nbrDays, $id );
    134134
    135135            $forecasts = array();
     
    169169        } catch ( Exception $e ) {
    170170
    171             return $this->isValidUrl( $weather_press_dailyForecast_url, $city, $unit, $nbrDays );
     171            return $this->isValidUrl( $weather_press_dailyForecast_url, $city, $unit, $nbrDays, $id );
    172172        }               
    173173    }
     
    229229     * @param      string    $city    Get the weather hourly forecast data for a specific city.
    230230     */     
    231     public function getWeatherHourlyForecast( $city, $unit='metric' ) {
     231    public function getWeatherHourlyForecast( $city, $unit='metric', $id ) {
    232232       
    233233        $weatherforecastsurl = $this->weatherforecastsurl;
     
    237237        try
    238238          {
    239             $data = $this->isValidUrl( $weatherforecastsurl, $city, $unit, $nbrDays = 4 );
     239            $data = $this->isValidUrl( $weatherforecastsurl, $city, $unit, $nbrDays = 4, $id );
    240240           
    241241            $city = $data['city']['name'];
     
    267267        catch (Exception $e)
    268268          {
    269             return $this->isValidUrl( $weatherforecastsurl, $city, $unit, $nbrDays = 4 );
     269            return $this->isValidUrl( $weatherforecastsurl, $city, $unit, $nbrDays = 4, $id );
    270270          }             
    271271    }   
     
    281281     * @param      string    $city    This function handle the OpenWeatherMap response provided by URL.
    282282     */     
    283     private function isValidUrl( $url, $city, $unit = 'metric', $nbrDays ) {
     283    private function isValidUrl( $url, $city, $unit = 'metric', $nbrDays, $id = null ) {
    284284       
    285285        if( empty( $city ) ) {
     
    295295        }           
    296296
    297         $result = $url . $city . '&units=' . $unit . '&cnt=' . $nbrDays . '&APPID=' . $this->appid;
     297        if( $id !== null ){
     298
     299            $url_extension = '?id=' . $id;
     300
     301        } else {
     302
     303            $url_extension = '?q=' . $city;
     304        }
     305       
     306        $result = $url . $url_extension . '&units=' . $unit . '&cnt=' . $nbrDays . '&APPID=' . $this->appid;
    298307        $remote_get = wp_remote_get( $result );
    299308       
  • weather-press/trunk/includes/class-weather-press.php

    r1759591 r1820020  
    6969
    7070        $this->plugin_name = 'weather-press';
    71         $this->version = '4.5';
     71        $this->version = '4.6';
    7272
    7373        $this->load_dependencies();
  • weather-press/trunk/public/class-weather-press-public.php

    r1759591 r1820020  
    227227        // Get the city name
    228228        $city = isset($_REQUEST['city']) ? $_REQUEST['city'] : 'tunis';
     229        $city_id = isset($_REQUEST['city_id']) ? $_REQUEST['city_id'] : 2464470;
    229230   
    230231        // Get the temperature unit
     
    262263                        if( false === ( $weather_press_transient_response = get_transient( 'weather_press_'. $weather_press_transient_name .'_current_transient' ) ) ) {
    263264                       
    264                             $weather_press_weather_response = $weather_press_content_fetcher->getCurrentWeatherData( $city, $unit );
     265                            $weather_press_weather_response = $weather_press_content_fetcher->getCurrentWeatherData( $city, $unit, $city_id );
    265266
    266267                            set_transient( 'weather_press_'. $weather_press_transient_name .'_current_transient', $weather_press_weather_response, MINUTE_IN_SECONDS * $weather_press_Cache );
     
    273274                    } else {
    274275                       
    275                         $weather_press_weather_response = $weather_press_content_fetcher->getCurrentWeatherData( $city, $unit );
     276                        $weather_press_weather_response = $weather_press_content_fetcher->getCurrentWeatherData( $city, $unit, $city_id );
    276277                    }                   
    277278                    break;
     
    284285                        if( false === ( $weather_press_transient_response = get_transient( 'weather_press_'. $weather_press_transient_name .'_hourly_transient' ) ) ) {
    285286                       
    286                             $weather_press_weather_response = $weather_press_content_fetcher->getWeatherHourlyForecast( $city, $unit );
     287                            $weather_press_weather_response = $weather_press_content_fetcher->getWeatherHourlyForecast( $city, $unit, $city_id );
    287288
    288289                            set_transient( 'weather_press_'. $weather_press_transient_name .'_hourly_transient', $weather_press_weather_response, MINUTE_IN_SECONDS * $weather_press_Cache );
     
    295296                    } else {
    296297                       
    297                         $weather_press_weather_response = $weather_press_content_fetcher->getWeatherHourlyForecast( $city, $unit );
     298                        $weather_press_weather_response = $weather_press_content_fetcher->getWeatherHourlyForecast( $city, $unit, $city_id );
    298299                    }
    299300                    break;
     
    306307                        if( false === ( $weather_press_transient_response = get_transient( 'weather_press_'. $weather_press_transient_name .'_daily_transient' ) ) ) {
    307308                       
    308                             $weather_press_weather_response = $weather_press_content_fetcher->getWeatherDailyForecast( $city, $unit, $nbrDays, $language );
     309                            $weather_press_weather_response = $weather_press_content_fetcher->getWeatherDailyForecast( $city, $unit, $nbrDays, $language, $city_id );
    309310
    310311                            set_transient( 'weather_press_'. $weather_press_transient_name .'_daily_transient', $weather_press_weather_response, MINUTE_IN_SECONDS * $weather_press_Cache );
     
    317318                    } else {
    318319                       
    319                         $weather_press_weather_response = $weather_press_content_fetcher->getWeatherDailyForecast( $city, $unit, $nbrDays, $language );
     320                        $weather_press_weather_response = $weather_press_content_fetcher->getWeatherDailyForecast( $city, $unit, $nbrDays, $language, $city_id );
    320321                    }
    321322                    break;
     
    362363        $mainImage = $xpath->query( "//mainlocation/city" )->item(0)->getAttribute('image');
    363364        $wpress_Main_Location = $this->weather_Press_Styling (  $mainName, $mainImage );
     365
     366        $mainid = $xpath->query( "//mainlocation/alternativeCity" )->item(0)->nodeValue;
     367        $mainImageid = $xpath->query( "//mainlocation/alternativeCity" )->item(0)->getAttribute('image');
     368        $wpress_Main_Location_id = $this->weather_Press_Styling (  $mainid, $mainImageid );
    364369           
    365370        $secondary2Name = $xpath->query( "//location[@number=1]/city" )->item(0)->nodeValue;
    366371        $secondary2Image = $xpath->query( "//location[@number=1]/city" )->item(0)->getAttribute('image');
    367372        $wpress_Secondary_Location_Bottom = $this->weather_Press_Styling (  $secondary2Name, $secondary2Image );
     373
     374        $secondary2id = $xpath->query( "//location[@number=1]/alternativeCity" )->item(0)->nodeValue;
     375        $secondary2Imageid = $xpath->query( "//location[@number=1]/alternativeCity" )->item(0)->getAttribute('image');
     376        $wpress_Secondary_Location_Bottom_id = $this->weather_Press_Styling (  $secondary2id, $secondary2Imageid );
    368377   
    369378    } catch( Exception $e ) {
     
    371380//  NOTE THAT Exceptions will be automatically rendered by the class-weather-press-fetcher.php in weather-press/includes //
    372381
    373        
    374382       // PHP variables fallback
    375 
    376383        $weather_press_Current_Language = 'EN';
    377        
     384
    378385        $weather_press_Current_Unit = 'metric';
    379        
    380         $wpress_Main_Location = '';
    381        
    382         $wpress_Secondary_Location_Bottom = '';
    383 
    384     }
    385 
    386    
     386
     387        $wpress_Main_Location    = '';
     388        $wpress_Main_Location_id = 2464470;
     389
     390        $wpress_Secondary_Location_Bottom    = '';
     391        $wpress_Secondary_Location_Bottom_id = 2464470;
     392
     393    }
     394
    387395    include 'partials/weather-press-public-display.php';
    388396
  • weather-press/trunk/public/js/weather-press-public-min.js

    r1760185 r1820020  
    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"),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);
     2!function(e){"use strict";e(document).ready(function(){if(console.log("THANK YOU FOR CHOOSING WEATHER PRESS, V4.6"),e("#weather-press-layoutContainer").length){var t,r,i=null,n=e(".weather-press-block-bottom").width(),o=0;e("#weather-press-forecast-loader").css("left",n+7),e(".weather-press-cities-list li").each(function(i,n){if(e(n).hasClass("main-location"))return t=i,r=e(n).position().top.toFixed(2),e("#weather-press-city-name").text(e(n).text()),e("#weather-press-city-name").attr("title",e(n).text()),!1}),e("#weather-press-display-image").click(function(){e(".weather-press-cities-list").css("margin-top");e(".weather-press-block-bottom").toggleClass("weather-press-block-bottom-marginTop"),e(".weather-press-block-middle img").fadeToggle("slow","linear")}),e(".weather-press-closeIcon").click(function(){var t=e(this).attr("data-weatherpressclose");e("."+t).removeClass("flipInX"),e("."+t).addClass("flipOutX"),"weather-press-dailyForecast"==t?e(".weather-press-forecasts ul li").each(function(t,r){e(r).removeClass("weather-press-forecast-active"),0==t&&e(r).addClass("weather-press-forecast-active")}):"weather-press-loader"==t&&(e(".weather-press-outputs-content").text("Loading ..."),e(".weather-press-outputs-toPremium").css("opacity","0"),e(".weather-press-cities-nav-container").css("display","block"),null!=i&&i.abort())}),e("#weather-press-cities-navs-top").click(function(){a(t+1)}),e("#weather-press-cities-navs-bottom").click(function(){a(t-1)});var a=function(i){var n,o=e(".weather-press-cities-list li").length;e(".weather-press-cities-list li").each(function(a,s){if(a==i&&a<o&&a>=0)return t=a,e("#weather-press-city-name").text(e(s).text()),e("#weather-press-city-name").attr("title",e(s).text()),e(s).removeClass(),e(s).addClass("main-location"),n=e(s).position().top.toFixed(2),e(".weather-press-cities-list").css("margin-top",r-n),e(".weather-press-cities-list li:eq("+(a-1)+")").length&&e(".weather-press-cities-list li:eq("+(a-1)+")").removeClass(),e(".weather-press-cities-list li:eq("+(a-2)+")").length&&(e(".weather-press-cities-list li:eq("+(a-2)+")").removeClass(),e(".weather-press-cities-list li:eq("+(a-2)+")").addClass("deep")),e(".weather-press-cities-list li:eq("+(a+1)+")").length&&e(".weather-press-cities-list li:eq("+(a+1)+")").removeClass(),e(".weather-press-cities-list li:eq("+(a+2)+")").length&&(e(".weather-press-cities-list li:eq("+(a+2)+")").removeClass(),e(".weather-press-cities-list li:eq("+(a+2)+")").addClass("deep")),!1})},s=function(t){var r;1==t?3>o?(r=-1*++o*(n+7),e(".weather-press-forecast-list").css("left",r),e(".weather-press-block-bottom").addClass("initial-background")):h(1):-1==t&&(o>0?(r=-1*--o*(n+7),e(".weather-press-forecast-list").css("left",r),0==o&&e(".weather-press-block-bottom").removeClass("initial-background")):h(-1))},h=function(t){var r,i,o;1==t?(r=-3*(n+7),i=parseInt(r)-10,clearTimeout(o),e(".weather-press-forecast-list").css("left",i),o=setTimeout(function(){e(".weather-press-forecast-list").css("left",r)},300)):-1==t&&(clearTimeout(o),e(".weather-press-forecast-list").css("left",10),o=setTimeout(function(){e(".weather-press-forecast-list").css("left",0)},300))},c=function(){e("#weather-press-loader").removeClass("flipOutX"),e("#weather-press-loader").addClass("flipInX"),e(".weather-press-cities-nav-container").css("display","none"),e(".weather-press-forecast-list").css("left",0),o=0,e(".weather-press-block-bottom").removeClass("initial-background")};e(".weather-press-cities-list li").click(function(){a(e(this).index()),l(e(this),1),p(e(this),1)}),e("#weather-press-city-name").click(function(){l(e(".weather-press-cities-list .main-location"),1),p(e(".weather-press-cities-list .main-location"),1)}),e("#weather-press-forecast-navs-right").click(function(){s(1)}),e("#weather-press-forecast-navs-left").click(function(){s(-1)});var l=function(t,r){c(),i=e.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(t.text().toLowerCase()),city_id:t.attr("data-city"),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=null!=r.temp?r.temp:"00",n=null!=r.temp_min?r.temp_min:"00",o=null!=r.temp_max?r.temp_max:"00",s=null!=r.icon?r.icon:"undefined";e(".weather-press-forecast-list li:first-child .weather-press-temp").text(i+"°"),e(".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"),e(".weather-press-forecast-list li:first-child .weather-press-min-temp").text(n+"°"),e(".weather-press-forecast-list li:first-child .weather-press-max-temp").text(o+"°"),s.indexOf("n")>=0&&"undefined"!=s?(e(".weather-press-block-bottom").addClass("night-background"),e(".weather-press-block-middle").addClass("night-background"),console.log("night")):(e(".weather-press-block-bottom").removeClass("night-background"),e(".weather-press-block-middle").removeClass("night-background"),console.log("day")),a(t.index()),f(),e(".weather-press-cities-nav-container").css("display","block")},error:function(t){console.log(t);var r=JSON.stringify(t.responseText).substring(1,JSON.stringify(t.responseText).length-1);e(".weather-press-outputs-content").text("Error : "+r)}})},u=0,p=function(t,r){e.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(t.text().toLowerCase()),city_id:t.attr("data-city"),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;e.each(i,function(c,l){if(c>0)if(n=i[c].date,o=i[c].maxtemp,a=i[c].mintemp,s=i[c].daytemp,h=i[c].icon,n)1==c&&e(".weather-press-forecast-list > li").length>1&&e(".weather-press-forecast-list > li:not(:first)").remove(),e("<li id='weather_press_forecast_node_"+c+"'><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_"+(c-1));else if(u<=2){for(var d=1;c<4;d++)e(".weather-press-forecast-list > li;eq("+d+")").remove();p(t,r),u++}}),e("#weather-press-forecast-loader").css("display","none")},error:function(e){}})};l(e(".weather-press-cities-list .main-location"),1),p(e(".weather-press-cities-list .main-location"),1);var d=function(e,t){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(e,t)},f=function(){e("#weather-press-loader").removeClass("flipInX"),e("#weather-press-loader").addClass("flipOutX"),0!=e("#weather_press_brand").length&&"none"!=e("#weather_press_brand").css("display")&&"0"!=e("#weather_press_brand").css("opacity")&&"hidden"!=e("#weather_press_brand").css("visibility")&&0!=e("#weather_press_brand a").length&&"none"!=e("#weather_press_brand a").css("display")&&"0"!=e("#weather_press_brand a").css("opacity")&&"hidden"!=e("#weather_press_brand a").css("visibility")||(e(".weather-press-block-bottom").empty(),e(".weather-press-block-bottom").css("height","221px"),c(),e(".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 !'),e(".weather-press-outputs-content").css("color","red"),e(".weather-press-outputs-content").css("text-align","left"),e(".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(e){return 0>e?-1:0<e?1:+e}),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(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),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&&(t[h]=n[h])}return t}}),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(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},m.Color.prototype={constructor:m.Color,r:1,g:1,b:1,set:function(e){return e instanceof m.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.b=this.g=this.r=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?e+6*(t-e)*r:.5>r?t:r<2/3?e+6*(t-e)*(2/3-r):e}return function(t,r,i){return t=m.Math.euclideanModulo(t,1),r=m.Math.clamp(r,0,1),i=m.Math.clamp(i,0,1),0===r?this.r=this.g=this.b=i:(i=2*i-(r=.5>=i?i*(1+r):i+r-i*r),this.r=e(i,r,t+1/3),this.g=e(i,r,t),this.b=e(i,r,t-1/3)),this}}(),setStyle:function(e){function t(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e))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,t(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,t(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 t(r[5]),this.setHSL(i,n,o)}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){if(3===(i=(r=r[1]).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 e&&0<e.length&&(void 0!==(r=m.ColorKeywords[e])?this.setHex(r):console.warn("THREE.Color: Unknown color "+e)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=0<t?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,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(e){e=e||{h:0,s:0,l:0};var t,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=t=0;else{var s=o-h,h=.5>=a?s/(o+h):s/(2-o-h);switch(o){case r:t=(i-n)/s+(i<n?6:0);break;case i:t=(n-r)/s+2;break;case n:t=(r-i)/s+4}t/=6}return e.h=t,e.s=h,e.l=a,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},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(e,t,r,i){this._x=e||0,this._y=t||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(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,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(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(0==e instanceof m.Euler)throw Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),n=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),h=e.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!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,r=t[0];e=t[4];var i=t[8],n=t[1],o=t[5],a=t[9],s=t[2],h=t[6],c=r+o+(t=t[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-e)*r):r>o&&r>t?(r=2*Math.sqrt(1+r-o-t),this._w=(h-a)/r,this._x=.25*r,this._y=(e+n)/r,this._z=(i+s)/r):o>t?(r=2*Math.sqrt(1+o-r-t),this._w=(i-s)/r,this._x=(e+n)/r,this._y=.25*r,this._z=(a+h)/r):(r=2*Math.sqrt(1+t-r-o),this._w=(n-e)/r,this._x=(i+s)/r,this._y=(a+h)/r,this._z=.25*r),this.onChangeCallback(),this},setFromUnitVectors:function(e,t){return void 0===ar&&(ar=new m.Vector3),1e-6>(sr=e.dot(t)+1)?(sr=0,Math.abs(e.x)>Math.abs(e.z)?ar.set(-e.y,e.x,0):ar.set(0,-e.z,e.y)):ar.crossVectors(e,t),this._x=ar.x,this._y=ar.y,this._z=ar.z,this._w=sr,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._z=this._y=this._x=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._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(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w;if(0>(s=o*e._w+r*e._x+i*e._y+n*e._z)?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),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-t)*a)/h,h=Math.sin(t*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(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(m.Quaternion,{slerp:function(e,t,r,i){return r.copy(e).slerp(t,i)},slerpFlat:function(e,t,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(r!==(n=n[o+3])||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&&(s*=a=1/Math.sqrt(s*s+h*h+c*c+r*r),h*=a,c*=a,r*=a)}e[t]=s,e[t+1]=h,e[t+2]=c,e[t+3]=r}}),m.Vector2=function(e,t){this.x=e||0,this.y=t||0},m.Vector2.prototype={constructor:m.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):this.y=this.x=0,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return void 0===nr&&(nr=new m.Vector2,or=new m.Vector2),nr.set(e,e),or.set(t,t),this.clamp(nr,or)},clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.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 e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;return t*t+(e=this.y-e.y)*e},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*r-o*i+e.x,this.y=n*i+o*r+e.y,this}},m.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},m.Vector3.prototype={constructor:m.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):this.z=this.y=this.x=0,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler: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===ir&&(ir=new m.Quaternion),this.applyQuaternion(ir.setFromEuler(e)),this},applyAxisAngle:function(e,t){return void 0===rr&&(rr=new m.Quaternion),this.applyQuaternion(rr.setFromAxisAngle(e,t)),this},applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[3]*r+e[6]*i,this.y=e[1]*t+e[4]*r+e[7]*i,this.z=e[2]*t+e[5]*r+e[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i+e[12],this.y=e[1]*t+e[5]*r+e[9]*i+e[13],this.z=e[2]*t+e[6]*r+e[10]*i+e[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=1/((e=e.elements)[3]*t+e[7]*r+e[11]*i+e[15]);return this.x=(e[0]*t+e[4]*r+e[8]*i+e[12])*n,this.y=(e[1]*t+e[5]*r+e[9]*i+e[13])*n,this.z=(e[2]*t+e[6]*r+e[10]*i+e[14])*n,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z,s=(e=e.w)*t+o*i-a*r,h=e*r+a*t-n*i,c=e*i+n*r-o*t;t=-n*t-o*r-a*i;return this.x=s*e+t*-n+h*-a-c*-o,this.y=h*e+t*-o+c*-n-s*-a,this.z=c*e+t*-a+s*-o-h*-n,this},project:function(e){return void 0===tr&&(tr=new m.Matrix4),tr.multiplyMatrices(e.projectionMatrix,tr.getInverse(e.matrixWorld)),this.applyProjection(tr)},unproject:function(e){return void 0===er&&(er=new m.Matrix4),er.multiplyMatrices(e.matrixWorld,er.getInverse(e.projectionMatrix)),this.applyProjection(er)},transformDirection:function(e){var t=this.x,r=this.y,i=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i,this.y=e[1]*t+e[5]*r+e[9]*i,this.z=e[2]*t+e[6]*r+e[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return void 0===Jt&&(Jt=new m.Vector3,$t=new m.Vector3),Jt.set(e,e,e),$t.set(t,t,t),this.clamp(Jt,$t)},clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(e){return void 0===Qt&&(Qt=new m.Vector3),Qt.copy(e).normalize(),Kt=this.dot(Qt),this.copy(Qt).multiplyScalar(Kt)},projectOnPlane:function(e){return void 0===Zt&&(Zt=new m.Vector3),Zt.copy(this).projectOnVector(e),this.sub(Zt)},reflect:function(e){return void 0===Yt&&(Yt=new m.Vector3),this.sub(Yt.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(m.Math.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r+(e=this.z-e.z)*e},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length();return e=this.set(e.elements[8],e.elements[9],e.elements[10]).length(),this.x=t,this.y=r,this.z=e,this},setFromMatrixColumn:function(e,t){var r=4*e,i=t.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},m.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},m.Vector4.prototype={constructor:m.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setScalar:function(e){return this.w=this.z=this.y=this.x=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*i+e[12]*n,this.y=e[1]*t+e[5]*r+e[9]*i+e[13]*n,this.z=e[2]*t+e[6]*r+e[10]*i+e[14]*n,this.w=e[3]*t+e[7]*r+e[11]*i+e[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.z=this.y=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n=(e=e.elements)[0];i=e[4];var o=e[8],a=e[1],s=e[5],h=e[9];r=e[2],t=e[6];var c=e[10];return.01>Math.abs(i-a)&&.01>Math.abs(o-r)&&.01>Math.abs(h-t)?.1>Math.abs(i+a)&&.1>Math.abs(o+r)&&.1>Math.abs(h+t)&&.1>Math.abs(n+s+c-3)?(this.set(1,0,0,0),this):(e=Math.PI,c=(c+1)/2,i=(i+a)/4,o=(o+r)/4,h=(h+t)/4,(n=(n+1)/2)>(s=(s+1)/2)&&n>c?.01>n?(t=0,i=r=.707106781):(r=i/(t=Math.sqrt(n)),i=o/t):s>c?.01>s?(t=.707106781,r=0,i=.707106781):(t=i/(r=Math.sqrt(s)),i=h/r):.01>c?(r=t=.707106781,i=0):(t=o/(i=Math.sqrt(c)),r=h/i),this.set(t,r,i,e),this):(e=Math.sqrt((t-h)*(t-h)+(o-r)*(o-r)+(a-i)*(a-i)),.001>Math.abs(e)&&(e=1),this.x=(t-h)/e,this.y=(o-r)/e,this.z=(a-i)/e,this.w=Math.acos((n+s+c-1)/2),this)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===Xt&&(Xt=new m.Vector4,qt=new m.Vector4),Xt.set(e,e,e,e),qt.set(t,t,t,t),this.clamp(Xt,qt)},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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},m.Euler=function(e,t,r,i){this._x=e||0,this._y=t||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(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,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(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=m.Math.clamp;e=(u=e.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"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,e)):(this._x=Math.atan2(l,s),this._z=0)):"YXZ"===t?(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,e),this._z=0)):"ZXY"===t?(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,e))):"ZYX"===t?(this._y=Math.asin(-i(c,-1,1)),.99999>Math.abs(c)?(this._x=Math.atan2(l,u),this._z=Math.atan2(a,e)):(this._x=0,this._z=Math.atan2(-n,s))):"YZX"===t?(this._z=Math.asin(i(a,-1,1)),.99999>Math.abs(a)?(this._x=Math.atan2(-h,s),this._y=Math.atan2(-c,e)):(this._x=0,this._y=Math.atan2(o,u))):"XZY"===t?(this._z=Math.asin(-i(n,-1,1)),.99999>Math.abs(n)?(this._x=Math.atan2(l,s),this._y=Math.atan2(o,e)):(this._x=Math.atan2(-h,u),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(e,t,r){return void 0===Wt&&(Wt=new m.Matrix4),Wt.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Wt,t,r),this},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(jt=new m.Quaternion,function(e){jt.setFromEuler(this),this.setFromQuaternion(jt,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new m.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},m.Line3=function(e,t){this.start=void 0!==e?e:new m.Vector3,this.end=void 0!==t?t:new m.Vector3},m.Line3.prototype={constructor:m.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){return(e||new m.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||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(e,t){var r=t||new m.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(zt=new m.Vector3,Ht=new m.Vector3,function(e,t){zt.subVectors(e,this.start),Ht.subVectors(this.end,this.start);var r=Ht.dot(Ht);return r=Ht.dot(zt)/r,t&&(r=m.Math.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,r){return e=this.closestPointToPointParameter(e,t),r=r||new m.Vector3,this.delta(r).multiplyScalar(e).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},m.Box2=function(e,t){this.min=void 0!==e?e:new m.Vector2(1/0,1/0),this.max=void 0!==t?t:new m.Vector2(-1/0,-1/0)},m.Box2.prototype={constructor:m.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(Gt=new m.Vector2,function(e,t){var r=Gt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return(e||new m.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new m.Vector2).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new m.Vector2).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return(t||new m.Vector2).copy(e).clamp(this.min,this.max)},distanceToPoint:(Ot=new m.Vector2,function(e){return Ot.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},m.Box3=function(e,t){this.min=void 0!==e?e:new m.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new m.Vector3(-1/0,-1/0,-1/0)},m.Box3.prototype={constructor:m.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){this.makeEmpty();for(var t=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,h=e.length;s<h;s+=3){var c=e[s],l=e[s+1],u=e[s+2];c<t&&(t=c),l<r&&(r=l),u<i&&(i=u),c>n&&(n=c),l>o&&(o=l),u>a&&(a=u)}this.min.set(t,r,i),this.max.set(n,o,a)},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(Nt=new m.Vector3,function(e,t){var r=Nt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}),setFromObject:function(e){void 0===Vt&&(Vt=new m.Box3);var t=this;return this.makeEmpty(),e.updateMatrixWorld(!0),e.traverse(function(e){var r=e.geometry;void 0!==r&&(null===r.boundingBox&&r.computeBoundingBox(),Vt.copy(r.boundingBox),Vt.applyMatrix4(e.matrixWorld),t.union(Vt))}),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){return(e||new m.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){return(e||new m.Vector3).subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new m.Vector3).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return void 0===Bt&&(Bt=new m.Vector3),this.clampPoint(e.center,Bt),Bt.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,r;return 0<e.normal.x?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},clampPoint:function(e,t){return(t||new m.Vector3).copy(e).clamp(this.min,this.max)},distanceToPoint:(Ft=new m.Vector3,function(e){return Ft.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(It=new m.Vector3,function(e){return(e=e||new m.Sphere).center=this.center(),e.radius=.5*this.size(It).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Dt=[new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3,new m.Vector3],function(e){return Dt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(Dt),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.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(e,t,r,i,n,o,a,s,h){var c=this.elements;return c[0]=e,c[3]=t,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(e){return e=e.elements,this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},applyToVector3Array:function(e,t,r){void 0===kt&&(kt=new m.Vector3),void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i=0;i<r;i+=3,t+=3)kt.fromArray(e,t),kt.applyMatrix3(this),kt.toArray(e,t);return e},applyToBuffer:function(e,t,r){void 0===Ut&&(Ut=new m.Vector3),void 0===t&&(t=0),void 0===r&&(r=e.length/e.itemSize);for(var i=0;i<r;i++,t++)Ut.x=e.getX(t),Ut.y=e.getY(t),Ut.z=e.getZ(t),Ut.applyMatrix3(this),e.setXYZ(Ut.x,Ut.y,Ut.z);return e},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],h=e[7];return t*o*(e=e[8])-t*a*h-r*n*e+r*a*s+i*n*h-i*o*s},getInverse:function(e,t){var r=e.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(t)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 e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[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(e,t,r,i,n,o,a,s,h,c,l,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,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(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements;return e=e.elements,t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractBasis:function(e,t,r){var i=this.elements;return e.set(i[0],i[1],i[2]),t.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(e){void 0===Rt&&(Rt=new m.Vector3);var t=this.elements;e=e.elements;var r=1/Rt.set(e[0],e[1],e[2]).length(),i=1/Rt.set(e[4],e[5],e[6]).length(),n=1/Rt.set(e[8],e[9],e[10]).length();return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,this},makeRotationFromEuler:function(e){0==e instanceof m.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,o=Math.cos(r),a=(r=Math.sin(r),Math.cos(i)),s=(i=Math.sin(i),Math.cos(n));n=Math.sin(n);if("XYZ"===e.order){e=o*s;var h=o*n,c=r*s,l=r*n;t[0]=a*s,t[4]=-a*n,t[8]=i,t[1]=h+c*i,t[5]=e-l*i,t[9]=-r*a,t[2]=l-e*i,t[6]=c+h*i,t[10]=o*a}else"YXZ"===e.order?(e=a*s,h=a*n,c=i*s,l=i*n,t[0]=e+l*r,t[4]=c*r-h,t[8]=o*i,t[1]=o*n,t[5]=o*s,t[9]=-r,t[2]=h*r-c,t[6]=l+e*r,t[10]=o*a):"ZXY"===e.order?(e=a*s,h=a*n,c=i*s,l=i*n,t[0]=e-l*r,t[4]=-o*n,t[8]=c+h*r,t[1]=h+c*r,t[5]=o*s,t[9]=l-e*r,t[2]=-o*i,t[6]=r,t[10]=o*a):"ZYX"===e.order?(e=o*s,h=o*n,c=r*s,l=r*n,t[0]=a*s,t[4]=c*i-h,t[8]=e*i+l,t[1]=a*n,t[5]=l*i+e,t[9]=h*i-c,t[2]=-i,t[6]=r*a,t[10]=o*a):"YZX"===e.order?(e=o*a,h=o*i,c=r*a,l=r*i,t[0]=a*s,t[4]=l-e*n,t[8]=c*n+h,t[1]=n,t[5]=o*s,t[9]=-r*s,t[2]=-i*s,t[6]=h*n+c,t[10]=e-l*n):"XZY"===e.order&&(e=o*a,h=o*i,c=r*a,l=r*i,t[0]=a*s,t[4]=-n,t[8]=i*s,t[1]=e*n+l,t[5]=o*s,t[9]=h*n-c,t[2]=c*n-h,t[6]=r*s,t[10]=l*n+e);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=n+n;e=r*(c=r+r);var s=r*(l=i+i),h=(r=r*a,i*l),c=(i=i*a,n=n*a,o*c),l=o*l;o*=a;return t[0]=1-(h+n),t[4]=s-o,t[8]=r+l,t[1]=s+o,t[5]=1-(e+n),t[9]=i-c,t[2]=r-l,t[6]=i+c,t[10]=1-(e+h),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(e,t,r){void 0===Lt&&(Lt=new m.Vector3),void 0===At&&(At=new m.Vector3),void 0===Pt&&(Pt=new m.Vector3);var i=this.elements;return Pt.subVectors(e,t).normalize(),0===Pt.lengthSq()&&(Pt.z=1),Lt.crossVectors(r,Pt).normalize(),0===Lt.lengthSq()&&(Pt.x+=1e-4,Lt.crossVectors(r,Pt).normalize()),At.crossVectors(Pt,Lt),i[0]=Lt.x,i[4]=At.x,i[8]=Pt.x,i[1]=Lt.y,i[5]=At.y,i[9]=Pt.y,i[2]=Lt.z,i[6]=At.z,i[10]=Pt.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,i=t.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],b=(r=r[15],i[0]),_=i[4],w=i[8],M=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*w+a*T+s*P+h*D,n[12]=o*M+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*w+l*T+u*P+p*D,n[13]=c*M+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*w+f*T+m*P+g*D,n[14]=d*M+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*w+y*T+x*P+r*D,n[15]=v*M+y*C+x*R+r*i,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),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(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(e,t,r){void 0===Ct&&(Ct=new m.Vector3),void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i=0;i<r;i+=3,t+=3)Ct.fromArray(e,t),Ct.applyMatrix4(this),Ct.toArray(e,t);return e},applyToBuffer:function(e,t,r){void 0===Tt&&(Tt=new m.Vector3),void 0===t&&(t=0),void 0===r&&(r=e.length/e.itemSize);for(var i=0;i<r;i++,t++)Tt.x=e.getX(t),Tt.y=e.getY(t),Tt.z=e.getZ(t),Tt.applyMatrix4(this),e.setXYZ(Tt.x,Tt.y,Tt.z);return e},determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],h=e[13],c=e[2],l=e[6],u=e[10],p=e[14];return e[3]*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*p-r*s*p)+e[7]*(+t*s*p-t*h*u+n*o*u-i*o*p+i*h*c-n*s*c)+e[11]*(+t*h*l-t*a*p-n*o*l+r*o*p+n*a*c-r*h*c)+e[15]*(-i*a*c-t*s*l+t*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){void 0===Et&&(Et=new m.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return Et.set(e[12],e[13],e[14])},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=(y=e.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(t)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(e){var t=this.elements,r=e.x,i=e.y;return e=e.z,t[0]*=r,t[4]*=i,t[8]*=e,t[1]*=r,t[5]*=i,t[9]*=e,t[2]*=r,t[6]*=i,t[10]*=e,t[3]*=r,t[7]*=i,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.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(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(e,t,r){void 0===Mt&&(Mt=new m.Vector3),void 0===St&&(St=new m.Matrix4);var i=this.elements,n=Mt.set(i[0],i[1],i[2]).length(),o=Mt.set(i[4],i[5],i[6]).length(),a=Mt.set(i[8],i[9],i[10]).length();0>this.determinant()&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],St.elements.set(this.elements),e=1/n,i=1/o;var s=1/a;return St.elements[0]*=e,St.elements[1]*=e,St.elements[2]*=e,St.elements[4]*=i,St.elements[5]*=i,St.elements[6]*=i,St.elements[8]*=s,St.elements[9]*=s,St.elements[10]*=s,t.setFromRotationMatrix(St),r.x=n,r.y=o,r.z=a,this},makeFrustum:function(e,t,r,i,n,o){var a=this.elements;return a[0]=2*n/(t-e),a[4]=0,a[8]=(t+e)/(t-e),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(e,t,r,i){var n=-(e=r*Math.tan(m.Math.degToRad(.5*e)));return this.makeFrustum(n*t,e*t,n,e,r,i)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=t-e,h=r-i,c=o-n;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-(t+e)/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(e){var t=this.elements;e=e.elements;for(var r=0;16>r;r++)if(t[r]!==e[r])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}},m.Ray=function(e,t){this.origin=void 0!==e?e:new m.Vector3,this.direction=void 0!==t?t:new m.Vector3},m.Ray.prototype={constructor:m.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return(t||new m.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:(wt=new m.Vector3,function(e){return this.origin.copy(this.at(e,wt)),this}),closestPointToPoint:function(e,t){var r=t||new m.Vector3;r.subVectors(e,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(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(_t=new m.Vector3,function(e){var t=_t.subVectors(e,this.origin).dot(this.direction);return 0>t?this.origin.distanceToSquared(e):(_t.copy(this.direction).multiplyScalar(t).add(this.origin),_t.distanceToSquared(e))}),distanceSqToSegment:(yt=new m.Vector3,xt=new m.Vector3,bt=new m.Vector3,function(e,t,r,i){yt.copy(e).add(t).multiplyScalar(.5),xt.copy(t).sub(e).normalize(),bt.copy(this.origin).sub(yt);var n,o=.5*e.distanceTo(t),a=-this.direction.dot(xt),s=bt.dot(this.direction),h=-bt.dot(xt),c=bt.lengthSq(),l=Math.abs(1-a*a);return 0<l?(t=a*s-h,n=o*l,0<=(e=a*h-s)?t>=-n?t<=n?a=(e*=o=1/l)*(e+a*(t*=o)+2*s)+t*(a*e+t+2*h)+c:(t=o,a=-(e=Math.max(0,-(a*t+s)))*e+t*(t+2*h)+c):(t=-o,a=-(e=Math.max(0,-(a*t+s)))*e+t*(t+2*h)+c):t<=-n?a=-(e=Math.max(0,-(-a*o+s)))*e+(t=0<e?-o:Math.min(Math.max(-o,-h),o))*(t+2*h)+c:t<=n?(e=0,a=(t=Math.min(Math.max(-o,-h),o))*(t+2*h)+c):a=-(e=Math.max(0,-(a*o+s)))*e+(t=0<e?o:Math.min(Math.max(-o,-h),o))*(t+2*h)+c):(t=0<a?-o:o,a=-(e=Math.max(0,-(a*t+s)))*e+t*(t+2*h)+c),r&&r.copy(this.direction).multiplyScalar(e).add(this.origin),i&&i.copy(xt).multiplyScalar(t).add(yt),a}),intersectSphere:(vt=new m.Vector3,function(e,t){vt.subVectors(e.center,this.origin);var r=vt.dot(this.direction),i=vt.dot(vt)-r*r,n=e.radius*e.radius;return i>n?null:(i=r-(n=Math.sqrt(n-i)),r+=n,0>i&&0>r?null:0>i?this.at(r,t):this.at(i,t))}),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:0<=(e=-(this.origin.dot(e.normal)+e.constant)/t)?e:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||0>e.normal.dot(this.direction)*t},intersectBox:function(e,t){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=(e.min.x-s.x)*i,i*=e.max.x-s.x):(r=(e.max.x-s.x)*i,i*=e.min.x-s.x),0<=o?(n=(e.min.y-s.y)*o,o*=e.max.y-s.y):(n=(e.max.y-s.y)*o,o*=e.min.y-s.y),r>o||n>i?null:((n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),0<=a?(n=(e.min.z-s.z)*a,a*=e.max.z-s.z):(n=(e.max.z-s.z)*a,a*=e.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,t)))},intersectsBox:(gt=new m.Vector3,function(e){return null!==this.intersectBox(e,gt)}),intersectTriangle:(pt=new m.Vector3,dt=new m.Vector3,ft=new m.Vector3,mt=new m.Vector3,function(e,t,r,i,n){if(dt.subVectors(t,e),ft.subVectors(r,e),mt.crossVectors(dt,ft),0<(t=this.direction.dot(mt))){if(i)return null;i=1}else{if(!(0>t))return null;i=-1,t=-t}return pt.subVectors(this.origin,e),0>(e=i*this.direction.dot(ft.crossVectors(pt,ft)))?null:0>(r=i*this.direction.dot(dt.cross(pt)))||e+r>t?null:0>(e=-i*pt.dot(mt))?null:this.at(e/t,n)}),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},m.Sphere=function(e,t){this.center=void 0!==e?e:new m.Vector3,this.radius=void 0!==t?t:0},m.Sphere.prototype={constructor:m.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(ut=new m.Box3,function(e,t){var r=this.center;void 0!==t?r.copy(t):ut.setFromPoints(e).center(r);for(var i=0,n=0,o=e.length;n<o;n++)i=Math.max(i,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new m.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){return(e=e||new m.Box3).set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},m.Frustum=function(e,t,r,i,n,o){this.planes=[void 0!==e?e:new m.Plane,void 0!==t?t: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(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),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(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes;e=(g=e.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 t[0].setComponents(n-e,h-o,p-c,g-d).normalize(),t[1].setComponents(n+e,h+o,p+c,g+d).normalize(),t[2].setComponents(n+r,h+a,p+l,g+f).normalize(),t[3].setComponents(n-r,h-a,p-l,g-f).normalize(),t[4].setComponents(n-i,h-s,p-u,g-m).normalize(),t[5].setComponents(n+i,h+s,p+u,g+m).normalize(),this},intersectsObject:(lt=new m.Sphere,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),lt.copy(t.boundingSphere),lt.applyMatrix4(e.matrixWorld),this.intersectsSphere(lt)}),intersectsSphere:function(e){var t=this.planes,r=e.center;e=-e.radius;for(var i=0;6>i;i++)if(t[i].distanceToPoint(r)<e)return!1;return!0},intersectsBox:(ht=new m.Vector3,ct=new m.Vector3,function(e){for(var t=this.planes,r=0;6>r;r++){n=t[r],ht.x=0<n.normal.x?e.min.x:e.max.x,ct.x=0<n.normal.x?e.max.x:e.min.x,ht.y=0<n.normal.y?e.min.y:e.max.y,ct.y=0<n.normal.y?e.max.y:e.min.y,ht.z=0<n.normal.z?e.min.z:e.max.z,ct.z=0<n.normal.z?e.max.z:e.min.z;var i=n.distanceToPoint(ht),n=n.distanceToPoint(ct);if(0>i&&0>n)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}},m.Plane=function(e,t){this.normal=void 0!==e?e:new m.Vector3(1,0,0),this.constant=void 0!==t?t:0},m.Plane.prototype={constructor:m.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(at=new m.Vector3,st=new m.Vector3,function(e,t,r){return t=at.subVectors(r,t).cross(st.subVectors(e,t)).normalize(),this.setFromNormalAndCoplanarPoint(t,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e);return(t||new m.Vector3).copy(this.normal).multiplyScalar(r)},intersectLine:(ot=new m.Vector3,function(e,t){var r=t||new m.Vector3,i=e.delta(ot),n=this.normal.dot(i);return 0!==n?0>(n=-(e.start.dot(this.normal)+this.constant)/n)||1<n?void 0:r.copy(i).multiplyScalar(n).add(e.start):0===this.distanceToPoint(e.start)?r.copy(e.start):void 0}),intersectsLine:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),0>t&&0<e||0>e&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new m.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(rt=new m.Vector3,it=new m.Vector3,nt=new m.Matrix3,function(e,t){var r=t||nt.getNormalMatrix(e),i=(r=rt.copy(this.normal).applyMatrix3(r),this.coplanarPoint(it));return i.applyMatrix4(e),this.setFromNormalAndCoplanarPoint(r,i),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},m.Math={generateUUID:($e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),et=Array(36),tt=0,function(){for(var e=0;36>e;e++)8===e||13===e||18===e||23===e?et[e]="-":14===e?et[e]="4":(2>=tt&&(tt=33554432+16777216*Math.random()|0),Je=15&tt,tt>>=4,et[e]=$e[19===e?3&Je|8:Je]);return et.join("")}),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:(Ke=Math.PI/180,function(e){return e*Ke}),radToDeg:(Qe=180/Math.PI,function(e){return e*Qe}),isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}},m.Spline=function(e){function t(e,t,r,i,n,o,a){return(2*(t-r)+(e=.5*(r-e))+(i=.5*(i-t)))*a+(-3*(t-r)-2*e-i)*o+e*n+t}this.points=e;var r,i,n,o,a,s,h,c,l,u=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,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]],a=n*(o=n*n),p.x=t(s.x,h.x,c.x,l.x,n,o,a),p.y=t(s.y,h.y,c.y,l.y,n,o,a),p.z=t(s.z,h.z,c.z,l.z,n,o,a),p},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;e<r;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,n=t=t=0,o=new m.Vector3,a=new m.Vector3,s=[],h=0;for(s[0]=0,e||(e=100),r=this.points.length*e,o.copy(this.points[0]),e=1;e<r;e++)t=e/r,i=this.getPoint(t),a.copy(i),h+=a.distanceTo(o),o.copy(i),t*=this.points.length-1,(t=Math.floor(t))!==n&&(s[t]=h,n=t);return s[s.length]=h,{chunks:s,total:h}},this.reparametrizeByArcLength=function(e){var t,r,i,n,o,a,s=[],h=new m.Vector3,c=this.getLength();for(s.push(h.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(r=c.chunks[t]-c.chunks[t-1],a=Math.ceil(e*r/c.total),n=(t-1)/(this.points.length-1),o=t/(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[t]).clone())}this.points=s}},m.Triangle=function(e,t,r){this.a=void 0!==e?e:new m.Vector3,this.b=void 0!==t?t:new m.Vector3,this.c=void 0!==r?r:new m.Vector3},m.Triangle.normal=(Ze=new m.Vector3,function(e,t,r,i){return(i=i||new m.Vector3).subVectors(r,t),Ze.subVectors(e,t),i.cross(Ze),0<(e=i.lengthSq())?i.multiplyScalar(1/Math.sqrt(e)):i.set(0,0,0)}),m.Triangle.barycoordFromPoint=(Xe=new m.Vector3,qe=new m.Vector3,Ye=new m.Vector3,function(e,t,r,i,n){Xe.subVectors(i,t),qe.subVectors(r,t),Ye.subVectors(e,t),e=Xe.dot(Xe),t=Xe.dot(qe),r=Xe.dot(Ye);var o=qe.dot(qe);i=qe.dot(Ye);var a=e*o-t*t;return n=n||new m.Vector3,0===a?n.set(-2,-1,-1):(o=(o*r-t*i)*(a=1/a),e=(e*i-t*r)*a,n.set(1-o-e,e,o))}),m.Triangle.containsPoint=(We=new m.Vector3,function(e,t,r,i){return 0<=(e=m.Triangle.barycoordFromPoint(e,t,r,i,We)).x&&0<=e.y&&1>=e.x+e.y}),m.Triangle.prototype={constructor:m.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:(He=new m.Vector3,je=new m.Vector3,function(){return He.subVectors(this.c,this.b),je.subVectors(this.a,this.b),.5*He.cross(je).length()}),midpoint:function(e){return(e||new m.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return m.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new m.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return m.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return m.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},m.Interpolant=function(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r},m.Interpolant.prototype={constructor:m.Interpolant,evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{r:{i:if(!(e<i)){for(var o=r+2;;){if(void 0===i){if(e<n)break i;return this._cachedIndex=r=t.length,this.afterEnd_(r-1,e,n)}if(r===o)break;if(n=i,e<(i=t[++r]))break t}i=t.length;break r}if(e>=n)break e;for(e<(o=t[1])&&(r=2,n=o),o=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===o)break;if(i=n,e>=(n=t[--r-1]))break t}i=r,r=0}for(;r<i;)e<t[n=r+i>>>1]?i=n:r=n+1;if(i=t[r],void 0===(n=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return this._cachedIndex=r=t.length,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize;e*=i;for(var n=0;n!==i;++n)t[n]=r[e+n];return t},interpolate_:function(e,t,r,i){throw Error("call to abstract method")},intervalChanged_:function(e,t,r){}},Object.assign(m.Interpolant.prototype,{beforeStart_:m.Interpolant.prototype.copySampleValue_,afterEnd_:m.Interpolant.prototype.copySampleValue_}),m.CubicInterpolant=function(e,t,r,i){m.Interpolant.call(this,e,t,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(e,t,r){var i=this.parameterPositions,n=e-2,o=e+1,a=i[n],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case m.ZeroSlopeEnding:n=e,a=2*t-r;break;case m.WrapAroundEnding:a=t+i[n=i.length-2]-i[n+1];break;default:n=e,a=r}if(void 0===s)switch(this.getSettings_().endingEnd){case m.ZeroSlopeEnding:o=e,s=2*r-t;break;case m.WrapAroundEnding:o=1,s=r+i[1]-i[0];break;default:o=e-1,s=t}e=.5*(r-t),i=this.valueSize,this._weightPrev=e/(t-a),this._weightNext=e/(s-r),this._offsetPrev=n*i,this._offsetNext=o*i},interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(e*=a)-a,h=this._offsetPrev,c=this._offsetNext,l=this._weightPrev,u=this._weightNext,p=(r-t)/(i-t);for(t=-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]=t*o[h+r]+l*o[s+r]+p*o[e+r]+u*o[c+r];return n}}),m.DiscreteInterpolant=function(e,t,r,i){m.Interpolant.call(this,e,t,r,i)},m.DiscreteInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.DiscreteInterpolant,interpolate_:function(e,t,r,i){return this.copySampleValue_(e-1)}}),m.LinearInterpolant=function(e,t,r,i){m.Interpolant.call(this,e,t,r,i)},m.LinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.LinearInterpolant,interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(e*=a)-a;for(r=1-(t=(r-t)/(i-t)),i=0;i!==a;++i)n[i]=o[s+i]*r+o[e+i]*t;return n}}),m.QuaternionLinearInterpolant=function(e,t,r,i){m.Interpolant.call(this,e,t,r,i)},m.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(m.Interpolant.prototype),{constructor:m.QuaternionLinearInterpolant,interpolate_:function(e,t,r,i){var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize;for(t=(r-t)/(i-t),r=(e*=a)+a;e!==r;e+=4)m.Quaternion.slerpFlat(n,0,o,e-a,o,e,t);return n}}),m.Clock=function(e){this.autoStart=void 0===e||e,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(t=0,this.autoStart&&!this.running&&this.start(),this.running){var e=performance.now(),t=.001*(e-this.oldTime);this.oldTime=e,this.elapsedTime+=t}return t}},m.EventDispatcher=function(){},m.EventDispatcher.prototype={constructor:m.EventDispatcher,apply:function(e){e.addEventListener=m.EventDispatcher.prototype.addEventListener,e.hasEventListener=m.EventDispatcher.prototype.hasEventListener,e.removeEventListener=m.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=m.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=[],i=t.length,n=0;n<i;n++)r[n]=t[n];for(n=0;n<i;n++)r[n].call(this,e)}}}},m.Layers=function(){this.mask=1},m.Layers.prototype={constructor:m.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!=(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,i,n){if(!1!==e.visible&&(e.raycast(t,i),!0===n)){n=0;for(var o=(e=e.children).length;n<o;n++)r(e[n],t,i,!0)}}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,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}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=e.length;o<a;o++)r(e[o],this,n,i);return n.sort(t),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 e=new m.Vector3,t=new m.Euler,r=new m.Quaternion,i=new m.Vector3(1,1,1);t.onChange(function(){r.setFromEuler(t,!1)}),r.onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},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(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(ze=new m.Quaternion,function(e,t){return ze.setFromAxisAngle(e,t),this.quaternion.multiply(ze),this}),rotateX:(Ge=new m.Vector3(1,0,0),function(e){return this.rotateOnAxis(Ge,e)}),rotateY:(Oe=new m.Vector3(0,1,0),function(e){return this.rotateOnAxis(Oe,e)}),rotateZ:(Ne=new m.Vector3(0,0,1),function(e){return this.rotateOnAxis(Ne,e)}),translateOnAxis:(Ve=new m.Vector3,function(e,t){return Ve.copy(e).applyQuaternion(this.quaternion),this.position.add(Ve.multiplyScalar(t)),this}),translateX:(Be=new m.Vector3(1,0,0),function(e){return this.translateOnAxis(Be,e)}),translateY:(Fe=new m.Vector3(0,1,0),function(e){return this.translateOnAxis(Fe,e)}),translateZ:(Ie=new m.Vector3(0,0,1),function(e){return this.translateOnAxis(Ie,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(De=new m.Matrix4,function(e){return e.applyMatrix4(De.getInverse(this.matrixWorld))}),lookAt:(ke=new m.Matrix4,function(e){ke.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(ke)}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof m.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(1<arguments.length)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);-1!==(t=this.children.indexOf(e))&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(t,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(e,t);if(void 0!==n)return n}},getWorldPosition:function(e){return e=e||new m.Vector3,this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(Re=new m.Vector3,Ue=new m.Vector3,function(e){return e=e||new m.Quaternion,this.updateMatrixWorld(!0),this.matrixWorld.decompose(Re,e,Ue),e}),getWorldRotation:(Pe=new m.Quaternion,function(e){return e=e||new m.Euler,this.getWorldQuaternion(Pe),e.setFromQuaternion(Pe,this.rotation.order,!1)}),getWorldScale:(Le=new m.Vector3,Ae=new m.Quaternion,function(e){return e=e||new m.Vector3,this.updateMatrixWorld(!0),this.matrixWorld.decompose(Le,Ae,e),e}),getWorldDirection:(Ce=new m.Quaternion,function(e){return e=e||new m.Vector3,this.getWorldQuaternion(Ce),e.set(0,0,1).applyQuaternion(Ce)}),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==e||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;t<r;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t,r=[];for(t in e){var i=e[t];delete i.metadata,r.push(i)}return r}var r={};(n=void 0===e)&&(e={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===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),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(e).object);if(n){var n=t(e.geometries),o=t(e.materials),a=t(e.textures);e=t(e.images),0<n.length&&(r.geometries=n),0<o.length&&(r.materials=o),0<a.length&&(r.textures=a),0<e.length&&(r.images=e)}return r.object=i,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r=0;r<e.children.length;r++)this.add(e.children[r].clone());return this}},m.EventDispatcher.prototype.apply(m.Object3D.prototype),m.Object3DIdCount=0,m.Face3=function(e,t,r,i,n,o){this.a=e,this.b=t,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(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},m.BufferAttribute=function(e,t){this.uuid=m.Math.generateUUID(),this.array=e,this.itemSize=t,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(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new m.Color),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new m.Vector2),t[r++]=o.x,t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new m.Vector3),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;i<n;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new m.Vector4),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},m.Int8Attribute=function(e,t){return new m.BufferAttribute(new Int8Array(e),t)},m.Uint8Attribute=function(e,t){return new m.BufferAttribute(new Uint8Array(e),t)},m.Uint8ClampedAttribute=function(e,t){return new m.BufferAttribute(new Uint8ClampedArray(e),t)},m.Int16Attribute=function(e,t){return new m.BufferAttribute(new Int16Array(e),t)},m.Uint16Attribute=function(e,t){return new m.BufferAttribute(new Uint16Array(e),t)},m.Int32Attribute=function(e,t){return new m.BufferAttribute(new Int32Array(e),t)},m.Uint32Attribute=function(e,t){return new m.BufferAttribute(new Uint32Array(e),t)},m.Float32Attribute=function(e,t){return new m.BufferAttribute(new Float32Array(e),t)},m.Float64Attribute=function(e,t){return new m.BufferAttribute(new Float64Array(e),t)},m.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new m.BufferAttribute(e,t).setDynamic(!0)},m.InstancedBufferAttribute=function(e,t,r){m.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},m.InstancedBufferAttribute.prototype=Object.create(m.BufferAttribute.prototype),m.InstancedBufferAttribute.prototype.constructor=m.InstancedBufferAttribute,m.InstancedBufferAttribute.prototype.copy=function(e){return m.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},m.InterleavedBuffer=function(e,t){this.uuid=m.Math.generateUUID(),this.array=e,this.stride=t,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(e){!0===e&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},m.InstancedInterleavedBuffer=function(e,t,r){m.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},m.InstancedInterleavedBuffer.prototype=Object.create(m.InterleavedBuffer.prototype),m.InstancedInterleavedBuffer.prototype.constructor=m.InstancedInterleavedBuffer,m.InstancedInterleavedBuffer.prototype.copy=function(e){return m.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},m.InterleavedBufferAttribute=function(e,t,r){this.uuid=m.Math.generateUUID(),this.data=e,this.itemSize=t,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(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+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(e){for(var t=(new m.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;r<i;r++)this.vertices[r].applyMatrix4(e);for(r=0,i=this.faces.length;r<i;r++){(e=this.faces[r]).normal.applyMatrix3(t).normalize();for(var n=0,o=e.vertexNormals.length;n<o;n++)e.vertexNormals[n].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},rotateX:function(e){return void 0===Te&&(Te=new m.Matrix4),Te.makeRotationX(e),this.applyMatrix(Te),this},rotateY:function(e){return void 0===Ee&&(Ee=new m.Matrix4),Ee.makeRotationY(e),this.applyMatrix(Ee),this},rotateZ:function(e){return void 0===Se&&(Se=new m.Matrix4),Se.makeRotationZ(e),this.applyMatrix(Se),this},translate:function(e,t,r){return void 0===Me&&(Me=new m.Matrix4),Me.makeTranslation(e,t,r),this.applyMatrix(Me),this},scale:function(e,t,r){return void 0===we&&(we=new m.Matrix4),we.makeScale(e,t,r),this.applyMatrix(we),this},lookAt:function(e){void 0===_e&&(_e=new m.Object3D),_e.lookAt(e),_e.updateMatrix(),this.applyMatrix(_e.matrix)},fromBufferGeometry:function(e){function t(e,t,i){var n=void 0!==a?[l[e].clone(),l[t].clone(),l[i].clone()]:[],o=void 0!==s?[r.colors[e].clone(),r.colors[t].clone(),r.colors[i].clone()]:[];n=new m.Face3(e,t,i,n,o);r.faces.push(n),void 0!==h&&r.faceVertexUvs[0].push([u[e].clone(),u[t].clone(),u[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[i].clone()])}var r=this,i=null!==e.index?e.index.array:void 0,n=e.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=e.groups).length)for(n=0;n<o.length;n++){var f=(d=o[n]).start,g=d.count;for(d=f,f=f+g;d<f;d+=3)t(i[d],i[d+1],i[d+2])}else for(n=0;n<i.length;n+=3)t(i[n],i[n+1],i[n+2]);else for(n=0;n<o.length/3;n+=3)t(n,n+1,n+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=0===(t=this.boundingSphere.radius)?1:1/t,r=new m.Matrix4;return r.set(t,0,0,-t*e.x,0,t,0,-t*e.y,0,0,t,-t*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new m.Vector3,t=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];e.subVectors(this.vertices[n.c],a),t.subVectors(o,a),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){var t,r,i;for(void 0===e&&(e=!0),i=Array(this.vertices.length),t=0,r=this.vertices.length;t<r;t++)i[t]=new m.Vector3;if(e){var n,o,a,s=new m.Vector3,h=new m.Vector3;for(e=0,t=this.faces.length;e<t;e++)r=this.faces[e],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(e=0,t=this.faces.length;e<t;e++)i[(r=this.faces[e]).a].add(r.normal),i[r.b].add(r.normal),i[r.c].add(r.normal);for(t=0,r=this.vertices.length;t<r;t++)i[t].normalize();for(e=0,t=this.faces.length;e<t;e++)3===(n=(r=this.faces[e]).vertexNormals).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 e,t,r,i,n;for(r=0,i=this.faces.length;r<i;r++)for((n=this.faces[r]).__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;e<t;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var o=new m.Geometry;for(o.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[],n=this.morphNormals[e].faceNormals;var a,s,h=this.morphNormals[e].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[e],o.vertices=this.morphTargets[e].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]).normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;r<i;r++)0<r&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},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(e,t,r){if(0==e instanceof m.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);else{var i,n=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,h=e.faces,c=this.faceVertexUvs[0];e=e.faceVertexUvs[0],void 0===r&&(r=0),void 0!==t&&(i=(new m.Matrix3).getNormalMatrix(t));for(var l=0,u=a.length;l<u;l++){var p=a[l].clone();void 0!==t&&p.applyMatrix4(t),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(),t=0,o=f.length;t<o;t++)d=f[t].clone(),void 0!==i&&d.applyMatrix3(i).normalize(),p.vertexNormals.push(d);for(p.color.copy(a.color),t=0,o=g.length;t<o;t++)d=g[t],p.vertexColors.push(d.clone());p.materialIndex=a.materialIndex+r,s.push(p)}for(l=0,u=e.length;l<u;l++)if(i=[],void 0!==(r=e[l])){for(t=0,o=r.length;t<o;t++)i.push(r[t].clone());c.push(i)}}},mergeMesh:function(e){0==e instanceof m.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i={},n=[],o=[],a=Math.pow(10,4);for(t=0,r=this.vertices.length;t<r;t++)e=this.vertices[t],void 0===i[e=Math.round(e.x*a)+"_"+Math.round(e.y*a)+"_"+Math.round(e.z*a)]?(i[e]=t,n.push(this.vertices[t]),o[t]=n.length-1):o[t]=o[i[e]];for(i=[],t=0,r=this.faces.length;t<r;t++)for((a=this.faces[t]).a=o[a.a],a.b=o[a.b],a.c=o[a.c],a=[a.a,a.b,a.c],e=0;3>e;e++)if(a[e]===a[(e+1)%3]){i.push(t);break}for(t=i.length-1;0<=t;t--)for(a=i[t],this.faces.splice(a,1),o=0,r=this.faceVertexUvs.length;o<r;o++)this.faceVertexUvs[o].splice(a,1);return t=this.vertices.length-n.length,this.vertices=n,t},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var i,n,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===t&&(i=[]),a&&a.length===t&&(n=[]),r=0;r<t;r++){var s=e[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 e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]?c[t]:(c[t]=h.length/3,h.push(e.x,e.y,e.z),c[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]?u[t]:(u[t]=l.length,l.push(e.getHex()),u[t])}function i(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]?d[t]:(d[t]=p.length/2,p.push(e.x,e.y),d[t])}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=e(b=e(b=e(b=e(b=e(b=e(b=e(b=e(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(t(f.normal)),v&&(g=f.vertexNormals,s.push(t(g[0]),t(g[1]),t(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(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;r<i;r++)this.vertices.push(t[r].clone());for(r=0,i=(t=e.faces).length;r<i;r++)this.faces.push(t[r].clone());for(r=0,i=e.faceVertexUvs.length;r<i;r++){t=e.faceVertexUvs[r],void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var n=0,o=t.length;n<o;n++){for(var a=t[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(e){var t,r,i=[];e=e.faces;for(var n=0;n<e.length;n++){var o=e[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*n-t.start,i.push(t)),t={start:3*n,materialIndex:r})}void 0!==t&&(t.count=3*n-t.start,i.push(t)),this.groups=i},fromGeometry:function(e){var t,r=e.faces,i=e.vertices,n=e.faceVertexUvs,o=n[0]&&0<n[0].length,a=n[1]&&0<n[1].length,s=e.morphTargets,h=s.length;if(0<h){for(t=[],v=0;v<h;v++)t[v]=[];this.morphTargets.position=t}var c,l=e.morphNormals,u=l.length;if(0<u){for(c=[],v=0;v<u;v++)c[v]=[];this.morphTargets.normal=c}for(var p=e.skinIndices,d=e.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&&(void 0!==(x=n[0][v])?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&&(void 0!==(x=n[1][v])?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;t[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(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.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(e){this.index=e},addAttribute:function(e,t,r){if(0==t instanceof m.BufferAttribute&&0==t instanceof m.InterleavedBufferAttribute)console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new m.BufferAttribute(t,r));else{if("index"!==e)return this.attributes[e]=t,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)}},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0),void 0!==(t=this.attributes.normal)&&((new m.Matrix3).getNormalMatrix(e).applyToVector3Array(t.array),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(e){return void 0===be&&(be=new m.Matrix4),be.makeRotationX(e),this.applyMatrix(be),this},rotateY:function(e){return void 0===xe&&(xe=new m.Matrix4),xe.makeRotationY(e),this.applyMatrix(xe),this},rotateZ:function(e){return void 0===ye&&(ye=new m.Matrix4),ye.makeRotationZ(e),this.applyMatrix(ye),this},translate:function(e,t,r){return void 0===ve&&(ve=new m.Matrix4),ve.makeTranslation(e,t,r),this.applyMatrix(ve),this},scale:function(e,t,r){return void 0===ge&&(ge=new m.Matrix4),ge.makeScale(e,t,r),this.applyMatrix(ge),this},lookAt:function(e){void 0===me&&(me=new m.Object3D),me.lookAt(e),me.updateMatrix(),this.applyMatrix(me.matrix)},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof m.Points||e instanceof m.Line){e=new m.Float32Attribute(3*t.vertices.length,3);var r=new m.Float32Attribute(3*t.colors.length,3);this.addAttribute("position",e.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length&&(e=new m.Float32Attribute(t.lineDistances.length,1),this.addAttribute("lineDistance",e.copyArray(t.lineDistances))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof m.Mesh&&t instanceof m.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof m.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}return!0===t.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),!0===t.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),!0===t.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new m.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){for(var t in r=new Float32Array(3*e.vertices.length),this.addAttribute("position",new m.BufferAttribute(r,3).copyVector3sArray(e.vertices)),0<e.normals.length&&(r=new Float32Array(3*e.normals.length),this.addAttribute("normal",new m.BufferAttribute(r,3).copyVector3sArray(e.normals))),0<e.colors.length&&(r=new Float32Array(3*e.colors.length),this.addAttribute("color",new m.BufferAttribute(r,3).copyColorsArray(e.colors))),0<e.uvs.length&&(r=new Float32Array(2*e.uvs.length),this.addAttribute("uv",new m.BufferAttribute(r,2).copyVector2sArray(e.uvs))),0<e.uvs2.length&&(r=new Float32Array(2*e.uvs2.length),this.addAttribute("uv2",new m.BufferAttribute(r,2).copyVector2sArray(e.uvs2))),0<e.indices.length&&(r=new(65535<e.vertices.length?Uint32Array:Uint16Array)(3*e.indices.length),this.setIndex(new m.BufferAttribute(r,1).copyIndicesArray(e.indices))),this.groups=e.groups,e.morphTargets){for(var r=[],i=e.morphTargets[t],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[t]=r}return 0<e.skinIndices.length&&(t=new m.Float32Attribute(4*e.skinIndices.length,4),this.addAttribute("skinIndex",t.copyVector4sArray(e.skinIndices))),0<e.skinWeights.length&&(t=new m.Float32Attribute(4*e.skinWeights.length,4),this.addAttribute("skinWeight",t.copyVector4sArray(e.skinWeights))),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:(new m.Vector3,function(){null===this.boundingBox&&(this.boundingBox=new m.Box3);var e=this.attributes.position.array;e&&this.boundingBox.setFromArray(e),void 0!==e&&0!==e.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:(de=new m.Box3,fe=new m.Vector3,function(){null===this.boundingSphere&&(this.boundingSphere=new m.Sphere);var e=this.attributes.position.array;if(e){var t=this.boundingSphere.center;de.setFromArray(e),de.center(t);for(var r=0,i=0,n=e.length;i<n;i+=3)fe.fromArray(e,i),r=Math.max(r,t.distanceToSquared(fe));this.boundingSphere.radius=Math.sqrt(r),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 e=this.index,t=this.attributes,r=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new m.BufferAttribute(new Float32Array(i.length),3));else for(var n=0,o=(c=t.normal.array).length;n<o;n++)c[n]=0;var a,s,h,c=t.normal.array,l=new m.Vector3,u=new m.Vector3,p=new m.Vector3,d=new m.Vector3,f=new m.Vector3;if(e){e=e.array,0===r.length&&this.addGroup(0,e.length);for(var g=0,v=r.length;g<v;++g)for(o=(n=r[g]).start,a=n.count,n=o,o+=a;n<o;n+=3)a=3*e[n+0],s=3*e[n+1],h=3*e[n+2],l.fromArray(i,a),u.fromArray(i,s),p.fromArray(i,h),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),c[a]+=d.x,c[a+1]+=d.y,c[a+2]+=d.z,c[s]+=d.x,c[s+1]+=d.y,c[s+2]+=d.z,c[h]+=d.x,c[h+1]+=d.y,c[h+2]+=d.z}else for(n=0,o=i.length;n<o;n+=9)l.fromArray(i,n),u.fromArray(i,n+3),p.fromArray(i,n+6),d.subVectors(p,u),f.subVectors(l,u),d.cross(f),c[n]=d.x,c[n+1]=d.y,c[n+2]=d.z,c[n+3]=d.x,c[n+4]=d.y,c[n+5]=d.z,c[n+6]=d.x,c[n+7]=d.y,c[n+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(0!=e instanceof m.BufferGeometry){void 0===t&&(t=0);var r,i=this.attributes;for(r in i)if(void 0!==e.attributes[r])for(var n=i[r].array,o=(s=e.attributes[r]).array,a=0,s=s.itemSize*t;a<o.length;a++,s++)n[s]=o[a];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e,t,r,i=this.attributes.normal.array,n=0,o=i.length;n<o;n+=3)e=i[n],t=i[n+1],r=i[n+2],e=1/Math.sqrt(e*e+t*t+r*r),i[n]*=e,i[n+1]*=e,i[n+2]*=e},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e,t=new m.BufferGeometry,r=this.index.array,i=this.attributes;for(e in i){for(var n=(o=i[e]).array,o=o.itemSize,a=new n.constructor(r.length*o),s=0,h=0,c=0,l=r.length;c<l;c++){s=r[c]*o;for(var u=0;u<o;u++)a[h++]=n[s++]}t.addAttribute(e,new m.BufferAttribute(a,o))}return t},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t,r=this.parameters;for(t in r)void 0!==r[t]&&(e[t]=r[t]);return e}e.data={attributes:{}};var i=this.index;for(t in null!==i&&(r=Array.prototype.slice.call(i.array),e.data.index={type:i.array.constructor.name,array:r}),i=this.attributes){var n=i[t];r=Array.prototype.slice.call(n.array);e.data.attributes[t]={itemSize:n.itemSize,type:n.array.constructor.name,array:r}}return 0<(t=this.groups).length&&(e.data.groups=JSON.parse(JSON.stringify(t))),null!==(t=this.boundingSphere)&&(e.data.boundingSphere={center:t.center.toArray(),radius:t.radius}),e},clone:function(){return(new m.BufferGeometry).copy(this)},copy:function(e){null!==(r=e.index)&&this.setIndex(r.clone());var t,r=e.attributes;for(t in r)this.addAttribute(t,r[t].clone());for(t=0,r=(e=e.groups).length;t<r;t++){var i=e[t];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(e,t,r){this.groups.push({start:e,count:t,instances:r})},m.InstancedBufferGeometry.prototype.copy=function(e){null!==(r=e.index)&&this.setIndex(r.clone());var t,r=e.attributes;for(t in r)this.addAttribute(t,r[t].clone());for(t=0,r=(e=e.groups).length;t<r;t++){var i=e[t];this.addGroup(i.start,i.count,i.instances)}return this},m.EventDispatcher.prototype.apply(m.InstancedBufferGeometry.prototype),m.Uniform=function(e,t){this.type=e,this.value=t,this.dynamic=!1},m.Uniform.prototype={constructor:m.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},m.AnimationClip=function(e,t,r){this.name=e||m.Math.generateUUID(),this.tracks=r,this.duration=void 0!==t?t:-1,0>this.duration&&this.resetDuration(),this.trim(),this.optimize()},m.AnimationClip.prototype={constructor:m.AnimationClip,resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(m.AnimationClip,{parse:function(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,o=r.length;n!==o;++n)t.push(m.KeyframeTrack.parse(r[n]).scale(i));return new m.AnimationClip(e.name,e.duration,t)},toJSON:function(e){var t=[],r=e.tracks;e={name:e.name,duration:e.duration,tracks:t};for(var i=0,n=r.length;i!==n;++i)t.push(m.KeyframeTrack.toJSON(r[i]));return e},CreateFromMorphTargetSequence:function(e,t,r){for(var i=t.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["+t[o].name+"]",s,h).scale(1/r))}return new m.AnimationClip(e,-1,n)},findByName:function(e,t){for(var r=0;r<e.length;r++)if(e[r].name===t)return e[r];return null},CreateClipsFromMorphTargetSequences:function(e,t){for(var r={},i=/^([\w-]*?)([\d]+)$/,n=0,o=e.length;n<o;n++){var a=e[n],s=a.name.match(i);if(s&&1<s.length){var h=s[1];(s=r[h])||(r[h]=s=[]),s.push(a)}}for(h in i=[],r)i.push(m.AnimationClip.CreateFromMorphTargetSequence(h,r[h],t));return i},parseAnimation:function(e,t,r){if(!e)return console.error("  no animation in JSONLoader data"),null;r=function(e,t,r,i,n){if(0!==r.length){var o=[],a=[];m.AnimationUtils.flattenJSON(r,o,a,i),0!==o.length&&n.push(new e(t,o,a))}};var i=[],n=e.name||"default",o=e.length||-1,a=e.fps||30;e=e.hierarchy||[];for(var s=0;s<e.length;s++){var h=e[s].keys;if(h&&0!=h.length)if(h[0].morphTargets){o={};for(var 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["+t[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(e){this._root=e,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1},m.AnimationMixer.prototype={constructor:m.AnimationMixer,clipAction:function(e,t){var r,i=(t||this._root).uuid,n="string"==typeof e?e:e.name,o=e!==n?e:null,a=this._actionsByClip[n];if(void 0!==a){if(void 0!==(r=a.actionByRoot[i]))return r;if(o=(r=a.knownActions[0])._clip,e!==n&&e!==o)throw Error("Different clips with the same name detected!")}return null===o?null:(a=new m.AnimationMixer._Action(this,o,t),this._bindAction(a,r),this._addInactiveAction(a,n,i),a)},existingAction:function(e,t){var r=(t||this._root).uuid,i=this._actionsByClip["string"==typeof e?e:e.name];return void 0!==i&&i.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,r=this._bindings,i=this._nActiveBindings,n=this._nActiveBindings=this._nActiveActions=0;n!==t;++n)e[n].reset();for(n=0;n!==i;++n)r[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),o=this._accuIndex^=1,a=0;a!==r;++a){var s=t[a];s.enabled&&s._update(i,e,n,o)}for(e=this._bindings,t=this._nActiveBindings,a=0;a!==t;++a)e[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions;e=e.name;var r=this._actionsByClip,i=r[e];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=t[t.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,h._cacheIndex=s,t[s]=h,t.pop(),this._removeInactiveBindingsForAction(a)}delete r[e]}},uncacheRoot:function(e){e=e.uuid;var t,r=this._actionsByClip;for(t in r){var i=r[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}if(void 0!==(t=this._bindingsByRootAndName[e]))for(var n in t)(e=t[n]).restoreOriginalState(),this._removeInactiveBinding(e)},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},m.EventDispatcher.prototype.apply(m.AnimationMixer.prototype),m.AnimationMixer._Action=function(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null,t=(e=t.tracks).length,r=Array(t);for(var i={endingStart:m.ZeroCurvatureEnding,endingEnd:m.ZeroCurvatureEnding},n=0;n!==t;++n){var o=e[n].createInterpolant(null);r[n]=o,o.settings=i}this._interpolantSettings=i,this._interpolants=r,this._propertyBindings=Array(t),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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){r=this._clip.duration;var i=e._clip.duration,n=r/i;e.warp(1,i/r,t),this.warp(n,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,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]=e/a,o[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,i){if(null!==(n=this._startTime)){if(0>(t=(e-n)*r)||0===r)return;this._startTime=null,t*=r}if(t*=this._updateTimeScale(e),r=this._updateTime(t),0<(e=this._updateWeight(e))){t=this._interpolants;for(var n=this._propertyBindings,o=0,a=t.length;o!==a;++o)t[o].evaluate(r),n[o].accumulate(i,e)}},_updateWeight:function(e){if(t=0,this.enabled){var t=this.weight,r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0];t=t*i;e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){if(t=0,!this.paused){var t=this.timeScale,r=this._timeScaleInterpolant;null!==r&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t))}return this._effectiveTimeScale=t},_updateTime:function(e){if(a=this.time+e,0===e)return a;var t=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>=t)a=t;else{if(!(0>a))break;a=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case m.LoopPingPong:n=!0;case m.LoopRepeat:if(-1===i&&(0<e?(i=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),a>=t||0>a){var o=Math.floor(a/t),a=a-t*o,s=(i=i+Math.abs(o),this.repetitions-i);if(0>s){this.clampWhenFinished?this.paused=!0:this.enabled=!1,a=0<e?t:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});break}0===s?(e=0>e,this._setEndings(e,!e,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,t-a}return this.time=a},_setEndings:function(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=m.ZeroSlopeEnding,i.endingEnd=m.ZeroSlopeEnding):(i.endingStart=e?this.zeroSlopeAtStart?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding,i.endingEnd=t?this.zeroSlopeAtEnd?m.ZeroSlopeEnding:m.ZeroCurvatureEnding:m.WrapAroundEnding)},_scheduleFading:function(e,t,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]=t,i[1]=n+e,o[1]=r,this}},Object.assign(m.AnimationMixer.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,o=e._propertyBindings,a=e._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,t&&t._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,u)}o[h]=p,a[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.name,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(r=0,i=(t=e._propertyBindings).length;r!==i;++r){var n=t[r];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,i=t.length;r!==i;++r){var n=t[r];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){return null!==(e=e._cacheIndex)&&e<this._nActiveActions},_addInactiveAction:function(e,t,r){var i=this._actions,n=this._actionsByClip,o=n[t];void 0===o?(o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=o):(t=o.knownActions,e._byClipCacheIndex=t.length,t.push(e)),e._cacheIndex=i.length,i.push(e),o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;r=e._clip.name;var n=(i=this._actionsByClip)[r],o=n.knownActions,a=o[o.length-1],s=e._byClipCacheIndex;a._byClipCacheIndex=s,o[s]=a,o.pop(),e._byClipCacheIndex=null,delete n.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete i[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=0,r=(e=e._propertyBindings).length;t!==r;++t){var i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_addInactiveBinding:function(e,t,r){var i=this._bindingsByRootAndName,n=i[t],o=this._bindings;void 0===n&&(n={},i[t]=n),n[r]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=(i=e.binding).rootNode.uuid,i=i.path,n=this._bindingsByRootAndName,o=n[r],a=t[t.length-1];e=e._cacheIndex,a._cacheIndex=e,t[e]=a,t.pop(),delete o[i];e:{for(var s in o)break e;delete n[r]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new m.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),m.AnimationObjectGroup=function(e){this.uuid=m.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var r=0,i=arguments.length;r!==i;++r)t[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(e){for(var t=this._objects,r=t.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,t.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=t[p],v=--i;for(n[(f=t[v]).uuid]=p,t[p]=f,n[d]=v,t[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 t[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(e){for(var t=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=t[u];for(i[p.uuid]=l,t[l]=p,i[c]=u,t[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(e){for(var t=this._objects,r=t.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=t[c=--i],p=--r,d=t[p];for(n[u.uuid]=l,t[l]=u,n[d.uuid]=c,t[c]=d,t.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(n[(d=t[p=--r]).uuid]=l,t[l]=d,t.pop(),u=0,d=a;u!==d;++u)(f=o[u])[l]=f[p],f.pop()}this.nCachedObjects_=i},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,i=r[e],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[e]=i,o.push(e),a.push(t),n.push(c),r=h,i=s.length;r!==i;++r)c[r]=new m.PropertyBinding(s[r],e,t);return c},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=r,o[r]=s,o.pop(),n[r]=n[a],n.pop(),i[r]=i[a],i.pop()}}},m.AnimationUtils={arraySlice:function(e,t,r){return m.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,r)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=Array(t),i=0;i!==t;++i)r[i]=i;return r.sort(function(t,r){return e[t]-e[r]}),r},sortedArray:function(e,t,r){for(var i=e.length,n=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=r[o]*t,h=0;h!==t;++h)n[a++]=e[s+h];return n},flattenJSON:function(e,t,r,i){for(var n=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[n++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(t.push(o.time),r.push.apply(r,a)),o=e[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(t.push(o.time),a.toArray(r,r.length)),o=e[n++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(t.push(o.time),r.push(a)),o=e[n++]}while(void 0!==o)}}},m.KeyframeTrack=function(e,t,r,i){if(void 0===e)throw Error("track name is undefined");if(void 0===t||0===t.length)throw Error("no keyframes in track named "+e);this.name=e,this.times=m.AnimationUtils.convertArray(t,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(e){return new m.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new m.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new m.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case m.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case m.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case m.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){if(t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw Error(t);this.setInterpolation(this.DefaultInterpolation)}console.warn(t)}else this.createInterpolant=t},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(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,i=r.length,n=0,o=i-1;n!==i&&r[n]<e;)++n;for(;-1!==o&&r[o]>t;)--o;return++o,0===n&&o===i||(n>=o&&(n=(o=Math.max(o,1))-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 e=!0;0!=(r=this.getValueSize())-Math.floor(r)&&(console.error("invalid value size in track",this),e=!1);var t=this.times,r=this.values,i=t.length;0===i&&(console.error("track is empty",this),e=!1);for(var n=null,o=0;o!==i;o++){var a=t[o];if("number"==typeof a&&isNaN(a)){console.error("time is not a valid number",this,o,a),e=!1;break}if(null!==n&&n>a){console.error("out of order keys",this,o,a,n),e=!1;break}n=a}if(void 0!==r&&m.AnimationUtils.isTypedArray(r))for(o=0,t=r.length;o!==t;++o)if(i=r[o],isNaN(i)){console.error("value is not a valid number",this,o,i),e=!1;break}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),i=1,n=1,o=e.length-1;n<=o;++n){var a=!1;if((l=e[n])!==e[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=t[s+l];if(u!==t[h+l]||u!==t[c+l]){a=!0;break}}if(a){if(n!==i)for(e[i]=e[n],a=n*r,s=i*r,l=0;l!==r;++l)t[s+l]=t[a+l];++i}}return i!==e.length&&(this.times=m.AnimationUtils.arraySlice(e,0,i),this.values=m.AnimationUtils.arraySlice(t,0,i*r)),this}},Object.assign(m.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw Error("track type undefined, can not parse");var t=m.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var r=[],i=[];m.AnimationUtils.flattenJSON(e.keys,r,i,"value"),e.times=r,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){if(void 0!==(t=e.constructor).toJSON)t=t.toJSON(e);else{var t={name:e.name,times:m.AnimationUtils.convertArray(e.times,Array),values:m.AnimationUtils.convertArray(e.values,Array)},r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.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: "+e)}}),m.PropertyBinding=function(e,t,r){this.path=t,this.parsedPath=r||m.PropertyBinding.parseTrackName(t),this.node=m.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},m.PropertyBinding.prototype={constructor:m.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(this.node=e=m.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var o=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("  can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);for(e=e.skeleton.bones,r=0;r<e.length;r++)if(e[r].name===o){o=r;break}break;default:if(void 0===e[r])return void console.error("  can not bind to objectName of node, undefined",this);e=e[r]}if(void 0!==o){if(void 0===e[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[o]}}if(o=e[i]){if(t=this.Versioning.None,void 0!==e.needsUpdate?(t=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(t=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e),r=this.BindingType.Direct,void 0!==n){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.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(e.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][t]}else console.error("  trying to update property for track: "+t.nodeName+"."+i+" but it wasn't found.",e)}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(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),m.PropertyBinding.Composite=function(e,t,r){r=r||m.PropertyBinding.parseTrackName(t),this._targetGroup=e,this._bindings=e.subscribe_(t,r)},m.PropertyBinding.Composite.prototype={constructor:m.PropertyBinding.Composite,getValue:function(e,t){this.bind();var r=this._bindings[this._targetGroup.nCachedObjects_];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},m.PropertyBinding.create=function(e,t,r){return e instanceof m.AnimationObjectGroup?new m.PropertyBinding.Composite(e,t,r):new m.PropertyBinding(e,t,r)},m.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw Error("cannot parse trackName at all: "+e);if(r.index===t.lastIndex&&t.lastIndex++,null===(t={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]}).propertyName||0===t.propertyName.length)throw Error("can not parse propertyName from trackName: "+e);return t},m.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r<e.bones.length;r++){var i=e.bones[r];if(i.name===t)return i}return null}(e.skeleton);if(r)return r}if(e.children){var i=function(e){for(var r=0;r<e.length;r++){var n=e[r];if(n.name===t||n.uuid===t||(n=i(n.children)))return n}return null};if(r=i(e.children))return r}return null},m.PropertyMixer=function(e,t,r){switch(this.binding=e,this.valueSize=r,e=Float64Array,t){case"quaternion":t=this._slerp;break;case"string":case"bool":e=Array,t=this._select;break;default:t=this._lerp}this.buffer=new e(4*r),this._mixBufferRegion=t,this.referenceCount=this.useCount=this.cumulativeWeight=0},m.PropertyMixer.prototype={constructor:m.PropertyMixer,accumulate:function(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,o=this.cumulativeWeight;if(0===o){for(o=0;o!==i;++o)r[n+o]=r[o];o=t}else o+=t,this._mixBufferRegion(r,n,0,t/o,i);this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,r=this.buffer;e=e*t+t;var i=this.cumulativeWeight,n=this.binding;this.cumulativeWeight=0,1>i&&this._mixBufferRegion(r,e,3*t,1-i,t);i=t;for(var o=t+t;i!==o;++i)if(r[i]!==r[i+t]){n.setValue(r,e);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,r=3*t;this.binding.getValue(e,r);for(var i=t;i!==r;++i)e[i]=e[r+i%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,r,i,n){if(.5<=i)for(i=0;i!==n;++i)e[t+i]=e[r+i]},_slerp:function(e,t,r,i,n){m.Quaternion.slerpFlat(e,t,e,t,e,r,i)},_lerp:function(e,t,r,i,n){for(var o=1-i,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*i}}},m.BooleanKeyframeTrack=function(e,t,r){m.KeyframeTrack.call(this,e,t,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(e,t,r,i){m.KeyframeTrack.call(this,e,t,r,i)},m.NumberKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.NumberKeyframeTrack,ValueTypeName:"number"}),m.QuaternionKeyframeTrack=function(e,t,r,i){m.KeyframeTrack.call(this,e,t,r,i)},m.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:m.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new m.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),m.StringKeyframeTrack=function(e,t,r,i){m.KeyframeTrack.call(this,e,t,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(e,t,r,i){m.KeyframeTrack.call(this,e,t,r,i)},m.VectorKeyframeTrack.prototype=Object.assign(Object.create(m.KeyframeTrack.prototype),{constructor:m.VectorKeyframeTrack,ValueTypeName:"vector"}),m.Audio=function(e){m.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.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(e){var t=new m.AudioBuffer(this.context);return t.load(e),this.setBuffer(t),this},m.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},m.Audio.prototype.setBuffer=function(e){var t=this;return e.onReady(function(e){t.source.buffer=e,t.sourceType="buffer",t.autoplay&&t.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 e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,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(e){void 0===e&&(e=null),!0===this.isPlaying?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},m.Audio.prototype.setPlaybackRate=function(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!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(e){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=e},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(e){this.gain.gain.value=e},m.Audio.prototype.getVolume=function(){return this.gain.gain.value},m.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},m.AudioAnalyser.prototype={constructor:m.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},m.AudioBuffer=function(e){this.context=e,this.ready=!1,this.readyCallbacks=[]},m.AudioBuffer.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){for(t.buffer=e,t.ready=!0,e=0;e<t.readyCallbacks.length;e++)t.readyCallbacks[e](t.buffer);t.readyCallbacks=[]})},r.send(),this},m.AudioBuffer.prototype.onReady=function(e){this.ready?e(this.buffer):this.readyCallbacks.push(e)},m.PositionalAudio=function(e){m.Audio.call(this,e),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(e){this.panner.refDistance=e},m.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},m.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},m.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},m.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},m.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},m.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},m.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},m.PositionalAudio.prototype.updateMatrixWorld=(pe=new m.Vector3,function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),pe.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(pe.x,pe.y,pe.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(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},m.AudioListener.prototype.getFilter=function(){return this.filter},m.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},m.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},m.AudioListener.prototype.updateMatrixWorld=(he=new m.Vector3,ce=new m.Quaternion,le=new m.Vector3,ue=new m.Vector3,function(e){m.Object3D.prototype.updateMatrixWorld.call(this,e),e=this.context.listener;var t=this.up;this.matrixWorld.decompose(he,ce,le),ue.set(0,0,-1).applyQuaternion(ce),e.setPosition(he.x,he.y,he.z),e.setOrientation(ue.x,ue.y,ue.z,t.x,t.y,t.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=(se=new m.Quaternion,function(e){return e=e||new m.Vector3,this.getWorldQuaternion(se),e.set(0,0,-1).applyQuaternion(se)}),m.Camera.prototype.lookAt=(ae=new m.Matrix4,function(e){ae.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(ae)}),m.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},m.Camera.prototype.copy=function(e){return m.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},m.CubeCamera=function(e,t,r){m.Object3D.call(this),this.type="CubeCamera";var i=new m.PerspectiveCamera(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new m.Vector3(1,0,0)),this.add(i);var n=new m.PerspectiveCamera(90,1,e,t);n.up.set(0,-1,0),n.lookAt(new m.Vector3(-1,0,0)),this.add(n);var o=new m.PerspectiveCamera(90,1,e,t);o.up.set(0,0,1),o.lookAt(new m.Vector3(0,1,0)),this.add(o);var a=new m.PerspectiveCamera(90,1,e,t);a.up.set(0,0,-1),a.lookAt(new m.Vector3(0,-1,0)),this.add(a);var s=new m.PerspectiveCamera(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new m.Vector3(0,0,1)),this.add(s);var h=new m.PerspectiveCamera(90,1,e,t);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(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,i,r),r.activeCubeFace=1,e.render(t,n,r),r.activeCubeFace=2,e.render(t,o,r),r.activeCubeFace=3,e.render(t,a,r),r.activeCubeFace=4,e.render(t,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,e.render(t,h,r),e.setRenderTarget(null)}},m.CubeCamera.prototype=Object.create(m.Object3D.prototype),m.CubeCamera.prototype.constructor=m.CubeCamera,m.OrthographicCamera=function(e,t,r,i,n,o){m.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,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 e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,i+t,i-t,this.near,this.far)},m.OrthographicCamera.prototype.copy=function(e){return m.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},m.OrthographicCamera.prototype.toJSON=function(e){return(e=m.Object3D.prototype.toJSON.call(this,e)).object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,e},m.PerspectiveCamera=function(e,t,r,i){m.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t: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(e,t){void 0===t&&(t=24),this.fov=2*m.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,i,n,o){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},m.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=m.Math.radToDeg(2*Math.atan(Math.tan(.5*m.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=(r=this.fullWidth/this.fullHeight)*(i=-(e=Math.tan(m.Math.degToRad(.5*e))*this.near)),r=Math.abs(r*e-t),i=Math.abs(e-i);this.projectionMatrix.makeFrustum(t+this.x*r/this.fullWidth,t+(this.x+this.width)*r/this.fullWidth,e-(this.y+this.height)*i/this.fullHeight,e-this.y*i/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},m.PerspectiveCamera.prototype.copy=function(e){return m.Camera.prototype.copy.call(this,e),this.focalLength=e.focalLength,this.zoom=e.zoom,this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this},m.PerspectiveCamera.prototype.toJSON=function(e){return(e=m.Object3D.prototype.toJSON.call(this,e)).object.focalLength=this.focalLength,e.object.zoom=this.zoom,e.object.fov=this.fov,e.object.aspect=this.aspect,e.object.near=this.near,e.object.far=this.far,e},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:(ne=new m.Matrix4,oe=new m.Matrix4,function(e){if($!==e.focalLength||ee!==e.fov||te!==e.aspect*this.aspect||re!==e.near||ie!==e.far){$=e.focalLength,ee=e.fov,te=e.aspect*this.aspect,re=e.near,ie=e.far;var t,r,i=e.projectionMatrix.clone(),n=.032*re/$,o=re*Math.tan(m.Math.degToRad(.5*ee));oe.elements[12]=-.032,ne.elements[12]=.032,t=-o*te+n,r=o*te+n,i.elements[0]=2*re/(r-t),i.elements[8]=(r+t)/(r-t),this.cameraL.projectionMatrix.copy(i),t=-o*te-n,r=o*te-n,i.elements[0]=2*re/(r-t),i.elements[8]=(r+t)/(r-t),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(oe),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(ne)})},m.Light=function(e,t){m.Object3D.call(this),this.type="Light",this.color=new m.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},m.Light.prototype=Object.create(m.Object3D.prototype),m.Light.prototype.constructor=m.Light,m.Light.prototype.copy=function(e){return m.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},m.Light.prototype.toJSON=function(e){return(e=m.Object3D.prototype.toJSON.call(this,e)).object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.exponent&&(e.object.exponent=this.exponent),e},m.LightShadow=function(e){this.camera=e,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(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},m.AmbientLight=function(e,t){m.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},m.AmbientLight.prototype=Object.create(m.Light.prototype),m.AmbientLight.prototype.constructor=m.AmbientLight,m.DirectionalLight=function(e,t){m.Light.call(this,e,t),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(e){return m.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},m.HemisphereLight=function(e,t,r){m.Light.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new m.Color(t)},m.HemisphereLight.prototype=Object.create(m.Light.prototype),m.HemisphereLight.prototype.constructor=m.HemisphereLight,m.HemisphereLight.prototype.copy=function(e){return m.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},m.PointLight=function(e,t,r,i){m.Light.call(this,e,t),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(e){return m.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},m.SpotLight=function(e,t,r,i,n,o){m.Light.call(this,e,t),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(e){return m.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.exponent=e.exponent,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},m.Cache={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},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(e){return 1===(e=e.split("/")).length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:function(e,t,r){function i(e,i,n,a,s){e=t+e;var h=m.Loader.Handlers.get(e);return null!==h?e=h.load(e):(K.setCrossOrigin(r),e=K.load(e)),void 0!==i&&(e.repeat.fromArray(i),1!==i[0]&&(e.wrapS=m.RepeatWrapping),1!==i[1]&&(e.wrapT=m.RepeatWrapping)),void 0!==n&&e.offset.fromArray(n),void 0!==a&&("repeat"===a[0]&&(e.wrapS=m.RepeatWrapping),"mirror"===a[0]&&(e.wrapS=m.MirroredRepeatWrapping),"repeat"===a[1]&&(e.wrapT=m.RepeatWrapping),"mirror"===a[1]&&(e.wrapT=m.MirroredRepeatWrapping)),void 0!==s&&(e.anisotropy=s),i=m.Math.generateUUID(),o[i]=e,i}void 0===Q&&(Q=new m.Color),void 0===K&&(K=new m.TextureLoader),void 0===J&&(J=new m.MaterialLoader);var n,o={},a={uuid:m.Math.generateUUID(),type:"MeshLambertMaterial"};for(n in e){var s=e[n];switch(n){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":a.name=s;break;case"blending":a.blending=m[s];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":a.color=Q.fromArray(s).getHex();break;case"colorSpecular":a.specular=Q.fromArray(s).getHex();break;case"colorEmissive":a.emissive=Q.fromArray(s).getHex();break;case"specularCoef":a.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(a.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(a.type="MeshPhongMaterial");break;case"mapDiffuse":a.map=i(s,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":a.lightMap=i(s,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":a.aoMap=i(s,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":a.bumpMap=i(s,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":a.bumpScale=s;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":a.normalMap=i(s,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":a.normalScale=[s,s];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":a.specularMap=i(s,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":a.alphaMap=i(s,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":a.side=m.BackSide;break;case"doubleSided":a.side=m.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),a.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":a[n]=s;break;case"vertexColors":!0===s&&(a.vertexColors=m.VertexColors),"face"===s&&(a.vertexColors=m.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",n,s)}}return"MeshBasicMaterial"===a.type&&delete a.emissive,"MeshPhongMaterial"!==a.type&&delete a.specular,1>a.opacity&&(a.transparent=!0),J.setTextures(o),J.parse(a)}},m.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;r<i;r+=2){var n=t[r+1];if(t[r].test(e))return n}return null}},m.XHRLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.XHRLoader.prototype={constructor:m.XHRLoader,load:function(e,t,r,i){void 0!==this.path&&(e=this.path+e);var n=this,o=m.Cache.get(e);if(void 0!==o)return t&&setTimeout(function(){t(o)},0),o;var a=new XMLHttpRequest;return a.overrideMimeType("text/plain"),a.open("GET",e,!0),a.addEventListener("load",function(r){var o=r.target.response;m.Cache.add(e,o),200===this.status?(t&&t(o),n.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(o),n.manager.itemEnd(e)):(i&&i(r),n.manager.itemError(e))},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(e),a},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},m.FontLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.FontLoader.prototype={constructor:m.FontLoader,load:function(e,t,r,i){new m.XHRLoader(this.manager).load(e,function(e){t(new m.Font(JSON.parse(e.substring(65,e.length-2))))},r,i)}},m.ImageLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.ImageLoader.prototype={constructor:m.ImageLoader,load:function(e,t,r,i){void 0!==this.path&&(e=this.path+e);var n=this,o=m.Cache.get(e);if(void 0!==o)return n.manager.itemStart(e),t?setTimeout(function(){t(o),n.manager.itemEnd(e)},0):n.manager.itemEnd(e),o;var a=document.createElement("img");return a.addEventListener("load",function(r){m.Cache.add(e,this),t&&t(this),n.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},m.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e: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(e,t,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:m.Loader.prototype.extractUrlBase(e),a=new m.XHRLoader(this.manager);a.setWithCredentials(this.withCredentials),a.load(e,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: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===i.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}r=n.parse(r,o),t(r.geometry,r.materials)},r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){var r=new m.Geometry,i=void 0!==e.scale?1/e.scale:1;return function(t){var i,n,o,a,s,h,c,l,u,p,d,f,g,v=e.faces;h=e.vertices;var y=e.normals,x=e.colors,b=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.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).x=h[a++]*t,i.y=h[a++]*t,i.z=h[a++]*t,r.vertices.push(i);for(a=0,s=v.length;a<s;)if(u=1&(t=v[a++]),o=2&t,i=8&t,c=16&t,p=32&t,h=64&t,t&=128,u){if((u=new m.Face3).a=v[a],u.b=v[a+1],u.c=v[a+3],(d=new m.Face3).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=e.uvs[i],r.faceVertexUvs[i][o]=[],r.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)g=f[2*(l=v[a++])],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=x[h=v[a++]],u.color.setHex(h),d.color.setHex(h)),t)for(i=0;4>i;i++)h=x[h=v[a++]],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).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=e.uvs[i],r.faceVertexUvs[i][o]=[],n=0;3>n;n++)g=f[2*(l=v[a++])],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])),t)for(i=0;3>i;i++)h=v[a++],u.vertexColors.push(new m.Color(x[h]));r.faces.push(u)}}(i),function(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;i<n;i+=t)r.skinWeights.push(new m.Vector4(e.skinWeights[i],1<t?e.skinWeights[i+1]:0,2<t?e.skinWeights[i+2]:0,3<t?e.skinWeights[i+3]:0));if(e.skinIndices)for(i=0,n=e.skinIndices.length;i<n;i+=t)r.skinIndices.push(new m.Vector4(e.skinIndices[i],1<t?e.skinIndices[i+1]:0,2<t?e.skinIndices[i+2]:0,3<t?e.skinIndices[i+3]:0));r.bones=e.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(t){if(void 0!==e.morphTargets)for(var i=0,n=e.morphTargets.length;i<n;i++){r.morphTargets[i]={},r.morphTargets[i].name=e.morphTargets[i].name,r.morphTargets[i].vertices=[];for(var o=r.morphTargets[i].vertices,a=e.morphTargets[i].vertices,s=0,h=a.length;s<h;s+=3){var c=new m.Vector3;c.x=a[s]*t,c.y=a[s+1]*t,c.z=a[s+2]*t,o.push(c)}}if(void 0!==e.morphColors&&0<e.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),t=r.faces,o=e.morphColors[0].colors,i=0,n=t.length;i<n;i++)t[i].color.fromArray(o,3*i)}(i),function(){var t=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n=0;n<i.length;n++){var o=m.AnimationClip.parseAnimation(i[n],r.bones);o&&t.push(o)}r.morphTargets&&(i=m.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets,10),t=t.concat(i)),0<t.length&&(r.animations=t)}(),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:r}:(i=m.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin),{geometry:r,materials:i})}},m.LoadingManager=function(e,t,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,!1===n&&void 0!==i.onStart&&i.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(n=!1,void 0!==i.onLoad)&&i.onLoad()},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},m.DefaultLoadingManager=new m.LoadingManager,m.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.BufferGeometryLoader.prototype={constructor:m.BufferGeometryLoader,load:function(e,t,r,i){var n=this;new m.XHRLoader(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},parse:function(e){var t=new m.BufferGeometry,r=e.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),t.setIndex(new m.BufferAttribute(r,1)));var n,o=e.data.attributes;for(n in o){var a=o[n];r=new i[a.type](a.array);t.addAttribute(n,new m.BufferAttribute(r,a.itemSize))}if(void 0!==(i=e.data.groups||e.data.drawcalls||e.data.offsets))for(n=0,r=i.length;n!==r;++n)o=i[n],t.addGroup(o.start,o.count,o.materialIndex);return void 0!==(e=e.data.boundingSphere)&&(i=new m.Vector3,void 0!==e.center&&i.fromArray(e.center),t.boundingSphere=new m.Sphere(i,e.radius)),t}},m.MaterialLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager,this.textures={}},m.MaterialLoader.prototype={constructor:m.MaterialLoader,load:function(e,t,r,i){var n=this;new m.XHRLoader(n.manager).load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new m[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale&&(r=e.normalScale,!1===Array.isArray(r)&&(r=[r,r]),t.normalScale=(new m.Vector2).fromArray(r)),void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=m.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var r=0,i=e.materials.length;r<i;r++)t.materials.push(this.parse(e.materials[r]));return t}},m.ObjectLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager,this.texturePath=""},m.ObjectLoader.prototype={constructor:m.ObjectLoader,load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this;new m.XHRLoader(n.manager).load(e,function(e){n.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(n)}),n=(i=this.parseTextures(e.textures,i),i=this.parseMaterials(e.materials,i),this.parseObject(e.object,r,i));return e.animations&&(n.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0===t||t(n),n},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new m.JSONLoader,i=new m.BufferGeometryLoader,n=0,o=e.length;n<o;n++){var a,s=e[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),t[s.uuid]=a}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var i=new m.MaterialLoader;i.setTextures(t);for(var n=0,o=e.length;n<o;n++){var a=i.parse(e[n]);r[a.uuid]=a}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var i=m.AnimationClip.parse(e[r]);t.push(i)}return t},parseImages:function(e,t){var r=this,i={};if(void 0!==e&&0<e.length){var n=new m.LoadingManager(t),o=new m.ImageLoader(n);o.setCrossOrigin(this.crossOrigin);n=0;for(var a=e.length;n<a;n++){var s=e[n],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:r.texturePath+s.url;i[s.uuid]=function(e){return r.manager.itemStart(e),o.load(e,function(){r.manager.itemEnd(e)})}(h)}}return i},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),m[e])}var i={};if(void 0!==e)for(var n=0,o=e.length;n<o;n++){var a=e[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new m.Texture(t[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:(Z=new m.Matrix4,function(e,t,r){function i(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function n(e){if(void 0!==e)return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]}var o;switch(e.type){case"Scene":o=new m.Scene;break;case"PerspectiveCamera":o=new m.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":o=new m.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":o=new m.AmbientLight(e.color,e.intensity);break;case"DirectionalLight":o=new m.DirectionalLight(e.color,e.intensity);break;case"PointLight":o=new m.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":o=new m.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":o=new m.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":o=i(e.geometry);var a=n(e.material);o=o.bones&&0<o.bones.length?new m.SkinnedMesh(o,a):new m.Mesh(o,a);break;case"LOD":o=new m.LOD;break;case"Line":o=new m.Line(i(e.geometry),n(e.material),e.mode);break;case"PointCloud":case"Points":o=new m.Points(i(e.geometry),n(e.material));break;case"Sprite":o=new m.Sprite(n(e.material));break;case"Group":o=new m.Group;break;default:o=new m.Object3D}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(Z.fromArray(e.matrix),Z.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.children)for(var s in e.children)o.add(this.parseObject(e.children[s],t,r));if("LOD"===e.type)for(e=e.levels,a=0;a<e.length;a++){var h=e[a];void 0!==(s=o.getObjectByProperty("uuid",h.object))&&o.addLevel(s,h.distance)}return o})},m.TextureLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.TextureLoader.prototype={constructor:m.TextureLoader,load:function(e,t,r,i){var n=new m.Texture,o=new m.ImageLoader(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},r,i),n},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},m.CubeTextureLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager},m.CubeTextureLoader.prototype={constructor:m.CubeTextureLoader,load:function(e,t,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<e.length;++r)!function(r){o.load(e[r],function(e){n.images[r]=e,6==++a&&(n.needsUpdate=!0,t&&t(n))},void 0,i)}(r);return n},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},m.DataTextureLoader=m.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager,this._parser=null},m.BinaryTextureLoader.prototype={constructor:m.BinaryTextureLoader,load:function(e,t,r,i){var n=this,o=new m.DataTexture,a=new m.XHRLoader(this.manager);return a.setResponseType("arraybuffer"),a.load(e,function(e){(e=n._parser(e))&&(void 0!==e.image?o.image=e.image:void 0!==e.data&&(o.image.width=e.width,o.image.height=e.height,o.image.data=e.data),o.wrapS=void 0!==e.wrapS?e.wrapS:m.ClampToEdgeWrapping,o.wrapT=void 0!==e.wrapT?e.wrapT:m.ClampToEdgeWrapping,o.magFilter=void 0!==e.magFilter?e.magFilter:m.LinearFilter,o.minFilter=void 0!==e.minFilter?e.minFilter:m.LinearMipMapLinearFilter,o.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(o.format=e.format),void 0!==e.type&&(o.type=e.type),void 0!==e.mipmaps&&(o.mipmaps=e.mipmaps),1===e.mipmapCount&&(o.minFilter=m.LinearFilter),o.needsUpdate=!0,t&&t(o,e))},r,i),o}},m.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:m.DefaultLoadingManager,this._parser=null},m.CompressedTextureLoader.prototype={constructor:m.CompressedTextureLoader,load:function(e,t,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(e))for(var h=0,c=0,l=e.length;c<l;++c)!function(c){s.load(e[c],function(e){e=n._parser(e,!0),o[c]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(h+=1)&&(1===e.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=e.format,a.needsUpdate=!0,t&&t(a))},r,i)}(c);else s.load(e,function(e){if((e=n._parser(e,!0)).isCubemap)for(var r=e.mipmaps.length/e.mipmapCount,i=0;i<r;i++){o[i]={mipmaps:[]};for(var s=0;s<e.mipmapCount;s++)o[i].mipmaps.push(e.mipmaps[i*e.mipmapCount+s]),o[i].format=e.format,o[i].width=e.width,o[i].height=e.height}else a.image.width=e.width,a.image.height=e.height,a.mipmaps=e.mipmaps;1===e.mipmapCount&&(a.minFilter=m.LinearFilter),a.format=e.format,a.needsUpdate=!0,t&&t(a)},r,i);return a},setPath:function(e){this.path=e}},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(e){!0===e&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0===r)console.warn("THREE.Material: '"+t+"' parameter is undefined.");else{var i=this[t];void 0===i?console.warn("THREE."+this.type+": '"+t+"' 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[t]="overdraw"===t?Number(r):r}}},toJSON:function(e){function t(e){var t,r=[];for(t in e){var i=e[t];delete i.metadata,r.push(i)}return r}var r=void 0===e;r&&(e={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(e).uuid),this.alphaMap instanceof m.Texture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof m.Texture&&(i.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof m.Texture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap instanceof m.Texture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap instanceof m.Texture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap instanceof m.Texture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof m.Texture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof m.Texture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof m.Texture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof m.Texture&&(i.envMap=this.envMap.toJSON(e).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=t(e.textures),e=t(e.images),0<r.length&&(i.textures=r),0<e.length&&(i.images=e)),i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.overdraw=e.overdraw,this.visible=e.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(e){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(e)},m.LineBasicMaterial.prototype=Object.create(m.Material.prototype),m.LineBasicMaterial.prototype.constructor=m.LineBasicMaterial,m.LineBasicMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},m.LineDashedMaterial=function(e){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(e)},m.LineDashedMaterial.prototype=Object.create(m.Material.prototype),m.LineDashedMaterial.prototype.constructor=m.LineDashedMaterial,m.LineDashedMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},m.MeshBasicMaterial=function(e){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(e)},m.MeshBasicMaterial.prototype=Object.create(m.Material.prototype),m.MeshBasicMaterial.prototype.constructor=m.MeshBasicMaterial,m.MeshBasicMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},m.MeshLambertMaterial=function(e){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(e)},m.MeshLambertMaterial.prototype=Object.create(m.Material.prototype),m.MeshLambertMaterial.prototype.constructor=m.MeshLambertMaterial,m.MeshLambertMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},m.MeshPhongMaterial=function(e){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(e)},m.MeshPhongMaterial.prototype=Object.create(m.Material.prototype),m.MeshPhongMaterial.prototype.constructor=m.MeshPhongMaterial,m.MeshPhongMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},m.MeshStandardMaterial=function(e){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(e)},m.MeshStandardMaterial.prototype=Object.create(m.Material.prototype),m.MeshStandardMaterial.prototype.constructor=m.MeshStandardMaterial,m.MeshStandardMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},m.MeshDepthMaterial=function(e){m.Material.call(this),this.type="MeshDepthMaterial",this.wireframe=this.morphTargets=!1,this.wireframeLinewidth=1,this.setValues(e)},m.MeshDepthMaterial.prototype=Object.create(m.Material.prototype),m.MeshDepthMaterial.prototype.constructor=m.MeshDepthMaterial,m.MeshDepthMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},m.MeshNormalMaterial=function(e){m.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},m.MeshNormalMaterial.prototype=Object.create(m.Material.prototype),m.MeshNormalMaterial.prototype.constructor=m.MeshNormalMaterial,m.MeshNormalMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},m.MultiMaterial=function(e){this.uuid=m.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},m.MultiMaterial.prototype={constructor:m.MultiMaterial,toJSON:function(e){for(var t={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(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},m.PointsMaterial=function(e){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(e)},m.PointsMaterial.prototype=Object.create(m.Material.prototype),m.PointsMaterial.prototype.constructor=m.PointsMaterial,m.PointsMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},m.ShaderMaterial=function(e){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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},m.ShaderMaterial.prototype=Object.create(m.Material.prototype),m.ShaderMaterial.prototype.constructor=m.ShaderMaterial,m.ShaderMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=m.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},m.ShaderMaterial.prototype.toJSON=function(e){return(e=m.Material.prototype.toJSON.call(this,e)).uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},m.RawShaderMaterial=function(e){m.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},m.RawShaderMaterial.prototype=Object.create(m.ShaderMaterial.prototype),m.RawShaderMaterial.prototype.constructor=m.RawShaderMaterial,m.SpriteMaterial=function(e){m.Material.call(this),this.type="SpriteMaterial",this.color=new m.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},m.SpriteMaterial.prototype=Object.create(m.Material.prototype),m.SpriteMaterial.prototype.constructor=m.SpriteMaterial,m.SpriteMaterial.prototype.copy=function(e){return m.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},m.Texture=function(e,t,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!==e?e:m.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t: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(e){!0===e&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this},toJSON:function(e){if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var t={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===e.images[r.uuid]){var i,n=e.images,o=r.uuid,a=r.uuid;void 0!==r.toDataURL?i=r:((i=document.createElement("canvas")).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}}t.image=r.uuid}return e.textures[this.uuid]=t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===m.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),0>e.x||1<e.x)switch(this.wrapS){case m.RepeatWrapping:e.x-=Math.floor(e.x);break;case m.ClampToEdgeWrapping:e.x=0>e.x?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case m.RepeatWrapping:e.y-=Math.floor(e.y);break;case m.ClampToEdgeWrapping:e.y=0>e.y?0:1;break;case m.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},m.EventDispatcher.prototype.apply(m.Texture.prototype),m.TextureIdCount=0,m.CanvasTexture=function(e,t,r,i,n,o,a,s,h){m.Texture.call(this,e,t,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(e,t,r,i,n,o,a,s,h){t=void 0!==t?t:m.CubeReflectionMapping,m.Texture.call(this,e,t,r,i,n,o,a,s,h),this.images=e,this.flipY=!1},m.CubeTexture.prototype=Object.create(m.Texture.prototype),m.CubeTexture.prototype.constructor=m.CubeTexture,m.CubeTexture.prototype.copy=function(e){return m.Texture.prototype.copy.call(this,e),this.images=e.images,this},m.CompressedTexture=function(e,t,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:t,height:r},this.mipmaps=e,this.generateMipmaps=this.flipY=!1},m.CompressedTexture.prototype=Object.create(m.Texture.prototype),m.CompressedTexture.prototype.constructor=m.CompressedTexture,m.DataTexture=function(e,t,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:e,width:t,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(e,t,r,i,n,o,a,s,h){m.Texture.call(this,e,t,r,i,n,o,a,s,h),this.generateMipmaps=!1;var c=this;!function t(){requestAnimationFrame(t),e.readyState===e.HAVE_ENOUGH_DATA&&(c.needsUpdate=!0)}()},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(e,t){m.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new m.Geometry,this.material=void 0!==t?t: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=(X=new m.Matrix4,q=new m.Ray,Y=new m.Sphere,function(e,t){function r(r,n){var a=q.distanceSqToPoint(r);if(a<s){var h=q.closestPointToPoint(r);h.applyMatrix4(o);var c=e.ray.origin.distanceTo(h);c<e.near||c>e.far||t.push({distance:c,distanceToRay:Math.sqrt(a),point:h.clone(),index:n,face:null,object:i})}}var i=this,n=this.geometry,o=this.matrixWorld,a=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Y.copy(n.boundingSphere),Y.applyMatrix4(o),!1!==e.ray.intersectsSphere(Y)){X.getInverse(o),q.copy(e.ray).applyMatrix4(X);var s=(a/=(this.scale.x+this.scale.y+this.scale.z)/3)*a;if(a=new m.Vector3,n instanceof m.BufferGeometry){var h=n.index;if(n=n.attributes.position.array,null!==h)for(var c=h.array,l=(h=0,c.length);h<l;h++){var u=c[h];a.fromArray(n,3*u),r(a,u)}else for(h=0,c=n.length/3;h<c;h++)a.fromArray(n,3*h),r(a,h)}else for(h=0,c=(a=n.vertices).length;h<c;h++)r(a[h],h)}}),m.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Line=function(e,t,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new m.LineSegments(e,t);m.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new m.Geometry,this.material=void 0!==t?t: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=(H=new m.Matrix4,j=new m.Ray,W=new m.Sphere,function(e,t){var r=(r=e.linePrecision)*r,i=this.geometry,n=this.matrixWorld;if(null===i.boundingSphere&&i.computeBoundingSphere(),W.copy(i.boundingSphere),W.applyMatrix4(n),!1!==e.ray.intersectsSphere(W)){H.getInverse(n),j.copy(e.ray).applyMatrix4(H);var o=new m.Vector3,a=new m.Vector3,s=(n=new m.Vector3,new m.Vector3),h=this instanceof m.LineSegments?2:1;if(i instanceof m.BufferGeometry){var c=i.index,l=i.attributes.position.array;if(null!==c){i=0;for(var u=(c=c.array).length-1;i<u;i+=h){var p=c[i+1];o.fromArray(l,3*c[i]),a.fromArray(l,3*p),(p=j.distanceSqToSegment(o,a,s,n))>r||(s.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(s))<e.near||p>e.far||t.push({distance:p,point:n.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this}))}}else for(i=0,u=l.length/3-1;i<u;i+=h)o.fromArray(l,3*i),a.fromArray(l,3*i+3),(p=j.distanceSqToSegment(o,a,s,n))>r||(s.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(s))<e.near||p>e.far||t.push({distance:p,point:n.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this}))}else if(i instanceof m.Geometry)for(a=(o=i.vertices).length,i=0;i<a-1;i+=h)(p=j.distanceSqToSegment(o[i],o[i+1],s,n))>r||(s.applyMatrix4(this.matrixWorld),(p=e.ray.origin.distanceTo(s))<e.near||p>e.far||t.push({distance:p,point:n.clone().applyMatrix4(this.matrixWorld),index:i,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(e,t){m.Line.call(this,e,t),this.type="LineSegments"},m.LineSegments.prototype=Object.create(m.Line.prototype),m.LineSegments.prototype.constructor=m.LineSegments,m.Mesh=function(e,t){m.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new m.Geometry,this.material=void 0!==t?t: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(e){this.drawMode=e},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 e=0,t=this.geometry.morphTargets.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},m.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},m.Mesh.prototype.raycast=function(){function e(e,t,r,i,n,o,a){return m.Triangle.barycoordFromPoint(e,t,r,i,g),n.multiplyScalar(g.x),o.multiplyScalar(g.y),a.multiplyScalar(g.z),n.add(o).add(a),n.clone()}function t(e,t,r,i,n,o,a){var s=e.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(e.matrixWorld),(r=t.ray.origin.distanceTo(y))<t.near||r>t.far?null:{distance:r,point:y.clone(),object:e})}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=t(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=e(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,b,_=this.geometry,w=this.material,M=this.matrixWorld;if(void 0!==w&&(null===_.boundingSphere&&_.computeBoundingSphere(),o.copy(_.boundingSphere),o.applyMatrix4(M),!1!==g.ray.intersectsSphere(o)&&(i.getInverse(M),n.copy(g.ray).applyMatrix4(i),null===_.boundingBox||!1!==n.intersectsBox(_.boundingBox))))if(_ instanceof m.BufferGeometry){var S,E;w=_.index,_=(M=_.attributes).position.array;if(void 0!==M.uv&&(x=M.uv.array),null!==w)for(var T=0,C=(M=w.array).length;T<C;T+=3)w=M[T],S=M[T+1],E=M[T+2],(b=r(this,g,n,_,x,w,S,E))&&(b.faceIndex=Math.floor(T/3),y.push(b));else for(T=0,C=_.length;T<C;T+=9)(b=r(this,g,n,_,x,w=T/3,S=w+1,E=w+2))&&(b.index=w,y.push(b))}else if(_ instanceof m.Geometry){var L,A;T=!0==(M=w instanceof m.MultiMaterial)?w.materials:null,C=_.vertices;S=_.faces,0<(E=_.faceVertexUvs[0]).length&&(x=E);for(var P=0,R=S.length;P<R;P++){var U=S[P];if(void 0!==(b=!0===M?T[U.materialIndex]:w)){if(E=C[U.a],L=C[U.b],A=C[U.c],!0===b.morphTargets){b=_.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=b.length;D<I;D++){var F=k[D];if(0!==F){var B=b[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}(b=t(this,g,n,E,L,A,v))&&(x&&(k=x[P],p.copy(k[0]),d.copy(k[1]),f.copy(k[2]),b.uv=e(v,E,L,A,p,d,f)),b.face=U,b.faceIndex=P,y.push(b))}}}}}(),m.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},m.Bone=function(e){m.Object3D.call(this),this.type="Bone",this.skin=e},m.Bone.prototype=Object.create(m.Object3D.prototype),m.Bone.prototype.constructor=m.Bone,m.Bone.prototype.copy=function(e){return m.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},m.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0===r||r,this.identityMatrix=new m.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture?(e=Math.sqrt(4*this.bones.length),e=m.Math.nextPowerOfTwo(Math.ceil(e)),this.boneTextureHeight=this.boneTextureWidth=e=Math.max(e,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===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new m.Matrix4)},m.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new m.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},m.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},m.Skeleton.prototype.update=(z=new m.Matrix4,function(){for(var e=0,t=this.bones.length;e<t;e++)z.multiplyMatrices(this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix,this.boneInverses[e]),z.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(e,t,r){if(m.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new m.Matrix4,this.bindMatrixInverse=new m.Matrix4,e=[],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],t=new m.Bone(this),e.push(t),t.name=i.name,t.position.fromArray(i.pos),t.quaternion.fromArray(i.rotq),void 0!==i.scl&&t.scale.fromArray(i.scl);for(n=0,o=this.geometry.bones.length;n<o;++n)-1!==(i=this.geometry.bones[n]).parent&&null!==i.parent?e[i.parent].add(e[n]):this.add(e[n])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new m.Skeleton(e,void 0,r),this.matrixWorld)},m.SkinnedMesh.prototype=Object.create(m.Mesh.prototype),m.SkinnedMesh.prototype.constructor=m.SkinnedMesh,m.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},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 e=1/(t=this.geometry.skinWeights[i]).lengthManhattan();1/0!==e?t.multiplyScalar(e):t.set(1,0,0,0)}else if(this.geometry instanceof m.BufferGeometry)for(var t=new m.Vector4,r=this.geometry.attributes.skinWeight,i=0;i<r.count;i++)t.x=r.getX(i),t.y=r.getY(i),t.z=r.getZ(i),t.w=r.getW(i),1/0!==(e=1/t.lengthManhattan())?t.multiplyScalar(e):t.set(1,0,0,0),r.setXYZW(i,t.x,t.y,t.z,t.w)},m.SkinnedMesh.prototype.updateMatrixWorld=function(e){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(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,i=0;i<r.length&&!(t<r[i].distance);i++);r.splice(i,0,{distance:t,object:e}),this.add(e)},m.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,r=1,i=t.length;r<i&&!(e<t[r].distance);r++);return t[r-1].object},m.LOD.prototype.raycast=(G=new m.Vector3,function(e,t){G.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(G);this.getObjectForDistance(r).raycast(e,t)}),m.LOD.prototype.update=(N=new m.Vector3,O=new m.Vector3,function(e){var t=this.levels;if(1<t.length){N.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(this.matrixWorld),e=N.distanceTo(O),t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&e>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<i;r++)t[r].object.visible=!1}}),m.LOD.prototype.copy=function(e){m.Object3D.prototype.copy.call(this,e,!1);for(var t=0,r=(e=e.levels).length;t<r;t++){var i=e[t];this.addLevel(i.object.clone(),i.distance)}return this},m.LOD.prototype.toJSON=function(e){(e=m.Object3D.prototype.toJSON.call(this,e)).object.levels=[];for(var t=this.levels,r=0,i=t.length;r<i;r++){var n=t[r];e.object.levels.push({object:n.object.uuid,distance:n.distance})}return e},m.Sprite=(I=new Uint16Array([0,1,2,0,2,3]),F=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),B=new Float32Array([0,0,1,0,1,1,0,1]),(V=new m.BufferGeometry).setIndex(new m.BufferAttribute(I,1)),V.addAttribute("position",new m.BufferAttribute(F,3)),V.addAttribute("uv",new m.BufferAttribute(B,2)),function(e){m.Object3D.call(this),this.type="Sprite",this.geometry=V,this.material=void 0!==e?e:new m.SpriteMaterial}),m.Sprite.prototype=Object.create(m.Object3D.prototype),m.Sprite.prototype.constructor=m.Sprite,m.Sprite.prototype.raycast=(D=new m.Vector3,function(e,t){D.setFromMatrixPosition(this.matrixWorld);var r=e.ray.distanceSqToPoint(D);r>this.scale.x*this.scale.y||t.push({distance:Math.sqrt(r),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(e,t,r,i,n){m.Object3D.call(this),this.lensFlares=[],this.positionScreen=new m.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,n)},m.LensFlare.prototype=Object.create(m.Object3D.prototype),m.LensFlare.prototype.constructor=m.LensFlare,m.LensFlare.prototype.add=function(e,t,r,i,n,o){void 0===t&&(t=-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:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},m.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;e<r;e++)(t=this.lensFlares[e]).x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},m.LensFlare.prototype.copy=function(e){m.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;t<r;t++)this.lensFlares.push(e.lensFlares[t]);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(e){return m.Object3D.prototype.copy.call(this,e),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},m.Fog=function(e,t,r){this.name="",this.color=new m.Color(e),this.near=void 0!==t?t: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(e,t){this.name="",this.color=new m.Color(e),this.density=void 0!==t?t: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(e){for(var t={},r=0;r<e.length;r++){var i,n=this.clone(e[r]);for(i in n)t[i]=n[i]}return t},clone:function(e){var t,r={};for(t in e)for(var i in r[t]={},e[t]){var n=e[t][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[t][i]=n.clone():Array.isArray(n)?r[t][i]=n.slice():r[t][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(e){function t(e,t,r,i){!0===D&&(e*=i,t*=i,r*=i),ye.clearColor(e,t,r,i)}function r(){ye.init(),ye.scissor(J.copy(se).multiplyScalar(ae)),ye.viewport(ee.copy(ce).multiplyScalar(ae)),t(re.r,re.g,re.b,ie)}function i(){K=X=null,Q="",Z=-1,ye.reset()}function n(e){e.preventDefault(),i(),r(),xe.clear()}function o(e){(e=e.target).removeEventListener("dispose",o);e:{var t=xe.get(e);if(e.image&&t.__image__webglTextureCube)j.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)break e;j.deleteTexture(t.__webglTexture)}xe.delete(e)}fe.textures--}function a(e){(e=e.target).removeEventListener("dispose",a);var t=xe.get(e),r=xe.get(e.texture);if(e&&void 0!==r.__webglTexture){if(j.deleteTexture(r.__webglTexture),e instanceof m.WebGLRenderTargetCube)for(r=0;6>r;r++)j.deleteFramebuffer(t.__webglFramebuffer[r]),j.deleteRenderbuffer(t.__webglDepthbuffer[r]);else j.deleteFramebuffer(t.__webglFramebuffer),j.deleteRenderbuffer(t.__webglDepthbuffer);xe.delete(e.texture),xe.delete(e)}fe.textures--}function s(e){(e=e.target).removeEventListener("dispose",s),h(e),xe.delete(e)}function h(e){var t=xe.get(e).program;e.program=void 0,void 0!==t&&_e.releaseProgram(t)}function c(e,t){return Math.abs(t[0])-Math.abs(e[0])}function l(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function u(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function p(e,t,r,i,n){var o;r.transparent?(i=N,o=++O):(i=B,o=++V),void 0!==(o=i[o])?(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.z=pe.z,o.group=n):(o={id:e.id,object:e,geometry:t,material:r,z:pe.z,group:n},i.push(o))}function d(e,t,r,i){for(var n=0,o=e.length;n<o;n++){var a=(c=e[n]).object,s=c.geometry,h=void 0===i?c.material:i,c=c.group;if(a.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),a instanceof m.ImmediateRenderObject){f(h);var l=g(t,r,h,a);Q="",a.render(function(e){W.renderBufferImmediate(e,l,h)})}else W.renderBufferDirect(t,r,s,h,a,c)}}function f(e){e.side!==m.DoubleSide?ye.enable(j.CULL_FACE):ye.disable(j.CULL_FACE),ye.setFlipSided(e.side===m.BackSide),!0===e.transparent?ye.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):ye.setBlending(m.NoBlending),ye.setDepthFunc(e.depthFunc),ye.setDepthTest(e.depthTest),ye.setDepthWrite(e.depthWrite),ye.setColorWrite(e.colorWrite),ye.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function g(e,t,r,i){te=0;var n=xe.get(r);if(void 0===n.program&&(r.needsUpdate=!0),void 0!==n.lightsHash&&n.lightsHash!==de.hash&&(r.needsUpdate=!0),r.needsUpdate){e:{var o=xe.get(r),a=_e.getParameters(r,de,t,i),c=_e.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 e;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=_e.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=de.hash,a.ambientLightColor.value=de.ambient,a.directionalLights.value=de.directional,a.spotLights.value=de.spot,a.pointLights.value=de.point,a.hemisphereLights.value=de.hemi,a.directionalShadowMap.value=de.directionalShadowMap,a.directionalShadowMatrix.value=de.directionalShadowMatrix,a.spotShadowMap.value=de.spotShadowMap,a.spotShadowMatrix.value=de.spotShadowMatrix,a.pointShadowMap.value=de.pointShadowMap,a.pointShadowMatrix.value=de.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,p=(o=n.program).getUniforms(),a=n.__webglShader.uniforms,o.id!==X&&(j.useProgram(o.program),X=o.id,l=c=u=!0),r.id!==Z&&(Z=r.id,c=!0),(u||e!==K)&&(j.uniformMatrix4fv(p.projectionMatrix,!1,e.projectionMatrix.elements),ve.logarithmicDepthBuffer&&j.uniform1f(p.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==K&&(K=e,l=c=!0),(r instanceof m.ShaderMaterial||r instanceof m.MeshPhongMaterial||r instanceof m.MeshStandardMaterial||r.envMap)&&void 0!==p.cameraPosition&&(pe.setFromMatrixPosition(e.matrixWorld),j.uniform3f(p.cameraPosition,pe.x,pe.y,pe.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&&j.uniformMatrix4fv(p.viewMatrix,!1,e.matrixWorldInverse.elements)),r.skinning&&(i.bindMatrix&&void 0!==p.bindMatrix&&j.uniformMatrix4fv(p.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&j.uniformMatrix4fv(p.bindMatrixInverse,!1,i.bindMatrixInverse.elements),ve.floatVertexTextures&&i.skeleton&&i.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(u=v(),j.uniform1i(p.boneTexture,u),W.setTexture(i.skeleton.boneTexture,u)),void 0!==p.boneTextureWidth&&j.uniform1i(p.boneTextureWidth,i.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&j.uniform1i(p.boneTextureHeight,i.skeleton.boneTextureHeight)):i.skeleton&&i.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&j.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.skeleton.boneMatrices)),c){var d;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),t&&r.fog&&(a.fogColor.value=t.color,t instanceof m.Fog?(a.fogNear.value=t.near,a.fogFar.value=t.far):t instanceof m.FogExp2&&(a.fogDensity.value=t.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),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),t=d.offset,d=d.repeat,a.offsetRepeat.value.set(t.x,t.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*ae,a.scale.value=L.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=e.near,a.mFar.value=e.far,a.opacity.value=r.opacity):r instanceof m.MeshNormalMaterial&&(a.opacity.value=r.opacity),y(n.uniformsList)}if(j.uniformMatrix4fv(p.modelViewMatrix,!1,i.modelViewMatrix.elements),p.normalMatrix&&j.uniformMatrix3fv(p.normalMatrix,!1,i.normalMatrix.elements),void 0!==p.modelMatrix&&j.uniformMatrix4fv(p.modelMatrix,!1,i.matrixWorld.elements),!0===n.hasDynamicUniforms){for(r=[],d=0,t=(n=n.uniformsList).length;d<t;d++)void 0!==(a=(p=n[d][0]).onUpdateCallback)&&(a.bind(p)(i,e),r.push(n[d]));y(r)}return o}function v(){var e=te;return e>=ve.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+ve.maxTextures),te+=1,e}function y(e){for(var t,r,i=0,n=e.length;i<n;i++){var o=e[i][0];if(!1!==o.needsUpdate){var a=o.type;t=o.value;var s=e[i][1];switch(a){case"1i":j.uniform1i(s,t);break;case"1f":j.uniform1f(s,t);break;case"2f":j.uniform2f(s,t[0],t[1]);break;case"3f":j.uniform3f(s,t[0],t[1],t[2]);break;case"4f":j.uniform4f(s,t[0],t[1],t[2],t[3]);break;case"1iv":j.uniform1iv(s,t);break;case"3iv":j.uniform3iv(s,t);break;case"1fv":j.uniform1fv(s,t);break;case"2fv":j.uniform2fv(s,t);break;case"3fv":j.uniform3fv(s,t);break;case"4fv":j.uniform4fv(s,t);break;case"Matrix2fv":j.uniformMatrix2fv(s,!1,t);break;case"Matrix3fv":j.uniformMatrix3fv(s,!1,t);break;case"Matrix4fv":j.uniformMatrix4fv(s,!1,t);break;case"i":j.uniform1i(s,t);break;case"f":j.uniform1f(s,t);break;case"v2":j.uniform2f(s,t.x,t.y);break;case"v3":j.uniform3f(s,t.x,t.y,t.z);break;case"v4":j.uniform4f(s,t.x,t.y,t.z,t.w);break;case"c":j.uniform3f(s,t.r,t.g,t.b);break;case"sa":for(a=0;a<t.length;a++)for(var h in o.properties){var c=s[a][h];switch(r=t[a][h],o.properties[h].type){case"i":j.uniform1i(c,r);break;case"f":j.uniform1f(c,r);break;case"v2":j.uniform2f(c,r.x,r.y);break;case"v3":j.uniform3f(c,r.x,r.y,r.z);break;case"v4":j.uniform4f(c,r.x,r.y,r.z,r.w);break;case"c":j.uniform3f(c,r.r,r.g,r.b);break;case"m4":j.uniformMatrix4fv(c,!1,r.elements)}}break;case"iv1":j.uniform1iv(s,t);break;case"iv":j.uniform3iv(s,t);break;case"fv1":j.uniform1fv(s,t);break;case"fv":j.uniform3fv(s,t);break;case"v2v":for(void 0===o._array&&(o._array=new Float32Array(2*t.length)),r=a=0,c=t.length;a<c;a++,r+=2)o._array[r+0]=t[a].x,o._array[r+1]=t[a].y;j.uniform2fv(s,o._array);break;case"v3v":for(void 0===o._array&&(o._array=new Float32Array(3*t.length)),r=a=0,c=t.length;a<c;a++,r+=3)o._array[r+0]=t[a].x,o._array[r+1]=t[a].y,o._array[r+2]=t[a].z;j.uniform3fv(s,o._array);break;case"v4v":for(void 0===o._array&&(o._array=new Float32Array(4*t.length)),r=a=0,c=t.length;a<c;a++,r+=4)o._array[r+0]=t[a].x,o._array[r+1]=t[a].y,o._array[r+2]=t[a].z,o._array[r+3]=t[a].w;j.uniform4fv(s,o._array);break;case"m2":j.uniformMatrix2fv(s,!1,t.elements);break;case"m3":j.uniformMatrix3fv(s,!1,t.elements);break;case"m3v":for(void 0===o._array&&(o._array=new Float32Array(9*t.length)),a=0,c=t.length;a<c;a++)t[a].flattenToArrayOffset(o._array,9*a);j.uniformMatrix3fv(s,!1,o._array);break;case"m4":j.uniformMatrix4fv(s,!1,t.elements);break;case"m4v":for(void 0===o._array&&(o._array=new Float32Array(16*t.length)),a=0,c=t.length;a<c;a++)t[a].flattenToArrayOffset(o._array,16*a);j.uniformMatrix4fv(s,!1,o._array);break;case"t":if(r=v(),j.uniform1i(s,r),!t)continue;t instanceof m.CubeTexture||Array.isArray(t.image)&&6===t.image.length?w(t,r):t instanceof m.WebGLRenderTargetCube?M(t.texture,r):t instanceof m.WebGLRenderTarget?W.setTexture(t.texture,r):W.setTexture(t,r);break;case"tv":for(void 0===o._array&&(o._array=[]),a=0,c=o.value.length;a<c;a++)o._array[a]=v();for(j.uniform1iv(s,o._array),a=0,c=o.value.length;a<c;a++)t=o.value[a],r=o._array[a],t&&(t instanceof m.CubeTexture||t.image instanceof Array&&6===t.image.length?w(t,r):t instanceof m.WebGLRenderTarget?W.setTexture(t.texture,r):t instanceof m.WebGLRenderTargetCube?M(t.texture,r):W.setTexture(t,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function x(e,t,r){r?(j.texParameteri(e,j.TEXTURE_WRAP_S,C(t.wrapS)),j.texParameteri(e,j.TEXTURE_WRAP_T,C(t.wrapT)),j.texParameteri(e,j.TEXTURE_MAG_FILTER,C(t.magFilter)),j.texParameteri(e,j.TEXTURE_MIN_FILTER,C(t.minFilter))):(j.texParameteri(e,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(e,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),t.wrapS===m.ClampToEdgeWrapping&&t.wrapT===m.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),j.texParameteri(e,j.TEXTURE_MAG_FILTER,T(t.magFilter)),j.texParameteri(e,j.TEXTURE_MIN_FILTER,T(t.minFilter)),t.minFilter!==m.NearestFilter&&t.minFilter!==m.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),!(r=ge.get("EXT_texture_filter_anisotropic"))||t.type===m.FloatType&&null===ge.get("OES_texture_float_linear")||t.type===m.HalfFloatType&&null===ge.get("OES_texture_half_float_linear")||!(1<t.anisotropy||xe.get(t).__currentAnisotropy)||(j.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,W.getMaxAnisotropy())),xe.get(t).__currentAnisotropy=t.anisotropy)}function b(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");return i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function _(e){return m.Math.isPowerOfTwo(e.width)&&m.Math.isPowerOfTwo(e.height)}function w(e,t){var r=xe.get(e);if(6===e.image.length)if(0<e.version&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",o),r.__image__webglTextureCube=j.createTexture(),fe.textures++),ye.activeTexture(j.TEXTURE0+t),ye.bindTexture(j.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e instanceof m.CompressedTexture,n=e.image[0]instanceof m.DataTexture,a=[],s=0;6>s;s++)a[s]=!W.autoScaleCubemaps||i||n?n?e.image[s].image:e.image[s]:b(e.image[s],ve.maxCubemapSize);var h=_(a[0]),c=C(e.format),l=C(e.type);for(x(j.TEXTURE_CUBE_MAP,e,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],e.format!==m.RGBAFormat&&e.format!==m.RGBFormat?-1<ye.getCompressedTextureFormats().indexOf(c)?ye.compressedTexImage2D(j.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()"):ye.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,c,u.width,u.height,0,c,l,u.data);else n?ye.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,a[s].width,a[s].height,0,c,l,a[s].data):ye.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c,c,l,a[s]);e.generateMipmaps&&h&&j.generateMipmap(j.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else ye.activeTexture(j.TEXTURE0+t),ye.bindTexture(j.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function M(e,t){ye.activeTexture(j.TEXTURE0+t),ye.bindTexture(j.TEXTURE_CUBE_MAP,xe.get(e).__webglTexture)}function S(e,t,r,i){var n=C(t.texture.format),o=C(t.texture.type);ye.texImage2D(i,0,n,t.width,t.height,0,n,o,null),j.bindFramebuffer(j.FRAMEBUFFER,e),j.framebufferTexture2D(j.FRAMEBUFFER,r,i,xe.get(t.texture).__webglTexture,0),j.bindFramebuffer(j.FRAMEBUFFER,null)}function E(e,t){j.bindRenderbuffer(j.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,t.width,t.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,t.width,t.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,e)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,t.width,t.height),j.bindRenderbuffer(j.RENDERBUFFER,null)}function T(e){return e===m.NearestFilter||e===m.NearestMipMapNearestFilter||e===m.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function C(e){var t;if(e===m.RepeatWrapping)return j.REPEAT;if(e===m.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(e===m.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(e===m.NearestFilter)return j.NEAREST;if(e===m.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(e===m.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(e===m.LinearFilter)return j.LINEAR;if(e===m.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(e===m.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(e===m.UnsignedByteType)return j.UNSIGNED_BYTE;if(e===m.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(e===m.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(e===m.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(e===m.ByteType)return j.BYTE;if(e===m.ShortType)return j.SHORT;if(e===m.UnsignedShortType)return j.UNSIGNED_SHORT;if(e===m.IntType)return j.INT;if(e===m.UnsignedIntType)return j.UNSIGNED_INT;if(e===m.FloatType)return j.FLOAT;if(null!==(t=ge.get("OES_texture_half_float"))&&e===m.HalfFloatType)return t.HALF_FLOAT_OES;if(e===m.AlphaFormat)return j.ALPHA;if(e===m.RGBFormat)return j.RGB;if(e===m.RGBAFormat)return j.RGBA;if(e===m.LuminanceFormat)return j.LUMINANCE;if(e===m.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(e===m.AddEquation)return j.FUNC_ADD;if(e===m.SubtractEquation)return j.FUNC_SUBTRACT;if(e===m.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(e===m.ZeroFactor)return j.ZERO;if(e===m.OneFactor)return j.ONE;if(e===m.SrcColorFactor)return j.SRC_COLOR;if(e===m.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(e===m.SrcAlphaFactor)return j.SRC_ALPHA;if(e===m.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(e===m.DstAlphaFactor)return j.DST_ALPHA;if(e===m.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(e===m.DstColorFactor)return j.DST_COLOR;if(e===m.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(e===m.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(null!==(t=ge.get("WEBGL_compressed_texture_s3tc"))){if(e===m.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===m.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===m.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===m.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(t=ge.get("WEBGL_compressed_texture_pvrtc"))){if(e===m.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===m.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===m.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===m.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(t=ge.get("WEBGL_compressed_texture_etc1"))&&e===m.RGB_ETC1_Format)return t.COMPRESSED_RGB_ETC1_WEBGL;if(null!==(t=ge.get("EXT_blend_minmax"))){if(e===m.MinEquation)return t.MIN_EXT;if(e===m.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",m.REVISION);var L=void 0!==(e=e||{}).canvas?e.canvas:document.createElement("canvas"),A=void 0!==e.context?e.context:null,P=void 0!==e.alpha&&e.alpha,R=void 0===e.depth||e.depth,U=void 0===e.stencil||e.stencil,k=void 0!==e.antialias&&e.antialias,D=void 0===e.premultipliedAlpha||e.premultipliedAlpha,I=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,F=[],B=[],V=-1,N=[],O=-1,G=new Float32Array(8),z=[],H=[];this.domElement=L,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 j,W=this,X=null,q=null,Y=null,Z=-1,Q="",K=null,J=new m.Vector4,$=null,ee=new m.Vector4,te=0,re=new m.Color(0),ie=0,ne=L.width,oe=L.height,ae=1,se=new m.Vector4(0,0,ne,oe),he=!1,ce=new m.Vector4(0,0,ne,oe),le=new m.Frustum,ue=new m.Matrix4,pe=new m.Vector3,de={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},fe={geometries:0,textures:0},me={calls:0,vertices:0,faces:0,points:0};this.info={render:me,memory:fe,programs:null};try{if(P={alpha:P,depth:R,stencil:U,antialias:k,premultipliedAlpha:D,preserveDrawingBuffer:I},null===(j=A||L.getContext("webgl",P)||L.getContext("experimental-webgl",P))){if(null!==L.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}L.addEventListener("webglcontextlost",n,!1)}catch(e){console.error("THREE.WebGLRenderer: "+e)}var ge=new m.WebGLExtensions(j);ge.get("OES_texture_float"),ge.get("OES_texture_float_linear"),ge.get("OES_texture_half_float"),ge.get("OES_texture_half_float_linear"),ge.get("OES_standard_derivatives"),ge.get("ANGLE_instanced_arrays"),ge.get("OES_element_index_uint")&&(m.BufferGeometry.MaxIndex=4294967296);var ve=new m.WebGLCapabilities(j,ge,e),ye=new m.WebGLState(j,ge,C),xe=new m.WebGLProperties,be=new m.WebGLObjects(j,xe,this.info),_e=new m.WebGLPrograms(this,ve),we=new m.WebGLLights;this.info.programs=_e.programs;var Me=new m.WebGLBufferRenderer(j,ge,me),Se=new m.WebGLIndexedBufferRenderer(j,ge,me);r(),this.context=j,this.capabilities=ve,this.extensions=ge,this.properties=xe,this.state=ye;var Ee=new m.WebGLShadowMap(this,de,be);this.shadowMap=Ee;var Te,Ce=new m.SpritePlugin(this,z),Le=new m.LensFlarePlugin(this,H);this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){ge.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){if(void 0!==Te)return Te;var e=ge.get("EXT_texture_filter_anisotropic");return Te=null!==e?j.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return ve.precision},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(e){void 0!==e&&(ae=e,this.setSize(ce.z,ce.w,!1))},this.getSize=function(){return{width:ne,height:oe}},this.setSize=function(e,t,r){ne=e,oe=t,L.width=e*ae,L.height=t*ae,!1!==r&&(L.style.width=e+"px",L.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){ye.viewport(ce.set(e,t,r,i))},this.setScissor=function(e,t,r,i){ye.scissor(se.set(e,t,r,i))},this.setScissorTest=function(e){ye.setScissorTest(he=e)},this.getClearColor=function(){return re},this.setClearColor=function(e,r){re.set(e),ie=void 0!==r?r:1,t(re.r,re.g,re.b,ie)},this.getClearAlpha=function(){return ie},this.setClearAlpha=function(e){ie=e,t(re.r,re.g,re.b,ie)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=j.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=j.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=j.STENCIL_BUFFER_BIT),j.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(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=i,this.dispose=function(){L.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(e,t,r){ye.initAttributes();var i=xe.get(e);if(e.hasPositions&&!i.position&&(i.position=j.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=j.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=j.createBuffer()),e.hasColors&&!i.color&&(i.color=j.createBuffer()),t=t.getAttributes(),e.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,i.position),j.bufferData(j.ARRAY_BUFFER,e.positionArray,j.DYNAMIC_DRAW),ye.enableAttribute(t.position),j.vertexAttribPointer(t.position,3,j.FLOAT,!1,0,0)),e.hasNormals){if(j.bindBuffer(j.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===m.FlatShading)for(var n=0,o=3*e.count;n<o;n+=9){var a=e.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}j.bufferData(j.ARRAY_BUFFER,e.normalArray,j.DYNAMIC_DRAW),ye.enableAttribute(t.normal),j.vertexAttribPointer(t.normal,3,j.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(j.bindBuffer(j.ARRAY_BUFFER,i.uv),j.bufferData(j.ARRAY_BUFFER,e.uvArray,j.DYNAMIC_DRAW),ye.enableAttribute(t.uv),j.vertexAttribPointer(t.uv,2,j.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==m.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,i.color),j.bufferData(j.ARRAY_BUFFER,e.colorArray,j.DYNAMIC_DRAW),ye.enableAttribute(t.color),j.vertexAttribPointer(t.color,3,j.FLOAT,!1,0,0)),ye.disableUnusedAttributes(),j.drawArrays(j.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,i,n,o){f(i);var a=g(e,t,i,n),s=!1;if((e=r.id+"_"+a.id+"_"+i.wireframe)!==Q&&(Q=e,s=!0),void 0!==(t=n.morphTargetInfluences)){e=[];var h=0;for(s=t.length;h<s;h++)d=t[h],e.push([d,h]);e.sort(c),8<e.length&&(e.length=8);var l=r.morphAttributes;for(h=0,s=e.length;h<s;h++)d=e[h],G[h]=d[0],0!==d[0]?(t=d[1],!0===i.morphTargets&&l.position&&r.addAttribute("morphTarget"+h,l.position[t]),!0===i.morphNormals&&l.normal&&r.addAttribute("morphNormal"+h,l.normal[t])):(!0===i.morphTargets&&r.removeAttribute("morphTarget"+h),!0===i.morphNormals&&r.removeAttribute("morphNormal"+h));null!==(e=a.getUniforms()).morphTargetInfluences&&j.uniform1fv(e.morphTargetInfluences,G),s=!0}if(t=r.index,h=r.attributes.position,!0===i.wireframe&&(t=be.getWireframeAttribute(r)),null!==t?(e=Se).setIndex(t):e=Me,s){var u;s=void 0;if(r instanceof m.InstancedBufferGeometry&&null===(u=ge.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),ye.initAttributes();var p,d=r.attributes;a=a.getAttributes(),l=i.defaultAttributeValues;for(p in a){var v=a[p];if(0<=v)if(void 0!==(w=d[p])){var y=w.itemSize,x=be.getAttributeBuffer(w);if(w instanceof m.InterleavedBufferAttribute){var b=w.data,_=b.stride,w=w.offset;b instanceof m.InstancedInterleavedBuffer?(ye.enableAttributeAndDivisor(v,b.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=b.meshPerAttribute*b.count)):ye.enableAttribute(v),j.bindBuffer(j.ARRAY_BUFFER,x),j.vertexAttribPointer(v,y,j.FLOAT,!1,_*b.array.BYTES_PER_ELEMENT,(s*_+w)*b.array.BYTES_PER_ELEMENT)}else w instanceof m.InstancedBufferAttribute?(ye.enableAttributeAndDivisor(v,w.meshPerAttribute,u),void 0===r.maxInstancedCount&&(r.maxInstancedCount=w.meshPerAttribute*w.count)):ye.enableAttribute(v),j.bindBuffer(j.ARRAY_BUFFER,x),j.vertexAttribPointer(v,y,j.FLOAT,!1,0,s*y*4)}else if(void 0!==l&&void 0!==(y=l[p]))switch(y.length){case 2:j.vertexAttrib2fv(v,y);break;case 3:j.vertexAttrib3fv(v,y);break;case 4:j.vertexAttrib4fv(v,y);break;default:j.vertexAttrib1fv(v,y)}}ye.disableUnusedAttributes()}null!==t&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,be.getAttributeBuffer(t))}if(u=1/0,null!==t?u=t.count:void 0!==h&&(u=h.count),p=r.drawRange.start,t=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+t,h+s)-1,u=Math.max(0,u-o+1),n instanceof m.Mesh)if(!0===i.wireframe)ye.setLineWidth(i.wireframeLinewidth*(null===q?ae:1)),e.setMode(j.LINES);else switch(n.drawMode){case m.TrianglesDrawMode:e.setMode(j.TRIANGLES);break;case m.TriangleStripDrawMode:e.setMode(j.TRIANGLE_STRIP);break;case m.TriangleFanDrawMode:e.setMode(j.TRIANGLE_FAN)}else n instanceof m.Line?(void 0===(i=i.linewidth)&&(i=1),ye.setLineWidth(i*(null===q?ae:1)),n instanceof m.LineSegments?e.setMode(j.LINES):e.setMode(j.LINE_STRIP)):n instanceof m.Points&&e.setMode(j.POINTS);r instanceof m.InstancedBufferGeometry&&0<r.maxInstancedCount?e.renderInstances(r,o,u):e.render(o,u)},this.render=function(e,t,r,i){if(0==t instanceof m.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var n=e.fog;Q="",Z=-1,K=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),ue.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),le.setFromMatrix(ue),F.length=0,O=V=-1,z.length=0,H.length=0,function e(t,r){if(!1!==t.visible){if(t.layers.test(r.layers))if(t instanceof m.Light)F.push(t);else if(t instanceof m.Sprite)!1!==t.frustumCulled&&!0!==le.intersectsObject(t)||z.push(t);else if(t instanceof m.LensFlare)H.push(t);else if(t instanceof m.ImmediateRenderObject)!0===W.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyProjection(ue)),p(t,null,t.material,pe.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===le.intersectsObject(t))&&!0===(a=t.material).visible)){!0===W.sortObjects&&(pe.setFromMatrixPosition(t.matrixWorld),pe.applyProjection(ue));var i=be.update(t);if(a instanceof m.MultiMaterial)for(var n=i.groups,o=a.materials,a=0,s=n.length;a<s;a++){var h=n[a],c=o[h.materialIndex];!0===c.visible&&p(t,i,c,pe.z,h)}else p(t,i,a,pe.z,null)}for(a=0,s=(i=t.children).length;a<s;a++)e(i[a],r)}}(e,t),B.length=V+1,N.length=O+1,!0===W.sortObjects&&(B.sort(l),N.sort(u));var o,a,s,h,c,f,g=F,v=0,y=0,x=0,b=t.matrixWorldInverse,w=0,M=0,S=0,E=0,T=0;for(o=de.shadowsPointLight=0,a=g.length;o<a;o++)if(h=(s=g[o]).color,c=s.intensity,f=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=we.get(s);C.color.copy(s.color).multiplyScalar(s.intensity),C.direction.setFromMatrixPosition(s.matrixWorld),pe.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pe),C.direction.transformDirection(b),(C.shadow=s.castShadow)&&(C.shadowBias=s.shadow.bias,C.shadowRadius=s.shadow.radius,C.shadowMapSize=s.shadow.mapSize,de.shadows[T++]=s),de.directionalShadowMap[w]=s.shadow.map,de.directionalShadowMatrix[w]=s.shadow.matrix,de.directional[w++]=C}else s instanceof m.SpotLight?((C=we.get(s)).position.setFromMatrixPosition(s.matrixWorld),C.position.applyMatrix4(b),C.color.copy(h).multiplyScalar(c),C.distance=f,C.direction.setFromMatrixPosition(s.matrixWorld),pe.setFromMatrixPosition(s.target.matrixWorld),C.direction.sub(pe),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,de.shadows[T++]=s),de.spotShadowMap[S]=s.shadow.map,de.spotShadowMatrix[S]=s.shadow.matrix,de.spot[S++]=C):s instanceof m.PointLight?((C=we.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,de.shadows[T++]=s),de.pointShadowMap[M]=s.shadow.map,void 0===de.pointShadowMatrix[M]&&(de.pointShadowMatrix[M]=new m.Matrix4),pe.setFromMatrixPosition(s.matrixWorld).negate(),de.pointShadowMatrix[M].identity().setPosition(pe),de.point[M++]=C):s instanceof m.HemisphereLight&&((C=we.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),de.hemi[E++]=C);de.ambient[0]=v,de.ambient[1]=y,de.ambient[2]=x,de.directional.length=w,de.spot.length=S,de.point.length=M,de.hemi.length=E,de.shadows.length=T,de.hash=w+","+M+","+S+","+E+","+T,Ee.render(e,t),me.calls=0,me.vertices=0,me.faces=0,me.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial?(i=e.overrideMaterial,d(B,t,n,i),d(N,t,n,i)):(ye.setBlending(m.NoBlending),d(B,t,n),d(N,t,n)),Ce.render(e,t),Le.render(e,t,ee),r&&(e=r.texture).generateMipmaps&&_(r)&&e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter&&(e=r instanceof m.WebGLRenderTargetCube?j.TEXTURE_CUBE_MAP:j.TEXTURE_2D,r=xe.get(r.texture).__webglTexture,ye.bindTexture(e,r),j.generateMipmap(e),ye.bindTexture(e,null)),ye.setDepthTest(!0),ye.setDepthWrite(!0),ye.setColorWrite(!0)}},this.setFaceCulling=function(e,t){e===m.CullFaceNone?ye.disable(j.CULL_FACE):(t===m.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),e===m.CullFaceBack?j.cullFace(j.BACK):e===m.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),ye.enable(j.CULL_FACE))},this.setTexture=function(e,t){var r=xe.get(e);if(0<e.version&&r.__version!==e.version)if(void 0===(n=e.image))console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else if(!1===n.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e);else{void 0===r.__webglInit&&(r.__webglInit=!0,e.addEventListener("dispose",o),r.__webglTexture=j.createTexture(),fe.textures++),ye.activeTexture(j.TEXTURE0+t),ye.bindTexture(j.TEXTURE_2D,r.__webglTexture),j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,e.flipY),j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),j.pixelStorei(j.UNPACK_ALIGNMENT,e.unpackAlignment);var i=b(e.image,ve.maxTextureSize);(e.wrapS!==m.ClampToEdgeWrapping||e.wrapT!==m.ClampToEdgeWrapping||e.minFilter!==m.NearestFilter&&e.minFilter!==m.LinearFilter)&&!1===_(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=_(i),a=C(e.format),s=C(e.type);x(j.TEXTURE_2D,e,n);var h=e.mipmaps;if(e instanceof m.DataTexture)if(0<h.length&&n){for(var c=0,l=h.length;c<l;c++)i=h[c],ye.texImage2D(j.TEXTURE_2D,c,a,i.width,i.height,0,a,s,i.data);e.generateMipmaps=!1}else ye.texImage2D(j.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(e instanceof m.CompressedTexture)for(c=0,l=h.length;c<l;c++)i=h[c],e.format!==m.RGBAFormat&&e.format!==m.RGBFormat?-1<ye.getCompressedTextureFormats().indexOf(a)?ye.compressedTexImage2D(j.TEXTURE_2D,c,a,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ye.texImage2D(j.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],ye.texImage2D(j.TEXTURE_2D,c,a,a,s,i);e.generateMipmaps=!1}else ye.texImage2D(j.TEXTURE_2D,0,a,a,s,i);e.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_2D),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else ye.activeTexture(j.TEXTURE0+t),ye.bindTexture(j.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(e){if((q=e)&&void 0===xe.get(e).__webglFramebuffer){var t=xe.get(e),r=xe.get(e.texture);e.addEventListener("dispose",a),r.__webglTexture=j.createTexture(),fe.textures++;var i=e instanceof m.WebGLRenderTargetCube,n=m.Math.isPowerOfTwo(e.width)&&m.Math.isPowerOfTwo(e.height);if(i){t.__webglFramebuffer=[];for(var o=0;6>o;o++)t.__webglFramebuffer[o]=j.createFramebuffer()}else t.__webglFramebuffer=j.createFramebuffer();if(i){for(ye.bindTexture(j.TEXTURE_CUBE_MAP,r.__webglTexture),x(j.TEXTURE_CUBE_MAP,e.texture,n),o=0;6>o;o++)S(t.__webglFramebuffer[o],e,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+o);e.texture.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP),ye.bindTexture(j.TEXTURE_CUBE_MAP,null)}else ye.bindTexture(j.TEXTURE_2D,r.__webglTexture),x(j.TEXTURE_2D,e.texture,n),S(t.__webglFramebuffer,e,j.COLOR_ATTACHMENT0,j.TEXTURE_2D),e.texture.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_2D),ye.bindTexture(j.TEXTURE_2D,null);if(e.depthBuffer){if(t=xe.get(e),e instanceof m.WebGLRenderTargetCube)for(t.__webglDepthbuffer=[],r=0;6>r;r++)j.bindFramebuffer(j.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=j.createRenderbuffer(),E(t.__webglDepthbuffer[r],e);else j.bindFramebuffer(j.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=j.createRenderbuffer(),E(t.__webglDepthbuffer,e);j.bindFramebuffer(j.FRAMEBUFFER,null)}}t=e instanceof m.WebGLRenderTargetCube,e?(r=xe.get(e),r=t?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,J.copy(e.scissor),$=e.scissorTest,ee.copy(e.viewport)):(r=null,J.copy(se).multiplyScalar(ae),$=he,ee.copy(ce).multiplyScalar(ae)),Y!==r&&(j.bindFramebuffer(j.FRAMEBUFFER,r),Y=r),ye.scissor(J),ye.setScissorTest($),ye.viewport(ee),t&&(t=xe.get(e.texture),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,t.__webglTexture,0))},this.readRenderTargetPixels=function(e,t,r,i,n,o){if(0==e instanceof m.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var a=xe.get(e).__webglFramebuffer;if(a){var s=!1;a!==Y&&(j.bindFramebuffer(j.FRAMEBUFFER,a),s=!0);try{var h=e.texture;h.format!==m.RGBAFormat&&C(h.format)!==j.getParameter(j.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):h.type===m.UnsignedByteType||C(h.type)===j.getParameter(j.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===m.FloatType&&ge.get("WEBGL_color_buffer_float")||h.type===m.HalfFloatType&&ge.get("EXT_color_buffer_half_float")?j.checkFramebufferStatus(j.FRAMEBUFFER)===j.FRAMEBUFFER_COMPLETE?j.readPixels(t,r,i,n,C(h.format),C(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&&j.bindFramebuffer(j.FRAMEBUFFER,Y)}}}}},m.WebGLRenderTarget=function(e,t,r){this.uuid=m.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new m.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new m.Vector4(0,0,e,t),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(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.shareDepthFrom=e.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},m.EventDispatcher.prototype.apply(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube=function(e,t,r){m.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},m.WebGLRenderTargetCube.prototype=Object.create(m.WebGLRenderTarget.prototype),m.WebGLRenderTargetCube.prototype.constructor=m.WebGLRenderTargetCube,m.WebGLBufferRenderer=function(e,t,r){var i;this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.calls++,r.vertices+=n,i===e.TRIANGLES&&(r.faces+=n/3)},this.renderInstances=function(n){var o=t.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=a instanceof m.InterleavedBufferAttribute?a.data.count:a.count;o.drawArraysInstancedANGLE(i,0,s,n.maxInstancedCount),r.calls++,r.vertices+=s*n.maxInstancedCount,i===e.TRIANGLES&&(r.faces+=n.maxInstancedCount*s/3)}}},m.WebGLIndexedBufferRenderer=function(e,t,r){var i,n,o;this.setMode=function(e){i=e},this.setIndex=function(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(n=e.UNSIGNED_INT,o=4):(n=e.UNSIGNED_SHORT,o=2)},this.render=function(t,a){e.drawElements(i,a,n,t*o),r.calls++,r.vertices+=a,i===e.TRIANGLES&&(r.faces+=a/3)},this.renderInstances=function(a,s,h){var c=t.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===e.TRIANGLES&&(r.faces+=a.maxInstancedCount*h/3))}},m.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i}},m.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.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=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=0<this.maxVertexTextures,this.floatFragmentTextures=!!t.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=!!t.get("EXT_frag_depth"))},m.WebGLGeometries=function(e,t,r){function i(e){var a=e.target;null!==(e=o[a.id]).index&&n(e.index);var s,h=e.attributes;for(s in h)n(h[s]);a.removeEventListener("dispose",i),delete o[a.id],(s=t.get(a)).wireframe&&n(s.wireframe),t.delete(a),(a=t.get(e)).wireframe&&n(a.wireframe),t.delete(e),r.memory.geometries--}function n(r){var i;void 0!==(i=r instanceof m.InterleavedBufferAttribute?t.get(r.data).__webglBuffer:t.get(r).__webglBuffer)&&(e.deleteBuffer(i),r instanceof m.InterleavedBufferAttribute?t.delete(r.data):t.delete(r))}var o={};this.get=function(e){var t,n=e.geometry;return void 0!==o[n.id]?o[n.id]:(n.addEventListener("dispose",i),n instanceof m.BufferGeometry?t=n:n instanceof m.Geometry&&(void 0===n._bufferGeometry&&(n._bufferGeometry=(new m.BufferGeometry).setFromObject(e)),t=n._bufferGeometry),o[n.id]=t,r.memory.geometries++,t)}},m.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.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 e[t.id]=r}},m.WebGLObjects=function(e,t,r){function i(r,i){var n=r instanceof m.InterleavedBufferAttribute?r.data:r,o=t.get(n);void 0===o.__webglBuffer?(o.__webglBuffer=e.createBuffer(),e.bindBuffer(i,o.__webglBuffer),e.bufferData(i,n.array,n.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW),o.version=n.version):o.version!==n.version&&(e.bindBuffer(i,o.__webglBuffer),!1===n.dynamic||-1===n.updateRange.count?e.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."):(e.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(e,t,r){if(t>r){var i=t;t=r,r=i}return void 0===(i=e[t])?(e[t]=[r],!0):-1===i.indexOf(r)&&(i.push(r),!0)}var o=new m.WebGLGeometries(e,t,r);this.getAttributeBuffer=function(e){return e instanceof m.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer},this.getWireframeAttribute=function(r){var o=t.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={},c=0,l=(s=s.array).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(c=0,l=(s=h.position.array).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 i(a=new m.BufferAttribute(new(65535<r.count?Uint32Array:Uint16Array)(a),1),e.ELEMENT_ARRAY_BUFFER),o.wireframe=a},this.update=function(t){var r=o.get(t);for(var n in t.geometry instanceof m.Geometry&&r.updateFromObject(t),t=r.index,a=r.attributes,null!==t&&i(t,e.ELEMENT_ARRAY_BUFFER),a)i(a[n],e.ARRAY_BUFFER);for(n in t=r.morphAttributes)for(var a=t[n],s=0,h=a.length;s<h;s++)i(a[s],e.ARRAY_BUFFER);return r}},m.WebGLProgram=function(){function e(e){return""!==e}function t(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function r(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,r,i){for(e="",t=parseInt(t);t<parseInt(r);t++)e+=i.replace(/\[ i \]/g,"[ "+t+" ]");return e})}var i=0,n=/^([\w\d_]+)\.([\w\d_]+)$/,o=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,a=/^([\w\d_]+)\[0\]$/;return function(s,h,c,l){var u=s.context,p=c.extensions,d=c.defines,f=c.__webglShader.vertexShader,g=c.__webglShader.fragmentShader,v="SHADOWMAP_TYPE_BASIC";l.shadowMapType===m.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":l.shadowMapType===m.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",x="ENVMAP_MODE_REFLECTION",b="ENVMAP_BLENDING_MULTIPLY";if(l.envMap){switch(c.envMap.mapping){case m.CubeReflectionMapping:case m.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case m.EquirectangularReflectionMapping:case m.EquirectangularRefractionMapping:y="ENVMAP_TYPE_EQUIREC";break;case m.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(c.envMap.mapping){case m.CubeRefractionMapping:case m.EquirectangularRefractionMapping:x="ENVMAP_MODE_REFRACTION"}switch(c.combine){case m.MultiplyOperation:b="ENVMAP_BLENDING_MULTIPLY";break;case m.MixOperation:b="ENVMAP_BLENDING_MIX";break;case m.AddOperation:b="ENVMAP_BLENDING_ADD"}}var _,w,M,S,E,T=0<s.gammaFactor?s.gammaFactor:1,C=(p=(_=p,w=l,M=s.extensions,[(_=_||{}).derivatives||w.bumpMap||w.normalMap||w.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(_.fragDepth||w.logarithmicDepthBuffer)&&M.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",_.drawBuffers&&M.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(_.shaderTextureLOD||w.envMap)&&M.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(e).join("\n")),function(e){var t,r=[];for(t in e){var i=e[t];!1!==i&&r.push("#define "+t+" "+i)}return r.join("\n")}(d)),L=u.createProgram();return c instanceof m.RawShaderMaterial?s=d="":(d=["precision "+l.precision+" float;","precision "+l.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,C,l.supportsVertexTextures?"#define VERTEX_TEXTURES":"",s.gammaInput?"#define GAMMA_INPUT":"",s.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+T,"#define MAX_BONES "+l.maxBones,l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define "+x:"",l.lightMap?"#define USE_LIGHTMAP":"",l.aoMap?"#define USE_AOMAP":"",l.emissiveMap?"#define USE_EMISSIVEMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.displacementMap&&l.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.roughnessMap?"#define USE_ROUGHNESSMAP":"",l.metalnessMap?"#define USE_METALNESSMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.flatShading?"#define FLAT_SHADED":"",l.skinning?"#define USE_SKINNING":"",l.useVertexTexture?"#define BONE_TEXTURE":"",l.morphTargets?"#define USE_MORPHTARGETS":"",l.morphNormals&&!1===l.flatShading?"#define USE_MORPHNORMALS":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.shadowMapEnabled?"#define USE_SHADOWMAP":"",l.shadowMapEnabled?"#define "+v:"",0<l.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",l.sizeAttenuation?"#define USE_SIZEATTENUATION":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer&&s.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(e).join("\n"),s=[p,"precision "+l.precision+" float;","precision "+l.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,C,l.alphaTest?"#define ALPHATEST "+l.alphaTest:"",s.gammaInput?"#define GAMMA_INPUT":"",s.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+T,l.useFog&&l.fog?"#define USE_FOG":"",l.useFog&&l.fogExp?"#define FOG_EXP2":"",l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define "+y:"",l.envMap?"#define "+x:"",l.envMap?"#define "+b:"",l.lightMap?"#define USE_LIGHTMAP":"",l.aoMap?"#define USE_AOMAP":"",l.emissiveMap?"#define USE_EMISSIVEMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.roughnessMap?"#define USE_ROUGHNESSMAP":"",l.metalnessMap?"#define USE_METALNESSMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.flatShading?"#define FLAT_SHADED":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.shadowMapEnabled?"#define USE_SHADOWMAP":"",l.shadowMapEnabled?"#define "+v:"",0<l.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer&&s.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",l.envMap&&s.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(e).join("\n")),f=t(f,l),g=t(g,l),0==c instanceof m.ShaderMaterial&&(f=r(f),g=r(g)),g=s+g,f=m.WebGLShader(u,u.VERTEX_SHADER,d+f),g=m.WebGLShader(u,u.FRAGMENT_SHADER,g),u.attachShader(L,f),u.attachShader(L,g),void 0!==c.index0AttributeName?u.bindAttribLocation(L,0,c.index0AttributeName):!0===l.morphTargets&&u.bindAttribLocation(L,0,"position"),u.linkProgram(L),l=u.getProgramInfoLog(L),v=u.getShaderInfoLog(f),y=u.getShaderInfoLog(g),b=x=!0,!1===u.getProgramParameter(L,u.LINK_STATUS)?(x=!1,console.error("THREE.WebGLProgram: shader error: ",u.getError(),"gl.VALIDATE_STATUS",u.getProgramParameter(L,u.VALIDATE_STATUS),"gl.getProgramInfoLog",l,v,y)):""!==l?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",l):""!==v&&""!==y||(b=!1),b&&(this.diagnostics={runnable:x,material:c,programLog:l,vertexShader:{log:v,prefix:d},fragmentShader:{log:y,prefix:s}}),u.deleteShader(f),u.deleteShader(g),this.getUniforms=function(){if(void 0===S){for(var e={},t=u.getProgramParameter(L,u.ACTIVE_UNIFORMS),r=0;r<t;r++){var i=u.getActiveUniform(L,r).name,s=u.getUniformLocation(L,i);if(h=n.exec(i)){i=h[1];var h=h[2];(c=e[i])||(c=e[i]={}),c[h]=s}else if(h=o.exec(i)){var c=h[1],l=(i=h[2],h=h[3],e[c]);l||(l=e[c]=[]),(c=l[i])||(c=l[i]={}),c[h]=s}else(h=a.exec(i))?e[c=h[1]]=s:e[i]=s}S=e}return S},this.getAttributes=function(){if(void 0===E){for(var e={},t=u.getProgramParameter(L,u.ACTIVE_ATTRIBUTES),r=0;r<t;r++){var i=u.getActiveAttrib(L,r).name;e[i]=u.getAttribLocation(L,i)}E=e}return E},this.destroy=function(){u.deleteProgram(L),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=i++,this.code=h,this.usedTimes=1,this.program=L,this.vertexShader=f,this.fragmentShader=g,this}}(),m.WebGLPrograms=function(e,t){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];t.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture?s=1024:(s=Math.floor((t.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=e.getPrecision();return null!==r.precision&&(c=t.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",c,"instead."),{shaderID:h,precision:c,supportsVertexTextures:t.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:t.logarithmicDepthBuffer,skinning:r.skinning,maxBones:s,useVertexTexture:t.floatVertexTextures&&a&&a.skeleton&&a.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numHemiLights:n.hemi.length,pointLightShadows:n.shadowsPointLight,shadowMapEnabled:e.shadowMap.enabled&&a.receiveShadow&&0<n.shadows.length,shadowMapType:e.shadowMap.type,alphaTest:r.alphaTest,doubleSided:r.side===m.DoubleSide,flipSided:r.side===m.BackSide}},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(i=0;i<n.length;i++){var o=n[i];r.push(o),r.push(t[o])}return r.join()},this.acquireProgram=function(t,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(e,n,t,i),r.push(o)),o},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r},m.WebGLProperties=function(){var e={};this.get=function(t){t=t.uuid;var r=e[t];return void 0===r&&(r={},e[t]=r),r},this.delete=function(t){delete e[t.uuid]},this.clear=function(){e={}}},m.WebGLShader=function(){return function(e,t,r){var i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),!1===e.getShaderParameter(i,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(i),function(e){e=e.split("\n");for(var t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(r)),i}}(),m.WebGLShadowMap=function(e,t,r){function i(e,t,r,i){var n=e.geometry,o=null,a=(o=p,e.customDepthMaterial);return r&&(o=d,a=e.customDistanceMaterial),a?o=a:(e=e instanceof m.SkinnedMesh&&t.skinning,a=0,void 0!==n.morphTargets&&0<n.morphTargets.length&&t.morphTargets&&(a|=1),e&&(a|=2),o=o[a]),o.visible=t.visible,o.wireframe=t.wireframe,o.wireframeLinewidth=t.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(e,t,r){if(!1!==e.visible){e.layers.test(t.layers)&&(e instanceof m.Mesh||e instanceof m.Line||e instanceof m.Points)&&e.castShadow&&(!1===e.frustumCulled||!0===s.intersectsObject(e))&&!0===e.material.visible&&(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),u.push(e));for(var i=0,o=(e=e.children).length;i<o;i++)n(e[i],t,r)}}for(var o=e.context,a=e.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),w=0;4!==w;++w){var M=0!=(1&w),S=0!=(2&w),E=new m.ShaderMaterial({uniforms:x,vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,morphTargets:M,skinning:S});E._shadowPass=!0,p[w]=E,(M=new m.ShaderMaterial({uniforms:_,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:M,skinning:S}))._shadowPass=!0,d[w]=M}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=t.shadows,_=0,w=b.length;_<w;_++){var M=b[_],S=M.shadow,E=S.camera,C=S.mapSize;if(M 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}),M instanceof m.SpotLight&&(E.aspect=C.x/C.y),E.updateProjectionMatrix()),C=S.map,S=S.matrix,l.setFromMatrixPosition(M.matrixWorld),E.position.copy(l),e.setRenderTarget(C),e.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(M.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),e.renderBufferDirect(E,null,R,B,P,F))}else B=i(P,k,x,l),e.renderBufferDirect(E,null,R,B,P,null)}e.resetGLState()}y=e.getClearColor(),x=e.getClearAlpha(),e.setClearColor(y,x),a.enable(o.BLEND),T.cullFace===m.CullFaceFront&&o.cullFace(o.BACK),e.resetGLState(),T.needsUpdate=!1}}},m.WebGLState=function(e,t,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,w=null,M=null,S=null,E=null,T=null,C=null,L=null,A=null,P=null,R=null,U=null,k=e.getParameter(e.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(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=o.length;e<t;e++)o[e]=0},this.enableAttribute=function(r){o[r]=1,0===a[r]&&(e.enableVertexAttribArray(r),a[r]=1),0!==s[r]&&(t.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),s[r]=0)},this.enableAttributeAndDivisor=function(t,r,i){o[t]=1,0===a[t]&&(e.enableVertexAttribArray(t),a[t]=1),s[t]!==r&&(i.vertexAttribDivisorANGLE(t,r),s[t]=r)},this.disableUnusedAttributes=function(){for(var t=0,r=a.length;t<r;t++)a[t]!==o[t]&&(e.disableVertexAttribArray(t),a[t]=0)},this.enable=function(t){!0!==h[t]&&(e.enable(t),h[t]=!0)},this.disable=function(t){!1!==h[t]&&(e.disable(t),h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i<r.length;i++)c.push(r[i]);return c},this.setBlending=function(t,i,n,o,a,s,h){t===m.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),t!==l&&(t===m.AdditiveBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===m.SubtractiveBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===m.MultiplyBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),l=t),t===m.CustomBlending?(a=a||i,s=s||n,h=h||o,i===u&&a===f||(e.blendEquationSeparate(r(i),r(a)),u=i,f=a),n===p&&o===d&&s===g&&h===v||(e.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(t){if(y!==t){if(t)switch(t){case m.NeverDepth:e.depthFunc(e.NEVER);break;case m.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case m.LessDepth:e.depthFunc(e.LESS);break;case m.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case m.EqualDepth:e.depthFunc(e.EQUAL);break;case m.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case m.GreaterDepth:e.depthFunc(e.GREATER);break;case m.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);y=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){x!==t&&(e.depthMask(t),x=t)},this.setColorWrite=function(t){b!==t&&(e.colorMask(t,t,t,t),b=t)},this.setStencilFunc=function(t,r,i){w===t&&M===r&&S===i||(e.stencilFunc(t,r,i),w=t,M=r,S=i)},this.setStencilOp=function(t,r,i){E===t&&T===r&&C===i||(e.stencilOp(t,r,i),E=t,T=r,C=i)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){_!==t&&(e.stencilMask(t),_=t)},this.setFlipSided=function(t){L!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),L=t)},this.setLineWidth=function(t){t!==A&&(e.lineWidth(t),A=t)},this.setPolygonOffset=function(t,r,i){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||P===r&&R===i||(e.polygonOffset(r,i),P=r,R=i)},this.getScissorTest=function(){return U},this.setScissorTest=function(t){(U=t)?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+k-1),D!==t&&(e.activeTexture(t),D=t)},this.bindTexture=function(t,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===t&&n.texture===r||(e.bindTexture(t,r),n.type=t,n.texture=r)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error(e)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error(e)}},this.clearColor=function(t,r,i,o){n.set(t,r,i,o),!1===F.equals(n)&&(e.clearColor(t,r,i,o),F.copy(n))},this.clearDepth=function(t){B!==t&&(e.clearDepth(t),B=t)},this.clearStencil=function(t){V!==t&&(e.clearStencil(t),V=t)},this.scissor=function(t){!1===N.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),N.copy(t))},this.viewport=function(t){!1===O.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),O.copy(t))},this.reset=function(){for(var t=0;t<a.length;t++)1===a[t]&&(e.disableVertexAttribArray(t),a[t]=0);h={},L=_=x=b=l=c=null}},m.LensFlarePlugin=function(e,t){var r,i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x=e.context,b=e.state;this.render=function(_,w,M){if(0!==t.length){_=new m.Vector3;var S=M.w/M.z,E=.5*M.z,T=.5*M.w,C=16/M.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){C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]);var 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);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();var U=x.createShader(x.FRAGMENT_SHADER),k=x.createShader(x.VERTEX_SHADER),D="precision "+e.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=t.length;R<U;R++)if(C=16/M.w,L.set(C*S,C),k=t[R],_.set(k.matrixWorld.elements[12],k.matrixWorld.elements[13],k.matrixWorld.elements[14]),_.applyMatrix4(w.matrixWorldInverse),_.applyProjection(w.projectionMatrix),A.copy(_),P.x=A.x*E+E,P.y=A.y*T+T,g||0<P.x&&P.x<M.z&&0<P.y&&P.y<M.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,M.x+P.x-8,M.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,M.x+P.x-8,M.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);D=0;for(var 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/M.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),e.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),e.resetGLState()}}},m.SpritePlugin=function(e,t){function r(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var i,n,o,a,s,h,c,l,u,p,d,f,g,v,y,x,b,_,w,M,S,E=e.context,T=e.state,C=new m.Vector3,L=new m.Quaternion,A=new m.Vector3;this.render=function(P,R){if(0!==t.length){if(void 0===M){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(),w=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,U,E.STATIC_DRAW),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,w),E.bufferData(E.ELEMENT_ARRAY_BUFFER,k,E.STATIC_DRAW);U=E.createProgram(),k=E.createShader(E.VERTEX_SHADER);var D=E.createShader(E.FRAGMENT_SHADER);E.shaderSource(k,["precision "+e.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 "+e.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),M=U,x=E.getAttribLocation(M,"position"),b=E.getAttribLocation(M,"uv"),i=E.getUniformLocation(M,"uvOffset"),n=E.getUniformLocation(M,"uvScale"),o=E.getUniformLocation(M,"rotation"),a=E.getUniformLocation(M,"scale"),s=E.getUniformLocation(M,"color"),h=E.getUniformLocation(M,"map"),c=E.getUniformLocation(M,"opacity"),l=E.getUniformLocation(M,"modelViewMatrix"),u=E.getUniformLocation(M,"projectionMatrix"),p=E.getUniformLocation(M,"fogType"),d=E.getUniformLocation(M,"fogDensity"),f=E.getUniformLocation(M,"fogNear"),g=E.getUniformLocation(M,"fogFar"),v=E.getUniformLocation(M,"fogColor"),y=E.getUniformLocation(M,"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(M),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,w),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);D=0;for(var I=t.length;D<I;D++)(B=t[D]).modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,B.matrixWorld),B.z=-B.modelViewMatrix.elements[14];t.sort(r);var F=[];for(D=0,I=t.length;D<I;D++){var B=t[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?e.setTexture(V.map,0):e.setTexture(S,0),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0)}T.enable(E.CULL_FACE),e.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(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(m.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(m.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(m.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(e){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(m.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(m.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(m.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),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(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),m.Face4=function(e,t,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new m.Face3(e,t,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(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(m,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new m.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new m.Points(e,t)}}}),Object.defineProperties(m.Light.prototype,{onlyShadow:{set:function(e){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(e){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(e){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),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(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},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(e){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(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new m.PointsMaterial(e)}}}),Object.defineProperties(m.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(e){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(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},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(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(m.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),m.GeometryUtils={merge:function(e,t,r){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t instanceof m.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},m.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new m.TextureLoader;return n.setCrossOrigin(this.crossOrigin),e=n.load(e,r,void 0,i),t&&(e.mapping=t),e},loadTextureCube:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new m.CubeTextureLoader;return n.setCrossOrigin(this.crossOrigin),e=n.load(e,r,void 0,i),t&&(e.mapping=t),e},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(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){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(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){return 6*e*e-6*e+(3*e*e-4*e+1)+(-6*e*e+6*e)+(3*e*e-2*e)},interpolate:function(e,t,r,i,n){var o=n*n;return(2*t-2*r+(e=.5*(r-e))+(i=.5*(i-t)))*n*o+(-3*t+3*r-2*e-i)*o+e*n+t}},m.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new m.Group,i=0,n=t.length;i<n;i++)r.add(new m.Mesh(e,t[i]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var i=new m.Matrix4;i.getInverse(r.matrixWorld),e.applyMatrix(i),t.remove(e),r.add(e)}},m.ShapeUtils={area:function(e){for(var t=e.length,r=0,i=t-1,n=0;n<t;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},triangulate:function(e,t){var r=e.length;if(3>r)return null;var i,n,o,a=[],s=[],h=[];if(0<m.ShapeUtils.area(e))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}var l;r<=(i=n)&&(i=0),r<=(n=i+1)&&(n=0),r<=(o=n+1)&&(o=0);e:{var u=l=void 0,p=void 0,d=void 0,f=(u=e[s[i]].x,e[s[i]].y),g=e[s[n]].x,v=e[s[n]].y,y=e[s[o]].x,x=e[s[o]].y;if(Number.EPSILON>(g-u)*(x-f)-(v-f)*(y-u))l=!1;else{var b=void 0,_=void 0,w=void 0,M=void 0,S=(w=_=b=d=p=void 0,y-g),E=x-v,T=u-y,C=f-x,L=g-u,A=v-f;for(l=0;l<r;l++)if(p=e[s[l]].x,d=e[s[l]].y,!(p===u&&d===f||p===g&&d===v||p===y&&d===x)&&(w=p-g,M=d-v,b=L*(_=d-f)-A*(b=p-u),_=T*(d-=x)-C*(p-=y),(w=S*M-E*w)>=-Number.EPSILON&&_>=-Number.EPSILON&&b>=-Number.EPSILON)){l=!1;break e}l=!0}}if(l){for(a.push([e[s[i]],e[s[n]],e[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 t?h:a},triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.x<t.x?e.x<=r.x&&r.x<=t.x:t.x<=r.x&&r.x<=e.x:e.y<t.y?e.y<=r.y&&r.y<=t.y:t.y<=r.y&&r.y<=e.y}function i(e,t,i,n,o){var a=t.x-e.x,s=t.y-e.y,h=n.x-i.x,c=n.y-i.y,l=e.x-i.x,u=e.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?[e]:[]:h===p?!o||0!==d&&d!==p?[t]:[]:0===d?[i]:d===p?[n]:(o=h/p,[{x:e.x+o*a,y:e.y+o*s}])}return 0!==d||c*l!=h*u?[]:(h=0===h&&0===c,(s=0===a&&0===s)&&h?e.x!==i.x||e.y!==i.y?[]:[e]:s?r(i,n,e)?[e]:[]:h?r(e,t,i)?[i]:[]:(0!==a?(e.x<t.x?(a=e,h=e.x,s=t,e=t.x):(a=t,h=t.x,s=e,e=e.x),i.x<n.x?(t=i,p=i.x,c=n,i=n.x):(t=n,p=n.x,c=i,i=i.x)):(e.y<t.y?(a=e,h=e.y,s=t,e=t.y):(a=t,h=t.y,s=e,e=e.y),i.y<n.y?(t=i,p=i.y,c=n,i=n.y):(t=n,p=n.y,c=i,i=i.y)),h<=p?e<p?[]:e===p?o?[]:[t]:e<=i?[t,s]:[t,c]:h>i?[]:h===i?o?[]:[a]:e<=i?[a,s]:[a,c]))}function n(e,t,r,i){var n=t.x-e.x,o=t.y-e.y;t=r.x-e.x,r=r.y-e.y;var a=i.x-e.x;return i=i.y-e.y,e=n*r-o*t,n=n*i-o*a,Math.abs(e)>Number.EPSILON?(t=a*r-i*t,0<e?0<=n&&0<=t:0<=n||0<=t):0<n}var o,a,s,h,c,l={};for(s=e.concat(),o=0,a=t.length;o<a;o++)Array.prototype.push.apply(s,t[o]);for(o=0,a=s.length;o<a;o++)void 0!==l[c=s[o].x+":"+s[o].y]&&console.warn("THREE.Shape: Duplicate point",c),l[c]=o;o=function(t,r){var o,a,s,h,c,l,u,p,d,f=e.concat(),m=[],g=[],v=0;for(a=r.length;v<a;v++)m.push(v);u=0;for(var y=2*m.length;0<m.length;){if(0>--y){console.log("Infinite Loop! Holes left:"+m.length+", Probably Hole outside Shape!");break}for(s=u;s<f.length;s++){for(h=f[s],a=-1,v=0;v<m.length;v++)if(c=m[v],void 0===g[l=h.x+":"+h.y+":"+c]){for(o=r[c],p=0;p<o.length;p++)if(c=o[p],function(e,t){var r=f.length-1,i=e-1;0>i&&(i=r);var a=e+1;return a>r&&(a=0),!!(r=n(f[e],f[i],f[a],o[t]))&&(r=o.length-1,0>(i=t-1)&&(i=r),(a=t+1)>r&&(a=0),!!(r=n(o[t],o[i],o[a],f[e])))}(s,p)&&!function(e,t){var r,n;for(r=0;r<f.length;r++)if(n=r+1,n%=f.length,0<(n=i(e,t,f[r],f[n],!0)).length)return!0;return!1}(h,c)&&!function(e,t){var n,o,a,s;for(n=0;n<m.length;n++)for(o=r[m[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,0<(s=i(e,t,o[a],o[s],!0)).length)return!0;return!1}(h,c)){a=p,m.splice(v,1),u=f.slice(0,s+1),c=f.slice(s),p=o.slice(a),d=o.slice(0,a+1),f=u.concat(p).concat(d).concat(c),u=s;break}if(0<=a)break;g[l]=!0}if(0<=a)break}}return f}(0,t);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++)void 0!==(c=l[c=h[s].x+":"+h[s].y])&&(h[s]=c);return u.concat()},isClockWise:function(e){return 0>m.ShapeUtils.area(e)},b2:function(e,t,r,i){var n=1-e;return n*n*t+2*(1-e)*e*r+e*e*i},b3:function(e,t,r,i,n){var o=1-e,a=1-e;return o*o*o*t+3*a*a*e*r+3*(1-e)*e*e*i+e*e*e*n}},m.Curve=function(){},m.Curve.prototype={constructor:m.Curve,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){return e=this.getUtoTmapping(e),this.getPoint(e)},getPoints:function(e){e||(e=5);var t,r=[];for(t=0;t<=e;t++)r.push(this.getPoint(t/e));return r},getSpacedPoints:function(e){e||(e=5);var t,r=[];for(t=0;t<=e;t++)r.push(this.getPointAt(t/e));return r},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;r<=e;r++)o+=(t=this.getPoint(r/e)).distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t||e*i[o-1];for(var a,s=0,h=o-1;s<=h;)if(0>(a=i[n=Math.floor(s+(h-s)/2)]-r))s=n+1;else{if(!(0<a)){h=n;break}h=n-1}return i[n=h]===r?n/(o-1):i=(n+(r-(s=i[n]))/(i[n+1]-s))/(o-1)},getTangent:function(e){var t=e-1e-4;return 0>t&&(t=0),1<(e+=1e-4)&&(e=1),t=this.getPoint(t),this.getPoint(e).clone().sub(t).normalize()},getTangentAt:function(e){return e=this.getUtoTmapping(e),this.getTangent(e)}},m.Curve.create=function(e,t){return e.prototype=Object.create(m.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},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(e){this.curves.push(e)},m.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new m.LineCurve(t,e))},m.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=t)return e=this.curves[i],t=1-(r[i]-t)/e.getLength(),e.getPointAt(t);i++}return null},m.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},m.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;r<i;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e},m.CurvePath.prototype.createPointsGeometry=function(e){return e=this.getPoints(e),this.createGeometry(e)},m.CurvePath.prototype.createSpacedPointsGeometry=function(e){return e=this.getSpacedPoints(e),this.createGeometry(e)},m.CurvePath.prototype.createGeometry=function(e){for(var t=new m.Geometry,r=0,i=e.length;r<i;r++){var n=e[r];t.vertices.push(new m.Vector3(n.x,n.y,n.z||0))}return t},m.Font=function(e){this.data=e},m.Font.prototype={constructor:m.Font,generateShapes:function(e,t,r){void 0===t&&(t=100),void 0===r&&(r=4);var i=this.data;e=String(e).split("");var n=t/i.resolution,o=0;t=[];for(var a=0;a<e.length;a++){var s;s=n;var h=o,c=i.glyphs[e[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,w=void 0;y=void 0;if(c.o)for(var M=c._cachedOutline||(c._cachedOutline=c.o.split(" ")),S=0,E=M.length;S<E;)switch(M[S++]){case"m":f=M[S++]*s+h,g=M[S++]*s,l.moveTo(f,g);break;case"l":f=M[S++]*s+h,g=M[S++]*s,l.lineTo(f,g);break;case"q":if(f=M[S++]*s+h,g=M[S++]*s,x=M[S++]*s+h,b=M[S++]*s,l.quadraticCurveTo(x,b,f,g),y=u[u.length-1]){v=y.x,y=y.y;for(var T=1;T<=r;T++){var C=T/r;p(C,v,x,f),p(C,y,b,g)}}break;case"b":if(f=M[S++]*s+h,g=M[S++]*s,x=M[S++]*s+h,b=M[S++]*s,_=M[S++]*s+h,w=M[S++]*s,l.bezierCurveTo(x,b,_,w,f,g),y=u[u.length-1])for(v=y.x,y=y.y,T=1;T<=r;T++)d(C=T/r,v,x,_,f),d(C,y,b,w,g)}s={offset:c.ha*s,path:l}}else s=void 0;o+=s.offset,t.push(s.path)}for(r=[],i=0,e=t.length;i<e;i++)Array.prototype.push.apply(r,t[i].toShapes());return r}},m.Path=function(e){m.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},m.Path.prototype=Object.create(m.CurvePath.prototype),m.Path.prototype.constructor=m.Path,m.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y)},m.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},m.Path.prototype.lineTo=function(e,t){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(e,t));this.curves.push(r),this.actions.push({action:"lineTo",args:[e,t]})},m.Path.prototype.quadraticCurveTo=function(e,t,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(e,t),new m.Vector2(r,i));this.curves.push(n),this.actions.push({action:"quadraticCurveTo",args:[e,t,r,i]})},m.Path.prototype.bezierCurveTo=function(e,t,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(e,t),new m.Vector2(r,i),new m.Vector2(n,o));this.curves.push(a),this.actions.push({action:"bezierCurveTo",args:[e,t,r,i,n,o]})},m.Path.prototype.splineThru=function(e){var t=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,e),r=new m.SplineCurve(r),this.curves.push(r),this.actions.push({action:"splineThru",args:t})},m.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args;this.absarc(e+a[a.length-2],t+a[a.length-1],r,i,n,o)},m.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},m.Path.prototype.ellipse=function(e,t,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args;this.absellipse(e+h[h.length-2],t+h[h.length-1],r,i,n,o,a,s)},m.Path.prototype.absellipse=function(e,t,r,i,n,o,a,s){var h=[e,t,r,i,n,o,a,s||0];e=new m.EllipseCurve(e,t,r,i,n,o,a,s),this.curves.push(e),e=e.getPoint(1),h.push(e.x),h.push(e.y),this.actions.push({action:"ellipse",args:h})},m.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],r=0;r<e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},m.Path.prototype.getPoints=function(e){e=e||12;for(var t,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(t=v[2],r=v[3],o=v[0],a=v[1],0<d.length?(s=(c=d[d.length-1]).x,h=c.y):(s=(c=this.actions[f-1].args)[c.length-2],h=c[c.length-1]),v=1;v<=e;v++)c=u(l=v/e,s,o,t),l=u(l,h,a,r),d.push(new m.Vector2(c,l));break;case"bezierCurveTo":for(t=v[4],r=v[5],o=v[0],a=v[1],i=v[2],n=v[3],0<d.length?(s=(c=d[d.length-1]).x,h=c.y):(s=(c=this.actions[f-1].args)[c.length-2],h=c[c.length-1]),v=1;v<=e;v++)c=p(l=v/e,s,o,i,t),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=e*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(t=v[0],r=v[1],a=v[2],i=v[3],c=v[4],o=!!v[5],s=c-i,h=2*e,v=1;v<=h;v++)l=v/h,o||(l=1-l),l=i+l*s,c=t+a*Math.cos(l),l=r+a*Math.sin(l),d.push(new m.Vector2(c,l));break;case"ellipse":t=v[0],r=v[1],a=v[2],n=v[3],i=v[4],c=v[5],o=!!v[6];var y,x,b=v[7];for(s=c-i,h=2*e,0!==b&&(y=Math.cos(b),x=Math.sin(b)),v=1;v<=h;v++){if(l=v/h,o||(l=1-l),l=i+l*s,c=t+a*Math.cos(l),l=r+n*Math.sin(l),0!==b){var _=c;c=(_-t)*y-(l-r)*x+t,l=(_-t)*x+(l-r)*y+r}d.push(new m.Vector2(c,l))}}}return e=d[d.length-1],Math.abs(e.x-d[0].x)<Number.EPSILON&&Math.abs(e.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1),this.autoClose&&d.push(d[0]),d},m.Path.prototype.toShapes=function(e,t){function r(e){for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r],o=new m.Shape;o.actions=n.actions,o.curves=n.curves,t.push(o)}return t}var i=m.ShapeUtils.isClockWise,n=function(e){for(var t=[],r=new m.Path,i=0,n=e.length;i<n;i++){var o=e[i],a=o.args;"moveTo"===(o=o.action)&&0!==r.actions.length&&(t.push(r),r=new m.Path),r[o].apply(r,a)}return 0!==r.actions.length&&t.push(r),t}(this.actions);if(0===n.length)return[];if(!0===t)return r(n);var o,a,s,h=[];if(1===n.length)return a=n[0],(s=new m.Shape).actions=a.actions,s.curves=a.curves,h.push(s),h;var c=!i(n[0].getPoints());c=e?!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++)o=i(l=(a=n[f]).getPoints()),(o=e?!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(e,t){for(var r=t.length,i=!1,n=r-1,o=0;o<r;n=o++){var a=t[n],s=t[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=t[o],h=-h,s=t[n],c=-c),!(e.y<a.y||e.y>s.y))if(e.y===a.y){if(e.x===a.x)return!0}else{if(0==(n=c*(e.x-a.x)-h*(e.y-a.y)))return!0;0>n||(i=!i)}}else if(e.y===a.y&&(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.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),n=0,o=(a=p[f]).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(e){return new m.ExtrudeGeometry(this,e)},m.Shape.prototype.makeGeometry=function(e){return new m.ShapeGeometry(this,e)},m.Shape.prototype.getPointsHoles=function(e){for(var t=[],r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t},m.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},m.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},m.LineCurve=function(e,t){this.v1=e,this.v2=t},m.LineCurve.prototype=Object.create(m.Curve.prototype),m.LineCurve.prototype.constructor=m.LineCurve,m.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},m.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},m.LineCurve.prototype.getTangent=function(e){return this.v2.clone().sub(this.v1).normalize()},m.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},m.QuadraticBezierCurve.prototype=Object.create(m.Curve.prototype),m.QuadraticBezierCurve.prototype.constructor=m.QuadraticBezierCurve,m.QuadraticBezierCurve.prototype.getPoint=function(e){var t=m.ShapeUtils.b2;return new m.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},m.QuadraticBezierCurve.prototype.getTangent=function(e){var t=m.CurveUtils.tangentQuadraticBezier;return new m.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},m.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,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(e){var t=m.ShapeUtils.b3;return new m.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},m.CubicBezierCurve.prototype.getTangent=function(e){var t=m.CurveUtils.tangentCubicBezier;return new m.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},m.SplineCurve=function(e){this.points=null==e?[]:e},m.SplineCurve.prototype=Object.create(m.Curve.prototype),m.SplineCurve.prototype.constructor=m.SplineCurve,m.SplineCurve.prototype.getPoint=function(e){e*=(n=this.points).length-1,e-=o=Math.floor(e);var t=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(t.x,r.x,i.x,n.x,e),o(t.y,r.y,i.y,n.y,e))},m.EllipseCurve=function(e,t,r,i,n,o,a,s){this.aX=e,this.aY=t,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(e){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-e)*(2*Math.PI-r):this.aStartAngle+e*r,e=this.aX+this.xRadius*Math.cos(r);var t=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var r=Math.cos(this.aRotation),i=Math.sin(this.aRotation),n=e;e=(n-this.aX)*r-(t-this.aY)*i+this.aX,t=(n-this.aX)*i+(t-this.aY)*r+this.aY}return new m.Vector2(e,t)},m.ArcCurve=function(e,t,r,i,n,o){m.EllipseCurve.call(this,e,t,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(e,t){this.v1=e,this.v2=t},function(e){var t=new m.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),m.QuadraticBezierCurve3=m.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=m.ShapeUtils.b2;return new m.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),m.CubicBezierCurve3=m.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=m.ShapeUtils.b3;return new m.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),m.SplineCurve3=m.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=null==e?[]:e},function(e){e*=(n=this.points).length-1,e-=o=Math.floor(e);var t=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(t.x,r.x,i.x,n.x,e),o(t.y,r.y,i.y,n.y,e),o(t.z,r.z,i.z,n.z,e))}),m.CatmullRomCurve3=function(){function e(){}var t=new m.Vector3,r=new e,i=new e,n=new e;return e.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},e.prototype.initNonuniformCatmullRom=function(e,t,r,i,n,o,a){e=((t-e)/n-(r-e)/(n+o)+(r-t)/o)*o,i=((r-t)/o-(i-t)/(o+a)+(i-r)/a)*o,this.init(t,r,e,i)},e.prototype.initCatmullRom=function(e,t,r,i,n){this.init(t,r,n*(r-e),n*(i-t))},e.prototype.calc=function(e){var t=e*e;return this.c0+this.c1*e+this.c2*t+this.c3*t*e},m.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var o,a,s,h,c,l=this.points;if(2>(a=l.length)&&console.log("duh, you need at least 2 points"),e*=a-(this.closed?0:1),e-=o=Math.floor(e),this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/l.length)+1)*l.length:0===e&&o===a-1&&(o=a-2,e=1),this.closed||0<o?s=l[(o-1)%a]:(t.subVectors(l[0],l[1]).add(l[0]),s=t),h=l[o%a],c=l[(o+1)%a],this.closed||o+2<a?l=l[(o+2)%a]:(t.subVectors(l[a-1],l[a-2]).add(l[a-1]),l=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var u="chordal"===this.type?.5:.25;a=Math.pow(s.distanceToSquared(h),u),1e-4>(o=Math.pow(h.distanceToSquared(c),u))&&(o=1),1e-4>a&&(a=o),1e-4>(u=Math.pow(c.distanceToSquared(l),u))&&(u=o),r.initNonuniformCatmullRom(s.x,h.x,c.x,l.x,a,o,u),i.initNonuniformCatmullRom(s.y,h.y,c.y,l.y,a,o,u),n.initNonuniformCatmullRom(s.z,h.z,c.z,l.z,a,o,u)}else"catmullrom"===this.type&&(a=void 0!==this.tension?this.tension:.5,r.initCatmullRom(s.x,h.x,c.x,l.x,a),i.initCatmullRom(s.y,h.y,c.y,l.y,a),n.initCatmullRom(s.z,h.z,c.z,l.z,a));return new m.Vector3(r.calc(e),i.calc(e),n.calc(e))})}(),m.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),m.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},m.ClosedSplineCurve3.prototype=Object.create(m.CatmullRomCurve3.prototype),m.BoxGeometry=function(e,t,r,i,n,o){function a(e,t,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"===e&&"y"===t||"y"===e&&"x"===t?c="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(c="y",u=s.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(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;_[e]=(o*y-p)*r,_[t]=(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,e=o+g*(n+1),t=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,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([i,a,p]),(d=new m.Face3(e+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([a.clone(),c,p.clone()])}m.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this;n=t/2,o=r/2,a("z","y",-1,-1,r,t,i=e/2,0),a("z","y",1,-1,r,t,-i,1),a("x","z",1,1,e,r,n,2),a("x","z",1,-1,e,r,-n,3),a("x","y",1,-1,e,t,o,4),a("x","y",-1,-1,e,t,-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(e,t,r,i){m.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new m.CircleBufferGeometry(e,t,r,i))},m.CircleGeometry.prototype=Object.create(m.Geometry.prototype),m.CircleGeometry.prototype.constructor=m.CircleGeometry,m.CircleBufferGeometry=function(e,t,r,i){m.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=t+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<=t;s++,h+=3,c+=2){var l=r+s/t*i;o[h]=e*Math.cos(l),o[h+1]=e*Math.sin(l),a[h+2]=1,n[c]=(o[h]/e+1)/2,n[c+1]=(o[h+1]/e+1)/2}for(r=[],h=1;h<=t;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,e)},m.CircleBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.CircleBufferGeometry.prototype.constructor=m.CircleBufferGeometry,m.CylinderGeometry=function(e,t,r,i,n,o,a,s){m.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},e=void 0!==e?e:20,t=void 0!==t?t: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)*(t-e)+e;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=(t-e)/r,h=0;h<i;h++)for(0!==e?(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++){d=u[c][h],f=u[c+1][h];var v=u[c+1][h+1],y=(g=u[c][h+1],a.clone()),x=a.clone(),b=s.clone(),_=s.clone(),w=p[c][h].clone(),M=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([w,M,E]),this.faces.push(new m.Face3(f,v,g,[x.clone(),b,_.clone()])),this.faceVertexUvs[0].push([M.clone(),S,E.clone()])}if(!1===o&&0<e)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),w=p[0][h].clone(),M=p[0][h+1].clone(),S=new m.Vector2(M.x,0),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,1)),this.faceVertexUvs[0].push([w,M,S]);if(!1===o&&0<t)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),w=p[n][h+1].clone(),M=p[n][h].clone(),S=new m.Vector2(M.x,1),this.faces.push(new m.Face3(d,f,v,[y,x,b],void 0,2)),this.faceVertexUvs[0].push([w,M,S]);this.computeFaceNormals()},m.CylinderGeometry.prototype=Object.create(m.Geometry.prototype),m.CylinderGeometry.prototype.constructor=m.CylinderGeometry,m.EdgesGeometry=function(e,t){m.BufferGeometry.call(this);var r,i=Math.cos(m.Math.degToRad(void 0!==t?t:1)),n=[0,0],o={},a=["a","b","c"];e instanceof m.BufferGeometry?(r=new m.Geometry).fromBufferGeometry(e):r=e.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(e,t){return e-t});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}for(p in n=[],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(e,t){void 0!==e&&(m.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeFaceNormals())},m.ExtrudeGeometry.prototype=Object.create(m.Geometry.prototype),m.ExtrudeGeometry.prototype.constructor=m.ExtrudeGeometry,m.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;i<r;i++)this.addShape(e[i],t)},m.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function i(e,t,r){var i=1,n=(i=e.x-t.x,e.y-t.y),o=r.x-e.x,a=r.y-e.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=t.x-n/h;if(t=t.y+i/h,2>=(i=(r=s+i*(o=((r.x-a/c-s)*a-(r.y+o/c-t)*o)/(i*a-n*o))-e.x)*r+(e=t+n*o-e.y)*e))return new m.Vector2(r,e);i=Math.sqrt(i/2)}else e=!1,i>Number.EPSILON?o>Number.EPSILON&&(e=!0):i<-Number.EPSILON?o<-Number.EPSILON&&(e=!0):Math.sign(n)===Math.sign(a)&&(e=!0),e?(r=-n,e=i,i=Math.sqrt(s)):(r=i,e=n,i=Math.sqrt(s/2));return new m.Vector2(r/i,e/i)}function n(e,t){var r,i;for(N=e.length;0<=--N;){r=N,0>(i=N-1)&&(i=e.length-1);var n=0,o=x+2*g;for(n=0;n<o;n++){var a=(a=t+r+(s=B*n))+C,s=(s=t+i+s)+C,h=(h=t+i+(c=B*(n+1)))+C,c=(c=t+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=w.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(e,t,r){T.vertices.push(new m.Vector3(e,t,r))}function a(e,t,r){e+=C,t+=C,r+=C,T.faces.push(new m.Face3(e,t,r,null,null,0)),e=w.generateTopUV(T,e,t,r),T.faceVertexUvs[0].push(e)}var s,h,c,l,u,p=void 0!==t.amount?t.amount:100,d=void 0!==t.bevelThickness?t.bevelThickness:6,f=void 0!==t.bevelSize?t.bevelSize:d-2,g=void 0!==t.bevelSegments?t.bevelSegments:3,v=void 0===t.bevelEnabled||t.bevelEnabled,y=void 0!==t.curveSegments?t.curveSegments:12,x=void 0!==t.steps?t.steps:1,b=t.extrudePath,_=!1,w=void 0!==t.UVGenerator?t.UVGenerator:m.ExtrudeGeometry.WorldUVGenerator;b&&(s=b.getSpacedPoints(x),_=!0,v=!1,h=void 0!==t.frames?t.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 M,S,E,T=this,C=this.vertices.length,L=(y=(b=e.extractPoints(y)).shape,b.holes);if(b=!m.ShapeUtils.isClockWise(y)){for(y=y.reverse(),S=0,E=L.length;S<E;S++)M=L[S],m.ShapeUtils.isClockWise(M)&&(L[S]=M.reverse());b=!1}var A=m.ShapeUtils.triangulateShape(y,L),P=y;for(S=0,E=L.length;S<E;S++)M=L[S],y=y.concat(M);var R,U,k,D,I,F,B=y.length,V=A.length,N=(b=[],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(M=L[S],O=[],N=0,R=(k=M.length)-1,U=N+1;N<k;N++,R++,U++)R===k&&(R=0),U===k&&(U=0),O[N]=i(M[N],M[R],M[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++)o((I=r(P[N],b[N],U)).x,I.y,-D);for(S=0,E=L.length;S<E;S++)for(M=L[S],O=G[S],N=0,k=M.length;N<k;N++)o((I=r(M[N],O[N],U)).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++)o((I=r(P[N],b[N],U)).x,I.y,p+D);for(S=0,E=L.length;S<E;S++)for(M=L[S],O=G[S],N=0,k=M.length;N<k;N++)I=r(M[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 e;for(e=0*B,N=0;N<V;N++)a((F=A[N])[2]+e,F[1]+e,F[0]+e);for(e=x+2*g,e*=B,N=0;N<V;N++)a((F=A[N])[0]+e,F[1]+e,F[2]+e)}else{for(N=0;N<V;N++)a((F=A[N])[2],F[1],F[0]);for(N=0;N<V;N++)a((F=A[N])[0]+B*x,F[1]+B*x,F[2]+B*x)}}(),function(){var e=0;for(n(P,e),e+=P.length,S=0,E=L.length;S<E;S++)n(M=L[S],e),e+=M.length}()},m.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,i){return t=(e=e.vertices)[t],r=e[r],i=e[i],[new m.Vector2(t.x,t.y),new m.Vector2(r.x,r.y),new m.Vector2(i.x,i.y)]},generateSideWallUV:function(e,t,r,i,n){return t=(e=e.vertices)[t],r=e[r],i=e[i],n=e[n],.01>Math.abs(t.y-r.y)?[new m.Vector2(t.x,1-t.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(t.y,1-t.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(e,t){m.Geometry.call(this),this.type="ShapeGeometry",!1===Array.isArray(e)&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},m.ShapeGeometry.prototype=Object.create(m.Geometry.prototype),m.ShapeGeometry.prototype.constructor=m.ShapeGeometry,m.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;r<i;r++)this.addShape(e[r],t);return this},m.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,i,n,o=t.material,a=void 0===t.UVGenerator?m.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,s=this.vertices.length,h=(r=e.extractPoints(void 0!==t.curveSegments?t.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++)h=(c=l[r])[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(e,t,r,i){m.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=t||12,r=r||0,i=i||2*Math.PI;for(var n=1/(e.length-1),o=1/t,a=0,s=t;a<=s;a++)for(var h=r+a*o*i,c=Math.sin(h),l=Math.cos(h),u=(h=0,e.length);h<u;h++){var p=e[h];(d=new m.Vector3).x=p.x*c,d.y=p.y,d.z=p.x*l,this.vertices.push(d)}for(r=e.length,a=0,s=t;a<s;a++)for(h=0,u=e.length-1;h<u;h++){i=(t=h+r*a)+r;c=t+1+r,l=t+1;var d=h*n,f=(p=a*o)+o,g=d+n;this.faces.push(new m.Face3(t,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(e,t,r,i){m.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new m.PlaneBufferGeometry(e,t,r,i))},m.PlaneGeometry.prototype=Object.create(m.Geometry.prototype),m.PlaneGeometry.prototype.constructor=m.PlaneGeometry,m.PlaneBufferGeometry=function(e,t,r,i){m.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};var n=e/2,o=t/2,a=(r=Math.floor(r)||1)+1,s=(i=Math.floor(i)||1)+1,h=e/r,c=t/i;t=new Float32Array(a*s*3),e=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++)t[u]=g*h-n,t[u+1]=-f,e[u+2]=1,l[p]=g/r,l[p+1]=1-d/i,u+=3,p+=2;for(u=0,n=new(65535<t.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(t,3)),this.addAttribute("normal",new m.BufferAttribute(e,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(e,t,r,i,n,o){m.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},e=e||0,t=t||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=e,c=(t-e)/(i=void 0!==i?Math.max(1,i):8);for(e=0;e<i+1;e++){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/t+1)/2,(l.y/t+1)/2))}h+=c}for(t=new m.Vector3(0,0,1),e=0;e<i;e++)for(n=e*(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,[t.clone(),t.clone(),t.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,[t.clone(),t.clone(),t.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(e,t,r,i,n,o,a){m.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new m.SphereBufferGeometry(e,t,r,i,n,o,a))},m.SphereGeometry.prototype=Object.create(m.Geometry.prototype),m.SphereGeometry.prototype.constructor=m.SphereGeometry,m.SphereBufferGeometry=function(e,t,r,i,n,o,a){m.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},e=e||50,t=Math.max(3,Math.floor(t)||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=(t+1)*(r+1),c=new m.BufferAttribute(new Float32Array(3*h),3),l=new m.BufferAttribute(new Float32Array(3*h),3),u=(h=new m.BufferAttribute(new Float32Array(2*h),2),0),p=[],d=new m.Vector3,f=0;f<=r;f++){for(var g=[],v=f/r,y=0;y<=t;y++){var x=y/t,b=-e*Math.cos(i+x*n)*Math.sin(o+v*a),_=e*Math.cos(o+v*a),w=e*Math.sin(i+x*n)*Math.sin(o+v*a);d.set(b,_,w).normalize(),c.setXYZ(u,b,_,w),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<t;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,e)},m.SphereBufferGeometry.prototype=Object.create(m.BufferGeometry.prototype),m.SphereBufferGeometry.prototype.constructor=m.SphereBufferGeometry,m.TextGeometry=function(e,t){var r=(t=t||{}).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(e,t.size,t.curveSegments),t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),m.ExtrudeGeometry.call(this,r,t),this.type="TextGeometry"},m.TextGeometry.prototype=Object.create(m.ExtrudeGeometry.prototype),m.TextGeometry.prototype.constructor=m.TextGeometry,m.TorusGeometry=function(e,t,r,i,n){m.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},e=e||100,t=t||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=e*Math.cos(l),o.y=e*Math.sin(l);var p=new m.Vector3;p.x=(e+t*Math.cos(u))*Math.cos(l),p.y=(e+t*Math.cos(u))*Math.sin(l),p.z=t*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++)e=(i+1)*h+c-1,t=(i+1)*(h-1)+c-1,n=(i+1)*(h-1)+c,o=(i+1)*h+c,l=new m.Face3(e,t,o,[s[e].clone(),s[t].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[e].clone(),a[t].clone(),a[o].clone()]),l=new m.Face3(t,n,o,[s[t].clone(),s[n].clone(),s[o].clone()]),this.faces.push(l),this.faceVertexUvs[0].push([a[t].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(e,t,r,i,n,o,a){function s(e,t,r,i,n){var o=Math.cos(e),a=Math.sin(e);return e*=t/r,o*=i*(2+(t=Math.cos(e)))*.5,a=i*(2+t)*a*.5,i=n*i*Math.sin(e)*.5,new m.Vector3(o,a,i)}m.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},e=e||100,t=t||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,e,a),f=s(f+.01,o,n,e,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=-t*Math.cos(g),y=(g=t*Math.sin(g),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,e=h[p][f],t=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(e,t,o)),this.faceVertexUvs[0].push([a,c,u]),this.faces.push(new m.Face3(t,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(e,t,r,i,n,o){m.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:i,closed:n,taper:o},t=t||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=t+1,x=new m.Vector3;for(f=(d=new m.TubeGeometry.FrenetFrames(e,t,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=e.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<t;d++)for(h=0;h<i;h++)o=n?(d+1)%t:d+1,y=(h+1)%i,e=v[d][h],r=v[o][h],o=v[o][y],y=v[d][y],x=new m.Vector2(d/t,h/i),f=new m.Vector2((d+1)/t,h/i),g=new m.Vector2((d+1)/t,(h+1)/i),a=new m.Vector2(d/t,(h+1)/i),this.faces.push(new m.Face3(e,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(e){return 1},m.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},m.TubeGeometry.FrenetFrames=function(e,t,r){var i,n,o,a=new m.Vector3,s=[],h=[],c=[],l=new m.Vector3,u=new m.Matrix4;for(t+=1,this.tangents=s,this.normals=h,this.binormals=c,i=0;i<t;i++)n=i/(t-1),s[i]=e.getTangentAt(n),s[i].normalize();for(h[0]=new m.Vector3,c[0]=new m.Vector3,e=Number.MAX_VALUE,i=Math.abs(s[0].x),n=Math.abs(s[0].y),o=Math.abs(s[0].z),i<=e&&(e=i,a.set(1,0,0)),n<=e&&(e=n,a.set(0,1,0)),o<=e&&a.set(0,0,1),l.crossVectors(s[0],a).normalize(),h[0].crossVectors(s[0],l),c[0].crossVectors(s[0],h[0]),i=1;i<t;i++)h[i]=h[i-1].clone(),c[i]=c[i-1].clone(),l.crossVectors(s[i-1],s[i]),l.length()>Number.EPSILON&&(l.normalize(),a=Math.acos(m.Math.clamp(s[i-1].dot(s[i]),-1,1)),h[i].applyMatrix4(u.makeRotationAxis(l,a))),c[i].crossVectors(s[i],h[i]);if(r)for(a=Math.acos(m.Math.clamp(h[0].dot(h[t-1]),-1,1)),a/=t-1,0<s[0].dot(l.crossVectors(h[0],h[t-1]))&&(a=-a),i=1;i<t;i++)h[i].applyMatrix4(u.makeRotationAxis(s[i],a*i)),c[i].crossVectors(s[i],h[i])},m.PolyhedronGeometry=function(e,t,r,i){function n(e){var t=e.normalize().clone();t.index=s.vertices.push(t)-1;var r=Math.atan2(e.z,-e.x)/2/Math.PI+.5;return e=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5,t.uv=new m.Vector2(r,1-e),t}function o(e,t,r,i){i=new m.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,i),s.faces.push(i),g.copy(e).add(t).add(r).divideScalar(3),i=Math.atan2(g.z,-g.x),s.faceVertexUvs[0].push([a(e.uv,e,i),a(t.uv,t,i),a(r.uv,r,i)])}function a(e,t,r){return 0>r&&1===e.x&&(e=new m.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new m.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}m.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i},r=r||1,i=i||0;for(var s=this,h=0,c=e.length;h<c;h+=3)n(new m.Vector3(e[h],e[h+1],e[h+2]));e=this.vertices;var l=[],u=h=0;for(c=t.length;h<c;h+=3,u++){var p=e[t[h]],d=e[t[h+1]],f=e[t[h+2]];l[u]=new m.Face3(p.index,d.index,f.index,[p.clone(),d.clone(),f.clone()],void 0,u)}var g=new m.Vector3;for(h=0,c=l.length;h<c;h++)!function(e,t){for(var r=Math.pow(2,t),i=n(s.vertices[e.a]),a=n(s.vertices[e.b]),h=n(s.vertices[e.c]),c=[],l=e.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++)i=(t=this.faceVertexUvs[0][h])[0].x,e=t[1].x,l=t[2].x,u=Math.max(i,e,l),p=Math.min(i,e,l),.9<u&&.1>p&&(.2>i&&(t[0].x+=1),.2>e&&(t[1].x+=1),.2>l&&(t[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(e,t){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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},m.DodecahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.DodecahedronGeometry.prototype.constructor=m.DodecahedronGeometry,m.IcosahedronGeometry=function(e,t){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],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},m.IcosahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype);m.IcosahedronGeometry.prototype.constructor=m.IcosahedronGeometry,m.OctahedronGeometry=function(e,t){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],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},m.OctahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.OctahedronGeometry.prototype.constructor=m.OctahedronGeometry,m.TetrahedronGeometry=function(e,t){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],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},m.TetrahedronGeometry.prototype=Object.create(m.PolyhedronGeometry.prototype),m.TetrahedronGeometry.prototype.constructor=m.TetrahedronGeometry,m.ParametricGeometry=function(e,t,r){m.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i,n,o,a,s,h,c,l,u=this.vertices,p=this.faces,d=this.faceVertexUvs[0],f=t+1;for(i=0;i<=r;i++)for(a=i/r,n=0;n<=t;n++)o=e(o=n/t,a),u.push(o);for(i=0;i<r;i++)for(n=0;n<t;n++)e=i*f+n,u=i*f+n+1,a=(i+1)*f+n+1,o=(i+1)*f+n,s=new m.Vector2(n/t,i/r),h=new m.Vector2((n+1)/t,i/r),c=new m.Vector2((n+1)/t,(i+1)/r),l=new m.Vector2(n/t,(i+1)/r),p.push(new m.Face3(e,u,o)),d.push([s,h,l]),p.push(new m.Face3(u,a,o)),d.push([h.clone(),c,l.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},m.ParametricGeometry.prototype=Object.create(m.Geometry.prototype),m.ParametricGeometry.prototype.constructor=m.ParametricGeometry,m.WireframeGeometry=function(e){function t(e,t){return e-t}m.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(e instanceof m.Geometry){var o=e.vertices,a=e.faces,s=0,h=new Uint32Array(6*a.length);e=0;for(var c=a.length;e<c;e++)for(var l=a[e],u=0;3>u;u++){r[0]=l[n[u]],r[1]=l[n[(u+1)%3]],r.sort(t);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),e=0,c=s;e<c;e++)for(u=0;2>u;u++)i=o[h[2*e+u]],r[(s=6*e+3*u)+0]=i.x,r[s+1]=i.y,r[s+2]=i.z;this.addAttribute("position",new m.BufferAttribute(r,3))}else if(e instanceof m.BufferGeometry){if(null!==e.index){for(c=e.index.array,o=e.attributes.position,s=0,0===(n=e.groups).length&&e.addGroup(0,c.length),h=new Uint32Array(2*c.length),a=0,l=n.length;a<l;++a){u=(e=n[a]).start,p=e.count,e=u;for(var d=u+p;e<d;e+=3)for(u=0;3>u;u++)r[0]=c[e+u],r[1]=c[e+(u+1)%3],r.sort(t),void 0===i[p=r.toString()]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(r=new Float32Array(6*s),e=0,c=s;e<c;e++)for(u=0;2>u;u++)s=6*e+3*u,i=h[2*e+u],r[s+0]=o.getX(i),r[s+1]=o.getY(i),r[s+2]=o.getZ(i)}else for(h=(s=(o=e.attributes.position.array).length/3)/3,r=new Float32Array(6*s),e=0,c=h;e<c;e++)for(u=0;3>u;u++)h=9*e+3*u,r[(s=18*e+6*u)+0]=o[h],r[s+1]=o[h+1],r[s+2]=o[h+2],i=9*e+(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(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);(e=new m.BufferGeometry).addAttribute("position",new m.BufferAttribute(t,3)),e.addAttribute("color",new m.BufferAttribute(r,3)),t=new m.LineBasicMaterial({vertexColors:m.VertexColors}),m.LineSegments.call(this,e,t)},m.AxisHelper.prototype=Object.create(m.LineSegments.prototype),m.AxisHelper.prototype.constructor=m.AxisHelper,m.ArrowHelper=function(){var e=new m.Geometry;e.vertices.push(new m.Vector3(0,0,0),new m.Vector3(0,1,0));var t=new m.CylinderGeometry(0,.5,1,5,1);return t.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(e,new m.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new m.Mesh(t,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=(k=new m.Vector3,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):-.99999>e.y?this.quaternion.set(1,0,0,0):(k.set(e.z,0,-e.x).normalize(),U=Math.acos(e.y),this.quaternion.setFromAxisAngle(k,U))}),m.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},m.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},m.BoxHelper=function(e){var t=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(t,1)),i.addAttribute("position",new m.BufferAttribute(r,3)),m.LineSegments.call(this,i,new m.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},m.BoxHelper.prototype=Object.create(m.LineSegments.prototype),m.BoxHelper.prototype.constructor=m.BoxHelper,m.BoxHelper.prototype.update=(R=new m.Box3,function(e){if(R.setFromObject(e),!R.isEmpty()){e=R.min;var t=R.max,r=this.geometry.attributes.position,i=r.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),m.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,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(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){i.vertices.push(new m.Vector3),i.colors.push(new m.Color(t)),void 0===o[e]&&(o[e]=[]),o[e].push(i.vertices.length-1)}var i=new m.Geometry,n=new m.LineBasicMaterial({color:16777215,vertexColors:m.FaceColors}),o={};t("n1","n2",16755200),t("n2","n4",16755200),t("n4","n3",16755200),t("n3","n1",16755200),t("f1","f2",16755200),t("f2","f4",16755200),t("f4","f3",16755200),t("f3","f1",16755200),t("n1","f1",16755200),t("n2","f2",16755200),t("n3","f3",16755200),t("n4","f4",16755200),t("p","n1",16711680),t("p","n2",16711680),t("p","n3",16711680),t("p","n4",16711680),t("u1","u2",43775),t("u2","u3",43775),t("u3","u1",43775),t("c","t",16777215),t("p","c",3355443),t("cn1","cn2",3355443),t("cn3","cn4",3355443),t("cf1","cf2",3355443),t("cf3","cf4",3355443),m.LineSegments.call(this,i,n),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.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 e(e,o,a,s){if(i.set(o,a,s).unproject(n),void 0!==(e=r[e]))for(o=0,a=e.length;o<a;o++)t.vertices[e[o]].copy(i)}var t,r,i=new m.Vector3,n=new m.Camera;return function(){t=this.geometry,r=this.pointMap,n.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),t.verticesNeedUpdate=!0}}(),m.DirectionalLightHelper=function(e,t){m.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new m.Geometry;r.vertices.push(new m.Vector3(-t,t,0),new m.Vector3(t,t,0),new m.Vector3(t,-t,0),new m.Vector3(-t,-t,0),new m.Vector3(-t,t,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=(L=new m.Vector3,A=new m.Vector3,P=new m.Vector3,function(){L.setFromMatrixPosition(this.light.matrixWorld),A.setFromMatrixPosition(this.light.target.matrixWorld),P.subVectors(A,L),this.lightPlane.lookAt(P),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(P),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}),m.EdgesHelper=function(e,t,r){t=void 0!==t?t:16777215,m.LineSegments.call(this,new m.EdgesGeometry(e.geometry,r),new m.LineBasicMaterial({color:t})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},m.EdgesHelper.prototype=Object.create(m.LineSegments.prototype),m.EdgesHelper.prototype.constructor=m.EdgesHelper,m.FaceNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16776960,i=void 0!==i?i:1,t=0,(r=this.object.geometry)instanceof m.Geometry?t=r.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),r=new m.BufferGeometry,t=new m.Float32Attribute(6*t,3),r.addAttribute("position",t),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:e,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=(E=new m.Vector3,T=new m.Vector3,C=new m.Matrix3,function(){this.object.updateMatrixWorld(!0),C.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,r=this.object.geometry,i=r.vertices,n=0,o=0,a=(r=r.faces).length;o<a;o++){var s=r[o],h=s.normal;E.copy(i[s.a]).add(i[s.b]).add(i[s.c]).divideScalar(3).applyMatrix4(e),T.copy(h).applyMatrix3(C).normalize().multiplyScalar(this.size).add(E),t.setXYZ(n,E.x,E.y,E.z),n+=1,t.setXYZ(n,T.x,T.y,T.z),n+=1}return t.needsUpdate=!0,this}),m.GridHelper=function(e,t){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=-e;n<=e;n+=t){r.vertices.push(new m.Vector3(-e,0,n),new m.Vector3(e,0,n),new m.Vector3(n,0,-e),new m.Vector3(n,0,e));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(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},m.HemisphereLightHelper=function(e,t){m.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new m.Color,new m.Color];var r=new m.SphereGeometry(t,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=(S=new m.Vector3,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(S.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}),m.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new m.SphereGeometry(t,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(e){this.bones=this.getBoneList(e);for(var t=new m.Geometry,r=0;r<this.bones.length;r++)this.bones[r].parent instanceof m.Bone&&(t.vertices.push(new m.Vector3),t.vertices.push(new m.Vector3),t.colors.push(new m.Color(0,0,1)),t.colors.push(new m.Color(0,1,0)));t.dynamic=!0,r=new m.LineBasicMaterial({vertexColors:m.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0}),m.LineSegments.call(this,t,r),this.root=e,this.matrix=e.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(e){var t=[];e instanceof m.Bone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,this.getBoneList(e.children[r]));return t},m.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(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(t,o.matrixWorld),e.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(t,o.parent.matrixWorld),e.vertices[i+1].setFromMatrixPosition(r),i+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},m.SpotLightHelper=function(e){m.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,(e=new m.CylinderGeometry(0,1,1,8,1,!0)).translate(0,-.5,0),e.rotateX(-Math.PI/2);var t=new m.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new m.Mesh(e,t),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=(w=new m.Vector3,M=new m.Vector3,function(){var e=this.light.distance?this.light.distance:1e4,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),w.setFromMatrixPosition(this.light.matrixWorld),M.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(M.sub(w)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}),m.VertexNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1,e=void 0!==r?r:16711680,i=void 0!==i?i:1,t=0,(r=this.object.geometry)instanceof m.Geometry?t=3*r.faces.length:r instanceof m.BufferGeometry&&(t=r.attributes.normal.count),r=new m.BufferGeometry,t=new m.Float32Attribute(6*t,3),r.addAttribute("position",t),m.LineSegments.call(this,r,new m.LineBasicMaterial({color:e,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=(x=new m.Vector3,b=new m.Vector3,_=new m.Matrix3,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),_.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,r=this.geometry.attributes.position,i=this.object.geometry;if(i instanceof m.Geometry)for(var n=i.vertices,o=i.faces,a=i=0,s=o.length;a<s;a++)for(var h=o[a],c=0,l=h.vertexNormals.length;c<l;c++){var u=h.vertexNormals[c];x.copy(n[h[e[c]]]).applyMatrix4(t),b.copy(u).applyMatrix3(_).normalize().multiplyScalar(this.size).add(x),r.setXYZ(i,x.x,x.y,x.z),i+=1,r.setXYZ(i,b.x,b.y,b.z),i+=1}else if(i instanceof m.BufferGeometry)for(e=i.attributes.position,n=i.attributes.normal,c=i=0,l=e.count;c<l;c++)x.set(e.getX(c),e.getY(c),e.getZ(c)).applyMatrix4(t),b.set(n.getX(c),n.getY(c),n.getZ(c)),b.applyMatrix3(_).normalize().multiplyScalar(this.size).add(x),r.setXYZ(i,x.x,x.y,x.z),i+=1,r.setXYZ(i,b.x,b.y,b.z),i+=1;return r.needsUpdate=!0,this}),m.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;m.LineSegments.call(this,new m.WireframeGeometry(e.geometry),new m.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},m.WireframeHelper.prototype=Object.create(m.LineSegments.prototype),m.WireframeHelper.prototype.constructor=m.WireframeHelper,m.ImmediateRenderObject=function(e){m.Object3D.call(this),this.material=e,this.render=function(e){}},m.ImmediateRenderObject.prototype=Object.create(m.Object3D.prototype),m.ImmediateRenderObject.prototype.constructor=m.ImmediateRenderObject,m.MorphBlendMesh=function(e,t){m.Mesh.call(this,e,t),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(e,t,r,i){t={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[e]=t,this.animationsList.push(t)},m.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,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),t||(t=h)}}for(h in i)s=i[h],this.createAnimation(h,s.start,s.end,e);this.firstAnimation=t},m.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){(e=this.animationsMap[e])&&(e.direction=1,e.directionBackwards=!1)},m.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){(e=this.animationsMap[e])&&(e.direction=-1,e.directionBackwards=!0)},m.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},m.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},m.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},m.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},m.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0;return(e=this.animationsMap[e])&&(t=e.time),t},m.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1;return(e=this.animationsMap[e])&&(t=e.duration),t},m.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},m.MorphBlendMesh.prototype.stopAnimation=function(e){(e=this.animationsMap[e])&&(e.active=!1)},m.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;t<r;t++){var i=this.animationsList[t];if(i.active){var n=i.duration/i.length;i.time+=i.direction*e,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 e(){}return e.prototype.webgl=function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},e}(),v="clouds";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(e,t){this.container=e,this.config=t,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 t={};t.cloud=this.config.imageCloud;var r=0,i=0;for(var n in t)t.hasOwnProperty(n)&&r++;for(var n in t)if(t.hasOwnProperty(n)){var o=new XMLHttpRequest;o.open("GET",t[n],!0),o.crossOrigin="Anonymous",o.responseType="arraybuffer",o.customKey=n,o.onload=e.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=e.proxy(function(e){t[e.customKey]=s,++i==r&&(this.applyListeners(),this.buildScene(t),this.renderScene())},this,o)},this),o.onerror=e.proxy(function(e){var t=e.currentTarget;throw Error("Cannot load resource "+t.responseURL+". Status code ["+t.status+"]")},this),o.send()}},buildScene:function(e){var t=this.container.width(),r=this.container.height();this.aspect=t/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(e,"cloud");this.buildClouds(i),this.renderer=new m.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(t,r),this.container.append(this.renderer.domElement)},buildClouds:function(e){var t={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")};t.uniforms.texCloud.value=e;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);t.uniforms.skyColor.value=i.color,t.uniforms.fogFar.value=i.far,t.uniforms.fogNear.value=i.near,t.uniforms.horizonLength.value=this.cameraFarClipPlane;for(var n=new m.ShaderMaterial({uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.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(e.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",e.proxy(this.onMouseMove,this)),this.container.on("touchmove.clouds",e.proxy(this.onMouseMove,this))),e(window).on("resize.clouds",e.proxy(this.onWindowResize,this))},resetListeners:function(){this.container.off("mousemove.clouds"),this.container.off("touchmove.clouds"),e(window).off("resize.clouds")},onMouseMove:function(e){var t=this.getMousePositionPower("touchmove"==e.type?e.originalEvent.targetTouches[0]:e);this.cameraX.value=t.x<0?t.x*Math.abs(this.cameraX.min):t.x*Math.abs(this.cameraX.max),this.cameraY.value=t.y<0?t.y*Math.abs(this.cameraY.min):t.y*Math.abs(this.cameraY.max),this.cameraRotation.value=.03*t.x},onWindowResize:function(e){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(e){var t=this.container.get(0).getBoundingClientRect(),r={},i=(t.right-t.left)/2,n=(t.bottom-t.top)/2,o=this.container.offset();return r.x=(e.pageX-o.left-i)/i,r.y=(n-(e.pageY-o.top))/n,r},createTexture:function(e,t){var r=new m.Texture;return r.image=e[t],r.needsUpdate=!0,r},util:function(){return null!=this._util?this._util:this._util=new g}},e.clouds=function(e,t){if("support"==e)return new g,!!this.util().webgl()},e.fn.clouds=function(t,r){return this.each(function(){var r=e(this),i=r.data(v),n=e.isPlainObject(t)?t:{};if("destroy"!=t)if("pause"!=t)if("play"!=t)if(i){var o=e.extend({},i.config,n);i.init(r,o)}else i=new d(r,o=e.extend({},d.prototype.defaults,n)),r.data(v,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 y={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}]};e("#weather_press_scene_container").clouds(y)}var x,b,_,w,M,S,E,T,C,L,A,P,R,U,k,D,I,F,B,V,N,O,G,z,H,j,W,X,q,Y,Z,Q,K,J,$,ee,te,re,ie,ne,oe,ae,se,he,ce,le,ue,pe,de,fe,me,ge,ve,ye,xe,be,_e,we,Me,Se,Ee,Te,Ce,Le,Ae,Pe,Re,Ue,ke,De,Ie,Fe,Be,Ve,Ne,Oe,Ge,ze,He,je,We,Xe,qe,Ye,Ze,Qe,Ke,Je,$e,et,tt,rt,it,nt,ot,at,st,ht,ct,lt,ut,pt,dt,ft,mt,gt,vt,yt,xt,bt,_t,wt,Mt,St,Et,Tt,Ct,Lt,At,Pt,Rt,Ut,kt,Dt,It,Ft,Bt,Vt,Nt,Ot,Gt,zt,Ht,jt,Wt,Xt,qt,Yt,Zt,Qt,Kt,Jt,$t,er,tr,rr,ir,nr,or,ar,sr})}(jQuery);
  • weather-press/trunk/public/partials/weather-press-public-display.php

    r1759591 r1820020  
    111111                <li class='deep'></li>
    112112                <li></li>
    113                 <li class='main-location'><?php echo $wpress_Main_Location; ?></li><!-- Main location -->
    114                 <li><?php echo $wpress_Secondary_Location_Bottom; ?></li><!-- secondary location -->
     113                <li class='main-location' data-city='<?php echo $wpress_Main_Location_id; ?>'><?php echo $wpress_Main_Location; ?></li><!-- Main location -->
     114                <li data-city='<?php echo $wpress_Secondary_Location_Bottom_id; ?>'><?php echo $wpress_Secondary_Location_Bottom; ?></li><!-- secondary location -->
    115115                <li class='deep'></li>
    116116
  • weather-press/trunk/weather-press.php

    r1759591 r1820020  
    99 * Plugin URI:        https://www.weather-press.com
    1010 * Description:       You need an amazing wordpress weather plugin & widget ?? ...Weather Press offer you more !
    11  * Version:           4.5
     11 * Version:           4.6
    1212 * Author:            Zied Bouzidi
    1313 * Author URI:        https://www.weather-press.com/founder
Note: See TracChangeset for help on using the changeset viewer.