WP Photo Album Plus - Version 6.9.13

Version Description

  • Security release.
Download this release

Release Info

Developer opajaap
Plugin Icon wp plugin WP Photo Album Plus
Version 6.9.13
Comparing to
See all releases

Code changes from version 6.9.12 to 6.9.13

changelog.txt CHANGED
@@ -1,11 +1,23 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 6.9.12 =
4
 
5
  = Bug Fixes =
6
 
7
  * Fixed a layout issue on the settings page.
8
- * Fixed a loayout issue on lightbox spheric panoramas that occurs when there are also normal photos in the set.
9
  * Fixed uninitialized vars in widget activation screens.
10
 
11
  = Other Changes =
1
  WP Photo Album Plus Changelog
2
 
3
+ = 6.9.13 =
4
+
5
+ = Bug Fixes =
6
+
7
+ * Trying to import a non existing remote photo no longer generates a warning in the server log.
8
+
9
+ = Other Changes =
10
+
11
+ * Several security issues found by RIPS Technologies (https://www.ripstech.com)
12
+ * If ImageMagick is activated, all filenames of newly uploaded or imported files will be sanitized by sanitize_file_name().
13
+ This implies (a.o.) that spaces in filenames will be converted to dashes. Due to security reasons this is a permanent restriction.
14
+
15
  = 6.9.12 =
16
 
17
  = Bug Fixes =
18
 
19
  * Fixed a layout issue on the settings page.
20
+ * Fixed a layout issue on lightbox spheric panoramas that occurs when there are also normal photos in the set.
21
  * Fixed uninitialized vars in widget activation screens.
22
 
23
  = Other Changes =
js/wppa-panorama.js CHANGED
@@ -7343,45 +7343,6 @@ THREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype );
7343
 
7344
  THREE.Object3DIdCount = 0;
7345
 
7346
- // File:src/core/Projector.js
7347
-
7348
- /**
7349
- * @author mrdoob / http://mrdoob.com/
7350
- */
7351
- /*
7352
- THREE.Projector = function () {
7353
-
7354
- console.warn( 'THREE.Projector has been moved to /examples/renderers/Projector.js.' );
7355
-
7356
- this.projectVector = function ( vector, camera ) {
7357
-
7358
- console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
7359
- vector.project( camera );
7360
-
7361
- };
7362
-
7363
- this.unprojectVector = function ( vector, camera ) {
7364
-
7365
- console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
7366
- vector.unproject( camera );
7367
-
7368
- };
7369
-
7370
- this.pickingRay = function ( vector, camera ) {
7371
-
7372
- console.error( 'THREE.Projector: .pickingRay() has been removed.' );
7373
-
7374
- };
7375
-
7376
- };
7377
-
7378
- // File:src/core/Face3.js
7379
-
7380
- /**
7381
- * @author mrdoob / http://mrdoob.com/
7382
- * @author alteredq / http://alteredqualia.com/
7383
- */
7384
-
7385
  THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
7386
 
7387
  this.a = a;
@@ -7437,19 +7398,6 @@ THREE.Face3.prototype = {
7437
 
7438
  };
7439
 
7440
- // File:src/core/Face4.js
7441
-
7442
- /**
7443
- * @author mrdoob / http://mrdoob.com/
7444
- */
7445
- /*
7446
- THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
7447
-
7448
- console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' )
7449
- return new THREE.Face3( a, b, c, normal, color, materialIndex );
7450
-
7451
- };
7452
-
7453
  // File:src/core/BufferAttribute.js
7454
 
7455
  /**
@@ -7564,72 +7512,6 @@ THREE.BufferAttribute.prototype = {
7564
 
7565
  };
7566
 
7567
- //
7568
- /*
7569
- THREE.Int8Attribute = function ( data, itemSize ) {
7570
-
7571
- console.warn( 'THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7572
- return new THREE.BufferAttribute( data, itemSize );
7573
-
7574
- };
7575
-
7576
- THREE.Uint8Attribute = function ( data, itemSize ) {
7577
-
7578
- console.warn( 'THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7579
- return new THREE.BufferAttribute( data, itemSize );
7580
-
7581
- };
7582
-
7583
- THREE.Uint8ClampedAttribute = function ( data, itemSize ) {
7584
-
7585
- console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7586
- return new THREE.BufferAttribute( data, itemSize );
7587
-
7588
-
7589
- };
7590
-
7591
- THREE.Int16Attribute = function ( data, itemSize ) {
7592
-
7593
- console.warn( 'THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7594
- return new THREE.BufferAttribute( data, itemSize );
7595
-
7596
- };
7597
-
7598
- THREE.Uint16Attribute = function ( data, itemSize ) {
7599
-
7600
- console.warn( 'THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7601
- return new THREE.BufferAttribute( data, itemSize );
7602
-
7603
- };
7604
-
7605
- THREE.Int32Attribute = function ( data, itemSize ) {
7606
-
7607
- console.warn( 'THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7608
- return new THREE.BufferAttribute( data, itemSize );
7609
-
7610
- };
7611
-
7612
- THREE.Uint32Attribute = function ( data, itemSize ) {
7613
-
7614
- console.warn( 'THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7615
- return new THREE.BufferAttribute( data, itemSize );
7616
-
7617
- };
7618
-
7619
- THREE.Float32Attribute = function ( data, itemSize ) {
7620
-
7621
- console.warn( 'THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7622
- return new THREE.BufferAttribute( data, itemSize );
7623
-
7624
- };
7625
-
7626
- THREE.Float64Attribute = function ( data, itemSize ) {
7627
-
7628
- console.warn( 'THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );
7629
- return new THREE.BufferAttribute( data, itemSize );
7630
-
7631
- };
7632
-
7633
  // File:src/core/BufferGeometry.js
7634
 
7635
  /**
@@ -9805,325 +9687,6 @@ THREE.Light.prototype.clone = function ( light ) {
9805
 
9806
  };
9807
 
9808
- // File:src/lights/AmbientLight.js
9809
-
9810
- /**
9811
- * @author mrdoob / http://mrdoob.com/
9812
- */
9813
- /*
9814
- THREE.AmbientLight = function ( color ) {
9815
-
9816
- THREE.Light.call( this, color );
9817
-
9818
- this.type = 'AmbientLight';
9819
-
9820
- };
9821
-
9822
- THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );
9823
-
9824
- THREE.AmbientLight.prototype.clone = function () {
9825
-
9826
- var light = new THREE.AmbientLight();
9827
-
9828
- THREE.Light.prototype.clone.call( this, light );
9829
-
9830
- return light;
9831
-
9832
- };
9833
-
9834
- // File:src/lights/AreaLight.js
9835
-
9836
- /**
9837
- * @author MPanknin / http://www.redplant.de/
9838
- * @author alteredq / http://alteredqualia.com/
9839
- */
9840
- /*
9841
- THREE.AreaLight = function ( color, intensity ) {
9842
-
9843
- THREE.Light.call( this, color );
9844
-
9845
- this.type = 'AreaLight';
9846
-
9847
- this.normal = new THREE.Vector3( 0, - 1, 0 );
9848
- this.right = new THREE.Vector3( 1, 0, 0 );
9849
-
9850
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
9851
-
9852
- this.width = 1.0;
9853
- this.height = 1.0;
9854
-
9855
- this.constantAttenuation = 1.5;
9856
- this.linearAttenuation = 0.5;
9857
- this.quadraticAttenuation = 0.1;
9858
-
9859
- };
9860
-
9861
- THREE.AreaLight.prototype = Object.create( THREE.Light.prototype );
9862
-
9863
-
9864
- // File:src/lights/DirectionalLight.js
9865
-
9866
- /**
9867
- * @author mrdoob / http://mrdoob.com/
9868
- * @author alteredq / http://alteredqualia.com/
9869
- */
9870
- /*
9871
- THREE.DirectionalLight = function ( color, intensity ) {
9872
-
9873
- THREE.Light.call( this, color );
9874
-
9875
- this.type = 'DirectionalLight';
9876
-
9877
- this.position.set( 0, 1, 0 );
9878
- this.target = new THREE.Object3D();
9879
-
9880
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
9881
-
9882
- this.castShadow = false;
9883
- this.onlyShadow = false;
9884
-
9885
- //
9886
-
9887
- this.shadowCameraNear = 50;
9888
- this.shadowCameraFar = 5000;
9889
-
9890
- this.shadowCameraLeft = - 500;
9891
- this.shadowCameraRight = 500;
9892
- this.shadowCameraTop = 500;
9893
- this.shadowCameraBottom = - 500;
9894
-
9895
- this.shadowCameraVisible = false;
9896
-
9897
- this.shadowBias = 0;
9898
- this.shadowDarkness = 0.5;
9899
-
9900
- this.shadowMapWidth = 512;
9901
- this.shadowMapHeight = 512;
9902
-
9903
- //
9904
-
9905
- this.shadowCascade = false;
9906
-
9907
- this.shadowCascadeOffset = new THREE.Vector3( 0, 0, - 1000 );
9908
- this.shadowCascadeCount = 2;
9909
-
9910
- this.shadowCascadeBias = [ 0, 0, 0 ];
9911
- this.shadowCascadeWidth = [ 512, 512, 512 ];
9912
- this.shadowCascadeHeight = [ 512, 512, 512 ];
9913
-
9914
- this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];
9915
- this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
9916
-
9917
- this.shadowCascadeArray = [];
9918
-
9919
- //
9920
-
9921
- this.shadowMap = null;
9922
- this.shadowMapSize = null;
9923
- this.shadowCamera = null;
9924
- this.shadowMatrix = null;
9925
-
9926
- };
9927
-
9928
- THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );
9929
-
9930
- THREE.DirectionalLight.prototype.clone = function () {
9931
-
9932
- var light = new THREE.DirectionalLight();
9933
-
9934
- THREE.Light.prototype.clone.call( this, light );
9935
-
9936
- light.target = this.target.clone();
9937
-
9938
- light.intensity = this.intensity;
9939
-
9940
- light.castShadow = this.castShadow;
9941
- light.onlyShadow = this.onlyShadow;
9942
-
9943
- //
9944
-
9945
- light.shadowCameraNear = this.shadowCameraNear;
9946
- light.shadowCameraFar = this.shadowCameraFar;
9947
-
9948
- light.shadowCameraLeft = this.shadowCameraLeft;
9949
- light.shadowCameraRight = this.shadowCameraRight;
9950
- light.shadowCameraTop = this.shadowCameraTop;
9951
- light.shadowCameraBottom = this.shadowCameraBottom;
9952
-
9953
- light.shadowCameraVisible = this.shadowCameraVisible;
9954
-
9955
- light.shadowBias = this.shadowBias;
9956
- light.shadowDarkness = this.shadowDarkness;
9957
-
9958
- light.shadowMapWidth = this.shadowMapWidth;
9959
- light.shadowMapHeight = this.shadowMapHeight;
9960
-
9961
- //
9962
-
9963
- light.shadowCascade = this.shadowCascade;
9964
-
9965
- light.shadowCascadeOffset.copy( this.shadowCascadeOffset );
9966
- light.shadowCascadeCount = this.shadowCascadeCount;
9967
-
9968
- light.shadowCascadeBias = this.shadowCascadeBias.slice( 0 );
9969
- light.shadowCascadeWidth = this.shadowCascadeWidth.slice( 0 );
9970
- light.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 );
9971
-
9972
- light.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 );
9973
- light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );
9974
-
9975
- return light;
9976
-
9977
- };
9978
-
9979
- // File:src/lights/HemisphereLight.js
9980
-
9981
- /**
9982
- * @author alteredq / http://alteredqualia.com/
9983
- */
9984
- /*
9985
- THREE.HemisphereLight = function ( skyColor, groundColor, intensity ) {
9986
-
9987
- THREE.Light.call( this, skyColor );
9988
-
9989
- this.type = 'HemisphereLight';
9990
-
9991
- this.position.set( 0, 100, 0 );
9992
-
9993
- this.groundColor = new THREE.Color( groundColor );
9994
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
9995
-
9996
- };
9997
-
9998
- THREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype );
9999
-
10000
- THREE.HemisphereLight.prototype.clone = function () {
10001
-
10002
- var light = new THREE.HemisphereLight();
10003
-
10004
- THREE.Light.prototype.clone.call( this, light );
10005
-
10006
- light.groundColor.copy( this.groundColor );
10007
- light.intensity = this.intensity;
10008
-
10009
- return light;
10010
-
10011
- };
10012
-
10013
- // File:src/lights/PointLight.js
10014
-
10015
- /**
10016
- * @author mrdoob / http://mrdoob.com/
10017
- */
10018
- /*
10019
- THREE.PointLight = function ( color, intensity, distance ) {
10020
-
10021
- THREE.Light.call( this, color );
10022
-
10023
- this.type = 'PointLight';
10024
-
10025
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
10026
- this.distance = ( distance !== undefined ) ? distance : 0;
10027
-
10028
- };
10029
-
10030
- THREE.PointLight.prototype = Object.create( THREE.Light.prototype );
10031
-
10032
- THREE.PointLight.prototype.clone = function () {
10033
-
10034
- var light = new THREE.PointLight();
10035
-
10036
- THREE.Light.prototype.clone.call( this, light );
10037
-
10038
- light.intensity = this.intensity;
10039
- light.distance = this.distance;
10040
-
10041
- return light;
10042
-
10043
- };
10044
-
10045
- // File:src/lights/SpotLight.js
10046
-
10047
- /**
10048
- * @author alteredq / http://alteredqualia.com/
10049
- */
10050
- /*
10051
- THREE.SpotLight = function ( color, intensity, distance, angle, exponent ) {
10052
-
10053
- THREE.Light.call( this, color );
10054
-
10055
- this.type = 'SpotLight';
10056
-
10057
- this.position.set( 0, 1, 0 );
10058
- this.target = new THREE.Object3D();
10059
-
10060
- this.intensity = ( intensity !== undefined ) ? intensity : 1;
10061
- this.distance = ( distance !== undefined ) ? distance : 0;
10062
- this.angle = ( angle !== undefined ) ? angle : Math.PI / 3;
10063
- this.exponent = ( exponent !== undefined ) ? exponent : 10;
10064
-
10065
- this.castShadow = false;
10066
- this.onlyShadow = false;
10067
-
10068
- //
10069
-
10070
- this.shadowCameraNear = 50;
10071
- this.shadowCameraFar = 5000;
10072
- this.shadowCameraFov = 50;
10073
-
10074
- this.shadowCameraVisible = false;
10075
-
10076
- this.shadowBias = 0;
10077
- this.shadowDarkness = 0.5;
10078
-
10079
- this.shadowMapWidth = 512;
10080
- this.shadowMapHeight = 512;
10081
-
10082
- //
10083
-
10084
- this.shadowMap = null;
10085
- this.shadowMapSize = null;
10086
- this.shadowCamera = null;
10087
- this.shadowMatrix = null;
10088
-
10089
- };
10090
-
10091
- THREE.SpotLight.prototype = Object.create( THREE.Light.prototype );
10092
-
10093
- THREE.SpotLight.prototype.clone = function () {
10094
-
10095
- var light = new THREE.SpotLight();
10096
-
10097
- THREE.Light.prototype.clone.call( this, light );
10098
-
10099
- light.target = this.target.clone();
10100
-
10101
- light.intensity = this.intensity;
10102
- light.distance = this.distance;
10103
- light.angle = this.angle;
10104
- light.exponent = this.exponent;
10105
-
10106
- light.castShadow = this.castShadow;
10107
- light.onlyShadow = this.onlyShadow;
10108
-
10109
- //
10110
-
10111
- light.shadowCameraNear = this.shadowCameraNear;
10112
- light.shadowCameraFar = this.shadowCameraFar;
10113
- light.shadowCameraFov = this.shadowCameraFov;
10114
-
10115
- light.shadowCameraVisible = this.shadowCameraVisible;
10116
-
10117
- light.shadowBias = this.shadowBias;
10118
- light.shadowDarkness = this.shadowDarkness;
10119
-
10120
- light.shadowMapWidth = this.shadowMapWidth;
10121
- light.shadowMapHeight = this.shadowMapHeight;
10122
-
10123
- return light;
10124
-
10125
- };
10126
-
10127
  // File:src/loaders/Cache.js
10128
 
10129
  /**
@@ -10819,1300 +10382,50 @@ THREE.ImageLoader.prototype = {
10819
 
10820
  }
10821
 
10822
- // File:src/loaders/JSONLoader.js
10823
 
10824
  /**
10825
  * @author mrdoob / http://mrdoob.com/
10826
- * @author alteredq / http://alteredqualia.com/
10827
  */
10828
- /*
10829
- THREE.JSONLoader = function ( showStatus ) {
10830
 
10831
- THREE.Loader.call( this, showStatus );
10832
 
10833
- this.withCredentials = false;
10834
 
10835
- };
10836
 
10837
- THREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype );
 
 
10838
 
10839
- THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
10840
 
10841
- var scope = this;
10842
-
10843
- // todo: unify load API to for easier SceneLoader use
10844
-
10845
- texturePath = texturePath && ( typeof texturePath === 'string' ) ? texturePath : this.extractUrlBase( url );
10846
-
10847
- this.onLoadStart();
10848
- this.loadAjaxJSON( this, url, callback, texturePath );
10849
-
10850
- };
10851
-
10852
- THREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, callbackProgress ) {
10853
-
10854
- var xhr = new XMLHttpRequest();
10855
-
10856
- var length = 0;
10857
-
10858
- xhr.onreadystatechange = function () {
10859
-
10860
- if ( xhr.readyState === xhr.DONE ) {
10861
-
10862
- if ( xhr.status === 200 || xhr.status === 0 ) {
10863
-
10864
- if ( xhr.responseText ) {
10865
-
10866
- var json = JSON.parse( xhr.responseText );
10867
-
10868
- if ( json.metadata !== undefined && json.metadata.type === 'scene' ) {
10869
-
10870
- console.error( 'THREE.JSONLoader: "' + url + '" seems to be a Scene. Use THREE.SceneLoader instead.' );
10871
- return;
10872
-
10873
- }
10874
-
10875
- var result = context.parse( json, texturePath );
10876
- callback( result.geometry, result.materials );
10877
-
10878
- } else {
10879
-
10880
- console.error( 'THREE.JSONLoader: "' + url + '" seems to be unreachable or the file is empty.' );
10881
-
10882
- }
10883
-
10884
- // in context of more complex asset initialization
10885
- // do not block on single failed file
10886
- // maybe should go even one more level up
10887
-
10888
- context.onLoadComplete();
10889
-
10890
- } else {
10891
-
10892
- console.error( 'THREE.JSONLoader: Couldn\'t load "' + url + '" (' + xhr.status + ')' );
10893
-
10894
- }
10895
-
10896
- } else if ( xhr.readyState === xhr.LOADING ) {
10897
-
10898
- if ( callbackProgress ) {
10899
-
10900
- if ( length === 0 ) {
10901
-
10902
- length = xhr.getResponseHeader( 'Content-Length' );
10903
-
10904
- }
10905
-
10906
- callbackProgress( { total: length, loaded: xhr.responseText.length } );
10907
-
10908
- }
10909
-
10910
- } else if ( xhr.readyState === xhr.HEADERS_RECEIVED ) {
10911
-
10912
- if ( callbackProgress !== undefined ) {
10913
-
10914
- length = xhr.getResponseHeader( 'Content-Length' );
10915
-
10916
- }
10917
-
10918
- }
10919
-
10920
- };
10921
-
10922
- xhr.open( 'GET', url, true );
10923
- xhr.withCredentials = this.withCredentials;
10924
- xhr.send( null );
10925
-
10926
- };
10927
-
10928
- THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
10929
-
10930
- var scope = this,
10931
- geometry = new THREE.Geometry(),
10932
- scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;
10933
-
10934
- parseModel( scale );
10935
-
10936
- parseSkin();
10937
- parseMorphing( scale );
10938
-
10939
- geometry.computeFaceNormals();
10940
- geometry.computeBoundingSphere();
10941
-
10942
- function parseModel( scale ) {
10943
-
10944
- function isBitSet( value, position ) {
10945
-
10946
- return value & ( 1 << position );
10947
-
10948
- }
10949
-
10950
- var i, j, fi,
10951
-
10952
- offset, zLength,
10953
-
10954
- colorIndex, normalIndex, uvIndex, materialIndex,
10955
-
10956
- type,
10957
- isQuad,
10958
- hasMaterial,
10959
- hasFaceVertexUv,
10960
- hasFaceNormal, hasFaceVertexNormal,
10961
- hasFaceColor, hasFaceVertexColor,
10962
-
10963
- vertex, face, faceA, faceB, color, hex, normal,
10964
-
10965
- uvLayer, uv, u, v,
10966
-
10967
- faces = json.faces,
10968
- vertices = json.vertices,
10969
- normals = json.normals,
10970
- colors = json.colors,
10971
-
10972
- nUvLayers = 0;
10973
-
10974
- if ( json.uvs !== undefined ) {
10975
-
10976
- // disregard empty arrays
10977
-
10978
- for ( i = 0; i < json.uvs.length; i ++ ) {
10979
-
10980
- if ( json.uvs[ i ].length ) nUvLayers ++;
10981
-
10982
- }
10983
-
10984
- for ( i = 0; i < nUvLayers; i ++ ) {
10985
-
10986
- geometry.faceVertexUvs[ i ] = [];
10987
-
10988
- }
10989
-
10990
- }
10991
-
10992
- offset = 0;
10993
- zLength = vertices.length;
10994
-
10995
- while ( offset < zLength ) {
10996
-
10997
- vertex = new THREE.Vector3();
10998
-
10999
- vertex.x = vertices[ offset ++ ] * scale;
11000
- vertex.y = vertices[ offset ++ ] * scale;
11001
- vertex.z = vertices[ offset ++ ] * scale;
11002
-
11003
- geometry.vertices.push( vertex );
11004
-
11005
- }
11006
-
11007
- offset = 0;
11008
- zLength = faces.length;
11009
-
11010
- while ( offset < zLength ) {
11011
-
11012
- type = faces[ offset ++ ];
11013
-
11014
-
11015
- isQuad = isBitSet( type, 0 );
11016
- hasMaterial = isBitSet( type, 1 );
11017
- hasFaceVertexUv = isBitSet( type, 3 );
11018
- hasFaceNormal = isBitSet( type, 4 );
11019
- hasFaceVertexNormal = isBitSet( type, 5 );
11020
- hasFaceColor = isBitSet( type, 6 );
11021
- hasFaceVertexColor = isBitSet( type, 7 );
11022
-
11023
- // console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
11024
-
11025
- if ( isQuad ) {
11026
-
11027
- faceA = new THREE.Face3();
11028
- faceA.a = faces[ offset ];
11029
- faceA.b = faces[ offset + 1 ];
11030
- faceA.c = faces[ offset + 3 ];
11031
-
11032
- faceB = new THREE.Face3();
11033
- faceB.a = faces[ offset + 1 ];
11034
- faceB.b = faces[ offset + 2 ];
11035
- faceB.c = faces[ offset + 3 ];
11036
-
11037
- offset += 4;
11038
-
11039
- if ( hasMaterial ) {
11040
-
11041
- materialIndex = faces[ offset ++ ];
11042
- faceA.materialIndex = materialIndex;
11043
- faceB.materialIndex = materialIndex;
11044
-
11045
- }
11046
-
11047
- // to get face <=> uv index correspondence
11048
-
11049
- fi = geometry.faces.length;
11050
-
11051
- if ( hasFaceVertexUv ) {
11052
-
11053
- for ( i = 0; i < nUvLayers; i ++ ) {
11054
-
11055
- uvLayer = json.uvs[ i ];
11056
-
11057
- geometry.faceVertexUvs[ i ][ fi ] = [];
11058
- geometry.faceVertexUvs[ i ][ fi + 1 ] = []
11059
-
11060
- for ( j = 0; j < 4; j ++ ) {
11061
-
11062
- uvIndex = faces[ offset ++ ];
11063
-
11064
- u = uvLayer[ uvIndex * 2 ];
11065
- v = uvLayer[ uvIndex * 2 + 1 ];
11066
-
11067
- uv = new THREE.Vector2( u, v );
11068
-
11069
- if ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv );
11070
- if ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv );
11071
-
11072
- }
11073
-
11074
- }
11075
-
11076
- }
11077
-
11078
- if ( hasFaceNormal ) {
11079
-
11080
- normalIndex = faces[ offset ++ ] * 3;
11081
-
11082
- faceA.normal.set(
11083
- normals[ normalIndex ++ ],
11084
- normals[ normalIndex ++ ],
11085
- normals[ normalIndex ]
11086
- );
11087
-
11088
- faceB.normal.copy( faceA.normal );
11089
-
11090
- }
11091
-
11092
- if ( hasFaceVertexNormal ) {
11093
-
11094
- for ( i = 0; i < 4; i ++ ) {
11095
-
11096
- normalIndex = faces[ offset ++ ] * 3;
11097
-
11098
- normal = new THREE.Vector3(
11099
- normals[ normalIndex ++ ],
11100
- normals[ normalIndex ++ ],
11101
- normals[ normalIndex ]
11102
- );
11103
-
11104
-
11105
- if ( i !== 2 ) faceA.vertexNormals.push( normal );
11106
- if ( i !== 0 ) faceB.vertexNormals.push( normal );
11107
-
11108
- }
11109
-
11110
- }
11111
-
11112
-
11113
- if ( hasFaceColor ) {
11114
-
11115
- colorIndex = faces[ offset ++ ];
11116
- hex = colors[ colorIndex ];
11117
-
11118
- faceA.color.setHex( hex );
11119
- faceB.color.setHex( hex );
11120
-
11121
- }
11122
-
11123
-
11124
- if ( hasFaceVertexColor ) {
11125
-
11126
- for ( i = 0; i < 4; i ++ ) {
11127
-
11128
- colorIndex = faces[ offset ++ ];
11129
- hex = colors[ colorIndex ];
11130
-
11131
- if ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) );
11132
- if ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) );
11133
-
11134
- }
11135
-
11136
- }
11137
-
11138
- geometry.faces.push( faceA );
11139
- geometry.faces.push( faceB );
11140
-
11141
- } else {
11142
-
11143
- face = new THREE.Face3();
11144
- face.a = faces[ offset ++ ];
11145
- face.b = faces[ offset ++ ];
11146
- face.c = faces[ offset ++ ];
11147
-
11148
- if ( hasMaterial ) {
11149
-
11150
- materialIndex = faces[ offset ++ ];
11151
- face.materialIndex = materialIndex;
11152
-
11153
- }
11154
-
11155
- // to get face <=> uv index correspondence
11156
-
11157
- fi = geometry.faces.length;
11158
-
11159
- if ( hasFaceVertexUv ) {
11160
-
11161
- for ( i = 0; i < nUvLayers; i ++ ) {
11162
-
11163
- uvLayer = json.uvs[ i ];
11164
-
11165
- geometry.faceVertexUvs[ i ][ fi ] = [];
11166
-
11167
- for ( j = 0; j < 3; j ++ ) {
11168
-
11169
- uvIndex = faces[ offset ++ ];
11170
-
11171
- u = uvLayer[ uvIndex * 2 ];
11172
- v = uvLayer[ uvIndex * 2 + 1 ];
11173
-
11174
- uv = new THREE.Vector2( u, v );
11175
-
11176
- geometry.faceVertexUvs[ i ][ fi ].push( uv );
11177
-
11178
- }
11179
-
11180
- }
11181
-
11182
- }
11183
-
11184
- if ( hasFaceNormal ) {
11185
-
11186
- normalIndex = faces[ offset ++ ] * 3;
11187
-
11188
- face.normal.set(
11189
- normals[ normalIndex ++ ],
11190
- normals[ normalIndex ++ ],
11191
- normals[ normalIndex ]
11192
- );
11193
-
11194
- }
11195
-
11196
- if ( hasFaceVertexNormal ) {
11197
-
11198
- for ( i = 0; i < 3; i ++ ) {
11199
-
11200
- normalIndex = faces[ offset ++ ] * 3;
11201
-
11202
- normal = new THREE.Vector3(
11203
- normals[ normalIndex ++ ],
11204
- normals[ normalIndex ++ ],
11205
- normals[ normalIndex ]
11206
- );
11207
-
11208
- face.vertexNormals.push( normal );
11209
-
11210
- }
11211
-
11212
- }
11213
-
11214
-
11215
- if ( hasFaceColor ) {
11216
-
11217
- colorIndex = faces[ offset ++ ];
11218
- face.color.setHex( colors[ colorIndex ] );
11219
-
11220
- }
11221
-
11222
-
11223
- if ( hasFaceVertexColor ) {
11224
-
11225
- for ( i = 0; i < 3; i ++ ) {
11226
-
11227
- colorIndex = faces[ offset ++ ];
11228
- face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );
11229
-
11230
- }
11231
-
11232
- }
11233
-
11234
- geometry.faces.push( face );
11235
-
11236
- }
11237
-
11238
- }
11239
 
11240
  };
11241
 
11242
- function parseSkin() {
11243
- var influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2;
11244
-
11245
- if ( json.skinWeights ) {
11246
-
11247
- for ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) {
11248
-
11249
- var x = json.skinWeights[ i ];
11250
- var y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0;
11251
- var z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0;
11252
- var w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0;
11253
-
11254
- geometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) );
11255
-
11256
- }
11257
-
11258
- }
11259
-
11260
- if ( json.skinIndices ) {
11261
-
11262
- for ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) {
11263
 
11264
- var a = json.skinIndices[ i ];
11265
- var b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0;
11266
- var c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0;
11267
- var d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0;
11268
 
11269
- geometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) );
11270
 
11271
- }
11272
 
11273
  }
11274
 
11275
- geometry.bones = json.bones;
11276
-
11277
- if ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) {
11278
 
11279
- console.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +
11280
- geometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' );
11281
 
11282
  }
11283
 
11284
-
11285
- // could change this to json.animations[0] or remove completely
11286
-
11287
- geometry.animation = json.animation;
11288
- geometry.animations = json.animations;
11289
-
11290
  };
11291
 
11292
- function parseMorphing( scale ) {
11293
-
11294
- if ( json.morphTargets !== undefined ) {
11295
-
11296
- var i, l, v, vl, dstVertices, srcVertices;
11297
-
11298
- for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {
11299
-
11300
- geometry.morphTargets[ i ] = {};
11301
- geometry.morphTargets[ i ].name = json.morphTargets[ i ].name;
11302
- geometry.morphTargets[ i ].vertices = [];
11303
-
11304
- dstVertices = geometry.morphTargets[ i ].vertices;
11305
- srcVertices = json.morphTargets [ i ].vertices;
11306
-
11307
- for ( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
11308
-
11309
- var vertex = new THREE.Vector3();
11310
- vertex.x = srcVertices[ v ] * scale;
11311
- vertex.y = srcVertices[ v + 1 ] * scale;
11312
- vertex.z = srcVertices[ v + 2 ] * scale;
11313
-
11314
- dstVertices.push( vertex );
11315
-
11316
- }
11317
-
11318
- }
11319
-
11320
- }
11321
-
11322
- if ( json.morphColors !== undefined ) {
11323
-
11324
- var i, l, c, cl, dstColors, srcColors, color;
11325
-
11326
- for ( i = 0, l = json.morphColors.length; i < l; i ++ ) {
11327
-
11328
- geometry.morphColors[ i ] = {};
11329
- geometry.morphColors[ i ].name = json.morphColors[ i ].name;
11330
- geometry.morphColors[ i ].colors = [];
11331
-
11332
- dstColors = geometry.morphColors[ i ].colors;
11333
- srcColors = json.morphColors [ i ].colors;
11334
-
11335
- for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
11336
-
11337
- color = new THREE.Color( 0xffaa00 );
11338
- color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );
11339
- dstColors.push( color );
11340
-
11341
- }
11342
-
11343
- }
11344
-
11345
- }
11346
-
11347
- };
11348
-
11349
- if ( json.materials === undefined || json.materials.length === 0 ) {
11350
-
11351
- return { geometry: geometry };
11352
-
11353
- } else {
11354
-
11355
- var materials = this.initMaterials( json.materials, texturePath );
11356
-
11357
- if ( this.needsTangents( materials ) ) {
11358
-
11359
- geometry.computeTangents();
11360
-
11361
- }
11362
-
11363
- return { geometry: geometry, materials: materials };
11364
-
11365
- }
11366
-
11367
- };
11368
-
11369
- // File:src/loaders/LoadingManager.js
11370
-
11371
- /**
11372
- * @author mrdoob / http://mrdoob.com/
11373
- */
11374
-
11375
- THREE.LoadingManager = function ( onLoad, onProgress, onError ) {
11376
-
11377
- var scope = this;
11378
-
11379
- var loaded = 0, total = 0;
11380
-
11381
- this.onLoad = onLoad;
11382
- this.onProgress = onProgress;
11383
- this.onError = onError;
11384
-
11385
- this.itemStart = function ( url ) {
11386
-
11387
- total ++;
11388
-
11389
- };
11390
-
11391
- this.itemEnd = function ( url ) {
11392
-
11393
- loaded ++;
11394
-
11395
- if ( scope.onProgress !== undefined ) {
11396
-
11397
- scope.onProgress( url, loaded, total );
11398
-
11399
- }
11400
-
11401
- if ( loaded === total && scope.onLoad !== undefined ) {
11402
-
11403
- scope.onLoad();
11404
-
11405
- }
11406
-
11407
- };
11408
-
11409
- };
11410
 
11411
  THREE.DefaultLoadingManager = new THREE.LoadingManager();
11412
 
11413
- // File:src/loaders/BufferGeometryLoader.js
11414
-
11415
- /**
11416
- * @author mrdoob / http://mrdoob.com/
11417
- */
11418
- /*
11419
- THREE.BufferGeometryLoader = function ( manager ) {
11420
-
11421
- this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
11422
-
11423
- };
11424
-
11425
- THREE.BufferGeometryLoader.prototype = {
11426
-
11427
- constructor: THREE.BufferGeometryLoader,
11428
-
11429
- load: function ( url, onLoad, onProgress, onError ) {
11430
-
11431
- var scope = this;
11432
-
11433
- var loader = new THREE.XHRLoader();
11434
- loader.setCrossOrigin( this.crossOrigin );
11435
- loader.load( url, function ( text ) {
11436
-
11437
- onLoad( scope.parse( JSON.parse( text ) ) );
11438
-
11439
- }, onProgress, onError );
11440
-
11441
- },
11442
-
11443
- setCrossOrigin: function ( value ) {
11444
-
11445
- this.crossOrigin = value;
11446
-
11447
- },
11448
-
11449
- parse: function ( json ) {
11450
-
11451
- var geometry = new THREE.BufferGeometry();
11452
-
11453
- var attributes = json.attributes;
11454
-
11455
- for ( var key in attributes ) {
11456
-
11457
- var attribute = attributes[ key ];
11458
- var typedArray = new self[ attribute.type ]( attribute.array );
11459
-
11460
- geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) );
11461
-
11462
- }
11463
-
11464
- var offsets = json.offsets;
11465
-
11466
- if ( offsets !== undefined ) {
11467
-
11468
- geometry.offsets = JSON.parse( JSON.stringify( offsets ) );
11469
-
11470
- }
11471
-
11472
- var boundingSphere = json.boundingSphere;
11473
-
11474
- if ( boundingSphere !== undefined ) {
11475
-
11476
- var center = new THREE.Vector3();
11477
-
11478
- if ( boundingSphere.center !== undefined ) {
11479
-
11480
- center.fromArray( boundingSphere.center );
11481
-
11482
- }
11483
-
11484
- geometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius );
11485
-
11486
- }
11487
-
11488
- return geometry;
11489
-
11490
- }
11491
-
11492
- };
11493
-
11494
- // File:src/loaders/MaterialLoader.js
11495
-
11496
- /**
11497
- * @author mrdoob / http://mrdoob.com/
11498
- */
11499
- /*
11500
- THREE.MaterialLoader = function ( manager ) {
11501
-
11502
- this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
11503
-
11504
- };
11505
-
11506
- THREE.MaterialLoader.prototype = {
11507
-
11508
- constructor: THREE.MaterialLoader,
11509
-
11510
- load: function ( url, onLoad, onProgress, onError ) {
11511
-
11512
- var scope = this;
11513
-
11514
- var loader = new THREE.XHRLoader();
11515
- loader.setCrossOrigin( this.crossOrigin );
11516
- loader.load( url, function ( text ) {
11517
-
11518
- onLoad( scope.parse( JSON.parse( text ) ) );
11519
-
11520
- }, onProgress, onError );
11521
-
11522
- },
11523
-
11524
- setCrossOrigin: function ( value ) {
11525
-
11526
- this.crossOrigin = value;
11527
-
11528
- },
11529
-
11530
- parse: function ( json ) {
11531
-
11532
- var material = new THREE[ json.type ];
11533
-
11534
- if ( json.color !== undefined ) material.color.setHex( json.color );
11535
- if ( json.ambient !== undefined ) material.ambient.setHex( json.ambient );
11536
- if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );
11537
- if ( json.specular !== undefined ) material.specular.setHex( json.specular );
11538
- if ( json.shininess !== undefined ) material.shininess = json.shininess;
11539
- if ( json.uniforms !== undefined ) material.uniforms = json.uniforms;
11540
- if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
11541
- if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
11542
- if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors;
11543
- if ( json.shading !== undefined ) material.shading = json.shading;
11544
- if ( json.blending !== undefined ) material.blending = json.blending;
11545
- if ( json.side !== undefined ) material.side = json.side;
11546
- if ( json.opacity !== undefined ) material.opacity = json.opacity;
11547
- if ( json.transparent !== undefined ) material.transparent = json.transparent;
11548
- if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
11549
-
11550
- if ( json.materials !== undefined ) {
11551
-
11552
- for ( var i = 0, l = json.materials.length; i < l; i ++ ) {
11553
-
11554
- material.materials.push( this.parse( json.materials[ i ] ) );
11555
-
11556
- }
11557
-
11558
- }
11559
-
11560
- return material;
11561
-
11562
- }
11563
-
11564
- };
11565
-
11566
- // File:src/loaders/ObjectLoader.js
11567
-
11568
- /**
11569
- * @author mrdoob / http://mrdoob.com/
11570
- */
11571
- /*
11572
- THREE.ObjectLoader = function ( manager ) {
11573
-
11574
- this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
11575
-
11576
- };
11577
-
11578
- THREE.ObjectLoader.prototype = {
11579
-
11580
- constructor: THREE.ObjectLoader,
11581
-
11582
- load: function ( url, onLoad, onProgress, onError ) {
11583
-
11584
- var scope = this;
11585
-
11586
- var loader = new THREE.XHRLoader( scope.manager );
11587
- loader.setCrossOrigin( this.crossOrigin );
11588
- loader.load( url, function ( text ) {
11589
-
11590
- onLoad( scope.parse( JSON.parse( text ) ) );
11591
-
11592
- }, onProgress, onError );
11593
-
11594
- },
11595
-
11596
- setCrossOrigin: function ( value ) {
11597
-
11598
- this.crossOrigin = value;
11599
-
11600
- },
11601
-
11602
- parse: function ( json ) {
11603
-
11604
- var geometries = this.parseGeometries( json.geometries );
11605
- var materials = this.parseMaterials( json.materials );
11606
- var object = this.parseObject( json.object, geometries, materials );
11607
-
11608
- return object;
11609
-
11610
- },
11611
-
11612
- parseGeometries: function ( json ) {
11613
-
11614
- var geometries = {};
11615
-
11616
- if ( json !== undefined ) {
11617
-
11618
- var geometryLoader = new THREE.JSONLoader();
11619
- var bufferGeometryLoader = new THREE.BufferGeometryLoader();
11620
-
11621
- for ( var i = 0, l = json.length; i < l; i ++ ) {
11622
-
11623
- var geometry;
11624
- var data = json[ i ];
11625
-
11626
- switch ( data.type ) {
11627
-
11628
- case 'PlaneGeometry':
11629
-
11630
- geometry = new THREE.PlaneGeometry(
11631
- data.width,
11632
- data.height,
11633
- data.widthSegments,
11634
- data.heightSegments
11635
- );
11636
-
11637
- break;
11638
-
11639
- case 'BoxGeometry':
11640
- case 'CubeGeometry': // backwards compatible
11641
-
11642
- geometry = new THREE.BoxGeometry(
11643
- data.width,
11644
- data.height,
11645
- data.depth,
11646
- data.widthSegments,
11647
- data.heightSegments,
11648
- data.depthSegments
11649
- );
11650
-
11651
- break;
11652
-
11653
- case 'CircleGeometry':
11654
-
11655
- geometry = new THREE.CircleGeometry(
11656
- data.radius,
11657
- data.segments
11658
- );
11659
-
11660
- break;
11661
-
11662
- case 'CylinderGeometry':
11663
-
11664
- geometry = new THREE.CylinderGeometry(
11665
- data.radiusTop,
11666
- data.radiusBottom,
11667
- data.height,
11668
- data.radialSegments,
11669
- data.heightSegments,
11670
- data.openEnded
11671
- );
11672
-
11673
- break;
11674
-
11675
- case 'SphereGeometry':
11676
-
11677
- geometry = new THREE.SphereGeometry(
11678
- data.radius,
11679
- data.widthSegments,
11680
- data.heightSegments,
11681
- data.phiStart,
11682
- data.phiLength,
11683
- data.thetaStart,
11684
- data.thetaLength
11685
- );
11686
-
11687
- break;
11688
-
11689
- case 'IcosahedronGeometry':
11690
-
11691
- geometry = new THREE.IcosahedronGeometry(
11692
- data.radius,
11693
- data.detail
11694
- );
11695
-
11696
- break;
11697
-
11698
- case 'TorusGeometry':
11699
-
11700
- geometry = new THREE.TorusGeometry(
11701
- data.radius,
11702
- data.tube,
11703
- data.radialSegments,
11704
- data.tubularSegments,
11705
- data.arc
11706
- );
11707
-
11708
- break;
11709
-
11710
- case 'TorusKnotGeometry':
11711
-
11712
- geometry = new THREE.TorusKnotGeometry(
11713
- data.radius,
11714
- data.tube,
11715
- data.radialSegments,
11716
- data.tubularSegments,
11717
- data.p,
11718
- data.q,
11719
- data.heightScale
11720
- );
11721
-
11722
- break;
11723
-
11724
- case 'BufferGeometry':
11725
-
11726
- geometry = bufferGeometryLoader.parse( data.data );
11727
-
11728
- break;
11729
-
11730
- case 'Geometry':
11731
-
11732
- geometry = geometryLoader.parse( data.data ).geometry;
11733
-
11734
- break;
11735
-
11736
- }
11737
-
11738
- geometry.uuid = data.uuid;
11739
-
11740
- if ( data.name !== undefined ) geometry.name = data.name;
11741
-
11742
- geometries[ data.uuid ] = geometry;
11743
-
11744
- }
11745
-
11746
- }
11747
-
11748
- return geometries;
11749
-
11750
- },
11751
-
11752
- parseMaterials: function ( json ) {
11753
-
11754
- var materials = {};
11755
-
11756
- if ( json !== undefined ) {
11757
-
11758
- var loader = new THREE.MaterialLoader();
11759
-
11760
- for ( var i = 0, l = json.length; i < l; i ++ ) {
11761
-
11762
- var data = json[ i ];
11763
- var material = loader.parse( data );
11764
-
11765
- material.uuid = data.uuid;
11766
-
11767
- if ( data.name !== undefined ) material.name = data.name;
11768
-
11769
- materials[ data.uuid ] = material;
11770
-
11771
- }
11772
-
11773
- }
11774
-
11775
- return materials;
11776
-
11777
- },
11778
-
11779
- parseObject: function () {
11780
-
11781
- var matrix = new THREE.Matrix4();
11782
-
11783
- return function ( data, geometries, materials ) {
11784
-
11785
- var object;
11786
-
11787
- switch ( data.type ) {
11788
-
11789
- case 'Scene':
11790
-
11791
- object = new THREE.Scene();
11792
-
11793
- break;
11794
-
11795
- case 'PerspectiveCamera':
11796
-
11797
- object = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far );
11798
-
11799
- break;
11800
-
11801
- case 'OrthographicCamera':
11802
-
11803
- object = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );
11804
-
11805
- break;
11806
-
11807
- case 'AmbientLight':
11808
-
11809
- object = new THREE.AmbientLight( data.color );
11810
-
11811
- break;
11812
-
11813
- case 'DirectionalLight':
11814
-
11815
- object = new THREE.DirectionalLight( data.color, data.intensity );
11816
-
11817
- break;
11818
-
11819
- case 'PointLight':
11820
-
11821
- object = new THREE.PointLight( data.color, data.intensity, data.distance );
11822
-
11823
- break;
11824
-
11825
- case 'SpotLight':
11826
-
11827
- object = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent );
11828
-
11829
- break;
11830
-
11831
- case 'HemisphereLight':
11832
-
11833
- object = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity );
11834
-
11835
- break;
11836
-
11837
- case 'Mesh':
11838
-
11839
- var geometry = geometries[ data.geometry ];
11840
- var material = materials[ data.material ];
11841
-
11842
- if ( geometry === undefined ) {
11843
-
11844
- console.warn( 'THREE.ObjectLoader: Undefined geometry', data.geometry );
11845
-
11846
- }
11847
-
11848
- if ( material === undefined ) {
11849
-
11850
- console.warn( 'THREE.ObjectLoader: Undefined material', data.material );
11851
-
11852
- }
11853
-
11854
- object = new THREE.Mesh( geometry, material );
11855
-
11856
- break;
11857
-
11858
- case 'Line':
11859
-
11860
- var geometry = geometries[ data.geometry ];
11861
- var material = materials[ data.material ];
11862
-
11863
- if ( geometry === undefined ) {
11864
-
11865
- console.warn( 'THREE.ObjectLoader: Undefined geometry', data.geometry );
11866
-
11867
- }
11868
-
11869
- if ( material === undefined ) {
11870
-
11871
- console.warn( 'THREE.ObjectLoader: Undefined material', data.material );
11872
-
11873
- }
11874
-
11875
- object = new THREE.Line( geometry, material );
11876
-
11877
- break;
11878
-
11879
- case 'Sprite':
11880
-
11881
- var material = materials[ data.material ];
11882
-
11883
- if ( material === undefined ) {
11884
-
11885
- console.warn( 'THREE.ObjectLoader: Undefined material', data.material );
11886
-
11887
- }
11888
-
11889
- object = new THREE.Sprite( material );
11890
-
11891
- break;
11892
-
11893
- case 'Group':
11894
-
11895
- object = new THREE.Group();
11896
-
11897
- break;
11898
-
11899
- default:
11900
-
11901
- object = new THREE.Object3D();
11902
-
11903
- }
11904
-
11905
- object.uuid = data.uuid;
11906
-
11907
- if ( data.name !== undefined ) object.name = data.name;
11908
- if ( data.matrix !== undefined ) {
11909
-
11910
- matrix.fromArray( data.matrix );
11911
- matrix.decompose( object.position, object.quaternion, object.scale );
11912
-
11913
- } else {
11914
-
11915
- if ( data.position !== undefined ) object.position.fromArray( data.position );
11916
- if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );
11917
- if ( data.scale !== undefined ) object.scale.fromArray( data.scale );
11918
-
11919
- }
11920
-
11921
- if ( data.visible !== undefined ) object.visible = data.visible;
11922
- if ( data.userData !== undefined ) object.userData = data.userData;
11923
-
11924
- if ( data.children !== undefined ) {
11925
-
11926
- for ( var child in data.children ) {
11927
-
11928
- object.add( this.parseObject( data.children[ child ], geometries, materials ) );
11929
-
11930
- }
11931
-
11932
- }
11933
-
11934
- return object;
11935
-
11936
- }
11937
-
11938
- }()
11939
-
11940
- };
11941
-
11942
- // File:src/loaders/TextureLoader.js
11943
-
11944
- /**
11945
- * @author mrdoob / http://mrdoob.com/
11946
- */
11947
-
11948
- THREE.TextureLoader = function ( manager ) {
11949
-
11950
- this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
11951
-
11952
- };
11953
-
11954
- THREE.TextureLoader.prototype = {
11955
-
11956
- constructor: THREE.TextureLoader,
11957
-
11958
- load: function ( url, onLoad, onProgress, onError ) {
11959
-
11960
- var scope = this;
11961
-
11962
- var loader = new THREE.ImageLoader( scope.manager );
11963
- loader.setCrossOrigin( this.crossOrigin );
11964
- loader.load( url, function ( image ) {
11965
-
11966
- var texture = new THREE.Texture( image );
11967
- texture.needsUpdate = true;
11968
-
11969
- if ( onLoad !== undefined ) {
11970
-
11971
- onLoad( texture );
11972
-
11973
- }
11974
-
11975
- }, onProgress, onError );
11976
-
11977
- },
11978
-
11979
- setCrossOrigin: function ( value ) {
11980
-
11981
- this.crossOrigin = value;
11982
-
11983
- }
11984
-
11985
- };
11986
-
11987
- // File:src/loaders/CompressedTextureLoader.js
11988
-
11989
- /**
11990
- * @author mrdoob / http://mrdoob.com/
11991
- *
11992
- * Abstract Base class to block based textures loader (dds, pvr, ...)
11993
- */
11994
-
11995
- THREE.CompressedTextureLoader = function () {
11996
-
11997
- // override in sub classes
11998
- this._parser = null;
11999
-
12000
- };
12001
-
12002
-
12003
- THREE.CompressedTextureLoader.prototype = {
12004
-
12005
- constructor: THREE.CompressedTextureLoader,
12006
-
12007
- load: function ( url, onLoad, onError ) {
12008
-
12009
- var scope = this;
12010
-
12011
- var images = [];
12012
-
12013
- var texture = new THREE.CompressedTexture();
12014
- texture.image = images;
12015
-
12016
- var loader = new THREE.XHRLoader();
12017
- loader.setResponseType( 'arraybuffer' );
12018
-
12019
- if ( url instanceof Array ) {
12020
-
12021
- var loaded = 0;
12022
-
12023
- var loadTexture = function ( i ) {
12024
-
12025
- loader.load( url[ i ], function ( buffer ) {
12026
-
12027
- var texDatas = scope._parser( buffer, true );
12028
-
12029
- images[ i ] = {
12030
- width: texDatas.width,
12031
- height: texDatas.height,
12032
- format: texDatas.format,
12033
- mipmaps: texDatas.mipmaps
12034
- };
12035
-
12036
- loaded += 1;
12037
-
12038
- if ( loaded === 6 ) {
12039
-
12040
- if (texDatas.mipmapCount == 1)
12041
- texture.minFilter = THREE.LinearFilter;
12042
-
12043
- texture.format = texDatas.format;
12044
- texture.needsUpdate = true;
12045
-
12046
- if ( onLoad ) onLoad( texture );
12047
-
12048
- }
12049
-
12050
- } );
12051
-
12052
- };
12053
-
12054
- for ( var i = 0, il = url.length; i < il; ++ i ) {
12055
-
12056
- loadTexture( i );
12057
-
12058
- }
12059
-
12060
- } else {
12061
-
12062
- // compressed cubemap texture stored in a single DDS file
12063
-
12064
- loader.load( url, function ( buffer ) {
12065
-
12066
- var texDatas = scope._parser( buffer, true );
12067
-
12068
- if ( texDatas.isCubemap ) {
12069
-
12070
- var faces = texDatas.mipmaps.length / texDatas.mipmapCount;
12071
-
12072
- for ( var f = 0; f < faces; f ++ ) {
12073
-
12074
- images[ f ] = { mipmaps : [] };
12075
-
12076
- for ( var i = 0; i < texDatas.mipmapCount; i ++ ) {
12077
-
12078
- images[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );
12079
- images[ f ].format = texDatas.format;
12080
- images[ f ].width = texDatas.width;
12081
- images[ f ].height = texDatas.height;
12082
-
12083
- }
12084
-
12085
- }
12086
-
12087
- } else {
12088
-
12089
- texture.image.width = texDatas.width;
12090
- texture.image.height = texDatas.height;
12091
- texture.mipmaps = texDatas.mipmaps;
12092
-
12093
- }
12094
-
12095
- if ( texDatas.mipmapCount === 1 ) {
12096
-
12097
- texture.minFilter = THREE.LinearFilter;
12098
-
12099
- }
12100
-
12101
- texture.format = texDatas.format;
12102
- texture.needsUpdate = true;
12103
-
12104
- if ( onLoad ) onLoad( texture );
12105
-
12106
- } );
12107
-
12108
- }
12109
-
12110
- return texture;
12111
-
12112
- }
12113
-
12114
- };
12115
-
12116
  // File:src/materials/Material.js
12117
 
12118
  /**
7343
 
7344
  THREE.Object3DIdCount = 0;
7345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7346
  THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
7347
 
7348
  this.a = a;
7398
 
7399
  };
7400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7401
  // File:src/core/BufferAttribute.js
7402
 
7403
  /**
7512
 
7513
  };
7514
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7515
  // File:src/core/BufferGeometry.js
7516
 
7517
  /**
9687
 
9688
  };
9689
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9690
  // File:src/loaders/Cache.js
9691
 
9692
  /**
10382
 
10383
  }
10384
 
10385
+ // File:src/loaders/LoadingManager.js
10386
 
10387
  /**
10388
  * @author mrdoob / http://mrdoob.com/
 
10389
  */
 
 
10390
 
10391
+ THREE.LoadingManager = function ( onLoad, onProgress, onError ) {
10392
 
10393
+ var scope = this;
10394
 
10395
+ var loaded = 0, total = 0;
10396
 
10397
+ this.onLoad = onLoad;
10398
+ this.onProgress = onProgress;
10399
+ this.onError = onError;
10400
 
10401
+ this.itemStart = function ( url ) {
10402
 
10403
+ total ++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10404
 
10405
  };
10406
 
10407
+ this.itemEnd = function ( url ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10408
 
10409
+ loaded ++;
 
 
 
10410
 
10411
+ if ( scope.onProgress !== undefined ) {
10412
 
10413
+ scope.onProgress( url, loaded, total );
10414
 
10415
  }
10416
 
10417
+ if ( loaded === total && scope.onLoad !== undefined ) {
 
 
10418
 
10419
+ scope.onLoad();
 
10420
 
10421
  }
10422
 
 
 
 
 
 
 
10423
  };
10424
 
10425
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10426
 
10427
  THREE.DefaultLoadingManager = new THREE.LoadingManager();
10428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10429
  // File:src/materials/Material.js
10430
 
10431
  /**
js/wppa-panorama.min.js CHANGED
@@ -1 +1 @@
1
- var THREE={REVISION:"69"};"object"==typeof module&&(module.exports=THREE),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:0}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.NoShading=0,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=function(){},THREE.CubeReflectionMapping=function(){},THREE.CubeRefractionMapping=function(){},THREE.SphericalReflectionMapping=function(){},THREE.SphericalRefractionMapping=function(){},THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.Color=function(t){return 3===arguments.length?this.setRGB(t,arguments[1],arguments[2]):this.set(t)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(t){return t instanceof THREE.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},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(t,e,r){if(0===e)this.r=this.g=this.b=r;else{var i=function(t,e,r){return r<0&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t},n=r<=.5?r*(1+e):r+e-r*e,a=2*r-n;this.r=i(a,n,t+1/3),this.g=i(a,n,t),this.b=i(a,n,t-1/3)}return this},setStyle:function(t){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)){var e=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t);return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)){e=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t);return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(t)){e=/^\#([0-9a-f]{6})$/i.exec(t);return this.setHex(parseInt(e[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)){e=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return this.setHex(parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3],16)),this}if(/^(\w+)$/i.test(t))return this.setHex(THREE.ColorKeywords[t]),this},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t){return this.r=t.r*t.r,this.g=t.g*t.g,this.b=t.b*t.b,this},copyLinearToGamma:function(t){return this.r=Math.sqrt(t.r),this.g=Math.sqrt(t.g),this.b=Math.sqrt(t.b),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){var e,r,i=t||{h:0,s:0,l:0},n=this.r,a=this.g,o=this.b,s=Math.max(n,a,o),h=Math.min(n,a,o),l=(h+s)/2;if(h===s)r=e=0;else{var u=s-h;switch(r=l<=.5?u/(s+h):u/(2-s-h),s){case n:e=(a-o)/u+(a<o?6:0);break;case a:e=(o-n)/u+2;break;case o:e=(n-a)/u+4}e/=6}return i.h=e,i.s=r,i.l=l,i},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){return this.r=t[0],this.g=t[1],this.b=t[2],this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}},THREE.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},THREE.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},THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,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},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(t instanceof THREE.Euler==!1)throw new 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),a=Math.sin(t._x/2),o=Math.sin(t._y/2),s=Math.sin(t._z/2);return"XYZ"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n-a*o*s):"YXZ"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n+a*o*s):"ZXY"===t.order?(this._x=a*i*n-r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n-a*o*s):"ZYX"===t.order?(this._x=a*i*n-r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n+a*o*s):"YZX"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n-a*o*s):"XZY"===t.order&&(this._x=a*i*n-r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n+a*o*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,r=t.elements,i=r[0],n=r[4],a=r[8],o=r[1],s=r[5],h=r[9],l=r[2],u=r[6],c=r[10],f=i+s+c;return 0<f?(e=.5/Math.sqrt(f+1),this._w=.25/e,this._x=(u-h)*e,this._y=(a-l)*e,this._z=(o-n)*e):s<i&&c<i?(e=2*Math.sqrt(1+i-s-c),this._w=(u-h)/e,this._x=.25*e,this._y=(n+o)/e,this._z=(a+l)/e):c<s?(e=2*Math.sqrt(1+s-i-c),this._w=(a-l)/e,this._x=(n+o)/e,this._y=.25*e,this._z=(h+u)/e):(e=2*Math.sqrt(1+c-i-s),this._w=(o-n)/e,this._x=(a+l)/e,this._y=(h+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3),(i=t.dot(e)+1)<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?r.set(-t.y,t.x,0):r.set(0,-t.z,t.y)):r.crossVectors(t,e),this._x=r.x,this._y=r.y,this._z=r.z,this._w=i,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._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=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,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=r*l+a*o+i*h-n*s,this._y=i*l+a*s+n*o-r*h,this._z=n*l+a*h+r*s-i*o,this._w=a*l-r*o-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(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,a=this._w,o=a*t._w+r*t._x+i*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(o),h=Math.sqrt(1-o*o);if(Math.abs(h)<.001)return this._w=.5*(a+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var l=Math.sin((1-e)*s)/h,u=Math.sin(e*s)/h;return this._w=a*l+this._w*u,this._x=r*l+this._x*u,this._y=i*l+this._y*u,this._z=n*l+this._z*u,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(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}},THREE.Quaternion.slerp=function(t,e,r,i){return r.copy(t).slerp(e,i)},THREE.Vector2=function(t,e){this.x=t||0,this.y=e||0},THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(t,e){return this.x=t,this.y=e,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 new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},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)},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScalar:function(t){return this.x+=t,this.y+=t,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)},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 this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e}else this.x=0,this.y=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector2,i=new THREE.Vector2),r.set(t,t),i.set(e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?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)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,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},clone:function(){return new THREE.Vector2(this.x,this.y)}},THREE.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,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 new 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 new Error("index is out of range: "+t)}},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},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)},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 this.x*=t,this.y*=t,this.z*=t,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 e;return function(t){return t instanceof THREE.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var r;return function(t,e){return void 0===r&&(r=new THREE.Quaternion),this.applyQuaternion(r.setFromAxisAngle(t,e)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6]*i,this.y=n[1]*e+n[4]*r+n[7]*i,this.z=n[2]*e+n[5]*r+n[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i+n[12],this.y=n[1]*e+n[5]*r+n[9]*i+n[13],this.z=n[2]*e+n[6]*r+n[10]*i+n[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements,a=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*a,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,a=t.y,o=t.z,s=t.w,h=s*e+a*i-o*r,l=s*r+o*e-n*i,u=s*i+n*r-a*e,c=-n*e-a*r-o*i;return this.x=h*s+c*-n+l*-o-u*-a,this.y=l*s+c*-a+u*-n-h*-o,this.z=u*s+c*-o+h*-a-l*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[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){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3,i=new THREE.Vector3),r.set(t,t,t),i.set(e,e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},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,a=e.x,o=e.y,s=e.z;return this.x=i*s-n*o,this.y=n*a-r*s,this.z=r*o-i*a,this},projectOnVector:function(){var e,r;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(t).normalize(),r=this.dot(e),this.copy(e).multiplyScalar(r)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(t){var e=this.dot(t)/(this.length()*t.length());return Math.acos(THREE.Math.clamp(e,-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,i=this.z-t.z;return e*e+r*r+i*i},setEulerFromRotationMatrix:function(t,e){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},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(),i=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=r,this.z=i,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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}},THREE.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},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 new 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 new Error("index is out of range: "+t)}},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},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)},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 this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*e+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*e+a[7]*r+a[11]*i+a[15]*n,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e,this.w*=e}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=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,a=t.elements,o=a[0],s=a[4],h=a[8],l=a[1],u=a[5],c=a[9],f=a[2],d=a[6],p=a[10];if(Math.abs(s-l)<.01&&Math.abs(h-f)<.01&&Math.abs(c-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(h+f)<.1&&Math.abs(c+d)<.1&&Math.abs(o+u+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var E=(o+1)/2,m=(u+1)/2,g=(p+1)/2,v=(s+l)/4,T=(h+f)/4,x=(c+d)/4;return m<E&&g<E?E<.01?(r=0,n=i=.707106781):(i=v/(r=Math.sqrt(E)),n=T/r):g<m?m<.01?(i=0,n=r=.707106781):(r=v/(i=Math.sqrt(m)),n=x/i):g<.01?(i=r=.707106781,n=0):(r=T/(n=Math.sqrt(g)),i=x/n),this.set(r,i,n,e),this}var y=Math.sqrt((d-c)*(d-c)+(h-f)*(h-f)+(l-s)*(l-s));return Math.abs(y)<.001&&(y=1),this.x=(d-c)/y,this.y=(h-f)/y,this.z=(l-s)/y,this.w=Math.acos((o+u+p-1)/2),this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this.w>t.w&&(this.w=t.w),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this.w<t.w&&(this.w=t.w),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this.w<t.w?this.w=t.w:this.w>e.w&&(this.w=e.w),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector4,i=new THREE.Vector4),r.set(t,t,t,t),i.set(e,e,e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}},THREE.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,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},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){var r=THREE.Math.clamp,i=t.elements,n=i[0],a=i[4],o=i[8],s=i[1],h=i[5],l=i[9],u=i[2],c=i[6],f=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(c,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,h)):(this._y=Math.atan2(-u,n),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(s,n))):"ZYX"===e?(this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(c,f),this._z=Math.atan2(s,n)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===e?(this._z=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(o,f))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(c,h),this._y=Math.atan2(o,n)):(this._x=Math.atan2(-l,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,this.onChangeCallback(),this},setFromQuaternion:function(t,e,r){var i=THREE.Math.clamp,n=t.x*t.x,a=t.y*t.y,o=t.z*t.z,s=t.w*t.w;return"XYZ"===(e=e||this._order)?(this._x=Math.atan2(2*(t.x*t.w-t.y*t.z),s-n-a+o),this._y=Math.asin(i(2*(t.x*t.z+t.y*t.w),-1,1)),this._z=Math.atan2(2*(t.z*t.w-t.x*t.y),s+n-a-o)):"YXZ"===e?(this._x=Math.asin(i(2*(t.x*t.w-t.y*t.z),-1,1)),this._y=Math.atan2(2*(t.x*t.z+t.y*t.w),s-n-a+o),this._z=Math.atan2(2*(t.x*t.y+t.z*t.w),s-n+a-o)):"ZXY"===e?(this._x=Math.asin(i(2*(t.x*t.w+t.y*t.z),-1,1)),this._y=Math.atan2(2*(t.y*t.w-t.z*t.x),s-n-a+o),this._z=Math.atan2(2*(t.z*t.w-t.x*t.y),s-n+a-o)):"ZYX"===e?(this._x=Math.atan2(2*(t.x*t.w+t.z*t.y),s-n-a+o),this._y=Math.asin(i(2*(t.y*t.w-t.x*t.z),-1,1)),this._z=Math.atan2(2*(t.x*t.y+t.z*t.w),s+n-a-o)):"YZX"===e?(this._x=Math.atan2(2*(t.x*t.w-t.z*t.y),s-n+a-o),this._y=Math.atan2(2*(t.y*t.w-t.x*t.z),s+n-a-o),this._z=Math.asin(i(2*(t.x*t.y+t.z*t.w),-1,1))):"XZY"===e?(this._x=Math.atan2(2*(t.x*t.w+t.y*t.z),s-n+a-o),this._y=Math.atan2(2*(t.x*t.z+t.y*t.w),s+n-a-o),this._z=Math.asin(i(2*(t.z*t.w-t.x*t.y),-1,1))):console.warn("THREE.Euler: .setFromQuaternion() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},reorder:function(){var e=new THREE.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),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(){return[this._x,this._y,this._z,this._order]},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}},THREE.Box3=function(t,e){this.min=void 0!==t?t:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new THREE.Vector3(-1/0,-1/0,-1/0)},THREE.Box3.prototype={constructor:THREE.Box3,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 i=new THREE.Vector3;return function(t,e){var r=i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var s=new THREE.Vector3;return function(t){var o=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var e=t.geometry;if(void 0!==e)if(e instanceof THREE.Geometry)for(var r=e.vertices,i=0,n=r.length;i<n;i++)s.copy(r[i]),s.applyMatrix4(t.matrixWorld),o.expandByPoint(s);else if(e instanceof THREE.BufferGeometry&&void 0!==e.attributes.position){var a=e.attributes.position.array;for(i=0,n=a.length;i<n;i+=3)s.set(a[i],a[i+1],a[i+2]),s.applyMatrix4(t.matrixWorld),o.expandByPoint(s)}}),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},empty: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 THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new THREE.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 THREE.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))},isIntersectionBox: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)},clampPoint:function(t,e){return(e||new THREE.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var r=new THREE.Vector3;return function(t){var e=t||new THREE.Sphere;return e.center=this.center(),e.radius=.5*this.size(r).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 e=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),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)},clone:function(){return(new THREE.Box3).copy(this)}},THREE.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.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(t,e,r,i,n,a,o,s,h){var l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=a,l[2]=o,l[5]=s,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0,n=e;i<r;i+=3,n+=3)a.x=t[n],a.y=t[n+1],a.z=t[n+2],a.applyMatrix3(this),t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z;return t}}(),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],a=t[4],o=t[5],s=t[6],h=t[7],l=t[8];return e*a*l-e*o*h-r*n*l+r*o*s+i*n*h-i*a*s},getInverse:function(t,e){var r=t.elements,i=this.elements;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];var n=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===n){var a="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(a);return console.warn(a),this.identity(),this}return this.multiplyScalar(1/n),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]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}},THREE.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.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(t,e,r,i,n,a,o,s,h,l,u,c,f,d,p,E){var m=this.elements;return m[0]=t,m[4]=e,m[8]=r,m[12]=i,m[1]=n,m[5]=a,m[9]=o,m[13]=s,m[2]=h,m[6]=l,m[10]=u,m[14]=c,m[3]=f,m[7]=d,m[11]=p,m[15]=E,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(t){return this.elements.set(t.elements),this},extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},copyPosition:function(t){var e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this},extractRotation:function(){var o=new THREE.Vector3;return function(t){var e=this.elements,r=t.elements,i=1/o.set(r[0],r[1],r[2]).length(),n=1/o.set(r[4],r[5],r[6]).length(),a=1/o.set(r[8],r[9],r[10]).length();return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[4]=r[4]*n,e[5]=r[5]*n,e[6]=r[6]*n,e[8]=r[8]*a,e[9]=r[9]*a,e[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t instanceof THREE.Euler==!1&&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,a=Math.cos(r),o=Math.sin(r),s=Math.cos(i),h=Math.sin(i),l=Math.cos(n),u=Math.sin(n);if("XYZ"===t.order){var c=a*l,f=a*u,d=o*l,p=o*u;e[0]=s*l,e[4]=-s*u,e[8]=h,e[1]=f+d*h,e[5]=c-p*h,e[9]=-o*s,e[2]=p-c*h,e[6]=d+f*h,e[10]=a*s}else if("YXZ"===t.order){var E=s*l,m=s*u,g=h*l,v=h*u;e[0]=E+v*o,e[4]=g*o-m,e[8]=a*h,e[1]=a*u,e[5]=a*l,e[9]=-o,e[2]=m*o-g,e[6]=v+E*o,e[10]=a*s}else if("ZXY"===t.order){E=s*l,m=s*u,g=h*l,v=h*u;e[0]=E-v*o,e[4]=-a*u,e[8]=g+m*o,e[1]=m+g*o,e[5]=a*l,e[9]=v-E*o,e[2]=-a*h,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){c=a*l,f=a*u,d=o*l,p=o*u;e[0]=s*l,e[4]=d*h-f,e[8]=c*h+p,e[1]=s*u,e[5]=p*h+c,e[9]=f*h-d,e[2]=-h,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var T=a*s,x=a*h,y=o*s,R=o*h;e[0]=s*l,e[4]=R-T*u,e[8]=y*u+x,e[1]=u,e[5]=a*l,e[9]=-o*l,e[2]=-h*l,e[6]=x*u+y,e[10]=T-R*u}else if("XZY"===t.order){T=a*s,x=a*h,y=o*s,R=o*h;e[0]=s*l,e[4]=-u,e[8]=h*l,e[1]=T*u+R,e[5]=a*l,e[9]=x*u-y,e[2]=y*u-x,e[6]=o*l,e[10]=R*u+T}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,a=t.w,o=r+r,s=i+i,h=n+n,l=r*o,u=r*s,c=r*h,f=i*s,d=i*h,p=n*h,E=a*o,m=a*s,g=a*h;return e[0]=1-(f+p),e[4]=u-g,e[8]=c+m,e[1]=u+g,e[5]=1-(l+p),e[9]=d-E,e[2]=c-m,e[6]=d+E,e[10]=1-(l+f),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 n=new THREE.Vector3,a=new THREE.Vector3,o=new THREE.Vector3;return function(t,e,r){var i=this.elements;return o.subVectors(t,e).normalize(),0===o.length()&&(o.z=1),n.crossVectors(r,o).normalize(),0===n.length()&&(o.x+=1e-4,n.crossVectors(r,o).normalize()),a.crossVectors(o,n),i[0]=n.x,i[4]=a.x,i[8]=o.x,i[1]=n.y,i[5]=a.y,i[9]=o.y,i[2]=n.z,i[6]=a.z,i[10]=o.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,a=r[0],o=r[4],s=r[8],h=r[12],l=r[1],u=r[5],c=r[9],f=r[13],d=r[2],p=r[6],E=r[10],m=r[14],g=r[3],v=r[7],T=r[11],x=r[15],y=i[0],R=i[4],_=i[8],H=i[12],b=i[1],M=i[5],w=i[9],S=i[13],A=i[2],C=i[6],D=i[10],L=i[14],F=i[3],P=i[7],U=i[11],B=i[15];return n[0]=a*y+o*b+s*A+h*F,n[4]=a*R+o*M+s*C+h*P,n[8]=a*_+o*w+s*D+h*U,n[12]=a*H+o*S+s*L+h*B,n[1]=l*y+u*b+c*A+f*F,n[5]=l*R+u*M+c*C+f*P,n[9]=l*_+u*w+c*D+f*U,n[13]=l*H+u*S+c*L+f*B,n[2]=d*y+p*b+E*A+m*F,n[6]=d*R+p*M+E*C+m*P,n[10]=d*_+p*w+E*D+m*U,n[14]=d*H+p*S+E*L+m*B,n[3]=g*y+v*b+T*A+x*F,n[7]=g*R+v*M+T*C+x*P,n[11]=g*_+v*w+T*D+x*U,n[15]=g*H+v*S+T*L+x*B,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},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0,n=e;i<r;i+=3,n+=3)a.x=t[n],a.y=t[n+1],a.z=t[n+2],a.applyMatrix4(this),t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z;return t}}(),rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],a=t[1],o=t[5],s=t[9],h=t[13],l=t[2],u=t[6],c=t[10],f=t[14];return t[3]*(+n*s*u-i*h*u-n*o*c+r*h*c+i*o*f-r*s*f)+t[7]*(+e*s*f-e*h*c+n*a*c-i*a*f+i*h*l-n*s*l)+t[11]*(+e*h*u-e*o*f-n*a*u+r*a*f+n*o*l-r*h*l)+t[15]*(-i*o*l-e*s*u+e*o*c+i*a*u-r*a*c+r*s*l)},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 e=new THREE.Vector3;return function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[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=t.elements,n=i[0],a=i[4],o=i[8],s=i[12],h=i[1],l=i[5],u=i[9],c=i[13],f=i[2],d=i[6],p=i[10],E=i[14],m=i[3],g=i[7],v=i[11],T=i[15];r[0]=u*E*g-c*p*g+c*d*v-l*E*v-u*d*T+l*p*T,r[4]=s*p*g-o*E*g-s*d*v+a*E*v+o*d*T-a*p*T,r[8]=o*c*g-s*u*g+s*l*v-a*c*v-o*l*T+a*u*T,r[12]=s*u*d-o*c*d-s*l*p+a*c*p+o*l*E-a*u*E,r[1]=c*p*m-u*E*m-c*f*v+h*E*v+u*f*T-h*p*T,r[5]=o*E*m-s*p*m+s*f*v-n*E*v-o*f*T+n*p*T,r[9]=s*u*m-o*c*m-s*h*v+n*c*v+o*h*T-n*u*T,r[13]=o*c*f-s*u*f+s*h*p-n*c*p-o*h*E+n*u*E,r[2]=l*E*m-c*d*m+c*f*g-h*E*g-l*f*T+h*d*T,r[6]=s*d*m-a*E*m-s*f*g+n*E*g+a*f*T-n*d*T,r[10]=a*c*m-s*l*m+s*h*g-n*c*g-a*h*T+n*l*T,r[14]=s*l*f-a*c*f-s*h*d+n*c*d+a*h*E-n*l*E,r[3]=u*d*m-l*p*m-u*f*g+h*p*g+l*f*v-h*d*v,r[7]=a*p*m-o*d*m+o*f*g-n*p*g-a*f*v+n*d*v,r[11]=o*l*m-a*u*m-o*h*g+n*u*g+a*h*v-n*l*v,r[15]=a*u*f-o*l*f+o*h*d-n*u*d-a*h*p+n*l*p;var x=n*r[0]+h*r[4]+f*r[8]+m*r[12];if(0==x){var y="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(y);return console.warn(y),this.identity(),this}return this.multiplyScalar(1/x),this},translate:function(t){console.warn("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){console.warn("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){console.warn("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){console.warn("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){console.warn("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z;return e[0]*=r,e[4]*=i,e[8]*=n,e[1]*=r,e[5]*=i,e[9]*=n,e[2]*=r,e[6]*=i,e[10]*=n,e[3]*=r,e[7]*=i,e[11]*=n,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,Math.max(r,i)))},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),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,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,a=t.x,o=t.y,s=t.z,h=n*a,l=n*o;return this.set(h*a+r,h*o-i*s,h*s+i*o,0,h*o+i*s,l*o+r,l*s-i*a,0,h*s-i*o,l*s+i*a,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 u=new THREE.Vector3,c=new THREE.Matrix4;return function(t,e,r){var i=this.elements,n=u.set(i[0],i[1],i[2]).length(),a=u.set(i[4],i[5],i[6]).length(),o=u.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],c.elements.set(this.elements);var s=1/n,h=1/a,l=1/o;return c.elements[0]*=s,c.elements[1]*=s,c.elements[2]*=s,c.elements[4]*=h,c.elements[5]*=h,c.elements[6]*=h,c.elements[8]*=l,c.elements[9]*=l,c.elements[10]*=l,e.setFromRotationMatrix(c),r.x=n,r.y=a,r.z=o,this}}(),makeFrustum:function(t,e,r,i,n,a){var o=this.elements,s=2*n/(e-t),h=2*n/(i-r),l=(e+t)/(e-t),u=(i+r)/(i-r),c=-(a+n)/(a-n),f=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,r,i){var n=r*Math.tan(THREE.Math.degToRad(.5*t)),a=-n,o=a*e,s=n*e;return this.makeFrustum(o,s,a,n,r,i)},makeOrthographic:function(t,e,r,i,n,a){var o=this.elements,s=e-t,h=r-i,l=a-n,u=(e+t)/s,c=(r+i)/h,f=(a+n)/l;return o[0]=2/s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2/h,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2/l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,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],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}},THREE.Ray=function(t,e){this.origin=void 0!==t?t:new THREE.Vector3,this.direction=void 0!==e?e:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new THREE.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(t,e){var r=e||new THREE.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return i<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(){var r=new THREE.Vector3;return function(t){var e=r.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceTo(t):(r.copy(this.direction).multiplyScalar(e).add(this.origin),r.distanceTo(t))}}(),distanceSqToSegment:function(t,e,r,i){var n,a,o,s,h=t.clone().add(e).multiplyScalar(.5),l=e.clone().sub(t).normalize(),u=.5*t.distanceTo(e),c=this.origin.clone().sub(h),f=-this.direction.dot(l),d=c.dot(this.direction),p=-c.dot(l),E=c.lengthSq(),m=Math.abs(1-f*f);if(0<=m)if(a=f*d-p,s=u*m,0<=(n=f*p-d))if(-s<=a)if(a<=s){var g=1/m;o=(n*=g)*(n+f*(a*=g)+2*d)+a*(f*n+a+2*p)+E}else a=u,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;else a=-u,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;else a<=-s?o=-(n=Math.max(0,-(-f*u+d)))*n+(a=0<n?-u:Math.min(Math.max(-u,-p),u))*(a+2*p)+E:a<=s?(n=0,o=(a=Math.min(Math.max(-u,-p),u))*(a+2*p)+E):o=-(n=Math.max(0,-(f*u+d)))*n+(a=0<n?u:Math.min(Math.max(-u,-p),u))*(a+2*p)+E;else a=0<f?-u:u,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;return r&&r.copy(this.direction.clone().multiplyScalar(n).add(this.origin)),i&&i.copy(l.clone().multiplyScalar(a).add(h)),o},isIntersectionSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},intersectSphere:function(){var h=new THREE.Vector3;return function(t,e){h.subVectors(t.center,this.origin);var r=h.dot(this.direction),i=h.dot(h)-r*r,n=t.radius*t.radius;if(n<i)return null;var a=Math.sqrt(n-i),o=r-a,s=r+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}}(),isIntersectionPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0==e)return 0==t.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=r?r:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},isIntersectionBox:function(){var e=new THREE.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(t,e){var r,i,n,a,o,s,h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return 0<=h?(r=(t.min.x-c.x)*h,i=(t.max.x-c.x)*h):(r=(t.max.x-c.x)*h,i=(t.min.x-c.x)*h),0<=l?(n=(t.min.y-c.y)*l,a=(t.max.y-c.y)*l):(n=(t.max.y-c.y)*l,a=(t.min.y-c.y)*l),a<r||i<n?null:((r<n||r!=r)&&(r=n),(a<i||i!=i)&&(i=a),0<=u?(o=(t.min.z-c.z)*u,s=(t.max.z-c.z)*u):(o=(t.max.z-c.z)*u,s=(t.min.z-c.z)*u),s<r||i<o?null:((r<o||r!=r)&&(r=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(0<=r?r:i,e)))},intersectTriangle:function(){var u=new THREE.Vector3,c=new THREE.Vector3,f=new THREE.Vector3,d=new THREE.Vector3;return function(t,e,r,i,n){c.subVectors(e,t),f.subVectors(r,t),d.crossVectors(c,f);var a,o=this.direction.dot(d);if(0<o){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}u.subVectors(this.origin,t);var s=a*this.direction.dot(f.crossVectors(u,f));if(s<0)return null;var h=a*this.direction.dot(c.cross(u));if(h<0)return null;if(o<s+h)return null;var l=-a*u.dot(d);return l<0?null:this.at(l/o,n)}}(),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)},clone:function(){return(new THREE.Ray).copy(this)}},THREE.Sphere=function(t,e){this.center=void 0!==t?t:new THREE.Vector3,this.radius=void 0!==e?e:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var o=new THREE.Box3;return function(t,e){var r=this.center;void 0!==e?r.copy(e):o.setFromPoints(t).center(r);for(var i=0,n=0,a=t.length;n<a;n++)i=Math.max(i,r.distanceToSquared(t[n]));return this.radius=Math.sqrt(i),this}}(),copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},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},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new THREE.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){var e=t||new THREE.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=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},clone:function(){return(new THREE.Sphere).copy(this)}},THREE.Frustum=function(t,e,r,i,n,a){this.planes=[void 0!==t?t:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==n?n:new THREE.Plane,void 0!==a?a:new THREE.Plane]},THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(t,e,r,i,n,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(r),o[3].copy(i),o[4].copy(n),o[5].copy(a),this},copy:function(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes,r=t.elements,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],h=r[5],l=r[6],u=r[7],c=r[8],f=r[9],d=r[10],p=r[11],E=r[12],m=r[13],g=r[14],v=r[15];return e[0].setComponents(o-i,u-s,p-c,v-E).normalize(),e[1].setComponents(o+i,u+s,p+c,v+E).normalize(),e[2].setComponents(o+n,u+h,p+f,v+m).normalize(),e[3].setComponents(o-n,u-h,p-f,v-m).normalize(),e[4].setComponents(o-a,u-l,p-d,v-g).normalize(),e[5].setComponents(o+a,u+l,p+d,v+g).normalize(),this},intersectsObject:function(){var r=new THREE.Sphere;return function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),r.copy(e.boundingSphere),r.applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSphere:function(t){for(var e=this.planes,r=t.center,i=-t.radius,n=0;n<6;n++){if(e[n].distanceToPoint(r)<i)return!1}return!0},intersectsBox:function(){var o=new THREE.Vector3,s=new THREE.Vector3;return function(t){for(var e=this.planes,r=0;r<6;r++){var i=e[r];o.x=0<i.normal.x?t.min.x:t.max.x,s.x=0<i.normal.x?t.max.x:t.min.x,o.y=0<i.normal.y?t.min.y:t.max.y,s.y=0<i.normal.y?t.max.y:t.min.y,o.z=0<i.normal.z?t.min.z:t.max.z,s.z=0<i.normal.z?t.max.z:t.min.z;var n=i.distanceToPoint(o),a=i.distanceToPoint(s);if(n<0&&a<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}},THREE.Plane=function(t,e){this.normal=void 0!==t?t:new THREE.Vector3(1,0,0),this.constant=void 0!==e?e:0},THREE.Plane.prototype={constructor:THREE.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 n=new THREE.Vector3,a=new THREE.Vector3;return function(t,e,r){var i=n.subVectors(r,e).cross(a.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),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 THREE.Vector3).copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start),r=this.distanceToPoint(t.end);return e<0&&0<r||r<0&&0<e},intersectLine:function(){var o=new THREE.Vector3;return function(t,e){var r=e||new THREE.Vector3,i=t.delta(o),n=this.normal.dot(i);if(0==n)return 0==this.distanceToPoint(t.start)?r.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/n;return a<0||1<a?void 0:r.copy(i).multiplyScalar(a).add(t.start)}}(),coplanarPoint:function(t){return(t||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Matrix3;return function(t,e){var r=e||s.getNormalMatrix(t),i=a.copy(this.normal).applyMatrix3(r),n=this.coplanarPoint(o);return n.applyMatrix4(t),this.setFromNormalAndCoplanarPoint(i,n),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}},THREE.Math={generateUUID:function(){var e,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var t=0;t<36;t++)8==t||13==t||18==t||23==t?i[t]="-":14==t?i[t]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[t]=r[19==t?3&e|8:e]);return i.join("")}}(),clamp:function(t,e,r){return t<e?e:r<t?r:t},clampBottom:function(t,e){return t<e?e:t},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},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 e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t}},THREE.Spline=function(t){this.points=t;var e,r,i,n,a,o,s,h,l,u=[],c={x:0,y:0,z:0};function f(t,e,r,i,n,a,o){var s=.5*(r-t),h=.5*(i-e);return(2*(e-r)+s+h)*o+(-3*(e-r)-2*s-h)*a+s*n+e}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 e=(this.points.length-1)*t,r=Math.floor(e),i=e-r,u[0]=0===r?r:r-1,u[1]=r,u[2]=r>this.points.length-2?this.points.length-1:r+1,u[3]=r>this.points.length-3?this.points.length-1:r+2,o=this.points[u[0]],s=this.points[u[1]],h=this.points[u[2]],l=this.points[u[3]],a=i*(n=i*i),c.x=f(o.x,s.x,h.x,l.x,i,n,a),c.y=f(o.y,s.y,h.y,l.y,i,n,a),c.z=f(o.z,s.z,h.z,l.z,i,n,a),c},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,a=0,o=0,s=0,h=new THREE.Vector3,l=new THREE.Vector3,u=[],c=0;for(u[0]=0,t||(t=100),i=this.points.length*t,h.copy(this.points[0]),e=1;e<i;e++)r=e/i,n=this.getPoint(r),l.copy(n),c+=l.distanceTo(h),h.copy(n),a=(this.points.length-1)*r,(o=Math.floor(a))!=s&&(u[o]=c,s=o);return u[u.length]=c,{chunks:u,total:c}},this.reparametrizeByArcLength=function(t){var e,r,i,n,a,o,s,h,l=[],u=new THREE.Vector3,c=this.getLength();for(l.push(u.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(o=c.chunks[e]-c.chunks[e-1],s=Math.ceil(t*o/c.total),n=(e-1)/(this.points.length-1),a=e/(this.points.length-1),r=1;r<s-1;r++)i=n+r*(1/s)*(a-n),h=this.getPoint(i),l.push(u.copy(h).clone());l.push(u.copy(this.points[e]).clone())}this.points=l}},THREE.Clock=function(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();t=.001*(e-this.oldTime),this.oldTime=e,this.elapsedTime+=t}return t}},THREE.EventDispatcher=function(){},THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(t){t.addEventListener=THREE.EventDispatcher.prototype.addEventListener,t.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener,t.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=THREE.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)}}}},THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var t=new THREE.Vector3,e=new THREE.Euler,r=new THREE.Quaternion,i=new THREE.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}}),this.renderDepth=null,this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){return console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(t){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=t},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},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 r=new THREE.Quaternion;return function(t,e){return r.setFromAxisAngle(t,e),this.quaternion.multiply(r),this}}(),rotateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var r=new THREE.Vector3;return function(t,e){return r.copy(t).applyQuaternion(this.quaternion),this.position.add(r.multiplyScalar(e)),this}}(),translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},translateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new THREE.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new THREE.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),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:",t,"can't be added as a child of itself."):t instanceof THREE.Object3D?(void 0!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add:",t,"is not an instance of THREE.Object3D."),this},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var r=this.children.indexOf(t);-1!==r&&(t.parent=void 0,t.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getChildByName:function(t,e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t,e)},getObjectById:function(t,e){if(this.id===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectById(t,e);if(void 0!==n)return n}},getObjectByName:function(t,e){if(this.name===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByName(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){var e=t||new THREE.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var r=new THREE.Vector3,i=new THREE.Vector3;return function(t){var e=t||new THREE.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,e,i),e}}(),getWorldRotation:function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Euler;return this.getWorldQuaternion(r),e.setFromQuaternion(r,this.rotation.order,!1)}}(),getWorldScale:function(){var r=new THREE.Vector3,i=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,i,e),e}}(),getWorldDirection:function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.getWorldQuaternion(r),e.set(0,0,1).applyQuaternion(r)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=0,r=this.children.length;e<r;e++)this.children[e].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=0,r=this.children.length;e<r;e++)this.children[e].traverseVisible(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||(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(){var r={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},i={},n=function(t){if(void 0===r.geometries&&(r.geometries=[]),void 0===i[t.uuid]){var e=t.toJSON();delete e.metadata,i[t.uuid]=e,r.geometries.push(e)}return t.uuid},a={},o=function(t){if(void 0===r.materials&&(r.materials=[]),void 0===a[t.uuid]){var e=t.toJSON();delete e.metadata,a[t.uuid]=e,r.materials.push(e)}return t.uuid},s=function(t){var e={};if(e.uuid=t.uuid,e.type=t.type,""!==t.name&&(e.name=t.name),"{}"!==JSON.stringify(t.userData)&&(e.userData=t.userData),!0!==t.visible&&(e.visible=t.visible),t instanceof THREE.PerspectiveCamera?(e.fov=t.fov,e.aspect=t.aspect,e.near=t.near,e.far=t.far):t instanceof THREE.OrthographicCamera?(e.left=t.left,e.right=t.right,e.top=t.top,e.bottom=t.bottom,e.near=t.near,e.far=t.far):t instanceof THREE.AmbientLight?e.color=t.color.getHex():t instanceof THREE.DirectionalLight?(e.color=t.color.getHex(),e.intensity=t.intensity):t instanceof THREE.PointLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance):t instanceof THREE.SpotLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.angle=t.angle,e.exponent=t.exponent):t instanceof THREE.HemisphereLight?(e.color=t.color.getHex(),e.groundColor=t.groundColor.getHex()):t instanceof THREE.Mesh?(e.geometry=n(t.geometry),e.material=o(t.material)):t instanceof THREE.Line?(e.geometry=n(t.geometry),e.material=o(t.material)):t instanceof THREE.Sprite&&(e.material=o(t.material)),e.matrix=t.matrix.toArray(),0<t.children.length){e.children=[];for(var r=0;r<t.children.length;r++)e.children.push(s(t.children[r]))}return e};return r.object=s(this),r},clone:function(t,e){if(void 0===t&&(t=new THREE.Object3D),void 0===e&&(e=!0),t.name=this.name,t.up.copy(this.up),t.position.copy(this.position),t.quaternion.copy(this.quaternion),t.scale.copy(this.scale),t.renderDepth=this.renderDepth,t.rotationAutoUpdate=this.rotationAutoUpdate,t.matrix.copy(this.matrix),t.matrixWorld.copy(this.matrixWorld),t.matrixAutoUpdate=this.matrixAutoUpdate,t.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,t.visible=this.visible,t.castShadow=this.castShadow,t.receiveShadow=this.receiveShadow,t.frustumCulled=this.frustumCulled,t.userData=JSON.parse(JSON.stringify(this.userData)),!0===e)for(var r=0;r<this.children.length;r++){var i=this.children[r];t.add(i.clone())}return t}},THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype),THREE.Object3DIdCount=0,THREE.Face3=function(t,e,r,i,n,a){this.a=t,this.b=e,this.c=r,this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3,this.vertexNormals=i instanceof Array?i:[],this.color=n instanceof THREE.Color?n:new THREE.Color,this.vertexColors=n instanceof Array?n:[],this.vertexTangents=[],this.materialIndex=void 0!==a?a:0},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var t=new THREE.Face3(this.a,this.b,this.c);t.normal.copy(this.normal),t.color.copy(this.color),t.materialIndex=this.materialIndex;for(var e=0,r=this.vertexNormals.length;e<r;e++)t.vertexNormals[e]=this.vertexNormals[e].clone();for(e=0,r=this.vertexColors.length;e<r;e++)t.vertexColors[e]=this.vertexColors[e].clone();for(e=0,r=this.vertexTangents.length;e<r;e++)t.vertexTangents[e]=this.vertexTangents[e].clone();return t}},THREE.BufferAttribute=function(t,e){this.array=t,this.itemSize=e,this.needsUpdate=!1},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},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]},set:function(t){return this.array.set(t),this},setX:function(t,e){return this.array[t*this.itemSize]=e,this},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t]=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]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(t,e){if(e instanceof THREE.BufferAttribute==!1)return console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void(this.attributes[t]={array:e,itemSize:arguments[2]});this.attributes[t]=e,this.attributesKeys=Object.keys(this.attributes)},getAttribute:function(t){return this.attributes[t]},addDrawCall:function(t,e,r){this.drawcalls.push({start:t,count:e,index:void 0!==r?r:0})},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var r=this.attributes.normal;void 0!==r&&((new THREE.Matrix3).getNormalMatrix(t).applyToVector3Array(r.array),r.needsUpdate=!0)},center:function(){},fromGeometry:function(t,e){e=e||{vertexColors:THREE.NoColors};var r=t.vertices,i=t.faces,n=t.faceVertexUvs,a=e.vertexColors,o=0<n[0].length,s=3==i[0].vertexNormals.length,h=new Float32Array(3*i.length*3);this.addAttribute("position",new THREE.BufferAttribute(h,3));var l=new Float32Array(3*i.length*3);if(this.addAttribute("normal",new THREE.BufferAttribute(l,3)),a!==THREE.NoColors){var u=new Float32Array(3*i.length*3);this.addAttribute("color",new THREE.BufferAttribute(u,3))}if(!0===o){var c=new Float32Array(3*i.length*2);this.addAttribute("uv",new THREE.BufferAttribute(c,2))}for(var f=0,d=0,p=0;f<i.length;f++,d+=6,p+=9){var E=i[f],m=r[E.a],g=r[E.b],v=r[E.c];if(h[p]=m.x,h[p+1]=m.y,h[p+2]=m.z,h[p+3]=g.x,h[p+4]=g.y,h[p+5]=g.z,h[p+6]=v.x,h[p+7]=v.y,h[p+8]=v.z,!0===s){var T=E.vertexNormals[0],x=E.vertexNormals[1],y=E.vertexNormals[2];l[p]=T.x,l[p+1]=T.y,l[p+2]=T.z,l[p+3]=x.x,l[p+4]=x.y,l[p+5]=x.z,l[p+6]=y.x,l[p+7]=y.y,l[p+8]=y.z}else{var R=E.normal;l[p]=R.x,l[p+1]=R.y,l[p+2]=R.z,l[p+3]=R.x,l[p+4]=R.y,l[p+5]=R.z,l[p+6]=R.x,l[p+7]=R.y,l[p+8]=R.z}if(a===THREE.FaceColors){var _=E.color;u[p]=_.r,u[p+1]=_.g,u[p+2]=_.b,u[p+3]=_.r,u[p+4]=_.g,u[p+5]=_.b,u[p+6]=_.r,u[p+7]=_.g,u[p+8]=_.b}else if(a===THREE.VertexColors){var H=E.vertexColors[0],b=E.vertexColors[1],M=E.vertexColors[2];u[p]=H.r,u[p+1]=H.g,u[p+2]=H.b,u[p+3]=b.r,u[p+4]=b.g,u[p+5]=b.b,u[p+6]=M.r,u[p+7]=M.g,u[p+8]=M.b}if(!0===o){var w=n[0][f][0],S=n[0][f][1],A=n[0][f][2];c[d]=w.x,c[d+1]=w.y,c[d+2]=S.x,c[d+3]=S.y,c[d+4]=A.x,c[d+5]=A.y}}return this.computeBoundingSphere(),this},computeBoundingBox:function(){var n=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.position.array;if(t){var e=this.boundingBox;e.makeEmpty();for(var r=0,i=t.length;r<i;r+=3)n.set(t[r],t[r+1],t[r+2]),e.expandByPoint(n)}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.')}}(),computeBoundingSphere:function(){var a=new THREE.Box3,o=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array;if(t){a.makeEmpty();for(var e=this.boundingSphere.center,r=0,i=t.length;r<i;r+=3)o.set(t[r],t[r+1],t[r+2]),a.expandByPoint(o);a.center(e);var n=0;for(r=0,i=t.length;r<i;r+=3)o.set(t[r],t[r+1],t[r+2]),n=Math.max(n,e.distanceToSquared(o));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.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.attributes;if(t.position){var e=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(e.length),3));else for(var r=0,i=(s=t.normal.array).length;r<i;r++)s[r]=0;var n,a,o,s=t.normal.array,h=new THREE.Vector3,l=new THREE.Vector3,u=new THREE.Vector3,c=new THREE.Vector3,f=new THREE.Vector3;if(t.index)for(var d=t.index.array,p=0<this.offsets.length?this.offsets:[{start:0,count:d.length,index:0}],E=0,m=p.length;E<m;++E){var g=p[E].start,v=p[E].count,T=p[E].index;for(r=g,i=g+v;r<i;r+=3)n=3*(T+d[r]),a=3*(T+d[r+1]),o=3*(T+d[r+2]),h.fromArray(e,n),l.fromArray(e,a),u.fromArray(e,o),c.subVectors(u,l),f.subVectors(h,l),c.cross(f),s[n]+=c.x,s[n+1]+=c.y,s[n+2]+=c.z,s[a]+=c.x,s[a+1]+=c.y,s[a+2]+=c.z,s[o]+=c.x,s[o+1]+=c.y,s[o+2]+=c.z}else for(r=0,i=e.length;r<i;r+=9)h.fromArray(e,r),l.fromArray(e,r+3),u.fromArray(e,r+6),c.subVectors(u,l),f.subVectors(h,l),c.cross(f),s[r]=c.x,s[r+1]=c.y,s[r+2]=c.z,s[r+3]=c.x,s[r+4]=c.y,s[r+5]=c.z,s[r+6]=c.x,s[r+7]=c.y,s[r+8]=c.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){if(void 0!==this.attributes.index&&void 0!==this.attributes.position&&void 0!==this.attributes.normal&&void 0!==this.attributes.uv){var t=this.attributes.index.array,e=this.attributes.position.array,r=this.attributes.normal.array,i=this.attributes.uv.array,n=e.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*n),4));for(var a=this.attributes.tangent.array,o=[],s=[],h=0;h<n;h++)o[h]=new THREE.Vector3,s[h]=new THREE.Vector3;var l,u,c,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w=new THREE.Vector3,S=new THREE.Vector3,A=new THREE.Vector3,C=new THREE.Vector2,D=new THREE.Vector2,L=new THREE.Vector2,F=new THREE.Vector3,P=new THREE.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,t.length,0);var U,B,z,N=this.drawcalls;for(R=0,_=N.length;R<_;++R){var k=N[R].start,V=N[R].count,O=N[R].index;for(y=(x=k)+V;x<y;x+=3)H=O+t[x],b=O+t[x+1],M=O+t[x+2],U=H,B=b,z=M,w.fromArray(e,3*U),S.fromArray(e,3*B),A.fromArray(e,3*z),C.fromArray(i,2*U),D.fromArray(i,2*B),L.fromArray(i,2*z),l=S.x-w.x,u=A.x-w.x,c=S.y-w.y,f=A.y-w.y,d=S.z-w.z,p=A.z-w.z,E=D.x-C.x,m=L.x-C.x,g=D.y-C.y,v=L.y-C.y,T=1/(E*v-m*g),F.set((v*l-g*u)*T,(v*c-g*f)*T,(v*d-g*p)*T),P.set((E*u-m*l)*T,(E*f-m*c)*T,(E*p-m*d)*T),o[U].add(F),o[B].add(F),o[z].add(F),s[U].add(P),s[B].add(P),s[z].add(P)}var I,G,W,X=new THREE.Vector3,j=new THREE.Vector3,Y=new THREE.Vector3,q=new THREE.Vector3;for(R=0,_=N.length;R<_;++R){k=N[R].start,V=N[R].count,O=N[R].index;for(y=(x=k)+V;x<y;x+=3)H=O+t[x],b=O+t[x+1],M=O+t[x+2],K(H),K(b),K(M)}}else console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");function K(t){Y.fromArray(r,3*t),q.copy(Y),G=o[t],X.copy(G),X.sub(Y.multiplyScalar(Y.dot(G))).normalize(),j.crossVectors(q,G),W=j.dot(s[t]),I=W<0?-1:1,a[4*t]=X.x,a[4*t+1]=X.y,a[4*t+2]=X.z,a[4*t+3]=I}},computeOffsets:function(t){var e=t;void 0===t&&(e=65535);Date.now();for(var r=this.attributes.index.array,i=this.attributes.position.array,n=(i.length,r.length/3),a=new Uint16Array(r.length),o=0,s=0,h=[{start:0,count:0,index:0}],l=h[0],u=0,c=new Int32Array(6),f=new Int32Array(i.length),d=new Int32Array(i.length),p=0;p<i.length;p++)f[p]=-1,d[p]=-1;for(var E=0;E<n;E++){for(var m=u=0;m<3;m++){-1==f[x=r[3*E+m]]?(c[2*m]=x,c[2*m+1]=-1,u++):f[x]<l.index?(c[2*m]=x,c[2*m+1]=-1,0):(c[2*m]=x,c[2*m+1]=f[x])}if(s+u>l.index+e){var g={start:o,count:0,index:s};h.push(g),l=g;for(var v=0;v<6;v+=2){-1<(T=c[v+1])&&T<l.index&&(c[v+1]=-1)}}for(v=0;v<6;v+=2){var T,x=c[v];-1===(T=c[v+1])&&(T=s++),d[f[x]=T]=x,a[o++]=T-l.index,l.count++}}return this.reorderBuffers(a,d,s),this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var t,e,r,i,n=this.attributes.normal.array,a=0,o=n.length;a<o;a+=3)t=n[a],e=n[a+1],r=n[a+2],i=1/Math.sqrt(t*t+e*e+r*r),n[a]*=i,n[a+1]*=i,n[a+2]*=i},reorderBuffers:function(t,e,r){var i={};for(var n in this.attributes)if("index"!=n){var a=this.attributes[n].array;i[n]=new a.constructor(this.attributes[n].itemSize*r)}for(var o=0;o<r;o++){var s=e[o];for(var n in this.attributes)if("index"!=n)for(var h=this.attributes[n].array,l=this.attributes[n].itemSize,u=i[n],c=0;c<l;c++)u[o*l+c]=h[s*l+c]}for(var n in this.attributes.index.array=t,this.attributes)"index"!=n&&(this.attributes[n].array=i[n],this.attributes[n].numItems=this.attributes[n].itemSize*r)},toJSON:function(){var t={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},e=this.attributes,r=this.offsets,i=this.boundingSphere;for(var n in e){for(var a=e[n],o=[],s=a.array,h=0,l=s.length;h<l;h++)o[h]=s[h];t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:o}}return 0<r.length&&(t.data.offsets=JSON.parse(JSON.stringify(r))),null!==i&&(t.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),t},clone:function(){var t=new THREE.BufferGeometry;for(var e in this.attributes){var r=this.attributes[e];t.addAttribute(e,r.clone())}for(var i=0,n=this.offsets.length;i<n;i++){var a=this.offsets[i];t.offsets.push({start:a.start,index:a.index,count:a.count})}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(t){for(var e=(new THREE.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++){var n=this.faces[r];n.normal.applyMatrix3(e).normalize();for(var a=0,o=n.vertexNormals.length;a<o;a++)n.vertexNormals[a].applyMatrix3(e).normalize()}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox(),this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},fromBufferGeometry:function(t){for(var a=this,e=t.attributes,r=e.position.array,i=void 0!==e.index?e.index.array:void 0,o=void 0!==e.normal?e.normal.array:void 0,s=void 0!==e.color?e.color.array:void 0,n=void 0!==e.uv?e.uv.array:void 0,h=[],l=[],u=0,c=0;u<r.length;u+=3,c+=2)a.vertices.push(new THREE.Vector3(r[u],r[u+1],r[u+2])),void 0!==o&&h.push(new THREE.Vector3(o[u],o[u+1],o[u+2])),void 0!==s&&a.colors.push(new THREE.Color(s[u],s[u+1],s[u+2])),void 0!==n&&l.push(new THREE.Vector2(n[c],n[c+1]));var f=function(t,e,r){var i=void 0!==o?[h[t].clone(),h[e].clone(),h[r].clone()]:[],n=void 0!==s?[a.colors[t].clone(),a.colors[e].clone(),a.colors[r].clone()]:[];a.faces.push(new THREE.Face3(t,e,r,i,n)),a.faceVertexUvs[0].push([l[t],l[e],l[r]])};if(void 0!==i)for(u=0;u<i.length;u+=3)f(i[u],i[u+1],i[u+2]);else for(u=0;u<r.length/3;u+=3)f(u,u+1,u+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=new THREE.Vector3;return t.addVectors(this.boundingBox.min,this.boundingBox.max),t.multiplyScalar(-.5),this.applyMatrix((new THREE.Matrix4).makeTranslation(t.x,t.y,t.z)),this.computeBoundingBox(),t},computeFaceNormals:function(){for(var t=new THREE.Vector3,e=new THREE.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){var e,r,i,n,a,o;for(o=new Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)o[e]=new THREE.Vector3;if(t){var s,h,l,u=new THREE.Vector3,c=new THREE.Vector3;new THREE.Vector3,new THREE.Vector3,new THREE.Vector3;for(i=0,n=this.faces.length;i<n;i++)a=this.faces[i],s=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,h),c.subVectors(s,h),u.cross(c),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(i=0,n=this.faces.length;i<n;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,r=this.vertices.length;e<r;e++)o[e].normalize();for(i=0,n=this.faces.length;i<n;i++)(a=this.faces[i]).vertexNormals[0]=o[a.a].clone(),a.vertexNormals[1]=o[a.b].clone(),a.vertexNormals[2]=o[a.c].clone()},computeMorphNormals:function(){var t,e,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=[]),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 a=new THREE.Geometry;for(a.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=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)h=new THREE.Vector3,l={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},o.push(h),s.push(l)}var h,l,u=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],h=u.faceNormals[r],l=u.vertexNormals[r],h.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.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(){var t,e,r,i,n,a,o,s,h,l,u,c,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w,S,A,C,D,L,F,P=[],U=[],B=new THREE.Vector3,z=new THREE.Vector3,N=new THREE.Vector3,k=new THREE.Vector3,V=new THREE.Vector3;for(r=0,i=this.vertices.length;r<i;r++)P[r]=new THREE.Vector3,U[r]=new THREE.Vector3;for(t=0,e=this.faces.length;t<e;t++)o=this.faces[t],s=this.faceVertexUvs[0][t],w=this,S=o.a,A=o.b,C=o.c,D=0,L=1,F=2,h=w.vertices[S],l=w.vertices[A],u=w.vertices[C],c=s[D],f=s[L],d=s[F],p=l.x-h.x,E=u.x-h.x,m=l.y-h.y,g=u.y-h.y,v=l.z-h.z,T=u.z-h.z,x=f.x-c.x,y=d.x-c.x,R=f.y-c.y,_=d.y-c.y,H=1/(x*_-y*R),B.set((_*p-R*E)*H,(_*m-R*g)*H,(_*v-R*T)*H),z.set((x*E-y*p)*H,(x*g-y*m)*H,(x*T-y*v)*H),P[S].add(B),P[A].add(B),P[C].add(B),U[S].add(z),U[A].add(z),U[C].add(z);var O=["a","b","c","d"];for(t=0,e=this.faces.length;t<e;t++)for(o=this.faces[t],n=0;n<Math.min(o.vertexNormals.length,3);n++)V.copy(o.vertexNormals[n]),a=o[O[n]],b=P[a],N.copy(b),N.sub(V.multiplyScalar(V.dot(b))).normalize(),k.crossVectors(o.vertexNormals[n],b),M=k.dot(U[a])<0?-1:1,o.vertexTangents[n]=new THREE.Vector4(N.x,N.y,N.z,M);this.hasTangents=!0},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 THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(t instanceof THREE.Geometry!=!1){var i,n=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,h=t.faces,l=this.faceVertexUvs[0],u=t.faceVertexUvs[0];void 0===r&&(r=0),void 0!==e&&(i=(new THREE.Matrix3).getNormalMatrix(e));for(var c=0,f=o.length;c<f;c++){var d=o[c].clone();void 0!==e&&d.applyMatrix4(e),a.push(d)}for(c=0,f=h.length;c<f;c++){var p,E,m,g=h[c],v=g.vertexNormals,T=g.vertexColors;(p=new THREE.Face3(g.a+n,g.b+n,g.c+n)).normal.copy(g.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize();for(var x=0,y=v.length;x<y;x++)E=v[x].clone(),void 0!==i&&E.applyMatrix3(i).normalize(),p.vertexNormals.push(E);p.color.copy(g.color);for(x=0,y=T.length;x<y;x++)m=T[x],p.vertexColors.push(m.clone());p.materialIndex=g.materialIndex+r,s.push(p)}for(c=0,f=u.length;c<f;c++){var R=u[c],_=[];if(void 0!==R){for(x=0,y=R.length;x<y;x++)_.push(new THREE.Vector2(R[x].x,R[x].y));l.push(_)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeVertices:function(){var t,e,r,i,n,a,o,s,h={},l=[],u=[],c=Math.pow(10,4);for(r=0,i=this.vertices.length;r<i;r++)t=this.vertices[r],void 0===h[e=Math.round(t.x*c)+"_"+Math.round(t.y*c)+"_"+Math.round(t.z*c)]?(h[e]=r,l.push(this.vertices[r]),u[r]=l.length-1):u[r]=u[h[e]];var f=[];for(r=0,i=this.faces.length;r<i;r++){(n=this.faces[r]).a=u[n.a],n.b=u[n.b],n.c=u[n.c],a=[n.a,n.b,n.c];for(var d=0;d<3;d++)if(a[d]==a[(d+1)%3]){d,f.push(r);break}}for(r=f.length-1;0<=r;r--){var p=f[r];for(this.faces.splice(p,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(p,1)}var E=this.vertices.length-l.length;return this.vertices=l,E},toJSON:function(){var t={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}for(var i=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];i.push(a.x,a.y,a.z)}var o=[],s=[],h={},l=[],u={},c=[],f={};for(n=0;n<this.faces.length;n++){var d=this.faces[n],p=void 0!==this.faceVertexUvs[0][n],E=0<d.normal.length(),m=0<d.vertexNormals.length,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,v=0<d.vertexColors.length,T=0;if(T=_(T=_(T=_(T=_(T=_(T=_(T=_(T=_(T,0,0),1,!1),2,!1),3,p),4,E),5,m),6,g),7,v),o.push(T),o.push(d.a,d.b,d.c),p){var x=this.faceVertexUvs[0][n];o.push(M(x[0]),M(x[1]),M(x[2]))}if(E&&o.push(H(d.normal)),m){var y=d.vertexNormals;o.push(H(y[0]),H(y[1]),H(y[2]))}if(g&&o.push(b(d.color)),v){var R=d.vertexColors;o.push(b(R[0]),b(R[1]),b(R[2]))}}function _(t,e,r){return r?t|1<<e:t&~(1<<e)}function H(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]||(h[e]=s.length/3,s.push(t.x,t.y,t.z)),h[e]}function b(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]||(u[e]=l.length,l.push(t.getHex())),u[e]}function M(t){var e=t.x.toString()+t.y.toString();return void 0!==f[e]||(f[e]=c.length/2,c.push(t.x,t.y)),f[e]}return t.data={},t.data.vertices=i,t.data.normals=s,0<l.length&&(t.data.colors=l),0<c.length&&(t.data.uvs=[c]),t.data.faces=o,t},clone:function(){for(var t=new THREE.Geometry,e=this.vertices,r=0,i=e.length;r<i;r++)t.vertices.push(e[r].clone());var n=this.faces;for(r=0,i=n.length;r<i;r++)t.faces.push(n[r].clone());var a=this.faceVertexUvs[0];for(r=0,i=a.length;r<i;r++){for(var o=a[r],s=[],h=0,l=o.length;h<l;h++)s.push(new THREE.Vector2(o[h].x,o[h].y));t.faceVertexUvs[0].push(s)}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.Camera=function(){THREE.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.getWorldDirection=function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.getWorldQuaternion(r),e.set(0,0,-1).applyQuaternion(r)}}(),THREE.Camera.prototype.lookAt=function(){var e=new THREE.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),THREE.Camera.prototype.clone=function(t){return void 0===t&&(t=new THREE.Camera),THREE.Object3D.prototype.clone.call(this,t),t.matrixWorldInverse.copy(this.matrixWorldInverse),t.projectionMatrix.copy(this.projectionMatrix),t},THREE.PerspectiveCamera=function(t,e,r,i){THREE.Camera.call(this),this.type="PerspectiveCamera",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()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*THREE.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,a){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=a,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=this.fullWidth/this.fullHeight,r=Math.tan(THREE.Math.degToRad(.5*t))*this.near,i=-r,n=e*i,a=e*r,o=Math.abs(a-n),s=Math.abs(r-i);this.projectionMatrix.makeFrustum(n+this.x*o/this.fullWidth,n+(this.x+this.width)*o/this.fullWidth,r-(this.y+this.height)*s/this.fullHeight,r-this.y*s/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},THREE.PerspectiveCamera.prototype.clone=function(){var t=new THREE.PerspectiveCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),t},THREE.Light=function(t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(t)},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.clone=function(t){return void 0===t&&(t=new THREE.Light),THREE.Object3D.prototype.clone.call(this,t),t.color.copy(this.color),t},THREE.Cache=function(){this.files={}},THREE.Cache.prototype={constructor:THREE.Cache,add:function(t,e){this.files[t]=e},get:function(t){return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},THREE.Loader=function(t){this.showStatus=t,this.statusDomElement=t?THREE.Loader.prototype.addStatusElement():null,this.imageLoader=new THREE.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var t=document.createElement("div");return t.style.position="absolute",t.style.right="0px",t.style.top="0px",t.style.fontSize="0.8em",t.style.textAlign="left",t.style.background="rgba(0,0,0,0.25)",t.style.color="#fff",t.style.width="120px",t.style.padding="0.5em 0.5em 0.5em 0.5em",t.style.zIndex=1e3,t.innerHTML="Loading ...",t},updateProgress:function(t){var e="Loaded ";t.total?e+=(100*t.loaded/t.total).toFixed(0)+"%":e+=(t.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=e},extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e){for(var r=[],i=0;i<t.length;++i)r[i]=this.createMaterial(t[i],e);return r},needsTangents:function(t){for(var e=0,r=t.length;e<r;e++){if(t[e]instanceof THREE.ShaderMaterial)return!0}return!1},createMaterial:function(t,c){var f=this;function d(t){var e=Math.log(t)/Math.LN2;return Math.pow(2,Math.round(e))}function e(t,e,r,i,n,a,o){var s,h=c+r,l=THREE.Loader.Handlers.get(h);if(null!==l?s=l.load(h):(s=new THREE.Texture,(l=f.imageLoader).crossOrigin=f.crossOrigin,l.load(h,function(t){if(!1===THREE.Math.isPowerOfTwo(t.width)||!1===THREE.Math.isPowerOfTwo(t.height)){var e=d(t.width),r=d(t.height),i=document.createElement("canvas");i.width=e,i.height=r,i.getContext("2d").drawImage(t,0,0,e,r),s.image=i}else s.image=t;s.needsUpdate=!0})),s.sourceFile=r,i&&(s.repeat.set(i[0],i[1]),1!==i[0]&&(s.wrapS=THREE.RepeatWrapping),1!==i[1]&&(s.wrapT=THREE.RepeatWrapping)),n&&s.offset.set(n[0],n[1]),a){var u={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};void 0!==u[a[0]]&&(s.wrapS=u[a[0]]),void 0!==u[a[1]]&&(s.wrapT=u[a[1]])}o&&(s.anisotropy=o),t[e]=s}function r(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]}var i="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(t.shading){var a=t.shading.toLowerCase();"phong"===a?i="MeshPhongMaterial":"basic"===a&&(i="MeshBasicMaterial")}if(void 0!==t.blending&&void 0!==THREE[t.blending]&&(n.blending=THREE[t.blending]),(void 0!==t.transparent||t.opacity<1)&&(n.transparent=t.transparent),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.flipSided&&(n.side=THREE.BackSide),void 0!==t.doubleSided&&(n.side=THREE.DoubleSide),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.vertexColors&&("face"===t.vertexColors?n.vertexColors=THREE.FaceColors:t.vertexColors&&(n.vertexColors=THREE.VertexColors)),t.colorDiffuse?n.color=r(t.colorDiffuse):t.DbgColor&&(n.color=t.DbgColor),t.colorSpecular&&(n.specular=r(t.colorSpecular)),t.colorAmbient&&(n.ambient=r(t.colorAmbient)),t.colorEmissive&&(n.emissive=r(t.colorEmissive)),t.transparency&&(n.opacity=t.transparency),t.specularCoef&&(n.shininess=t.specularCoef),t.mapDiffuse&&c&&e(n,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy),t.mapLight&&c&&e(n,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy),t.mapBump&&c&&e(n,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy),t.mapNormal&&c&&e(n,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy),t.mapSpecular&&c&&e(n,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy),t.mapAlpha&&c&&e(n,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy),t.mapBumpScale&&(n.bumpScale=t.mapBumpScale),t.mapNormal){var o=THREE.ShaderLib.normalmap,s=THREE.UniformsUtils.clone(o.uniforms);s.tNormal.value=n.normalMap,t.mapNormalFactor&&s.uNormalScale.value.set(t.mapNormalFactor,t.mapNormalFactor),n.map&&(s.tDiffuse.value=n.map,s.enableDiffuse.value=!0),n.specularMap&&(s.tSpecular.value=n.specularMap,s.enableSpecular.value=!0),n.lightMap&&(s.tAO.value=n.lightMap,s.enableAO.value=!0),s.diffuse.value.setHex(n.color),s.specular.value.setHex(n.specular),s.ambient.value.setHex(n.ambient),s.shininess.value=n.shininess,void 0!==n.opacity&&(s.opacity.value=n.opacity);var h={fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:s,lights:!0,fog:!0},l=new THREE.ShaderMaterial(h);n.transparent&&(l.transparent=!0)}else l=new THREE[i](n);return void 0!==t.DbgName&&(l.name=t.DbgName),l}},THREE.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=0,r=this.handlers.length;e<r;e+=2){var i=this.handlers[e],n=this.handlers[e+1];if(i.test(t))return n}return null}},THREE.XHRLoader=function(t){this.cache=new THREE.Cache,this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(e,r,i,n){var a=this,t=a.cache.get(e);if(void 0===t){var o=new XMLHttpRequest;o.open("GET",e,!0),o.addEventListener("load",function(t){a.cache.add(e,this.response),r&&r(this.response),a.manager.itemEnd(e)},!1),void 0!==i&&o.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&o.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(o.responseType=this.responseType),o.send(null),a.manager.itemStart(e)}else r&&r(t)},setResponseType:function(t){this.responseType=t},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.ImageLoader=function(t){this.cache=new THREE.Cache,this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,r,i,n){var a=this,t=a.cache.get(e);if(void 0===t){var o=document.createElement("img");return void 0!==r&&o.addEventListener("load",function(t){a.cache.add(e,this),r(this),a.manager.itemEnd(e)},!1),void 0!==i&&o.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&o.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),o.src=e,a.manager.itemStart(e),o}r(t)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.LoadingManager=function(t,e,r){var i=this,n=0,a=0;this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++},this.itemEnd=function(t){n++,void 0!==i.onProgress&&i.onProgress(t,n,a),n===a&&void 0!==i.onLoad&&i.onLoad()}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.TextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(t,r,e,i){var n=new THREE.ImageLoader(this.manager);n.setCrossOrigin(this.crossOrigin),n.load(t,function(t){var e=new THREE.Texture(t);e.needsUpdate=!0,void 0!==r&&r(e)},e,i)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.CompressedTextureLoader=function(){this._parser=null},THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(t,a,e){var o=this,s=[],h=new THREE.CompressedTexture;h.image=s;var i=new THREE.XHRLoader;if(i.setResponseType("arraybuffer"),t instanceof Array)for(var n=0,r=function(r){i.load(t[r],function(t){var e=o._parser(t,!0);s[r]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(n+=1)&&(1==e.mipmapCount&&(h.minFilter=THREE.LinearFilter),h.format=e.format,h.needsUpdate=!0,a&&a(h))})},l=0,u=t.length;l<u;++l)r(l);else i.load(t,function(t){var e=o._parser(t,!0);if(e.isCubemap)for(var r=e.mipmaps.length/e.mipmapCount,i=0;i<r;i++){s[i]={mipmaps:[]};for(var n=0;n<e.mipmapCount;n++)s[i].mipmaps.push(e.mipmaps[i*e.mipmapCount+n]),s[i].format=e.format,s[i].width=e.width,s[i].height=e.height}else h.image.width=e.width,h.image.height=e.height,h.mipmaps=e.mipmaps;1===e.mipmapCount&&(h.minFilter=THREE.LinearFilter),h.format=e.format,h.needsUpdate=!0,a&&a(h)});return h}},THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Material",this.side=THREE.FrontSide,this.opacity=1,this.transparent=!1,this.blending=THREE.NormalBlending,this.blendSrc=THREE.SrcAlphaFactor,this.blendDst=THREE.OneMinusSrcAlphaFactor,this.blendEquation=THREE.AddEquation,this.depthTest=!0,this.depthWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this.needsUpdate=!0},THREE.Material.prototype={constructor:THREE.Material,setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0!==r){if(e in this){var i=this[e];i instanceof THREE.Color?i.set(r):i instanceof THREE.Vector3&&r instanceof THREE.Vector3?i.copy(r):this[e]="overdraw"==e?Number(r):r}}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(){var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(t.name=this.name),this instanceof THREE.MeshBasicMaterial?(t.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshLambertMaterial?(t.color=this.color.getHex(),t.ambient=this.ambient.getHex(),t.emissive=this.emissive.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshPhongMaterial?(t.color=this.color.getHex(),t.ambient=this.ambient.getHex(),t.emissive=this.emissive.getHex(),t.specular=this.specular.getHex(),t.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.shading!==THREE.FlatShading&&(t.shading=this.shading),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.ShaderMaterial?(t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(t.color=this.color.getHex()),this.opacity<1&&(t.opacity=this.opacity),!1!==this.transparent&&(t.transparent=this.transparent),!1!==this.wireframe&&(t.wireframe=this.wireframe),t},clone:function(t){return void 0===t&&(t=new THREE.Material),t.name=this.name,t.side=this.side,t.opacity=this.opacity,t.transparent=this.transparent,t.blending=this.blending,t.blendSrc=this.blendSrc,t.blendDst=this.blendDst,t.blendEquation=this.blendEquation,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.polygonOffset=this.polygonOffset,t.polygonOffsetFactor=this.polygonOffsetFactor,t.polygonOffsetUnits=this.polygonOffsetUnits,t.alphaTest=this.alphaTest,t.overdraw=this.overdraw,t.visible=this.visible,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Material.prototype),THREE.MaterialIdCount=0,THREE.LineBasicMaterial=function(t){THREE.Material.call(this),this.type="LineBasicMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.clone=function(){var t=new THREE.LineBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.linecap=this.linecap,t.linejoin=this.linejoin,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.LineDashedMaterial=function(t){THREE.Material.call(this),this.type="LineDashedMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(t)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.clone=function(){var t=new THREE.LineDashedMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.scale=this.scale,t.dashSize=this.dashSize,t.gapSize=this.gapSize,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.MeshBasicMaterial=function(t){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(t)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.clone=function(){var t=new THREE.MeshBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t},THREE.MeshLambertMaterial=function(t){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.clone=function(){var t=new THREE.MeshLambertMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.ambient.copy(this.ambient),t.emissive.copy(this.emissive),t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.MeshPhongMaterial=function(t){THREE.Material.call(this),this.type="MeshPhongMaterial",this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.specular=new THREE.Color(1118481),this.shininess=30,this.metal=!1,this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.clone=function(){var t=new THREE.MeshPhongMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.ambient.copy(this.ambient),t.emissive.copy(this.emissive),t.specular.copy(this.specular),t.shininess=this.shininess,t.metal=this.metal,t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.bumpMap=this.bumpMap,t.bumpScale=this.bumpScale,t.normalMap=this.normalMap,t.normalScale.copy(this.normalScale),t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.MeshDepthMaterial=function(t){THREE.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.clone=function(){var t=new THREE.MeshDepthMaterial;return THREE.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},THREE.MeshNormalMaterial=function(t){THREE.Material.call(this,t),this.type="MeshNormalMaterial",this.shading=THREE.FlatShading,this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.clone=function(){var t=new THREE.MeshNormalMaterial;return THREE.Material.prototype.clone.call(this,t),t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},THREE.MeshFaceMaterial=function(t){this.uuid=THREE.Math.generateUUID(),this.type="MeshFaceMaterial",this.materials=t instanceof Array?t:[]},THREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,toJSON:function(){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},e=0,r=this.materials.length;e<r;e++)t.materials.push(this.materials[e].toJSON());return t},clone:function(){for(var t=new THREE.MeshFaceMaterial,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t}},THREE.PointCloudMaterial=function(t){THREE.Material.call(this),this.type="PointCloudMaterial",this.color=new THREE.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype),THREE.PointCloudMaterial.prototype.clone=function(){var t=new THREE.PointCloudMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.size=this.size,t.sizeAttenuation=this.sizeAttenuation,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ShaderMaterial=function(t){THREE.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,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=THREE.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(t)},THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.clone=function(){var t=new THREE.ShaderMaterial;return THREE.Material.prototype.clone.call(this,t),t.fragmentShader=this.fragmentShader,t.vertexShader=this.vertexShader,t.uniforms=THREE.UniformsUtils.clone(this.uniforms),t.attributes=this.attributes,t.defines=this.defines,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.fog=this.fog,t.lights=this.lights,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.RawShaderMaterial=function(t){THREE.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype),THREE.RawShaderMaterial.prototype.clone=function(){var t=new THREE.RawShaderMaterial;return THREE.ShaderMaterial.prototype.clone.call(this,t),t},THREE.SpriteMaterial=function(t){THREE.Material.call(this),this.type="SpriteMaterial",this.color=new THREE.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteMaterial.prototype.clone=function(){var t=new THREE.SpriteMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.rotation=this.rotation,t.fog=this.fog,t},THREE.Texture=function(t,e,r,i,n,a,o,s,h){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.image=void 0!==t?t:THREE.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:THREE.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:THREE.LinearFilter,this.minFilter=void 0!==a?a:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==o?o:THREE.RGBAFormat,this.type=void 0!==s?s:THREE.UnsignedByteType,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},THREE.Texture.DEFAULT_IMAGE=void 0,THREE.Texture.DEFAULT_MAPPING=new THREE.UVMapping,THREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},clone:function(t){return void 0===t&&(t=new THREE.Texture),t.image=this.image,t.mipmaps=this.mipmaps.slice(0),t.mapping=this.mapping,t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.format=this.format,t.type=this.type,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.generateMipmaps=this.generateMipmaps,t.premultiplyAlpha=this.premultiplyAlpha,t.flipY=this.flipY,t.unpackAlignment=this.unpackAlignment,t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,THREE.CubeTexture=function(t,e,r,i,n,a,o,s,h){THREE.Texture.call(this,t,e,r,i,n,a,o,s,h),this.images=t},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.clone=function(t){return void 0===t&&(t=new THREE.CubeTexture),THREE.Texture.prototype.clone.call(this,t),t.images=this.images,t},THREE.CompressedTexture=function(t,e,r,i,n,a,o,s,h,l,u){THREE.Texture.call(this,null,a,o,s,h,l,i,n,u),this.image={width:e,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1},THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.clone=function(){var t=new THREE.CompressedTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.DataTexture=function(t,e,r,i,n,a,o,s,h,l,u){THREE.Texture.call(this,null,a,o,s,h,l,i,n,u),this.image={data:t,width:e,height:r}},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.clone=function(){var t=new THREE.DataTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.VideoTexture=function(t,e,r,i,n,a,o,s,h){THREE.Texture.call(this,t,e,r,i,n,a,o,s,h),this.generateMipmaps=!1;var l=this,u=function(){requestAnimationFrame(u),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};u()},THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype),THREE.Group=function(){THREE.Object3D.call(this),this.type="Group"},THREE.Group.prototype=Object.create(THREE.Object3D.prototype),THREE.PointCloud=function(t,e){THREE.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.PointCloudMaterial({color:16777215*Math.random()}),this.sortParticles=!1},THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype),THREE.PointCloud.prototype.raycast=function(){var R=new THREE.Matrix4,_=new THREE.Ray;return function(a,o){var s=this,t=s.geometry,e=a.params.PointCloud.threshold;if(R.getInverse(this.matrixWorld),_.copy(a.ray).applyMatrix4(R),null===t.boundingBox||!1!==_.isIntersectionBox(t.boundingBox)){var h=e/((this.scale.x+this.scale.y+this.scale.z)/3),r=new THREE.Vector3,i=function(t,e){var r=_.distanceToPoint(t);if(r<h){var i=_.closestPointToPoint(t);i.applyMatrix4(s.matrixWorld);var n=a.ray.origin.distanceTo(i);o.push({distance:n,distanceToRay:r,point:i.clone(),index:e,face:null,object:s})}};if(t instanceof THREE.BufferGeometry){var n=t.attributes,l=n.position.array;if(void 0!==n.index){var u=n.index.array,c=t.offsets;if(0===c.length)c=[{start:0,count:u.length,index:0}];for(var f=0,d=c.length;f<d;++f)for(var p=c[f].start,E=c[f].count,m=c[f].index,g=p,v=p+E;g<v;g++){var T=m+u[g];r.fromArray(l,3*T),i(r,T)}}else{var x=l.length/3;for(g=0;g<x;g++)r.set(l[3*g],l[3*g+1],l[3*g+2]),i(r,g)}}else{var y=this.geometry.vertices;for(g=0;g<y.length;g++)i(y[g],g)}}}}(),THREE.PointCloud.prototype.clone=function(t){return void 0===t&&(t=new THREE.PointCloud(this.geometry,this.material)),t.sortParticles=this.sortParticles,THREE.Object3D.prototype.clone.call(this,t),t},THREE.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new THREE.PointCloud(t,e)},THREE.Line=function(t,e,r){THREE.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.LineBasicMaterial({color:16777215*Math.random()}),this.mode=void 0!==r?r:THREE.LineStrip},THREE.LineStrip=0,THREE.LinePieces=1,THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.raycast=function(){var f=new THREE.Matrix4,d=new THREE.Ray,p=new THREE.Sphere;return function(t,e){var r=t.linePrecision,i=r*r,n=this.geometry;if(null===n.boundingSphere&&n.computeBoundingSphere(),p.copy(n.boundingSphere),p.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(p)&&(f.getInverse(this.matrixWorld),d.copy(t.ray).applyMatrix4(f),n instanceof THREE.Geometry))for(var a=n.vertices,o=a.length,s=new THREE.Vector3,h=new THREE.Vector3,l=this.mode===THREE.LineStrip?1:2,u=0;u<o-1;u+=l){if(!(i<d.distanceSqToSegment(a[u],a[u+1],h,s))){var c=d.origin.distanceTo(h);c<t.near||c>t.far||e.push({distance:c,point:s.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}}(),THREE.Line.prototype.clone=function(t){return void 0===t&&(t=new THREE.Line(this.geometry,this.material,this.mode)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Mesh=function(t,e){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],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}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){var P=new THREE.Matrix4,U=new THREE.Ray,B=new THREE.Sphere,z=new THREE.Vector3,N=new THREE.Vector3,k=new THREE.Vector3;return function(t,e){var r=this.geometry;if(null===r.boundingSphere&&r.computeBoundingSphere(),B.copy(r.boundingSphere),B.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(B)&&(P.getInverse(this.matrixWorld),U.copy(t.ray).applyMatrix4(P),null===r.boundingBox||!1!==U.isIntersectionBox(r.boundingBox)))if(r instanceof THREE.BufferGeometry){if(void 0===(b=this.material))return;var i=r.attributes,n=t.precision;if(void 0!==i.index){var a=i.index.array,o=i.position.array,s=r.offsets;0===s.length&&(s=[{start:0,count:a.length,index:0}]);for(var h=0,l=s.length;h<l;++h)for(var u=s[h].start,c=s[h].count,f=s[h].index,d=u,p=u+c;d<p;d+=3){if(g=f+a[d],v=f+a[d+1],T=f+a[d+2],z.fromArray(o,3*g),N.fromArray(o,3*v),k.fromArray(o,3*T),b.side===THREE.BackSide)var E=U.intersectTriangle(k,N,z,!0);else E=U.intersectTriangle(z,N,k,b.side!==THREE.DoubleSide);if(null!==E)E.applyMatrix4(this.matrixWorld),(F=t.ray.origin.distanceTo(E))<n||F<t.near||F>t.far||e.push({distance:F,point:E,face:new THREE.Face3(g,v,T,THREE.Triangle.normal(z,N,k)),faceIndex:null,object:this})}}else{d=0;var m=0;for(p=(o=i.position.array).length;d<p;d+=3,m+=9){if(v=(g=d)+1,T=d+2,z.fromArray(o,m),N.fromArray(o,m+3),k.fromArray(o,m+6),b.side===THREE.BackSide)E=U.intersectTriangle(k,N,z,!0);else E=U.intersectTriangle(z,N,k,b.side!==THREE.DoubleSide);if(null!==E)E.applyMatrix4(this.matrixWorld),(F=t.ray.origin.distanceTo(E))<n||F<t.near||F>t.far||e.push({distance:F,point:E,face:new THREE.Face3(g,v,T,THREE.Triangle.normal(z,N,k)),faceIndex:null,object:this})}}}else if(r instanceof THREE.Geometry)for(var g,v,T,x=this.material instanceof THREE.MeshFaceMaterial,y=!0===x?this.material.materials:null,R=(n=t.precision,r.vertices),_=0,H=r.faces.length;_<H;_++){var b,M=r.faces[_];if(void 0!==(b=!0===x?y[M.materialIndex]:this.material)){if(g=R[M.a],v=R[M.b],T=R[M.c],!0===b.morphTargets){var w=r.morphTargets,S=this.morphTargetInfluences;z.set(0,0,0),N.set(0,0,0),k.set(0,0,0);for(var A=0,C=w.length;A<C;A++){var D=S[A];if(0!==D){var L=w[A].vertices;z.x+=(L[M.a].x-g.x)*D,z.y+=(L[M.a].y-g.y)*D,z.z+=(L[M.a].z-g.z)*D,N.x+=(L[M.b].x-v.x)*D,N.y+=(L[M.b].y-v.y)*D,N.z+=(L[M.b].z-v.z)*D,k.x+=(L[M.c].x-T.x)*D,k.y+=(L[M.c].y-T.y)*D,k.z+=(L[M.c].z-T.z)*D}}z.add(g),N.add(v),k.add(T),g=z,v=N,T=k}if(b.side===THREE.BackSide)E=U.intersectTriangle(T,v,g,!0);else E=U.intersectTriangle(g,v,T,b.side!==THREE.DoubleSide);var F;if(null!==E)E.applyMatrix4(this.matrixWorld),(F=t.ray.origin.distanceTo(E))<n||F<t.near||F>t.far||e.push({distance:F,point:E,face:M,faceIndex:_,object:this})}}}}(),THREE.Mesh.prototype.clone=function(t,e){return void 0===t&&(t=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,t,e),t},THREE.Bone=function(t){THREE.Object3D.call(this),this.skin=t},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Skeleton=function(t,e,r){var i;(this.useVertexTexture=void 0===r||r,this.identityMatrix=new THREE.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture)?(i=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;n<a;n++)this.boneInverses.push(new THREE.Matrix4)}},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new THREE.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},THREE.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))},THREE.Skeleton.prototype.update=function(){var i=new THREE.Matrix4;return function(){for(var t=0,e=this.bones.length;t<e;t++){var r=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;i.multiplyMatrices(r,this.boneInverses[t]),i.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.SkinnedMesh=function(t,e,r){THREE.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,a,o,s,h,l=0,u=this.geometry.bones.length;l<u;++l)o=(a=this.geometry.bones[l]).pos,s=a.rotq,h=a.scl,n=new THREE.Bone(this),i.push(n),n.name=a.name,n.position.set(o[0],o[1],o[2]),n.quaternion.set(s[0],s[1],s[2],s[3]),void 0!==h?n.scale.set(h[0],h[1],h[2]):n.scale.set(1,1,1);for(l=0,u=this.geometry.bones.length;l<u;++l)-1!==(a=this.geometry.bones[l]).parent?i[a.parent].add(i[l]):this.add(i[l])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(i,void 0,r))},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var t=0;t<this.geometry.skinIndices.length;t++){var e=this.geometry.skinWeights[t],r=1/e.lengthManhattan();r!==1/0?e.multiplyScalar(r):e.set(1)}},THREE.SkinnedMesh.prototype.updateMatrixWorld=function(t){THREE.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 unreckognized bindMode: "+this.bindMode)},THREE.SkinnedMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),THREE.Mesh.prototype.clone.call(this,t),t},THREE.MorphAnimMesh=function(t,e){THREE.Mesh.call(this,t,e),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphAnimMesh.prototype.setFrameRange=function(t,e){this.startKeyframe=t,this.endKeyframe=e,this.length=this.endKeyframe-this.startKeyframe+1},THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},THREE.MorphAnimMesh.prototype.parseAnimations=function(){var t=this.geometry;t.animations||(t.animations={});for(var e,r=t.animations,i=/([a-z]+)_?(\d+)/,n=0,a=t.morphTargets.length;n<a;n++){var o=t.morphTargets[n].name.match(i);if(o&&1<o.length){var s=o[1];o[2];r[s]||(r[s]={start:1/0,end:-1/0});var h=r[s];n<h.start&&(h.start=n),n>h.end&&(h.end=n),e||(e=s)}}t.firstAnimation=e},THREE.MorphAnimMesh.prototype.setAnimationLabel=function(t,e,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[t]={start:e,end:r}},THREE.MorphAnimMesh.prototype.playAnimation=function(t,e){var r=this.geometry.animations[t];r?(this.setFrameRange(r.start,r.end),this.duration=(r.end-r.start)/e*1e3,this.time=0):console.warn("animation["+t+"] undefined")},THREE.MorphAnimMesh.prototype.updateAnimation=function(t){var e=this.duration/this.length;this.time+=this.direction*t,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/e),0,this.length-1);r!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var i=this.time%e/e;this.directionBackwards&&(i=1-i),this.morphTargetInfluences[this.currentKeyframe]=i,this.morphTargetInfluences[this.lastKeyframe]=1-i},THREE.MorphAnimMesh.prototype.interpolateTargets=function(t,e,r){for(var i=this.morphTargetInfluences,n=0,a=i.length;n<a;n++)i[n]=0;-1<t&&(i[t]=1-r),-1<e&&(i[e]=r)},THREE.MorphAnimMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.MorphAnimMesh(this.geometry,this.material)),t.duration=this.duration,t.mirroredLoop=this.mirroredLoop,t.time=this.time,t.lastKeyframe=this.lastKeyframe,t.currentKeyframe=this.currentKeyframe,t.direction=this.direction,t.directionBackwards=this.directionBackwards,THREE.Mesh.prototype.clone.call(this,t),t},THREE.LOD=function(){THREE.Object3D.call(this),this.objects=[]},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=0;r<this.objects.length&&!(e<this.objects[r].distance);r++);this.objects.splice(r,0,{distance:e,object:t}),this.add(t)},THREE.LOD.prototype.getObjectForDistance=function(t){for(var e=1,r=this.objects.length;e<r&&!(t<this.objects[e].distance);e++);return this.objects[e-1].object},THREE.LOD.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(i);this.getObjectForDistance(r).raycast(t,e)}}(),THREE.LOD.prototype.update=function(){var n=new THREE.Vector3,a=new THREE.Vector3;return function(t){if(1<this.objects.length){n.setFromMatrixPosition(t.matrixWorld),a.setFromMatrixPosition(this.matrixWorld);var e=n.distanceTo(a);this.objects[0].object.visible=!0;for(var r=1,i=this.objects.length;r<i&&e>=this.objects[r].distance;r++)this.objects[r-1].object.visible=!1,this.objects[r].object.visible=!0;for(;r<i;r++)this.objects[r].object.visible=!1}}}(),THREE.LOD.prototype.clone=function(t){void 0===t&&(t=new THREE.LOD),THREE.Object3D.prototype.clone.call(this,t);for(var e=0,r=this.objects.length;e<r;e++){var i=this.objects[e].object.clone();i.visible=0===e,t.addLevel(i,this.objects[e].distance)}return t},THREE.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 THREE.BufferGeometry;return i.addAttribute("index",new THREE.BufferAttribute(t,1)),i.addAttribute("position",new THREE.BufferAttribute(e,3)),i.addAttribute("uv",new THREE.BufferAttribute(r,2)),function(t){THREE.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceToPoint(i);r>this.scale.x||e.push({distance:r,point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(t){return void 0===t&&(t=new THREE.Sprite(this.material)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Particle=THREE.Sprite,THREE.LensFlare=function(t,e,r,i,n){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,(this.customUpdateCallback=void 0)!==t&&this.add(t,e,r,i,n)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.add=function(t,e,r,i,n,a){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===n&&(n=new THREE.Color(16777215)),void 0===i&&(i=THREE.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:1,opacity:a,color:n,blending:i})},THREE.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]).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)},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.clone=function(t){return void 0===t&&(t=new THREE.Scene),THREE.Object3D.prototype.clone.call(this,t),null!==this.fog&&(t.fog=this.fog.clone()),null!==this.overrideMaterial&&(t.overrideMaterial=this.overrideMaterial.clone()),t.autoUpdate=this.autoUpdate,t.matrixAutoUpdate=this.matrixAutoUpdate,t},THREE.Fog=function(t,e,r){this.name="",this.color=new THREE.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(t,e){this.name="",this.color=new THREE.Color(t),this.density=void 0!==e?e:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( gl_FragColor.a < ALPHATEST ) discard;\n\n#endif\n",THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\tvec3 dirVector = normalize( lDirection.xyz );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat lDistance = 1.0;\n\t\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n\n#endif",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",THREE.ShaderChunk.default_vertex="vec4 mvPosition;\n\n#ifdef USE_SKINNING\n\n\tmvPosition = modelViewMatrix * skinned;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\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\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.lights_phong_fragment="vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef DOUBLE_SIDED\n\n\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tvec3 pointDiffuse = vec3( 0.0 );\n\tvec3 pointSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tpointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tvec3 spotDiffuse = vec3( 0.0 );\n\tvec3 spotSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\tspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\n\n\t\t\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tvec3 dirDiffuse = vec3( 0.0 );\n\tvec3 dirSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\t\tvec3 dirVector = normalize( lDirection.xyz );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tdirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tvec3 hemiDiffuse = vec3( 0.0 );\n\tvec3 hemiSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\themiDiffuse += diffuse * hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n\ttotalDiffuse += dirDiffuse;\n\ttotalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\ttotalDiffuse += hemiDiffuse;\n\ttotalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\ttotalDiffuse += pointDiffuse;\n\ttotalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\ttotalDiffuse += spotDiffuse;\n\ttotalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n\n#else\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\n#endif",THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif",THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\tuniform samplerCube envMap;\n\tuniform float flipEnvMap;\n\tuniform int combine;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform bool useRefract;\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t\t\t// Per-Pixel Tangent Space Normal Mapping\n\t\t\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\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\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\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\n\t}\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\t#ifdef GAMMA_INPUT\n\n\t\ttexelColor.xyz *= texelColor.xyz;\n\n\t#endif\n\n\tgl_FragColor = gl_FragColor * texelColor;\n\n#endif",THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tgl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n\n#endif",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\t#ifdef GAMMA_INPUT\n\n\t\tvColor = color * color;\n\n\t#else\n\n\t\tvColor = color;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\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\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\tuniform bool useRefract;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="#ifdef GAMMA_OUTPUT\n\n\tgl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n\n#endif",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\n\nuniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n",THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\tvec3 reflectVec;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\n\t\tvec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );\n\n\t\tif ( useRefract ) {\n\n\t\t\treflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t} else { \n\n\t\t\treflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t}\n\n\t#else\n\n\t\treflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t\tvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#else\n\n\t\tvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#endif\n\n\t#ifdef GAMMA_INPUT\n\n\t\tcubeColor.xyz *= cubeColor.xyz;\n\n\t#endif\n\n\tif ( combine == 1 ) {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n\n\t} else if ( combine == 2 ) {\n\n\t\tgl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n\n\t} else {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n\n\t}\n\n#endif",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tconst float LOG2 = 1.442695;\n\t\tfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\n\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\tgl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n\n#endif",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t\t\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t\t\t//\thttp://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t\t\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif",THREE.ShaderChunk.defaultnormal_vertex="vec3 objectNormal;\n\n#ifdef USE_SKINNING\n\n\tobjectNormal = skinnedNormal.xyz;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\n\n\tobjectNormal = morphedNormal;\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\n\n\tobjectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;",THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\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\n#endif",THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\tgl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n\n#endif",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tgl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\n\tworldNormal = normalize( worldNormal );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tif ( useRefract ) {\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t} else {\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t}\n\n#endif",THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t#ifdef GAMMA_OUTPUT\n\n\t\tshadowColor *= shadowColor;\n\n\t#endif\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n\n#endif\n",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#endif\n\n\t#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#endif\n\n\t#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\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\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\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\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tgl_FragColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",THREE.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i=this.clone(t[r]);for(var n in i)e[n]=i[n]}return e},clone:function(t){var e={};for(var r in t)for(var i in e[r]={},t[r]){var n=t[r][i];n instanceof THREE.Color||n instanceof THREE.Vector2||n instanceof THREE.Vector3||n instanceof THREE.Vector4||n instanceof THREE.Matrix4||n instanceof THREE.Texture?e[r][i]=n.clone():n instanceof Array?e[r][i]=n.slice():e[r][i]=n}return e}},THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED","\t\tif ( gl_FrontFacing )","\t\t\tgl_FragColor.xyz *= vLightFront;","\t\telse","\t\t\tgl_FragColor.xyz *= vLightBack;","\t#else","\t\tgl_FragColor.xyz *= vLightFront;","\t#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","varying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\tvNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform float opacity;","uniform vec3 ambient;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\t#ifdef USE_SIZEATTENUATION","\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );","\t#else","\t\tgl_PointSize = size;","\t#endif","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tif ( mod( vLineDistance, totalSize ) > dashSize ) {","\t\tdiscard;","\t}","\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;","\t#else","\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;","\t#endif","\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );","\tgl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},normalmap:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},diffuse:{type:"c",value:new THREE.Color(16777215)},specular:{type:"c",value:new THREE.Color(1118481)},ambient:{type:"c",value:new THREE.Color(16777215)},shininess:{type:"f",value:30},opacity:{type:"f",value:1},useRefract:{type:"i",value:0},refractionRatio:{type:"f",value:.98},reflectivity:{type:"f",value:.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 ambient;","uniform vec3 diffuse;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;","uniform bool enableDiffuse;","uniform bool enableSpecular;","uniform bool enableAO;","uniform bool enableReflection;","uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tSpecular;","uniform sampler2D tAO;","uniform samplerCube tCube;","uniform vec2 uNormalScale;","uniform bool useRefract;","uniform float refractionRatio;","uniform float reflectivity;","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","uniform vec3 ambientLightColor;","#if MAX_DIR_LIGHTS > 0","\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];","\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];","#endif","#if MAX_HEMI_LIGHTS > 0","\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];","\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];","\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];","#endif","#if MAX_POINT_LIGHTS > 0","\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];","\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];","#endif","#if MAX_SPOT_LIGHTS > 0","\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];","\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];","\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","#endif","#ifdef WRAP_AROUND","\tuniform vec3 wrapRGB;","#endif","varying vec3 vWorldPosition;","varying vec3 vViewPosition;",THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\tgl_FragColor = vec4( vec3( 1.0 ), opacity );","\tvec3 specularTex = vec3( 1.0 );","\tvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;","\tnormalTex.xy *= uNormalScale;","\tnormalTex = normalize( normalTex );","\tif( enableDiffuse ) {","\t\t#ifdef GAMMA_INPUT","\t\t\tvec4 texelColor = texture2D( tDiffuse, vUv );","\t\t\ttexelColor.xyz *= texelColor.xyz;","\t\t\tgl_FragColor = gl_FragColor * texelColor;","\t\t#else","\t\t\tgl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );","\t\t#endif","\t}","\tif( enableAO ) {","\t\t#ifdef GAMMA_INPUT","\t\t\tvec4 aoColor = texture2D( tAO, vUv );","\t\t\taoColor.xyz *= aoColor.xyz;","\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;","\t\t#else","\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;","\t\t#endif","\t}",THREE.ShaderChunk.alphatest_fragment,"\tif( enableSpecular )","\t\tspecularTex = texture2D( tSpecular, vUv ).xyz;","\tmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );","\tvec3 finalNormal = tsb * normalTex;","\t#ifdef FLIP_SIDED","\t\tfinalNormal = -finalNormal;","\t#endif","\tvec3 normal = normalize( finalNormal );","\tvec3 viewPosition = normalize( vViewPosition );","\t#if MAX_POINT_LIGHTS > 0","\t\tvec3 pointDiffuse = vec3( 0.0 );","\t\tvec3 pointSpecular = vec3( 0.0 );","\t\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {","\t\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","\t\t\tvec3 pointVector = lPosition.xyz + vViewPosition.xyz;","\t\t\tfloat pointDistance = 1.0;","\t\t\tif ( pointLightDistance[ i ] > 0.0 )","\t\t\t\tpointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );","\t\t\tpointVector = normalize( pointVector );","\t\t\t#ifdef WRAP_AROUND","\t\t\t\tfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );","\t\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );","\t\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );","\t\t\t#else","\t\t\t\tfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );","\t\t\t#endif","\t\t\tpointDiffuse += pointDistance * pointLightColor[ i ] * diffuse * pointDiffuseWeight;","\t\t\tvec3 pointHalfVector = normalize( pointVector + viewPosition );","\t\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );","\t\t\tfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( pointVector, pointHalfVector ), 0.0 ), 5.0 );","\t\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;","\t\t}","\t#endif","\t#if MAX_SPOT_LIGHTS > 0","\t\tvec3 spotDiffuse = vec3( 0.0 );","\t\tvec3 spotSpecular = vec3( 0.0 );","\t\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","\t\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","\t\t\tvec3 spotVector = lPosition.xyz + vViewPosition.xyz;","\t\t\tfloat spotDistance = 1.0;","\t\t\tif ( spotLightDistance[ i ] > 0.0 )","\t\t\t\tspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );","\t\t\tspotVector = normalize( spotVector );","\t\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );","\t\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {","\t\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );","\t\t\t\t#ifdef WRAP_AROUND","\t\t\t\t\tfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );","\t\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );","\t\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );","\t\t\t\t#else","\t\t\t\t\tfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );","\t\t\t\t#endif","\t\t\t\tspotDiffuse += spotDistance * spotLightColor[ i ] * diffuse * spotDiffuseWeight * spotEffect;","\t\t\t\tvec3 spotHalfVector = normalize( spotVector + viewPosition );","\t\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );","\t\t\t\tfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );","\t\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( spotVector, spotHalfVector ), 0.0 ), 5.0 );","\t\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;","\t\t\t}","\t\t}","\t#endif","\t#if MAX_DIR_LIGHTS > 0","\t\tvec3 dirDiffuse = vec3( 0.0 );","\t\tvec3 dirSpecular = vec3( 0.0 );","\t\tfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {","\t\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );","\t\t\tvec3 dirVector = normalize( lDirection.xyz );","\t\t\t#ifdef WRAP_AROUND","\t\t\t\tfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );","\t\t\t\tfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );","\t\t\t\tvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );","\t\t\t#else","\t\t\t\tfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );","\t\t\t#endif","\t\t\tdirDiffuse += directionalLightColor[ i ] * diffuse * dirDiffuseWeight;","\t\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );","\t\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );","\t\t\tfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );","\t\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;","\t\t}","\t#endif","\t#if MAX_HEMI_LIGHTS > 0","\t\tvec3 hemiDiffuse = vec3( 0.0 );","\t\tvec3 hemiSpecular = vec3( 0.0 );","\t\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {","\t\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );","\t\t\tvec3 lVector = normalize( lDirection.xyz );","\t\t\tfloat dotProduct = dot( normal, lVector );","\t\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;","\t\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );","\t\t\themiDiffuse += diffuse * hemiColor;","\t\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );","\t\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;","\t\t\tfloat hemiSpecularWeightSky = specularTex.r * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );","\t\t\tvec3 lVectorGround = -lVector;","\t\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );","\t\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;","\t\t\tfloat hemiSpecularWeightGround = specularTex.r * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );","\t\t\tfloat dotProductGround = dot( normal, lVectorGround );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );","\t\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );","\t\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );","\t\t}","\t#endif","\tvec3 totalDiffuse = vec3( 0.0 );","\tvec3 totalSpecular = vec3( 0.0 );","\t#if MAX_DIR_LIGHTS > 0","\t\ttotalDiffuse += dirDiffuse;","\t\ttotalSpecular += dirSpecular;","\t#endif","\t#if MAX_HEMI_LIGHTS > 0","\t\ttotalDiffuse += hemiDiffuse;","\t\ttotalSpecular += hemiSpecular;","\t#endif","\t#if MAX_POINT_LIGHTS > 0","\t\ttotalDiffuse += pointDiffuse;","\t\ttotalSpecular += pointSpecular;","\t#endif","\t#if MAX_SPOT_LIGHTS > 0","\t\ttotalDiffuse += spotDiffuse;","\t\ttotalSpecular += spotSpecular;","\t#endif","\t#ifdef METAL","\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );","\t#else","\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;","\t#endif","\tif ( enableReflection ) {","\t\tvec3 vReflect;","\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );","\t\tif ( useRefract ) {","\t\t\tvReflect = refract( cameraToVertex, normal, refractionRatio );","\t\t} else {","\t\t\tvReflect = reflect( cameraToVertex, normal );","\t\t}","\t\tvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","\t\t#ifdef GAMMA_INPUT","\t\t\tcubeColor.xyz *= cubeColor.xyz;","\t\t#endif","\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * reflectivity );","\t}",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;","uniform vec2 uOffset;","uniform vec2 uRepeat;","uniform bool enableDisplacement;","#ifdef VERTEX_TEXTURES","\tuniform sampler2D tDisplacement;","\tuniform float uDisplacementScale;","\tuniform float uDisplacementBias;","#endif","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","varying vec3 vWorldPosition;","varying vec3 vViewPosition;",THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"\t#ifdef USE_SKINNING","\t\tvNormal = normalize( normalMatrix * skinnedNormal.xyz );","\t\tvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );","\t\tvTangent = normalize( normalMatrix * skinnedTangent.xyz );","\t#else","\t\tvNormal = normalize( normalMatrix * normal );","\t\tvTangent = normalize( normalMatrix * tangent.xyz );","\t#endif","\tvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );","\tvUv = uv * uRepeat + uOffset;","\tvec3 displacedPosition;","\t#ifdef VERTEX_TEXTURES","\t\tif ( enableDisplacement ) {","\t\t\tvec3 dv = texture2D( tDisplacement, uv ).xyz;","\t\t\tfloat df = uDisplacementScale * dv.x + uDisplacementBias;","\t\t\tdisplacedPosition = position + normalize( normal ) * df;","\t\t} else {","\t\t\t#ifdef USE_SKINNING","\t\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );","\t\t\t\tvec4 skinned = vec4( 0.0 );","\t\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;","\t\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;","\t\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;","\t\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;","\t\t\t\tskinned = bindMatrixInverse * skinned;","\t\t\t\tdisplacedPosition = skinned.xyz;","\t\t\t#else","\t\t\t\tdisplacedPosition = position;","\t\t\t#endif","\t\t}","\t#else","\t\t#ifdef USE_SKINNING","\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );","\t\t\tvec4 skinned = vec4( 0.0 );","\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;","\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;","\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;","\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;","\t\t\tskinned = bindMatrixInverse * skinned;","\t\t\tdisplacedPosition = skinned.xyz;","\t\t#else","\t\t\tdisplacedPosition = position;","\t\t#endif","\t#endif","\tvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"\tvWorldPosition = worldPosition.xyz;","\tvViewPosition = -mvPosition.xyz;","\t#ifdef USE_SHADOWMAP","\t\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {","\t\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;","\t\t}","\t#endif","}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","\tres -= res.xxyz * bit_mask;","\treturn res;","}","void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","\t#else","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","\t#endif","}"].join("\n")}},THREE.WebGLRenderer=function(t){console.log("THREE.WebGLRenderer",THREE.REVISION);var R=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),e=void 0!==t.context?t.context:null,_=void 0!==t.precision?t.precision:"highp",r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,n=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,s=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,H=void 0!==t.logarithmicDepthBuffer&&t.logarithmicDepthBuffer,h=new THREE.Color(0),l=0,c=[],E={},m=[],f=[],d=[],p=[],g=[];this.domElement=R,this.context=null,this.devicePixelRatio=void 0!==t.devicePixelRatio?t.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=THREE.PCFShadowMap,this.shadowMapCullFace=THREE.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var zt,V=this,b=[],M=null,v=null,w=-1,T=-1,S=null,A=0,u=-1,x=-1,y=-1,C=-1,D=-1,L=-1,F=-1,P=-1,U=null,B=null,z=null,N=null,k=0,O=0,I=R.width,G=R.height,W=0,X=0,j=new Uint8Array(16),Y=new Uint8Array(16),q=new THREE.Frustum,K=new THREE.Matrix4,Z=new THREE.Matrix4,Q=new THREE.Vector3,J=new THREE.Vector3,$=!0,tt={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var et={alpha:r,depth:i,stencil:n,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:s};if(null===(zt=e||R.getContext("webgl",et)||R.getContext("experimental-webgl",et)))throw null!==R.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context."}catch(t){console.error(t)}void 0===zt.getShaderPrecisionFormat&&(zt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var rt=new THREE.WebGLExtensions(zt);rt.get("OES_texture_float"),rt.get("OES_texture_float_linear"),rt.get("OES_standard_derivatives"),H&&rt.get("EXT_frag_depth"),zt.clearColor(0,0,0,1),zt.clearDepth(1),zt.clearStencil(0),zt.enable(zt.DEPTH_TEST),zt.depthFunc(zt.LEQUAL),zt.frontFace(zt.CCW),zt.cullFace(zt.BACK),zt.enable(zt.CULL_FACE),zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA),zt.viewport(k,O,I,G),zt.clearColor(h.r,h.g,h.b,l);var it,nt=(this.context=zt).getParameter(zt.MAX_TEXTURE_IMAGE_UNITS),at=zt.getParameter(zt.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ot=zt.getParameter(zt.MAX_TEXTURE_SIZE),st=zt.getParameter(zt.MAX_CUBE_MAP_TEXTURE_SIZE),ht=0<at,lt=ht&&rt.get("OES_texture_float"),ut=zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.HIGH_FLOAT),ct=zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.MEDIUM_FLOAT),ft=(zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.LOW_FLOAT),zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.HIGH_FLOAT)),dt=zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.MEDIUM_FLOAT),pt=(zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.LOW_FLOAT),function(){if(void 0!==it)return it;if(it=[],rt.get("WEBGL_compressed_texture_pvrtc")||rt.get("WEBGL_compressed_texture_s3tc"))for(var t=zt.getParameter(zt.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)it.push(t[e]);return it}),Et=0<ut.precision&&0<ft.precision,mt=0<ct.precision&&0<dt.precision;"highp"!==_||Et||(mt?(_="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(_="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==_||mt||(_="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var gt,vt=new THREE.ShadowMapPlugin(this,c,E,m),Tt=new THREE.SpritePlugin(this,p),xt=new THREE.LensFlarePlugin(this,g);function yt(t){var e,r;if(t.__webglVertexBuffer=zt.createBuffer(),t.__webglNormalBuffer=zt.createBuffer(),t.__webglTangentBuffer=zt.createBuffer(),t.__webglColorBuffer=zt.createBuffer(),t.__webglUVBuffer=zt.createBuffer(),t.__webglUV2Buffer=zt.createBuffer(),t.__webglSkinIndicesBuffer=zt.createBuffer(),t.__webglSkinWeightsBuffer=zt.createBuffer(),t.__webglFaceBuffer=zt.createBuffer(),t.__webglLineBuffer=zt.createBuffer(),t.numMorphTargets)for(t.__webglMorphTargetsBuffers=[],e=0,r=t.numMorphTargets;e<r;e++)t.__webglMorphTargetsBuffers.push(zt.createBuffer());if(t.numMorphNormals)for(t.__webglMorphNormalsBuffers=[],e=0,r=t.numMorphNormals;e<r;e++)t.__webglMorphNormalsBuffers.push(zt.createBuffer());V.info.memory.geometries++}this.getContext=function(){return zt},this.supportsVertexTextures=function(){return ht},this.supportsFloatTextures=function(){return rt.get("OES_texture_float")},this.supportsStandardDerivatives=function(){return rt.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return rt.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return rt.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return rt.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){if(void 0!==gt)return gt;var t=rt.get("EXT_texture_filter_anisotropic");return gt=null!==t?zt.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return _},this.setSize=function(t,e,r){R.width=t*this.devicePixelRatio,R.height=e*this.devicePixelRatio,!1!==r&&(R.style.width=t+"px",R.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){k=t*this.devicePixelRatio,O=e*this.devicePixelRatio,I=r*this.devicePixelRatio,G=i*this.devicePixelRatio,zt.viewport(k,O,I,G)},this.setScissor=function(t,e,r,i){zt.scissor(t*this.devicePixelRatio,e*this.devicePixelRatio,r*this.devicePixelRatio,i*this.devicePixelRatio)},this.enableScissorTest=function(t){t?zt.enable(zt.SCISSOR_TEST):zt.disable(zt.SCISSOR_TEST)},this.setClearColor=function(t,e){h.set(t),l=void 0!==e?e:1,zt.clearColor(h.r,h.g,h.b,l)},this.setClearColorHex=function(t,e){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(t,e)},this.getClearColor=function(){return h},this.getClearAlpha=function(){return l},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=zt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=zt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=zt.STENCIL_BUFFER_BIT),zt.clear(i)},this.clearColor=function(){zt.clear(zt.COLOR_BUFFER_BIT)},this.clearDepth=function(){zt.clear(zt.DEPTH_BUFFER_BIT)},this.clearStencil=function(){zt.clear(zt.STENCIL_BUFFER_BIT)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=function(){w=T=x=u=P=F=y=-1,$=!(S=M=null)};var Rt=function(t){t.target.traverse(function(t){t.removeEventListener("remove",Rt),function(t){t instanceof THREE.Mesh||t instanceof THREE.PointCloud||t instanceof THREE.Line?delete E[t.id]:(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&function(t,e){for(var r=t.length-1;0<=r;r--)t[r].object===e&&t.splice(r,1)}(m,t);delete t.__webglInit,delete t._modelViewMatrix,delete t._normalMatrix,delete t.__webglActive}(t)})},_t=function(t){var e=t.target;e.removeEventListener("dispose",_t),St(e)},Ht=function(t){var e=t.target;e.removeEventListener("dispose",Ht),At(e),V.info.memory.textures--},bt=function(t){var e=t.target;e.removeEventListener("dispose",bt),Ct(e),V.info.memory.textures--},Mt=function(t){var e=t.target;e.removeEventListener("dispose",Mt),Dt(e)},wt=function(t){for(var e=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],r=0,i=e.length;r<i;r++){void 0!==t[n=e[r]]&&(zt.deleteBuffer(t[n]),delete t[n])}if(void 0!==t.__webglCustomAttributesList){for(var n in t.__webglCustomAttributesList)zt.deleteBuffer(t.__webglCustomAttributesList[n].buffer);delete t.__webglCustomAttributesList}V.info.memory.geometries--},St=function(t){if(delete t.__webglInit,t instanceof THREE.BufferGeometry){for(var e in t.attributes){var r=t.attributes[e];void 0!==r.buffer&&(zt.deleteBuffer(r.buffer),delete r.buffer)}V.info.memory.geometries--}else{var i=qt[t.id];if(void 0!==i){for(var n=0,a=i.length;n<a;n++){var o=i[n];if(void 0!==o.numMorphTargets){for(var s=0,h=o.numMorphTargets;s<h;s++)zt.deleteBuffer(o.__webglMorphTargetsBuffers[s]);delete o.__webglMorphTargetsBuffers}if(void 0!==o.numMorphNormals){for(s=0,h=o.numMorphNormals;s<h;s++)zt.deleteBuffer(o.__webglMorphNormalsBuffers[s]);delete o.__webglMorphNormalsBuffers}wt(o)}delete qt[t.id]}else wt(t)}T=-1},At=function(t){if(t.image&&t.image.__webglTextureCube)zt.deleteTexture(t.image.__webglTextureCube),delete t.image.__webglTextureCube;else{if(void 0===t.__webglInit)return;zt.deleteTexture(t.__webglTexture),delete t.__webglTexture,delete t.__webglInit}},Ct=function(t){if(t&&void 0!==t.__webglTexture){if(zt.deleteTexture(t.__webglTexture),delete t.__webglTexture,t instanceof THREE.WebGLRenderTargetCube)for(var e=0;e<6;e++)zt.deleteFramebuffer(t.__webglFramebuffer[e]),zt.deleteRenderbuffer(t.__webglRenderbuffer[e]);else zt.deleteFramebuffer(t.__webglFramebuffer),zt.deleteRenderbuffer(t.__webglRenderbuffer);delete t.__webglFramebuffer,delete t.__webglRenderbuffer}},Dt=function(t){var e=t.program.program;if(void 0!==e){var r,i,n;t.program=void 0;var a=!1;for(r=0,i=b.length;r<i;r++)if((n=b[r]).program===e){n.usedTimes--,0===n.usedTimes&&(a=!0);break}if(!0===a){var o=[];for(r=0,i=b.length;r<i;r++)(n=b[r]).program!==e&&o.push(n);b=o,zt.deleteProgram(e),V.info.memory.programs--}}};function Lt(t){var e=t.geometry,r=t.material,i=e.vertices.length;if(r.attributes)for(var n in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),r.attributes){var a=r.attributes[n];if(!a.__webglInitialized||a.createUniqueBuffers){a.__webglInitialized=!0;var o=1;"v2"===a.type?o=2:"v3"===a.type?o=3:"v4"===a.type?o=4:"c"===a.type&&(o=3),a.size=o,a.array=new Float32Array(i*o),a.buffer=zt.createBuffer(),a.buffer.belongsToAttribute=n,a.needsUpdate=!0}e.__webglCustomAttributesList.push(a)}}function Ft(t,e){var r=e.geometry,i=t.faces3,n=3*i.length,a=1*i.length,o=3*i.length,s=Pt(e,t);t.__vertexArray=new Float32Array(3*n),t.__normalArray=new Float32Array(3*n),t.__colorArray=new Float32Array(3*n),t.__uvArray=new Float32Array(2*n),1<r.faceVertexUvs.length&&(t.__uv2Array=new Float32Array(2*n)),r.hasTangents&&(t.__tangentArray=new Float32Array(4*n)),e.geometry.skinWeights.length&&e.geometry.skinIndices.length&&(t.__skinIndexArray=new Float32Array(4*n),t.__skinWeightArray=new Float32Array(4*n));var h,l,u=null!==rt.get("OES_element_index_uint")&&21845<a?Uint32Array:Uint16Array;if(t.__typeArray=u,t.__faceArray=new u(3*a),t.__lineArray=new u(2*o),t.numMorphTargets)for(t.__morphTargetsArrays=[],h=0,l=t.numMorphTargets;h<l;h++)t.__morphTargetsArrays.push(new Float32Array(3*n));if(t.numMorphNormals)for(t.__morphNormalsArrays=[],h=0,l=t.numMorphNormals;h<l;h++)t.__morphNormalsArrays.push(new Float32Array(3*n));if(t.__webglFaceCount=3*a,t.__webglLineCount=2*o,s.attributes)for(var c in void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]),s.attributes){var f=s.attributes[c],d={};for(var p in f)d[p]=f[p];if(!d.__webglInitialized||d.createUniqueBuffers){d.__webglInitialized=!0;var E=1;"v2"===d.type?E=2:"v3"===d.type?E=3:"v4"===d.type?E=4:"c"===d.type&&(E=3),d.size=E,d.array=new Float32Array(n*E),d.buffer=zt.createBuffer(),d.buffer.belongsToAttribute=c,f.needsUpdate=!0,d.__original=f}t.__webglCustomAttributesList.push(d)}t.__inittedArrays=!0}function Pt(t,e){return t.material instanceof THREE.MeshFaceMaterial?t.material.materials[e.materialIndex]:t.material}function Ut(t,e,r,i,n){if(t.__inittedArrays){var a,o,s,h,l,u,c,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w,S,A,C,D,L,F,P,U,B,z,N,k,V,O,I,G,W,X,j,Y=(a=n)&&void 0!==a.shading&&a.shading===THREE.SmoothShading,q=0,K=0,Z=0,Q=0,J=0,$=0,tt=0,et=0,rt=0,it=0,nt=0,at=0,ot=t.__vertexArray,st=t.__uvArray,ht=t.__uv2Array,lt=t.__normalArray,ut=t.__tangentArray,ct=t.__colorArray,ft=t.__skinIndexArray,dt=t.__skinWeightArray,pt=t.__morphTargetsArrays,Et=t.__morphNormalsArrays,mt=t.__webglCustomAttributesList,gt=t.__faceArray,vt=t.__lineArray,Tt=e.geometry,xt=Tt.verticesNeedUpdate,yt=Tt.elementsNeedUpdate,Rt=Tt.uvsNeedUpdate,_t=Tt.normalsNeedUpdate,Ht=Tt.tangentsNeedUpdate,bt=Tt.colorsNeedUpdate,Mt=Tt.morphTargetsNeedUpdate,wt=Tt.vertices,St=t.faces3,At=Tt.faces,Ct=Tt.faceVertexUvs[0],Dt=Tt.faceVertexUvs[1],Lt=(Tt.colors,Tt.skinIndices),Ft=Tt.skinWeights,Pt=Tt.morphTargets,Ut=Tt.morphNormals;if(xt){for(o=0,s=St.length;o<s;o++)m=wt[(h=At[St[o]]).a],g=wt[h.b],v=wt[h.c],ot[K]=m.x,ot[K+1]=m.y,ot[K+2]=m.z,ot[K+3]=g.x,ot[K+4]=g.y,ot[K+5]=g.z,ot[K+6]=v.x,ot[K+7]=v.y,ot[K+8]=v.z,K+=9;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,ot,r)}if(Mt)for(k=0,V=Pt.length;k<V;k++){for(o=nt=0,s=St.length;o<s;o++)h=At[G=St[o]],m=Pt[k].vertices[h.a],g=Pt[k].vertices[h.b],v=Pt[k].vertices[h.c],(O=pt[k])[nt]=m.x,O[nt+1]=m.y,O[nt+2]=m.z,O[nt+3]=g.x,O[nt+4]=g.y,O[nt+5]=g.z,O[nt+6]=v.x,O[nt+7]=v.y,O[nt+8]=v.z,n.morphNormals&&(Y?(R=(W=Ut[k].vertexNormals[G]).a,_=W.b,H=W.c):H=_=R=Ut[k].faceNormals[G],(I=Et[k])[nt]=R.x,I[nt+1]=R.y,I[nt+2]=R.z,I[nt+3]=_.x,I[nt+4]=_.y,I[nt+5]=_.z,I[nt+6]=H.x,I[nt+7]=H.y,I[nt+8]=H.z),nt+=9;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[k]),zt.bufferData(zt.ARRAY_BUFFER,pt[k],r),n.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[k]),zt.bufferData(zt.ARRAY_BUFFER,Et[k],r))}if(Ft.length){for(o=0,s=St.length;o<s;o++)S=Ft[(h=At[St[o]]).a],A=Ft[h.b],C=Ft[h.c],dt[it]=S.x,dt[it+1]=S.y,dt[it+2]=S.z,dt[it+3]=S.w,dt[it+4]=A.x,dt[it+5]=A.y,dt[it+6]=A.z,dt[it+7]=A.w,dt[it+8]=C.x,dt[it+9]=C.y,dt[it+10]=C.z,dt[it+11]=C.w,D=Lt[h.a],L=Lt[h.b],F=Lt[h.c],ft[it]=D.x,ft[it+1]=D.y,ft[it+2]=D.z,ft[it+3]=D.w,ft[it+4]=L.x,ft[it+5]=L.y,ft[it+6]=L.z,ft[it+7]=L.w,ft[it+8]=F.x,ft[it+9]=F.y,ft[it+10]=F.z,ft[it+11]=F.w,it+=12;0<it&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),zt.bufferData(zt.ARRAY_BUFFER,ft,r),zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),zt.bufferData(zt.ARRAY_BUFFER,dt,r))}if(bt){for(o=0,s=St.length;o<s;o++)c=(h=At[St[o]]).vertexColors,f=h.color,3===c.length&&n.vertexColors===THREE.VertexColors?(b=c[0],M=c[1],w=c[2]):w=M=b=f,ct[rt]=b.r,ct[rt+1]=b.g,ct[rt+2]=b.b,ct[rt+3]=M.r,ct[rt+4]=M.g,ct[rt+5]=M.b,ct[rt+6]=w.r,ct[rt+7]=w.g,ct[rt+8]=w.b,rt+=9;0<rt&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,ct,r))}if(Ht&&Tt.hasTangents){for(o=0,s=St.length;o<s;o++)T=(d=(h=At[St[o]]).vertexTangents)[0],x=d[1],y=d[2],ut[tt]=T.x,ut[tt+1]=T.y,ut[tt+2]=T.z,ut[tt+3]=T.w,ut[tt+4]=x.x,ut[tt+5]=x.y,ut[tt+6]=x.z,ut[tt+7]=x.w,ut[tt+8]=y.x,ut[tt+9]=y.y,ut[tt+10]=y.z,ut[tt+11]=y.w,tt+=12;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglTangentBuffer),zt.bufferData(zt.ARRAY_BUFFER,ut,r)}if(_t){for(o=0,s=St.length;o<s;o++)if(l=(h=At[St[o]]).vertexNormals,u=h.normal,3===l.length&&Y)for(P=0;P<3;P++)B=l[P],lt[$]=B.x,lt[$+1]=B.y,lt[$+2]=B.z,$+=3;else for(P=0;P<3;P++)lt[$]=u.x,lt[$+1]=u.y,lt[$+2]=u.z,$+=3;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglNormalBuffer),zt.bufferData(zt.ARRAY_BUFFER,lt,r)}if(Rt&&Ct){for(o=0,s=St.length;o<s;o++)if(void 0!==(p=Ct[St[o]]))for(P=0;P<3;P++)z=p[P],st[Z]=z.x,st[Z+1]=z.y,Z+=2;0<Z&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUVBuffer),zt.bufferData(zt.ARRAY_BUFFER,st,r))}if(Rt&&Dt){for(o=0,s=St.length;o<s;o++)if(void 0!==(E=Dt[St[o]]))for(P=0;P<3;P++)N=E[P],ht[Q]=N.x,ht[Q+1]=N.y,Q+=2;0<Q&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUV2Buffer),zt.bufferData(zt.ARRAY_BUFFER,ht,r))}if(yt){for(o=0,s=St.length;o<s;o++)gt[J]=q,gt[J+1]=q+1,gt[J+2]=q+2,J+=3,vt[et]=q,vt[et+1]=q+1,vt[et+2]=q,vt[et+3]=q+2,vt[et+4]=q+1,vt[et+5]=q+2,et+=6,q+=3;zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),zt.bufferData(zt.ELEMENT_ARRAY_BUFFER,gt,r),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),zt.bufferData(zt.ELEMENT_ARRAY_BUFFER,vt,r)}if(mt)for(P=0,U=mt.length;P<U;P++)if((j=mt[P]).__original.needsUpdate){if(at=0,1===j.size){if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],j.array[at]=j.value[h.a],j.array[at+1]=j.value[h.b],j.array[at+2]=j.value[h.c],at+=3;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)X=j.value[St[o]],j.array[at]=X,j.array[at+1]=X,j.array[at+2]=X,at+=3}else if(2===j.size){if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=g.x,j.array[at+3]=g.y,j.array[at+4]=v.x,j.array[at+5]=v.y,at+=6;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=g.x,j.array[at+3]=g.y,j.array[at+4]=v.x,j.array[at+5]=v.y,at+=6}else if(3===j.size){var Bt;if(Bt="c"===j.type?["r","g","b"]:["x","y","z"],void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9;else if("faceVertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)m=(X=j.value[St[o]])[0],g=X[1],v=X[2],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9}else if(4===j.size)if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;else if("faceVertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)m=(X=j.value[St[o]])[0],g=X[1],v=X[2],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;zt.bindBuffer(zt.ARRAY_BUFFER,j.buffer),zt.bufferData(zt.ARRAY_BUFFER,j.array,r)}i&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}}function Bt(t,e,r,i){for(var n=r.attributes,a=e.attributes,o=e.attributesKeys,s=0,h=o.length;s<h;s++){var l=o[s],u=a[l];if(0<=u){var c=n[l];if(void 0!==c){var f=c.itemSize;zt.bindBuffer(zt.ARRAY_BUFFER,c.buffer),kt(u),zt.vertexAttribPointer(u,f,zt.FLOAT,!1,0,i*f*4)}else void 0!==t.defaultAttributeValues&&(2===t.defaultAttributeValues[l].length?zt.vertexAttrib2fv(u,t.defaultAttributeValues[l]):3===t.defaultAttributeValues[l].length&&zt.vertexAttrib3fv(u,t.defaultAttributeValues[l]))}}Vt()}function Nt(){for(var t=0,e=j.length;t<e;t++)j[t]=0}function kt(t){j[t]=1,0===Y[t]&&(zt.enableVertexAttribArray(t),Y[t]=1)}function Vt(){for(var t=0,e=Y.length;t<e;t++)Y[t]!==j[t]&&(zt.disableVertexAttribArray(t),Y[t]=0)}function Ot(t,e){return t.material.id!==e.material.id?e.material.id-t.material.id:t.z!==e.z?e.z-t.z:t.id-e.id}function It(t,e){return t.z!==e.z?t.z-e.z:t.id-e.id}function Gt(t,e){return e[0]-t[0]}function Wt(t,e,r,i,n,a){for(var o,s=t.length-1;-1!==s;s--){var h=t[s],l=h.object,u=h.buffer;if(ae(l,e),a)o=a;else{if(!(o=h.material))continue;n&&V.setBlending(o.blending,o.blendEquation,o.blendSrc,o.blendDst),V.setDepthTest(o.depthTest),V.setDepthWrite(o.depthWrite),le(o.polygonOffset,o.polygonOffsetFactor,o.polygonOffsetUnits)}V.setMaterialFaces(o),u instanceof THREE.BufferGeometry?V.renderBufferDirect(e,r,i,o,u,l):V.renderBuffer(e,r,i,o,u,l)}}function Xt(t,e,r,i,n,a,o){for(var s,h=0,l=t.length;h<l;h++){var u=t[h],c=u.object;if(c.visible){if(o)s=o;else{if(!(s=u[e]))continue;a&&V.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst),V.setDepthTest(s.depthTest),V.setDepthWrite(s.depthWrite),le(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits)}V.renderImmediateObject(r,i,n,s,c)}}}function jt(t){var e=t.object.material;e.transparent?(t.transparent=e,t.opaque=null):(t.opaque=e,t.transparent=null)}function Yt(t){var e=t.object,r=t.buffer,i=e.geometry,n=e.material;if(n instanceof THREE.MeshFaceMaterial){var a=i instanceof THREE.BufferGeometry?0:r.materialIndex;n=n.materials[a],(t.material=n).transparent?d.push(t):f.push(t)}else n&&((t.material=n).transparent?d.push(t):f.push(t))}this.renderBufferImmediate=function(t,e,r){if(Nt(),t.hasPositions&&!t.__webglVertexBuffer&&(t.__webglVertexBuffer=zt.createBuffer()),t.hasNormals&&!t.__webglNormalBuffer&&(t.__webglNormalBuffer=zt.createBuffer()),t.hasUvs&&!t.__webglUvBuffer&&(t.__webglUvBuffer=zt.createBuffer()),t.hasColors&&!t.__webglColorBuffer&&(t.__webglColorBuffer=zt.createBuffer()),t.hasPositions&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.positionArray,zt.DYNAMIC_DRAW),kt(e.attributes.position),zt.vertexAttribPointer(e.attributes.position,3,zt.FLOAT,!1,0,0)),t.hasNormals){if(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglNormalBuffer),r.shading===THREE.FlatShading){var i,n,a,o,s,h,l,u,c,f,d,p=3*t.count;for(d=0;d<p;d+=9)o=(f=t.normalArray)[d],h=f[d+1],u=f[d+2],s=f[d+3],l=f[d+4],c=f[d+5],i=(o+s+f[d+6])/3,n=(h+l+f[d+7])/3,a=(u+c+f[d+8])/3,f[d]=i,f[d+1]=n,f[d+2]=a,f[d+3]=i,f[d+4]=n,f[d+5]=a,f[d+6]=i,f[d+7]=n,f[d+8]=a}zt.bufferData(zt.ARRAY_BUFFER,t.normalArray,zt.DYNAMIC_DRAW),kt(e.attributes.normal),zt.vertexAttribPointer(e.attributes.normal,3,zt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUvBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.uvArray,zt.DYNAMIC_DRAW),kt(e.attributes.uv),zt.vertexAttribPointer(e.attributes.uv,2,zt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==THREE.NoColors&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.colorArray,zt.DYNAMIC_DRAW),kt(e.attributes.color),zt.vertexAttribPointer(e.attributes.color,3,zt.FLOAT,!1,0,0)),Vt(),zt.drawArrays(zt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,a){if(!1!==i.visible){var o=ee(t,e,r,i,a),s=!1,h=i.wireframe?1:0,l=16777215*n.id+2*o.id+h;if(l!==T&&(T=l,s=!0),s&&Nt(),a instanceof THREE.Mesh){var u=!0===i.wireframe?zt.LINES:zt.TRIANGLES;if(E=n.attributes.index){if(E.array instanceof Uint32Array&&rt.get("OES_element_index_uint")?(m=zt.UNSIGNED_INT,g=4):(m=zt.UNSIGNED_SHORT,g=2),0===(v=n.offsets).length)s&&(Bt(i,o,n,0),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(u,E.array.length,m,0),V.info.render.calls++,V.info.render.vertices+=E.array.length,V.info.render.faces+=E.array.length/3;else{s=!0;for(var c=0,f=v.length;c<f;c++){var d=v[c].index;s&&(Bt(i,o,n,d),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(u,v[c].count,m,v[c].start*g),V.info.render.calls++,V.info.render.vertices+=v[c].count,V.info.render.faces+=v[c].count/3}}}else{s&&Bt(i,o,n,0);var p=n.attributes.position;zt.drawArrays(u,0,p.array.length/3),V.info.render.calls++,V.info.render.vertices+=p.array.length/3,V.info.render.faces+=p.array.length/9}}else if(a instanceof THREE.PointCloud){s&&Bt(i,o,n,0);p=n.attributes.position;zt.drawArrays(zt.POINTS,0,p.array.length/3),V.info.render.calls++,V.info.render.points+=p.array.length/3}else if(a instanceof THREE.Line){var E;u=a.mode===THREE.LineStrip?zt.LINE_STRIP:zt.LINES;if(he(i.linewidth),E=n.attributes.index){var m,g,v;if(E.array instanceof Uint32Array?(m=zt.UNSIGNED_INT,g=4):(m=zt.UNSIGNED_SHORT,g=2),0===(v=n.offsets).length)s&&(Bt(i,o,n,0),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(u,E.array.length,m,0),V.info.render.calls++,V.info.render.vertices+=E.array.length;else{1<v.length&&(s=!0);for(c=0,f=v.length;c<f;c++){d=v[c].index;s&&(Bt(i,o,n,d),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(u,v[c].count,m,v[c].start*g),V.info.render.calls++,V.info.render.vertices+=v[c].count}}}else{s&&Bt(i,o,n,0);p=n.attributes.position;zt.drawArrays(u,0,p.array.length/3),V.info.render.calls++,V.info.render.points+=p.array.length/3}}}},this.renderBuffer=function(t,e,r,i,n,a){if(!1!==i.visible){var o=ee(t,e,r,i,a),s=o.attributes,h=!1,l=i.wireframe?1:0,u=16777215*n.id+2*o.id+l;if(u!==T&&(T=u,h=!0),h&&Nt(),!i.morphTargets&&0<=s.position?h&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglVertexBuffer),kt(s.position),zt.vertexAttribPointer(s.position,3,zt.FLOAT,!1,0,0)):a.morphTargetBase&&function(t,e,r){var i=t.program.attributes;-1!==r.morphTargetBase&&0<=i.position?(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r.morphTargetBase]),kt(i.position),zt.vertexAttribPointer(i.position,3,zt.FLOAT,!1,0,0)):0<=i.position&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglVertexBuffer),kt(i.position),zt.vertexAttribPointer(i.position,3,zt.FLOAT,!1,0,0));if(r.morphTargetForcedOrder.length)for(var n=0,a=r.morphTargetForcedOrder,o=r.morphTargetInfluences;n<t.numSupportedMorphTargets&&n<a.length;)0<=i["morphTarget"+n]&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[a[n]]),kt(i["morphTarget"+n]),zt.vertexAttribPointer(i["morphTarget"+n],3,zt.FLOAT,!1,0,0)),0<=i["morphNormal"+n]&&t.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[a[n]]),kt(i["morphNormal"+n]),zt.vertexAttribPointer(i["morphNormal"+n],3,zt.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[n]=o[a[n]],n++;else{var s,h,l=[],o=r.morphTargetInfluences,u=o.length;for(h=0;h<u;h++)0<(s=o[h])&&l.push([s,h]);l.length>t.numSupportedMorphTargets?(l.sort(Gt),l.length=t.numSupportedMorphTargets):l.length>t.numSupportedMorphNormals?l.sort(Gt):0===l.length&&l.push([0,0]);for(var c,n=0;n<t.numSupportedMorphTargets;)l[n]?(c=l[n][1],0<=i["morphTarget"+n]&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[c]),kt(i["morphTarget"+n]),zt.vertexAttribPointer(i["morphTarget"+n],3,zt.FLOAT,!1,0,0)),0<=i["morphNormal"+n]&&t.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[c]),kt(i["morphNormal"+n]),zt.vertexAttribPointer(i["morphNormal"+n],3,zt.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[n]=o[c]):r.__webglMorphTargetInfluences[n]=0,n++}null!==t.program.uniforms.morphTargetInfluences&&zt.uniform1fv(t.program.uniforms.morphTargetInfluences,r.__webglMorphTargetInfluences)}(i,n,a),h){if(n.__webglCustomAttributesList)for(var c=0,f=n.__webglCustomAttributesList.length;c<f;c++){var d=n.__webglCustomAttributesList[c];0<=s[d.buffer.belongsToAttribute]&&(zt.bindBuffer(zt.ARRAY_BUFFER,d.buffer),kt(s[d.buffer.belongsToAttribute]),zt.vertexAttribPointer(s[d.buffer.belongsToAttribute],d.size,zt.FLOAT,!1,0,0))}0<=s.color&&(0<a.geometry.colors.length||0<a.geometry.faces.length?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglColorBuffer),kt(s.color),zt.vertexAttribPointer(s.color,3,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib3fv(s.color,i.defaultAttributeValues.color)),0<=s.normal&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglNormalBuffer),kt(s.normal),zt.vertexAttribPointer(s.normal,3,zt.FLOAT,!1,0,0)),0<=s.tangent&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglTangentBuffer),kt(s.tangent),zt.vertexAttribPointer(s.tangent,4,zt.FLOAT,!1,0,0)),0<=s.uv&&(a.geometry.faceVertexUvs[0]?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglUVBuffer),kt(s.uv),zt.vertexAttribPointer(s.uv,2,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib2fv(s.uv,i.defaultAttributeValues.uv)),0<=s.uv2&&(a.geometry.faceVertexUvs[1]?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglUV2Buffer),kt(s.uv2),zt.vertexAttribPointer(s.uv2,2,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib2fv(s.uv2,i.defaultAttributeValues.uv2)),i.skinning&&0<=s.skinIndex&&0<=s.skinWeight&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),kt(s.skinIndex),zt.vertexAttribPointer(s.skinIndex,4,zt.FLOAT,!1,0,0),zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),kt(s.skinWeight),zt.vertexAttribPointer(s.skinWeight,4,zt.FLOAT,!1,0,0)),0<=s.lineDistance&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglLineDistanceBuffer),kt(s.lineDistance),zt.vertexAttribPointer(s.lineDistance,1,zt.FLOAT,!1,0,0))}if(Vt(),a instanceof THREE.Mesh){var p=n.__typeArray===Uint32Array?zt.UNSIGNED_INT:zt.UNSIGNED_SHORT;i.wireframe?(he(i.wireframeLinewidth),h&&zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),zt.drawElements(zt.LINES,n.__webglLineCount,p,0)):(h&&zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),zt.drawElements(zt.TRIANGLES,n.__webglFaceCount,p,0)),V.info.render.calls++,V.info.render.vertices+=n.__webglFaceCount,V.info.render.faces+=n.__webglFaceCount/3}else if(a instanceof THREE.Line){var E=a.mode===THREE.LineStrip?zt.LINE_STRIP:zt.LINES;he(i.linewidth),zt.drawArrays(E,0,n.__webglLineCount),V.info.render.calls++}else a instanceof THREE.PointCloud&&(zt.drawArrays(zt.POINTS,0,n.__webglParticleCount),V.info.render.calls++,V.info.render.points+=n.__webglParticleCount)}},this.render=function(t,e,r,i){if(e instanceof THREE.Camera!=!1){var n,a=t.fog;w=T=-1,($=!(S=null))===t.autoUpdate&&t.updateMatrixWorld(),void 0===e.parent&&e.updateMatrixWorld(),t.traverse(function(t){t instanceof THREE.SkinnedMesh&&t.skeleton.update()}),e.matrixWorldInverse.getInverse(e.matrixWorld),K.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),q.setFromMatrix(K),c.length=0,f.length=0,d.length=0,p.length=0,g.length=0,function t(e,r){if(!1===r.visible)return;if(r instanceof THREE.Scene||r instanceof THREE.Group);else if(function(t,e){void 0===t.__webglInit&&(t.__webglInit=!0,t._modelViewMatrix=new THREE.Matrix4,t._normalMatrix=new THREE.Matrix3,t.addEventListener("removed",Rt));var r=t.geometry;void 0===r||void 0===r.__webglInit&&(r.__webglInit=!0,r.addEventListener("dispose",_t),r instanceof THREE.BufferGeometry||(t instanceof THREE.Mesh?Zt(e,t,r):t instanceof THREE.Line?void 0===r.__webglVertexBuffer&&((u=r).__webglVertexBuffer=zt.createBuffer(),u.__webglColorBuffer=zt.createBuffer(),u.__webglLineDistanceBuffer=zt.createBuffer(),V.info.memory.geometries++,h=t,l=(s=r).vertices.length,s.__vertexArray=new Float32Array(3*l),s.__colorArray=new Float32Array(3*l),s.__lineDistanceArray=new Float32Array(1*l),s.__webglLineCount=l,Lt(h),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0,r.lineDistancesNeedUpdate=!0):t instanceof THREE.PointCloud&&void 0===r.__webglVertexBuffer&&((o=r).__webglVertexBuffer=zt.createBuffer(),o.__webglColorBuffer=zt.createBuffer(),V.info.memory.geometries++,n=t,a=(i=r).vertices.length,i.__vertexArray=new Float32Array(3*a),i.__colorArray=new Float32Array(3*a),i.__sortArray=[],i.__webglParticleCount=a,Lt(n),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0)));var i,n,a;var o;var s,h,l;var u;if(void 0===t.__webglActive)if(t.__webglActive=!0,t instanceof THREE.Mesh){if(r instanceof THREE.BufferGeometry)Qt(E,r,t);else if(r instanceof THREE.Geometry)for(var c=qt[r.id],f=0,d=c.length;f<d;f++)Qt(E,c[f],t)}else t instanceof THREE.Line||t instanceof THREE.PointCloud?Qt(E,r,t):(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&(p=t,m.push({id:null,object:p,opaque:null,transparent:null,z:0}));var p}(r,e),r instanceof THREE.Light)c.push(r);else if(r instanceof THREE.Sprite)p.push(r);else if(r instanceof THREE.LensFlare)g.push(r);else{var i=E[r.id];if(i&&(!1===r.frustumCulled||!0===q.intersectsObject(r))){!function(t,e){var r,i,n=t.geometry;if(n instanceof THREE.BufferGeometry)!function(t){for(var e=t.attributes,r=t.attributesKeys,i=0,n=r.length;i<n;i++){var a=r[i],o=e[a];if(void 0===o.buffer&&(o.buffer=zt.createBuffer(),o.needsUpdate=!0),!0===o.needsUpdate){var s="index"===a?zt.ELEMENT_ARRAY_BUFFER:zt.ARRAY_BUFFER;zt.bindBuffer(s,o.buffer),zt.bufferData(s,o.array,zt.STATIC_DRAW),o.needsUpdate=!1}}}(n);else if(t instanceof THREE.Mesh){!0===n.groupsNeedUpdate&&Zt(e,t,n);for(var a=qt[n.id],o=0,s=a.length;o<s;o++){var h=a[o];i=Pt(t,h),!0===n.groupsNeedUpdate&&Ft(h,t),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.morphTargetsNeedUpdate||n.elementsNeedUpdate||n.uvsNeedUpdate||n.normalsNeedUpdate||n.colorsNeedUpdate||n.tangentsNeedUpdate||r)&&Ut(h,t,zt.DYNAMIC_DRAW,!n.dynamic,i)}n.verticesNeedUpdate=!1,n.morphTargetsNeedUpdate=!1,n.elementsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.tangentsNeedUpdate=!1,i.attributes&&$t(i)}else t instanceof THREE.Line?(i=Pt(t,n),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||n.lineDistancesNeedUpdate||r)&&function(t,e){var r,i,n,a,o,s,h,l,u,c,f,d,p=t.vertices,E=t.colors,m=t.lineDistances,g=p.length,v=E.length,T=m.length,x=t.__vertexArray,y=t.__colorArray,R=t.__lineDistanceArray,_=t.verticesNeedUpdate,H=t.colorsNeedUpdate,b=t.lineDistancesNeedUpdate,M=t.__webglCustomAttributesList;if(_){for(r=0;r<g;r++)a=p[r],x[o=3*r]=a.x,x[o+1]=a.y,x[o+2]=a.z;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,x,e)}if(H){for(i=0;i<v;i++)s=E[i],y[o=3*i]=s.r,y[o+1]=s.g,y[o+2]=s.b;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,y,e)}if(b){for(n=0;n<T;n++)R[n]=m[n];zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglLineDistanceBuffer),zt.bufferData(zt.ARRAY_BUFFER,R,e)}if(M)for(h=0,l=M.length;h<l;h++)if((d=M[h]).needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo)){if(o=0,c=d.value.length,1===d.size)for(u=0;u<c;u++)d.array[u]=d.value[u];else if(2===d.size)for(u=0;u<c;u++)f=d.value[u],d.array[o]=f.x,d.array[o+1]=f.y,o+=2;else if(3===d.size)if("c"===d.type)for(u=0;u<c;u++)f=d.value[u],d.array[o]=f.r,d.array[o+1]=f.g,d.array[o+2]=f.b,o+=3;else for(u=0;u<c;u++)f=d.value[u],d.array[o]=f.x,d.array[o+1]=f.y,d.array[o+2]=f.z,o+=3;else if(4===d.size)for(u=0;u<c;u++)f=d.value[u],d.array[o]=f.x,d.array[o+1]=f.y,d.array[o+2]=f.z,d.array[o+3]=f.w,o+=4;zt.bindBuffer(zt.ARRAY_BUFFER,d.buffer),zt.bufferData(zt.ARRAY_BUFFER,d.array,e)}}(n,zt.DYNAMIC_DRAW),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,n.lineDistancesNeedUpdate=!1,i.attributes&&$t(i)):t instanceof THREE.PointCloud&&(i=Pt(t,n),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||t.sortParticles||r)&&function(t,e,r){var i,n,a,o,s,h,l,u,c,f,d,p,E=t.vertices,m=E.length,g=t.colors,v=g.length,T=t.__vertexArray,x=t.__colorArray,y=t.__sortArray,R=t.verticesNeedUpdate,_=(t.elementsNeedUpdate,t.colorsNeedUpdate),H=t.__webglCustomAttributesList;if(r.sortParticles){for(Z.copy(K),Z.multiply(r.matrixWorld),i=0;i<m;i++)a=E[i],Q.copy(a),Q.applyProjection(Z),y[i]=[Q.z,i];for(y.sort(Gt),i=0;i<m;i++)a=E[y[i][1]],T[o=3*i]=a.x,T[o+1]=a.y,T[o+2]=a.z;for(n=0;n<v;n++)o=3*n,h=g[y[n][1]],x[o]=h.r,x[o+1]=h.g,x[o+2]=h.b;if(H)for(l=0,u=H.length;l<u;l++)if(void 0===(p=H[l]).boundTo||"vertices"===p.boundTo)if(o=0,f=p.value.length,1===p.size)for(c=0;c<f;c++)s=y[c][1],p.array[c]=p.value[s];else if(2===p.size)for(c=0;c<f;c++)s=y[c][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,o+=2;else if(3===p.size)if("c"===p.type)for(c=0;c<f;c++)s=y[c][1],d=p.value[s],p.array[o]=d.r,p.array[o+1]=d.g,p.array[o+2]=d.b,o+=3;else for(c=0;c<f;c++)s=y[c][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,o+=3;else if(4===p.size)for(c=0;c<f;c++)s=y[c][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,p.array[o+3]=d.w,o+=4}else{if(R)for(i=0;i<m;i++)a=E[i],T[o=3*i]=a.x,T[o+1]=a.y,T[o+2]=a.z;if(_)for(n=0;n<v;n++)h=g[n],x[o=3*n]=h.r,x[o+1]=h.g,x[o+2]=h.b;if(H)for(l=0,u=H.length;l<u;l++)if((p=H[l]).needsUpdate&&(void 0===p.boundTo||"vertices"===p.boundTo))if(f=p.value.length,o=0,1===p.size)for(c=0;c<f;c++)p.array[c]=p.value[c];else if(2===p.size)for(c=0;c<f;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,o+=2;else if(3===p.size)if("c"===p.type)for(c=0;c<f;c++)d=p.value[c],p.array[o]=d.r,p.array[o+1]=d.g,p.array[o+2]=d.b,o+=3;else for(c=0;c<f;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,o+=3;else if(4===p.size)for(c=0;c<f;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,p.array[o+3]=d.w,o+=4}if((R||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,T,e)),(_||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,x,e)),H)for(l=0,u=H.length;l<u;l++)((p=H[l]).needsUpdate||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,p.buffer),zt.bufferData(zt.ARRAY_BUFFER,p.array,e))}(n,zt.DYNAMIC_DRAW,t),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,i.attributes&&$t(i))}(r,e);for(var n=0,a=i.length;n<a;n++){var o=i[n];Yt(o),(o.render=!0)===V.sortObjects&&(null!==r.renderDepth?o.z=r.renderDepth:(Q.setFromMatrixPosition(r.matrixWorld),Q.applyProjection(K),o.z=Q.z))}}}for(var n=0,a=r.children.length;n<a;n++)t(e,r.children[n])}(t,t),!0===V.sortObjects&&(f.sort(Ot),d.sort(It)),vt.render(t,e),V.info.render.calls=0,V.info.render.vertices=0,V.info.render.faces=0,V.info.render.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var o=0,s=m.length;o<s;o++){var h=m[o],l=h.object;l.visible&&(ae(l,e),jt(h))}if(t.overrideMaterial){var u=t.overrideMaterial;this.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst),this.setDepthTest(u.depthTest),this.setDepthWrite(u.depthWrite),le(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits),Wt(f,e,c,a,!0,u),Wt(d,e,c,a,!0,u),Xt(m,"",e,c,a,!1,u)}else{u=null;this.setBlending(THREE.NoBlending),Wt(f,e,c,a,!1,u),Xt(m,"opaque",e,c,a,!1,u),Wt(d,e,c,a,!0,u),Xt(m,"transparent",e,c,a,!0,u)}Tt.render(t,e),xt.render(t,e,W,X),r&&r.generateMipmaps&&r.minFilter!==THREE.NearestFilter&&r.minFilter!==THREE.LinearFilter&&((n=r)instanceof THREE.WebGLRenderTargetCube?(zt.bindTexture(zt.TEXTURE_CUBE_MAP,n.__webglTexture),zt.generateMipmap(zt.TEXTURE_CUBE_MAP),zt.bindTexture(zt.TEXTURE_CUBE_MAP,null)):(zt.bindTexture(zt.TEXTURE_2D,n.__webglTexture),zt.generateMipmap(zt.TEXTURE_2D),zt.bindTexture(zt.TEXTURE_2D,null))),this.setDepthTest(!0),this.setDepthWrite(!0)}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.renderImmediateObject=function(t,e,r,i,n){var a=ee(t,e,r,i,n);T=-1,V.setMaterialFaces(i),n.immediateRenderCallback?n.immediateRenderCallback(a,zt,q):n.render(function(t){V.renderBufferImmediate(t,a,i)})};var qt={},Kt=0;function Zt(t,e,r){var i=e.material,n=!1;void 0!==qt[r.id]&&!0!==r.groupsNeedUpdate||(delete E[e.id],qt[r.id]=function(t,e){for(var r,i,n=rt.get("OES_element_index_uint")?4294967296:65535,a={},o=t.morphTargets.length,s=t.morphNormals.length,h={},l=[],u=0,c=t.faces.length;u<c;u++){var f=t.faces[u],d=e?f.materialIndex:0;d in a||(a[d]={hash:d,counter:0}),(r=a[d].hash+"_"+a[d].counter)in h||(i={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},h[r]=i,l.push(i)),h[r].vertices+3>n&&(a[d].counter+=1,(r=a[d].hash+"_"+a[d].counter)in h||(i={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},h[r]=i,l.push(i))),h[r].faces3.push(u),h[r].vertices+=3}return l}(r,i instanceof THREE.MeshFaceMaterial),r.groupsNeedUpdate=!1);for(var a=qt[r.id],o=0,s=a.length;o<s;o++){var h=a[o];void 0===h.__webglVertexBuffer?(yt(h),Ft(h,e),r.verticesNeedUpdate=!0,r.morphTargetsNeedUpdate=!0,r.elementsNeedUpdate=!0,r.uvsNeedUpdate=!0,r.normalsNeedUpdate=!0,r.tangentsNeedUpdate=!0,n=r.colorsNeedUpdate=!0):n=!1,(n||void 0===e.__webglActive)&&Qt(E,h,e)}e.__webglActive=!0}function Qt(t,e,r){var i=r.id;t[i]=t[i]||[],t[i].push({id:i,buffer:e,object:r,material:null,z:0})}function Jt(t){for(var e in t.attributes)if(t.attributes[e].needsUpdate)return!0;return!1}function $t(t){for(var e in t.attributes)t.attributes[e].needsUpdate=!1}function te(t,e,r,i){var n;if(t.addEventListener("dispose",Mt),t instanceof THREE.MeshDepthMaterial?n="depth":t instanceof THREE.MeshNormalMaterial?n="normal":t instanceof THREE.MeshBasicMaterial?n="basic":t instanceof THREE.MeshLambertMaterial?n="lambert":t instanceof THREE.MeshPhongMaterial?n="phong":t instanceof THREE.LineBasicMaterial?n="basic":t instanceof THREE.LineDashedMaterial?n="dashed":t instanceof THREE.PointCloudMaterial&&(n="particle_basic"),n){var a=THREE.ShaderLib[n];t.__webglShader={uniforms:THREE.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}}else t.__webglShader={uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};var o=function(t){for(var e=0,r=0,i=0,n=0,a=0,o=t.length;a<o;a++){var s=t[a];s.onlyShadow||!1===s.visible||(s instanceof THREE.DirectionalLight&&e++,s instanceof THREE.PointLight&&r++,s instanceof THREE.SpotLight&&i++,s instanceof THREE.HemisphereLight&&n++)}return{directional:e,point:r,spot:i,hemi:n}}(e),s=function(t){for(var e=0,r=0,i=t.length;r<i;r++){var n=t[r];n.castShadow&&(n instanceof THREE.SpotLight&&e++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&e++)}return e}(e),h=function(t){{if(lt&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var e=zt.getParameter(zt.MAX_VERTEX_UNIFORM_VECTORS),r=Math.floor((e-20)/4),i=r;return void 0!==t&&t instanceof THREE.SkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i))<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)"),i}}(i),l={precision:_,supportsVertexTextures:ht,map:!!t.map,envMap:!!t.envMap,lightMap:!!t.lightMap,bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,vertexColors:t.vertexColors,fog:r,useFog:t.fog,fogExp:r instanceof THREE.FogExp2,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:H,skinning:t.skinning,maxBones:h,useVertexTexture:lt&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:V.maxMorphTargets,maxMorphNormals:V.maxMorphNormals,maxDirLights:o.directional,maxPointLights:o.point,maxSpotLights:o.spot,maxHemiLights:o.hemi,maxShadows:s,shadowMapEnabled:V.shadowMapEnabled&&i.receiveShadow&&0<s,shadowMapType:V.shadowMapType,shadowMapDebug:V.shadowMapDebug,shadowMapCascade:V.shadowMapCascade,alphaTest:t.alphaTest,metal:t.metal,wrapAround:t.wrapAround,doubleSided:t.side===THREE.DoubleSide,flipSided:t.side===THREE.BackSide},u=[];if(n?u.push(n):(u.push(t.fragmentShader),u.push(t.vertexShader)),void 0!==t.defines)for(var c in t.defines)u.push(c),u.push(t.defines[c]);for(var c in l)u.push(c),u.push(l[c]);for(var f,d=u.join(),p=0,E=b.length;p<E;p++){var m=b[p];if(m.code===d){(f=m).usedTimes++;break}}void 0===f&&(f=new THREE.WebGLProgram(V,d,t,l),b.push(f),V.info.memory.programs=b.length);var g=(t.program=f).attributes;if(t.morphTargets)for(var v="morphTarget",T=t.numSupportedMorphTargets=0;T<V.maxMorphTargets;T++)0<=g[v+T]&&t.numSupportedMorphTargets++;if(t.morphNormals){v="morphNormal";for(T=t.numSupportedMorphNormals=0;T<V.maxMorphNormals;T++)0<=g[v+T]&&t.numSupportedMorphNormals++}for(var x in t.uniformsList=[],t.__webglShader.uniforms){var y=t.program.uniforms[x];y&&t.uniformsList.push([t.__webglShader.uniforms[x],y])}}function ee(t,e,r,i,n){A=0,i.needsUpdate&&(i.program&&Dt(i),te(i,e,r,n),i.needsUpdate=!1),i.morphTargets&&(n.__webglMorphTargetInfluences||(n.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets)));var a,o,s,h,l,u,c,f,d,p,E=!1,m=!1,g=!1,v=i.program,T=v.uniforms,x=i.__webglShader.uniforms;if(v.id!==M&&(zt.useProgram(v.program),M=v.id,g=m=E=!0),i.id!==w&&(-1===w&&(g=!0),w=i.id,m=!0),(E||t!==S)&&(zt.uniformMatrix4fv(T.projectionMatrix,!1,t.projectionMatrix.elements),H&&zt.uniform1f(T.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==S&&(S=t),(i instanceof THREE.ShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&null!==T.cameraPosition&&(Q.setFromMatrixPosition(t.matrixWorld),zt.uniform3f(T.cameraPosition,Q.x,Q.y,Q.z)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.ShaderMaterial||i.skinning)&&null!==T.viewMatrix&&zt.uniformMatrix4fv(T.viewMatrix,!1,t.matrixWorldInverse.elements)),i.skinning)if(n.bindMatrix&&null!==T.bindMatrix&&zt.uniformMatrix4fv(T.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&null!==T.bindMatrixInverse&&zt.uniformMatrix4fv(T.bindMatrixInverse,!1,n.bindMatrixInverse.elements),lt&&n.skeleton&&n.skeleton.useVertexTexture){if(null!==T.boneTexture){var y=ne();zt.uniform1i(T.boneTexture,y),V.setTexture(n.skeleton.boneTexture,y)}null!==T.boneTextureWidth&&zt.uniform1i(T.boneTextureWidth,n.skeleton.boneTextureWidth),null!==T.boneTextureHeight&&zt.uniform1i(T.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&null!==T.boneGlobalMatrices&&zt.uniformMatrix4fv(T.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return m&&(r&&i.fog&&(f=r,(c=x).fogColor.value=f.color,f instanceof THREE.Fog?(c.fogNear.value=f.near,c.fogFar.value=f.far):f instanceof THREE.FogExp2&&(c.fogDensity.value=f.density)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights)&&($&&(g=!0,function(t){var e,r,i,n,a,o,s,h,l,u=0,c=0,f=0,d=tt,p=d.directional.colors,E=d.directional.positions,m=d.point.colors,g=d.point.positions,v=d.point.distances,T=d.spot.colors,x=d.spot.positions,y=d.spot.distances,R=d.spot.directions,_=d.spot.anglesCos,H=d.spot.exponents,b=d.hemi.skyColors,M=d.hemi.groundColors,w=d.hemi.positions,S=0,A=0,C=0,D=0,L=0,F=0,P=0,U=0,B=0,z=0,N=0,k=0;for(e=0,r=t.length;e<r;e++)if(!(i=t[e]).onlyShadow)if(n=i.color,s=i.intensity,l=i.distance,i instanceof THREE.AmbientLight){if(!i.visible)continue;V.gammaInput?(u+=n.r*n.r,c+=n.g*n.g,f+=n.b*n.b):(u+=n.r,c+=n.g,f+=n.b)}else if(i instanceof THREE.DirectionalLight){if(L+=1,!i.visible)continue;J.setFromMatrixPosition(i.matrixWorld),Q.setFromMatrixPosition(i.target.matrixWorld),J.sub(Q),J.normalize(),E[B=3*S]=J.x,E[B+1]=J.y,E[B+2]=J.z,V.gammaInput?oe(p,B,n,s*s):se(p,B,n,s),S+=1}else if(i instanceof THREE.PointLight){if(F+=1,!i.visible)continue;z=3*A,V.gammaInput?oe(m,z,n,s*s):se(m,z,n,s),Q.setFromMatrixPosition(i.matrixWorld),g[z]=Q.x,g[z+1]=Q.y,g[z+2]=Q.z,v[A]=l,A+=1}else if(i instanceof THREE.SpotLight){if(P+=1,!i.visible)continue;N=3*C,V.gammaInput?oe(T,N,n,s*s):se(T,N,n,s),J.setFromMatrixPosition(i.matrixWorld),x[N]=J.x,x[N+1]=J.y,x[N+2]=J.z,y[C]=l,Q.setFromMatrixPosition(i.target.matrixWorld),J.sub(Q),J.normalize(),R[N]=J.x,R[N+1]=J.y,R[N+2]=J.z,_[C]=Math.cos(i.angle),H[C]=i.exponent,C+=1}else if(i instanceof THREE.HemisphereLight){if(U+=1,!i.visible)continue;J.setFromMatrixPosition(i.matrixWorld),J.normalize(),w[k=3*D]=J.x,w[k+1]=J.y,w[k+2]=J.z,a=i.color,o=i.groundColor,V.gammaInput?(oe(b,k,a,h=s*s),oe(M,k,o,h)):(se(b,k,a,s),se(M,k,o,s)),D+=1}for(e=3*S,r=Math.max(p.length,3*L);e<r;e++)p[e]=0;for(e=3*A,r=Math.max(m.length,3*F);e<r;e++)m[e]=0;for(e=3*C,r=Math.max(T.length,3*P);e<r;e++)T[e]=0;for(e=3*D,r=Math.max(b.length,3*U);e<r;e++)b[e]=0;for(e=3*D,r=Math.max(M.length,3*U);e<r;e++)M[e]=0;d.directional.length=S,d.point.length=A,d.spot.length=C,d.hemi.length=D,d.ambient[0]=u,d.ambient[1]=c,d.ambient[2]=f}(e),$=!1),g?(u=tt,(l=x).ambientLightColor.value=u.ambient,l.directionalLightColor.value=u.directional.colors,l.directionalLightDirection.value=u.directional.positions,l.pointLightColor.value=u.point.colors,l.pointLightPosition.value=u.point.positions,l.pointLightDistance.value=u.point.distances,l.spotLightColor.value=u.spot.colors,l.spotLightPosition.value=u.spot.positions,l.spotLightDistance.value=u.spot.distances,l.spotLightDirection.value=u.spot.directions,l.spotLightAngleCos.value=u.spot.anglesCos,l.spotLightExponent.value=u.spot.exponents,l.hemisphereLightSkyColor.value=u.hemi.skyColors,l.hemisphereLightGroundColor.value=u.hemi.groundColors,l.hemisphereLightDirection.value=u.hemi.positions,ie(x,!0)):ie(x,!1)),(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&function(t,e){t.opacity.value=e.opacity,V.gammaInput?t.diffuse.value.copyGammaToLinear(e.color):t.diffuse.value=e.color;t.map.value=e.map,t.lightMap.value=e.lightMap,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));var r;e.map?r=e.map:e.specularMap?r=e.specularMap:e.normalMap?r=e.normalMap:e.bumpMap?r=e.bumpMap:e.alphaMap&&(r=e.alphaMap);if(void 0!==r){var i=r.offset,n=r.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,V.gammaInput,t.reflectivity.value=e.reflectivity;t.refractionRatio.value=e.refractionRatio,t.combine.value=e.combine,t.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping}(x,i),i instanceof THREE.LineBasicMaterial?re(x,i):i instanceof THREE.LineDashedMaterial?(re(x,i),h=i,(s=x).dashSize.value=h.dashSize,s.totalSize.value=h.dashSize+h.gapSize,s.scale.value=h.scale):i instanceof THREE.PointCloudMaterial?(o=i,(a=x).psColor.value=o.color,a.opacity.value=o.opacity,a.size.value=o.size,a.scale.value=R.height/2,a.map.value=o.map):i instanceof THREE.MeshPhongMaterial?function(t,e){t.shininess.value=e.shininess,V.gammaInput?(t.ambient.value.copyGammaToLinear(e.ambient),t.emissive.value.copyGammaToLinear(e.emissive),t.specular.value.copyGammaToLinear(e.specular)):(t.ambient.value=e.ambient,t.emissive.value=e.emissive,t.specular.value=e.specular);e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}(x,i):i instanceof THREE.MeshLambertMaterial?function(t,e){V.gammaInput?(t.ambient.value.copyGammaToLinear(e.ambient),t.emissive.value.copyGammaToLinear(e.emissive)):(t.ambient.value=e.ambient,t.emissive.value=e.emissive);e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}(x,i):i instanceof THREE.MeshDepthMaterial?(x.mNear.value=t.near,x.mFar.value=t.far,x.opacity.value=i.opacity):i instanceof THREE.MeshNormalMaterial&&(x.opacity.value=i.opacity),n.receiveShadow&&!i._shadowPass&&function(t,e){if(t.shadowMatrix)for(var r=0,i=0,n=e.length;i<n;i++){var a=e[i];a.castShadow&&((a instanceof THREE.SpotLight||a instanceof THREE.DirectionalLight&&!a.shadowCascade)&&(t.shadowMap.value[r]=a.shadowMap,t.shadowMapSize.value[r]=a.shadowMapSize,t.shadowMatrix.value[r]=a.shadowMatrix,t.shadowDarkness.value[r]=a.shadowDarkness,t.shadowBias.value[r]=a.shadowBias,r++))}}(x,e),function(t){for(var e,r,i,n=0,a=t.length;n<a;n++){var o=t[n][0];if(!1!==o.needsUpdate){var s=o.type,h=o.value,l=t[n][1];switch(s){case"1i":zt.uniform1i(l,h);break;case"1f":zt.uniform1f(l,h);break;case"2f":zt.uniform2f(l,h[0],h[1]);break;case"3f":zt.uniform3f(l,h[0],h[1],h[2]);break;case"4f":zt.uniform4f(l,h[0],h[1],h[2],h[3]);break;case"1iv":zt.uniform1iv(l,h);break;case"3iv":zt.uniform3iv(l,h);break;case"1fv":zt.uniform1fv(l,h);break;case"2fv":zt.uniform2fv(l,h);break;case"3fv":zt.uniform3fv(l,h);break;case"4fv":zt.uniform4fv(l,h);break;case"Matrix3fv":zt.uniformMatrix3fv(l,!1,h);break;case"Matrix4fv":zt.uniformMatrix4fv(l,!1,h);break;case"i":zt.uniform1i(l,h);break;case"f":zt.uniform1f(l,h);break;case"v2":zt.uniform2f(l,h.x,h.y);break;case"v3":zt.uniform3f(l,h.x,h.y,h.z);break;case"v4":zt.uniform4f(l,h.x,h.y,h.z,h.w);break;case"c":zt.uniform3f(l,h.r,h.g,h.b);break;case"iv1":zt.uniform1iv(l,h);break;case"iv":zt.uniform3iv(l,h);break;case"fv1":zt.uniform1fv(l,h);break;case"fv":zt.uniform3fv(l,h);break;case"v2v":void 0===o._array&&(o._array=new Float32Array(2*h.length));for(var u=0,c=h.length;u<c;u++)i=2*u,o._array[i]=h[u].x,o._array[i+1]=h[u].y;zt.uniform2fv(l,o._array);break;case"v3v":void 0===o._array&&(o._array=new Float32Array(3*h.length));for(var u=0,c=h.length;u<c;u++)i=3*u,o._array[i]=h[u].x,o._array[i+1]=h[u].y,o._array[i+2]=h[u].z;zt.uniform3fv(l,o._array);break;case"v4v":void 0===o._array&&(o._array=new Float32Array(4*h.length));for(var u=0,c=h.length;u<c;u++)i=4*u,o._array[i]=h[u].x,o._array[i+1]=h[u].y,o._array[i+2]=h[u].z,o._array[i+3]=h[u].w;zt.uniform4fv(l,o._array);break;case"m3":zt.uniformMatrix3fv(l,!1,h.elements);break;case"m3v":void 0===o._array&&(o._array=new Float32Array(9*h.length));for(var u=0,c=h.length;u<c;u++)h[u].flattenToArrayOffset(o._array,9*u);zt.uniformMatrix3fv(l,!1,o._array);break;case"m4":zt.uniformMatrix4fv(l,!1,h.elements);break;case"m4v":void 0===o._array&&(o._array=new Float32Array(16*h.length));for(var u=0,c=h.length;u<c;u++)h[u].flattenToArrayOffset(o._array,16*u);zt.uniformMatrix4fv(l,!1,o._array);break;case"t":if(e=h,r=ne(),zt.uniform1i(l,r),!e)continue;e instanceof THREE.CubeTexture||e.image instanceof Array&&6===e.image.length?fe(e,r):e instanceof THREE.WebGLRenderTargetCube?de(e,r):V.setTexture(e,r);break;case"tv":void 0===o._array&&(o._array=[]);for(var u=0,c=o.value.length;u<c;u++)o._array[u]=ne();zt.uniform1iv(l,o._array);for(var u=0,c=o.value.length;u<c;u++)e=o.value[u],r=o._array[u],e&&V.setTexture(e,r);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+s)}}}}(i.uniformsList)),d=T,p=n,zt.uniformMatrix4fv(d.modelViewMatrix,!1,p._modelViewMatrix.elements),d.normalMatrix&&zt.uniformMatrix3fv(d.normalMatrix,!1,p._normalMatrix.elements),null!==T.modelMatrix&&zt.uniformMatrix4fv(T.modelMatrix,!1,n.matrixWorld.elements),v}function re(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function ie(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLightColor.needsUpdate=e,t.directionalLightDirection.needsUpdate=e,t.pointLightColor.needsUpdate=e,t.pointLightPosition.needsUpdate=e,t.pointLightDistance.needsUpdate=e,t.spotLightColor.needsUpdate=e,t.spotLightPosition.needsUpdate=e,t.spotLightDistance.needsUpdate=e,t.spotLightDirection.needsUpdate=e,t.spotLightAngleCos.needsUpdate=e,t.spotLightExponent.needsUpdate=e,t.hemisphereLightSkyColor.needsUpdate=e,t.hemisphereLightGroundColor.needsUpdate=e,t.hemisphereLightDirection.needsUpdate=e}function ne(){var t=A;return nt<=t&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+nt),A+=1,t}function ae(t,e){t._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),t._normalMatrix.getNormalMatrix(t._modelViewMatrix)}function oe(t,e,r,i){t[e]=r.r*r.r*i,t[e+1]=r.g*r.g*i,t[e+2]=r.b*r.b*i}function se(t,e,r,i){t[e]=r.r*i,t[e+1]=r.g*i,t[e+2]=r.b*i}function he(t){t!==N&&(zt.lineWidth(t),N=t)}function le(t,e,r){U!==t&&(t?zt.enable(zt.POLYGON_OFFSET_FILL):zt.disable(zt.POLYGON_OFFSET_FILL),U=t),!t||B===e&&z===r||(zt.polygonOffset(e,r),B=e,z=r)}function ue(t,e,r){var i;r?(zt.texParameteri(t,zt.TEXTURE_WRAP_S,ge(e.wrapS)),zt.texParameteri(t,zt.TEXTURE_WRAP_T,ge(e.wrapT)),zt.texParameteri(t,zt.TEXTURE_MAG_FILTER,ge(e.magFilter)),zt.texParameteri(t,zt.TEXTURE_MIN_FILTER,ge(e.minFilter))):(zt.texParameteri(t,zt.TEXTURE_WRAP_S,zt.CLAMP_TO_EDGE),zt.texParameteri(t,zt.TEXTURE_WRAP_T,zt.CLAMP_TO_EDGE),zt.texParameteri(t,zt.TEXTURE_MAG_FILTER,me(e.magFilter)),zt.texParameteri(t,zt.TEXTURE_MIN_FILTER,me(e.minFilter))),(i=rt.get("EXT_texture_filter_anisotropic"))&&e.type!==THREE.FloatType&&(1<e.anisotropy||e.__oldAnisotropy)&&(zt.texParameterf(t,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,V.getMaxAnisotropy())),e.__oldAnisotropy=e.anisotropy)}function ce(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.log("THREE.WebGLRenderer:",t,"is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height+"."),i}return t}function fe(t,e){if(6===t.image.length)if(t.needsUpdate){t.image.__webglTextureCube||(t.addEventListener("dispose",Ht),t.image.__webglTextureCube=zt.createTexture(),V.info.memory.textures++),zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube),zt.pixelStorei(zt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var r=t instanceof THREE.CompressedTexture,i=t.image[0]instanceof THREE.DataTexture,n=[],a=0;a<6;a++)!V.autoScaleCubemaps||r||i?n[a]=i?t.image[a].image:t.image[a]:n[a]=ce(t.image[a],st);var o=n[0],s=THREE.Math.isPowerOfTwo(o.width)&&THREE.Math.isPowerOfTwo(o.height),h=ge(t.format),l=ge(t.type);ue(zt.TEXTURE_CUBE_MAP,t,s);for(a=0;a<6;a++)if(r)for(var u,c=n[a].mipmaps,f=0,d=c.length;f<d;f++)u=c[f],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<pt().indexOf(h)?zt.compressedTexImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,f,h,u.width,u.height,0,u.data):console.warn("Attempt to load unsupported compressed texture format"):zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,f,h,u.width,u.height,0,h,l,u.data);else i?zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,n[a].width,n[a].height,0,h,l,n[a].data):zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,h,l,n[a]);t.generateMipmaps&&s&&zt.generateMipmap(zt.TEXTURE_CUBE_MAP),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()}else zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}function de(t,e){zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.__webglTexture)}function pe(t,e,r){zt.bindFramebuffer(zt.FRAMEBUFFER,t),zt.framebufferTexture2D(zt.FRAMEBUFFER,zt.COLOR_ATTACHMENT0,r,e.__webglTexture,0)}function Ee(t,e){zt.bindRenderbuffer(zt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(zt.renderbufferStorage(zt.RENDERBUFFER,zt.DEPTH_COMPONENT16,e.width,e.height),zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_ATTACHMENT,zt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(zt.renderbufferStorage(zt.RENDERBUFFER,zt.DEPTH_STENCIL,e.width,e.height),zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_STENCIL_ATTACHMENT,zt.RENDERBUFFER,t)):zt.renderbufferStorage(zt.RENDERBUFFER,zt.RGBA4,e.width,e.height)}function me(t){return t===THREE.NearestFilter||t===THREE.NearestMipMapNearestFilter||t===THREE.NearestMipMapLinearFilter?zt.NEAREST:zt.LINEAR}function ge(t){var e;if(t===THREE.RepeatWrapping)return zt.REPEAT;if(t===THREE.ClampToEdgeWrapping)return zt.CLAMP_TO_EDGE;if(t===THREE.MirroredRepeatWrapping)return zt.MIRRORED_REPEAT;if(t===THREE.NearestFilter)return zt.NEAREST;if(t===THREE.NearestMipMapNearestFilter)return zt.NEAREST_MIPMAP_NEAREST;if(t===THREE.NearestMipMapLinearFilter)return zt.NEAREST_MIPMAP_LINEAR;if(t===THREE.LinearFilter)return zt.LINEAR;if(t===THREE.LinearMipMapNearestFilter)return zt.LINEAR_MIPMAP_NEAREST;if(t===THREE.LinearMipMapLinearFilter)return zt.LINEAR_MIPMAP_LINEAR;if(t===THREE.UnsignedByteType)return zt.UNSIGNED_BYTE;if(t===THREE.UnsignedShort4444Type)return zt.UNSIGNED_SHORT_4_4_4_4;if(t===THREE.UnsignedShort5551Type)return zt.UNSIGNED_SHORT_5_5_5_1;if(t===THREE.UnsignedShort565Type)return zt.UNSIGNED_SHORT_5_6_5;if(t===THREE.ByteType)return zt.BYTE;if(t===THREE.ShortType)return zt.SHORT;if(t===THREE.UnsignedShortType)return zt.UNSIGNED_SHORT;if(t===THREE.IntType)return zt.INT;if(t===THREE.UnsignedIntType)return zt.UNSIGNED_INT;if(t===THREE.FloatType)return zt.FLOAT;if(t===THREE.AlphaFormat)return zt.ALPHA;if(t===THREE.RGBFormat)return zt.RGB;if(t===THREE.RGBAFormat)return zt.RGBA;if(t===THREE.LuminanceFormat)return zt.LUMINANCE;if(t===THREE.LuminanceAlphaFormat)return zt.LUMINANCE_ALPHA;if(t===THREE.AddEquation)return zt.FUNC_ADD;if(t===THREE.SubtractEquation)return zt.FUNC_SUBTRACT;if(t===THREE.ReverseSubtractEquation)return zt.FUNC_REVERSE_SUBTRACT;if(t===THREE.ZeroFactor)return zt.ZERO;if(t===THREE.OneFactor)return zt.ONE;if(t===THREE.SrcColorFactor)return zt.SRC_COLOR;if(t===THREE.OneMinusSrcColorFactor)return zt.ONE_MINUS_SRC_COLOR;if(t===THREE.SrcAlphaFactor)return zt.SRC_ALPHA;if(t===THREE.OneMinusSrcAlphaFactor)return zt.ONE_MINUS_SRC_ALPHA;if(t===THREE.DstAlphaFactor)return zt.DST_ALPHA;if(t===THREE.OneMinusDstAlphaFactor)return zt.ONE_MINUS_DST_ALPHA;if(t===THREE.DstColorFactor)return zt.DST_COLOR;if(t===THREE.OneMinusDstColorFactor)return zt.ONE_MINUS_DST_COLOR;if(t===THREE.SrcAlphaSaturateFactor)return zt.SRC_ALPHA_SATURATE;if(null!==(e=rt.get("WEBGL_compressed_texture_s3tc"))){if(t===THREE.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===THREE.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=rt.get("WEBGL_compressed_texture_pvrtc"))){if(t===THREE.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===THREE.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===THREE.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===THREE.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=rt.get("EXT_blend_minmax"))){if(t===THREE.MinEquation)return e.MIN_EXT;if(t===THREE.MaxEquation)return e.MAX_EXT}return 0}this.setFaceCulling=function(t,e){t===THREE.CullFaceNone?zt.disable(zt.CULL_FACE):(e===THREE.FrontFaceDirectionCW?zt.frontFace(zt.CW):zt.frontFace(zt.CCW),t===THREE.CullFaceBack?zt.cullFace(zt.BACK):t===THREE.CullFaceFront?zt.cullFace(zt.FRONT):zt.cullFace(zt.FRONT_AND_BACK),zt.enable(zt.CULL_FACE))},this.setMaterialFaces=function(t){var e=t.side===THREE.DoubleSide,r=t.side===THREE.BackSide;u!==e&&(e?zt.disable(zt.CULL_FACE):zt.enable(zt.CULL_FACE),u=e),x!==r&&(r?zt.frontFace(zt.CW):zt.frontFace(zt.CCW),x=r)},this.setDepthTest=function(t){F!==t&&(t?zt.enable(zt.DEPTH_TEST):zt.disable(zt.DEPTH_TEST),F=t)},this.setDepthWrite=function(t){P!==t&&(zt.depthMask(t),P=t)},this.setBlending=function(t,e,r,i){t!==y&&(t===THREE.NoBlending?zt.disable(zt.BLEND):t===THREE.AdditiveBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.SRC_ALPHA,zt.ONE)):t===THREE.SubtractiveBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.ZERO,zt.ONE_MINUS_SRC_COLOR)):t===THREE.MultiplyBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.ZERO,zt.SRC_COLOR)):t===THREE.CustomBlending?zt.enable(zt.BLEND):(zt.enable(zt.BLEND),zt.blendEquationSeparate(zt.FUNC_ADD,zt.FUNC_ADD),zt.blendFuncSeparate(zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA,zt.ONE,zt.ONE_MINUS_SRC_ALPHA)),y=t),t===THREE.CustomBlending?(e!==C&&(zt.blendEquation(ge(e)),C=e),r===D&&i===L||(zt.blendFunc(ge(r),ge(i)),D=r,L=i)):L=D=C=null},this.uploadTexture=function(t){void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",Ht),t.__webglTexture=zt.createTexture(),V.info.memory.textures++),zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture),zt.pixelStorei(zt.UNPACK_FLIP_Y_WEBGL,t.flipY),zt.pixelStorei(zt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),zt.pixelStorei(zt.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=ce(t.image,ot);var e=t.image,r=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),i=ge(t.format),n=ge(t.type);ue(zt.TEXTURE_2D,t,r);var a,o=t.mipmaps;if(t instanceof THREE.DataTexture)if(0<o.length&&r){for(var s=0,h=o.length;s<h;s++)a=o[s],zt.texImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,i,n,a.data);t.generateMipmaps=!1}else zt.texImage2D(zt.TEXTURE_2D,0,i,e.width,e.height,0,i,n,e.data);else if(t instanceof THREE.CompressedTexture)for(s=0,h=o.length;s<h;s++)a=o[s],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<pt().indexOf(i)?zt.compressedTexImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,a.data):console.warn("Attempt to load unsupported compressed texture format"):zt.texImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,i,n,a.data);else if(0<o.length&&r){for(s=0,h=o.length;s<h;s++)a=o[s],zt.texImage2D(zt.TEXTURE_2D,s,i,i,n,a);t.generateMipmaps=!1}else zt.texImage2D(zt.TEXTURE_2D,0,i,i,n,t.image);t.generateMipmaps&&r&&zt.generateMipmap(zt.TEXTURE_2D),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()},this.setTexture=function(t,e){zt.activeTexture(zt.TEXTURE0+e),t.needsUpdate?V.uploadTexture(t):zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture)},this.setRenderTarget=function(t){var e,r,i,n,a,o=t instanceof THREE.WebGLRenderTargetCube;if(t&&void 0===t.__webglFramebuffer){void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",bt),t.__webglTexture=zt.createTexture(),V.info.memory.textures++;var s=THREE.Math.isPowerOfTwo(t.width)&&THREE.Math.isPowerOfTwo(t.height),h=ge(t.format),l=ge(t.type);if(o){t.__webglFramebuffer=[],t.__webglRenderbuffer=[],zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.__webglTexture),ue(zt.TEXTURE_CUBE_MAP,t,s);for(var u=0;u<6;u++)t.__webglFramebuffer[u]=zt.createFramebuffer(),t.__webglRenderbuffer[u]=zt.createRenderbuffer(),zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,h,t.width,t.height,0,h,l,null),pe(t.__webglFramebuffer[u],t,zt.TEXTURE_CUBE_MAP_POSITIVE_X+u),Ee(t.__webglRenderbuffer[u],t);s&&zt.generateMipmap(zt.TEXTURE_CUBE_MAP)}else t.__webglFramebuffer=zt.createFramebuffer(),t.shareDepthFrom?t.__webglRenderbuffer=t.shareDepthFrom.__webglRenderbuffer:t.__webglRenderbuffer=zt.createRenderbuffer(),zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture),ue(zt.TEXTURE_2D,t,s),zt.texImage2D(zt.TEXTURE_2D,0,h,t.width,t.height,0,h,l,null),pe(t.__webglFramebuffer,t,zt.TEXTURE_2D),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_ATTACHMENT,zt.RENDERBUFFER,t.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_STENCIL_ATTACHMENT,zt.RENDERBUFFER,t.__webglRenderbuffer):Ee(t.__webglRenderbuffer,t),s&&zt.generateMipmap(zt.TEXTURE_2D);o?zt.bindTexture(zt.TEXTURE_CUBE_MAP,null):zt.bindTexture(zt.TEXTURE_2D,null),zt.bindRenderbuffer(zt.RENDERBUFFER,null),zt.bindFramebuffer(zt.FRAMEBUFFER,null)}t?(e=o?t.__webglFramebuffer[t.activeCubeFace]:t.__webglFramebuffer,r=t.width,i=t.height,a=n=0):(e=null,r=I,i=G,n=k,a=O),e!==v&&(zt.bindFramebuffer(zt.FRAMEBUFFER,e),zt.viewport(n,a,r,i),v=e),W=r,X=i},this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},THREE.WebGLRenderTarget=function(t,e,r){this.width=t,this.height=e,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:THREE.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.format=void 0!==r.format?r.format:THREE.RGBAFormat,this.type=void 0!==r.type?r.type:THREE.UnsignedByteType,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.generateMipmaps=!0,this.shareDepthFrom=null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(t,e){this.width=t,this.height=e},clone:function(){var t=new THREE.WebGLRenderTarget(this.width,this.height);return t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.format=this.format,t.type=this.type,t.depthBuffer=this.depthBuffer,t.stencilBuffer=this.stencilBuffer,t.generateMipmaps=this.generateMipmaps,t.shareDepthFrom=this.shareDepthFrom,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(t,e,r){THREE.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLExtensions=function(r){var i={};this.get=function(t){if(void 0!==i[t])return i[t];var e;switch(t){case"OES_texture_float":e=r.getExtension("OES_texture_float");break;case"OES_texture_float_linear":e=r.getExtension("OES_texture_float_linear");break;case"OES_standard_derivatives":e=r.getExtension("OES_standard_derivatives");break;case"EXT_texture_filter_anisotropic":e=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"OES_element_index_uint":e=r.getExtension("OES_element_index_uint");break;case"EXT_blend_minmax":e=r.getExtension("EXT_blend_minmax");break;case"EXT_frag_depth":e=r.getExtension("EXT_frag_depth")}return null===e&&console.log("THREE.WebGLRenderer: "+t+" extension not supported."),i[t]=e}},THREE.WebGLProgram=function(){var _=0;return function(t,e,r,i){var n=t,a=n.context,o=r.defines,s=r.__webglShader.uniforms,h=r.attributes,l=r.__webglShader.vertexShader,u=r.__webglShader.fragmentShader,c=r.index0AttributeName;void 0===c&&!0===i.morphTargets&&(c="position");var f="SHADOWMAP_TYPE_BASIC";i.shadowMapType===THREE.PCFShadowMap?f="SHADOWMAP_TYPE_PCF":i.shadowMapType===THREE.PCFSoftShadowMap&&(f="SHADOWMAP_TYPE_PCF_SOFT");var d,p,E=function(t){var e,r,i=[];for(var n in t)!1!==(e=t[n])&&(r="#define "+n+" "+e,i.push(r));return i.join("\n")}(o),m=a.createProgram();r instanceof THREE.RawShaderMaterial?p=d="":(d=["precision "+i.precision+" float;","precision "+i.precision+" int;",E,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.gammaInput?"#define GAMMA_INPUT":"",n.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals?"#define USE_MORPHNORMALS":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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;","attribute vec2 uv2;","#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",""].join("\n"),p=["precision "+i.precision+" float;","precision "+i.precision+" int;",i.bumpMap||i.normalMap?"#extension GL_OES_standard_derivatives : enable":"",E,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"",n.gammaInput?"#define GAMMA_INPUT":"",n.gammaOutput?"#define GAMMA_OUTPUT":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.metal?"#define METAL":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var g=new THREE.WebGLShader(a,a.VERTEX_SHADER,d+l),v=new THREE.WebGLShader(a,a.FRAGMENT_SHADER,p+u);a.attachShader(m,g),a.attachShader(m,v),void 0!==c&&a.bindAttribLocation(m,0,c),a.linkProgram(m),!1===a.getProgramParameter(m,a.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",a.getProgramParameter(m,a.VALIDATE_STATUS)),console.error("gl.getError()",a.getError())),""!==a.getProgramInfoLog(m)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a.getProgramInfoLog(m)),a.deleteShader(g),a.deleteShader(v);var T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];for(var x in i.useVertexTexture?(T.push("boneTexture"),T.push("boneTextureWidth"),T.push("boneTextureHeight")):T.push("boneGlobalMatrices"),i.logarithmicDepthBuffer&&T.push("logDepthBufFC"),s)T.push(x);this.uniforms=function(t,e,r){for(var i={},n=0,a=r.length;n<a;n++){var o=r[n];i[o]=t.getUniformLocation(e,o)}return i}(a,m,T),T=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var y=0;y<i.maxMorphTargets;y++)T.push("morphTarget"+y);for(y=0;y<i.maxMorphNormals;y++)T.push("morphNormal"+y);for(var R in h)T.push(R);return this.attributes=function(t,e,r){for(var i={},n=0,a=r.length;n<a;n++){var o=r[n];i[o]=t.getAttribLocation(e,o)}return i}(a,m,T),this.attributesKeys=Object.keys(this.attributes),this.id=_++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=g,this.fragmentShader=v,this}}(),THREE.WebGLShader=function(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t.getShaderInfoLog(i)),console.warn(function(t){for(var e=t.split("\n"),r=0;r<e.length;r++)e[r]=r+1+": "+e[r];return e.join("\n")}(r))),i},THREE.LensFlarePlugin=function(v,T){var x,y,R,_,H,b,M,w,S=v.context,A=function(){var t,e,r,i,n,a,o=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),s=new Uint16Array([0,1,2,0,2,3]);x=S.createBuffer(),y=S.createBuffer(),S.bindBuffer(S.ARRAY_BUFFER,x),S.bufferData(S.ARRAY_BUFFER,o,S.STATIC_DRAW),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,y),S.bufferData(S.ELEMENT_ARRAY_BUFFER,s,S.STATIC_DRAW),M=S.createTexture(),w=S.createTexture(),S.bindTexture(S.TEXTURE_2D,M),S.texImage2D(S.TEXTURE_2D,0,S.RGB,16,16,0,S.RGB,S.UNSIGNED_BYTE,null),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MAG_FILTER,S.NEAREST),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MIN_FILTER,S.NEAREST),S.bindTexture(S.TEXTURE_2D,w),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,16,16,0,S.RGBA,S.UNSIGNED_BYTE,null),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MAG_FILTER,S.NEAREST),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MIN_FILTER,S.NEAREST),t=(b=0<S.getParameter(S.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},e=t,r=S.createProgram(),i=S.createShader(S.FRAGMENT_SHADER),n=S.createShader(S.VERTEX_SHADER),a="precision "+v.getPrecision()+" float;\n",S.shaderSource(i,a+e.fragmentShader),S.shaderSource(n,a+e.vertexShader),S.compileShader(i),S.compileShader(n),S.attachShader(r,i),S.attachShader(r,n),S.linkProgram(r),R=r,_={vertex:S.getAttribLocation(R,"position"),uv:S.getAttribLocation(R,"uv")},H={renderType:S.getUniformLocation(R,"renderType"),map:S.getUniformLocation(R,"map"),occlusionMap:S.getUniformLocation(R,"occlusionMap"),opacity:S.getUniformLocation(R,"opacity"),color:S.getUniformLocation(R,"color"),scale:S.getUniformLocation(R,"scale"),rotation:S.getUniformLocation(R,"rotation"),screenPosition:S.getUniformLocation(R,"screenPosition")}};this.render=function(t,e,r,i){if(0!==T.length){var n=new THREE.Vector3,a=i/r,o=.5*r,s=.5*i,h=16/i,l=new THREE.Vector2(h*a,h),u=new THREE.Vector3(1,1,0),c=new THREE.Vector2(1,1);void 0===R&&A(),S.useProgram(R),S.enableVertexAttribArray(_.vertex),S.enableVertexAttribArray(_.uv),S.uniform1i(H.occlusionMap,0),S.uniform1i(H.map,1),S.bindBuffer(S.ARRAY_BUFFER,x),S.vertexAttribPointer(_.vertex,2,S.FLOAT,!1,16,0),S.vertexAttribPointer(_.uv,2,S.FLOAT,!1,16,8),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,y),S.disable(S.CULL_FACE),S.depthMask(!1);for(var f=0,d=T.length;f<d;f++){h=16/i,l.set(h*a,h);var p=T[f];if(n.set(p.matrixWorld.elements[12],p.matrixWorld.elements[13],p.matrixWorld.elements[14]),n.applyMatrix4(e.matrixWorldInverse),n.applyProjection(e.projectionMatrix),u.copy(n),c.x=u.x*o+o,c.y=u.y*s+s,b||0<c.x&&c.x<r&&0<c.y&&c.y<i){S.activeTexture(S.TEXTURE1),S.bindTexture(S.TEXTURE_2D,M),S.copyTexImage2D(S.TEXTURE_2D,0,S.RGB,c.x-8,c.y-8,16,16,0),S.uniform1i(H.renderType,0),S.uniform2f(H.scale,l.x,l.y),S.uniform3f(H.screenPosition,u.x,u.y,u.z),S.disable(S.BLEND),S.enable(S.DEPTH_TEST),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0),S.activeTexture(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,w),S.copyTexImage2D(S.TEXTURE_2D,0,S.RGBA,c.x-8,c.y-8,16,16,0),S.uniform1i(H.renderType,1),S.disable(S.DEPTH_TEST),S.activeTexture(S.TEXTURE1),S.bindTexture(S.TEXTURE_2D,M),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0),p.positionScreen.copy(u),p.customUpdateCallback?p.customUpdateCallback(p):p.updateLensFlares(),S.uniform1i(H.renderType,2),S.enable(S.BLEND);for(var E=0,m=p.lensFlares.length;E<m;E++){var g=p.lensFlares[E];.001<g.opacity&&.001<g.scale&&(u.x=g.x,u.y=g.y,u.z=g.z,h=g.size*g.scale/i,l.x=h*a,l.y=h,S.uniform3f(H.screenPosition,u.x,u.y,u.z),S.uniform2f(H.scale,l.x,l.y),S.uniform1f(H.rotation,g.rotation),S.uniform1f(H.opacity,g.opacity),S.uniform3f(H.color,g.color.r,g.color.g,g.color.b),v.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst),v.setTexture(g.texture,1),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0))}}}S.enable(S.CULL_FACE),S.enable(S.DEPTH_TEST),S.depthMask(!0),v.resetGLState()}}},THREE.ShadowMapPlugin=function(w,S,s,A){var C,D,L,F,P=w.context,U=new THREE.Frustum,B=new THREE.Matrix4,h=new THREE.Vector3,l=new THREE.Vector3,z=new THREE.Vector3,N=[],t=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(t.uniforms);function k(t,e,r){if(e.visible){var i=s[e.id];if(i&&e.castShadow&&(!1===e.frustumCulled||!0===U.intersectsObject(e)))for(var n=0,a=i.length;n<a;n++){var o=i[n];e._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),N.push(o)}for(n=0,a=e.children.length;n<a;n++)k(t,e.children[n],r)}}function V(t,e){var r=new THREE.DirectionalLight;r.isVirtual=!0,r.onlyShadow=!0,r.castShadow=!0,r.shadowCameraNear=t.shadowCameraNear,r.shadowCameraFar=t.shadowCameraFar,r.shadowCameraLeft=t.shadowCameraLeft,r.shadowCameraRight=t.shadowCameraRight,r.shadowCameraBottom=t.shadowCameraBottom,r.shadowCameraTop=t.shadowCameraTop,r.shadowCameraVisible=t.shadowCameraVisible,r.shadowDarkness=t.shadowDarkness,r.shadowBias=t.shadowCascadeBias[e],r.shadowMapWidth=t.shadowCascadeWidth[e],r.shadowMapHeight=t.shadowCascadeHeight[e],r.pointsWorld=[],r.pointsFrustum=[];for(var i=r.pointsWorld,n=r.pointsFrustum,a=0;a<8;a++)i[a]=new THREE.Vector3,n[a]=new THREE.Vector3;var o=t.shadowCascadeNearZ[e],s=t.shadowCascadeFarZ[e];return n[0].set(-1,-1,o),n[1].set(1,-1,o),n[2].set(-1,1,o),n[3].set(1,1,o),n[4].set(-1,-1,s),n[5].set(1,-1,s),n[6].set(-1,1,s),n[7].set(1,1,s),r}function O(t,e){var r=t.shadowCascadeArray[e];r.position.copy(t.position),r.target.position.copy(t.target.position),r.lookAt(r.target),r.shadowCameraVisible=t.shadowCameraVisible,r.shadowDarkness=t.shadowDarkness,r.shadowBias=t.shadowCascadeBias[e];var i=t.shadowCascadeNearZ[e],n=t.shadowCascadeFarZ[e],a=r.pointsFrustum;a[0].z=i,a[1].z=i,a[2].z=i,a[3].z=i,a[4].z=n,a[5].z=n,a[6].z=n,a[7].z=n}function I(t,e){var r=e.shadowCamera,i=e.pointsFrustum,n=e.pointsWorld;h.set(1/0,1/0,1/0),l.set(-1/0,-1/0,-1/0);for(var a=0;a<8;a++){var o=n[a];o.copy(i[a]),o.unproject(t),o.applyMatrix4(r.matrixWorldInverse),o.x<h.x&&(h.x=o.x),o.x>l.x&&(l.x=o.x),o.y<h.y&&(h.y=o.y),o.y>l.y&&(l.y=o.y),o.z<h.z&&(h.z=o.z),o.z>l.z&&(l.z=o.z)}r.left=h.x,r.right=l.x,r.top=l.y,r.bottom=h.y,r.updateProjectionMatrix()}C=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),D=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0}),L=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,skinning:!0}),F=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0,skinning:!0}),C._shadowPass=!0,D._shadowPass=!0,L._shadowPass=!0,F._shadowPass=!0,this.render=function(t,e){if(!1!==w.shadowMapEnabled){var r,i,n,a,o,s,h,l,u,c,f,d,p,E,m=[],g=0;for(P.clearColor(1,1,1,1),P.disable(P.BLEND),P.enable(P.CULL_FACE),P.frontFace(P.CCW),w.shadowMapCullFace===THREE.CullFaceFront?P.cullFace(P.FRONT):P.cullFace(P.BACK),w.setDepthTest(!0),r=0,i=S.length;r<i;r++)if((p=S[r]).castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(o=0;o<p.shadowCascadeCount;o++){var v;if(p.shadowCascadeArray[o])v=p.shadowCascadeArray[o];else{(v=V(p,o)).originalCamera=e;var T=new THREE.Gyroscope;T.position.copy(p.shadowCascadeOffset),T.add(v),T.add(v.target),e.add(T),p.shadowCascadeArray[o]=v,console.log("Created virtualLight",v)}O(p,o),m[g]=v,g++}else m[g]=p,g++;for(r=0,i=m.length;r<i;r++){if(!(p=m[r]).shadowMap){var x=THREE.LinearFilter;w.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter);var y={minFilter:x,magFilter:x,format:THREE.RGBAFormat};p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,y),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else{if(!(p instanceof THREE.DirectionalLight)){console.error("Unsupported light type for shadow");continue}p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar)}t.add(p.shadowCamera),!0===t.autoUpdate&&t.updateMatrixWorld()}var R,_,H;for(p.shadowCameraVisible&&!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),t.add(p.cameraHelper)),p.isVirtual&&v.originalCamera==e&&I(e,p),s=p.shadowMap,h=p.shadowMatrix,(l=p.shadowCamera).position.setFromMatrixPosition(p.matrixWorld),z.setFromMatrixPosition(p.target.matrixWorld),l.lookAt(z),l.updateMatrixWorld(),l.matrixWorldInverse.getInverse(l.matrixWorld),p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible),p.shadowCameraVisible&&p.cameraHelper.update(),h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(l.projectionMatrix),h.multiply(l.matrixWorldInverse),B.multiplyMatrices(l.projectionMatrix,l.matrixWorldInverse),U.setFromMatrix(B),w.setRenderTarget(s),w.clear(),N.length=0,k(t,t,l),n=0,a=N.length;n<a;n++)d=(f=N[n]).object,u=f.buffer,R=(E=d).material instanceof THREE.MeshFaceMaterial?E.material.materials[0]:E.material,_=void 0!==d.geometry.morphTargets&&0<d.geometry.morphTargets.length&&R.morphTargets,H=d instanceof THREE.SkinnedMesh&&R.skinning,c=d.customDepthMaterial?d.customDepthMaterial:H?_?F:L:_?D:C,w.setMaterialFaces(R),u instanceof THREE.BufferGeometry?w.renderBufferDirect(l,S,null,c,u,d):w.renderBuffer(l,S,null,c,u,d);for(n=0,a=A.length;n<a;n++)(d=(f=A[n]).object).visible&&d.castShadow&&(d._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,d.matrixWorld),w.renderImmediateObject(l,S,null,C,d))}var b=w.getClearColor(),M=w.getClearAlpha();P.clearColor(b.r,b.g,b.b,M),P.enable(P.BLEND),w.shadowMapCullFace===THREE.CullFaceFront&&P.cullFace(P.BACK),w.resetGLState()}}},THREE.SpritePlugin=function(c,f){var d,p,E,m,g,v,T=c.context,x=function(){var t,e,r,i=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);d=T.createBuffer(),p=T.createBuffer(),T.bindBuffer(T.ARRAY_BUFFER,d),T.bufferData(T.ARRAY_BUFFER,i,T.STATIC_DRAW),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,p),T.bufferData(T.ELEMENT_ARRAY_BUFFER,n,T.STATIC_DRAW),t=T.createProgram(),e=T.createShader(T.VERTEX_SHADER),r=T.createShader(T.FRAGMENT_SHADER),T.shaderSource(e,["precision "+c.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),T.shaderSource(r,["precision "+c.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),T.compileShader(e),T.compileShader(r),T.attachShader(t,e),T.attachShader(t,r),T.linkProgram(t),E=t,m={position:T.getAttribLocation(E,"position"),uv:T.getAttribLocation(E,"uv")},g={uvOffset:T.getUniformLocation(E,"uvOffset"),uvScale:T.getUniformLocation(E,"uvScale"),rotation:T.getUniformLocation(E,"rotation"),scale:T.getUniformLocation(E,"scale"),color:T.getUniformLocation(E,"color"),map:T.getUniformLocation(E,"map"),opacity:T.getUniformLocation(E,"opacity"),modelViewMatrix:T.getUniformLocation(E,"modelViewMatrix"),projectionMatrix:T.getUniformLocation(E,"projectionMatrix"),fogType:T.getUniformLocation(E,"fogType"),fogDensity:T.getUniformLocation(E,"fogDensity"),fogNear:T.getUniformLocation(E,"fogNear"),fogFar:T.getUniformLocation(E,"fogFar"),fogColor:T.getUniformLocation(E,"fogColor"),alphaTest:T.getUniformLocation(E,"alphaTest")};var a=document.createElement("canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(v=new THREE.Texture(a)).needsUpdate=!0};function y(t,e){return t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(t,e){if(0!==f.length){void 0===E&&x(),T.useProgram(E),T.enableVertexAttribArray(m.position),T.enableVertexAttribArray(m.uv),T.disable(T.CULL_FACE),T.enable(T.BLEND),T.bindBuffer(T.ARRAY_BUFFER,d),T.vertexAttribPointer(m.position,2,T.FLOAT,!1,16,0),T.vertexAttribPointer(m.uv,2,T.FLOAT,!1,16,8),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,p),T.uniformMatrix4fv(g.projectionMatrix,!1,e.projectionMatrix.elements),T.activeTexture(T.TEXTURE0),T.uniform1i(g.map,0);var r=0,i=0,n=t.fog;n?(T.uniform3f(g.fogColor,n.color.r,n.color.g,n.color.b),n instanceof THREE.Fog?(T.uniform1f(g.fogNear,n.near),T.uniform1f(g.fogFar,n.far),T.uniform1i(g.fogType,1),i=r=1):n instanceof THREE.FogExp2&&(T.uniform1f(g.fogDensity,n.density),T.uniform1i(g.fogType,2),i=r=2)):(T.uniform1i(g.fogType,0),i=r=0);for(var a=0,o=f.length;a<o;a++){(h=f[a])._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,h.matrixWorld),null===h.renderDepth?h.z=-h._modelViewMatrix.elements[14]:h.z=h.renderDepth}f.sort(y);var s=[];for(a=0,o=f.length;a<o;a++){var h,l=(h=f[a]).material;T.uniform1f(g.alphaTest,l.alphaTest),T.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrix.elements),s[0]=h.scale.x,s[1]=h.scale.y;var u=0;t.fog&&l.fog&&(u=i),r!==u&&(T.uniform1i(g.fogType,u),r=u),null!==l.map?(T.uniform2f(g.uvOffset,l.map.offset.x,l.map.offset.y),T.uniform2f(g.uvScale,l.map.repeat.x,l.map.repeat.y)):(T.uniform2f(g.uvOffset,0,0),T.uniform2f(g.uvScale,1,1)),T.uniform1f(g.opacity,l.opacity),T.uniform3f(g.color,l.color.r,l.color.g,l.color.b),T.uniform1f(g.rotation,l.rotation),T.uniform2fv(g.scale,s),c.setBlending(l.blending,l.blendEquation,l.blendSrc,l.blendDst),c.setDepthTest(l.depthTest),c.setDepthWrite(l.depthWrite),l.map&&l.map.image&&l.map.image.width?c.setTexture(l.map,0):c.setTexture(v,0),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0)}T.enable(T.CULL_FACE),c.resetGLState()}}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var a=new THREE.Texture(void 0,e);return n.load(t,function(t){a.image=t,a.needsUpdate=!0,r&&r(a)},void 0,function(t){i&&i(t)}),a.sourceFile=t,a},loadTextureCube:function(t,e,r,i){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var a=new THREE.CubeTexture([],e);a.flipY=!1;for(var o=0,s=function(e){n.load(t[e],function(t){a.images[e]=t,6===(o+=1)&&(a.needsUpdate=!0,r&&r(a))})},h=0,l=t.length;h<l;++h)s(h);return a},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.")},getNormalMap:function(t,e){var r=function(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]};e|=1;var i=t.width,n=t.height,a=document.createElement("canvas");a.width=i,a.height=n;var o=a.getContext("2d");o.drawImage(t,0,0);for(var s,h,l,u,c=o.getImageData(0,0,i,n).data,f=o.createImageData(i,n),d=f.data,p=0;p<i;p++)for(var E=0;E<n;E++){var m=E-1<0?0:E-1,g=n-1<E+1?n-1:E+1,v=p-1<0?0:p-1,T=i-1<p+1?i-1:p+1,x=[],y=[0,0,c[4*(E*i+p)]/255*e];x.push([-1,0,c[4*(E*i+v)]/255*e]),x.push([-1,-1,c[4*(m*i+v)]/255*e]),x.push([0,-1,c[4*(m*i+p)]/255*e]),x.push([1,-1,c[4*(m*i+T)]/255*e]),x.push([1,0,c[4*(E*i+T)]/255*e]),x.push([1,1,c[4*(g*i+T)]/255*e]),x.push([0,1,c[4*(g*i+p)]/255*e]),x.push([-1,1,c[4*(g*i+v)]/255*e]);for(var R=[],_=x.length,H=0;H<_;H++){var b=x[H],M=x[(H+1)%_];b=r(b,y),M=r(M,y),R.push((u=M,s=[(l=b)[1]*u[2]-l[2]*u[1],l[2]*u[0]-l[0]*u[2],l[0]*u[1]-l[1]*u[0]],void 0,h=Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]),[s[0]/h,s[1]/h,s[2]/h]))}var w=[0,0,0];for(H=0;H<R.length;H++)w[0]+=R[H][0],w[1]+=R[H][1],w[2]+=R[H][2];w[0]/=R.length,w[1]/=R.length,w[2]/=R.length;var S=4*(E*i+p);d[S]=(w[0]+1)/2*255|0,d[S+1]=(w[1]+1)/2*255|0,d[S+2]=255*w[2]|0,d[S+3]=255}return o.putImageData(f,0,0),a},generateDataTexture:function(t,e,r){for(var i=t*e,n=new Uint8Array(3*i),a=Math.floor(255*r.r),o=Math.floor(255*r.g),s=Math.floor(255*r.b),h=0;h<i;h++)n[3*h]=a,n[3*h+1]=o,n[3*h+2]=s;var l=new THREE.DataTexture(n,t,e,THREE.RGBFormat);return l.needsUpdate=!0,l}},THREE.SphereGeometry=function(t,e,r,i,n,a,o){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},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,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,h,l=[],u=[];for(h=0;h<=r;h++){var c=[],f=[];for(s=0;s<=e;s++){var d=s/e,p=h/r,E=new THREE.Vector3;E.x=-t*Math.cos(i+d*n)*Math.sin(a+p*o),E.y=t*Math.cos(a+p*o),E.z=t*Math.sin(i+d*n)*Math.sin(a+p*o),this.vertices.push(E),c.push(this.vertices.length-1),f.push(new THREE.Vector2(d,1-p))}l.push(c),u.push(f)}for(h=0;h<r;h++)for(s=0;s<e;s++){var m=l[h][s+1],g=l[h][s],v=l[h+1][s],T=l[h+1][s+1],x=this.vertices[m].clone().normalize(),y=this.vertices[g].clone().normalize(),R=this.vertices[v].clone().normalize(),_=this.vertices[T].clone().normalize(),H=u[h][s+1].clone(),b=u[h][s].clone(),M=u[h+1][s].clone(),w=u[h+1][s+1].clone();Math.abs(this.vertices[m].y)===t?(H.x=(H.x+b.x)/2,this.faces.push(new THREE.Face3(m,v,T,[x,R,_])),this.faceVertexUvs[0].push([H,M,w])):Math.abs(this.vertices[v].y)===t?(M.x=(M.x+w.x)/2,this.faces.push(new THREE.Face3(m,g,v,[x,y,R])),this.faceVertexUvs[0].push([H,b,M])):(this.faces.push(new THREE.Face3(m,g,T,[x,y,_])),this.faceVertexUvs[0].push([H,b,w]),this.faces.push(new THREE.Face3(g,v,T,[y.clone(),R,_.clone()])),this.faceVertexUvs[0].push([b.clone(),M,w.clone()]))}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
1
+ var THREE={REVISION:"69"};"object"==typeof module&&(module.exports=THREE),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?1:0}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.NoShading=0,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=function(){},THREE.CubeReflectionMapping=function(){},THREE.CubeRefractionMapping=function(){},THREE.SphericalReflectionMapping=function(){},THREE.SphericalRefractionMapping=function(){},THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.Color=function(t){return 3===arguments.length?this.setRGB(t,arguments[1],arguments[2]):this.set(t)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(t){return t instanceof THREE.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},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(t,e,r){if(0===e)this.r=this.g=this.b=r;else{var i=function(t,e,r){return r<0&&(r+=1),1<r&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t},n=r<=.5?r*(1+e):r+e-r*e,a=2*r-n;this.r=i(a,n,t+1/3),this.g=i(a,n,t),this.b=i(a,n,t-1/3)}return this},setStyle:function(t){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)){var e=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t);return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)){e=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t);return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(t)){e=/^\#([0-9a-f]{6})$/i.exec(t);return this.setHex(parseInt(e[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)){e=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return this.setHex(parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3],16)),this}if(/^(\w+)$/i.test(t))return this.setHex(THREE.ColorKeywords[t]),this},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t){return this.r=t.r*t.r,this.g=t.g*t.g,this.b=t.b*t.b,this},copyLinearToGamma:function(t){return this.r=Math.sqrt(t.r),this.g=Math.sqrt(t.g),this.b=Math.sqrt(t.b),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){var e,r,i=t||{h:0,s:0,l:0},n=this.r,a=this.g,o=this.b,s=Math.max(n,a,o),h=Math.min(n,a,o),l=(h+s)/2;if(h===s)r=e=0;else{var c=s-h;switch(r=l<=.5?c/(s+h):c/(2-s-h),s){case n:e=(a-o)/c+(a<o?6:0);break;case a:e=(o-n)/c+2;break;case o:e=(n-a)/c+4}e/=6}return i.h=e,i.s=r,i.l=l,i},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){return this.r=t[0],this.g=t[1],this.b=t[2],this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}},THREE.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},THREE.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},THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,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},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(t instanceof THREE.Euler==!1)throw new 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),a=Math.sin(t._x/2),o=Math.sin(t._y/2),s=Math.sin(t._z/2);return"XYZ"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n-a*o*s):"YXZ"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n+a*o*s):"ZXY"===t.order?(this._x=a*i*n-r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n-a*o*s):"ZYX"===t.order?(this._x=a*i*n-r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n+a*o*s):"YZX"===t.order?(this._x=a*i*n+r*o*s,this._y=r*o*n+a*i*s,this._z=r*i*s-a*o*n,this._w=r*i*n-a*o*s):"XZY"===t.order&&(this._x=a*i*n-r*o*s,this._y=r*o*n-a*i*s,this._z=r*i*s+a*o*n,this._w=r*i*n+a*o*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,r=t.elements,i=r[0],n=r[4],a=r[8],o=r[1],s=r[5],h=r[9],l=r[2],c=r[6],u=r[10],f=i+s+u;return 0<f?(e=.5/Math.sqrt(f+1),this._w=.25/e,this._x=(c-h)*e,this._y=(a-l)*e,this._z=(o-n)*e):s<i&&u<i?(e=2*Math.sqrt(1+i-s-u),this._w=(c-h)/e,this._x=.25*e,this._y=(n+o)/e,this._z=(a+l)/e):u<s?(e=2*Math.sqrt(1+s-i-u),this._w=(a-l)/e,this._x=(n+o)/e,this._y=.25*e,this._z=(h+c)/e):(e=2*Math.sqrt(1+u-i-s),this._w=(o-n)/e,this._x=(a+l)/e,this._y=(h+c)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3),(i=t.dot(e)+1)<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?r.set(-t.y,t.x,0):r.set(0,-t.z,t.y)):r.crossVectors(t,e),this._x=r.x,this._y=r.y,this._z=r.z,this._w=i,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._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=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,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=r*l+a*o+i*h-n*s,this._y=i*l+a*s+n*o-r*h,this._z=n*l+a*h+r*s-i*o,this._w=a*l-r*o-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(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,a=this._w,o=a*t._w+r*t._x+i*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(o),h=Math.sqrt(1-o*o);if(Math.abs(h)<.001)return this._w=.5*(a+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var l=Math.sin((1-e)*s)/h,c=Math.sin(e*s)/h;return this._w=a*l+this._w*c,this._x=r*l+this._x*c,this._y=i*l+this._y*c,this._z=n*l+this._z*c,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(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}},THREE.Quaternion.slerp=function(t,e,r,i){return r.copy(t).slerp(e,i)},THREE.Vector2=function(t,e){this.x=t||0,this.y=e||0},THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(t,e){return this.x=t,this.y=e,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 new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},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)},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScalar:function(t){return this.x+=t,this.y+=t,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)},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 this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e}else this.x=0,this.y=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector2,i=new THREE.Vector2),r.set(t,t),i.set(e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?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)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,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},clone:function(){return new THREE.Vector2(this.x,this.y)}},THREE.Vector3=function(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,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 new 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 new Error("index is out of range: "+t)}},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},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)},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 this.x*=t,this.y*=t,this.z*=t,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 e;return function(t){return t instanceof THREE.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var r;return function(t,e){return void 0===r&&(r=new THREE.Quaternion),this.applyQuaternion(r.setFromAxisAngle(t,e)),this}}(),applyMatrix3:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6]*i,this.y=n[1]*e+n[4]*r+n[7]*i,this.z=n[2]*e+n[5]*r+n[8]*i,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i+n[12],this.y=n[1]*e+n[5]*r+n[9]*i+n[13],this.z=n[2]*e+n[6]*r+n[10]*i+n[14],this},applyProjection:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements,a=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*a,this},applyQuaternion:function(t){var e=this.x,r=this.y,i=this.z,n=t.x,a=t.y,o=t.z,s=t.w,h=s*e+a*i-o*r,l=s*r+o*e-n*i,c=s*i+n*r-a*e,u=-n*e-a*r-o*i;return this.x=h*s+u*-n+l*-o-c*-a,this.y=l*s+u*-a+c*-n-h*-o,this.z=c*s+u*-o+h*-a-l*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(t){var e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[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){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector3,i=new THREE.Vector3),r.set(t,t,t),i.set(e,e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},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,a=e.x,o=e.y,s=e.z;return this.x=i*s-n*o,this.y=n*a-r*s,this.z=r*o-i*a,this},projectOnVector:function(){var e,r;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(t).normalize(),r=this.dot(e),this.copy(e).multiplyScalar(r)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(t){var e=this.dot(t)/(this.length()*t.length());return Math.acos(THREE.Math.clamp(e,-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,i=this.z-t.z;return e*e+r*r+i*i},setEulerFromRotationMatrix:function(t,e){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},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(),i=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=r,this.z=i,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},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}},THREE.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},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 new 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 new Error("index is out of range: "+t)}},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},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)},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 this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,i=this.z,n=this.w,a=t.elements;return this.x=a[0]*e+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*e+a[7]*r+a[11]*i+a[15]*n,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e,this.w*=e}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=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,a=t.elements,o=a[0],s=a[4],h=a[8],l=a[1],c=a[5],u=a[9],f=a[2],d=a[6],p=a[10];if(Math.abs(s-l)<.01&&Math.abs(h-f)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(h+f)<.1&&Math.abs(u+d)<.1&&Math.abs(o+c+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var E=(o+1)/2,m=(c+1)/2,g=(p+1)/2,v=(s+l)/4,T=(h+f)/4,x=(u+d)/4;return m<E&&g<E?E<.01?(r=0,n=i=.707106781):(i=v/(r=Math.sqrt(E)),n=T/r):g<m?m<.01?(i=0,n=r=.707106781):(r=v/(i=Math.sqrt(m)),n=x/i):g<.01?(i=r=.707106781,n=0):(r=T/(n=Math.sqrt(g)),i=x/n),this.set(r,i,n,e),this}var y=Math.sqrt((d-u)*(d-u)+(h-f)*(h-f)+(l-s)*(l-s));return Math.abs(y)<.001&&(y=1),this.x=(d-u)/y,this.y=(h-f)/y,this.z=(l-s)/y,this.w=Math.acos((o+c+p-1)/2),this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this.w>t.w&&(this.w=t.w),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this.w<t.w&&(this.w=t.w),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this.w<t.w?this.w=t.w:this.w>e.w&&(this.w=e.w),this},clampScalar:function(){var r,i;return function(t,e){return void 0===r&&(r=new THREE.Vector4,i=new THREE.Vector4),r.set(t,t,t,t),i.set(e,e,e,e),this.clamp(r,i)}}(),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?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){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},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},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}},THREE.Euler=function(t,e,r,i){this._x=t||0,this._y=e||0,this._z=r||0,this._order=i||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,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},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){var r=THREE.Math.clamp,i=t.elements,n=i[0],a=i[4],o=i[8],s=i[1],h=i[5],l=i[9],c=i[2],u=i[6],f=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,h)):(this._y=Math.atan2(-c,n),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(-c,f),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(s,n))):"ZYX"===e?(this._y=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(u,f),this._z=Math.atan2(s,n)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===e?(this._z=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(o,f))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(u,h),this._y=Math.atan2(o,n)):(this._x=Math.atan2(-l,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,this.onChangeCallback(),this},setFromQuaternion:function(t,e,r){var i=THREE.Math.clamp,n=t.x*t.x,a=t.y*t.y,o=t.z*t.z,s=t.w*t.w;return"XYZ"===(e=e||this._order)?(this._x=Math.atan2(2*(t.x*t.w-t.y*t.z),s-n-a+o),this._y=Math.asin(i(2*(t.x*t.z+t.y*t.w),-1,1)),this._z=Math.atan2(2*(t.z*t.w-t.x*t.y),s+n-a-o)):"YXZ"===e?(this._x=Math.asin(i(2*(t.x*t.w-t.y*t.z),-1,1)),this._y=Math.atan2(2*(t.x*t.z+t.y*t.w),s-n-a+o),this._z=Math.atan2(2*(t.x*t.y+t.z*t.w),s-n+a-o)):"ZXY"===e?(this._x=Math.asin(i(2*(t.x*t.w+t.y*t.z),-1,1)),this._y=Math.atan2(2*(t.y*t.w-t.z*t.x),s-n-a+o),this._z=Math.atan2(2*(t.z*t.w-t.x*t.y),s-n+a-o)):"ZYX"===e?(this._x=Math.atan2(2*(t.x*t.w+t.z*t.y),s-n-a+o),this._y=Math.asin(i(2*(t.y*t.w-t.x*t.z),-1,1)),this._z=Math.atan2(2*(t.x*t.y+t.z*t.w),s+n-a-o)):"YZX"===e?(this._x=Math.atan2(2*(t.x*t.w-t.z*t.y),s-n+a-o),this._y=Math.atan2(2*(t.y*t.w-t.x*t.z),s+n-a-o),this._z=Math.asin(i(2*(t.x*t.y+t.z*t.w),-1,1))):"XZY"===e?(this._x=Math.atan2(2*(t.x*t.w+t.y*t.z),s-n+a-o),this._y=Math.atan2(2*(t.x*t.z+t.y*t.w),s+n-a-o),this._z=Math.asin(i(2*(t.z*t.w-t.x*t.y),-1,1))):console.warn("THREE.Euler: .setFromQuaternion() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},reorder:function(){var e=new THREE.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),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(){return[this._x,this._y,this._z,this._order]},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}},THREE.Box3=function(t,e){this.min=void 0!==t?t:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new THREE.Vector3(-1/0,-1/0,-1/0)},THREE.Box3.prototype={constructor:THREE.Box3,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 i=new THREE.Vector3;return function(t,e){var r=i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var s=new THREE.Vector3;return function(t){var o=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var e=t.geometry;if(void 0!==e)if(e instanceof THREE.Geometry)for(var r=e.vertices,i=0,n=r.length;i<n;i++)s.copy(r[i]),s.applyMatrix4(t.matrixWorld),o.expandByPoint(s);else if(e instanceof THREE.BufferGeometry&&void 0!==e.attributes.position){var a=e.attributes.position.array;for(i=0,n=a.length;i<n;i+=3)s.set(a[i],a[i+1],a[i+2]),s.applyMatrix4(t.matrixWorld),o.expandByPoint(s)}}),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},empty: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 THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){return(t||new THREE.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 THREE.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))},isIntersectionBox: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)},clampPoint:function(t,e){return(e||new THREE.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var r=new THREE.Vector3;return function(t){var e=t||new THREE.Sphere;return e.center=this.center(),e.radius=.5*this.size(r).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 e=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),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)},clone:function(){return(new THREE.Box3).copy(this)}},THREE.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.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(t,e,r,i,n,a,o,s,h){var l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=a,l[2]=o,l[5]=s,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0,n=e;i<r;i+=3,n+=3)a.x=t[n],a.y=t[n+1],a.z=t[n+2],a.applyMatrix3(this),t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z;return t}}(),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],a=t[4],o=t[5],s=t[6],h=t[7],l=t[8];return e*a*l-e*o*h-r*n*l+r*o*s+i*n*h-i*a*s},getInverse:function(t,e){var r=t.elements,i=this.elements;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];var n=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===n){var a="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(a);return console.warn(a),this.identity(),this}return this.multiplyScalar(1/n),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]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}},THREE.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.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(t,e,r,i,n,a,o,s,h,l,c,u,f,d,p,E){var m=this.elements;return m[0]=t,m[4]=e,m[8]=r,m[12]=i,m[1]=n,m[5]=a,m[9]=o,m[13]=s,m[2]=h,m[6]=l,m[10]=c,m[14]=u,m[3]=f,m[7]=d,m[11]=p,m[15]=E,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(t){return this.elements.set(t.elements),this},extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},copyPosition:function(t){var e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this},extractRotation:function(){var o=new THREE.Vector3;return function(t){var e=this.elements,r=t.elements,i=1/o.set(r[0],r[1],r[2]).length(),n=1/o.set(r[4],r[5],r[6]).length(),a=1/o.set(r[8],r[9],r[10]).length();return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[4]=r[4]*n,e[5]=r[5]*n,e[6]=r[6]*n,e[8]=r[8]*a,e[9]=r[9]*a,e[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t instanceof THREE.Euler==!1&&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,a=Math.cos(r),o=Math.sin(r),s=Math.cos(i),h=Math.sin(i),l=Math.cos(n),c=Math.sin(n);if("XYZ"===t.order){var u=a*l,f=a*c,d=o*l,p=o*c;e[0]=s*l,e[4]=-s*c,e[8]=h,e[1]=f+d*h,e[5]=u-p*h,e[9]=-o*s,e[2]=p-u*h,e[6]=d+f*h,e[10]=a*s}else if("YXZ"===t.order){var E=s*l,m=s*c,g=h*l,v=h*c;e[0]=E+v*o,e[4]=g*o-m,e[8]=a*h,e[1]=a*c,e[5]=a*l,e[9]=-o,e[2]=m*o-g,e[6]=v+E*o,e[10]=a*s}else if("ZXY"===t.order){E=s*l,m=s*c,g=h*l,v=h*c;e[0]=E-v*o,e[4]=-a*c,e[8]=g+m*o,e[1]=m+g*o,e[5]=a*l,e[9]=v-E*o,e[2]=-a*h,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){u=a*l,f=a*c,d=o*l,p=o*c;e[0]=s*l,e[4]=d*h-f,e[8]=u*h+p,e[1]=s*c,e[5]=p*h+u,e[9]=f*h-d,e[2]=-h,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var T=a*s,x=a*h,y=o*s,R=o*h;e[0]=s*l,e[4]=R-T*c,e[8]=y*c+x,e[1]=c,e[5]=a*l,e[9]=-o*l,e[2]=-h*l,e[6]=x*c+y,e[10]=T-R*c}else if("XZY"===t.order){T=a*s,x=a*h,y=o*s,R=o*h;e[0]=s*l,e[4]=-c,e[8]=h*l,e[1]=T*c+R,e[5]=a*l,e[9]=x*c-y,e[2]=y*c-x,e[6]=o*l,e[10]=R*c+T}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z,a=t.w,o=r+r,s=i+i,h=n+n,l=r*o,c=r*s,u=r*h,f=i*s,d=i*h,p=n*h,E=a*o,m=a*s,g=a*h;return e[0]=1-(f+p),e[4]=c-g,e[8]=u+m,e[1]=c+g,e[5]=1-(l+p),e[9]=d-E,e[2]=u-m,e[6]=d+E,e[10]=1-(l+f),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 n=new THREE.Vector3,a=new THREE.Vector3,o=new THREE.Vector3;return function(t,e,r){var i=this.elements;return o.subVectors(t,e).normalize(),0===o.length()&&(o.z=1),n.crossVectors(r,o).normalize(),0===n.length()&&(o.x+=1e-4,n.crossVectors(r,o).normalize()),a.crossVectors(o,n),i[0]=n.x,i[4]=a.x,i[8]=o.x,i[1]=n.y,i[5]=a.y,i[9]=o.y,i[2]=n.z,i[6]=a.z,i[10]=o.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,a=r[0],o=r[4],s=r[8],h=r[12],l=r[1],c=r[5],u=r[9],f=r[13],d=r[2],p=r[6],E=r[10],m=r[14],g=r[3],v=r[7],T=r[11],x=r[15],y=i[0],R=i[4],_=i[8],H=i[12],b=i[1],M=i[5],w=i[9],S=i[13],A=i[2],C=i[6],D=i[10],L=i[14],P=i[3],F=i[7],U=i[11],B=i[15];return n[0]=a*y+o*b+s*A+h*P,n[4]=a*R+o*M+s*C+h*F,n[8]=a*_+o*w+s*D+h*U,n[12]=a*H+o*S+s*L+h*B,n[1]=l*y+c*b+u*A+f*P,n[5]=l*R+c*M+u*C+f*F,n[9]=l*_+c*w+u*D+f*U,n[13]=l*H+c*S+u*L+f*B,n[2]=d*y+p*b+E*A+m*P,n[6]=d*R+p*M+E*C+m*F,n[10]=d*_+p*w+E*D+m*U,n[14]=d*H+p*S+E*L+m*B,n[3]=g*y+v*b+T*A+x*P,n[7]=g*R+v*M+T*C+x*F,n[11]=g*_+v*w+T*D+x*U,n[15]=g*H+v*S+T*L+x*B,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},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var i=0,n=e;i<r;i+=3,n+=3)a.x=t[n],a.y=t[n+1],a.z=t[n+2],a.applyMatrix4(this),t[n]=a.x,t[n+1]=a.y,t[n+2]=a.z;return t}}(),rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},determinant:function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],a=t[1],o=t[5],s=t[9],h=t[13],l=t[2],c=t[6],u=t[10],f=t[14];return t[3]*(+n*s*c-i*h*c-n*o*u+r*h*u+i*o*f-r*s*f)+t[7]*(+e*s*f-e*h*u+n*a*u-i*a*f+i*h*l-n*s*l)+t[11]*(+e*h*c-e*o*f-n*a*c+r*a*f+n*o*l-r*h*l)+t[15]*(-i*o*l-e*s*c+e*o*u+i*a*c-r*a*u+r*s*l)},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 e=new THREE.Vector3;return function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[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=t.elements,n=i[0],a=i[4],o=i[8],s=i[12],h=i[1],l=i[5],c=i[9],u=i[13],f=i[2],d=i[6],p=i[10],E=i[14],m=i[3],g=i[7],v=i[11],T=i[15];r[0]=c*E*g-u*p*g+u*d*v-l*E*v-c*d*T+l*p*T,r[4]=s*p*g-o*E*g-s*d*v+a*E*v+o*d*T-a*p*T,r[8]=o*u*g-s*c*g+s*l*v-a*u*v-o*l*T+a*c*T,r[12]=s*c*d-o*u*d-s*l*p+a*u*p+o*l*E-a*c*E,r[1]=u*p*m-c*E*m-u*f*v+h*E*v+c*f*T-h*p*T,r[5]=o*E*m-s*p*m+s*f*v-n*E*v-o*f*T+n*p*T,r[9]=s*c*m-o*u*m-s*h*v+n*u*v+o*h*T-n*c*T,r[13]=o*u*f-s*c*f+s*h*p-n*u*p-o*h*E+n*c*E,r[2]=l*E*m-u*d*m+u*f*g-h*E*g-l*f*T+h*d*T,r[6]=s*d*m-a*E*m-s*f*g+n*E*g+a*f*T-n*d*T,r[10]=a*u*m-s*l*m+s*h*g-n*u*g-a*h*T+n*l*T,r[14]=s*l*f-a*u*f-s*h*d+n*u*d+a*h*E-n*l*E,r[3]=c*d*m-l*p*m-c*f*g+h*p*g+l*f*v-h*d*v,r[7]=a*p*m-o*d*m+o*f*g-n*p*g-a*f*v+n*d*v,r[11]=o*l*m-a*c*m-o*h*g+n*c*g+a*h*v-n*l*v,r[15]=a*c*f-o*l*f+o*h*d-n*c*d-a*h*p+n*l*p;var x=n*r[0]+h*r[4]+f*r[8]+m*r[12];if(0==x){var y="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(y);return console.warn(y),this.identity(),this}return this.multiplyScalar(1/x),this},translate:function(t){console.warn("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){console.warn("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){console.warn("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){console.warn("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){console.warn("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(t){var e=this.elements,r=t.x,i=t.y,n=t.z;return e[0]*=r,e[4]*=i,e[8]*=n,e[1]*=r,e[5]*=i,e[9]*=n,e[2]*=r,e[6]*=i,e[10]*=n,e[3]*=r,e[7]*=i,e[11]*=n,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,Math.max(r,i)))},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),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,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,a=t.x,o=t.y,s=t.z,h=n*a,l=n*o;return this.set(h*a+r,h*o-i*s,h*s+i*o,0,h*o+i*s,l*o+r,l*s-i*a,0,h*s-i*o,l*s+i*a,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 c=new THREE.Vector3,u=new THREE.Matrix4;return function(t,e,r){var i=this.elements,n=c.set(i[0],i[1],i[2]).length(),a=c.set(i[4],i[5],i[6]).length(),o=c.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],u.elements.set(this.elements);var s=1/n,h=1/a,l=1/o;return u.elements[0]*=s,u.elements[1]*=s,u.elements[2]*=s,u.elements[4]*=h,u.elements[5]*=h,u.elements[6]*=h,u.elements[8]*=l,u.elements[9]*=l,u.elements[10]*=l,e.setFromRotationMatrix(u),r.x=n,r.y=a,r.z=o,this}}(),makeFrustum:function(t,e,r,i,n,a){var o=this.elements,s=2*n/(e-t),h=2*n/(i-r),l=(e+t)/(e-t),c=(i+r)/(i-r),u=-(a+n)/(a-n),f=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=h,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,r,i){var n=r*Math.tan(THREE.Math.degToRad(.5*t)),a=-n,o=a*e,s=n*e;return this.makeFrustum(o,s,a,n,r,i)},makeOrthographic:function(t,e,r,i,n,a){var o=this.elements,s=e-t,h=r-i,l=a-n,c=(e+t)/s,u=(r+i)/h,f=(a+n)/l;return o[0]=2/s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2/h,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2/l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,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],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}},THREE.Ray=function(t,e){this.origin=void 0!==t?t:new THREE.Vector3,this.direction=void 0!==e?e:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new THREE.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(t,e){var r=e||new THREE.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return i<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(){var r=new THREE.Vector3;return function(t){var e=r.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceTo(t):(r.copy(this.direction).multiplyScalar(e).add(this.origin),r.distanceTo(t))}}(),distanceSqToSegment:function(t,e,r,i){var n,a,o,s,h=t.clone().add(e).multiplyScalar(.5),l=e.clone().sub(t).normalize(),c=.5*t.distanceTo(e),u=this.origin.clone().sub(h),f=-this.direction.dot(l),d=u.dot(this.direction),p=-u.dot(l),E=u.lengthSq(),m=Math.abs(1-f*f);if(0<=m)if(a=f*d-p,s=c*m,0<=(n=f*p-d))if(-s<=a)if(a<=s){var g=1/m;o=(n*=g)*(n+f*(a*=g)+2*d)+a*(f*n+a+2*p)+E}else a=c,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;else a=-c,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;else a<=-s?o=-(n=Math.max(0,-(-f*c+d)))*n+(a=0<n?-c:Math.min(Math.max(-c,-p),c))*(a+2*p)+E:a<=s?(n=0,o=(a=Math.min(Math.max(-c,-p),c))*(a+2*p)+E):o=-(n=Math.max(0,-(f*c+d)))*n+(a=0<n?c:Math.min(Math.max(-c,-p),c))*(a+2*p)+E;else a=0<f?-c:c,o=-(n=Math.max(0,-(f*a+d)))*n+a*(a+2*p)+E;return r&&r.copy(this.direction.clone().multiplyScalar(n).add(this.origin)),i&&i.copy(l.clone().multiplyScalar(a).add(h)),o},isIntersectionSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},intersectSphere:function(){var h=new THREE.Vector3;return function(t,e){h.subVectors(t.center,this.origin);var r=h.dot(this.direction),i=h.dot(h)-r*r,n=t.radius*t.radius;if(n<i)return null;var a=Math.sqrt(n-i),o=r-a,s=r+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}}(),isIntersectionPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0==e)return 0==t.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=r?r:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},isIntersectionBox:function(){var e=new THREE.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(t,e){var r,i,n,a,o,s,h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return 0<=h?(r=(t.min.x-u.x)*h,i=(t.max.x-u.x)*h):(r=(t.max.x-u.x)*h,i=(t.min.x-u.x)*h),0<=l?(n=(t.min.y-u.y)*l,a=(t.max.y-u.y)*l):(n=(t.max.y-u.y)*l,a=(t.min.y-u.y)*l),a<r||i<n?null:((r<n||r!=r)&&(r=n),(a<i||i!=i)&&(i=a),0<=c?(o=(t.min.z-u.z)*c,s=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,s=(t.min.z-u.z)*c),s<r||i<o?null:((r<o||r!=r)&&(r=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(0<=r?r:i,e)))},intersectTriangle:function(){var c=new THREE.Vector3,u=new THREE.Vector3,f=new THREE.Vector3,d=new THREE.Vector3;return function(t,e,r,i,n){u.subVectors(e,t),f.subVectors(r,t),d.crossVectors(u,f);var a,o=this.direction.dot(d);if(0<o){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}c.subVectors(this.origin,t);var s=a*this.direction.dot(f.crossVectors(c,f));if(s<0)return null;var h=a*this.direction.dot(u.cross(c));if(h<0)return null;if(o<s+h)return null;var l=-a*c.dot(d);return l<0?null:this.at(l/o,n)}}(),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)},clone:function(){return(new THREE.Ray).copy(this)}},THREE.Sphere=function(t,e){this.center=void 0!==t?t:new THREE.Vector3,this.radius=void 0!==e?e:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var o=new THREE.Box3;return function(t,e){var r=this.center;void 0!==e?r.copy(e):o.setFromPoints(t).center(r);for(var i=0,n=0,a=t.length;n<a;n++)i=Math.max(i,r.distanceToSquared(t[n]));return this.radius=Math.sqrt(i),this}}(),copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},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},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),i=e||new THREE.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){var e=t||new THREE.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=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},clone:function(){return(new THREE.Sphere).copy(this)}},THREE.Frustum=function(t,e,r,i,n,a){this.planes=[void 0!==t?t:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==n?n:new THREE.Plane,void 0!==a?a:new THREE.Plane]},THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(t,e,r,i,n,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(r),o[3].copy(i),o[4].copy(n),o[5].copy(a),this},copy:function(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes,r=t.elements,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],h=r[5],l=r[6],c=r[7],u=r[8],f=r[9],d=r[10],p=r[11],E=r[12],m=r[13],g=r[14],v=r[15];return e[0].setComponents(o-i,c-s,p-u,v-E).normalize(),e[1].setComponents(o+i,c+s,p+u,v+E).normalize(),e[2].setComponents(o+n,c+h,p+f,v+m).normalize(),e[3].setComponents(o-n,c-h,p-f,v-m).normalize(),e[4].setComponents(o-a,c-l,p-d,v-g).normalize(),e[5].setComponents(o+a,c+l,p+d,v+g).normalize(),this},intersectsObject:function(){var r=new THREE.Sphere;return function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),r.copy(e.boundingSphere),r.applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSphere:function(t){for(var e=this.planes,r=t.center,i=-t.radius,n=0;n<6;n++){if(e[n].distanceToPoint(r)<i)return!1}return!0},intersectsBox:function(){var o=new THREE.Vector3,s=new THREE.Vector3;return function(t){for(var e=this.planes,r=0;r<6;r++){var i=e[r];o.x=0<i.normal.x?t.min.x:t.max.x,s.x=0<i.normal.x?t.max.x:t.min.x,o.y=0<i.normal.y?t.min.y:t.max.y,s.y=0<i.normal.y?t.max.y:t.min.y,o.z=0<i.normal.z?t.min.z:t.max.z,s.z=0<i.normal.z?t.max.z:t.min.z;var n=i.distanceToPoint(o),a=i.distanceToPoint(s);if(n<0&&a<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}},THREE.Plane=function(t,e){this.normal=void 0!==t?t:new THREE.Vector3(1,0,0),this.constant=void 0!==e?e:0},THREE.Plane.prototype={constructor:THREE.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 n=new THREE.Vector3,a=new THREE.Vector3;return function(t,e,r){var i=n.subVectors(r,e).cross(a.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),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 THREE.Vector3).copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start),r=this.distanceToPoint(t.end);return e<0&&0<r||r<0&&0<e},intersectLine:function(){var o=new THREE.Vector3;return function(t,e){var r=e||new THREE.Vector3,i=t.delta(o),n=this.normal.dot(i);if(0==n)return 0==this.distanceToPoint(t.start)?r.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/n;return a<0||1<a?void 0:r.copy(i).multiplyScalar(a).add(t.start)}}(),coplanarPoint:function(t){return(t||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Matrix3;return function(t,e){var r=e||s.getNormalMatrix(t),i=a.copy(this.normal).applyMatrix3(r),n=this.coplanarPoint(o);return n.applyMatrix4(t),this.setFromNormalAndCoplanarPoint(i,n),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}},THREE.Math={generateUUID:function(){var e,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var t=0;t<36;t++)8==t||13==t||18==t||23==t?i[t]="-":14==t?i[t]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[t]=r[19==t?3&e|8:e]);return i.join("")}}(),clamp:function(t,e,r){return t<e?e:r<t?r:t},clampBottom:function(t,e){return t<e?e:t},mapLinear:function(t,e,r,i,n){return i+(t-e)*(n-i)/(r-e)},smoothstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:r<=t?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},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 e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t}},THREE.Spline=function(t){this.points=t;var e,r,i,n,a,o,s,h,l,c=[],u={x:0,y:0,z:0};function f(t,e,r,i,n,a,o){var s=.5*(r-t),h=.5*(i-e);return(2*(e-r)+s+h)*o+(-3*(e-r)-2*s-h)*a+s*n+e}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 e=(this.points.length-1)*t,r=Math.floor(e),i=e-r,c[0]=0===r?r:r-1,c[1]=r,c[2]=r>this.points.length-2?this.points.length-1:r+1,c[3]=r>this.points.length-3?this.points.length-1:r+2,o=this.points[c[0]],s=this.points[c[1]],h=this.points[c[2]],l=this.points[c[3]],a=i*(n=i*i),u.x=f(o.x,s.x,h.x,l.x,i,n,a),u.y=f(o.y,s.y,h.y,l.y,i,n,a),u.z=f(o.z,s.z,h.z,l.z,i,n,a),u},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,a=0,o=0,s=0,h=new THREE.Vector3,l=new THREE.Vector3,c=[],u=0;for(c[0]=0,t||(t=100),i=this.points.length*t,h.copy(this.points[0]),e=1;e<i;e++)r=e/i,n=this.getPoint(r),l.copy(n),u+=l.distanceTo(h),h.copy(n),a=(this.points.length-1)*r,(o=Math.floor(a))!=s&&(c[o]=u,s=o);return c[c.length]=u,{chunks:c,total:u}},this.reparametrizeByArcLength=function(t){var e,r,i,n,a,o,s,h,l=[],c=new THREE.Vector3,u=this.getLength();for(l.push(c.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(o=u.chunks[e]-u.chunks[e-1],s=Math.ceil(t*o/u.total),n=(e-1)/(this.points.length-1),a=e/(this.points.length-1),r=1;r<s-1;r++)i=n+r*(1/s)*(a-n),h=this.getPoint(i),l.push(c.copy(h).clone());l.push(c.copy(this.points[e]).clone())}this.points=l}},THREE.Clock=function(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();t=.001*(e-this.oldTime),this.oldTime=e,this.elapsedTime+=t}return t}},THREE.EventDispatcher=function(){},THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(t){t.addEventListener=THREE.EventDispatcher.prototype.addEventListener,t.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener,t.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=THREE.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)}}}},THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var t=new THREE.Vector3,e=new THREE.Euler,r=new THREE.Quaternion,i=new THREE.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}}),this.renderDepth=null,this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){return console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(t){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=t},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},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 r=new THREE.Quaternion;return function(t,e){return r.setFromAxisAngle(t,e),this.quaternion.multiply(r),this}}(),rotateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var r=new THREE.Vector3;return function(t,e){return r.copy(t).applyQuaternion(this.quaternion),this.position.add(r.multiplyScalar(e)),this}}(),translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},translateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new THREE.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new THREE.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),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:",t,"can't be added as a child of itself."):t instanceof THREE.Object3D?(void 0!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add:",t,"is not an instance of THREE.Object3D."),this},remove:function(t){if(1<arguments.length)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var r=this.children.indexOf(t);-1!==r&&(t.parent=void 0,t.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getChildByName:function(t,e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t,e)},getObjectById:function(t,e){if(this.id===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectById(t,e);if(void 0!==n)return n}},getObjectByName:function(t,e){if(this.name===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByName(t,e);if(void 0!==n)return n}},getWorldPosition:function(t){var e=t||new THREE.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var r=new THREE.Vector3,i=new THREE.Vector3;return function(t){var e=t||new THREE.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,e,i),e}}(),getWorldRotation:function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Euler;return this.getWorldQuaternion(r),e.setFromQuaternion(r,this.rotation.order,!1)}}(),getWorldScale:function(){var r=new THREE.Vector3,i=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,i,e),e}}(),getWorldDirection:function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.getWorldQuaternion(r),e.set(0,0,1).applyQuaternion(r)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=0,r=this.children.length;e<r;e++)this.children[e].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=0,r=this.children.length;e<r;e++)this.children[e].traverseVisible(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||(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(){var r={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},i={},n=function(t){if(void 0===r.geometries&&(r.geometries=[]),void 0===i[t.uuid]){var e=t.toJSON();delete e.metadata,i[t.uuid]=e,r.geometries.push(e)}return t.uuid},a={},o=function(t){if(void 0===r.materials&&(r.materials=[]),void 0===a[t.uuid]){var e=t.toJSON();delete e.metadata,a[t.uuid]=e,r.materials.push(e)}return t.uuid},s=function(t){var e={};if(e.uuid=t.uuid,e.type=t.type,""!==t.name&&(e.name=t.name),"{}"!==JSON.stringify(t.userData)&&(e.userData=t.userData),!0!==t.visible&&(e.visible=t.visible),t instanceof THREE.PerspectiveCamera?(e.fov=t.fov,e.aspect=t.aspect,e.near=t.near,e.far=t.far):t instanceof THREE.OrthographicCamera?(e.left=t.left,e.right=t.right,e.top=t.top,e.bottom=t.bottom,e.near=t.near,e.far=t.far):t instanceof THREE.AmbientLight?e.color=t.color.getHex():t instanceof THREE.DirectionalLight?(e.color=t.color.getHex(),e.intensity=t.intensity):t instanceof THREE.PointLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance):t instanceof THREE.SpotLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.angle=t.angle,e.exponent=t.exponent):t instanceof THREE.HemisphereLight?(e.color=t.color.getHex(),e.groundColor=t.groundColor.getHex()):t instanceof THREE.Mesh?(e.geometry=n(t.geometry),e.material=o(t.material)):t instanceof THREE.Line?(e.geometry=n(t.geometry),e.material=o(t.material)):t instanceof THREE.Sprite&&(e.material=o(t.material)),e.matrix=t.matrix.toArray(),0<t.children.length){e.children=[];for(var r=0;r<t.children.length;r++)e.children.push(s(t.children[r]))}return e};return r.object=s(this),r},clone:function(t,e){if(void 0===t&&(t=new THREE.Object3D),void 0===e&&(e=!0),t.name=this.name,t.up.copy(this.up),t.position.copy(this.position),t.quaternion.copy(this.quaternion),t.scale.copy(this.scale),t.renderDepth=this.renderDepth,t.rotationAutoUpdate=this.rotationAutoUpdate,t.matrix.copy(this.matrix),t.matrixWorld.copy(this.matrixWorld),t.matrixAutoUpdate=this.matrixAutoUpdate,t.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,t.visible=this.visible,t.castShadow=this.castShadow,t.receiveShadow=this.receiveShadow,t.frustumCulled=this.frustumCulled,t.userData=JSON.parse(JSON.stringify(this.userData)),!0===e)for(var r=0;r<this.children.length;r++){var i=this.children[r];t.add(i.clone())}return t}},THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype),THREE.Object3DIdCount=0,THREE.Face3=function(t,e,r,i,n,a){this.a=t,this.b=e,this.c=r,this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3,this.vertexNormals=i instanceof Array?i:[],this.color=n instanceof THREE.Color?n:new THREE.Color,this.vertexColors=n instanceof Array?n:[],this.vertexTangents=[],this.materialIndex=void 0!==a?a:0},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var t=new THREE.Face3(this.a,this.b,this.c);t.normal.copy(this.normal),t.color.copy(this.color),t.materialIndex=this.materialIndex;for(var e=0,r=this.vertexNormals.length;e<r;e++)t.vertexNormals[e]=this.vertexNormals[e].clone();for(e=0,r=this.vertexColors.length;e<r;e++)t.vertexColors[e]=this.vertexColors[e].clone();for(e=0,r=this.vertexTangents.length;e<r;e++)t.vertexTangents[e]=this.vertexTangents[e].clone();return t}},THREE.BufferAttribute=function(t,e){this.array=t,this.itemSize=e,this.needsUpdate=!1},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},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]},set:function(t){return this.array.set(t),this},setX:function(t,e){return this.array[t*this.itemSize]=e,this},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,i){return t*=this.itemSize,this.array[t]=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]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=n,this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(t,e){if(e instanceof THREE.BufferAttribute==!1)return console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void(this.attributes[t]={array:e,itemSize:arguments[2]});this.attributes[t]=e,this.attributesKeys=Object.keys(this.attributes)},getAttribute:function(t){return this.attributes[t]},addDrawCall:function(t,e,r){this.drawcalls.push({start:t,count:e,index:void 0!==r?r:0})},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var r=this.attributes.normal;void 0!==r&&((new THREE.Matrix3).getNormalMatrix(t).applyToVector3Array(r.array),r.needsUpdate=!0)},center:function(){},fromGeometry:function(t,e){e=e||{vertexColors:THREE.NoColors};var r=t.vertices,i=t.faces,n=t.faceVertexUvs,a=e.vertexColors,o=0<n[0].length,s=3==i[0].vertexNormals.length,h=new Float32Array(3*i.length*3);this.addAttribute("position",new THREE.BufferAttribute(h,3));var l=new Float32Array(3*i.length*3);if(this.addAttribute("normal",new THREE.BufferAttribute(l,3)),a!==THREE.NoColors){var c=new Float32Array(3*i.length*3);this.addAttribute("color",new THREE.BufferAttribute(c,3))}if(!0===o){var u=new Float32Array(3*i.length*2);this.addAttribute("uv",new THREE.BufferAttribute(u,2))}for(var f=0,d=0,p=0;f<i.length;f++,d+=6,p+=9){var E=i[f],m=r[E.a],g=r[E.b],v=r[E.c];if(h[p]=m.x,h[p+1]=m.y,h[p+2]=m.z,h[p+3]=g.x,h[p+4]=g.y,h[p+5]=g.z,h[p+6]=v.x,h[p+7]=v.y,h[p+8]=v.z,!0===s){var T=E.vertexNormals[0],x=E.vertexNormals[1],y=E.vertexNormals[2];l[p]=T.x,l[p+1]=T.y,l[p+2]=T.z,l[p+3]=x.x,l[p+4]=x.y,l[p+5]=x.z,l[p+6]=y.x,l[p+7]=y.y,l[p+8]=y.z}else{var R=E.normal;l[p]=R.x,l[p+1]=R.y,l[p+2]=R.z,l[p+3]=R.x,l[p+4]=R.y,l[p+5]=R.z,l[p+6]=R.x,l[p+7]=R.y,l[p+8]=R.z}if(a===THREE.FaceColors){var _=E.color;c[p]=_.r,c[p+1]=_.g,c[p+2]=_.b,c[p+3]=_.r,c[p+4]=_.g,c[p+5]=_.b,c[p+6]=_.r,c[p+7]=_.g,c[p+8]=_.b}else if(a===THREE.VertexColors){var H=E.vertexColors[0],b=E.vertexColors[1],M=E.vertexColors[2];c[p]=H.r,c[p+1]=H.g,c[p+2]=H.b,c[p+3]=b.r,c[p+4]=b.g,c[p+5]=b.b,c[p+6]=M.r,c[p+7]=M.g,c[p+8]=M.b}if(!0===o){var w=n[0][f][0],S=n[0][f][1],A=n[0][f][2];u[d]=w.x,u[d+1]=w.y,u[d+2]=S.x,u[d+3]=S.y,u[d+4]=A.x,u[d+5]=A.y}}return this.computeBoundingSphere(),this},computeBoundingBox:function(){var n=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.position.array;if(t){var e=this.boundingBox;e.makeEmpty();for(var r=0,i=t.length;r<i;r+=3)n.set(t[r],t[r+1],t[r+2]),e.expandByPoint(n)}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.')}}(),computeBoundingSphere:function(){var a=new THREE.Box3,o=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array;if(t){a.makeEmpty();for(var e=this.boundingSphere.center,r=0,i=t.length;r<i;r+=3)o.set(t[r],t[r+1],t[r+2]),a.expandByPoint(o);a.center(e);var n=0;for(r=0,i=t.length;r<i;r+=3)o.set(t[r],t[r+1],t[r+2]),n=Math.max(n,e.distanceToSquared(o));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.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.attributes;if(t.position){var e=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(e.length),3));else for(var r=0,i=(s=t.normal.array).length;r<i;r++)s[r]=0;var n,a,o,s=t.normal.array,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3,u=new THREE.Vector3,f=new THREE.Vector3;if(t.index)for(var d=t.index.array,p=0<this.offsets.length?this.offsets:[{start:0,count:d.length,index:0}],E=0,m=p.length;E<m;++E){var g=p[E].start,v=p[E].count,T=p[E].index;for(r=g,i=g+v;r<i;r+=3)n=3*(T+d[r]),a=3*(T+d[r+1]),o=3*(T+d[r+2]),h.fromArray(e,n),l.fromArray(e,a),c.fromArray(e,o),u.subVectors(c,l),f.subVectors(h,l),u.cross(f),s[n]+=u.x,s[n+1]+=u.y,s[n+2]+=u.z,s[a]+=u.x,s[a+1]+=u.y,s[a+2]+=u.z,s[o]+=u.x,s[o+1]+=u.y,s[o+2]+=u.z}else for(r=0,i=e.length;r<i;r+=9)h.fromArray(e,r),l.fromArray(e,r+3),c.fromArray(e,r+6),u.subVectors(c,l),f.subVectors(h,l),u.cross(f),s[r]=u.x,s[r+1]=u.y,s[r+2]=u.z,s[r+3]=u.x,s[r+4]=u.y,s[r+5]=u.z,s[r+6]=u.x,s[r+7]=u.y,s[r+8]=u.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){if(void 0!==this.attributes.index&&void 0!==this.attributes.position&&void 0!==this.attributes.normal&&void 0!==this.attributes.uv){var t=this.attributes.index.array,e=this.attributes.position.array,r=this.attributes.normal.array,i=this.attributes.uv.array,n=e.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*n),4));for(var a=this.attributes.tangent.array,o=[],s=[],h=0;h<n;h++)o[h]=new THREE.Vector3,s[h]=new THREE.Vector3;var l,c,u,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w=new THREE.Vector3,S=new THREE.Vector3,A=new THREE.Vector3,C=new THREE.Vector2,D=new THREE.Vector2,L=new THREE.Vector2,P=new THREE.Vector3,F=new THREE.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,t.length,0);var U,B,z,N=this.drawcalls;for(R=0,_=N.length;R<_;++R){var k=N[R].start,V=N[R].count,O=N[R].index;for(y=(x=k)+V;x<y;x+=3)H=O+t[x],b=O+t[x+1],M=O+t[x+2],U=H,B=b,z=M,w.fromArray(e,3*U),S.fromArray(e,3*B),A.fromArray(e,3*z),C.fromArray(i,2*U),D.fromArray(i,2*B),L.fromArray(i,2*z),l=S.x-w.x,c=A.x-w.x,u=S.y-w.y,f=A.y-w.y,d=S.z-w.z,p=A.z-w.z,E=D.x-C.x,m=L.x-C.x,g=D.y-C.y,v=L.y-C.y,T=1/(E*v-m*g),P.set((v*l-g*c)*T,(v*u-g*f)*T,(v*d-g*p)*T),F.set((E*c-m*l)*T,(E*f-m*u)*T,(E*p-m*d)*T),o[U].add(P),o[B].add(P),o[z].add(P),s[U].add(F),s[B].add(F),s[z].add(F)}var I,G,W,X=new THREE.Vector3,j=new THREE.Vector3,Y=new THREE.Vector3,q=new THREE.Vector3;for(R=0,_=N.length;R<_;++R){k=N[R].start,V=N[R].count,O=N[R].index;for(y=(x=k)+V;x<y;x+=3)H=O+t[x],b=O+t[x+1],M=O+t[x+2],K(H),K(b),K(M)}}else console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");function K(t){Y.fromArray(r,3*t),q.copy(Y),G=o[t],X.copy(G),X.sub(Y.multiplyScalar(Y.dot(G))).normalize(),j.crossVectors(q,G),W=j.dot(s[t]),I=W<0?-1:1,a[4*t]=X.x,a[4*t+1]=X.y,a[4*t+2]=X.z,a[4*t+3]=I}},computeOffsets:function(t){var e=t;void 0===t&&(e=65535);Date.now();for(var r=this.attributes.index.array,i=this.attributes.position.array,n=(i.length,r.length/3),a=new Uint16Array(r.length),o=0,s=0,h=[{start:0,count:0,index:0}],l=h[0],c=0,u=new Int32Array(6),f=new Int32Array(i.length),d=new Int32Array(i.length),p=0;p<i.length;p++)f[p]=-1,d[p]=-1;for(var E=0;E<n;E++){for(var m=c=0;m<3;m++){-1==f[x=r[3*E+m]]?(u[2*m]=x,u[2*m+1]=-1,c++):f[x]<l.index?(u[2*m]=x,u[2*m+1]=-1,0):(u[2*m]=x,u[2*m+1]=f[x])}if(s+c>l.index+e){var g={start:o,count:0,index:s};h.push(g),l=g;for(var v=0;v<6;v+=2){-1<(T=u[v+1])&&T<l.index&&(u[v+1]=-1)}}for(v=0;v<6;v+=2){var T,x=u[v];-1===(T=u[v+1])&&(T=s++),d[f[x]=T]=x,a[o++]=T-l.index,l.count++}}return this.reorderBuffers(a,d,s),this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var t,e,r,i,n=this.attributes.normal.array,a=0,o=n.length;a<o;a+=3)t=n[a],e=n[a+1],r=n[a+2],i=1/Math.sqrt(t*t+e*e+r*r),n[a]*=i,n[a+1]*=i,n[a+2]*=i},reorderBuffers:function(t,e,r){var i={};for(var n in this.attributes)if("index"!=n){var a=this.attributes[n].array;i[n]=new a.constructor(this.attributes[n].itemSize*r)}for(var o=0;o<r;o++){var s=e[o];for(var n in this.attributes)if("index"!=n)for(var h=this.attributes[n].array,l=this.attributes[n].itemSize,c=i[n],u=0;u<l;u++)c[o*l+u]=h[s*l+u]}for(var n in this.attributes.index.array=t,this.attributes)"index"!=n&&(this.attributes[n].array=i[n],this.attributes[n].numItems=this.attributes[n].itemSize*r)},toJSON:function(){var t={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},e=this.attributes,r=this.offsets,i=this.boundingSphere;for(var n in e){for(var a=e[n],o=[],s=a.array,h=0,l=s.length;h<l;h++)o[h]=s[h];t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:o}}return 0<r.length&&(t.data.offsets=JSON.parse(JSON.stringify(r))),null!==i&&(t.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),t},clone:function(){var t=new THREE.BufferGeometry;for(var e in this.attributes){var r=this.attributes[e];t.addAttribute(e,r.clone())}for(var i=0,n=this.offsets.length;i<n;i++){var a=this.offsets[i];t.offsets.push({start:a.start,index:a.index,count:a.count})}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(t){for(var e=(new THREE.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++){var n=this.faces[r];n.normal.applyMatrix3(e).normalize();for(var a=0,o=n.vertexNormals.length;a<o;a++)n.vertexNormals[a].applyMatrix3(e).normalize()}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox(),this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},fromBufferGeometry:function(t){for(var a=this,e=t.attributes,r=e.position.array,i=void 0!==e.index?e.index.array:void 0,o=void 0!==e.normal?e.normal.array:void 0,s=void 0!==e.color?e.color.array:void 0,n=void 0!==e.uv?e.uv.array:void 0,h=[],l=[],c=0,u=0;c<r.length;c+=3,u+=2)a.vertices.push(new THREE.Vector3(r[c],r[c+1],r[c+2])),void 0!==o&&h.push(new THREE.Vector3(o[c],o[c+1],o[c+2])),void 0!==s&&a.colors.push(new THREE.Color(s[c],s[c+1],s[c+2])),void 0!==n&&l.push(new THREE.Vector2(n[u],n[u+1]));var f=function(t,e,r){var i=void 0!==o?[h[t].clone(),h[e].clone(),h[r].clone()]:[],n=void 0!==s?[a.colors[t].clone(),a.colors[e].clone(),a.colors[r].clone()]:[];a.faces.push(new THREE.Face3(t,e,r,i,n)),a.faceVertexUvs[0].push([l[t],l[e],l[r]])};if(void 0!==i)for(c=0;c<i.length;c+=3)f(i[c],i[c+1],i[c+2]);else for(c=0;c<r.length/3;c+=3)f(c,c+1,c+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=new THREE.Vector3;return t.addVectors(this.boundingBox.min,this.boundingBox.max),t.multiplyScalar(-.5),this.applyMatrix((new THREE.Matrix4).makeTranslation(t.x,t.y,t.z)),this.computeBoundingBox(),t},computeFaceNormals:function(){for(var t=new THREE.Vector3,e=new THREE.Vector3,r=0,i=this.faces.length;r<i;r++){var n=this.faces[r],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),n.normal.copy(t)}},computeVertexNormals:function(t){var e,r,i,n,a,o;for(o=new Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)o[e]=new THREE.Vector3;if(t){var s,h,l,c=new THREE.Vector3,u=new THREE.Vector3;new THREE.Vector3,new THREE.Vector3,new THREE.Vector3;for(i=0,n=this.faces.length;i<n;i++)a=this.faces[i],s=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],c.subVectors(l,h),u.subVectors(s,h),c.cross(u),o[a.a].add(c),o[a.b].add(c),o[a.c].add(c)}else for(i=0,n=this.faces.length;i<n;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,r=this.vertices.length;e<r;e++)o[e].normalize();for(i=0,n=this.faces.length;i<n;i++)(a=this.faces[i]).vertexNormals[0]=o[a.a].clone(),a.vertexNormals[1]=o[a.b].clone(),a.vertexNormals[2]=o[a.c].clone()},computeMorphNormals:function(){var t,e,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=[]),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 a=new THREE.Geometry;for(a.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=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;r<i;r++)h=new THREE.Vector3,l={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},o.push(h),s.push(l)}var h,l,c=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),r=0,i=this.faces.length;r<i;r++)n=this.faces[r],h=c.faceNormals[r],l=c.vertexNormals[r],h.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.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(){var t,e,r,i,n,a,o,s,h,l,c,u,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w,S,A,C,D,L,P,F=[],U=[],B=new THREE.Vector3,z=new THREE.Vector3,N=new THREE.Vector3,k=new THREE.Vector3,V=new THREE.Vector3;for(r=0,i=this.vertices.length;r<i;r++)F[r]=new THREE.Vector3,U[r]=new THREE.Vector3;for(t=0,e=this.faces.length;t<e;t++)o=this.faces[t],s=this.faceVertexUvs[0][t],w=this,S=o.a,A=o.b,C=o.c,D=0,L=1,P=2,h=w.vertices[S],l=w.vertices[A],c=w.vertices[C],u=s[D],f=s[L],d=s[P],p=l.x-h.x,E=c.x-h.x,m=l.y-h.y,g=c.y-h.y,v=l.z-h.z,T=c.z-h.z,x=f.x-u.x,y=d.x-u.x,R=f.y-u.y,_=d.y-u.y,H=1/(x*_-y*R),B.set((_*p-R*E)*H,(_*m-R*g)*H,(_*v-R*T)*H),z.set((x*E-y*p)*H,(x*g-y*m)*H,(x*T-y*v)*H),F[S].add(B),F[A].add(B),F[C].add(B),U[S].add(z),U[A].add(z),U[C].add(z);var O=["a","b","c","d"];for(t=0,e=this.faces.length;t<e;t++)for(o=this.faces[t],n=0;n<Math.min(o.vertexNormals.length,3);n++)V.copy(o.vertexNormals[n]),a=o[O[n]],b=F[a],N.copy(b),N.sub(V.multiplyScalar(V.dot(b))).normalize(),k.crossVectors(o.vertexNormals[n],b),M=k.dot(U[a])<0?-1:1,o.vertexTangents[n]=new THREE.Vector4(N.x,N.y,N.z,M);this.hasTangents=!0},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 THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(t instanceof THREE.Geometry!=!1){var i,n=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,h=t.faces,l=this.faceVertexUvs[0],c=t.faceVertexUvs[0];void 0===r&&(r=0),void 0!==e&&(i=(new THREE.Matrix3).getNormalMatrix(e));for(var u=0,f=o.length;u<f;u++){var d=o[u].clone();void 0!==e&&d.applyMatrix4(e),a.push(d)}for(u=0,f=h.length;u<f;u++){var p,E,m,g=h[u],v=g.vertexNormals,T=g.vertexColors;(p=new THREE.Face3(g.a+n,g.b+n,g.c+n)).normal.copy(g.normal),void 0!==i&&p.normal.applyMatrix3(i).normalize();for(var x=0,y=v.length;x<y;x++)E=v[x].clone(),void 0!==i&&E.applyMatrix3(i).normalize(),p.vertexNormals.push(E);p.color.copy(g.color);for(x=0,y=T.length;x<y;x++)m=T[x],p.vertexColors.push(m.clone());p.materialIndex=g.materialIndex+r,s.push(p)}for(u=0,f=c.length;u<f;u++){var R=c[u],_=[];if(void 0!==R){for(x=0,y=R.length;x<y;x++)_.push(new THREE.Vector2(R[x].x,R[x].y));l.push(_)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeVertices:function(){var t,e,r,i,n,a,o,s,h={},l=[],c=[],u=Math.pow(10,4);for(r=0,i=this.vertices.length;r<i;r++)t=this.vertices[r],void 0===h[e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u)]?(h[e]=r,l.push(this.vertices[r]),c[r]=l.length-1):c[r]=c[h[e]];var f=[];for(r=0,i=this.faces.length;r<i;r++){(n=this.faces[r]).a=c[n.a],n.b=c[n.b],n.c=c[n.c],a=[n.a,n.b,n.c];for(var d=0;d<3;d++)if(a[d]==a[(d+1)%3]){d,f.push(r);break}}for(r=f.length-1;0<=r;r--){var p=f[r];for(this.faces.splice(p,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(p,1)}var E=this.vertices.length-l.length;return this.vertices=l,E},toJSON:function(){var t={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}for(var i=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];i.push(a.x,a.y,a.z)}var o=[],s=[],h={},l=[],c={},u=[],f={};for(n=0;n<this.faces.length;n++){var d=this.faces[n],p=void 0!==this.faceVertexUvs[0][n],E=0<d.normal.length(),m=0<d.vertexNormals.length,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,v=0<d.vertexColors.length,T=0;if(T=_(T=_(T=_(T=_(T=_(T=_(T=_(T=_(T,0,0),1,!1),2,!1),3,p),4,E),5,m),6,g),7,v),o.push(T),o.push(d.a,d.b,d.c),p){var x=this.faceVertexUvs[0][n];o.push(M(x[0]),M(x[1]),M(x[2]))}if(E&&o.push(H(d.normal)),m){var y=d.vertexNormals;o.push(H(y[0]),H(y[1]),H(y[2]))}if(g&&o.push(b(d.color)),v){var R=d.vertexColors;o.push(b(R[0]),b(R[1]),b(R[2]))}}function _(t,e,r){return r?t|1<<e:t&~(1<<e)}function H(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==h[e]||(h[e]=s.length/3,s.push(t.x,t.y,t.z)),h[e]}function b(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==c[e]||(c[e]=l.length,l.push(t.getHex())),c[e]}function M(t){var e=t.x.toString()+t.y.toString();return void 0!==f[e]||(f[e]=u.length/2,u.push(t.x,t.y)),f[e]}return t.data={},t.data.vertices=i,t.data.normals=s,0<l.length&&(t.data.colors=l),0<u.length&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){for(var t=new THREE.Geometry,e=this.vertices,r=0,i=e.length;r<i;r++)t.vertices.push(e[r].clone());var n=this.faces;for(r=0,i=n.length;r<i;r++)t.faces.push(n[r].clone());var a=this.faceVertexUvs[0];for(r=0,i=a.length;r<i;r++){for(var o=a[r],s=[],h=0,l=o.length;h<l;h++)s.push(new THREE.Vector2(o[h].x,o[h].y));t.faceVertexUvs[0].push(s)}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.Camera=function(){THREE.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.getWorldDirection=function(){var r=new THREE.Quaternion;return function(t){var e=t||new THREE.Vector3;return this.getWorldQuaternion(r),e.set(0,0,-1).applyQuaternion(r)}}(),THREE.Camera.prototype.lookAt=function(){var e=new THREE.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),THREE.Camera.prototype.clone=function(t){return void 0===t&&(t=new THREE.Camera),THREE.Object3D.prototype.clone.call(this,t),t.matrixWorldInverse.copy(this.matrixWorldInverse),t.projectionMatrix.copy(this.projectionMatrix),t},THREE.PerspectiveCamera=function(t,e,r,i){THREE.Camera.call(this),this.type="PerspectiveCamera",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()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*THREE.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.setViewOffset=function(t,e,r,i,n,a){this.fullWidth=t,this.fullHeight=e,this.x=r,this.y=i,this.width=n,this.height=a,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=this.fullWidth/this.fullHeight,r=Math.tan(THREE.Math.degToRad(.5*t))*this.near,i=-r,n=e*i,a=e*r,o=Math.abs(a-n),s=Math.abs(r-i);this.projectionMatrix.makeFrustum(n+this.x*o/this.fullWidth,n+(this.x+this.width)*o/this.fullWidth,r-(this.y+this.height)*s/this.fullHeight,r-this.y*s/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},THREE.PerspectiveCamera.prototype.clone=function(){var t=new THREE.PerspectiveCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),t},THREE.Light=function(t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(t)},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.clone=function(t){return void 0===t&&(t=new THREE.Light),THREE.Object3D.prototype.clone.call(this,t),t.color.copy(this.color),t},THREE.Cache=function(){this.files={}},THREE.Cache.prototype={constructor:THREE.Cache,add:function(t,e){this.files[t]=e},get:function(t){return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},THREE.Loader=function(t){this.showStatus=t,this.statusDomElement=t?THREE.Loader.prototype.addStatusElement():null,this.imageLoader=new THREE.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var t=document.createElement("div");return t.style.position="absolute",t.style.right="0px",t.style.top="0px",t.style.fontSize="0.8em",t.style.textAlign="left",t.style.background="rgba(0,0,0,0.25)",t.style.color="#fff",t.style.width="120px",t.style.padding="0.5em 0.5em 0.5em 0.5em",t.style.zIndex=1e3,t.innerHTML="Loading ...",t},updateProgress:function(t){var e="Loaded ";t.total?e+=(100*t.loaded/t.total).toFixed(0)+"%":e+=(t.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=e},extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e){for(var r=[],i=0;i<t.length;++i)r[i]=this.createMaterial(t[i],e);return r},needsTangents:function(t){for(var e=0,r=t.length;e<r;e++){if(t[e]instanceof THREE.ShaderMaterial)return!0}return!1},createMaterial:function(t,u){var f=this;function d(t){var e=Math.log(t)/Math.LN2;return Math.pow(2,Math.round(e))}function e(t,e,r,i,n,a,o){var s,h=u+r,l=THREE.Loader.Handlers.get(h);if(null!==l?s=l.load(h):(s=new THREE.Texture,(l=f.imageLoader).crossOrigin=f.crossOrigin,l.load(h,function(t){if(!1===THREE.Math.isPowerOfTwo(t.width)||!1===THREE.Math.isPowerOfTwo(t.height)){var e=d(t.width),r=d(t.height),i=document.createElement("canvas");i.width=e,i.height=r,i.getContext("2d").drawImage(t,0,0,e,r),s.image=i}else s.image=t;s.needsUpdate=!0})),s.sourceFile=r,i&&(s.repeat.set(i[0],i[1]),1!==i[0]&&(s.wrapS=THREE.RepeatWrapping),1!==i[1]&&(s.wrapT=THREE.RepeatWrapping)),n&&s.offset.set(n[0],n[1]),a){var c={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};void 0!==c[a[0]]&&(s.wrapS=c[a[0]]),void 0!==c[a[1]]&&(s.wrapT=c[a[1]])}o&&(s.anisotropy=o),t[e]=s}function r(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]}var i="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(t.shading){var a=t.shading.toLowerCase();"phong"===a?i="MeshPhongMaterial":"basic"===a&&(i="MeshBasicMaterial")}if(void 0!==t.blending&&void 0!==THREE[t.blending]&&(n.blending=THREE[t.blending]),(void 0!==t.transparent||t.opacity<1)&&(n.transparent=t.transparent),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.flipSided&&(n.side=THREE.BackSide),void 0!==t.doubleSided&&(n.side=THREE.DoubleSide),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.vertexColors&&("face"===t.vertexColors?n.vertexColors=THREE.FaceColors:t.vertexColors&&(n.vertexColors=THREE.VertexColors)),t.colorDiffuse?n.color=r(t.colorDiffuse):t.DbgColor&&(n.color=t.DbgColor),t.colorSpecular&&(n.specular=r(t.colorSpecular)),t.colorAmbient&&(n.ambient=r(t.colorAmbient)),t.colorEmissive&&(n.emissive=r(t.colorEmissive)),t.transparency&&(n.opacity=t.transparency),t.specularCoef&&(n.shininess=t.specularCoef),t.mapDiffuse&&u&&e(n,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy),t.mapLight&&u&&e(n,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy),t.mapBump&&u&&e(n,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy),t.mapNormal&&u&&e(n,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy),t.mapSpecular&&u&&e(n,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy),t.mapAlpha&&u&&e(n,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy),t.mapBumpScale&&(n.bumpScale=t.mapBumpScale),t.mapNormal){var o=THREE.ShaderLib.normalmap,s=THREE.UniformsUtils.clone(o.uniforms);s.tNormal.value=n.normalMap,t.mapNormalFactor&&s.uNormalScale.value.set(t.mapNormalFactor,t.mapNormalFactor),n.map&&(s.tDiffuse.value=n.map,s.enableDiffuse.value=!0),n.specularMap&&(s.tSpecular.value=n.specularMap,s.enableSpecular.value=!0),n.lightMap&&(s.tAO.value=n.lightMap,s.enableAO.value=!0),s.diffuse.value.setHex(n.color),s.specular.value.setHex(n.specular),s.ambient.value.setHex(n.ambient),s.shininess.value=n.shininess,void 0!==n.opacity&&(s.opacity.value=n.opacity);var h={fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:s,lights:!0,fog:!0},l=new THREE.ShaderMaterial(h);n.transparent&&(l.transparent=!0)}else l=new THREE[i](n);return void 0!==t.DbgName&&(l.name=t.DbgName),l}},THREE.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=0,r=this.handlers.length;e<r;e+=2){var i=this.handlers[e],n=this.handlers[e+1];if(i.test(t))return n}return null}},THREE.XHRLoader=function(t){this.cache=new THREE.Cache,this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(e,r,i,n){var a=this,t=a.cache.get(e);if(void 0===t){var o=new XMLHttpRequest;o.open("GET",e,!0),o.addEventListener("load",function(t){a.cache.add(e,this.response),r&&r(this.response),a.manager.itemEnd(e)},!1),void 0!==i&&o.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&o.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(o.responseType=this.responseType),o.send(null),a.manager.itemStart(e)}else r&&r(t)},setResponseType:function(t){this.responseType=t},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.ImageLoader=function(t){this.cache=new THREE.Cache,this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,r,i,n){var a=this,t=a.cache.get(e);if(void 0===t){var o=document.createElement("img");return void 0!==r&&o.addEventListener("load",function(t){a.cache.add(e,this),r(this),a.manager.itemEnd(e)},!1),void 0!==i&&o.addEventListener("progress",function(t){i(t)},!1),void 0!==n&&o.addEventListener("error",function(t){n(t)},!1),void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),o.src=e,a.manager.itemStart(e),o}r(t)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.LoadingManager=function(t,e,r){var i=this,n=0,a=0;this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){a++},this.itemEnd=function(t){n++,void 0!==i.onProgress&&i.onProgress(t,n,a),n===a&&void 0!==i.onLoad&&i.onLoad()}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Material",this.side=THREE.FrontSide,this.opacity=1,this.transparent=!1,this.blending=THREE.NormalBlending,this.blendSrc=THREE.SrcAlphaFactor,this.blendDst=THREE.OneMinusSrcAlphaFactor,this.blendEquation=THREE.AddEquation,this.depthTest=!0,this.depthWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this.needsUpdate=!0},THREE.Material.prototype={constructor:THREE.Material,setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0!==r){if(e in this){var i=this[e];i instanceof THREE.Color?i.set(r):i instanceof THREE.Vector3&&r instanceof THREE.Vector3?i.copy(r):this[e]="overdraw"==e?Number(r):r}}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(){var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(t.name=this.name),this instanceof THREE.MeshBasicMaterial?(t.color=this.color.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshLambertMaterial?(t.color=this.color.getHex(),t.ambient=this.ambient.getHex(),t.emissive=this.emissive.getHex(),this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshPhongMaterial?(t.color=this.color.getHex(),t.ambient=this.ambient.getHex(),t.emissive=this.emissive.getHex(),t.specular=this.specular.getHex(),t.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.shading!==THREE.FlatShading&&(t.shading=this.shading),this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(t.blending=this.blending),this.side!==THREE.FrontSide&&(t.side=this.side)):this instanceof THREE.ShaderMaterial?(t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(t.color=this.color.getHex()),this.opacity<1&&(t.opacity=this.opacity),!1!==this.transparent&&(t.transparent=this.transparent),!1!==this.wireframe&&(t.wireframe=this.wireframe),t},clone:function(t){return void 0===t&&(t=new THREE.Material),t.name=this.name,t.side=this.side,t.opacity=this.opacity,t.transparent=this.transparent,t.blending=this.blending,t.blendSrc=this.blendSrc,t.blendDst=this.blendDst,t.blendEquation=this.blendEquation,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.polygonOffset=this.polygonOffset,t.polygonOffsetFactor=this.polygonOffsetFactor,t.polygonOffsetUnits=this.polygonOffsetUnits,t.alphaTest=this.alphaTest,t.overdraw=this.overdraw,t.visible=this.visible,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Material.prototype),THREE.MaterialIdCount=0,THREE.LineBasicMaterial=function(t){THREE.Material.call(this),this.type="LineBasicMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.clone=function(){var t=new THREE.LineBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.linecap=this.linecap,t.linejoin=this.linejoin,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.LineDashedMaterial=function(t){THREE.Material.call(this),this.type="LineDashedMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(t)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.clone=function(){var t=new THREE.LineDashedMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.linewidth=this.linewidth,t.scale=this.scale,t.dashSize=this.dashSize,t.gapSize=this.gapSize,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.MeshBasicMaterial=function(t){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(t)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.clone=function(){var t=new THREE.MeshBasicMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t},THREE.MeshLambertMaterial=function(t){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.clone=function(){var t=new THREE.MeshLambertMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.ambient.copy(this.ambient),t.emissive.copy(this.emissive),t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.MeshPhongMaterial=function(t){THREE.Material.call(this),this.type="MeshPhongMaterial",this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.specular=new THREE.Color(1118481),this.shininess=30,this.metal=!1,this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.clone=function(){var t=new THREE.MeshPhongMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.ambient.copy(this.ambient),t.emissive.copy(this.emissive),t.specular.copy(this.specular),t.shininess=this.shininess,t.metal=this.metal,t.wrapAround=this.wrapAround,t.wrapRGB.copy(this.wrapRGB),t.map=this.map,t.lightMap=this.lightMap,t.bumpMap=this.bumpMap,t.bumpScale=this.bumpScale,t.normalMap=this.normalMap,t.normalScale.copy(this.normalScale),t.specularMap=this.specularMap,t.alphaMap=this.alphaMap,t.envMap=this.envMap,t.combine=this.combine,t.reflectivity=this.reflectivity,t.refractionRatio=this.refractionRatio,t.fog=this.fog,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.wireframeLinecap=this.wireframeLinecap,t.wireframeLinejoin=this.wireframeLinejoin,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.MeshDepthMaterial=function(t){THREE.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.clone=function(){var t=new THREE.MeshDepthMaterial;return THREE.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},THREE.MeshNormalMaterial=function(t){THREE.Material.call(this,t),this.type="MeshNormalMaterial",this.shading=THREE.FlatShading,this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(t)},THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.clone=function(){var t=new THREE.MeshNormalMaterial;return THREE.Material.prototype.clone.call(this,t),t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},THREE.MeshFaceMaterial=function(t){this.uuid=THREE.Math.generateUUID(),this.type="MeshFaceMaterial",this.materials=t instanceof Array?t:[]},THREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,toJSON:function(){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},e=0,r=this.materials.length;e<r;e++)t.materials.push(this.materials[e].toJSON());return t},clone:function(){for(var t=new THREE.MeshFaceMaterial,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t}},THREE.PointCloudMaterial=function(t){THREE.Material.call(this),this.type="PointCloudMaterial",this.color=new THREE.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(t)},THREE.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype),THREE.PointCloudMaterial.prototype.clone=function(){var t=new THREE.PointCloudMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.size=this.size,t.sizeAttenuation=this.sizeAttenuation,t.vertexColors=this.vertexColors,t.fog=this.fog,t},THREE.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),new THREE.PointCloudMaterial(t)},THREE.ShaderMaterial=function(t){THREE.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.attributes=null,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=THREE.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.setValues(t)},THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.clone=function(){var t=new THREE.ShaderMaterial;return THREE.Material.prototype.clone.call(this,t),t.fragmentShader=this.fragmentShader,t.vertexShader=this.vertexShader,t.uniforms=THREE.UniformsUtils.clone(this.uniforms),t.attributes=this.attributes,t.defines=this.defines,t.shading=this.shading,t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t.fog=this.fog,t.lights=this.lights,t.vertexColors=this.vertexColors,t.skinning=this.skinning,t.morphTargets=this.morphTargets,t.morphNormals=this.morphNormals,t},THREE.RawShaderMaterial=function(t){THREE.ShaderMaterial.call(this,t),this.type="RawShaderMaterial"},THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype),THREE.RawShaderMaterial.prototype.clone=function(){var t=new THREE.RawShaderMaterial;return THREE.ShaderMaterial.prototype.clone.call(this,t),t},THREE.SpriteMaterial=function(t){THREE.Material.call(this),this.type="SpriteMaterial",this.color=new THREE.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(t)},THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteMaterial.prototype.clone=function(){var t=new THREE.SpriteMaterial;return THREE.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.rotation=this.rotation,t.fog=this.fog,t},THREE.Texture=function(t,e,r,i,n,a,o,s,h){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.image=void 0!==t?t:THREE.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:THREE.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==n?n:THREE.LinearFilter,this.minFilter=void 0!==a?a:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==o?o:THREE.RGBAFormat,this.type=void 0!==s?s:THREE.UnsignedByteType,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},THREE.Texture.DEFAULT_IMAGE=void 0,THREE.Texture.DEFAULT_MAPPING=new THREE.UVMapping,THREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},clone:function(t){return void 0===t&&(t=new THREE.Texture),t.image=this.image,t.mipmaps=this.mipmaps.slice(0),t.mapping=this.mapping,t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.format=this.format,t.type=this.type,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.generateMipmaps=this.generateMipmaps,t.premultiplyAlpha=this.premultiplyAlpha,t.flipY=this.flipY,t.unpackAlignment=this.unpackAlignment,t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,THREE.CubeTexture=function(t,e,r,i,n,a,o,s,h){THREE.Texture.call(this,t,e,r,i,n,a,o,s,h),this.images=t},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.clone=function(t){return void 0===t&&(t=new THREE.CubeTexture),THREE.Texture.prototype.clone.call(this,t),t.images=this.images,t},THREE.CompressedTexture=function(t,e,r,i,n,a,o,s,h,l,c){THREE.Texture.call(this,null,a,o,s,h,l,i,n,c),this.image={width:e,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1},THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.clone=function(){var t=new THREE.CompressedTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.DataTexture=function(t,e,r,i,n,a,o,s,h,l,c){THREE.Texture.call(this,null,a,o,s,h,l,i,n,c),this.image={data:t,width:e,height:r}},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.clone=function(){var t=new THREE.DataTexture;return THREE.Texture.prototype.clone.call(this,t),t},THREE.VideoTexture=function(t,e,r,i,n,a,o,s,h){THREE.Texture.call(this,t,e,r,i,n,a,o,s,h),this.generateMipmaps=!1;var l=this,c=function(){requestAnimationFrame(c),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};c()},THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype),THREE.Group=function(){THREE.Object3D.call(this),this.type="Group"},THREE.Group.prototype=Object.create(THREE.Object3D.prototype),THREE.PointCloud=function(t,e){THREE.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.PointCloudMaterial({color:16777215*Math.random()}),this.sortParticles=!1},THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype),THREE.PointCloud.prototype.raycast=function(){var R=new THREE.Matrix4,_=new THREE.Ray;return function(a,o){var s=this,t=s.geometry,e=a.params.PointCloud.threshold;if(R.getInverse(this.matrixWorld),_.copy(a.ray).applyMatrix4(R),null===t.boundingBox||!1!==_.isIntersectionBox(t.boundingBox)){var h=e/((this.scale.x+this.scale.y+this.scale.z)/3),r=new THREE.Vector3,i=function(t,e){var r=_.distanceToPoint(t);if(r<h){var i=_.closestPointToPoint(t);i.applyMatrix4(s.matrixWorld);var n=a.ray.origin.distanceTo(i);o.push({distance:n,distanceToRay:r,point:i.clone(),index:e,face:null,object:s})}};if(t instanceof THREE.BufferGeometry){var n=t.attributes,l=n.position.array;if(void 0!==n.index){var c=n.index.array,u=t.offsets;if(0===u.length)u=[{start:0,count:c.length,index:0}];for(var f=0,d=u.length;f<d;++f)for(var p=u[f].start,E=u[f].count,m=u[f].index,g=p,v=p+E;g<v;g++){var T=m+c[g];r.fromArray(l,3*T),i(r,T)}}else{var x=l.length/3;for(g=0;g<x;g++)r.set(l[3*g],l[3*g+1],l[3*g+2]),i(r,g)}}else{var y=this.geometry.vertices;for(g=0;g<y.length;g++)i(y[g],g)}}}}(),THREE.PointCloud.prototype.clone=function(t){return void 0===t&&(t=new THREE.PointCloud(this.geometry,this.material)),t.sortParticles=this.sortParticles,THREE.Object3D.prototype.clone.call(this,t),t},THREE.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new THREE.PointCloud(t,e)},THREE.Line=function(t,e,r){THREE.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.LineBasicMaterial({color:16777215*Math.random()}),this.mode=void 0!==r?r:THREE.LineStrip},THREE.LineStrip=0,THREE.LinePieces=1,THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.raycast=function(){var f=new THREE.Matrix4,d=new THREE.Ray,p=new THREE.Sphere;return function(t,e){var r=t.linePrecision,i=r*r,n=this.geometry;if(null===n.boundingSphere&&n.computeBoundingSphere(),p.copy(n.boundingSphere),p.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(p)&&(f.getInverse(this.matrixWorld),d.copy(t.ray).applyMatrix4(f),n instanceof THREE.Geometry))for(var a=n.vertices,o=a.length,s=new THREE.Vector3,h=new THREE.Vector3,l=this.mode===THREE.LineStrip?1:2,c=0;c<o-1;c+=l){if(!(i<d.distanceSqToSegment(a[c],a[c+1],h,s))){var u=d.origin.distanceTo(h);u<t.near||u>t.far||e.push({distance:u,point:s.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}}(),THREE.Line.prototype.clone=function(t){return void 0===t&&(t=new THREE.Line(this.geometry,this.material,this.mode)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Mesh=function(t,e){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],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}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){var F=new THREE.Matrix4,U=new THREE.Ray,B=new THREE.Sphere,z=new THREE.Vector3,N=new THREE.Vector3,k=new THREE.Vector3;return function(t,e){var r=this.geometry;if(null===r.boundingSphere&&r.computeBoundingSphere(),B.copy(r.boundingSphere),B.applyMatrix4(this.matrixWorld),!1!==t.ray.isIntersectionSphere(B)&&(F.getInverse(this.matrixWorld),U.copy(t.ray).applyMatrix4(F),null===r.boundingBox||!1!==U.isIntersectionBox(r.boundingBox)))if(r instanceof THREE.BufferGeometry){if(void 0===(b=this.material))return;var i=r.attributes,n=t.precision;if(void 0!==i.index){var a=i.index.array,o=i.position.array,s=r.offsets;0===s.length&&(s=[{start:0,count:a.length,index:0}]);for(var h=0,l=s.length;h<l;++h)for(var c=s[h].start,u=s[h].count,f=s[h].index,d=c,p=c+u;d<p;d+=3){if(g=f+a[d],v=f+a[d+1],T=f+a[d+2],z.fromArray(o,3*g),N.fromArray(o,3*v),k.fromArray(o,3*T),b.side===THREE.BackSide)var E=U.intersectTriangle(k,N,z,!0);else E=U.intersectTriangle(z,N,k,b.side!==THREE.DoubleSide);if(null!==E)E.applyMatrix4(this.matrixWorld),(P=t.ray.origin.distanceTo(E))<n||P<t.near||P>t.far||e.push({distance:P,point:E,face:new THREE.Face3(g,v,T,THREE.Triangle.normal(z,N,k)),faceIndex:null,object:this})}}else{d=0;var m=0;for(p=(o=i.position.array).length;d<p;d+=3,m+=9){if(v=(g=d)+1,T=d+2,z.fromArray(o,m),N.fromArray(o,m+3),k.fromArray(o,m+6),b.side===THREE.BackSide)E=U.intersectTriangle(k,N,z,!0);else E=U.intersectTriangle(z,N,k,b.side!==THREE.DoubleSide);if(null!==E)E.applyMatrix4(this.matrixWorld),(P=t.ray.origin.distanceTo(E))<n||P<t.near||P>t.far||e.push({distance:P,point:E,face:new THREE.Face3(g,v,T,THREE.Triangle.normal(z,N,k)),faceIndex:null,object:this})}}}else if(r instanceof THREE.Geometry)for(var g,v,T,x=this.material instanceof THREE.MeshFaceMaterial,y=!0===x?this.material.materials:null,R=(n=t.precision,r.vertices),_=0,H=r.faces.length;_<H;_++){var b,M=r.faces[_];if(void 0!==(b=!0===x?y[M.materialIndex]:this.material)){if(g=R[M.a],v=R[M.b],T=R[M.c],!0===b.morphTargets){var w=r.morphTargets,S=this.morphTargetInfluences;z.set(0,0,0),N.set(0,0,0),k.set(0,0,0);for(var A=0,C=w.length;A<C;A++){var D=S[A];if(0!==D){var L=w[A].vertices;z.x+=(L[M.a].x-g.x)*D,z.y+=(L[M.a].y-g.y)*D,z.z+=(L[M.a].z-g.z)*D,N.x+=(L[M.b].x-v.x)*D,N.y+=(L[M.b].y-v.y)*D,N.z+=(L[M.b].z-v.z)*D,k.x+=(L[M.c].x-T.x)*D,k.y+=(L[M.c].y-T.y)*D,k.z+=(L[M.c].z-T.z)*D}}z.add(g),N.add(v),k.add(T),g=z,v=N,T=k}if(b.side===THREE.BackSide)E=U.intersectTriangle(T,v,g,!0);else E=U.intersectTriangle(g,v,T,b.side!==THREE.DoubleSide);var P;if(null!==E)E.applyMatrix4(this.matrixWorld),(P=t.ray.origin.distanceTo(E))<n||P<t.near||P>t.far||e.push({distance:P,point:E,face:M,faceIndex:_,object:this})}}}}(),THREE.Mesh.prototype.clone=function(t,e){return void 0===t&&(t=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,t,e),t},THREE.Bone=function(t){THREE.Object3D.call(this),this.skin=t},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Skeleton=function(t,e,r){var i;(this.useVertexTexture=void 0===r||r,this.identityMatrix=new THREE.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture)?(i=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;n<a;n++)this.boneInverses.push(new THREE.Matrix4)}},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new THREE.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},THREE.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))},THREE.Skeleton.prototype.update=function(){var i=new THREE.Matrix4;return function(){for(var t=0,e=this.bones.length;t<e;t++){var r=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;i.multiplyMatrices(r,this.boneInverses[t]),i.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.SkinnedMesh=function(t,e,r){THREE.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,a,o,s,h,l=0,c=this.geometry.bones.length;l<c;++l)o=(a=this.geometry.bones[l]).pos,s=a.rotq,h=a.scl,n=new THREE.Bone(this),i.push(n),n.name=a.name,n.position.set(o[0],o[1],o[2]),n.quaternion.set(s[0],s[1],s[2],s[3]),void 0!==h?n.scale.set(h[0],h[1],h[2]):n.scale.set(1,1,1);for(l=0,c=this.geometry.bones.length;l<c;++l)-1!==(a=this.geometry.bones[l]).parent?i[a.parent].add(i[l]):this.add(i[l])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(i,void 0,r))},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var t=0;t<this.geometry.skinIndices.length;t++){var e=this.geometry.skinWeights[t],r=1/e.lengthManhattan();r!==1/0?e.multiplyScalar(r):e.set(1)}},THREE.SkinnedMesh.prototype.updateMatrixWorld=function(t){THREE.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 unreckognized bindMode: "+this.bindMode)},THREE.SkinnedMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),THREE.Mesh.prototype.clone.call(this,t),t},THREE.MorphAnimMesh=function(t,e){THREE.Mesh.call(this,t,e),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphAnimMesh.prototype.setFrameRange=function(t,e){this.startKeyframe=t,this.endKeyframe=e,this.length=this.endKeyframe-this.startKeyframe+1},THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1,this.directionBackwards=!1},THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},THREE.MorphAnimMesh.prototype.parseAnimations=function(){var t=this.geometry;t.animations||(t.animations={});for(var e,r=t.animations,i=/([a-z]+)_?(\d+)/,n=0,a=t.morphTargets.length;n<a;n++){var o=t.morphTargets[n].name.match(i);if(o&&1<o.length){var s=o[1];o[2];r[s]||(r[s]={start:1/0,end:-1/0});var h=r[s];n<h.start&&(h.start=n),n>h.end&&(h.end=n),e||(e=s)}}t.firstAnimation=e},THREE.MorphAnimMesh.prototype.setAnimationLabel=function(t,e,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[t]={start:e,end:r}},THREE.MorphAnimMesh.prototype.playAnimation=function(t,e){var r=this.geometry.animations[t];r?(this.setFrameRange(r.start,r.end),this.duration=(r.end-r.start)/e*1e3,this.time=0):console.warn("animation["+t+"] undefined")},THREE.MorphAnimMesh.prototype.updateAnimation=function(t){var e=this.duration/this.length;this.time+=this.direction*t,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/e),0,this.length-1);r!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var i=this.time%e/e;this.directionBackwards&&(i=1-i),this.morphTargetInfluences[this.currentKeyframe]=i,this.morphTargetInfluences[this.lastKeyframe]=1-i},THREE.MorphAnimMesh.prototype.interpolateTargets=function(t,e,r){for(var i=this.morphTargetInfluences,n=0,a=i.length;n<a;n++)i[n]=0;-1<t&&(i[t]=1-r),-1<e&&(i[e]=r)},THREE.MorphAnimMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.MorphAnimMesh(this.geometry,this.material)),t.duration=this.duration,t.mirroredLoop=this.mirroredLoop,t.time=this.time,t.lastKeyframe=this.lastKeyframe,t.currentKeyframe=this.currentKeyframe,t.direction=this.direction,t.directionBackwards=this.directionBackwards,THREE.Mesh.prototype.clone.call(this,t),t},THREE.LOD=function(){THREE.Object3D.call(this),this.objects=[]},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=0;r<this.objects.length&&!(e<this.objects[r].distance);r++);this.objects.splice(r,0,{distance:e,object:t}),this.add(t)},THREE.LOD.prototype.getObjectForDistance=function(t){for(var e=1,r=this.objects.length;e<r&&!(t<this.objects[e].distance);e++);return this.objects[e-1].object},THREE.LOD.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(i);this.getObjectForDistance(r).raycast(t,e)}}(),THREE.LOD.prototype.update=function(){var n=new THREE.Vector3,a=new THREE.Vector3;return function(t){if(1<this.objects.length){n.setFromMatrixPosition(t.matrixWorld),a.setFromMatrixPosition(this.matrixWorld);var e=n.distanceTo(a);this.objects[0].object.visible=!0;for(var r=1,i=this.objects.length;r<i&&e>=this.objects[r].distance;r++)this.objects[r-1].object.visible=!1,this.objects[r].object.visible=!0;for(;r<i;r++)this.objects[r].object.visible=!1}}}(),THREE.LOD.prototype.clone=function(t){void 0===t&&(t=new THREE.LOD),THREE.Object3D.prototype.clone.call(this,t);for(var e=0,r=this.objects.length;e<r;e++){var i=this.objects[e].object.clone();i.visible=0===e,t.addLevel(i,this.objects[e].distance)}return t},THREE.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 THREE.BufferGeometry;return i.addAttribute("index",new THREE.BufferAttribute(t,1)),i.addAttribute("position",new THREE.BufferAttribute(e,3)),i.addAttribute("uv",new THREE.BufferAttribute(r,2)),function(t){THREE.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?t:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.raycast=function(){var i=new THREE.Vector3;return function(t,e){i.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceToPoint(i);r>this.scale.x||e.push({distance:r,point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(t){return void 0===t&&(t=new THREE.Sprite(this.material)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Particle=THREE.Sprite,THREE.LensFlare=function(t,e,r,i,n){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,(this.customUpdateCallback=void 0)!==t&&this.add(t,e,r,i,n)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.add=function(t,e,r,i,n,a){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===n&&(n=new THREE.Color(16777215)),void 0===i&&(i=THREE.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:1,opacity:a,color:n,blending:i})},THREE.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]).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)},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.clone=function(t){return void 0===t&&(t=new THREE.Scene),THREE.Object3D.prototype.clone.call(this,t),null!==this.fog&&(t.fog=this.fog.clone()),null!==this.overrideMaterial&&(t.overrideMaterial=this.overrideMaterial.clone()),t.autoUpdate=this.autoUpdate,t.matrixAutoUpdate=this.matrixAutoUpdate,t},THREE.Fog=function(t,e,r){this.name="",this.color=new THREE.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(t,e){this.name="",this.color=new THREE.Color(t),this.density=void 0!==e?e:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( gl_FragColor.a < ALPHATEST ) discard;\n\n#endif\n",THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\tvec3 dirVector = normalize( lDirection.xyz );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat lDistance = 1.0;\n\t\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n\n#endif",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",THREE.ShaderChunk.default_vertex="vec4 mvPosition;\n\n#ifdef USE_SKINNING\n\n\tmvPosition = modelViewMatrix * skinned;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\n\n\tmvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\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\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.lights_phong_fragment="vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef DOUBLE_SIDED\n\n\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tvec3 pointDiffuse = vec3( 0.0 );\n\tvec3 pointSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( pointLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tpointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tvec3 spotDiffuse = vec3( 0.0 );\n\tvec3 spotSpecular = vec3( 0.0 );\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat lDistance = 1.0;\n\t\tif ( spotLightDistance[ i ] > 0.0 )\n\t\t\tlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\tspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\n\n\t\t\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tvec3 dirDiffuse = vec3( 0.0 );\n\tvec3 dirSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\n\t\tvec3 dirVector = normalize( lDirection.xyz );\n\n\t\t\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\tdirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tvec3 hemiDiffuse = vec3( 0.0 );\n\tvec3 hemiSpecular = vec3( 0.0 );\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\n\t\tvec3 lVector = normalize( lDirection.xyz );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\themiDiffuse += diffuse * hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n\ttotalDiffuse += dirDiffuse;\n\ttotalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\ttotalDiffuse += hemiDiffuse;\n\ttotalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\ttotalDiffuse += pointDiffuse;\n\ttotalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\ttotalDiffuse += spotDiffuse;\n\ttotalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n\n#else\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n\n#endif",THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif",THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\tuniform samplerCube envMap;\n\tuniform float flipEnvMap;\n\tuniform int combine;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform bool useRefract;\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t\t\t// Per-Pixel Tangent Space Normal Mapping\n\t\t\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\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\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\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\n\t}\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\t#ifdef GAMMA_INPUT\n\n\t\ttexelColor.xyz *= texelColor.xyz;\n\n\t#endif\n\n\tgl_FragColor = gl_FragColor * texelColor;\n\n#endif",THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tgl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n\n#endif",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\t#ifdef GAMMA_INPUT\n\n\t\tvColor = color * color;\n\n\t#else\n\n\t\tvColor = color;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\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\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\tuniform bool useRefract;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="#ifdef GAMMA_OUTPUT\n\n\tgl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n\n#endif",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\n\nuniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n",THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\tvec3 reflectVec;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\n\t\tvec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );\n\n\t\tif ( useRefract ) {\n\n\t\t\treflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t} else { \n\n\t\t\treflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t}\n\n\t#else\n\n\t\treflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t\tvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#else\n\n\t\tvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#endif\n\n\t#ifdef GAMMA_INPUT\n\n\t\tcubeColor.xyz *= cubeColor.xyz;\n\n\t#endif\n\n\tif ( combine == 1 ) {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n\n\t} else if ( combine == 2 ) {\n\n\t\tgl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n\n\t} else {\n\n\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n\n\t}\n\n#endif",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tconst float LOG2 = 1.442695;\n\t\tfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\n\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\tgl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n\n#endif",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t\t\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t\t\t//\thttp://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t\t\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif",THREE.ShaderChunk.defaultnormal_vertex="vec3 objectNormal;\n\n#ifdef USE_SKINNING\n\n\tobjectNormal = skinnedNormal.xyz;\n\n#endif\n\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\n\n\tobjectNormal = morphedNormal;\n\n#endif\n\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\n\n\tobjectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;",THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\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\n#endif",THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\tgl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n\n#endif",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tgl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\n\tworldNormal = normalize( worldNormal );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tif ( useRefract ) {\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t} else {\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t}\n\n#endif",THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t#ifdef GAMMA_OUTPUT\n\n\t\tshadowColor *= shadowColor;\n\n\t#endif\n\n\tgl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n\n#endif\n",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#endif\n\n\t#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#endif\n\n\t#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\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\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\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\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif",THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tgl_FragColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",THREE.UniformsUtils={merge:function(t){for(var e={},r=0;r<t.length;r++){var i=this.clone(t[r]);for(var n in i)e[n]=i[n]}return e},clone:function(t){var e={};for(var r in t)for(var i in e[r]={},t[r]){var n=t[r][i];n instanceof THREE.Color||n instanceof THREE.Vector2||n instanceof THREE.Vector3||n instanceof THREE.Vector4||n instanceof THREE.Matrix4||n instanceof THREE.Texture?e[r][i]=n.clone():n instanceof Array?e[r][i]=n.slice():e[r][i]=n}return e}},THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED","\t\tif ( gl_FrontFacing )","\t\t\tgl_FragColor.xyz *= vLightFront;","\t\telse","\t\t\tgl_FragColor.xyz *= vLightBack;","\t#else","\t\tgl_FragColor.xyz *= vLightFront;","\t#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","varying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\tvNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform float opacity;","uniform vec3 ambient;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( vec3( 1.0 ), opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\t#ifdef USE_SIZEATTENUATION","\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );","\t#else","\t\tgl_PointSize = size;","\t#endif","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tif ( mod( vLineDistance, totalSize ) > dashSize ) {","\t\tdiscard;","\t}","\tgl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;","\t#else","\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;","\t#endif","\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );","\tgl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},normalmap:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},diffuse:{type:"c",value:new THREE.Color(16777215)},specular:{type:"c",value:new THREE.Color(1118481)},ambient:{type:"c",value:new THREE.Color(16777215)},shininess:{type:"f",value:30},opacity:{type:"f",value:1},useRefract:{type:"i",value:0},refractionRatio:{type:"f",value:.98},reflectivity:{type:"f",value:.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 ambient;","uniform vec3 diffuse;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;","uniform bool enableDiffuse;","uniform bool enableSpecular;","uniform bool enableAO;","uniform bool enableReflection;","uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tSpecular;","uniform sampler2D tAO;","uniform samplerCube tCube;","uniform vec2 uNormalScale;","uniform bool useRefract;","uniform float refractionRatio;","uniform float reflectivity;","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","uniform vec3 ambientLightColor;","#if MAX_DIR_LIGHTS > 0","\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];","\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];","#endif","#if MAX_HEMI_LIGHTS > 0","\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];","\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];","\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];","#endif","#if MAX_POINT_LIGHTS > 0","\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];","\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];","#endif","#if MAX_SPOT_LIGHTS > 0","\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];","\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];","\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];","\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","#endif","#ifdef WRAP_AROUND","\tuniform vec3 wrapRGB;","#endif","varying vec3 vWorldPosition;","varying vec3 vViewPosition;",THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\tgl_FragColor = vec4( vec3( 1.0 ), opacity );","\tvec3 specularTex = vec3( 1.0 );","\tvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;","\tnormalTex.xy *= uNormalScale;","\tnormalTex = normalize( normalTex );","\tif( enableDiffuse ) {","\t\t#ifdef GAMMA_INPUT","\t\t\tvec4 texelColor = texture2D( tDiffuse, vUv );","\t\t\ttexelColor.xyz *= texelColor.xyz;","\t\t\tgl_FragColor = gl_FragColor * texelColor;","\t\t#else","\t\t\tgl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );","\t\t#endif","\t}","\tif( enableAO ) {","\t\t#ifdef GAMMA_INPUT","\t\t\tvec4 aoColor = texture2D( tAO, vUv );","\t\t\taoColor.xyz *= aoColor.xyz;","\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;","\t\t#else","\t\t\tgl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;","\t\t#endif","\t}",THREE.ShaderChunk.alphatest_fragment,"\tif( enableSpecular )","\t\tspecularTex = texture2D( tSpecular, vUv ).xyz;","\tmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );","\tvec3 finalNormal = tsb * normalTex;","\t#ifdef FLIP_SIDED","\t\tfinalNormal = -finalNormal;","\t#endif","\tvec3 normal = normalize( finalNormal );","\tvec3 viewPosition = normalize( vViewPosition );","\t#if MAX_POINT_LIGHTS > 0","\t\tvec3 pointDiffuse = vec3( 0.0 );","\t\tvec3 pointSpecular = vec3( 0.0 );","\t\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {","\t\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","\t\t\tvec3 pointVector = lPosition.xyz + vViewPosition.xyz;","\t\t\tfloat pointDistance = 1.0;","\t\t\tif ( pointLightDistance[ i ] > 0.0 )","\t\t\t\tpointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );","\t\t\tpointVector = normalize( pointVector );","\t\t\t#ifdef WRAP_AROUND","\t\t\t\tfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );","\t\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );","\t\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );","\t\t\t#else","\t\t\t\tfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );","\t\t\t#endif","\t\t\tpointDiffuse += pointDistance * pointLightColor[ i ] * diffuse * pointDiffuseWeight;","\t\t\tvec3 pointHalfVector = normalize( pointVector + viewPosition );","\t\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );","\t\t\tfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( pointVector, pointHalfVector ), 0.0 ), 5.0 );","\t\t\tpointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;","\t\t}","\t#endif","\t#if MAX_SPOT_LIGHTS > 0","\t\tvec3 spotDiffuse = vec3( 0.0 );","\t\tvec3 spotSpecular = vec3( 0.0 );","\t\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","\t\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","\t\t\tvec3 spotVector = lPosition.xyz + vViewPosition.xyz;","\t\t\tfloat spotDistance = 1.0;","\t\t\tif ( spotLightDistance[ i ] > 0.0 )","\t\t\t\tspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );","\t\t\tspotVector = normalize( spotVector );","\t\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );","\t\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {","\t\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );","\t\t\t\t#ifdef WRAP_AROUND","\t\t\t\t\tfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );","\t\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );","\t\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );","\t\t\t\t#else","\t\t\t\t\tfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );","\t\t\t\t#endif","\t\t\t\tspotDiffuse += spotDistance * spotLightColor[ i ] * diffuse * spotDiffuseWeight * spotEffect;","\t\t\t\tvec3 spotHalfVector = normalize( spotVector + viewPosition );","\t\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );","\t\t\t\tfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );","\t\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( spotVector, spotHalfVector ), 0.0 ), 5.0 );","\t\t\t\tspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;","\t\t\t}","\t\t}","\t#endif","\t#if MAX_DIR_LIGHTS > 0","\t\tvec3 dirDiffuse = vec3( 0.0 );","\t\tvec3 dirSpecular = vec3( 0.0 );","\t\tfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {","\t\t\tvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );","\t\t\tvec3 dirVector = normalize( lDirection.xyz );","\t\t\t#ifdef WRAP_AROUND","\t\t\t\tfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );","\t\t\t\tfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );","\t\t\t\tvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );","\t\t\t#else","\t\t\t\tfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );","\t\t\t#endif","\t\t\tdirDiffuse += directionalLightColor[ i ] * diffuse * dirDiffuseWeight;","\t\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );","\t\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );","\t\t\tfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );","\t\t\tdirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;","\t\t}","\t#endif","\t#if MAX_HEMI_LIGHTS > 0","\t\tvec3 hemiDiffuse = vec3( 0.0 );","\t\tvec3 hemiSpecular = vec3( 0.0 );","\t\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {","\t\t\tvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );","\t\t\tvec3 lVector = normalize( lDirection.xyz );","\t\t\tfloat dotProduct = dot( normal, lVector );","\t\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;","\t\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );","\t\t\themiDiffuse += diffuse * hemiColor;","\t\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );","\t\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;","\t\t\tfloat hemiSpecularWeightSky = specularTex.r * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );","\t\t\tvec3 lVectorGround = -lVector;","\t\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );","\t\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;","\t\t\tfloat hemiSpecularWeightGround = specularTex.r * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );","\t\t\tfloat dotProductGround = dot( normal, lVectorGround );","\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;","\t\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );","\t\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );","\t\t\themiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );","\t\t}","\t#endif","\tvec3 totalDiffuse = vec3( 0.0 );","\tvec3 totalSpecular = vec3( 0.0 );","\t#if MAX_DIR_LIGHTS > 0","\t\ttotalDiffuse += dirDiffuse;","\t\ttotalSpecular += dirSpecular;","\t#endif","\t#if MAX_HEMI_LIGHTS > 0","\t\ttotalDiffuse += hemiDiffuse;","\t\ttotalSpecular += hemiSpecular;","\t#endif","\t#if MAX_POINT_LIGHTS > 0","\t\ttotalDiffuse += pointDiffuse;","\t\ttotalSpecular += pointSpecular;","\t#endif","\t#if MAX_SPOT_LIGHTS > 0","\t\ttotalDiffuse += spotDiffuse;","\t\ttotalSpecular += spotSpecular;","\t#endif","\t#ifdef METAL","\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );","\t#else","\t\tgl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;","\t#endif","\tif ( enableReflection ) {","\t\tvec3 vReflect;","\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );","\t\tif ( useRefract ) {","\t\t\tvReflect = refract( cameraToVertex, normal, refractionRatio );","\t\t} else {","\t\t\tvReflect = reflect( cameraToVertex, normal );","\t\t}","\t\tvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","\t\t#ifdef GAMMA_INPUT","\t\t\tcubeColor.xyz *= cubeColor.xyz;","\t\t#endif","\t\tgl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * reflectivity );","\t}",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;","uniform vec2 uOffset;","uniform vec2 uRepeat;","uniform bool enableDisplacement;","#ifdef VERTEX_TEXTURES","\tuniform sampler2D tDisplacement;","\tuniform float uDisplacementScale;","\tuniform float uDisplacementBias;","#endif","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","varying vec3 vWorldPosition;","varying vec3 vViewPosition;",THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"\t#ifdef USE_SKINNING","\t\tvNormal = normalize( normalMatrix * skinnedNormal.xyz );","\t\tvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );","\t\tvTangent = normalize( normalMatrix * skinnedTangent.xyz );","\t#else","\t\tvNormal = normalize( normalMatrix * normal );","\t\tvTangent = normalize( normalMatrix * tangent.xyz );","\t#endif","\tvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );","\tvUv = uv * uRepeat + uOffset;","\tvec3 displacedPosition;","\t#ifdef VERTEX_TEXTURES","\t\tif ( enableDisplacement ) {","\t\t\tvec3 dv = texture2D( tDisplacement, uv ).xyz;","\t\t\tfloat df = uDisplacementScale * dv.x + uDisplacementBias;","\t\t\tdisplacedPosition = position + normalize( normal ) * df;","\t\t} else {","\t\t\t#ifdef USE_SKINNING","\t\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );","\t\t\t\tvec4 skinned = vec4( 0.0 );","\t\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;","\t\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;","\t\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;","\t\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;","\t\t\t\tskinned = bindMatrixInverse * skinned;","\t\t\t\tdisplacedPosition = skinned.xyz;","\t\t\t#else","\t\t\t\tdisplacedPosition = position;","\t\t\t#endif","\t\t}","\t#else","\t\t#ifdef USE_SKINNING","\t\t\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );","\t\t\tvec4 skinned = vec4( 0.0 );","\t\t\tskinned += boneMatX * skinVertex * skinWeight.x;","\t\t\tskinned += boneMatY * skinVertex * skinWeight.y;","\t\t\tskinned += boneMatZ * skinVertex * skinWeight.z;","\t\t\tskinned += boneMatW * skinVertex * skinWeight.w;","\t\t\tskinned = bindMatrixInverse * skinned;","\t\t\tdisplacedPosition = skinned.xyz;","\t\t#else","\t\t\tdisplacedPosition = position;","\t\t#endif","\t#endif","\tvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"\tvWorldPosition = worldPosition.xyz;","\tvViewPosition = -mvPosition.xyz;","\t#ifdef USE_SHADOWMAP","\t\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {","\t\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;","\t\t}","\t#endif","}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","\tres -= res.xxyz * bit_mask;","\treturn res;","}","void main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","\t#else","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","\t#endif","}"].join("\n")}},THREE.WebGLRenderer=function(t){console.log("THREE.WebGLRenderer",THREE.REVISION);var R=void 0!==(t=t||{}).canvas?t.canvas:document.createElement("canvas"),e=void 0!==t.context?t.context:null,_=void 0!==t.precision?t.precision:"highp",r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,n=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,s=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,H=void 0!==t.logarithmicDepthBuffer&&t.logarithmicDepthBuffer,h=new THREE.Color(0),l=0,u=[],E={},m=[],f=[],d=[],p=[],g=[];this.domElement=R,this.context=null,this.devicePixelRatio=void 0!==t.devicePixelRatio?t.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=THREE.PCFShadowMap,this.shadowMapCullFace=THREE.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var zt,V=this,b=[],M=null,v=null,w=-1,T=-1,S=null,A=0,c=-1,x=-1,y=-1,C=-1,D=-1,L=-1,P=-1,F=-1,U=null,B=null,z=null,N=null,k=0,O=0,I=R.width,G=R.height,W=0,X=0,j=new Uint8Array(16),Y=new Uint8Array(16),q=new THREE.Frustum,K=new THREE.Matrix4,Z=new THREE.Matrix4,Q=new THREE.Vector3,J=new THREE.Vector3,$=!0,tt={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var et={alpha:r,depth:i,stencil:n,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:s};if(null===(zt=e||R.getContext("webgl",et)||R.getContext("experimental-webgl",et)))throw null!==R.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context."}catch(t){console.error(t)}void 0===zt.getShaderPrecisionFormat&&(zt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var rt=new THREE.WebGLExtensions(zt);rt.get("OES_texture_float"),rt.get("OES_texture_float_linear"),rt.get("OES_standard_derivatives"),H&&rt.get("EXT_frag_depth"),zt.clearColor(0,0,0,1),zt.clearDepth(1),zt.clearStencil(0),zt.enable(zt.DEPTH_TEST),zt.depthFunc(zt.LEQUAL),zt.frontFace(zt.CCW),zt.cullFace(zt.BACK),zt.enable(zt.CULL_FACE),zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA),zt.viewport(k,O,I,G),zt.clearColor(h.r,h.g,h.b,l);var it,nt=(this.context=zt).getParameter(zt.MAX_TEXTURE_IMAGE_UNITS),at=zt.getParameter(zt.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ot=zt.getParameter(zt.MAX_TEXTURE_SIZE),st=zt.getParameter(zt.MAX_CUBE_MAP_TEXTURE_SIZE),ht=0<at,lt=ht&&rt.get("OES_texture_float"),ct=zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.HIGH_FLOAT),ut=zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.MEDIUM_FLOAT),ft=(zt.getShaderPrecisionFormat(zt.VERTEX_SHADER,zt.LOW_FLOAT),zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.HIGH_FLOAT)),dt=zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.MEDIUM_FLOAT),pt=(zt.getShaderPrecisionFormat(zt.FRAGMENT_SHADER,zt.LOW_FLOAT),function(){if(void 0!==it)return it;if(it=[],rt.get("WEBGL_compressed_texture_pvrtc")||rt.get("WEBGL_compressed_texture_s3tc"))for(var t=zt.getParameter(zt.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)it.push(t[e]);return it}),Et=0<ct.precision&&0<ft.precision,mt=0<ut.precision&&0<dt.precision;"highp"!==_||Et||(mt?(_="mediump",console.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(_="lowp",console.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==_||mt||(_="lowp",console.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var gt,vt=new THREE.ShadowMapPlugin(this,u,E,m),Tt=new THREE.SpritePlugin(this,p),xt=new THREE.LensFlarePlugin(this,g);function yt(t){var e,r;if(t.__webglVertexBuffer=zt.createBuffer(),t.__webglNormalBuffer=zt.createBuffer(),t.__webglTangentBuffer=zt.createBuffer(),t.__webglColorBuffer=zt.createBuffer(),t.__webglUVBuffer=zt.createBuffer(),t.__webglUV2Buffer=zt.createBuffer(),t.__webglSkinIndicesBuffer=zt.createBuffer(),t.__webglSkinWeightsBuffer=zt.createBuffer(),t.__webglFaceBuffer=zt.createBuffer(),t.__webglLineBuffer=zt.createBuffer(),t.numMorphTargets)for(t.__webglMorphTargetsBuffers=[],e=0,r=t.numMorphTargets;e<r;e++)t.__webglMorphTargetsBuffers.push(zt.createBuffer());if(t.numMorphNormals)for(t.__webglMorphNormalsBuffers=[],e=0,r=t.numMorphNormals;e<r;e++)t.__webglMorphNormalsBuffers.push(zt.createBuffer());V.info.memory.geometries++}this.getContext=function(){return zt},this.supportsVertexTextures=function(){return ht},this.supportsFloatTextures=function(){return rt.get("OES_texture_float")},this.supportsStandardDerivatives=function(){return rt.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return rt.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return rt.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return rt.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){if(void 0!==gt)return gt;var t=rt.get("EXT_texture_filter_anisotropic");return gt=null!==t?zt.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},this.getPrecision=function(){return _},this.setSize=function(t,e,r){R.width=t*this.devicePixelRatio,R.height=e*this.devicePixelRatio,!1!==r&&(R.style.width=t+"px",R.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,i){k=t*this.devicePixelRatio,O=e*this.devicePixelRatio,I=r*this.devicePixelRatio,G=i*this.devicePixelRatio,zt.viewport(k,O,I,G)},this.setScissor=function(t,e,r,i){zt.scissor(t*this.devicePixelRatio,e*this.devicePixelRatio,r*this.devicePixelRatio,i*this.devicePixelRatio)},this.enableScissorTest=function(t){t?zt.enable(zt.SCISSOR_TEST):zt.disable(zt.SCISSOR_TEST)},this.setClearColor=function(t,e){h.set(t),l=void 0!==e?e:1,zt.clearColor(h.r,h.g,h.b,l)},this.setClearColorHex=function(t,e){console.warn("THREE.WebGLRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(t,e)},this.getClearColor=function(){return h},this.getClearAlpha=function(){return l},this.clear=function(t,e,r){var i=0;(void 0===t||t)&&(i|=zt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=zt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=zt.STENCIL_BUFFER_BIT),zt.clear(i)},this.clearColor=function(){zt.clear(zt.COLOR_BUFFER_BIT)},this.clearDepth=function(){zt.clear(zt.DEPTH_BUFFER_BIT)},this.clearStencil=function(){zt.clear(zt.STENCIL_BUFFER_BIT)},this.clearTarget=function(t,e,r,i){this.setRenderTarget(t),this.clear(e,r,i)},this.resetGLState=function(){w=T=x=c=F=P=y=-1,$=!(S=M=null)};var Rt=function(t){t.target.traverse(function(t){t.removeEventListener("remove",Rt),function(t){t instanceof THREE.Mesh||t instanceof THREE.PointCloud||t instanceof THREE.Line?delete E[t.id]:(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&function(t,e){for(var r=t.length-1;0<=r;r--)t[r].object===e&&t.splice(r,1)}(m,t);delete t.__webglInit,delete t._modelViewMatrix,delete t._normalMatrix,delete t.__webglActive}(t)})},_t=function(t){var e=t.target;e.removeEventListener("dispose",_t),St(e)},Ht=function(t){var e=t.target;e.removeEventListener("dispose",Ht),At(e),V.info.memory.textures--},bt=function(t){var e=t.target;e.removeEventListener("dispose",bt),Ct(e),V.info.memory.textures--},Mt=function(t){var e=t.target;e.removeEventListener("dispose",Mt),Dt(e)},wt=function(t){for(var e=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],r=0,i=e.length;r<i;r++){void 0!==t[n=e[r]]&&(zt.deleteBuffer(t[n]),delete t[n])}if(void 0!==t.__webglCustomAttributesList){for(var n in t.__webglCustomAttributesList)zt.deleteBuffer(t.__webglCustomAttributesList[n].buffer);delete t.__webglCustomAttributesList}V.info.memory.geometries--},St=function(t){if(delete t.__webglInit,t instanceof THREE.BufferGeometry){for(var e in t.attributes){var r=t.attributes[e];void 0!==r.buffer&&(zt.deleteBuffer(r.buffer),delete r.buffer)}V.info.memory.geometries--}else{var i=qt[t.id];if(void 0!==i){for(var n=0,a=i.length;n<a;n++){var o=i[n];if(void 0!==o.numMorphTargets){for(var s=0,h=o.numMorphTargets;s<h;s++)zt.deleteBuffer(o.__webglMorphTargetsBuffers[s]);delete o.__webglMorphTargetsBuffers}if(void 0!==o.numMorphNormals){for(s=0,h=o.numMorphNormals;s<h;s++)zt.deleteBuffer(o.__webglMorphNormalsBuffers[s]);delete o.__webglMorphNormalsBuffers}wt(o)}delete qt[t.id]}else wt(t)}T=-1},At=function(t){if(t.image&&t.image.__webglTextureCube)zt.deleteTexture(t.image.__webglTextureCube),delete t.image.__webglTextureCube;else{if(void 0===t.__webglInit)return;zt.deleteTexture(t.__webglTexture),delete t.__webglTexture,delete t.__webglInit}},Ct=function(t){if(t&&void 0!==t.__webglTexture){if(zt.deleteTexture(t.__webglTexture),delete t.__webglTexture,t instanceof THREE.WebGLRenderTargetCube)for(var e=0;e<6;e++)zt.deleteFramebuffer(t.__webglFramebuffer[e]),zt.deleteRenderbuffer(t.__webglRenderbuffer[e]);else zt.deleteFramebuffer(t.__webglFramebuffer),zt.deleteRenderbuffer(t.__webglRenderbuffer);delete t.__webglFramebuffer,delete t.__webglRenderbuffer}},Dt=function(t){var e=t.program.program;if(void 0!==e){var r,i,n;t.program=void 0;var a=!1;for(r=0,i=b.length;r<i;r++)if((n=b[r]).program===e){n.usedTimes--,0===n.usedTimes&&(a=!0);break}if(!0===a){var o=[];for(r=0,i=b.length;r<i;r++)(n=b[r]).program!==e&&o.push(n);b=o,zt.deleteProgram(e),V.info.memory.programs--}}};function Lt(t){var e=t.geometry,r=t.material,i=e.vertices.length;if(r.attributes)for(var n in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),r.attributes){var a=r.attributes[n];if(!a.__webglInitialized||a.createUniqueBuffers){a.__webglInitialized=!0;var o=1;"v2"===a.type?o=2:"v3"===a.type?o=3:"v4"===a.type?o=4:"c"===a.type&&(o=3),a.size=o,a.array=new Float32Array(i*o),a.buffer=zt.createBuffer(),a.buffer.belongsToAttribute=n,a.needsUpdate=!0}e.__webglCustomAttributesList.push(a)}}function Pt(t,e){var r=e.geometry,i=t.faces3,n=3*i.length,a=1*i.length,o=3*i.length,s=Ft(e,t);t.__vertexArray=new Float32Array(3*n),t.__normalArray=new Float32Array(3*n),t.__colorArray=new Float32Array(3*n),t.__uvArray=new Float32Array(2*n),1<r.faceVertexUvs.length&&(t.__uv2Array=new Float32Array(2*n)),r.hasTangents&&(t.__tangentArray=new Float32Array(4*n)),e.geometry.skinWeights.length&&e.geometry.skinIndices.length&&(t.__skinIndexArray=new Float32Array(4*n),t.__skinWeightArray=new Float32Array(4*n));var h,l,c=null!==rt.get("OES_element_index_uint")&&21845<a?Uint32Array:Uint16Array;if(t.__typeArray=c,t.__faceArray=new c(3*a),t.__lineArray=new c(2*o),t.numMorphTargets)for(t.__morphTargetsArrays=[],h=0,l=t.numMorphTargets;h<l;h++)t.__morphTargetsArrays.push(new Float32Array(3*n));if(t.numMorphNormals)for(t.__morphNormalsArrays=[],h=0,l=t.numMorphNormals;h<l;h++)t.__morphNormalsArrays.push(new Float32Array(3*n));if(t.__webglFaceCount=3*a,t.__webglLineCount=2*o,s.attributes)for(var u in void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]),s.attributes){var f=s.attributes[u],d={};for(var p in f)d[p]=f[p];if(!d.__webglInitialized||d.createUniqueBuffers){d.__webglInitialized=!0;var E=1;"v2"===d.type?E=2:"v3"===d.type?E=3:"v4"===d.type?E=4:"c"===d.type&&(E=3),d.size=E,d.array=new Float32Array(n*E),d.buffer=zt.createBuffer(),d.buffer.belongsToAttribute=u,f.needsUpdate=!0,d.__original=f}t.__webglCustomAttributesList.push(d)}t.__inittedArrays=!0}function Ft(t,e){return t.material instanceof THREE.MeshFaceMaterial?t.material.materials[e.materialIndex]:t.material}function Ut(t,e,r,i,n){if(t.__inittedArrays){var a,o,s,h,l,c,u,f,d,p,E,m,g,v,T,x,y,R,_,H,b,M,w,S,A,C,D,L,P,F,U,B,z,N,k,V,O,I,G,W,X,j,Y=(a=n)&&void 0!==a.shading&&a.shading===THREE.SmoothShading,q=0,K=0,Z=0,Q=0,J=0,$=0,tt=0,et=0,rt=0,it=0,nt=0,at=0,ot=t.__vertexArray,st=t.__uvArray,ht=t.__uv2Array,lt=t.__normalArray,ct=t.__tangentArray,ut=t.__colorArray,ft=t.__skinIndexArray,dt=t.__skinWeightArray,pt=t.__morphTargetsArrays,Et=t.__morphNormalsArrays,mt=t.__webglCustomAttributesList,gt=t.__faceArray,vt=t.__lineArray,Tt=e.geometry,xt=Tt.verticesNeedUpdate,yt=Tt.elementsNeedUpdate,Rt=Tt.uvsNeedUpdate,_t=Tt.normalsNeedUpdate,Ht=Tt.tangentsNeedUpdate,bt=Tt.colorsNeedUpdate,Mt=Tt.morphTargetsNeedUpdate,wt=Tt.vertices,St=t.faces3,At=Tt.faces,Ct=Tt.faceVertexUvs[0],Dt=Tt.faceVertexUvs[1],Lt=(Tt.colors,Tt.skinIndices),Pt=Tt.skinWeights,Ft=Tt.morphTargets,Ut=Tt.morphNormals;if(xt){for(o=0,s=St.length;o<s;o++)m=wt[(h=At[St[o]]).a],g=wt[h.b],v=wt[h.c],ot[K]=m.x,ot[K+1]=m.y,ot[K+2]=m.z,ot[K+3]=g.x,ot[K+4]=g.y,ot[K+5]=g.z,ot[K+6]=v.x,ot[K+7]=v.y,ot[K+8]=v.z,K+=9;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,ot,r)}if(Mt)for(k=0,V=Ft.length;k<V;k++){for(o=nt=0,s=St.length;o<s;o++)h=At[G=St[o]],m=Ft[k].vertices[h.a],g=Ft[k].vertices[h.b],v=Ft[k].vertices[h.c],(O=pt[k])[nt]=m.x,O[nt+1]=m.y,O[nt+2]=m.z,O[nt+3]=g.x,O[nt+4]=g.y,O[nt+5]=g.z,O[nt+6]=v.x,O[nt+7]=v.y,O[nt+8]=v.z,n.morphNormals&&(Y?(R=(W=Ut[k].vertexNormals[G]).a,_=W.b,H=W.c):H=_=R=Ut[k].faceNormals[G],(I=Et[k])[nt]=R.x,I[nt+1]=R.y,I[nt+2]=R.z,I[nt+3]=_.x,I[nt+4]=_.y,I[nt+5]=_.z,I[nt+6]=H.x,I[nt+7]=H.y,I[nt+8]=H.z),nt+=9;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[k]),zt.bufferData(zt.ARRAY_BUFFER,pt[k],r),n.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[k]),zt.bufferData(zt.ARRAY_BUFFER,Et[k],r))}if(Pt.length){for(o=0,s=St.length;o<s;o++)S=Pt[(h=At[St[o]]).a],A=Pt[h.b],C=Pt[h.c],dt[it]=S.x,dt[it+1]=S.y,dt[it+2]=S.z,dt[it+3]=S.w,dt[it+4]=A.x,dt[it+5]=A.y,dt[it+6]=A.z,dt[it+7]=A.w,dt[it+8]=C.x,dt[it+9]=C.y,dt[it+10]=C.z,dt[it+11]=C.w,D=Lt[h.a],L=Lt[h.b],P=Lt[h.c],ft[it]=D.x,ft[it+1]=D.y,ft[it+2]=D.z,ft[it+3]=D.w,ft[it+4]=L.x,ft[it+5]=L.y,ft[it+6]=L.z,ft[it+7]=L.w,ft[it+8]=P.x,ft[it+9]=P.y,ft[it+10]=P.z,ft[it+11]=P.w,it+=12;0<it&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),zt.bufferData(zt.ARRAY_BUFFER,ft,r),zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),zt.bufferData(zt.ARRAY_BUFFER,dt,r))}if(bt){for(o=0,s=St.length;o<s;o++)u=(h=At[St[o]]).vertexColors,f=h.color,3===u.length&&n.vertexColors===THREE.VertexColors?(b=u[0],M=u[1],w=u[2]):w=M=b=f,ut[rt]=b.r,ut[rt+1]=b.g,ut[rt+2]=b.b,ut[rt+3]=M.r,ut[rt+4]=M.g,ut[rt+5]=M.b,ut[rt+6]=w.r,ut[rt+7]=w.g,ut[rt+8]=w.b,rt+=9;0<rt&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,ut,r))}if(Ht&&Tt.hasTangents){for(o=0,s=St.length;o<s;o++)T=(d=(h=At[St[o]]).vertexTangents)[0],x=d[1],y=d[2],ct[tt]=T.x,ct[tt+1]=T.y,ct[tt+2]=T.z,ct[tt+3]=T.w,ct[tt+4]=x.x,ct[tt+5]=x.y,ct[tt+6]=x.z,ct[tt+7]=x.w,ct[tt+8]=y.x,ct[tt+9]=y.y,ct[tt+10]=y.z,ct[tt+11]=y.w,tt+=12;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglTangentBuffer),zt.bufferData(zt.ARRAY_BUFFER,ct,r)}if(_t){for(o=0,s=St.length;o<s;o++)if(l=(h=At[St[o]]).vertexNormals,c=h.normal,3===l.length&&Y)for(F=0;F<3;F++)B=l[F],lt[$]=B.x,lt[$+1]=B.y,lt[$+2]=B.z,$+=3;else for(F=0;F<3;F++)lt[$]=c.x,lt[$+1]=c.y,lt[$+2]=c.z,$+=3;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglNormalBuffer),zt.bufferData(zt.ARRAY_BUFFER,lt,r)}if(Rt&&Ct){for(o=0,s=St.length;o<s;o++)if(void 0!==(p=Ct[St[o]]))for(F=0;F<3;F++)z=p[F],st[Z]=z.x,st[Z+1]=z.y,Z+=2;0<Z&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUVBuffer),zt.bufferData(zt.ARRAY_BUFFER,st,r))}if(Rt&&Dt){for(o=0,s=St.length;o<s;o++)if(void 0!==(E=Dt[St[o]]))for(F=0;F<3;F++)N=E[F],ht[Q]=N.x,ht[Q+1]=N.y,Q+=2;0<Q&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUV2Buffer),zt.bufferData(zt.ARRAY_BUFFER,ht,r))}if(yt){for(o=0,s=St.length;o<s;o++)gt[J]=q,gt[J+1]=q+1,gt[J+2]=q+2,J+=3,vt[et]=q,vt[et+1]=q+1,vt[et+2]=q,vt[et+3]=q+2,vt[et+4]=q+1,vt[et+5]=q+2,et+=6,q+=3;zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),zt.bufferData(zt.ELEMENT_ARRAY_BUFFER,gt,r),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),zt.bufferData(zt.ELEMENT_ARRAY_BUFFER,vt,r)}if(mt)for(F=0,U=mt.length;F<U;F++)if((j=mt[F]).__original.needsUpdate){if(at=0,1===j.size){if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],j.array[at]=j.value[h.a],j.array[at+1]=j.value[h.b],j.array[at+2]=j.value[h.c],at+=3;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)X=j.value[St[o]],j.array[at]=X,j.array[at+1]=X,j.array[at+2]=X,at+=3}else if(2===j.size){if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=g.x,j.array[at+3]=g.y,j.array[at+4]=v.x,j.array[at+5]=v.y,at+=6;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=g.x,j.array[at+3]=g.y,j.array[at+4]=v.x,j.array[at+5]=v.y,at+=6}else if(3===j.size){var Bt;if(Bt="c"===j.type?["r","g","b"]:["x","y","z"],void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9;else if("faceVertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)m=(X=j.value[St[o]])[0],g=X[1],v=X[2],j.array[at]=m[Bt[0]],j.array[at+1]=m[Bt[1]],j.array[at+2]=m[Bt[2]],j.array[at+3]=g[Bt[0]],j.array[at+4]=g[Bt[1]],j.array[at+5]=g[Bt[2]],j.array[at+6]=v[Bt[0]],j.array[at+7]=v[Bt[1]],j.array[at+8]=v[Bt[2]],at+=9}else if(4===j.size)if(void 0===j.boundTo||"vertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)h=At[St[o]],m=j.value[h.a],g=j.value[h.b],v=j.value[h.c],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;else if("faces"===j.boundTo)for(o=0,s=St.length;o<s;o++)v=g=m=X=j.value[St[o]],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;else if("faceVertices"===j.boundTo)for(o=0,s=St.length;o<s;o++)m=(X=j.value[St[o]])[0],g=X[1],v=X[2],j.array[at]=m.x,j.array[at+1]=m.y,j.array[at+2]=m.z,j.array[at+3]=m.w,j.array[at+4]=g.x,j.array[at+5]=g.y,j.array[at+6]=g.z,j.array[at+7]=g.w,j.array[at+8]=v.x,j.array[at+9]=v.y,j.array[at+10]=v.z,j.array[at+11]=v.w,at+=12;zt.bindBuffer(zt.ARRAY_BUFFER,j.buffer),zt.bufferData(zt.ARRAY_BUFFER,j.array,r)}i&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}}function Bt(t,e,r,i){for(var n=r.attributes,a=e.attributes,o=e.attributesKeys,s=0,h=o.length;s<h;s++){var l=o[s],c=a[l];if(0<=c){var u=n[l];if(void 0!==u){var f=u.itemSize;zt.bindBuffer(zt.ARRAY_BUFFER,u.buffer),kt(c),zt.vertexAttribPointer(c,f,zt.FLOAT,!1,0,i*f*4)}else void 0!==t.defaultAttributeValues&&(2===t.defaultAttributeValues[l].length?zt.vertexAttrib2fv(c,t.defaultAttributeValues[l]):3===t.defaultAttributeValues[l].length&&zt.vertexAttrib3fv(c,t.defaultAttributeValues[l]))}}Vt()}function Nt(){for(var t=0,e=j.length;t<e;t++)j[t]=0}function kt(t){j[t]=1,0===Y[t]&&(zt.enableVertexAttribArray(t),Y[t]=1)}function Vt(){for(var t=0,e=Y.length;t<e;t++)Y[t]!==j[t]&&(zt.disableVertexAttribArray(t),Y[t]=0)}function Ot(t,e){return t.material.id!==e.material.id?e.material.id-t.material.id:t.z!==e.z?e.z-t.z:t.id-e.id}function It(t,e){return t.z!==e.z?t.z-e.z:t.id-e.id}function Gt(t,e){return e[0]-t[0]}function Wt(t,e,r,i,n,a){for(var o,s=t.length-1;-1!==s;s--){var h=t[s],l=h.object,c=h.buffer;if(ae(l,e),a)o=a;else{if(!(o=h.material))continue;n&&V.setBlending(o.blending,o.blendEquation,o.blendSrc,o.blendDst),V.setDepthTest(o.depthTest),V.setDepthWrite(o.depthWrite),le(o.polygonOffset,o.polygonOffsetFactor,o.polygonOffsetUnits)}V.setMaterialFaces(o),c instanceof THREE.BufferGeometry?V.renderBufferDirect(e,r,i,o,c,l):V.renderBuffer(e,r,i,o,c,l)}}function Xt(t,e,r,i,n,a,o){for(var s,h=0,l=t.length;h<l;h++){var c=t[h],u=c.object;if(u.visible){if(o)s=o;else{if(!(s=c[e]))continue;a&&V.setBlending(s.blending,s.blendEquation,s.blendSrc,s.blendDst),V.setDepthTest(s.depthTest),V.setDepthWrite(s.depthWrite),le(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits)}V.renderImmediateObject(r,i,n,s,u)}}}function jt(t){var e=t.object.material;e.transparent?(t.transparent=e,t.opaque=null):(t.opaque=e,t.transparent=null)}function Yt(t){var e=t.object,r=t.buffer,i=e.geometry,n=e.material;if(n instanceof THREE.MeshFaceMaterial){var a=i instanceof THREE.BufferGeometry?0:r.materialIndex;n=n.materials[a],(t.material=n).transparent?d.push(t):f.push(t)}else n&&((t.material=n).transparent?d.push(t):f.push(t))}this.renderBufferImmediate=function(t,e,r){if(Nt(),t.hasPositions&&!t.__webglVertexBuffer&&(t.__webglVertexBuffer=zt.createBuffer()),t.hasNormals&&!t.__webglNormalBuffer&&(t.__webglNormalBuffer=zt.createBuffer()),t.hasUvs&&!t.__webglUvBuffer&&(t.__webglUvBuffer=zt.createBuffer()),t.hasColors&&!t.__webglColorBuffer&&(t.__webglColorBuffer=zt.createBuffer()),t.hasPositions&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.positionArray,zt.DYNAMIC_DRAW),kt(e.attributes.position),zt.vertexAttribPointer(e.attributes.position,3,zt.FLOAT,!1,0,0)),t.hasNormals){if(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglNormalBuffer),r.shading===THREE.FlatShading){var i,n,a,o,s,h,l,c,u,f,d,p=3*t.count;for(d=0;d<p;d+=9)o=(f=t.normalArray)[d],h=f[d+1],c=f[d+2],s=f[d+3],l=f[d+4],u=f[d+5],i=(o+s+f[d+6])/3,n=(h+l+f[d+7])/3,a=(c+u+f[d+8])/3,f[d]=i,f[d+1]=n,f[d+2]=a,f[d+3]=i,f[d+4]=n,f[d+5]=a,f[d+6]=i,f[d+7]=n,f[d+8]=a}zt.bufferData(zt.ARRAY_BUFFER,t.normalArray,zt.DYNAMIC_DRAW),kt(e.attributes.normal),zt.vertexAttribPointer(e.attributes.normal,3,zt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglUvBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.uvArray,zt.DYNAMIC_DRAW),kt(e.attributes.uv),zt.vertexAttribPointer(e.attributes.uv,2,zt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==THREE.NoColors&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,t.colorArray,zt.DYNAMIC_DRAW),kt(e.attributes.color),zt.vertexAttribPointer(e.attributes.color,3,zt.FLOAT,!1,0,0)),Vt(),zt.drawArrays(zt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,r,i,n,a){if(!1!==i.visible){var o=ee(t,e,r,i,a),s=!1,h=i.wireframe?1:0,l=16777215*n.id+2*o.id+h;if(l!==T&&(T=l,s=!0),s&&Nt(),a instanceof THREE.Mesh){var c=!0===i.wireframe?zt.LINES:zt.TRIANGLES;if(E=n.attributes.index){if(E.array instanceof Uint32Array&&rt.get("OES_element_index_uint")?(m=zt.UNSIGNED_INT,g=4):(m=zt.UNSIGNED_SHORT,g=2),0===(v=n.offsets).length)s&&(Bt(i,o,n,0),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(c,E.array.length,m,0),V.info.render.calls++,V.info.render.vertices+=E.array.length,V.info.render.faces+=E.array.length/3;else{s=!0;for(var u=0,f=v.length;u<f;u++){var d=v[u].index;s&&(Bt(i,o,n,d),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(c,v[u].count,m,v[u].start*g),V.info.render.calls++,V.info.render.vertices+=v[u].count,V.info.render.faces+=v[u].count/3}}}else{s&&Bt(i,o,n,0);var p=n.attributes.position;zt.drawArrays(c,0,p.array.length/3),V.info.render.calls++,V.info.render.vertices+=p.array.length/3,V.info.render.faces+=p.array.length/9}}else if(a instanceof THREE.PointCloud){s&&Bt(i,o,n,0);p=n.attributes.position;zt.drawArrays(zt.POINTS,0,p.array.length/3),V.info.render.calls++,V.info.render.points+=p.array.length/3}else if(a instanceof THREE.Line){var E;c=a.mode===THREE.LineStrip?zt.LINE_STRIP:zt.LINES;if(he(i.linewidth),E=n.attributes.index){var m,g,v;if(E.array instanceof Uint32Array?(m=zt.UNSIGNED_INT,g=4):(m=zt.UNSIGNED_SHORT,g=2),0===(v=n.offsets).length)s&&(Bt(i,o,n,0),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(c,E.array.length,m,0),V.info.render.calls++,V.info.render.vertices+=E.array.length;else{1<v.length&&(s=!0);for(u=0,f=v.length;u<f;u++){d=v[u].index;s&&(Bt(i,o,n,d),zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,E.buffer)),zt.drawElements(c,v[u].count,m,v[u].start*g),V.info.render.calls++,V.info.render.vertices+=v[u].count}}}else{s&&Bt(i,o,n,0);p=n.attributes.position;zt.drawArrays(c,0,p.array.length/3),V.info.render.calls++,V.info.render.points+=p.array.length/3}}}},this.renderBuffer=function(t,e,r,i,n,a){if(!1!==i.visible){var o=ee(t,e,r,i,a),s=o.attributes,h=!1,l=i.wireframe?1:0,c=16777215*n.id+2*o.id+l;if(c!==T&&(T=c,h=!0),h&&Nt(),!i.morphTargets&&0<=s.position?h&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglVertexBuffer),kt(s.position),zt.vertexAttribPointer(s.position,3,zt.FLOAT,!1,0,0)):a.morphTargetBase&&function(t,e,r){var i=t.program.attributes;-1!==r.morphTargetBase&&0<=i.position?(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r.morphTargetBase]),kt(i.position),zt.vertexAttribPointer(i.position,3,zt.FLOAT,!1,0,0)):0<=i.position&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglVertexBuffer),kt(i.position),zt.vertexAttribPointer(i.position,3,zt.FLOAT,!1,0,0));if(r.morphTargetForcedOrder.length)for(var n=0,a=r.morphTargetForcedOrder,o=r.morphTargetInfluences;n<t.numSupportedMorphTargets&&n<a.length;)0<=i["morphTarget"+n]&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[a[n]]),kt(i["morphTarget"+n]),zt.vertexAttribPointer(i["morphTarget"+n],3,zt.FLOAT,!1,0,0)),0<=i["morphNormal"+n]&&t.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[a[n]]),kt(i["morphNormal"+n]),zt.vertexAttribPointer(i["morphNormal"+n],3,zt.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[n]=o[a[n]],n++;else{var s,h,l=[],o=r.morphTargetInfluences,c=o.length;for(h=0;h<c;h++)0<(s=o[h])&&l.push([s,h]);l.length>t.numSupportedMorphTargets?(l.sort(Gt),l.length=t.numSupportedMorphTargets):l.length>t.numSupportedMorphNormals?l.sort(Gt):0===l.length&&l.push([0,0]);for(var u,n=0;n<t.numSupportedMorphTargets;)l[n]?(u=l[n][1],0<=i["morphTarget"+n]&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[u]),kt(i["morphTarget"+n]),zt.vertexAttribPointer(i["morphTarget"+n],3,zt.FLOAT,!1,0,0)),0<=i["morphNormal"+n]&&t.morphNormals&&(zt.bindBuffer(zt.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[u]),kt(i["morphNormal"+n]),zt.vertexAttribPointer(i["morphNormal"+n],3,zt.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[n]=o[u]):r.__webglMorphTargetInfluences[n]=0,n++}null!==t.program.uniforms.morphTargetInfluences&&zt.uniform1fv(t.program.uniforms.morphTargetInfluences,r.__webglMorphTargetInfluences)}(i,n,a),h){if(n.__webglCustomAttributesList)for(var u=0,f=n.__webglCustomAttributesList.length;u<f;u++){var d=n.__webglCustomAttributesList[u];0<=s[d.buffer.belongsToAttribute]&&(zt.bindBuffer(zt.ARRAY_BUFFER,d.buffer),kt(s[d.buffer.belongsToAttribute]),zt.vertexAttribPointer(s[d.buffer.belongsToAttribute],d.size,zt.FLOAT,!1,0,0))}0<=s.color&&(0<a.geometry.colors.length||0<a.geometry.faces.length?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglColorBuffer),kt(s.color),zt.vertexAttribPointer(s.color,3,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib3fv(s.color,i.defaultAttributeValues.color)),0<=s.normal&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglNormalBuffer),kt(s.normal),zt.vertexAttribPointer(s.normal,3,zt.FLOAT,!1,0,0)),0<=s.tangent&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglTangentBuffer),kt(s.tangent),zt.vertexAttribPointer(s.tangent,4,zt.FLOAT,!1,0,0)),0<=s.uv&&(a.geometry.faceVertexUvs[0]?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglUVBuffer),kt(s.uv),zt.vertexAttribPointer(s.uv,2,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib2fv(s.uv,i.defaultAttributeValues.uv)),0<=s.uv2&&(a.geometry.faceVertexUvs[1]?(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglUV2Buffer),kt(s.uv2),zt.vertexAttribPointer(s.uv2,2,zt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&zt.vertexAttrib2fv(s.uv2,i.defaultAttributeValues.uv2)),i.skinning&&0<=s.skinIndex&&0<=s.skinWeight&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),kt(s.skinIndex),zt.vertexAttribPointer(s.skinIndex,4,zt.FLOAT,!1,0,0),zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),kt(s.skinWeight),zt.vertexAttribPointer(s.skinWeight,4,zt.FLOAT,!1,0,0)),0<=s.lineDistance&&(zt.bindBuffer(zt.ARRAY_BUFFER,n.__webglLineDistanceBuffer),kt(s.lineDistance),zt.vertexAttribPointer(s.lineDistance,1,zt.FLOAT,!1,0,0))}if(Vt(),a instanceof THREE.Mesh){var p=n.__typeArray===Uint32Array?zt.UNSIGNED_INT:zt.UNSIGNED_SHORT;i.wireframe?(he(i.wireframeLinewidth),h&&zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),zt.drawElements(zt.LINES,n.__webglLineCount,p,0)):(h&&zt.bindBuffer(zt.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),zt.drawElements(zt.TRIANGLES,n.__webglFaceCount,p,0)),V.info.render.calls++,V.info.render.vertices+=n.__webglFaceCount,V.info.render.faces+=n.__webglFaceCount/3}else if(a instanceof THREE.Line){var E=a.mode===THREE.LineStrip?zt.LINE_STRIP:zt.LINES;he(i.linewidth),zt.drawArrays(E,0,n.__webglLineCount),V.info.render.calls++}else a instanceof THREE.PointCloud&&(zt.drawArrays(zt.POINTS,0,n.__webglParticleCount),V.info.render.calls++,V.info.render.points+=n.__webglParticleCount)}},this.render=function(t,e,r,i){if(e instanceof THREE.Camera!=!1){var n,a=t.fog;w=T=-1,($=!(S=null))===t.autoUpdate&&t.updateMatrixWorld(),void 0===e.parent&&e.updateMatrixWorld(),t.traverse(function(t){t instanceof THREE.SkinnedMesh&&t.skeleton.update()}),e.matrixWorldInverse.getInverse(e.matrixWorld),K.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),q.setFromMatrix(K),u.length=0,f.length=0,d.length=0,p.length=0,g.length=0,function t(e,r){if(!1===r.visible)return;if(r instanceof THREE.Scene||r instanceof THREE.Group);else if(function(t,e){void 0===t.__webglInit&&(t.__webglInit=!0,t._modelViewMatrix=new THREE.Matrix4,t._normalMatrix=new THREE.Matrix3,t.addEventListener("removed",Rt));var r=t.geometry;void 0===r||void 0===r.__webglInit&&(r.__webglInit=!0,r.addEventListener("dispose",_t),r instanceof THREE.BufferGeometry||(t instanceof THREE.Mesh?Zt(e,t,r):t instanceof THREE.Line?void 0===r.__webglVertexBuffer&&((c=r).__webglVertexBuffer=zt.createBuffer(),c.__webglColorBuffer=zt.createBuffer(),c.__webglLineDistanceBuffer=zt.createBuffer(),V.info.memory.geometries++,h=t,l=(s=r).vertices.length,s.__vertexArray=new Float32Array(3*l),s.__colorArray=new Float32Array(3*l),s.__lineDistanceArray=new Float32Array(1*l),s.__webglLineCount=l,Lt(h),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0,r.lineDistancesNeedUpdate=!0):t instanceof THREE.PointCloud&&void 0===r.__webglVertexBuffer&&((o=r).__webglVertexBuffer=zt.createBuffer(),o.__webglColorBuffer=zt.createBuffer(),V.info.memory.geometries++,n=t,a=(i=r).vertices.length,i.__vertexArray=new Float32Array(3*a),i.__colorArray=new Float32Array(3*a),i.__sortArray=[],i.__webglParticleCount=a,Lt(n),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0)));var i,n,a;var o;var s,h,l;var c;if(void 0===t.__webglActive)if(t.__webglActive=!0,t instanceof THREE.Mesh){if(r instanceof THREE.BufferGeometry)Qt(E,r,t);else if(r instanceof THREE.Geometry)for(var u=qt[r.id],f=0,d=u.length;f<d;f++)Qt(E,u[f],t)}else t instanceof THREE.Line||t instanceof THREE.PointCloud?Qt(E,r,t):(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&(p=t,m.push({id:null,object:p,opaque:null,transparent:null,z:0}));var p}(r,e),r instanceof THREE.Light)u.push(r);else if(r instanceof THREE.Sprite)p.push(r);else if(r instanceof THREE.LensFlare)g.push(r);else{var i=E[r.id];if(i&&(!1===r.frustumCulled||!0===q.intersectsObject(r))){!function(t,e){var r,i,n=t.geometry;if(n instanceof THREE.BufferGeometry)!function(t){for(var e=t.attributes,r=t.attributesKeys,i=0,n=r.length;i<n;i++){var a=r[i],o=e[a];if(void 0===o.buffer&&(o.buffer=zt.createBuffer(),o.needsUpdate=!0),!0===o.needsUpdate){var s="index"===a?zt.ELEMENT_ARRAY_BUFFER:zt.ARRAY_BUFFER;zt.bindBuffer(s,o.buffer),zt.bufferData(s,o.array,zt.STATIC_DRAW),o.needsUpdate=!1}}}(n);else if(t instanceof THREE.Mesh){!0===n.groupsNeedUpdate&&Zt(e,t,n);for(var a=qt[n.id],o=0,s=a.length;o<s;o++){var h=a[o];i=Ft(t,h),!0===n.groupsNeedUpdate&&Pt(h,t),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.morphTargetsNeedUpdate||n.elementsNeedUpdate||n.uvsNeedUpdate||n.normalsNeedUpdate||n.colorsNeedUpdate||n.tangentsNeedUpdate||r)&&Ut(h,t,zt.DYNAMIC_DRAW,!n.dynamic,i)}n.verticesNeedUpdate=!1,n.morphTargetsNeedUpdate=!1,n.elementsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.tangentsNeedUpdate=!1,i.attributes&&$t(i)}else t instanceof THREE.Line?(i=Ft(t,n),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||n.lineDistancesNeedUpdate||r)&&function(t,e){var r,i,n,a,o,s,h,l,c,u,f,d,p=t.vertices,E=t.colors,m=t.lineDistances,g=p.length,v=E.length,T=m.length,x=t.__vertexArray,y=t.__colorArray,R=t.__lineDistanceArray,_=t.verticesNeedUpdate,H=t.colorsNeedUpdate,b=t.lineDistancesNeedUpdate,M=t.__webglCustomAttributesList;if(_){for(r=0;r<g;r++)a=p[r],x[o=3*r]=a.x,x[o+1]=a.y,x[o+2]=a.z;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,x,e)}if(H){for(i=0;i<v;i++)s=E[i],y[o=3*i]=s.r,y[o+1]=s.g,y[o+2]=s.b;zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,y,e)}if(b){for(n=0;n<T;n++)R[n]=m[n];zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglLineDistanceBuffer),zt.bufferData(zt.ARRAY_BUFFER,R,e)}if(M)for(h=0,l=M.length;h<l;h++)if((d=M[h]).needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo)){if(o=0,u=d.value.length,1===d.size)for(c=0;c<u;c++)d.array[c]=d.value[c];else if(2===d.size)for(c=0;c<u;c++)f=d.value[c],d.array[o]=f.x,d.array[o+1]=f.y,o+=2;else if(3===d.size)if("c"===d.type)for(c=0;c<u;c++)f=d.value[c],d.array[o]=f.r,d.array[o+1]=f.g,d.array[o+2]=f.b,o+=3;else for(c=0;c<u;c++)f=d.value[c],d.array[o]=f.x,d.array[o+1]=f.y,d.array[o+2]=f.z,o+=3;else if(4===d.size)for(c=0;c<u;c++)f=d.value[c],d.array[o]=f.x,d.array[o+1]=f.y,d.array[o+2]=f.z,d.array[o+3]=f.w,o+=4;zt.bindBuffer(zt.ARRAY_BUFFER,d.buffer),zt.bufferData(zt.ARRAY_BUFFER,d.array,e)}}(n,zt.DYNAMIC_DRAW),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,n.lineDistancesNeedUpdate=!1,i.attributes&&$t(i)):t instanceof THREE.PointCloud&&(i=Ft(t,n),r=i.attributes&&Jt(i),(n.verticesNeedUpdate||n.colorsNeedUpdate||t.sortParticles||r)&&function(t,e,r){var i,n,a,o,s,h,l,c,u,f,d,p,E=t.vertices,m=E.length,g=t.colors,v=g.length,T=t.__vertexArray,x=t.__colorArray,y=t.__sortArray,R=t.verticesNeedUpdate,_=(t.elementsNeedUpdate,t.colorsNeedUpdate),H=t.__webglCustomAttributesList;if(r.sortParticles){for(Z.copy(K),Z.multiply(r.matrixWorld),i=0;i<m;i++)a=E[i],Q.copy(a),Q.applyProjection(Z),y[i]=[Q.z,i];for(y.sort(Gt),i=0;i<m;i++)a=E[y[i][1]],T[o=3*i]=a.x,T[o+1]=a.y,T[o+2]=a.z;for(n=0;n<v;n++)o=3*n,h=g[y[n][1]],x[o]=h.r,x[o+1]=h.g,x[o+2]=h.b;if(H)for(l=0,c=H.length;l<c;l++)if(void 0===(p=H[l]).boundTo||"vertices"===p.boundTo)if(o=0,f=p.value.length,1===p.size)for(u=0;u<f;u++)s=y[u][1],p.array[u]=p.value[s];else if(2===p.size)for(u=0;u<f;u++)s=y[u][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,o+=2;else if(3===p.size)if("c"===p.type)for(u=0;u<f;u++)s=y[u][1],d=p.value[s],p.array[o]=d.r,p.array[o+1]=d.g,p.array[o+2]=d.b,o+=3;else for(u=0;u<f;u++)s=y[u][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,o+=3;else if(4===p.size)for(u=0;u<f;u++)s=y[u][1],d=p.value[s],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,p.array[o+3]=d.w,o+=4}else{if(R)for(i=0;i<m;i++)a=E[i],T[o=3*i]=a.x,T[o+1]=a.y,T[o+2]=a.z;if(_)for(n=0;n<v;n++)h=g[n],x[o=3*n]=h.r,x[o+1]=h.g,x[o+2]=h.b;if(H)for(l=0,c=H.length;l<c;l++)if((p=H[l]).needsUpdate&&(void 0===p.boundTo||"vertices"===p.boundTo))if(f=p.value.length,o=0,1===p.size)for(u=0;u<f;u++)p.array[u]=p.value[u];else if(2===p.size)for(u=0;u<f;u++)d=p.value[u],p.array[o]=d.x,p.array[o+1]=d.y,o+=2;else if(3===p.size)if("c"===p.type)for(u=0;u<f;u++)d=p.value[u],p.array[o]=d.r,p.array[o+1]=d.g,p.array[o+2]=d.b,o+=3;else for(u=0;u<f;u++)d=p.value[u],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,o+=3;else if(4===p.size)for(u=0;u<f;u++)d=p.value[u],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,p.array[o+3]=d.w,o+=4}if((R||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglVertexBuffer),zt.bufferData(zt.ARRAY_BUFFER,T,e)),(_||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,t.__webglColorBuffer),zt.bufferData(zt.ARRAY_BUFFER,x,e)),H)for(l=0,c=H.length;l<c;l++)((p=H[l]).needsUpdate||r.sortParticles)&&(zt.bindBuffer(zt.ARRAY_BUFFER,p.buffer),zt.bufferData(zt.ARRAY_BUFFER,p.array,e))}(n,zt.DYNAMIC_DRAW,t),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,i.attributes&&$t(i))}(r,e);for(var n=0,a=i.length;n<a;n++){var o=i[n];Yt(o),(o.render=!0)===V.sortObjects&&(null!==r.renderDepth?o.z=r.renderDepth:(Q.setFromMatrixPosition(r.matrixWorld),Q.applyProjection(K),o.z=Q.z))}}}for(var n=0,a=r.children.length;n<a;n++)t(e,r.children[n])}(t,t),!0===V.sortObjects&&(f.sort(Ot),d.sort(It)),vt.render(t,e),V.info.render.calls=0,V.info.render.vertices=0,V.info.render.faces=0,V.info.render.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var o=0,s=m.length;o<s;o++){var h=m[o],l=h.object;l.visible&&(ae(l,e),jt(h))}if(t.overrideMaterial){var c=t.overrideMaterial;this.setBlending(c.blending,c.blendEquation,c.blendSrc,c.blendDst),this.setDepthTest(c.depthTest),this.setDepthWrite(c.depthWrite),le(c.polygonOffset,c.polygonOffsetFactor,c.polygonOffsetUnits),Wt(f,e,u,a,!0,c),Wt(d,e,u,a,!0,c),Xt(m,"",e,u,a,!1,c)}else{c=null;this.setBlending(THREE.NoBlending),Wt(f,e,u,a,!1,c),Xt(m,"opaque",e,u,a,!1,c),Wt(d,e,u,a,!0,c),Xt(m,"transparent",e,u,a,!0,c)}Tt.render(t,e),xt.render(t,e,W,X),r&&r.generateMipmaps&&r.minFilter!==THREE.NearestFilter&&r.minFilter!==THREE.LinearFilter&&((n=r)instanceof THREE.WebGLRenderTargetCube?(zt.bindTexture(zt.TEXTURE_CUBE_MAP,n.__webglTexture),zt.generateMipmap(zt.TEXTURE_CUBE_MAP),zt.bindTexture(zt.TEXTURE_CUBE_MAP,null)):(zt.bindTexture(zt.TEXTURE_2D,n.__webglTexture),zt.generateMipmap(zt.TEXTURE_2D),zt.bindTexture(zt.TEXTURE_2D,null))),this.setDepthTest(!0),this.setDepthWrite(!0)}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.renderImmediateObject=function(t,e,r,i,n){var a=ee(t,e,r,i,n);T=-1,V.setMaterialFaces(i),n.immediateRenderCallback?n.immediateRenderCallback(a,zt,q):n.render(function(t){V.renderBufferImmediate(t,a,i)})};var qt={},Kt=0;function Zt(t,e,r){var i=e.material,n=!1;void 0!==qt[r.id]&&!0!==r.groupsNeedUpdate||(delete E[e.id],qt[r.id]=function(t,e){for(var r,i,n=rt.get("OES_element_index_uint")?4294967296:65535,a={},o=t.morphTargets.length,s=t.morphNormals.length,h={},l=[],c=0,u=t.faces.length;c<u;c++){var f=t.faces[c],d=e?f.materialIndex:0;d in a||(a[d]={hash:d,counter:0}),(r=a[d].hash+"_"+a[d].counter)in h||(i={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},h[r]=i,l.push(i)),h[r].vertices+3>n&&(a[d].counter+=1,(r=a[d].hash+"_"+a[d].counter)in h||(i={id:Kt++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:o,numMorphNormals:s},h[r]=i,l.push(i))),h[r].faces3.push(c),h[r].vertices+=3}return l}(r,i instanceof THREE.MeshFaceMaterial),r.groupsNeedUpdate=!1);for(var a=qt[r.id],o=0,s=a.length;o<s;o++){var h=a[o];void 0===h.__webglVertexBuffer?(yt(h),Pt(h,e),r.verticesNeedUpdate=!0,r.morphTargetsNeedUpdate=!0,r.elementsNeedUpdate=!0,r.uvsNeedUpdate=!0,r.normalsNeedUpdate=!0,r.tangentsNeedUpdate=!0,n=r.colorsNeedUpdate=!0):n=!1,(n||void 0===e.__webglActive)&&Qt(E,h,e)}e.__webglActive=!0}function Qt(t,e,r){var i=r.id;t[i]=t[i]||[],t[i].push({id:i,buffer:e,object:r,material:null,z:0})}function Jt(t){for(var e in t.attributes)if(t.attributes[e].needsUpdate)return!0;return!1}function $t(t){for(var e in t.attributes)t.attributes[e].needsUpdate=!1}function te(t,e,r,i){var n;if(t.addEventListener("dispose",Mt),t instanceof THREE.MeshDepthMaterial?n="depth":t instanceof THREE.MeshNormalMaterial?n="normal":t instanceof THREE.MeshBasicMaterial?n="basic":t instanceof THREE.MeshLambertMaterial?n="lambert":t instanceof THREE.MeshPhongMaterial?n="phong":t instanceof THREE.LineBasicMaterial?n="basic":t instanceof THREE.LineDashedMaterial?n="dashed":t instanceof THREE.PointCloudMaterial&&(n="particle_basic"),n){var a=THREE.ShaderLib[n];t.__webglShader={uniforms:THREE.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}}else t.__webglShader={uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};var o=function(t){for(var e=0,r=0,i=0,n=0,a=0,o=t.length;a<o;a++){var s=t[a];s.onlyShadow||!1===s.visible||(s instanceof THREE.DirectionalLight&&e++,s instanceof THREE.PointLight&&r++,s instanceof THREE.SpotLight&&i++,s instanceof THREE.HemisphereLight&&n++)}return{directional:e,point:r,spot:i,hemi:n}}(e),s=function(t){for(var e=0,r=0,i=t.length;r<i;r++){var n=t[r];n.castShadow&&(n instanceof THREE.SpotLight&&e++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&e++)}return e}(e),h=function(t){{if(lt&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var e=zt.getParameter(zt.MAX_VERTEX_UNIFORM_VECTORS),r=Math.floor((e-20)/4),i=r;return void 0!==t&&t instanceof THREE.SkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i))<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)"),i}}(i),l={precision:_,supportsVertexTextures:ht,map:!!t.map,envMap:!!t.envMap,lightMap:!!t.lightMap,bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,vertexColors:t.vertexColors,fog:r,useFog:t.fog,fogExp:r instanceof THREE.FogExp2,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:H,skinning:t.skinning,maxBones:h,useVertexTexture:lt&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:V.maxMorphTargets,maxMorphNormals:V.maxMorphNormals,maxDirLights:o.directional,maxPointLights:o.point,maxSpotLights:o.spot,maxHemiLights:o.hemi,maxShadows:s,shadowMapEnabled:V.shadowMapEnabled&&i.receiveShadow&&0<s,shadowMapType:V.shadowMapType,shadowMapDebug:V.shadowMapDebug,shadowMapCascade:V.shadowMapCascade,alphaTest:t.alphaTest,metal:t.metal,wrapAround:t.wrapAround,doubleSided:t.side===THREE.DoubleSide,flipSided:t.side===THREE.BackSide},c=[];if(n?c.push(n):(c.push(t.fragmentShader),c.push(t.vertexShader)),void 0!==t.defines)for(var u in t.defines)c.push(u),c.push(t.defines[u]);for(var u in l)c.push(u),c.push(l[u]);for(var f,d=c.join(),p=0,E=b.length;p<E;p++){var m=b[p];if(m.code===d){(f=m).usedTimes++;break}}void 0===f&&(f=new THREE.WebGLProgram(V,d,t,l),b.push(f),V.info.memory.programs=b.length);var g=(t.program=f).attributes;if(t.morphTargets)for(var v="morphTarget",T=t.numSupportedMorphTargets=0;T<V.maxMorphTargets;T++)0<=g[v+T]&&t.numSupportedMorphTargets++;if(t.morphNormals){v="morphNormal";for(T=t.numSupportedMorphNormals=0;T<V.maxMorphNormals;T++)0<=g[v+T]&&t.numSupportedMorphNormals++}for(var x in t.uniformsList=[],t.__webglShader.uniforms){var y=t.program.uniforms[x];y&&t.uniformsList.push([t.__webglShader.uniforms[x],y])}}function ee(t,e,r,i,n){A=0,i.needsUpdate&&(i.program&&Dt(i),te(i,e,r,n),i.needsUpdate=!1),i.morphTargets&&(n.__webglMorphTargetInfluences||(n.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets)));var a,o,s,h,l,c,u,f,d,p,E=!1,m=!1,g=!1,v=i.program,T=v.uniforms,x=i.__webglShader.uniforms;if(v.id!==M&&(zt.useProgram(v.program),M=v.id,g=m=E=!0),i.id!==w&&(-1===w&&(g=!0),w=i.id,m=!0),(E||t!==S)&&(zt.uniformMatrix4fv(T.projectionMatrix,!1,t.projectionMatrix.elements),H&&zt.uniform1f(T.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==S&&(S=t),(i instanceof THREE.ShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&null!==T.cameraPosition&&(Q.setFromMatrixPosition(t.matrixWorld),zt.uniform3f(T.cameraPosition,Q.x,Q.y,Q.z)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.ShaderMaterial||i.skinning)&&null!==T.viewMatrix&&zt.uniformMatrix4fv(T.viewMatrix,!1,t.matrixWorldInverse.elements)),i.skinning)if(n.bindMatrix&&null!==T.bindMatrix&&zt.uniformMatrix4fv(T.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&null!==T.bindMatrixInverse&&zt.uniformMatrix4fv(T.bindMatrixInverse,!1,n.bindMatrixInverse.elements),lt&&n.skeleton&&n.skeleton.useVertexTexture){if(null!==T.boneTexture){var y=ne();zt.uniform1i(T.boneTexture,y),V.setTexture(n.skeleton.boneTexture,y)}null!==T.boneTextureWidth&&zt.uniform1i(T.boneTextureWidth,n.skeleton.boneTextureWidth),null!==T.boneTextureHeight&&zt.uniform1i(T.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&null!==T.boneGlobalMatrices&&zt.uniformMatrix4fv(T.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return m&&(r&&i.fog&&(f=r,(u=x).fogColor.value=f.color,f instanceof THREE.Fog?(u.fogNear.value=f.near,u.fogFar.value=f.far):f instanceof THREE.FogExp2&&(u.fogDensity.value=f.density)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights)&&($&&(g=!0,function(t){var e,r,i,n,a,o,s,h,l,c=0,u=0,f=0,d=tt,p=d.directional.colors,E=d.directional.positions,m=d.point.colors,g=d.point.positions,v=d.point.distances,T=d.spot.colors,x=d.spot.positions,y=d.spot.distances,R=d.spot.directions,_=d.spot.anglesCos,H=d.spot.exponents,b=d.hemi.skyColors,M=d.hemi.groundColors,w=d.hemi.positions,S=0,A=0,C=0,D=0,L=0,P=0,F=0,U=0,B=0,z=0,N=0,k=0;for(e=0,r=t.length;e<r;e++)if(!(i=t[e]).onlyShadow)if(n=i.color,s=i.intensity,l=i.distance,i instanceof THREE.AmbientLight){if(!i.visible)continue;V.gammaInput?(c+=n.r*n.r,u+=n.g*n.g,f+=n.b*n.b):(c+=n.r,u+=n.g,f+=n.b)}else if(i instanceof THREE.DirectionalLight){if(L+=1,!i.visible)continue;J.setFromMatrixPosition(i.matrixWorld),Q.setFromMatrixPosition(i.target.matrixWorld),J.sub(Q),J.normalize(),E[B=3*S]=J.x,E[B+1]=J.y,E[B+2]=J.z,V.gammaInput?oe(p,B,n,s*s):se(p,B,n,s),S+=1}else if(i instanceof THREE.PointLight){if(P+=1,!i.visible)continue;z=3*A,V.gammaInput?oe(m,z,n,s*s):se(m,z,n,s),Q.setFromMatrixPosition(i.matrixWorld),g[z]=Q.x,g[z+1]=Q.y,g[z+2]=Q.z,v[A]=l,A+=1}else if(i instanceof THREE.SpotLight){if(F+=1,!i.visible)continue;N=3*C,V.gammaInput?oe(T,N,n,s*s):se(T,N,n,s),J.setFromMatrixPosition(i.matrixWorld),x[N]=J.x,x[N+1]=J.y,x[N+2]=J.z,y[C]=l,Q.setFromMatrixPosition(i.target.matrixWorld),J.sub(Q),J.normalize(),R[N]=J.x,R[N+1]=J.y,R[N+2]=J.z,_[C]=Math.cos(i.angle),H[C]=i.exponent,C+=1}else if(i instanceof THREE.HemisphereLight){if(U+=1,!i.visible)continue;J.setFromMatrixPosition(i.matrixWorld),J.normalize(),w[k=3*D]=J.x,w[k+1]=J.y,w[k+2]=J.z,a=i.color,o=i.groundColor,V.gammaInput?(oe(b,k,a,h=s*s),oe(M,k,o,h)):(se(b,k,a,s),se(M,k,o,s)),D+=1}for(e=3*S,r=Math.max(p.length,3*L);e<r;e++)p[e]=0;for(e=3*A,r=Math.max(m.length,3*P);e<r;e++)m[e]=0;for(e=3*C,r=Math.max(T.length,3*F);e<r;e++)T[e]=0;for(e=3*D,r=Math.max(b.length,3*U);e<r;e++)b[e]=0;for(e=3*D,r=Math.max(M.length,3*U);e<r;e++)M[e]=0;d.directional.length=S,d.point.length=A,d.spot.length=C,d.hemi.length=D,d.ambient[0]=c,d.ambient[1]=u,d.ambient[2]=f}(e),$=!1),g?(c=tt,(l=x).ambientLightColor.value=c.ambient,l.directionalLightColor.value=c.directional.colors,l.directionalLightDirection.value=c.directional.positions,l.pointLightColor.value=c.point.colors,l.pointLightPosition.value=c.point.positions,l.pointLightDistance.value=c.point.distances,l.spotLightColor.value=c.spot.colors,l.spotLightPosition.value=c.spot.positions,l.spotLightDistance.value=c.spot.distances,l.spotLightDirection.value=c.spot.directions,l.spotLightAngleCos.value=c.spot.anglesCos,l.spotLightExponent.value=c.spot.exponents,l.hemisphereLightSkyColor.value=c.hemi.skyColors,l.hemisphereLightGroundColor.value=c.hemi.groundColors,l.hemisphereLightDirection.value=c.hemi.positions,ie(x,!0)):ie(x,!1)),(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&function(t,e){t.opacity.value=e.opacity,V.gammaInput?t.diffuse.value.copyGammaToLinear(e.color):t.diffuse.value=e.color;t.map.value=e.map,t.lightMap.value=e.lightMap,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));var r;e.map?r=e.map:e.specularMap?r=e.specularMap:e.normalMap?r=e.normalMap:e.bumpMap?r=e.bumpMap:e.alphaMap&&(r=e.alphaMap);if(void 0!==r){var i=r.offset,n=r.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,V.gammaInput,t.reflectivity.value=e.reflectivity;t.refractionRatio.value=e.refractionRatio,t.combine.value=e.combine,t.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping}(x,i),i instanceof THREE.LineBasicMaterial?re(x,i):i instanceof THREE.LineDashedMaterial?(re(x,i),h=i,(s=x).dashSize.value=h.dashSize,s.totalSize.value=h.dashSize+h.gapSize,s.scale.value=h.scale):i instanceof THREE.PointCloudMaterial?(o=i,(a=x).psColor.value=o.color,a.opacity.value=o.opacity,a.size.value=o.size,a.scale.value=R.height/2,a.map.value=o.map):i instanceof THREE.MeshPhongMaterial?function(t,e){t.shininess.value=e.shininess,V.gammaInput?(t.ambient.value.copyGammaToLinear(e.ambient),t.emissive.value.copyGammaToLinear(e.emissive),t.specular.value.copyGammaToLinear(e.specular)):(t.ambient.value=e.ambient,t.emissive.value=e.emissive,t.specular.value=e.specular);e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}(x,i):i instanceof THREE.MeshLambertMaterial?function(t,e){V.gammaInput?(t.ambient.value.copyGammaToLinear(e.ambient),t.emissive.value.copyGammaToLinear(e.emissive)):(t.ambient.value=e.ambient,t.emissive.value=e.emissive);e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}(x,i):i instanceof THREE.MeshDepthMaterial?(x.mNear.value=t.near,x.mFar.value=t.far,x.opacity.value=i.opacity):i instanceof THREE.MeshNormalMaterial&&(x.opacity.value=i.opacity),n.receiveShadow&&!i._shadowPass&&function(t,e){if(t.shadowMatrix)for(var r=0,i=0,n=e.length;i<n;i++){var a=e[i];a.castShadow&&((a instanceof THREE.SpotLight||a instanceof THREE.DirectionalLight&&!a.shadowCascade)&&(t.shadowMap.value[r]=a.shadowMap,t.shadowMapSize.value[r]=a.shadowMapSize,t.shadowMatrix.value[r]=a.shadowMatrix,t.shadowDarkness.value[r]=a.shadowDarkness,t.shadowBias.value[r]=a.shadowBias,r++))}}(x,e),function(t){for(var e,r,i,n=0,a=t.length;n<a;n++){var o=t[n][0];if(!1!==o.needsUpdate){var s=o.type,h=o.value,l=t[n][1];switch(s){case"1i":zt.uniform1i(l,h);break;case"1f":zt.uniform1f(l,h);break;case"2f":zt.uniform2f(l,h[0],h[1]);break;case"3f":zt.uniform3f(l,h[0],h[1],h[2]);break;case"4f":zt.uniform4f(l,h[0],h[1],h[2],h[3]);break;case"1iv":zt.uniform1iv(l,h);break;case"3iv":zt.uniform3iv(l,h);break;case"1fv":zt.uniform1fv(l,h);break;case"2fv":zt.uniform2fv(l,h);break;case"3fv":zt.uniform3fv(l,h);break;case"4fv":zt.uniform4fv(l,h);break;case"Matrix3fv":zt.uniformMatrix3fv(l,!1,h);break;case"Matrix4fv":zt.uniformMatrix4fv(l,!1,h);break;case"i":zt.uniform1i(l,h);break;case"f":zt.uniform1f(l,h);break;case"v2":zt.uniform2f(l,h.x,h.y);break;case"v3":zt.uniform3f(l,h.x,h.y,h.z);break;case"v4":zt.uniform4f(l,h.x,h.y,h.z,h.w);break;case"c":zt.uniform3f(l,h.r,h.g,h.b);break;case"iv1":zt.uniform1iv(l,h);break;case"iv":zt.uniform3iv(l,h);break;case"fv1":zt.uniform1fv(l,h);break;case"fv":zt.uniform3fv(l,h);break;case"v2v":void 0===o._array&&(o._array=new Float32Array(2*h.length));for(var c=0,u=h.length;c<u;c++)i=2*c,o._array[i]=h[c].x,o._array[i+1]=h[c].y;zt.uniform2fv(l,o._array);break;case"v3v":void 0===o._array&&(o._array=new Float32Array(3*h.length));for(var c=0,u=h.length;c<u;c++)i=3*c,o._array[i]=h[c].x,o._array[i+1]=h[c].y,o._array[i+2]=h[c].z;zt.uniform3fv(l,o._array);break;case"v4v":void 0===o._array&&(o._array=new Float32Array(4*h.length));for(var c=0,u=h.length;c<u;c++)i=4*c,o._array[i]=h[c].x,o._array[i+1]=h[c].y,o._array[i+2]=h[c].z,o._array[i+3]=h[c].w;zt.uniform4fv(l,o._array);break;case"m3":zt.uniformMatrix3fv(l,!1,h.elements);break;case"m3v":void 0===o._array&&(o._array=new Float32Array(9*h.length));for(var c=0,u=h.length;c<u;c++)h[c].flattenToArrayOffset(o._array,9*c);zt.uniformMatrix3fv(l,!1,o._array);break;case"m4":zt.uniformMatrix4fv(l,!1,h.elements);break;case"m4v":void 0===o._array&&(o._array=new Float32Array(16*h.length));for(var c=0,u=h.length;c<u;c++)h[c].flattenToArrayOffset(o._array,16*c);zt.uniformMatrix4fv(l,!1,o._array);break;case"t":if(e=h,r=ne(),zt.uniform1i(l,r),!e)continue;e instanceof THREE.CubeTexture||e.image instanceof Array&&6===e.image.length?fe(e,r):e instanceof THREE.WebGLRenderTargetCube?de(e,r):V.setTexture(e,r);break;case"tv":void 0===o._array&&(o._array=[]);for(var c=0,u=o.value.length;c<u;c++)o._array[c]=ne();zt.uniform1iv(l,o._array);for(var c=0,u=o.value.length;c<u;c++)e=o.value[c],r=o._array[c],e&&V.setTexture(e,r);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+s)}}}}(i.uniformsList)),d=T,p=n,zt.uniformMatrix4fv(d.modelViewMatrix,!1,p._modelViewMatrix.elements),d.normalMatrix&&zt.uniformMatrix3fv(d.normalMatrix,!1,p._normalMatrix.elements),null!==T.modelMatrix&&zt.uniformMatrix4fv(T.modelMatrix,!1,n.matrixWorld.elements),v}function re(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function ie(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLightColor.needsUpdate=e,t.directionalLightDirection.needsUpdate=e,t.pointLightColor.needsUpdate=e,t.pointLightPosition.needsUpdate=e,t.pointLightDistance.needsUpdate=e,t.spotLightColor.needsUpdate=e,t.spotLightPosition.needsUpdate=e,t.spotLightDistance.needsUpdate=e,t.spotLightDirection.needsUpdate=e,t.spotLightAngleCos.needsUpdate=e,t.spotLightExponent.needsUpdate=e,t.hemisphereLightSkyColor.needsUpdate=e,t.hemisphereLightGroundColor.needsUpdate=e,t.hemisphereLightDirection.needsUpdate=e}function ne(){var t=A;return nt<=t&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+nt),A+=1,t}function ae(t,e){t._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),t._normalMatrix.getNormalMatrix(t._modelViewMatrix)}function oe(t,e,r,i){t[e]=r.r*r.r*i,t[e+1]=r.g*r.g*i,t[e+2]=r.b*r.b*i}function se(t,e,r,i){t[e]=r.r*i,t[e+1]=r.g*i,t[e+2]=r.b*i}function he(t){t!==N&&(zt.lineWidth(t),N=t)}function le(t,e,r){U!==t&&(t?zt.enable(zt.POLYGON_OFFSET_FILL):zt.disable(zt.POLYGON_OFFSET_FILL),U=t),!t||B===e&&z===r||(zt.polygonOffset(e,r),B=e,z=r)}function ce(t,e,r){var i;r?(zt.texParameteri(t,zt.TEXTURE_WRAP_S,ge(e.wrapS)),zt.texParameteri(t,zt.TEXTURE_WRAP_T,ge(e.wrapT)),zt.texParameteri(t,zt.TEXTURE_MAG_FILTER,ge(e.magFilter)),zt.texParameteri(t,zt.TEXTURE_MIN_FILTER,ge(e.minFilter))):(zt.texParameteri(t,zt.TEXTURE_WRAP_S,zt.CLAMP_TO_EDGE),zt.texParameteri(t,zt.TEXTURE_WRAP_T,zt.CLAMP_TO_EDGE),zt.texParameteri(t,zt.TEXTURE_MAG_FILTER,me(e.magFilter)),zt.texParameteri(t,zt.TEXTURE_MIN_FILTER,me(e.minFilter))),(i=rt.get("EXT_texture_filter_anisotropic"))&&e.type!==THREE.FloatType&&(1<e.anisotropy||e.__oldAnisotropy)&&(zt.texParameterf(t,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,V.getMaxAnisotropy())),e.__oldAnisotropy=e.anisotropy)}function ue(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.log("THREE.WebGLRenderer:",t,"is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height+"."),i}return t}function fe(t,e){if(6===t.image.length)if(t.needsUpdate){t.image.__webglTextureCube||(t.addEventListener("dispose",Ht),t.image.__webglTextureCube=zt.createTexture(),V.info.memory.textures++),zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube),zt.pixelStorei(zt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var r=t instanceof THREE.CompressedTexture,i=t.image[0]instanceof THREE.DataTexture,n=[],a=0;a<6;a++)!V.autoScaleCubemaps||r||i?n[a]=i?t.image[a].image:t.image[a]:n[a]=ue(t.image[a],st);var o=n[0],s=THREE.Math.isPowerOfTwo(o.width)&&THREE.Math.isPowerOfTwo(o.height),h=ge(t.format),l=ge(t.type);ce(zt.TEXTURE_CUBE_MAP,t,s);for(a=0;a<6;a++)if(r)for(var c,u=n[a].mipmaps,f=0,d=u.length;f<d;f++)c=u[f],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<pt().indexOf(h)?zt.compressedTexImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,f,h,c.width,c.height,0,c.data):console.warn("Attempt to load unsupported compressed texture format"):zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,f,h,c.width,c.height,0,h,l,c.data);else i?zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,n[a].width,n[a].height,0,h,l,n[a].data):zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,h,h,l,n[a]);t.generateMipmaps&&s&&zt.generateMipmap(zt.TEXTURE_CUBE_MAP),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()}else zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}function de(t,e){zt.activeTexture(zt.TEXTURE0+e),zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.__webglTexture)}function pe(t,e,r){zt.bindFramebuffer(zt.FRAMEBUFFER,t),zt.framebufferTexture2D(zt.FRAMEBUFFER,zt.COLOR_ATTACHMENT0,r,e.__webglTexture,0)}function Ee(t,e){zt.bindRenderbuffer(zt.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(zt.renderbufferStorage(zt.RENDERBUFFER,zt.DEPTH_COMPONENT16,e.width,e.height),zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_ATTACHMENT,zt.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(zt.renderbufferStorage(zt.RENDERBUFFER,zt.DEPTH_STENCIL,e.width,e.height),zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_STENCIL_ATTACHMENT,zt.RENDERBUFFER,t)):zt.renderbufferStorage(zt.RENDERBUFFER,zt.RGBA4,e.width,e.height)}function me(t){return t===THREE.NearestFilter||t===THREE.NearestMipMapNearestFilter||t===THREE.NearestMipMapLinearFilter?zt.NEAREST:zt.LINEAR}function ge(t){var e;if(t===THREE.RepeatWrapping)return zt.REPEAT;if(t===THREE.ClampToEdgeWrapping)return zt.CLAMP_TO_EDGE;if(t===THREE.MirroredRepeatWrapping)return zt.MIRRORED_REPEAT;if(t===THREE.NearestFilter)return zt.NEAREST;if(t===THREE.NearestMipMapNearestFilter)return zt.NEAREST_MIPMAP_NEAREST;if(t===THREE.NearestMipMapLinearFilter)return zt.NEAREST_MIPMAP_LINEAR;if(t===THREE.LinearFilter)return zt.LINEAR;if(t===THREE.LinearMipMapNearestFilter)return zt.LINEAR_MIPMAP_NEAREST;if(t===THREE.LinearMipMapLinearFilter)return zt.LINEAR_MIPMAP_LINEAR;if(t===THREE.UnsignedByteType)return zt.UNSIGNED_BYTE;if(t===THREE.UnsignedShort4444Type)return zt.UNSIGNED_SHORT_4_4_4_4;if(t===THREE.UnsignedShort5551Type)return zt.UNSIGNED_SHORT_5_5_5_1;if(t===THREE.UnsignedShort565Type)return zt.UNSIGNED_SHORT_5_6_5;if(t===THREE.ByteType)return zt.BYTE;if(t===THREE.ShortType)return zt.SHORT;if(t===THREE.UnsignedShortType)return zt.UNSIGNED_SHORT;if(t===THREE.IntType)return zt.INT;if(t===THREE.UnsignedIntType)return zt.UNSIGNED_INT;if(t===THREE.FloatType)return zt.FLOAT;if(t===THREE.AlphaFormat)return zt.ALPHA;if(t===THREE.RGBFormat)return zt.RGB;if(t===THREE.RGBAFormat)return zt.RGBA;if(t===THREE.LuminanceFormat)return zt.LUMINANCE;if(t===THREE.LuminanceAlphaFormat)return zt.LUMINANCE_ALPHA;if(t===THREE.AddEquation)return zt.FUNC_ADD;if(t===THREE.SubtractEquation)return zt.FUNC_SUBTRACT;if(t===THREE.ReverseSubtractEquation)return zt.FUNC_REVERSE_SUBTRACT;if(t===THREE.ZeroFactor)return zt.ZERO;if(t===THREE.OneFactor)return zt.ONE;if(t===THREE.SrcColorFactor)return zt.SRC_COLOR;if(t===THREE.OneMinusSrcColorFactor)return zt.ONE_MINUS_SRC_COLOR;if(t===THREE.SrcAlphaFactor)return zt.SRC_ALPHA;if(t===THREE.OneMinusSrcAlphaFactor)return zt.ONE_MINUS_SRC_ALPHA;if(t===THREE.DstAlphaFactor)return zt.DST_ALPHA;if(t===THREE.OneMinusDstAlphaFactor)return zt.ONE_MINUS_DST_ALPHA;if(t===THREE.DstColorFactor)return zt.DST_COLOR;if(t===THREE.OneMinusDstColorFactor)return zt.ONE_MINUS_DST_COLOR;if(t===THREE.SrcAlphaSaturateFactor)return zt.SRC_ALPHA_SATURATE;if(null!==(e=rt.get("WEBGL_compressed_texture_s3tc"))){if(t===THREE.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===THREE.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(null!==(e=rt.get("WEBGL_compressed_texture_pvrtc"))){if(t===THREE.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===THREE.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===THREE.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===THREE.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(null!==(e=rt.get("EXT_blend_minmax"))){if(t===THREE.MinEquation)return e.MIN_EXT;if(t===THREE.MaxEquation)return e.MAX_EXT}return 0}this.setFaceCulling=function(t,e){t===THREE.CullFaceNone?zt.disable(zt.CULL_FACE):(e===THREE.FrontFaceDirectionCW?zt.frontFace(zt.CW):zt.frontFace(zt.CCW),t===THREE.CullFaceBack?zt.cullFace(zt.BACK):t===THREE.CullFaceFront?zt.cullFace(zt.FRONT):zt.cullFace(zt.FRONT_AND_BACK),zt.enable(zt.CULL_FACE))},this.setMaterialFaces=function(t){var e=t.side===THREE.DoubleSide,r=t.side===THREE.BackSide;c!==e&&(e?zt.disable(zt.CULL_FACE):zt.enable(zt.CULL_FACE),c=e),x!==r&&(r?zt.frontFace(zt.CW):zt.frontFace(zt.CCW),x=r)},this.setDepthTest=function(t){P!==t&&(t?zt.enable(zt.DEPTH_TEST):zt.disable(zt.DEPTH_TEST),P=t)},this.setDepthWrite=function(t){F!==t&&(zt.depthMask(t),F=t)},this.setBlending=function(t,e,r,i){t!==y&&(t===THREE.NoBlending?zt.disable(zt.BLEND):t===THREE.AdditiveBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.SRC_ALPHA,zt.ONE)):t===THREE.SubtractiveBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.ZERO,zt.ONE_MINUS_SRC_COLOR)):t===THREE.MultiplyBlending?(zt.enable(zt.BLEND),zt.blendEquation(zt.FUNC_ADD),zt.blendFunc(zt.ZERO,zt.SRC_COLOR)):t===THREE.CustomBlending?zt.enable(zt.BLEND):(zt.enable(zt.BLEND),zt.blendEquationSeparate(zt.FUNC_ADD,zt.FUNC_ADD),zt.blendFuncSeparate(zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA,zt.ONE,zt.ONE_MINUS_SRC_ALPHA)),y=t),t===THREE.CustomBlending?(e!==C&&(zt.blendEquation(ge(e)),C=e),r===D&&i===L||(zt.blendFunc(ge(r),ge(i)),D=r,L=i)):L=D=C=null},this.uploadTexture=function(t){void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",Ht),t.__webglTexture=zt.createTexture(),V.info.memory.textures++),zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture),zt.pixelStorei(zt.UNPACK_FLIP_Y_WEBGL,t.flipY),zt.pixelStorei(zt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),zt.pixelStorei(zt.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=ue(t.image,ot);var e=t.image,r=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),i=ge(t.format),n=ge(t.type);ce(zt.TEXTURE_2D,t,r);var a,o=t.mipmaps;if(t instanceof THREE.DataTexture)if(0<o.length&&r){for(var s=0,h=o.length;s<h;s++)a=o[s],zt.texImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,i,n,a.data);t.generateMipmaps=!1}else zt.texImage2D(zt.TEXTURE_2D,0,i,e.width,e.height,0,i,n,e.data);else if(t instanceof THREE.CompressedTexture)for(s=0,h=o.length;s<h;s++)a=o[s],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?-1<pt().indexOf(i)?zt.compressedTexImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,a.data):console.warn("Attempt to load unsupported compressed texture format"):zt.texImage2D(zt.TEXTURE_2D,s,i,a.width,a.height,0,i,n,a.data);else if(0<o.length&&r){for(s=0,h=o.length;s<h;s++)a=o[s],zt.texImage2D(zt.TEXTURE_2D,s,i,i,n,a);t.generateMipmaps=!1}else zt.texImage2D(zt.TEXTURE_2D,0,i,i,n,t.image);t.generateMipmaps&&r&&zt.generateMipmap(zt.TEXTURE_2D),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()},this.setTexture=function(t,e){zt.activeTexture(zt.TEXTURE0+e),t.needsUpdate?V.uploadTexture(t):zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture)},this.setRenderTarget=function(t){var e,r,i,n,a,o=t instanceof THREE.WebGLRenderTargetCube;if(t&&void 0===t.__webglFramebuffer){void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",bt),t.__webglTexture=zt.createTexture(),V.info.memory.textures++;var s=THREE.Math.isPowerOfTwo(t.width)&&THREE.Math.isPowerOfTwo(t.height),h=ge(t.format),l=ge(t.type);if(o){t.__webglFramebuffer=[],t.__webglRenderbuffer=[],zt.bindTexture(zt.TEXTURE_CUBE_MAP,t.__webglTexture),ce(zt.TEXTURE_CUBE_MAP,t,s);for(var c=0;c<6;c++)t.__webglFramebuffer[c]=zt.createFramebuffer(),t.__webglRenderbuffer[c]=zt.createRenderbuffer(),zt.texImage2D(zt.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,h,t.width,t.height,0,h,l,null),pe(t.__webglFramebuffer[c],t,zt.TEXTURE_CUBE_MAP_POSITIVE_X+c),Ee(t.__webglRenderbuffer[c],t);s&&zt.generateMipmap(zt.TEXTURE_CUBE_MAP)}else t.__webglFramebuffer=zt.createFramebuffer(),t.shareDepthFrom?t.__webglRenderbuffer=t.shareDepthFrom.__webglRenderbuffer:t.__webglRenderbuffer=zt.createRenderbuffer(),zt.bindTexture(zt.TEXTURE_2D,t.__webglTexture),ce(zt.TEXTURE_2D,t,s),zt.texImage2D(zt.TEXTURE_2D,0,h,t.width,t.height,0,h,l,null),pe(t.__webglFramebuffer,t,zt.TEXTURE_2D),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_ATTACHMENT,zt.RENDERBUFFER,t.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&zt.framebufferRenderbuffer(zt.FRAMEBUFFER,zt.DEPTH_STENCIL_ATTACHMENT,zt.RENDERBUFFER,t.__webglRenderbuffer):Ee(t.__webglRenderbuffer,t),s&&zt.generateMipmap(zt.TEXTURE_2D);o?zt.bindTexture(zt.TEXTURE_CUBE_MAP,null):zt.bindTexture(zt.TEXTURE_2D,null),zt.bindRenderbuffer(zt.RENDERBUFFER,null),zt.bindFramebuffer(zt.FRAMEBUFFER,null)}t?(e=o?t.__webglFramebuffer[t.activeCubeFace]:t.__webglFramebuffer,r=t.width,i=t.height,a=n=0):(e=null,r=I,i=G,n=k,a=O),e!==v&&(zt.bindFramebuffer(zt.FRAMEBUFFER,e),zt.viewport(n,a,r,i),v=e),W=r,X=i},this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},THREE.WebGLRenderTarget=function(t,e,r){this.width=t,this.height=e,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:THREE.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.format=void 0!==r.format?r.format:THREE.RGBAFormat,this.type=void 0!==r.type?r.type:THREE.UnsignedByteType,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.generateMipmaps=!0,this.shareDepthFrom=null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(t,e){this.width=t,this.height=e},clone:function(){var t=new THREE.WebGLRenderTarget(this.width,this.height);return t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.format=this.format,t.type=this.type,t.depthBuffer=this.depthBuffer,t.stencilBuffer=this.stencilBuffer,t.generateMipmaps=this.generateMipmaps,t.shareDepthFrom=this.shareDepthFrom,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(t,e,r){THREE.WebGLRenderTarget.call(this,t,e,r),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLExtensions=function(r){var i={};this.get=function(t){if(void 0!==i[t])return i[t];var e;switch(t){case"OES_texture_float":e=r.getExtension("OES_texture_float");break;case"OES_texture_float_linear":e=r.getExtension("OES_texture_float_linear");break;case"OES_standard_derivatives":e=r.getExtension("OES_standard_derivatives");break;case"EXT_texture_filter_anisotropic":e=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"OES_element_index_uint":e=r.getExtension("OES_element_index_uint");break;case"EXT_blend_minmax":e=r.getExtension("EXT_blend_minmax");break;case"EXT_frag_depth":e=r.getExtension("EXT_frag_depth")}return null===e&&console.log("THREE.WebGLRenderer: "+t+" extension not supported."),i[t]=e}},THREE.WebGLProgram=function(){var _=0;return function(t,e,r,i){var n=t,a=n.context,o=r.defines,s=r.__webglShader.uniforms,h=r.attributes,l=r.__webglShader.vertexShader,c=r.__webglShader.fragmentShader,u=r.index0AttributeName;void 0===u&&!0===i.morphTargets&&(u="position");var f="SHADOWMAP_TYPE_BASIC";i.shadowMapType===THREE.PCFShadowMap?f="SHADOWMAP_TYPE_PCF":i.shadowMapType===THREE.PCFSoftShadowMap&&(f="SHADOWMAP_TYPE_PCF_SOFT");var d,p,E=function(t){var e,r,i=[];for(var n in t)!1!==(e=t[n])&&(r="#define "+n+" "+e,i.push(r));return i.join("\n")}(o),m=a.createProgram();r instanceof THREE.RawShaderMaterial?p=d="":(d=["precision "+i.precision+" float;","precision "+i.precision+" int;",E,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.gammaInput?"#define GAMMA_INPUT":"",n.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals?"#define USE_MORPHNORMALS":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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;","attribute vec2 uv2;","#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",""].join("\n"),p=["precision "+i.precision+" float;","precision "+i.precision+" int;",i.bumpMap||i.normalMap?"#extension GL_OES_standard_derivatives : enable":"",E,"#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,"#define MAX_SPOT_LIGHTS "+i.maxSpotLights,"#define MAX_HEMI_LIGHTS "+i.maxHemiLights,"#define MAX_SHADOWS "+i.maxShadows,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"",n.gammaInput?"#define GAMMA_INPUT":"",n.gammaOutput?"#define GAMMA_OUTPUT":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.lightMap?"#define USE_LIGHTMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.metal?"#define METAL":"",i.wrapAround?"#define WRAP_AROUND":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",i.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var g=new THREE.WebGLShader(a,a.VERTEX_SHADER,d+l),v=new THREE.WebGLShader(a,a.FRAGMENT_SHADER,p+c);a.attachShader(m,g),a.attachShader(m,v),void 0!==u&&a.bindAttribLocation(m,0,u),a.linkProgram(m),!1===a.getProgramParameter(m,a.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."),console.error("gl.VALIDATE_STATUS",a.getProgramParameter(m,a.VALIDATE_STATUS)),console.error("gl.getError()",a.getError())),""!==a.getProgramInfoLog(m)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a.getProgramInfoLog(m)),a.deleteShader(g),a.deleteShader(v);var T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];for(var x in i.useVertexTexture?(T.push("boneTexture"),T.push("boneTextureWidth"),T.push("boneTextureHeight")):T.push("boneGlobalMatrices"),i.logarithmicDepthBuffer&&T.push("logDepthBufFC"),s)T.push(x);this.uniforms=function(t,e,r){for(var i={},n=0,a=r.length;n<a;n++){var o=r[n];i[o]=t.getUniformLocation(e,o)}return i}(a,m,T),T=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var y=0;y<i.maxMorphTargets;y++)T.push("morphTarget"+y);for(y=0;y<i.maxMorphNormals;y++)T.push("morphNormal"+y);for(var R in h)T.push(R);return this.attributes=function(t,e,r){for(var i={},n=0,a=r.length;n<a;n++){var o=r[n];i[o]=t.getAttribLocation(e,o)}return i}(a,m,T),this.attributesKeys=Object.keys(this.attributes),this.id=_++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=g,this.fragmentShader=v,this}}(),THREE.WebGLShader=function(t,e,r){var i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&(console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t.getShaderInfoLog(i)),console.warn(function(t){for(var e=t.split("\n"),r=0;r<e.length;r++)e[r]=r+1+": "+e[r];return e.join("\n")}(r))),i},THREE.LensFlarePlugin=function(v,T){var x,y,R,_,H,b,M,w,S=v.context,A=function(){var t,e,r,i,n,a,o=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),s=new Uint16Array([0,1,2,0,2,3]);x=S.createBuffer(),y=S.createBuffer(),S.bindBuffer(S.ARRAY_BUFFER,x),S.bufferData(S.ARRAY_BUFFER,o,S.STATIC_DRAW),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,y),S.bufferData(S.ELEMENT_ARRAY_BUFFER,s,S.STATIC_DRAW),M=S.createTexture(),w=S.createTexture(),S.bindTexture(S.TEXTURE_2D,M),S.texImage2D(S.TEXTURE_2D,0,S.RGB,16,16,0,S.RGB,S.UNSIGNED_BYTE,null),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MAG_FILTER,S.NEAREST),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MIN_FILTER,S.NEAREST),S.bindTexture(S.TEXTURE_2D,w),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,16,16,0,S.RGBA,S.UNSIGNED_BYTE,null),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MAG_FILTER,S.NEAREST),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MIN_FILTER,S.NEAREST),t=(b=0<S.getParameter(S.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},e=t,r=S.createProgram(),i=S.createShader(S.FRAGMENT_SHADER),n=S.createShader(S.VERTEX_SHADER),a="precision "+v.getPrecision()+" float;\n",S.shaderSource(i,a+e.fragmentShader),S.shaderSource(n,a+e.vertexShader),S.compileShader(i),S.compileShader(n),S.attachShader(r,i),S.attachShader(r,n),S.linkProgram(r),R=r,_={vertex:S.getAttribLocation(R,"position"),uv:S.getAttribLocation(R,"uv")},H={renderType:S.getUniformLocation(R,"renderType"),map:S.getUniformLocation(R,"map"),occlusionMap:S.getUniformLocation(R,"occlusionMap"),opacity:S.getUniformLocation(R,"opacity"),color:S.getUniformLocation(R,"color"),scale:S.getUniformLocation(R,"scale"),rotation:S.getUniformLocation(R,"rotation"),screenPosition:S.getUniformLocation(R,"screenPosition")}};this.render=function(t,e,r,i){if(0!==T.length){var n=new THREE.Vector3,a=i/r,o=.5*r,s=.5*i,h=16/i,l=new THREE.Vector2(h*a,h),c=new THREE.Vector3(1,1,0),u=new THREE.Vector2(1,1);void 0===R&&A(),S.useProgram(R),S.enableVertexAttribArray(_.vertex),S.enableVertexAttribArray(_.uv),S.uniform1i(H.occlusionMap,0),S.uniform1i(H.map,1),S.bindBuffer(S.ARRAY_BUFFER,x),S.vertexAttribPointer(_.vertex,2,S.FLOAT,!1,16,0),S.vertexAttribPointer(_.uv,2,S.FLOAT,!1,16,8),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,y),S.disable(S.CULL_FACE),S.depthMask(!1);for(var f=0,d=T.length;f<d;f++){h=16/i,l.set(h*a,h);var p=T[f];if(n.set(p.matrixWorld.elements[12],p.matrixWorld.elements[13],p.matrixWorld.elements[14]),n.applyMatrix4(e.matrixWorldInverse),n.applyProjection(e.projectionMatrix),c.copy(n),u.x=c.x*o+o,u.y=c.y*s+s,b||0<u.x&&u.x<r&&0<u.y&&u.y<i){S.activeTexture(S.TEXTURE1),S.bindTexture(S.TEXTURE_2D,M),S.copyTexImage2D(S.TEXTURE_2D,0,S.RGB,u.x-8,u.y-8,16,16,0),S.uniform1i(H.renderType,0),S.uniform2f(H.scale,l.x,l.y),S.uniform3f(H.screenPosition,c.x,c.y,c.z),S.disable(S.BLEND),S.enable(S.DEPTH_TEST),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0),S.activeTexture(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,w),S.copyTexImage2D(S.TEXTURE_2D,0,S.RGBA,u.x-8,u.y-8,16,16,0),S.uniform1i(H.renderType,1),S.disable(S.DEPTH_TEST),S.activeTexture(S.TEXTURE1),S.bindTexture(S.TEXTURE_2D,M),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0),p.positionScreen.copy(c),p.customUpdateCallback?p.customUpdateCallback(p):p.updateLensFlares(),S.uniform1i(H.renderType,2),S.enable(S.BLEND);for(var E=0,m=p.lensFlares.length;E<m;E++){var g=p.lensFlares[E];.001<g.opacity&&.001<g.scale&&(c.x=g.x,c.y=g.y,c.z=g.z,h=g.size*g.scale/i,l.x=h*a,l.y=h,S.uniform3f(H.screenPosition,c.x,c.y,c.z),S.uniform2f(H.scale,l.x,l.y),S.uniform1f(H.rotation,g.rotation),S.uniform1f(H.opacity,g.opacity),S.uniform3f(H.color,g.color.r,g.color.g,g.color.b),v.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst),v.setTexture(g.texture,1),S.drawElements(S.TRIANGLES,6,S.UNSIGNED_SHORT,0))}}}S.enable(S.CULL_FACE),S.enable(S.DEPTH_TEST),S.depthMask(!0),v.resetGLState()}}},THREE.ShadowMapPlugin=function(w,S,s,A){var C,D,L,P,F=w.context,U=new THREE.Frustum,B=new THREE.Matrix4,h=new THREE.Vector3,l=new THREE.Vector3,z=new THREE.Vector3,N=[],t=THREE.ShaderLib.depthRGBA,e=THREE.UniformsUtils.clone(t.uniforms);function k(t,e,r){if(e.visible){var i=s[e.id];if(i&&e.castShadow&&(!1===e.frustumCulled||!0===U.intersectsObject(e)))for(var n=0,a=i.length;n<a;n++){var o=i[n];e._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),N.push(o)}for(n=0,a=e.children.length;n<a;n++)k(t,e.children[n],r)}}function V(t,e){var r=new THREE.DirectionalLight;r.isVirtual=!0,r.onlyShadow=!0,r.castShadow=!0,r.shadowCameraNear=t.shadowCameraNear,r.shadowCameraFar=t.shadowCameraFar,r.shadowCameraLeft=t.shadowCameraLeft,r.shadowCameraRight=t.shadowCameraRight,r.shadowCameraBottom=t.shadowCameraBottom,r.shadowCameraTop=t.shadowCameraTop,r.shadowCameraVisible=t.shadowCameraVisible,r.shadowDarkness=t.shadowDarkness,r.shadowBias=t.shadowCascadeBias[e],r.shadowMapWidth=t.shadowCascadeWidth[e],r.shadowMapHeight=t.shadowCascadeHeight[e],r.pointsWorld=[],r.pointsFrustum=[];for(var i=r.pointsWorld,n=r.pointsFrustum,a=0;a<8;a++)i[a]=new THREE.Vector3,n[a]=new THREE.Vector3;var o=t.shadowCascadeNearZ[e],s=t.shadowCascadeFarZ[e];return n[0].set(-1,-1,o),n[1].set(1,-1,o),n[2].set(-1,1,o),n[3].set(1,1,o),n[4].set(-1,-1,s),n[5].set(1,-1,s),n[6].set(-1,1,s),n[7].set(1,1,s),r}function O(t,e){var r=t.shadowCascadeArray[e];r.position.copy(t.position),r.target.position.copy(t.target.position),r.lookAt(r.target),r.shadowCameraVisible=t.shadowCameraVisible,r.shadowDarkness=t.shadowDarkness,r.shadowBias=t.shadowCascadeBias[e];var i=t.shadowCascadeNearZ[e],n=t.shadowCascadeFarZ[e],a=r.pointsFrustum;a[0].z=i,a[1].z=i,a[2].z=i,a[3].z=i,a[4].z=n,a[5].z=n,a[6].z=n,a[7].z=n}function I(t,e){var r=e.shadowCamera,i=e.pointsFrustum,n=e.pointsWorld;h.set(1/0,1/0,1/0),l.set(-1/0,-1/0,-1/0);for(var a=0;a<8;a++){var o=n[a];o.copy(i[a]),o.unproject(t),o.applyMatrix4(r.matrixWorldInverse),o.x<h.x&&(h.x=o.x),o.x>l.x&&(l.x=o.x),o.y<h.y&&(h.y=o.y),o.y>l.y&&(l.y=o.y),o.z<h.z&&(h.z=o.z),o.z>l.z&&(l.z=o.z)}r.left=h.x,r.right=l.x,r.top=l.y,r.bottom=h.y,r.updateProjectionMatrix()}C=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),D=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0}),L=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,skinning:!0}),P=new THREE.ShaderMaterial({uniforms:e,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,morphTargets:!0,skinning:!0}),C._shadowPass=!0,D._shadowPass=!0,L._shadowPass=!0,P._shadowPass=!0,this.render=function(t,e){if(!1!==w.shadowMapEnabled){var r,i,n,a,o,s,h,l,c,u,f,d,p,E,m=[],g=0;for(F.clearColor(1,1,1,1),F.disable(F.BLEND),F.enable(F.CULL_FACE),F.frontFace(F.CCW),w.shadowMapCullFace===THREE.CullFaceFront?F.cullFace(F.FRONT):F.cullFace(F.BACK),w.setDepthTest(!0),r=0,i=S.length;r<i;r++)if((p=S[r]).castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(o=0;o<p.shadowCascadeCount;o++){var v;if(p.shadowCascadeArray[o])v=p.shadowCascadeArray[o];else{(v=V(p,o)).originalCamera=e;var T=new THREE.Gyroscope;T.position.copy(p.shadowCascadeOffset),T.add(v),T.add(v.target),e.add(T),p.shadowCascadeArray[o]=v,console.log("Created virtualLight",v)}O(p,o),m[g]=v,g++}else m[g]=p,g++;for(r=0,i=m.length;r<i;r++){if(!(p=m[r]).shadowMap){var x=THREE.LinearFilter;w.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter);var y={minFilter:x,magFilter:x,format:THREE.RGBAFormat};p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,y),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else{if(!(p instanceof THREE.DirectionalLight)){console.error("Unsupported light type for shadow");continue}p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar)}t.add(p.shadowCamera),!0===t.autoUpdate&&t.updateMatrixWorld()}var R,_,H;for(p.shadowCameraVisible&&!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),t.add(p.cameraHelper)),p.isVirtual&&v.originalCamera==e&&I(e,p),s=p.shadowMap,h=p.shadowMatrix,(l=p.shadowCamera).position.setFromMatrixPosition(p.matrixWorld),z.setFromMatrixPosition(p.target.matrixWorld),l.lookAt(z),l.updateMatrixWorld(),l.matrixWorldInverse.getInverse(l.matrixWorld),p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible),p.shadowCameraVisible&&p.cameraHelper.update(),h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(l.projectionMatrix),h.multiply(l.matrixWorldInverse),B.multiplyMatrices(l.projectionMatrix,l.matrixWorldInverse),U.setFromMatrix(B),w.setRenderTarget(s),w.clear(),N.length=0,k(t,t,l),n=0,a=N.length;n<a;n++)d=(f=N[n]).object,c=f.buffer,R=(E=d).material instanceof THREE.MeshFaceMaterial?E.material.materials[0]:E.material,_=void 0!==d.geometry.morphTargets&&0<d.geometry.morphTargets.length&&R.morphTargets,H=d instanceof THREE.SkinnedMesh&&R.skinning,u=d.customDepthMaterial?d.customDepthMaterial:H?_?P:L:_?D:C,w.setMaterialFaces(R),c instanceof THREE.BufferGeometry?w.renderBufferDirect(l,S,null,u,c,d):w.renderBuffer(l,S,null,u,c,d);for(n=0,a=A.length;n<a;n++)(d=(f=A[n]).object).visible&&d.castShadow&&(d._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,d.matrixWorld),w.renderImmediateObject(l,S,null,C,d))}var b=w.getClearColor(),M=w.getClearAlpha();F.clearColor(b.r,b.g,b.b,M),F.enable(F.BLEND),w.shadowMapCullFace===THREE.CullFaceFront&&F.cullFace(F.BACK),w.resetGLState()}}},THREE.SpritePlugin=function(u,f){var d,p,E,m,g,v,T=u.context,x=function(){var t,e,r,i=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);d=T.createBuffer(),p=T.createBuffer(),T.bindBuffer(T.ARRAY_BUFFER,d),T.bufferData(T.ARRAY_BUFFER,i,T.STATIC_DRAW),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,p),T.bufferData(T.ELEMENT_ARRAY_BUFFER,n,T.STATIC_DRAW),t=T.createProgram(),e=T.createShader(T.VERTEX_SHADER),r=T.createShader(T.FRAGMENT_SHADER),T.shaderSource(e,["precision "+u.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),T.shaderSource(r,["precision "+u.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),T.compileShader(e),T.compileShader(r),T.attachShader(t,e),T.attachShader(t,r),T.linkProgram(t),E=t,m={position:T.getAttribLocation(E,"position"),uv:T.getAttribLocation(E,"uv")},g={uvOffset:T.getUniformLocation(E,"uvOffset"),uvScale:T.getUniformLocation(E,"uvScale"),rotation:T.getUniformLocation(E,"rotation"),scale:T.getUniformLocation(E,"scale"),color:T.getUniformLocation(E,"color"),map:T.getUniformLocation(E,"map"),opacity:T.getUniformLocation(E,"opacity"),modelViewMatrix:T.getUniformLocation(E,"modelViewMatrix"),projectionMatrix:T.getUniformLocation(E,"projectionMatrix"),fogType:T.getUniformLocation(E,"fogType"),fogDensity:T.getUniformLocation(E,"fogDensity"),fogNear:T.getUniformLocation(E,"fogNear"),fogFar:T.getUniformLocation(E,"fogFar"),fogColor:T.getUniformLocation(E,"fogColor"),alphaTest:T.getUniformLocation(E,"alphaTest")};var a=document.createElement("canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(v=new THREE.Texture(a)).needsUpdate=!0};function y(t,e){return t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(t,e){if(0!==f.length){void 0===E&&x(),T.useProgram(E),T.enableVertexAttribArray(m.position),T.enableVertexAttribArray(m.uv),T.disable(T.CULL_FACE),T.enable(T.BLEND),T.bindBuffer(T.ARRAY_BUFFER,d),T.vertexAttribPointer(m.position,2,T.FLOAT,!1,16,0),T.vertexAttribPointer(m.uv,2,T.FLOAT,!1,16,8),T.bindBuffer(T.ELEMENT_ARRAY_BUFFER,p),T.uniformMatrix4fv(g.projectionMatrix,!1,e.projectionMatrix.elements),T.activeTexture(T.TEXTURE0),T.uniform1i(g.map,0);var r=0,i=0,n=t.fog;n?(T.uniform3f(g.fogColor,n.color.r,n.color.g,n.color.b),n instanceof THREE.Fog?(T.uniform1f(g.fogNear,n.near),T.uniform1f(g.fogFar,n.far),T.uniform1i(g.fogType,1),i=r=1):n instanceof THREE.FogExp2&&(T.uniform1f(g.fogDensity,n.density),T.uniform1i(g.fogType,2),i=r=2)):(T.uniform1i(g.fogType,0),i=r=0);for(var a=0,o=f.length;a<o;a++){(h=f[a])._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,h.matrixWorld),null===h.renderDepth?h.z=-h._modelViewMatrix.elements[14]:h.z=h.renderDepth}f.sort(y);var s=[];for(a=0,o=f.length;a<o;a++){var h,l=(h=f[a]).material;T.uniform1f(g.alphaTest,l.alphaTest),T.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrix.elements),s[0]=h.scale.x,s[1]=h.scale.y;var c=0;t.fog&&l.fog&&(c=i),r!==c&&(T.uniform1i(g.fogType,c),r=c),null!==l.map?(T.uniform2f(g.uvOffset,l.map.offset.x,l.map.offset.y),T.uniform2f(g.uvScale,l.map.repeat.x,l.map.repeat.y)):(T.uniform2f(g.uvOffset,0,0),T.uniform2f(g.uvScale,1,1)),T.uniform1f(g.opacity,l.opacity),T.uniform3f(g.color,l.color.r,l.color.g,l.color.b),T.uniform1f(g.rotation,l.rotation),T.uniform2fv(g.scale,s),u.setBlending(l.blending,l.blendEquation,l.blendSrc,l.blendDst),u.setDepthTest(l.depthTest),u.setDepthWrite(l.depthWrite),l.map&&l.map.image&&l.map.image.width?u.setTexture(l.map,0):u.setTexture(v,0),T.drawElements(T.TRIANGLES,6,T.UNSIGNED_SHORT,0)}T.enable(T.CULL_FACE),u.resetGLState()}}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,r,i){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var a=new THREE.Texture(void 0,e);return n.load(t,function(t){a.image=t,a.needsUpdate=!0,r&&r(a)},void 0,function(t){i&&i(t)}),a.sourceFile=t,a},loadTextureCube:function(t,e,r,i){var n=new THREE.ImageLoader;n.crossOrigin=this.crossOrigin;var a=new THREE.CubeTexture([],e);a.flipY=!1;for(var o=0,s=function(e){n.load(t[e],function(t){a.images[e]=t,6===(o+=1)&&(a.needsUpdate=!0,r&&r(a))})},h=0,l=t.length;h<l;++h)s(h);return a},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.")},getNormalMap:function(t,e){var r=function(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]};e|=1;var i=t.width,n=t.height,a=document.createElement("canvas");a.width=i,a.height=n;var o=a.getContext("2d");o.drawImage(t,0,0);for(var s,h,l,c,u=o.getImageData(0,0,i,n).data,f=o.createImageData(i,n),d=f.data,p=0;p<i;p++)for(var E=0;E<n;E++){var m=E-1<0?0:E-1,g=n-1<E+1?n-1:E+1,v=p-1<0?0:p-1,T=i-1<p+1?i-1:p+1,x=[],y=[0,0,u[4*(E*i+p)]/255*e];x.push([-1,0,u[4*(E*i+v)]/255*e]),x.push([-1,-1,u[4*(m*i+v)]/255*e]),x.push([0,-1,u[4*(m*i+p)]/255*e]),x.push([1,-1,u[4*(m*i+T)]/255*e]),x.push([1,0,u[4*(E*i+T)]/255*e]),x.push([1,1,u[4*(g*i+T)]/255*e]),x.push([0,1,u[4*(g*i+p)]/255*e]),x.push([-1,1,u[4*(g*i+v)]/255*e]);for(var R=[],_=x.length,H=0;H<_;H++){var b=x[H],M=x[(H+1)%_];b=r(b,y),M=r(M,y),R.push((c=M,s=[(l=b)[1]*c[2]-l[2]*c[1],l[2]*c[0]-l[0]*c[2],l[0]*c[1]-l[1]*c[0]],void 0,h=Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]),[s[0]/h,s[1]/h,s[2]/h]))}var w=[0,0,0];for(H=0;H<R.length;H++)w[0]+=R[H][0],w[1]+=R[H][1],w[2]+=R[H][2];w[0]/=R.length,w[1]/=R.length,w[2]/=R.length;var S=4*(E*i+p);d[S]=(w[0]+1)/2*255|0,d[S+1]=(w[1]+1)/2*255|0,d[S+2]=255*w[2]|0,d[S+3]=255}return o.putImageData(f,0,0),a},generateDataTexture:function(t,e,r){for(var i=t*e,n=new Uint8Array(3*i),a=Math.floor(255*r.r),o=Math.floor(255*r.g),s=Math.floor(255*r.b),h=0;h<i;h++)n[3*h]=a,n[3*h+1]=o,n[3*h+2]=s;var l=new THREE.DataTexture(n,t,e,THREE.RGBFormat);return l.needsUpdate=!0,l}},THREE.SphereGeometry=function(t,e,r,i,n,a,o){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},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,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,h,l=[],c=[];for(h=0;h<=r;h++){var u=[],f=[];for(s=0;s<=e;s++){var d=s/e,p=h/r,E=new THREE.Vector3;E.x=-t*Math.cos(i+d*n)*Math.sin(a+p*o),E.y=t*Math.cos(a+p*o),E.z=t*Math.sin(i+d*n)*Math.sin(a+p*o),this.vertices.push(E),u.push(this.vertices.length-1),f.push(new THREE.Vector2(d,1-p))}l.push(u),c.push(f)}for(h=0;h<r;h++)for(s=0;s<e;s++){var m=l[h][s+1],g=l[h][s],v=l[h+1][s],T=l[h+1][s+1],x=this.vertices[m].clone().normalize(),y=this.vertices[g].clone().normalize(),R=this.vertices[v].clone().normalize(),_=this.vertices[T].clone().normalize(),H=c[h][s+1].clone(),b=c[h][s].clone(),M=c[h+1][s].clone(),w=c[h+1][s+1].clone();Math.abs(this.vertices[m].y)===t?(H.x=(H.x+b.x)/2,this.faces.push(new THREE.Face3(m,v,T,[x,R,_])),this.faceVertexUvs[0].push([H,M,w])):Math.abs(this.vertices[v].y)===t?(M.x=(M.x+w.x)/2,this.faces.push(new THREE.Face3(m,g,v,[x,y,R])),this.faceVertexUvs[0].push([H,b,M])):(this.faces.push(new THREE.Face3(m,g,T,[x,y,_])),this.faceVertexUvs[0].push([H,b,w]),this.faces.push(new THREE.Face3(g,v,T,[y.clone(),R,_.clone()])),this.faceVertexUvs[0].push([b.clone(),M,w.clone()]))}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 6.9.12
6
- Stable tag: 6.9.11
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
140
  = 6.9.12 =
141
 
142
  * This version addresses various minor bug fixes and performance improvements.
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 6.9.13
6
+ Stable tag: 6.9.12
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
137
 
138
  == Upgrade Notice ==
139
 
140
+ = 6.9.13 =
141
+
142
+ * Security release.
143
+
144
  = 6.9.12 =
145
 
146
  * This version addresses various minor bug fixes and performance improvements.
wppa-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
- * Version 6.9.12
7
  *
8
  */
9
 
@@ -133,6 +133,7 @@ function wppa_edit_photo() {
133
  function wppa_page_import() {
134
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Importing is temporary disabled for you' , 'wp-photo-album-plus') );
135
  wppa_grant_albums();
 
136
  require_once 'wppa-import.php';
137
  echo '<script type="text/javascript" >/* <![CDATA[ */wppa_import = "'.__('Import', 'wp-photo-album-plus').'"; wppa_update = "'.__('Update', 'wp-photo-album-plus').'";/* ]]> */</script>';
138
  _wppa_page_import();
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 6.9.13
7
  *
8
  */
9
 
133
  function wppa_page_import() {
134
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Importing is temporary disabled for you' , 'wp-photo-album-plus') );
135
  wppa_grant_albums();
136
+ wppa_rename_files_sanitized( WPPA_DEPOT_PATH );
137
  require_once 'wppa-import.php';
138
  echo '<script type="text/javascript" >/* <![CDATA[ */wppa_import = "'.__('Import', 'wp-photo-album-plus').'"; wppa_update = "'.__('Update', 'wp-photo-album-plus').'";/* ]]> */</script>';
139
  _wppa_page_import();
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 6.9.07
6
  *
7
  */
8
 
@@ -2147,7 +2147,7 @@ global $wppa_log_file;
2147
  $filename = wppa_get_photo_item( $photo, 'filename' );
2148
  // If very old, no filename, take new name
2149
  if ( ! $filename ) {
2150
- $filename = $_FILES['photo']['name'];
2151
  wppa_update_photo( array( 'id' => $photo, 'filename' => $filename ) );
2152
  }
2153
  wppa_save_source( $_FILES['photo']['tmp_name'], $filename, wppa_get_photo_item( $photo, 'album') );
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 6.9.13
6
  *
7
  */
8
 
2147
  $filename = wppa_get_photo_item( $photo, 'filename' );
2148
  // If very old, no filename, take new name
2149
  if ( ! $filename ) {
2150
+ $filename = wppa_sima( $_FILES['photo']['name'] );
2151
  wppa_update_photo( array( 'id' => $photo, 'filename' => $filename ) );
2152
  }
2153
  wppa_save_source( $_FILES['photo']['tmp_name'], $filename, wppa_get_photo_item( $photo, 'album') );
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 6.9.05
7
  *
8
  */
9
 
@@ -24,7 +24,6 @@ global $wppa_session;
24
  wppa_dbg_msg( 'Lang=' . $wppa_lang . ', Locale=' . $wppa_locale . ', Ajax=' . wppa( 'ajax' ) );
25
  wppa_dbg_msg( 'Get=' . serialize($_GET) );
26
  wppa_dbg_msg( 'Post=' . serialize($_POST) );
27
- // wppa_dbg_msg( '$wppa_session = ' . serialize( $wppa_session ) );
28
 
29
  // List content filters
30
  // Data struct: $wp_filter[$tag]->callbacks[$priority][$idx] = array( 'function' => $function_to_add, 'accepted_args' => $accepted_args );
@@ -3956,15 +3955,15 @@ function wppa_force_balance_pee( $xtext ) {
3956
  function wppa_smx_photo( $stype ) {
3957
 
3958
  $id = wppa( 'single_photo' );
3959
-
3960
  // Photo known?
3961
  if ( ! $id ) {
3962
  wppa_log( 'Err', 'Unknown photo id in wppa_smx_photo()', true );
3963
- return;
3964
  }
3965
-
3966
  $width = wppa_get_container_width();
3967
-
3968
  if ( wppa_is_video( $id ) ) {
3969
  $py = wppa_get_videoy( $id );
3970
  $px = wppa_get_videox( $id );
@@ -3977,8 +3976,8 @@ function wppa_smx_photo( $stype ) {
3977
  wppa_log( 'Err', 'Unknown size of item nr ' . $id . ' in wppa_smx_photo()', true );
3978
  return;
3979
  }
3980
-
3981
- $height = round( $width * $py / $px );
3982
  $style = wppa_get_container_style();
3983
 
3984
  // wrapper for maximized auto
@@ -4417,7 +4416,7 @@ global $wppa_upload_succes_id;
4417
  if ( $iret ) {
4418
  $f['error'] = $file['error'][$i];
4419
  $f['tmp_name'] = $file['tmp_name'][$i];
4420
- $f['name'] = $file['name'][$i];
4421
  $f['type'] = $file['type'][$i];
4422
  $f['size'] = $file['size'][$i];
4423
  $iret = wppa_do_frontend_file_upload( $f, $alb );
@@ -4610,7 +4609,7 @@ global $wppa_supported_audio_extensions;
4610
  global $wppa_alert;
4611
 
4612
  // Log upload attempt
4613
- wppa_log( 'Upl', 'FE Upload attempt of file ' . $file['name'] . ', size=' . filesize( $file['tmp_name'] ) );
4614
 
4615
  $album = wppa_cache_album( $alb );
4616
 
@@ -4656,7 +4655,7 @@ global $wppa_alert;
4656
  $name = wppa_get_post( 'user-name' );
4657
  }
4658
  else {
4659
- $name = $file['name'];
4660
  }
4661
  $name = wppa_sanitize_photo_name( $name );
4662
 
@@ -4697,7 +4696,7 @@ global $wppa_alert;
4697
 
4698
  // Repair name if not standard
4699
  if ( ! wppa_get_post( 'user-name' ) ) {
4700
- wppa_set_default_name( $id, $file['name'] );
4701
  }
4702
 
4703
  // tags
@@ -4780,7 +4779,7 @@ global $wppa_alert;
4780
  $name = wppa_get_post( 'user-name' );
4781
  }
4782
  else {
4783
- $name = $file['name'];
4784
  }
4785
 
4786
  // Sanitize input
@@ -4833,7 +4832,7 @@ global $wppa_alert;
4833
 
4834
  // Repair photoname if not standard
4835
  if ( ! wppa_get_post( 'user-name' ) ) {
4836
- wppa_set_default_name( $id, $file['name'] );
4837
  }
4838
 
4839
  // Custom data
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 6.9.13
7
  *
8
  */
9
 
24
  wppa_dbg_msg( 'Lang=' . $wppa_lang . ', Locale=' . $wppa_locale . ', Ajax=' . wppa( 'ajax' ) );
25
  wppa_dbg_msg( 'Get=' . serialize($_GET) );
26
  wppa_dbg_msg( 'Post=' . serialize($_POST) );
 
27
 
28
  // List content filters
29
  // Data struct: $wp_filter[$tag]->callbacks[$priority][$idx] = array( 'function' => $function_to_add, 'accepted_args' => $accepted_args );
3955
  function wppa_smx_photo( $stype ) {
3956
 
3957
  $id = wppa( 'single_photo' );
3958
+
3959
  // Photo known?
3960
  if ( ! $id ) {
3961
  wppa_log( 'Err', 'Unknown photo id in wppa_smx_photo()', true );
3962
+ return;
3963
  }
3964
+
3965
  $width = wppa_get_container_width();
3966
+
3967
  if ( wppa_is_video( $id ) ) {
3968
  $py = wppa_get_videoy( $id );
3969
  $px = wppa_get_videox( $id );
3976
  wppa_log( 'Err', 'Unknown size of item nr ' . $id . ' in wppa_smx_photo()', true );
3977
  return;
3978
  }
3979
+
3980
+ $height = round( $width * $py / $px );
3981
  $style = wppa_get_container_style();
3982
 
3983
  // wrapper for maximized auto
4416
  if ( $iret ) {
4417
  $f['error'] = $file['error'][$i];
4418
  $f['tmp_name'] = $file['tmp_name'][$i];
4419
+ $f['name'] = wppa_sima( $file['name'][$i] );
4420
  $f['type'] = $file['type'][$i];
4421
  $f['size'] = $file['size'][$i];
4422
  $iret = wppa_do_frontend_file_upload( $f, $alb );
4609
  global $wppa_alert;
4610
 
4611
  // Log upload attempt
4612
+ wppa_log( 'Upl', 'FE Upload attempt of file ' . wppa_sima( $file['name'] ) . ', size=' . filesize( $file['tmp_name'] ) );
4613
 
4614
  $album = wppa_cache_album( $alb );
4615
 
4655
  $name = wppa_get_post( 'user-name' );
4656
  }
4657
  else {
4658
+ $name = wppa_sima( $file['name'] );
4659
  }
4660
  $name = wppa_sanitize_photo_name( $name );
4661
 
4696
 
4697
  // Repair name if not standard
4698
  if ( ! wppa_get_post( 'user-name' ) ) {
4699
+ wppa_set_default_name( $id, wppa_sima( $file['name'] ) );
4700
  }
4701
 
4702
  // tags
4779
  $name = wppa_get_post( 'user-name' );
4780
  }
4781
  else {
4782
+ $name = wppa_sima( $file['name'] );
4783
  }
4784
 
4785
  // Sanitize input
4832
 
4833
  // Repair photoname if not standard
4834
  if ( ! wppa_get_post( 'user-name' ) ) {
4835
+ wppa_set_default_name( $id, wppa_sima( $file['name'] ) );
4836
  }
4837
 
4838
  // Custom data
wppa-import.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
- * Version 6.8.09
7
  *
8
  */
9
 
@@ -127,7 +127,7 @@ global $wppa_session;
127
  if ( isset( $_POST['wppa-import-submit'] ) ) {
128
  if ( wppa( 'ajax' ) ) {
129
  if ( ! wp_verify_nonce( $_POST['wppa-update-check'], '$wppa_nonce' ) ) {
130
- echo $_POST['wppa-update-check'].' Security check failure';
131
  wppa_exit();
132
  }
133
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 6.8.13
7
  *
8
  */
9
 
127
  if ( isset( $_POST['wppa-import-submit'] ) ) {
128
  if ( wppa( 'ajax' ) ) {
129
  if ( ! wp_verify_nonce( $_POST['wppa-update-check'], '$wppa_nonce' ) ) {
130
+ echo 'Security check failure';
131
  wppa_exit();
132
  }
133
  }
wppa-local-cdn.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains routines for local cdn implementation
6
- * Version 6.9.04
7
  *
8
  */
9
 
@@ -57,7 +57,7 @@ function wppa_cdn_make( $id, $x, $y ) {
57
  $quality = '-quality ' . $q;
58
  }
59
 
60
- $err = wppa_image_magick( 'convert "' . $fmpath . '" ' . $quality . ' -resize ' . $x . 'x' . $y . ' ' . $topath );
61
 
62
  // Log what we did
63
  if ( $err ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains routines for local cdn implementation
6
+ * Version 6.9.13
7
  *
8
  */
9
 
57
  $quality = '-quality ' . $q;
58
  }
59
 
60
+ $err = wppa_image_magick( 'convert ' . $fmpath . ' ' . $quality . ' -resize ' . $x . 'x' . $y . ' ' . $topath );
61
 
62
  // Log what we did
63
  if ( $err ) {
wppa-photo-files.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
- * Version 6.9.07
6
  *
7
  */
8
 
@@ -36,7 +36,7 @@ function wppa_make_o1_source( $id ) {
36
 
37
  // ImageMagick
38
  if ( wppa_opt( 'image_magick' ) ) {
39
- wppa_image_magick( 'convert "' . $src_path . '" -auto-orient "' . $dst_path . '"' );
40
  }
41
 
42
  // Classic
@@ -192,7 +192,10 @@ global $wpdb;
192
  $quality = '-quality ' . $q;
193
  }
194
 
195
- wppa_image_magick( 'convert "' . $file . '" ' . $quality . ' -resize ' . ( $thumb['stereo'] ? 2 * $max_width : $max_width ) . 'x' . $max_height . ' ' . $newimage );
 
 
 
196
  }
197
 
198
  // Classic GD
@@ -466,7 +469,10 @@ function wppa_create_thumbnail( $id, $use_source = true ) {
466
 
467
  // Image Magick?
468
  if ( wppa_opt( 'image_magick' ) && $type == 'none' ) {
469
- wppa_image_magick( 'convert "' . $file . '" -thumbnail ' . $max_side . 'x' . $max_side . ' ' . $thumbpath );
 
 
 
470
  }
471
 
472
  // Classic GD
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
+ * Version 6.9.13
6
  *
7
  */
8
 
36
 
37
  // ImageMagick
38
  if ( wppa_opt( 'image_magick' ) ) {
39
+ wppa_image_magick( 'convert ' . $src_path . ' -auto-orient ' . $dst_path );
40
  }
41
 
42
  // Classic
192
  $quality = '-quality ' . $q;
193
  }
194
 
195
+ $iret = wppa_image_magick( 'convert ' . $file . ' ' . $quality . ' -resize ' . ( $thumb['stereo'] ? 2 * $max_width : $max_width ) . 'x' . $max_height . ' ' . $newimage );
196
+ if ( $iret ) {
197
+ wppa_log( 'fso', 'Magick could not create ' . $newimage );
198
+ }
199
  }
200
 
201
  // Classic GD
469
 
470
  // Image Magick?
471
  if ( wppa_opt( 'image_magick' ) && $type == 'none' ) {
472
+ $iret = wppa_image_magick( 'convert ' . $file . ' -thumbnail ' . $max_side . 'x' . $max_side . ' ' . $thumbpath );
473
+ if ( $iret ) {
474
+ wppa_log( 'fso', 'Magick could not create ' . $thumbpath );
475
+ }
476
  }
477
 
478
  // Classic GD
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 6.9.12
7
  *
8
  */
9
 
@@ -136,11 +136,11 @@ echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\
136
  else {
137
  $imgsize = getimagesize($file['tmp_name']);
138
  if ( !is_array($imgsize) || !isset($imgsize[2]) || $imgsize[2] != 3 ) {
139
- wppa_error_message(sprintf(__('Uploaded file %s is not a .png file', 'wp-photo-album-plus'), $file['name']).' (Type='.$file['type'].').');
140
  }
141
  else {
142
- copy($file['tmp_name'], WPPA_UPLOAD_PATH . '/watermarks/' . basename($file['name']));
143
- wppa_alert(sprintf(__('Upload of %s done', 'wp-photo-album-plus'), basename($file['name'])));
144
  }
145
  }
146
  }
@@ -156,12 +156,12 @@ echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\
156
  wppa_error_message(sprintf(__('Upload error %s', 'wp-photo-album-plus'), $file['error']));
157
  }
158
  else {
159
- if ( substr($file['name'], -4) != '.ttf' ) {
160
- wppa_error_message(sprintf(__('Uploaded file %s is not a .ttf file', 'wp-photo-album-plus'), $file['name']).' (Type='.$file['type'].').');
161
  }
162
  else {
163
- copy($file['tmp_name'], WPPA_UPLOAD_PATH . '/fonts/' . basename($file['name']));
164
- wppa_alert(sprintf(__('Upload of %s done', 'wp-photo-album-plus'), basename($file['name'])));
165
  }
166
  }
167
  }
@@ -179,7 +179,7 @@ echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\
179
  else {
180
  $imgsize = getimagesize($file['tmp_name']);
181
  if ( ! is_array( $imgsize ) || ! isset( $imgsize[2] ) || $imgsize[2] < 1 || $imgsize[2] > 3 ) {
182
- wppa_error_message(sprintf(__('Uploaded file %s is not a valid image file', 'wp-photo-album-plus'), $file['name']).' (Type='.$file['type'].').');
183
  }
184
  else {
185
  switch ( $imgsize[2] ) {
@@ -198,7 +198,7 @@ echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\
198
 
199
  // Thumbx, thumby, phtox and photoy must be cleared for the new stub
200
  $wpdb->query( "UPDATE `" . WPPA_PHOTOS ."` SET `thumbx` = 0, `thumby` = 0, `photox` = 0, `photoy` = 0 WHERE `ext` = 'xxx'" );
201
- wppa_alert( sprintf( __( 'Upload of %s done', 'wp-photo-album-plus'), basename( $file['name'] ) ) );
202
  }
203
  }
204
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 6.9.13
7
  *
8
  */
9
 
136
  else {
137
  $imgsize = getimagesize($file['tmp_name']);
138
  if ( !is_array($imgsize) || !isset($imgsize[2]) || $imgsize[2] != 3 ) {
139
+ wppa_error_message(sprintf(__('Uploaded file %s is not a .png file', 'wp-photo-album-plus'), wppa_sima( $file['name'] ) ) . ' (Type='.$file['type'].').');
140
  }
141
  else {
142
+ copy($file['tmp_name'], WPPA_UPLOAD_PATH . '/watermarks/' . wppa_sima(basename($file['name'])));
143
+ wppa_alert(sprintf(__('Upload of %s done', 'wp-photo-album-plus'), wppa_sima(basename($file['name']))));
144
  }
145
  }
146
  }
156
  wppa_error_message(sprintf(__('Upload error %s', 'wp-photo-album-plus'), $file['error']));
157
  }
158
  else {
159
+ if ( substr(wppa_sima($file['name']), -4) != '.ttf' ) {
160
+ wppa_error_message(sprintf(__('Uploaded file %s is not a .ttf file', 'wp-photo-album-plus'), wppa_sima($file['name']) ).' (Type='.$file['type'].').');
161
  }
162
  else {
163
+ copy($file['tmp_name'], WPPA_UPLOAD_PATH . '/fonts/' . wppa_sima(basename($file['name'])));
164
+ wppa_alert(sprintf(__('Upload of %s done', 'wp-photo-album-plus'), wppa_sima(basename($file['name']))));
165
  }
166
  }
167
  }
179
  else {
180
  $imgsize = getimagesize($file['tmp_name']);
181
  if ( ! is_array( $imgsize ) || ! isset( $imgsize[2] ) || $imgsize[2] < 1 || $imgsize[2] > 3 ) {
182
+ wppa_error_message(sprintf(__('Uploaded file %s is not a valid image file', 'wp-photo-album-plus'), wppa_sima($file['name'])).' (Type='.$file['type'].').');
183
  }
184
  else {
185
  switch ( $imgsize[2] ) {
198
 
199
  // Thumbx, thumby, phtox and photoy must be cleared for the new stub
200
  $wpdb->query( "UPDATE `" . WPPA_PHOTOS ."` SET `thumbx` = 0, `thumby` = 0, `photox` = 0, `photoy` = 0 WHERE `ext` = 'xxx'" );
201
+ wppa_alert( sprintf( __( 'Upload of %s done', 'wp-photo-album-plus'), basename( wppa_sima( $file['name'] ) ) ) );
202
  }
203
  }
204
  }
wppa-upload.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
- * Version 6.8.09
7
  *
8
  */
9
 
@@ -562,15 +562,15 @@ global $upload_album;
562
  }
563
  if ( ! $file['error'][$i] ) {
564
  wppa_pdf_preprocess( $file, $upload_album, $i );
565
- $id = wppa_insert_photo( $file['tmp_name'][$i], $upload_album, $file['name'][$i] );
566
  if ( $id ) {
567
  $uploaded_a_file = true;
568
  $count++;
569
  wppa_pdf_postprocess( $id );
570
- wppa_backend_upload_mail( $id, $upload_album, $file['name'][$i] );
571
  }
572
  else {
573
- wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'][$i] ) ) . '.' );
574
  return;
575
  }
576
  }
@@ -598,12 +598,12 @@ global $upload_album;
598
  foreach ( $_FILES as $file ) {
599
  if ( $file['tmp_name'] != '' ) {
600
  wppa_pdf_preprocess( $file, $upload_album );
601
- $id = wppa_insert_photo( $file['tmp_name'], $upload_album, $file['name'] );
602
  if ( $id ) {
603
  $uploaded_a_file = true;
604
  $count++;
605
  wppa_pdf_postprocess( $id );
606
- wppa_backend_upload_mail( $id, $upload_album, $file['name'] );
607
  }
608
  else {
609
  wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
+ * Version 6.8.13
7
  *
8
  */
9
 
562
  }
563
  if ( ! $file['error'][$i] ) {
564
  wppa_pdf_preprocess( $file, $upload_album, $i );
565
+ $id = wppa_insert_photo( $file['tmp_name'][$i], $upload_album, wppa_sima($file['name'][$i]) );
566
  if ( $id ) {
567
  $uploaded_a_file = true;
568
  $count++;
569
  wppa_pdf_postprocess( $id );
570
+ wppa_backend_upload_mail( $id, $upload_album, wppa_sima($file['name'][$i]) );
571
  }
572
  else {
573
+ wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( wppa_sima( basename( $file['name'][$i] ) ) ) . '.' );
574
  return;
575
  }
576
  }
598
  foreach ( $_FILES as $file ) {
599
  if ( $file['tmp_name'] != '' ) {
600
  wppa_pdf_preprocess( $file, $upload_album );
601
+ $id = wppa_insert_photo( $file['tmp_name'], $upload_album, wppa_sima( $file['name'] ) );
602
  if ( $id ) {
603
  $uploaded_a_file = true;
604
  $count++;
605
  wppa_pdf_postprocess( $id );
606
+ wppa_backend_upload_mail( $id, $upload_album, wppa_sima( $file['name'] ) );
607
  }
608
  else {
609
  wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.' );
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 6.9.07
7
  *
8
  */
9
 
@@ -2562,7 +2562,7 @@ function wppa_force_numeric_else( $value, $default ) {
2562
  function wppa_sanitize_file_name( $file, $check_length = true ) {
2563
  $temp = explode( '/', $file );
2564
  $cnt = count( $temp );
2565
- $temp[$cnt - 1] = strip_tags( stripslashes( $temp[$cnt - 1] ) );//sanitize_file_name( $temp[$cnt - 1] );
2566
  $maxlen = wppa_opt( 'max_filename_length' );
2567
  if ( $maxlen && $check_length ) {
2568
  if ( strpos( $temp[$cnt - 1], '.' ) !== false ) {
@@ -3699,7 +3699,12 @@ function wppa_chmod( $fso ) {
3699
 
3700
  // Test if a given url is to a photo file
3701
  function wppa_is_url_a_photo( $url ) {
3702
- global $wppa_supported_photo_extensions;
 
 
 
 
 
3703
 
3704
  // Init
3705
  $result = true;
@@ -4632,13 +4637,13 @@ function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
4632
 
4633
  // Is it a pdf?
4634
  if ( $i === false ) {
4635
- $is_pdf = wppa_get_ext( $file['name'] ) == 'pdf';
4636
  $single = true;
4637
  }
4638
 
4639
  // One file out of a multiple upload
4640
  else {
4641
- $is_pdf = wppa_get_ext( $file['name'][$i] ) == 'pdf';
4642
  $single = false;
4643
  }
4644
 
@@ -4648,11 +4653,14 @@ function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
4648
  }
4649
 
4650
  // Make sure there are no spaces in the filename, otherwise the download link is broken
4651
- if ( $single ) {
4652
- $file['name'] = str_replace( ' ', '_', $file['name'] );
4653
- }
4654
- else {
4655
- $file['name'][$i] = str_replace( ' ', '_', $file['name'][$i] );
 
 
 
4656
  }
4657
 
4658
  // Copy pdf to source dir,
@@ -4663,34 +4671,29 @@ function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
4663
  $src .= '/';
4664
 
4665
  if ( $single ) {
4666
- copy( $file['tmp_name'], $src . $file['name'] );
4667
  }
4668
  else {
4669
- copy( $file['tmp_name'][$i], $src . $file['name'][$i] );
4670
  }
4671
 
4672
  // Make it a jpg in the source dir,
4673
  if ( $single ) {
4674
- $jpg = wppa_strip_ext( $file['name'] ) . '.jpg';
4675
- if ( wppa_is_windows() ) {
4676
-
4677
- // On windows the filename[pageno] must be enclosed in "", on unix in ''
4678
- wppa_image_magick( 'convert -density 300 "' . $src . $file['name'] . '[0]" ' . $src . $jpg );//, null, $result );
4679
- }
4680
- else {
4681
- wppa_image_magick( "convert -density 300 '" . $src . $file['name'] . "[0]' " . $src . $jpg );//, null, $result );
4682
- }
4683
  }
4684
  else {
4685
- $jpg = wppa_strip_ext( $file['name'][$i] ) . '.jpg';
4686
- if ( wppa_is_windows() ) {
 
4687
 
4688
- // On windows the filename[pageno] must be enclosed in "", on unix in ''
4689
- wppa_image_magick( 'convert -density 300 "' . $src . $file['name'][$i] . '[0]" ' . $src . $jpg );//, null, $result );
4690
- }
4691
- else {
4692
- wppa_image_magick( "convert -density 300 '" . $src . $file['name'][$i] . "[0]' " . $src . $jpg );//, null, $result );
4693
- }
 
 
4694
  }
4695
 
4696
  // Copy the jpg image back to $file['name'] and $file['tmp_name']
@@ -4876,4 +4879,63 @@ function wppa_icon_size( $default = '', $type = 0, $factor = 1 ) {
4876
  function wppa_is_panorama( $id ) {
4877
 
4878
  return wppa_get_photo_item( $id, 'panorama' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4879
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 6.9.13
7
  *
8
  */
9
 
2562
  function wppa_sanitize_file_name( $file, $check_length = true ) {
2563
  $temp = explode( '/', $file );
2564
  $cnt = count( $temp );
2565
+ $temp[$cnt - 1] = wppa_sima( strip_tags( stripslashes( $temp[$cnt - 1] ) ) );
2566
  $maxlen = wppa_opt( 'max_filename_length' );
2567
  if ( $maxlen && $check_length ) {
2568
  if ( strpos( $temp[$cnt - 1], '.' ) !== false ) {
3699
 
3700
  // Test if a given url is to a photo file
3701
  function wppa_is_url_a_photo( $url ) {
3702
+ global $wppa_supported_photo_extensions;
3703
+
3704
+ // Check existence
3705
+ if ( ! wppa_remote_file_exists( $url ) ) {
3706
+ return false;
3707
+ }
3708
 
3709
  // Init
3710
  $result = true;
4637
 
4638
  // Is it a pdf?
4639
  if ( $i === false ) {
4640
+ $is_pdf = wppa_get_ext( wppa_sima( $file['name'] ) ) == 'pdf';
4641
  $single = true;
4642
  }
4643
 
4644
  // One file out of a multiple upload
4645
  else {
4646
+ $is_pdf = wppa_get_ext( wppa_sima( $file['name'][$i] ) ) == 'pdf';
4647
  $single = false;
4648
  }
4649
 
4653
  }
4654
 
4655
  // Make sure there are no spaces in the filename, otherwise the download link is broken
4656
+ // Needs to be done only when imagick is not active because filename will be sanitized in that case
4657
+ if ( ! wppa_opt( 'image_magick' ) ) {
4658
+ if ( $single ) {
4659
+ $file['name'] = str_replace( ' ', '_', $file['name'] );
4660
+ }
4661
+ else {
4662
+ $file['name'][$i] = str_replace( ' ', '_', $file['name'][$i] );
4663
+ }
4664
  }
4665
 
4666
  // Copy pdf to source dir,
4671
  $src .= '/';
4672
 
4673
  if ( $single ) {
4674
+ copy( $file['tmp_name'], $src . sanitize_file_name( $file['name'] ) );
4675
  }
4676
  else {
4677
+ copy( $file['tmp_name'][$i], $src . sanitize_file_name( $file['name'][$i] ) );
4678
  }
4679
 
4680
  // Make it a jpg in the source dir,
4681
  if ( $single ) {
4682
+ $pdf = sanitize_file_name( $file['name'] );
 
 
 
 
 
 
 
 
4683
  }
4684
  else {
4685
+ $pdf = sanitize_file_name( $file['name'][$i] );
4686
+ }
4687
+ $jpg = wppa_strip_ext( $pdf ) . '.jpg';
4688
 
4689
+ $err = wppa_image_magick( 'convert -limit thread 1 ' . $src . $pdf . ' -background white -alpha deactivate -scene 1 ' . $src . $jpg );
4690
+
4691
+ // Log what we did
4692
+ if ( $err ) {
4693
+ wppa_log( 'fso', 'Imagick failed to create ' . $src . $jpg );
4694
+ }
4695
+ else {
4696
+ wppa_log( 'fso', 'Imagick Created ' . $src . $jpg );
4697
  }
4698
 
4699
  // Copy the jpg image back to $file['name'] and $file['tmp_name']
4879
  function wppa_is_panorama( $id ) {
4880
 
4881
  return wppa_get_photo_item( $id, 'panorama' );
4882
+ }
4883
+
4884
+ // See if a remote file exists
4885
+ function wppa_remote_file_exists( $url ) {
4886
+ $ch = curl_init( $url );
4887
+ curl_setopt( $ch, CURLOPT_NOBODY, true );
4888
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
4889
+ curl_exec( $ch );
4890
+ $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
4891
+ curl_close( $ch );
4892
+ if( $httpCode == 200 ) {
4893
+ return true;
4894
+ }
4895
+ return false;
4896
+ }
4897
+
4898
+ // Sanitize filename when imagemagick is active
4899
+ function wppa_sima( $filename ) {
4900
+
4901
+ if ( wppa_opt( 'image_magick' ) ) {
4902
+ $filename = sanitize_file_name( $filename );
4903
+ }
4904
+ return $filename;
4905
+ }
4906
+
4907
+ // Rename all files inside a tree to their sanitized name (recursive)
4908
+ function wppa_rename_files_sanitized( $root ) {
4909
+
4910
+ // Get the files
4911
+ $my_import_files = glob( $root . '/*' );
4912
+
4913
+ // If files
4914
+ if ( is_array( $my_import_files ) ) {
4915
+
4916
+ foreach( $my_import_files as $path ) {
4917
+
4918
+ // Process files
4919
+ if ( is_file( $path ) ) {
4920
+ $file = basename( $path );
4921
+ $new_name = sanitize_file_name( $file );
4922
+ if ( $new_name != $file ) {
4923
+ rename( $path, $root . '/' . $new_name );
4924
+ wppa_log( 'fso', 'Sanitized import filename ' . $path . ' to ' . $root . '/' . $new_name );
4925
+ }
4926
+ }
4927
+
4928
+ // Process directories
4929
+ else {
4930
+ $file = basename( $path );
4931
+
4932
+ // Only process real subfolders
4933
+ if ( $file != '.' && $file != '..' ) {
4934
+
4935
+ // Recursively one level deeper
4936
+ wppa_rename_files_sanitized( $path );
4937
+ }
4938
+ }
4939
+ }
4940
+ }
4941
  }
wppa.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
- * Version: 6.9.12.008
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -22,8 +22,8 @@ global $wpdb;
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
- global $wppa_revno; $wppa_revno = '6912'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '6-9-12-008'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 6.9.13.002
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
+ global $wppa_revno; $wppa_revno = '6913'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '6-9-13-002'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );