globe.gl 2.26.9 → 2.26.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.26.9 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.26.11 globe.gl - https://github.com/vasturiano/globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -57,6 +57,7 @@
57
57
  return target;
58
58
  }
59
59
  function _defineProperty$3(obj, key, value) {
60
+ key = _toPropertyKey$4(key);
60
61
  if (key in obj) {
61
62
  Object.defineProperty(obj, key, {
62
63
  value: value,
@@ -121,13 +122,27 @@
121
122
  function _nonIterableSpread$5() {
122
123
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
123
124
  }
125
+ function _toPrimitive$4(input, hint) {
126
+ if (typeof input !== "object" || input === null) return input;
127
+ var prim = input[Symbol.toPrimitive];
128
+ if (prim !== undefined) {
129
+ var res = prim.call(input, hint || "default");
130
+ if (typeof res !== "object") return res;
131
+ throw new TypeError("@@toPrimitive must return a primitive value.");
132
+ }
133
+ return (hint === "string" ? String : Number)(input);
134
+ }
135
+ function _toPropertyKey$4(arg) {
136
+ var key = _toPrimitive$4(arg, "string");
137
+ return typeof key === "symbol" ? key : String(key);
138
+ }
124
139
 
125
140
  /**
126
141
  * @license
127
142
  * Copyright 2010-2022 Three.js Authors
128
143
  * SPDX-License-Identifier: MIT
129
144
  */
130
- const REVISION = '146';
145
+ const REVISION = '148';
131
146
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
132
147
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
133
148
  const CullFaceNone = 0;
@@ -139,6 +154,7 @@
139
154
  const FrontSide = 0;
140
155
  const BackSide = 1;
141
156
  const DoubleSide = 2;
157
+ const TwoPassDoubleSide = 3;
142
158
  const NoBlending = 0;
143
159
  const NormalBlending = 1;
144
160
  const AdditiveBlending = 2;
@@ -1365,12 +1381,11 @@
1365
1381
 
1366
1382
  }
1367
1383
 
1368
- scale( sx, sy ) {
1384
+ //
1369
1385
 
1370
- const te = this.elements;
1386
+ scale( sx, sy ) {
1371
1387
 
1372
- te[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx;
1373
- te[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy;
1388
+ this.premultiply( _m3.makeScale( sx, sy ) );
1374
1389
 
1375
1390
  return this;
1376
1391
 
@@ -1378,37 +1393,71 @@
1378
1393
 
1379
1394
  rotate( theta ) {
1380
1395
 
1396
+ this.premultiply( _m3.makeRotation( - theta ) );
1397
+
1398
+ return this;
1399
+
1400
+ }
1401
+
1402
+ translate( tx, ty ) {
1403
+
1404
+ this.premultiply( _m3.makeTranslation( tx, ty ) );
1405
+
1406
+ return this;
1407
+
1408
+ }
1409
+
1410
+ // for 2D Transforms
1411
+
1412
+ makeTranslation( x, y ) {
1413
+
1414
+ this.set(
1415
+
1416
+ 1, 0, x,
1417
+ 0, 1, y,
1418
+ 0, 0, 1
1419
+
1420
+ );
1421
+
1422
+ return this;
1423
+
1424
+ }
1425
+
1426
+ makeRotation( theta ) {
1427
+
1428
+ // counterclockwise
1429
+
1381
1430
  const c = Math.cos( theta );
1382
1431
  const s = Math.sin( theta );
1383
1432
 
1384
- const te = this.elements;
1385
-
1386
- const a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ];
1387
- const a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ];
1433
+ this.set(
1388
1434
 
1389
- te[ 0 ] = c * a11 + s * a21;
1390
- te[ 3 ] = c * a12 + s * a22;
1391
- te[ 6 ] = c * a13 + s * a23;
1435
+ c, - s, 0,
1436
+ s, c, 0,
1437
+ 0, 0, 1
1392
1438
 
1393
- te[ 1 ] = - s * a11 + c * a21;
1394
- te[ 4 ] = - s * a12 + c * a22;
1395
- te[ 7 ] = - s * a13 + c * a23;
1439
+ );
1396
1440
 
1397
1441
  return this;
1398
1442
 
1399
1443
  }
1400
1444
 
1401
- translate( tx, ty ) {
1445
+ makeScale( x, y ) {
1402
1446
 
1403
- const te = this.elements;
1447
+ this.set(
1404
1448
 
1405
- te[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ];
1406
- te[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ];
1449
+ x, 0, 0,
1450
+ 0, y, 0,
1451
+ 0, 0, 1
1452
+
1453
+ );
1407
1454
 
1408
1455
  return this;
1409
1456
 
1410
1457
  }
1411
1458
 
1459
+ //
1460
+
1412
1461
  equals( matrix ) {
1413
1462
 
1414
1463
  const te = this.elements;
@@ -1464,6 +1513,8 @@
1464
1513
 
1465
1514
  }
1466
1515
 
1516
+ const _m3 = /*@__PURE__*/ new Matrix3();
1517
+
1467
1518
  function arrayNeedsUint32( array ) {
1468
1519
 
1469
1520
  // assumes larger values usually on last
@@ -1582,7 +1633,7 @@
1582
1633
  'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
1583
1634
  'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
1584
1635
 
1585
- const _rgb = { r: 0, g: 0, b: 0 };
1636
+ const _rgb$1 = { r: 0, g: 0, b: 0 };
1586
1637
  const _hslA = { h: 0, s: 0, l: 0 };
1587
1638
  const _hslB = { h: 0, s: 0, l: 0 };
1588
1639
 
@@ -1672,7 +1723,7 @@
1672
1723
 
1673
1724
  }
1674
1725
 
1675
- setRGB( r, g, b, colorSpace = LinearSRGBColorSpace ) {
1726
+ setRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {
1676
1727
 
1677
1728
  this.r = r;
1678
1729
  this.g = g;
@@ -1684,7 +1735,7 @@
1684
1735
 
1685
1736
  }
1686
1737
 
1687
- setHSL( h, s, l, colorSpace = LinearSRGBColorSpace ) {
1738
+ setHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {
1688
1739
 
1689
1740
  // h,s,l ranges are in 0.0 - 1.0
1690
1741
  h = euclideanModulo( h, 1 );
@@ -1912,9 +1963,9 @@
1912
1963
 
1913
1964
  getHex( colorSpace = SRGBColorSpace ) {
1914
1965
 
1915
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
1966
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
1916
1967
 
1917
- return clamp( _rgb.r * 255, 0, 255 ) << 16 ^ clamp( _rgb.g * 255, 0, 255 ) << 8 ^ clamp( _rgb.b * 255, 0, 255 ) << 0;
1968
+ return clamp( _rgb$1.r * 255, 0, 255 ) << 16 ^ clamp( _rgb$1.g * 255, 0, 255 ) << 8 ^ clamp( _rgb$1.b * 255, 0, 255 ) << 0;
1918
1969
 
1919
1970
  }
1920
1971
 
@@ -1924,13 +1975,13 @@
1924
1975
 
1925
1976
  }
1926
1977
 
1927
- getHSL( target, colorSpace = LinearSRGBColorSpace ) {
1978
+ getHSL( target, colorSpace = ColorManagement.workingColorSpace ) {
1928
1979
 
1929
1980
  // h,s,l ranges are in 0.0 - 1.0
1930
1981
 
1931
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
1982
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
1932
1983
 
1933
- const r = _rgb.r, g = _rgb.g, b = _rgb.b;
1984
+ const r = _rgb$1.r, g = _rgb$1.g, b = _rgb$1.b;
1934
1985
 
1935
1986
  const max = Math.max( r, g, b );
1936
1987
  const min = Math.min( r, g, b );
@@ -1969,13 +2020,13 @@
1969
2020
 
1970
2021
  }
1971
2022
 
1972
- getRGB( target, colorSpace = LinearSRGBColorSpace ) {
2023
+ getRGB( target, colorSpace = ColorManagement.workingColorSpace ) {
1973
2024
 
1974
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
2025
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
1975
2026
 
1976
- target.r = _rgb.r;
1977
- target.g = _rgb.g;
1978
- target.b = _rgb.b;
2027
+ target.r = _rgb$1.r;
2028
+ target.g = _rgb$1.g;
2029
+ target.b = _rgb$1.b;
1979
2030
 
1980
2031
  return target;
1981
2032
 
@@ -1983,16 +2034,16 @@
1983
2034
 
1984
2035
  getStyle( colorSpace = SRGBColorSpace ) {
1985
2036
 
1986
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
2037
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
1987
2038
 
1988
2039
  if ( colorSpace !== SRGBColorSpace ) {
1989
2040
 
1990
2041
  // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
1991
- return `color(${ colorSpace } ${ _rgb.r } ${ _rgb.g } ${ _rgb.b })`;
2042
+ return `color(${ colorSpace } ${ _rgb$1.r } ${ _rgb$1.g } ${ _rgb$1.b })`;
1992
2043
 
1993
2044
  }
1994
2045
 
1995
- return `rgb(${( _rgb.r * 255 ) | 0},${( _rgb.g * 255 ) | 0},${( _rgb.b * 255 ) | 0})`;
2046
+ return `rgb(${( _rgb$1.r * 255 ) | 0},${( _rgb$1.g * 255 ) | 0},${( _rgb$1.b * 255 ) | 0})`;
1996
2047
 
1997
2048
  }
1998
2049
 
@@ -2405,7 +2456,7 @@
2405
2456
 
2406
2457
  class Texture extends EventDispatcher {
2407
2458
 
2408
- constructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding ) {
2459
+ constructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, encoding = LinearEncoding ) {
2409
2460
 
2410
2461
  super();
2411
2462
 
@@ -2572,12 +2623,13 @@
2572
2623
 
2573
2624
  flipY: this.flipY,
2574
2625
 
2626
+ generateMipmaps: this.generateMipmaps,
2575
2627
  premultiplyAlpha: this.premultiplyAlpha,
2576
2628
  unpackAlignment: this.unpackAlignment
2577
2629
 
2578
2630
  };
2579
2631
 
2580
- if ( JSON.stringify( this.userData ) !== '{}' ) output.userData = this.userData;
2632
+ if ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;
2581
2633
 
2582
2634
  if ( ! isRootObject ) {
2583
2635
 
@@ -2690,6 +2742,7 @@
2690
2742
 
2691
2743
  Texture.DEFAULT_IMAGE = null;
2692
2744
  Texture.DEFAULT_MAPPING = UVMapping;
2745
+ Texture.DEFAULT_ANISOTROPY = 1;
2693
2746
 
2694
2747
  class Vector4 {
2695
2748
 
@@ -7609,12 +7662,16 @@
7609
7662
 
7610
7663
  localToWorld( vector ) {
7611
7664
 
7665
+ this.updateWorldMatrix( true, false );
7666
+
7612
7667
  return vector.applyMatrix4( this.matrixWorld );
7613
7668
 
7614
7669
  }
7615
7670
 
7616
7671
  worldToLocal( vector ) {
7617
7672
 
7673
+ this.updateWorldMatrix( true, false );
7674
+
7618
7675
  return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );
7619
7676
 
7620
7677
  }
@@ -7828,6 +7885,28 @@
7828
7885
 
7829
7886
  }
7830
7887
 
7888
+ getObjectsByProperty( name, value ) {
7889
+
7890
+ let result = [];
7891
+
7892
+ if ( this[ name ] === value ) result.push( this );
7893
+
7894
+ for ( let i = 0, l = this.children.length; i < l; i ++ ) {
7895
+
7896
+ const childResult = this.children[ i ].getObjectsByProperty( name, value );
7897
+
7898
+ if ( childResult.length > 0 ) {
7899
+
7900
+ result = result.concat( childResult );
7901
+
7902
+ }
7903
+
7904
+ }
7905
+
7906
+ return result;
7907
+
7908
+ }
7909
+
7831
7910
  getWorldPosition( target ) {
7832
7911
 
7833
7912
  this.updateWorldMatrix( true, false );
@@ -8049,7 +8128,7 @@
8049
8128
  if ( this.visible === false ) object.visible = false;
8050
8129
  if ( this.frustumCulled === false ) object.frustumCulled = false;
8051
8130
  if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
8052
- if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;
8131
+ if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
8053
8132
 
8054
8133
  object.layers = this.layers.mask;
8055
8134
  object.matrix = this.matrix.toArray();
@@ -8956,7 +9035,7 @@
8956
9035
 
8957
9036
  if ( this.fog === false ) data.fog = false;
8958
9037
 
8959
- if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
9038
+ if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
8960
9039
 
8961
9040
  // TODO: Copied from Object3D.toJSON
8962
9041
 
@@ -9168,7 +9247,7 @@
9168
9247
 
9169
9248
  class BufferAttribute {
9170
9249
 
9171
- constructor( array, itemSize, normalized ) {
9250
+ constructor( array, itemSize, normalized = false ) {
9172
9251
 
9173
9252
  if ( Array.isArray( array ) ) {
9174
9253
 
@@ -9183,7 +9262,7 @@
9183
9262
  this.array = array;
9184
9263
  this.itemSize = itemSize;
9185
9264
  this.count = array !== undefined ? array.length / itemSize : 0;
9186
- this.normalized = normalized === true;
9265
+ this.normalized = normalized;
9187
9266
 
9188
9267
  this.usage = StaticDrawUsage;
9189
9268
  this.updateRange = { offset: 0, count: - 1 };
@@ -10520,7 +10599,7 @@
10520
10599
 
10521
10600
  clone() {
10522
10601
 
10523
- return new this.constructor().copy( this );
10602
+ return new this.constructor().copy( this );
10524
10603
 
10525
10604
  }
10526
10605
 
@@ -10650,12 +10729,7 @@
10650
10729
  const _vC$1 = /*@__PURE__*/ new Vector3();
10651
10730
 
10652
10731
  const _tempA = /*@__PURE__*/ new Vector3();
10653
- const _tempB = /*@__PURE__*/ new Vector3();
10654
- const _tempC = /*@__PURE__*/ new Vector3();
10655
-
10656
10732
  const _morphA = /*@__PURE__*/ new Vector3();
10657
- const _morphB = /*@__PURE__*/ new Vector3();
10658
- const _morphC = /*@__PURE__*/ new Vector3();
10659
10733
 
10660
10734
  const _uvA$1 = /*@__PURE__*/ new Vector2();
10661
10735
  const _uvB$1 = /*@__PURE__*/ new Vector2();
@@ -10735,6 +10809,56 @@
10735
10809
 
10736
10810
  }
10737
10811
 
10812
+ getVertexPosition( vert, target ) {
10813
+
10814
+ const geometry = this.geometry;
10815
+ const position = geometry.attributes.position;
10816
+ const morphPosition = geometry.morphAttributes.position;
10817
+ const morphTargetsRelative = geometry.morphTargetsRelative;
10818
+
10819
+ target.fromBufferAttribute( position, vert );
10820
+
10821
+ const morphInfluences = this.morphTargetInfluences;
10822
+
10823
+ if ( morphPosition && morphInfluences ) {
10824
+
10825
+ _morphA.set( 0, 0, 0 );
10826
+
10827
+ for ( let i = 0, il = morphPosition.length; i < il; i ++ ) {
10828
+
10829
+ const influence = morphInfluences[ i ];
10830
+ const morphAttribute = morphPosition[ i ];
10831
+
10832
+ if ( influence === 0 ) continue;
10833
+
10834
+ _tempA.fromBufferAttribute( morphAttribute, vert );
10835
+
10836
+ if ( morphTargetsRelative ) {
10837
+
10838
+ _morphA.addScaledVector( _tempA, influence );
10839
+
10840
+ } else {
10841
+
10842
+ _morphA.addScaledVector( _tempA.sub( target ), influence );
10843
+
10844
+ }
10845
+
10846
+ }
10847
+
10848
+ target.add( _morphA );
10849
+
10850
+ }
10851
+
10852
+ if ( this.isSkinnedMesh ) {
10853
+
10854
+ this.boneTransform( vert, target );
10855
+
10856
+ }
10857
+
10858
+ return target;
10859
+
10860
+ }
10861
+
10738
10862
  raycast( raycaster, intersects ) {
10739
10863
 
10740
10864
  const geometry = this.geometry;
@@ -10769,8 +10893,6 @@
10769
10893
 
10770
10894
  const index = geometry.index;
10771
10895
  const position = geometry.attributes.position;
10772
- const morphPosition = geometry.morphAttributes.position;
10773
- const morphTargetsRelative = geometry.morphTargetsRelative;
10774
10896
  const uv = geometry.attributes.uv;
10775
10897
  const uv2 = geometry.attributes.uv2;
10776
10898
  const groups = geometry.groups;
@@ -10796,7 +10918,7 @@
10796
10918
  const b = index.getX( j + 1 );
10797
10919
  const c = index.getX( j + 2 );
10798
10920
 
10799
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
10921
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv2, a, b, c );
10800
10922
 
10801
10923
  if ( intersection ) {
10802
10924
 
@@ -10821,7 +10943,7 @@
10821
10943
  const b = index.getX( i + 1 );
10822
10944
  const c = index.getX( i + 2 );
10823
10945
 
10824
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
10946
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, uv, uv2, a, b, c );
10825
10947
 
10826
10948
  if ( intersection ) {
10827
10949
 
@@ -10854,7 +10976,7 @@
10854
10976
  const b = j + 1;
10855
10977
  const c = j + 2;
10856
10978
 
10857
- intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
10979
+ intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv2, a, b, c );
10858
10980
 
10859
10981
  if ( intersection ) {
10860
10982
 
@@ -10879,7 +11001,7 @@
10879
11001
  const b = i + 1;
10880
11002
  const c = i + 2;
10881
11003
 
10882
- intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );
11004
+ intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, uv, uv2, a, b, c );
10883
11005
 
10884
11006
  if ( intersection ) {
10885
11007
 
@@ -10908,7 +11030,7 @@
10908
11030
 
10909
11031
  } else {
10910
11032
 
10911
- intersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );
11033
+ intersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );
10912
11034
 
10913
11035
  }
10914
11036
 
@@ -10929,60 +11051,11 @@
10929
11051
 
10930
11052
  }
10931
11053
 
10932
- function checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) {
10933
-
10934
- _vA$1.fromBufferAttribute( position, a );
10935
- _vB$1.fromBufferAttribute( position, b );
10936
- _vC$1.fromBufferAttribute( position, c );
10937
-
10938
- const morphInfluences = object.morphTargetInfluences;
10939
-
10940
- if ( morphPosition && morphInfluences ) {
10941
-
10942
- _morphA.set( 0, 0, 0 );
10943
- _morphB.set( 0, 0, 0 );
10944
- _morphC.set( 0, 0, 0 );
10945
-
10946
- for ( let i = 0, il = morphPosition.length; i < il; i ++ ) {
10947
-
10948
- const influence = morphInfluences[ i ];
10949
- const morphAttribute = morphPosition[ i ];
10950
-
10951
- if ( influence === 0 ) continue;
10952
-
10953
- _tempA.fromBufferAttribute( morphAttribute, a );
10954
- _tempB.fromBufferAttribute( morphAttribute, b );
10955
- _tempC.fromBufferAttribute( morphAttribute, c );
10956
-
10957
- if ( morphTargetsRelative ) {
11054
+ function checkBufferGeometryIntersection( object, material, raycaster, ray, uv, uv2, a, b, c ) {
10958
11055
 
10959
- _morphA.addScaledVector( _tempA, influence );
10960
- _morphB.addScaledVector( _tempB, influence );
10961
- _morphC.addScaledVector( _tempC, influence );
10962
-
10963
- } else {
10964
-
10965
- _morphA.addScaledVector( _tempA.sub( _vA$1 ), influence );
10966
- _morphB.addScaledVector( _tempB.sub( _vB$1 ), influence );
10967
- _morphC.addScaledVector( _tempC.sub( _vC$1 ), influence );
10968
-
10969
- }
10970
-
10971
- }
10972
-
10973
- _vA$1.add( _morphA );
10974
- _vB$1.add( _morphB );
10975
- _vC$1.add( _morphC );
10976
-
10977
- }
10978
-
10979
- if ( object.isSkinnedMesh ) {
10980
-
10981
- object.boneTransform( a, _vA$1 );
10982
- object.boneTransform( b, _vB$1 );
10983
- object.boneTransform( c, _vC$1 );
10984
-
10985
- }
11056
+ object.getVertexPosition( a, _vA$1 );
11057
+ object.getVertexPosition( b, _vB$1 );
11058
+ object.getVertexPosition( c, _vC$1 );
10986
11059
 
10987
11060
  const intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );
10988
11061
 
@@ -11266,6 +11339,19 @@
11266
11339
 
11267
11340
  }
11268
11341
 
11342
+ function getUnlitUniformColorSpace( renderer ) {
11343
+
11344
+ if ( renderer.getRenderTarget() === null ) {
11345
+
11346
+ // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
11347
+ return renderer.outputEncoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
11348
+
11349
+ }
11350
+
11351
+ return LinearSRGBColorSpace;
11352
+
11353
+ }
11354
+
11269
11355
  // Legacy
11270
11356
 
11271
11357
  const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };
@@ -11742,7 +11828,8 @@
11742
11828
 
11743
11829
  }
11744
11830
 
11745
- const fov = 90, aspect = 1;
11831
+ const fov = - 90; // negative fov is not an error
11832
+ const aspect = 1;
11746
11833
 
11747
11834
  class CubeCamera extends Object3D {
11748
11835
 
@@ -11756,38 +11843,38 @@
11756
11843
 
11757
11844
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
11758
11845
  cameraPX.layers = this.layers;
11759
- cameraPX.up.set( 0, - 1, 0 );
11760
- cameraPX.lookAt( new Vector3( 1, 0, 0 ) );
11846
+ cameraPX.up.set( 0, 1, 0 );
11847
+ cameraPX.lookAt( 1, 0, 0 );
11761
11848
  this.add( cameraPX );
11762
11849
 
11763
11850
  const cameraNX = new PerspectiveCamera( fov, aspect, near, far );
11764
11851
  cameraNX.layers = this.layers;
11765
- cameraNX.up.set( 0, - 1, 0 );
11766
- cameraNX.lookAt( new Vector3( - 1, 0, 0 ) );
11852
+ cameraNX.up.set( 0, 1, 0 );
11853
+ cameraNX.lookAt( - 1, 0, 0 );
11767
11854
  this.add( cameraNX );
11768
11855
 
11769
11856
  const cameraPY = new PerspectiveCamera( fov, aspect, near, far );
11770
11857
  cameraPY.layers = this.layers;
11771
- cameraPY.up.set( 0, 0, 1 );
11772
- cameraPY.lookAt( new Vector3( 0, 1, 0 ) );
11858
+ cameraPY.up.set( 0, 0, - 1 );
11859
+ cameraPY.lookAt( 0, 1, 0 );
11773
11860
  this.add( cameraPY );
11774
11861
 
11775
11862
  const cameraNY = new PerspectiveCamera( fov, aspect, near, far );
11776
11863
  cameraNY.layers = this.layers;
11777
- cameraNY.up.set( 0, 0, - 1 );
11778
- cameraNY.lookAt( new Vector3( 0, - 1, 0 ) );
11864
+ cameraNY.up.set( 0, 0, 1 );
11865
+ cameraNY.lookAt( 0, - 1, 0 );
11779
11866
  this.add( cameraNY );
11780
11867
 
11781
11868
  const cameraPZ = new PerspectiveCamera( fov, aspect, near, far );
11782
11869
  cameraPZ.layers = this.layers;
11783
- cameraPZ.up.set( 0, - 1, 0 );
11784
- cameraPZ.lookAt( new Vector3( 0, 0, 1 ) );
11870
+ cameraPZ.up.set( 0, 1, 0 );
11871
+ cameraPZ.lookAt( 0, 0, 1 );
11785
11872
  this.add( cameraPZ );
11786
11873
 
11787
11874
  const cameraNZ = new PerspectiveCamera( fov, aspect, near, far );
11788
11875
  cameraNZ.layers = this.layers;
11789
- cameraNZ.up.set( 0, - 1, 0 );
11790
- cameraNZ.lookAt( new Vector3( 0, 0, - 1 ) );
11876
+ cameraNZ.up.set( 0, 1, 0 );
11877
+ cameraNZ.lookAt( 0, 0, - 1 );
11791
11878
  this.add( cameraNZ );
11792
11879
 
11793
11880
  }
@@ -12531,6 +12618,8 @@
12531
12618
 
12532
12619
  }
12533
12620
 
12621
+ attribute.onUploadCallback();
12622
+
12534
12623
  }
12535
12624
 
12536
12625
  //
@@ -12732,7 +12821,7 @@
12732
12821
 
12733
12822
  var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
12734
12823
 
12735
- var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
12824
+ var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
12736
12825
 
12737
12826
  var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
12738
12827
 
@@ -12774,7 +12863,7 @@
12774
12863
 
12775
12864
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
12776
12865
 
12777
- var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)";
12866
+ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
12778
12867
 
12779
12868
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
12780
12869
 
@@ -12782,17 +12871,17 @@
12782
12871
 
12783
12872
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
12784
12873
 
12785
- var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)";
12874
+ var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
12786
12875
 
12787
12876
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
12788
12877
 
12789
- var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)";
12878
+ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
12790
12879
 
12791
12880
  var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
12792
12881
 
12793
12882
  var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
12794
12883
 
12795
- var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
12884
+ var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
12796
12885
 
12797
12886
  var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
12798
12887
 
@@ -12862,7 +12951,7 @@
12862
12951
 
12863
12952
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
12864
12953
 
12865
- var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
12954
+ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
12866
12955
 
12867
12956
  var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
12868
12957
 
@@ -12906,11 +12995,11 @@
12906
12995
 
12907
12996
  const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
12908
12997
 
12909
- const fragment$h = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
12998
+ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
12910
12999
 
12911
13000
  const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
12912
13001
 
12913
- const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
13002
+ const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
12914
13003
 
12915
13004
  const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
12916
13005
 
@@ -13541,6 +13630,7 @@
13541
13630
  uniforms: {
13542
13631
  uvTransform: { value: /*@__PURE__*/ new Matrix3() },
13543
13632
  t2D: { value: null },
13633
+ backgroundIntensity: { value: 1 }
13544
13634
  },
13545
13635
 
13546
13636
  vertexShader: ShaderChunk.background_vert,
@@ -13553,7 +13643,8 @@
13553
13643
  uniforms: {
13554
13644
  envMap: { value: null },
13555
13645
  flipEnvMap: { value: - 1 },
13556
- backgroundBlurriness: { value: 0 }
13646
+ backgroundBlurriness: { value: 0 },
13647
+ backgroundIntensity: { value: 1 }
13557
13648
  },
13558
13649
 
13559
13650
  vertexShader: ShaderChunk.backgroundCube_vert,
@@ -13662,6 +13753,8 @@
13662
13753
 
13663
13754
  };
13664
13755
 
13756
+ const _rgb = { r: 0, b: 0, g: 0 };
13757
+
13665
13758
  function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
13666
13759
 
13667
13760
  const clearColor = new Color$1( 0x000000 );
@@ -13760,6 +13853,8 @@
13760
13853
  boxMesh.material.uniforms.envMap.value = background;
13761
13854
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
13762
13855
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
13856
+ boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
13857
+ boxMesh.material.toneMapped = ( background.encoding === sRGBEncoding ) ? false : true;
13763
13858
 
13764
13859
  if ( currentBackground !== background ||
13765
13860
  currentBackgroundVersion !== background.version ||
@@ -13814,6 +13909,8 @@
13814
13909
  }
13815
13910
 
13816
13911
  planeMesh.material.uniforms.t2D.value = background;
13912
+ planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
13913
+ planeMesh.material.toneMapped = ( background.encoding === sRGBEncoding ) ? false : true;
13817
13914
 
13818
13915
  if ( background.matrixAutoUpdate === true ) {
13819
13916
 
@@ -13846,7 +13943,9 @@
13846
13943
 
13847
13944
  function setClear( color, alpha ) {
13848
13945
 
13849
- state.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha );
13946
+ color.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );
13947
+
13948
+ state.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );
13850
13949
 
13851
13950
  }
13852
13951
 
@@ -20169,10 +20268,6 @@
20169
20268
 
20170
20269
  const uniforms = cache.get( light );
20171
20270
 
20172
- // (a) intensity is the total visible light emitted
20173
- //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
20174
-
20175
- // (b) intensity is the brightness of the light
20176
20271
  uniforms.color.copy( color ).multiplyScalar( intensity );
20177
20272
 
20178
20273
  uniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );
@@ -20839,37 +20934,38 @@
20839
20934
 
20840
20935
  result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;
20841
20936
 
20842
- }
20937
+ if ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
20938
+ ( material.displacementMap && material.displacementScale !== 0 ) ||
20939
+ ( material.alphaMap && material.alphaTest > 0 ) ||
20940
+ ( material.map && material.alphaTest > 0 ) ) {
20941
+
20942
+ // in this case we need a unique material instance reflecting the
20943
+ // appropriate state
20843
20944
 
20844
- if ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
20845
- ( material.displacementMap && material.displacementScale !== 0 ) ||
20846
- ( material.alphaMap && material.alphaTest > 0 ) ) {
20945
+ const keyA = result.uuid, keyB = material.uuid;
20847
20946
 
20848
- // in this case we need a unique material instance reflecting the
20849
- // appropriate state
20947
+ let materialsForVariant = _materialCache[ keyA ];
20850
20948
 
20851
- const keyA = result.uuid, keyB = material.uuid;
20949
+ if ( materialsForVariant === undefined ) {
20852
20950
 
20853
- let materialsForVariant = _materialCache[ keyA ];
20951
+ materialsForVariant = {};
20952
+ _materialCache[ keyA ] = materialsForVariant;
20854
20953
 
20855
- if ( materialsForVariant === undefined ) {
20954
+ }
20856
20955
 
20857
- materialsForVariant = {};
20858
- _materialCache[ keyA ] = materialsForVariant;
20956
+ let cachedMaterial = materialsForVariant[ keyB ];
20859
20957
 
20860
- }
20958
+ if ( cachedMaterial === undefined ) {
20861
20959
 
20862
- let cachedMaterial = materialsForVariant[ keyB ];
20960
+ cachedMaterial = result.clone();
20961
+ materialsForVariant[ keyB ] = cachedMaterial;
20863
20962
 
20864
- if ( cachedMaterial === undefined ) {
20963
+ }
20865
20964
 
20866
- cachedMaterial = result.clone();
20867
- materialsForVariant[ keyB ] = cachedMaterial;
20965
+ result = cachedMaterial;
20868
20966
 
20869
20967
  }
20870
20968
 
20871
- result = cachedMaterial;
20872
-
20873
20969
  }
20874
20970
 
20875
20971
  result.visible = material.visible;
@@ -20887,6 +20983,7 @@
20887
20983
 
20888
20984
  result.alphaMap = material.alphaMap;
20889
20985
  result.alphaTest = material.alphaTest;
20986
+ result.map = material.map;
20890
20987
 
20891
20988
  result.clipShadows = material.clipShadows;
20892
20989
  result.clippingPlanes = material.clippingPlanes;
@@ -21275,7 +21372,7 @@
21275
21372
  const stencilBuffer = new StencilBuffer();
21276
21373
 
21277
21374
  const uboBindings = new WeakMap();
21278
- const uboProgamMap = new WeakMap();
21375
+ const uboProgramMap = new WeakMap();
21279
21376
 
21280
21377
  let enabledCapabilities = {};
21281
21378
 
@@ -21686,7 +21783,7 @@
21686
21783
  }
21687
21784
 
21688
21785
  currentBlending = blending;
21689
- currentPremultipledAlpha = null;
21786
+ currentPremultipledAlpha = false;
21690
21787
 
21691
21788
  }
21692
21789
 
@@ -22072,13 +22169,13 @@
22072
22169
 
22073
22170
  function updateUBOMapping( uniformsGroup, program ) {
22074
22171
 
22075
- let mapping = uboProgamMap.get( program );
22172
+ let mapping = uboProgramMap.get( program );
22076
22173
 
22077
22174
  if ( mapping === undefined ) {
22078
22175
 
22079
22176
  mapping = new WeakMap();
22080
22177
 
22081
- uboProgamMap.set( program, mapping );
22178
+ uboProgramMap.set( program, mapping );
22082
22179
 
22083
22180
  }
22084
22181
 
@@ -22096,16 +22193,15 @@
22096
22193
 
22097
22194
  function uniformBlockBinding( uniformsGroup, program ) {
22098
22195
 
22099
- const mapping = uboProgamMap.get( program );
22196
+ const mapping = uboProgramMap.get( program );
22100
22197
  const blockIndex = mapping.get( uniformsGroup );
22101
22198
 
22102
- if ( uboBindings.get( uniformsGroup ) !== blockIndex ) {
22199
+ if ( uboBindings.get( program ) !== blockIndex ) {
22103
22200
 
22104
22201
  // bind shader specific block index to global block point
22105
-
22106
22202
  gl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );
22107
22203
 
22108
- uboBindings.set( uniformsGroup, blockIndex );
22204
+ uboBindings.set( program, blockIndex );
22109
22205
 
22110
22206
  }
22111
22207
 
@@ -22266,7 +22362,7 @@
22266
22362
  const maxTextureSize = capabilities.maxTextureSize;
22267
22363
  const maxSamples = capabilities.maxSamples;
22268
22364
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
22269
- const supportsInvalidateFramebuffer = /OculusBrowser/g.test( typeof navigator === 'undefined' ? '' : navigator.userAgent );
22365
+ const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
22270
22366
 
22271
22367
  const _videoTextures = new WeakMap();
22272
22368
  let _canvas;
@@ -22829,6 +22925,8 @@
22829
22925
 
22830
22926
  const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
22831
22927
 
22928
+ if ( texture.magFilter === NearestFilter ) return;
22929
+ if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
22832
22930
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
22833
22931
  if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only
22834
22932
 
@@ -24292,7 +24390,6 @@
24292
24390
  if ( p === LuminanceAlphaFormat ) return 6410;
24293
24391
  if ( p === DepthFormat ) return 6402;
24294
24392
  if ( p === DepthStencilFormat ) return 34041;
24295
- if ( p === RedFormat ) return 6403;
24296
24393
 
24297
24394
  // @deprecated since r137
24298
24395
 
@@ -24323,6 +24420,7 @@
24323
24420
 
24324
24421
  // WebGL2 formats.
24325
24422
 
24423
+ if ( p === RedFormat ) return 6403;
24326
24424
  if ( p === RedIntegerFormat ) return 36244;
24327
24425
  if ( p === RGFormat ) return 33319;
24328
24426
  if ( p === RGIntegerFormat ) return 33320;
@@ -24628,6 +24726,31 @@
24628
24726
 
24629
24727
  }
24630
24728
 
24729
+ connect( inputSource ) {
24730
+
24731
+ if ( inputSource && inputSource.hand ) {
24732
+
24733
+ const hand = this._hand;
24734
+
24735
+ if ( hand ) {
24736
+
24737
+ for ( const inputjoint of inputSource.hand.values() ) {
24738
+
24739
+ // Initialize hand with joints when connected
24740
+ this._getHandJoint( hand, inputjoint );
24741
+
24742
+ }
24743
+
24744
+ }
24745
+
24746
+ }
24747
+
24748
+ this.dispatchEvent( { type: 'connected', data: inputSource } );
24749
+
24750
+ return this;
24751
+
24752
+ }
24753
+
24631
24754
  disconnect( inputSource ) {
24632
24755
 
24633
24756
  this.dispatchEvent( { type: 'disconnected', data: inputSource } );
@@ -24675,19 +24798,8 @@
24675
24798
  // Update the joints groups with the XRJoint poses
24676
24799
  const jointPose = frame.getJointPose( inputjoint, referenceSpace );
24677
24800
 
24678
- if ( hand.joints[ inputjoint.jointName ] === undefined ) {
24679
-
24680
- // The transform of this joint will be updated with the joint pose on each frame
24681
- const joint = new Group$1();
24682
- joint.matrixAutoUpdate = false;
24683
- joint.visible = false;
24684
- hand.joints[ inputjoint.jointName ] = joint;
24685
- // ??
24686
- hand.add( joint );
24687
-
24688
- }
24689
-
24690
- const joint = hand.joints[ inputjoint.jointName ];
24801
+ // The transform of this joint will be updated with the joint pose on each frame
24802
+ const joint = this._getHandJoint( hand, inputjoint );
24691
24803
 
24692
24804
  if ( jointPose !== null ) {
24693
24805
 
@@ -24839,6 +24951,25 @@
24839
24951
 
24840
24952
  }
24841
24953
 
24954
+ // private method
24955
+
24956
+ _getHandJoint( hand, inputjoint ) {
24957
+
24958
+ if ( hand.joints[ inputjoint.jointName ] === undefined ) {
24959
+
24960
+ const joint = new Group$1();
24961
+ joint.matrixAutoUpdate = false;
24962
+ joint.visible = false;
24963
+ hand.joints[ inputjoint.jointName ] = joint;
24964
+
24965
+ hand.add( joint );
24966
+
24967
+ }
24968
+
24969
+ return hand.joints[ inputjoint.jointName ];
24970
+
24971
+ }
24972
+
24842
24973
  }
24843
24974
 
24844
24975
  class DepthTexture extends Texture {
@@ -24900,6 +25031,9 @@
24900
25031
  const controllers = [];
24901
25032
  const controllerInputSources = [];
24902
25033
 
25034
+ const planes = new Set();
25035
+ const planesLastChangedTimes = new Map();
25036
+
24903
25037
  //
24904
25038
 
24905
25039
  const cameraL = new PerspectiveCamera();
@@ -25221,7 +25355,7 @@
25221
25355
  if ( index >= 0 ) {
25222
25356
 
25223
25357
  controllerInputSources[ index ] = null;
25224
- controllers[ index ].dispatchEvent( { type: 'disconnected', data: inputSource } );
25358
+ controllers[ index ].disconnect( inputSource );
25225
25359
 
25226
25360
  }
25227
25361
 
@@ -25267,7 +25401,7 @@
25267
25401
 
25268
25402
  if ( controller ) {
25269
25403
 
25270
- controller.dispatchEvent( { type: 'connected', data: inputSource } );
25404
+ controller.connect( inputSource );
25271
25405
 
25272
25406
  }
25273
25407
 
@@ -25457,6 +25591,12 @@
25457
25591
 
25458
25592
  };
25459
25593
 
25594
+ this.getPlanes = function () {
25595
+
25596
+ return planes;
25597
+
25598
+ };
25599
+
25460
25600
  // Animation Loop
25461
25601
 
25462
25602
  let onAnimationFrameCallback = null;
@@ -25565,6 +25705,65 @@
25565
25705
 
25566
25706
  if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
25567
25707
 
25708
+ if ( frame.detectedPlanes ) {
25709
+
25710
+ scope.dispatchEvent( { type: 'planesdetected', data: frame.detectedPlanes } );
25711
+
25712
+ let planesToRemove = null;
25713
+
25714
+ for ( const plane of planes ) {
25715
+
25716
+ if ( ! frame.detectedPlanes.has( plane ) ) {
25717
+
25718
+ if ( planesToRemove === null ) {
25719
+
25720
+ planesToRemove = [];
25721
+
25722
+ }
25723
+
25724
+ planesToRemove.push( plane );
25725
+
25726
+ }
25727
+
25728
+ }
25729
+
25730
+ if ( planesToRemove !== null ) {
25731
+
25732
+ for ( const plane of planesToRemove ) {
25733
+
25734
+ planes.delete( plane );
25735
+ planesLastChangedTimes.delete( plane );
25736
+ scope.dispatchEvent( { type: 'planeremoved', data: plane } );
25737
+
25738
+ }
25739
+
25740
+ }
25741
+
25742
+ for ( const plane of frame.detectedPlanes ) {
25743
+
25744
+ if ( ! planes.has( plane ) ) {
25745
+
25746
+ planes.add( plane );
25747
+ planesLastChangedTimes.set( plane, frame.lastChangedTime );
25748
+ scope.dispatchEvent( { type: 'planeadded', data: plane } );
25749
+
25750
+ } else {
25751
+
25752
+ const lastKnownTime = planesLastChangedTimes.get( plane );
25753
+
25754
+ if ( plane.lastChangedTime > lastKnownTime ) {
25755
+
25756
+ planesLastChangedTimes.set( plane, plane.lastChangedTime );
25757
+ scope.dispatchEvent( { type: 'planechanged', data: plane } );
25758
+
25759
+ }
25760
+
25761
+ }
25762
+
25763
+ }
25764
+
25765
+ }
25766
+
25568
25767
  xrFrame = null;
25569
25768
 
25570
25769
  }
@@ -25589,7 +25788,7 @@
25589
25788
 
25590
25789
  function refreshFogUniforms( uniforms, fog ) {
25591
25790
 
25592
- uniforms.fogColor.value.copy( fog.color );
25791
+ fog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );
25593
25792
 
25594
25793
  if ( fog.isFog ) {
25595
25794
 
@@ -26363,43 +26562,52 @@
26363
26562
 
26364
26563
  if ( hasUniformChanged( uniform, i, cache ) === true ) {
26365
26564
 
26366
- const value = uniform.value;
26367
26565
  const offset = uniform.__offset;
26368
26566
 
26369
- if ( typeof value === 'number' ) {
26567
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
26370
26568
 
26371
- uniform.__data[ 0 ] = value;
26372
- gl.bufferSubData( 35345, offset, uniform.__data );
26569
+ let arrayOffset = 0;
26373
26570
 
26374
- } else {
26571
+ for ( let i = 0; i < values.length; i ++ ) {
26572
+
26573
+ const value = values[ i ];
26574
+
26575
+ const info = getUniformSize( value );
26375
26576
 
26376
- if ( uniform.value.isMatrix3 ) {
26577
+ if ( typeof value === 'number' ) {
26578
+
26579
+ uniform.__data[ 0 ] = value;
26580
+ gl.bufferSubData( 35345, offset + arrayOffset, uniform.__data );
26581
+
26582
+ } else if ( value.isMatrix3 ) {
26377
26583
 
26378
26584
  // manually converting 3x3 to 3x4
26379
26585
 
26380
- uniform.__data[ 0 ] = uniform.value.elements[ 0 ];
26381
- uniform.__data[ 1 ] = uniform.value.elements[ 1 ];
26382
- uniform.__data[ 2 ] = uniform.value.elements[ 2 ];
26383
- uniform.__data[ 3 ] = uniform.value.elements[ 0 ];
26384
- uniform.__data[ 4 ] = uniform.value.elements[ 3 ];
26385
- uniform.__data[ 5 ] = uniform.value.elements[ 4 ];
26386
- uniform.__data[ 6 ] = uniform.value.elements[ 5 ];
26387
- uniform.__data[ 7 ] = uniform.value.elements[ 0 ];
26388
- uniform.__data[ 8 ] = uniform.value.elements[ 6 ];
26389
- uniform.__data[ 9 ] = uniform.value.elements[ 7 ];
26390
- uniform.__data[ 10 ] = uniform.value.elements[ 8 ];
26391
- uniform.__data[ 11 ] = uniform.value.elements[ 0 ];
26586
+ uniform.__data[ 0 ] = value.elements[ 0 ];
26587
+ uniform.__data[ 1 ] = value.elements[ 1 ];
26588
+ uniform.__data[ 2 ] = value.elements[ 2 ];
26589
+ uniform.__data[ 3 ] = value.elements[ 0 ];
26590
+ uniform.__data[ 4 ] = value.elements[ 3 ];
26591
+ uniform.__data[ 5 ] = value.elements[ 4 ];
26592
+ uniform.__data[ 6 ] = value.elements[ 5 ];
26593
+ uniform.__data[ 7 ] = value.elements[ 0 ];
26594
+ uniform.__data[ 8 ] = value.elements[ 6 ];
26595
+ uniform.__data[ 9 ] = value.elements[ 7 ];
26596
+ uniform.__data[ 10 ] = value.elements[ 8 ];
26597
+ uniform.__data[ 11 ] = value.elements[ 0 ];
26392
26598
 
26393
26599
  } else {
26394
26600
 
26395
- value.toArray( uniform.__data );
26601
+ value.toArray( uniform.__data, arrayOffset );
26396
26602
 
26397
- }
26603
+ arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
26398
26604
 
26399
- gl.bufferSubData( 35345, offset, uniform.__data );
26605
+ }
26400
26606
 
26401
26607
  }
26402
26608
 
26609
+ gl.bufferSubData( 35345, offset, uniform.__data );
26610
+
26403
26611
  }
26404
26612
 
26405
26613
  }
@@ -26422,7 +26630,17 @@
26422
26630
 
26423
26631
  } else {
26424
26632
 
26425
- cache[ index ] = value.clone();
26633
+ const values = Array.isArray( value ) ? value : [ value ];
26634
+
26635
+ const tempValues = [];
26636
+
26637
+ for ( let i = 0; i < values.length; i ++ ) {
26638
+
26639
+ tempValues.push( values[ i ].clone() );
26640
+
26641
+ }
26642
+
26643
+ cache[ index ] = tempValues;
26426
26644
 
26427
26645
  }
26428
26646
 
@@ -26443,12 +26661,19 @@
26443
26661
 
26444
26662
  } else {
26445
26663
 
26446
- const cachedObject = cache[ index ];
26664
+ const cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];
26665
+ const values = Array.isArray( value ) ? value : [ value ];
26447
26666
 
26448
- if ( cachedObject.equals( value ) === false ) {
26667
+ for ( let i = 0; i < cachedObjects.length; i ++ ) {
26449
26668
 
26450
- cachedObject.copy( value );
26451
- return true;
26669
+ const cachedObject = cachedObjects[ i ];
26670
+
26671
+ if ( cachedObject.equals( values[ i ] ) === false ) {
26672
+
26673
+ cachedObject.copy( values[ i ] );
26674
+ return true;
26675
+
26676
+ }
26452
26677
 
26453
26678
  }
26454
26679
 
@@ -26474,11 +26699,28 @@
26474
26699
  for ( let i = 0, l = uniforms.length; i < l; i ++ ) {
26475
26700
 
26476
26701
  const uniform = uniforms[ i ];
26477
- const info = getUniformSize( uniform );
26702
+
26703
+ const infos = {
26704
+ boundary: 0, // bytes
26705
+ storage: 0 // bytes
26706
+ };
26707
+
26708
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
26709
+
26710
+ for ( let j = 0, jl = values.length; j < jl; j ++ ) {
26711
+
26712
+ const value = values[ j ];
26713
+
26714
+ const info = getUniformSize( value );
26715
+
26716
+ infos.boundary += info.boundary;
26717
+ infos.storage += info.storage;
26718
+
26719
+ }
26478
26720
 
26479
26721
  // the following two properties will be used for partial buffer updates
26480
26722
 
26481
- uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
26723
+ uniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );
26482
26724
  uniform.__offset = offset;
26483
26725
 
26484
26726
  //
@@ -26491,7 +26733,7 @@
26491
26733
 
26492
26734
  // check for chunk overflow
26493
26735
 
26494
- if ( chunkOffset !== 0 && ( remainingSizeInChunk - info.boundary ) < 0 ) {
26736
+ if ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {
26495
26737
 
26496
26738
  // add padding and adjust offset
26497
26739
 
@@ -26502,7 +26744,7 @@
26502
26744
 
26503
26745
  }
26504
26746
 
26505
- offset += info.storage;
26747
+ offset += infos.storage;
26506
26748
 
26507
26749
  }
26508
26750
 
@@ -26521,9 +26763,7 @@
26521
26763
 
26522
26764
  }
26523
26765
 
26524
- function getUniformSize( uniform ) {
26525
-
26526
- const value = uniform.value;
26766
+ function getUniformSize( value ) {
26527
26767
 
26528
26768
  const info = {
26529
26769
  boundary: 0, // bytes
@@ -26716,28 +26956,6 @@
26716
26956
  this.toneMapping = NoToneMapping;
26717
26957
  this.toneMappingExposure = 1.0;
26718
26958
 
26719
- //
26720
-
26721
- Object.defineProperties( this, {
26722
-
26723
- // @deprecated since r136, 0e21088102b4de7e0a0a33140620b7a3424b9e6d
26724
-
26725
- gammaFactor: {
26726
- get: function () {
26727
-
26728
- console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
26729
- return 2;
26730
-
26731
- },
26732
- set: function () {
26733
-
26734
- console.warn( 'THREE.WebGLRenderer: .gammaFactor has been removed.' );
26735
-
26736
- }
26737
- }
26738
-
26739
- } );
26740
-
26741
26959
  // internal properties
26742
26960
 
26743
26961
  const _this = this;
@@ -27304,31 +27522,48 @@
27304
27522
  //
27305
27523
 
27306
27524
  let index = geometry.index;
27307
- const position = geometry.attributes.position;
27525
+ let rangeFactor = 1;
27526
+
27527
+ if ( material.wireframe === true ) {
27528
+
27529
+ index = geometries.getWireframeAttribute( geometry );
27530
+ rangeFactor = 2;
27531
+
27532
+ }
27308
27533
 
27309
27534
  //
27310
27535
 
27311
- if ( index === null ) {
27536
+ const drawRange = geometry.drawRange;
27537
+ const position = geometry.attributes.position;
27312
27538
 
27313
- if ( position === undefined || position.count === 0 ) return;
27539
+ let drawStart = drawRange.start * rangeFactor;
27540
+ let drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;
27314
27541
 
27315
- } else if ( index.count === 0 ) {
27542
+ if ( group !== null ) {
27316
27543
 
27317
- return;
27544
+ drawStart = Math.max( drawStart, group.start * rangeFactor );
27545
+ drawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );
27318
27546
 
27319
27547
  }
27320
27548
 
27321
- //
27549
+ if ( index !== null ) {
27322
27550
 
27323
- let rangeFactor = 1;
27551
+ drawStart = Math.max( drawStart, 0 );
27552
+ drawEnd = Math.min( drawEnd, index.count );
27324
27553
 
27325
- if ( material.wireframe === true ) {
27554
+ } else if ( position !== undefined && position !== null ) {
27326
27555
 
27327
- index = geometries.getWireframeAttribute( geometry );
27328
- rangeFactor = 2;
27556
+ drawStart = Math.max( drawStart, 0 );
27557
+ drawEnd = Math.min( drawEnd, position.count );
27329
27558
 
27330
27559
  }
27331
27560
 
27561
+ const drawCount = drawEnd - drawStart;
27562
+
27563
+ if ( drawCount < 0 || drawCount === Infinity ) return;
27564
+
27565
+ //
27566
+
27332
27567
  bindingStates.setup( object, material, program, geometry, index );
27333
27568
 
27334
27569
  let attribute;
@@ -27345,23 +27580,6 @@
27345
27580
 
27346
27581
  //
27347
27582
 
27348
- const dataCount = ( index !== null ) ? index.count : position.count;
27349
-
27350
- const rangeStart = geometry.drawRange.start * rangeFactor;
27351
- const rangeCount = geometry.drawRange.count * rangeFactor;
27352
-
27353
- const groupStart = group !== null ? group.start * rangeFactor : 0;
27354
- const groupCount = group !== null ? group.count * rangeFactor : Infinity;
27355
-
27356
- const drawStart = Math.max( rangeStart, groupStart );
27357
- const drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;
27358
-
27359
- const drawCount = Math.max( 0, drawEnd - drawStart + 1 );
27360
-
27361
- if ( drawCount === 0 ) return;
27362
-
27363
- //
27364
-
27365
27583
  if ( object.isMesh ) {
27366
27584
 
27367
27585
  if ( material.wireframe === true ) {
@@ -27413,7 +27631,8 @@
27413
27631
 
27414
27632
  } else if ( geometry.isInstancedBufferGeometry ) {
27415
27633
 
27416
- const instanceCount = Math.min( geometry.instanceCount, geometry._maxInstanceCount );
27634
+ const maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;
27635
+ const instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );
27417
27636
 
27418
27637
  renderer.renderInstances( drawStart, drawCount, instanceCount );
27419
27638
 
@@ -27431,7 +27650,7 @@
27431
27650
 
27432
27651
  function prepare( material, scene, object ) {
27433
27652
 
27434
- if ( material.transparent === true && material.side === DoubleSide ) {
27653
+ if ( material.transparent === true && material.side === TwoPassDoubleSide ) {
27435
27654
 
27436
27655
  material.side = BackSide;
27437
27656
  material.needsUpdate = true;
@@ -27441,7 +27660,7 @@
27441
27660
  material.needsUpdate = true;
27442
27661
  getProgram( material, scene, object );
27443
27662
 
27444
- material.side = DoubleSide;
27663
+ material.side = TwoPassDoubleSide;
27445
27664
 
27446
27665
  } else {
27447
27666
 
@@ -27913,7 +28132,7 @@
27913
28132
 
27914
28133
  material.onBeforeRender( _this, scene, camera, geometry, object, group );
27915
28134
 
27916
- if ( material.transparent === true && material.side === DoubleSide ) {
28135
+ if ( material.transparent === true && material.side === TwoPassDoubleSide ) {
27917
28136
 
27918
28137
  material.side = BackSide;
27919
28138
  material.needsUpdate = true;
@@ -27923,7 +28142,7 @@
27923
28142
  material.needsUpdate = true;
27924
28143
  _this.renderBufferDirect( camera, scene, geometry, material, object, group );
27925
28144
 
27926
- material.side = DoubleSide;
28145
+ material.side = TwoPassDoubleSide;
27927
28146
 
27928
28147
  } else {
27929
28148
 
@@ -28873,6 +29092,7 @@
28873
29092
  this.fog = null;
28874
29093
 
28875
29094
  this.backgroundBlurriness = 0;
29095
+ this.backgroundIntensity = 1;
28876
29096
 
28877
29097
  this.overrideMaterial = null;
28878
29098
 
@@ -28893,6 +29113,7 @@
28893
29113
  if ( source.fog !== null ) this.fog = source.fog.clone();
28894
29114
 
28895
29115
  this.backgroundBlurriness = source.backgroundBlurriness;
29116
+ this.backgroundIntensity = source.backgroundIntensity;
28896
29117
 
28897
29118
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
28898
29119
 
@@ -28908,6 +29129,7 @@
28908
29129
 
28909
29130
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
28910
29131
  if ( this.backgroundBlurriness > 0 ) data.backgroundBlurriness = this.backgroundBlurriness;
29132
+ if ( this.backgroundIntensity !== 1 ) data.backgroundIntensity = this.backgroundIntensity;
28911
29133
 
28912
29134
  return data;
28913
29135
 
@@ -29086,7 +29308,7 @@
29086
29308
  this.itemSize = itemSize;
29087
29309
  this.offset = offset;
29088
29310
 
29089
- this.normalized = normalized === true;
29311
+ this.normalized = normalized;
29090
29312
 
29091
29313
  }
29092
29314
 
@@ -29300,7 +29522,7 @@
29300
29522
 
29301
29523
  if ( data === undefined ) {
29302
29524
 
29303
- console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.' );
29525
+ console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );
29304
29526
 
29305
29527
  const array = [];
29306
29528
 
@@ -29342,7 +29564,7 @@
29342
29564
 
29343
29565
  if ( data === undefined ) {
29344
29566
 
29345
- console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.' );
29567
+ console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );
29346
29568
 
29347
29569
  const array = [];
29348
29570
 
@@ -29358,7 +29580,7 @@
29358
29580
 
29359
29581
  }
29360
29582
 
29361
- // deinterleave data and save it as an ordinary buffer attribute for now
29583
+ // de-interleave data and save it as an ordinary buffer attribute for now
29362
29584
 
29363
29585
  return {
29364
29586
  itemSize: this.itemSize,
@@ -29369,7 +29591,7 @@
29369
29591
 
29370
29592
  } else {
29371
29593
 
29372
- // save as true interleaved attribtue
29594
+ // save as true interleaved attribute
29373
29595
 
29374
29596
  if ( data.interleavedBuffers === undefined ) {
29375
29597
 
@@ -31624,7 +31846,7 @@
31624
31846
 
31625
31847
  class CircleGeometry extends BufferGeometry {
31626
31848
 
31627
- constructor( radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2 ) {
31849
+ constructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {
31628
31850
 
31629
31851
  super();
31630
31852
 
@@ -31708,7 +31930,7 @@
31708
31930
 
31709
31931
  class CylinderGeometry extends BufferGeometry {
31710
31932
 
31711
- constructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {
31933
+ constructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {
31712
31934
 
31713
31935
  super();
31714
31936
 
@@ -35054,15 +35276,9 @@
35054
35276
 
35055
35277
  }
35056
35278
 
35057
- clone() {
35058
-
35059
- return new this.constructor().copy( this );
35060
-
35061
- }
35062
-
35063
35279
  toJSON() {
35064
35280
 
35065
- const data = super.toJSON( this );
35281
+ const data = super.toJSON();
35066
35282
 
35067
35283
  data.instanceCount = this.instanceCount;
35068
35284
 
@@ -37100,10 +37316,14 @@
37100
37316
 
37101
37317
  var TWEEN$1 = exports$1;
37102
37318
 
37103
- var earcut$1 = {exports: {}};
37319
+ var earcutExports = {};
37320
+ var earcut$1 = {
37321
+ get exports(){ return earcutExports; },
37322
+ set exports(v){ earcutExports = v; },
37323
+ };
37104
37324
 
37105
37325
  earcut$1.exports = earcut;
37106
- earcut$1.exports.default = earcut;
37326
+ earcutExports.default = earcut;
37107
37327
 
37108
37328
  function earcut(data, holeIndices, dim) {
37109
37329
 
@@ -38557,7 +38777,8 @@
38557
38777
  }
38558
38778
 
38559
38779
  function rotationIdentity(lambda, phi) {
38560
- return [abs(lambda) > pi$1 ? lambda + Math.round(-lambda / tau$1) * tau$1 : lambda, phi];
38780
+ if (abs(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1;
38781
+ return [lambda, phi];
38561
38782
  }
38562
38783
 
38563
38784
  rotationIdentity.invert = rotationIdentity;
@@ -38571,7 +38792,9 @@
38571
38792
 
38572
38793
  function forwardRotationLambda(deltaLambda) {
38573
38794
  return function(lambda, phi) {
38574
- return lambda += deltaLambda, [lambda > pi$1 ? lambda - tau$1 : lambda < -pi$1 ? lambda + tau$1 : lambda, phi];
38795
+ lambda += deltaLambda;
38796
+ if (abs(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1;
38797
+ return [lambda, phi];
38575
38798
  };
38576
38799
  }
38577
38800
 
@@ -40488,7 +40711,7 @@
40488
40711
  return polar2Cartesian$2(lat, lng, r);
40489
40712
  });
40490
40713
 
40491
- var _earcut$flatten = earcut$1.exports.flatten([coords3d]),
40714
+ var _earcut$flatten = earcutExports.flatten([coords3d]),
40492
40715
  vertices = _earcut$flatten.vertices;
40493
40716
 
40494
40717
  var numPoints = Math.round(vertices.length / 3);
@@ -40531,7 +40754,7 @@
40531
40754
  });
40532
40755
  }); // Each point generates 3 vertice items (x,y,z).
40533
40756
 
40534
- var _earcut$flatten2 = earcut$1.exports.flatten(coords3d),
40757
+ var _earcut$flatten2 = earcutExports.flatten(coords3d),
40535
40758
  vertices = _earcut$flatten2.vertices,
40536
40759
  holes = _earcut$flatten2.holes;
40537
40760
 
@@ -41847,6 +42070,112 @@
41847
42070
 
41848
42071
  }
41849
42072
 
42073
+
42074
+ // Creates a new, non-indexed geometry with smooth normals everywhere except faces that meet at
42075
+ // an angle greater than the crease angle.
42076
+ function toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {
42077
+
42078
+ const creaseDot = Math.cos( creaseAngle );
42079
+ const hashMultiplier = ( 1 + 1e-10 ) * 1e2;
42080
+
42081
+ // reusable vertors
42082
+ const verts = [ new Vector3(), new Vector3(), new Vector3() ];
42083
+ const tempVec1 = new Vector3();
42084
+ const tempVec2 = new Vector3();
42085
+ const tempNorm = new Vector3();
42086
+ const tempNorm2 = new Vector3();
42087
+
42088
+ // hashes a vector
42089
+ function hashVertex( v ) {
42090
+
42091
+ const x = ~ ~ ( v.x * hashMultiplier );
42092
+ const y = ~ ~ ( v.y * hashMultiplier );
42093
+ const z = ~ ~ ( v.z * hashMultiplier );
42094
+ return `${x},${y},${z}`;
42095
+
42096
+ }
42097
+
42098
+ const resultGeometry = geometry.toNonIndexed();
42099
+ const posAttr = resultGeometry.attributes.position;
42100
+ const vertexMap = {};
42101
+
42102
+ // find all the normals shared by commonly located vertices
42103
+ for ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {
42104
+
42105
+ const i3 = 3 * i;
42106
+ const a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );
42107
+ const b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );
42108
+ const c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );
42109
+
42110
+ tempVec1.subVectors( c, b );
42111
+ tempVec2.subVectors( a, b );
42112
+
42113
+ // add the normal to the map for all vertices
42114
+ const normal = new Vector3().crossVectors( tempVec1, tempVec2 ).normalize();
42115
+ for ( let n = 0; n < 3; n ++ ) {
42116
+
42117
+ const vert = verts[ n ];
42118
+ const hash = hashVertex( vert );
42119
+ if ( ! ( hash in vertexMap ) ) {
42120
+
42121
+ vertexMap[ hash ] = [];
42122
+
42123
+ }
42124
+
42125
+ vertexMap[ hash ].push( normal );
42126
+
42127
+ }
42128
+
42129
+ }
42130
+
42131
+ // average normals from all vertices that share a common location if they are within the
42132
+ // provided crease threshold
42133
+ const normalArray = new Float32Array( posAttr.count * 3 );
42134
+ const normAttr = new BufferAttribute( normalArray, 3, false );
42135
+ for ( let i = 0, l = posAttr.count / 3; i < l; i ++ ) {
42136
+
42137
+ // get the face normal for this vertex
42138
+ const i3 = 3 * i;
42139
+ const a = verts[ 0 ].fromBufferAttribute( posAttr, i3 + 0 );
42140
+ const b = verts[ 1 ].fromBufferAttribute( posAttr, i3 + 1 );
42141
+ const c = verts[ 2 ].fromBufferAttribute( posAttr, i3 + 2 );
42142
+
42143
+ tempVec1.subVectors( c, b );
42144
+ tempVec2.subVectors( a, b );
42145
+
42146
+ tempNorm.crossVectors( tempVec1, tempVec2 ).normalize();
42147
+
42148
+ // average all normals that meet the threshold and set the normal value
42149
+ for ( let n = 0; n < 3; n ++ ) {
42150
+
42151
+ const vert = verts[ n ];
42152
+ const hash = hashVertex( vert );
42153
+ const otherNormals = vertexMap[ hash ];
42154
+ tempNorm2.set( 0, 0, 0 );
42155
+
42156
+ for ( let k = 0, lk = otherNormals.length; k < lk; k ++ ) {
42157
+
42158
+ const otherNorm = otherNormals[ k ];
42159
+ if ( tempNorm.dot( otherNorm ) > creaseDot ) {
42160
+
42161
+ tempNorm2.add( otherNorm );
42162
+
42163
+ }
42164
+
42165
+ }
42166
+
42167
+ tempNorm2.normalize();
42168
+ normAttr.setXYZ( i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z );
42169
+
42170
+ }
42171
+
42172
+ }
42173
+
42174
+ resultGeometry.setAttribute( 'normal', normAttr );
42175
+ return resultGeometry;
42176
+
42177
+ }
42178
+
41850
42179
  var _bfg = /*#__PURE__*/Object.freeze({
41851
42180
  __proto__: null,
41852
42181
  deepCloneAttribute: deepCloneAttribute,
@@ -41861,7 +42190,8 @@
41861
42190
  mergeVertices: mergeVertices,
41862
42191
  toTrianglesDrawMode: toTrianglesDrawMode,
41863
42192
  computeMorphedAttributes: computeMorphedAttributes,
41864
- mergeGroups: mergeGroups
42193
+ mergeGroups: mergeGroups,
42194
+ toCreasedNormals: toCreasedNormals
41865
42195
  });
41866
42196
 
41867
42197
  var index$1 = (function (p) {
@@ -41876,7 +42206,11 @@
41876
42206
 
41877
42207
  var accessorFn = index$1;
41878
42208
 
41879
- var tinycolor = {exports: {}};
42209
+ var tinycolorExports = {};
42210
+ var tinycolor = {
42211
+ get exports(){ return tinycolorExports; },
42212
+ set exports(v){ tinycolorExports = v; },
42213
+ };
41880
42214
 
41881
42215
  (function (module) {
41882
42216
  // TinyColor v1.4.2
@@ -43072,7 +43406,7 @@
43072
43406
  })(Math);
43073
43407
  } (tinycolor));
43074
43408
 
43075
- var tinyColor = tinycolor.exports;
43409
+ var tinyColor = tinycolorExports;
43076
43410
 
43077
43411
  function _objectWithoutPropertiesLoose$2(source, excluded) {
43078
43412
  if (source == null) return {};
@@ -43185,7 +43519,7 @@
43185
43519
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43186
43520
  }
43187
43521
 
43188
- function _toPrimitive(input, hint) {
43522
+ function _toPrimitive$3(input, hint) {
43189
43523
  if (typeof input !== "object" || input === null) return input;
43190
43524
  var prim = input[Symbol.toPrimitive];
43191
43525
 
@@ -43198,8 +43532,8 @@
43198
43532
  return (hint === "string" ? String : Number)(input);
43199
43533
  }
43200
43534
 
43201
- function _toPropertyKey(arg) {
43202
- var key = _toPrimitive(arg, "string");
43535
+ function _toPropertyKey$3(arg) {
43536
+ var key = _toPrimitive$3(arg, "string");
43203
43537
 
43204
43538
  return typeof key === "symbol" ? key : String(key);
43205
43539
  }
@@ -43226,7 +43560,7 @@
43226
43560
  if (isProp) {
43227
43561
  var _itemVal = itemVal,
43228
43562
  propVal = _itemVal[keyAccessor],
43229
- rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey));
43563
+ rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$3));
43230
43564
 
43231
43565
  key = propVal;
43232
43566
  itemVal = rest;
@@ -43607,13 +43941,17 @@
43607
43941
  }
43608
43942
  }
43609
43943
 
43610
- var FrameTicker$3 = {exports: {}};
43944
+ var FrameTickerExports = {};
43945
+ var FrameTicker$3 = {
43946
+ get exports(){ return FrameTickerExports; },
43947
+ set exports(v){ FrameTickerExports = v; },
43948
+ };
43611
43949
 
43612
43950
  (function (module, exports) {
43613
43951
  !function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){var n=i(1),r=function(){function e(e,t,i){void 0===e&&(e=NaN),void 0===t&&(t=NaN),void 0===i&&(i=!1),this._minFPS=t,this._maxFPS=e,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,i||this.resume();}return e.prototype.updateOnce=function(e){e(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick);},e.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce());},e.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle));},e.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll();},Object.defineProperty(e.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeScale",{get:function(){return this._timeScale},set:function(e){this._timeScale!==e&&(this._timeScale=e);},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),e.prototype.animateOnce=function(){var e=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return e.onFrame()});},e.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce();},e.prototype.update=function(e,t){void 0===t&&(t=!0),this._currentTick++,this._currentTime+=e,this._tickDeltaTime=e,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),t&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick);},e.prototype.getTimer=function(){return Date.now()},e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;},function(e,t,i){!function(t,i){e.exports=i();}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t){var i=function(){function e(){this.functions=[];}return e.prototype.add=function(e){return this.functions.indexOf(e)===-1&&(this.functions.push(e),!0)},e.prototype.remove=function(e){var t=this.functions.indexOf(e);return t>-1&&(this.functions.splice(t,1),!0)},e.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.functions.concat();i.forEach(function(t){t.apply(void 0,e);});},Object.defineProperty(e.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;}])});}])});
43614
43952
  } (FrameTicker$3));
43615
43953
 
43616
- var _FrameTicker = /*@__PURE__*/getDefaultExportFromCjs(FrameTicker$3.exports);
43954
+ var _FrameTicker = /*@__PURE__*/getDefaultExportFromCjs(FrameTickerExports);
43617
43955
 
43618
43956
  function initRange(domain, range) {
43619
43957
  switch (arguments.length) {
@@ -46947,6 +47285,33 @@
46947
47285
  return data ? v(data) : v;
46948
47286
  }
46949
47287
 
47288
+ function _iterableToArrayLimit$2(arr, i) {
47289
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
47290
+ if (null != _i) {
47291
+ var _s,
47292
+ _e,
47293
+ _x,
47294
+ _r,
47295
+ _arr = [],
47296
+ _n = !0,
47297
+ _d = !1;
47298
+ try {
47299
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
47300
+ if (Object(_i) !== _i) return;
47301
+ _n = !1;
47302
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
47303
+ } catch (err) {
47304
+ _d = !0, _e = err;
47305
+ } finally {
47306
+ try {
47307
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
47308
+ } finally {
47309
+ if (_d) throw _e;
47310
+ }
47311
+ }
47312
+ return _arr;
47313
+ }
47314
+ }
46950
47315
  function _classCallCheck$1(instance, Constructor) {
46951
47316
  if (!(instance instanceof Constructor)) {
46952
47317
  throw new TypeError("Cannot call a class as a function");
@@ -46958,7 +47323,7 @@
46958
47323
  descriptor.enumerable = descriptor.enumerable || false;
46959
47324
  descriptor.configurable = true;
46960
47325
  if ("value" in descriptor) descriptor.writable = true;
46961
- Object.defineProperty(target, descriptor.key, descriptor);
47326
+ Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
46962
47327
  }
46963
47328
  }
46964
47329
  function _createClass$1(Constructor, protoProps, staticProps) {
@@ -47052,30 +47417,6 @@
47052
47417
  function _iterableToArray$2(iter) {
47053
47418
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
47054
47419
  }
47055
- function _iterableToArrayLimit$2(arr, i) {
47056
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
47057
- if (_i == null) return;
47058
- var _arr = [];
47059
- var _n = true;
47060
- var _d = false;
47061
- var _s, _e;
47062
- try {
47063
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
47064
- _arr.push(_s.value);
47065
- if (i && _arr.length === i) break;
47066
- }
47067
- } catch (err) {
47068
- _d = true;
47069
- _e = err;
47070
- } finally {
47071
- try {
47072
- if (!_n && _i["return"] != null) _i["return"]();
47073
- } finally {
47074
- if (_d) throw _e;
47075
- }
47076
- }
47077
- return _arr;
47078
- }
47079
47420
  function _unsupportedIterableToArray$2(o, minLen) {
47080
47421
  if (!o) return;
47081
47422
  if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
@@ -47095,6 +47436,20 @@
47095
47436
  function _nonIterableRest$2() {
47096
47437
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
47097
47438
  }
47439
+ function _toPrimitive$2(input, hint) {
47440
+ if (typeof input !== "object" || input === null) return input;
47441
+ var prim = input[Symbol.toPrimitive];
47442
+ if (prim !== undefined) {
47443
+ var res = prim.call(input, hint || "default");
47444
+ if (typeof res !== "object") return res;
47445
+ throw new TypeError("@@toPrimitive must return a primitive value.");
47446
+ }
47447
+ return (hint === "string" ? String : Number)(input);
47448
+ }
47449
+ function _toPropertyKey$2(arg) {
47450
+ var key = _toPrimitive$2(arg, "string");
47451
+ return typeof key === "symbol" ? key : String(key);
47452
+ }
47098
47453
 
47099
47454
  function geoPolygonTriangulate(polygon) {
47100
47455
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
@@ -47155,42 +47510,40 @@
47155
47510
  });
47156
47511
  } else if (!innerPoints.length) {
47157
47512
  // earcut triangulation slightly more performing if it's only using the polygon perimeter
47158
- var _earcut$flatten = earcut$1.exports.flatten(contour),
47513
+ var _earcut$flatten = earcutExports.flatten(contour),
47159
47514
  vertices = _earcut$flatten.vertices,
47160
47515
  _earcut$flatten$holes = _earcut$flatten.holes,
47161
47516
  holes = _earcut$flatten$holes === void 0 ? [] : _earcut$flatten$holes;
47162
- indices = earcut$1.exports(vertices, holes, 2);
47517
+ indices = earcutExports(vertices, holes, 2);
47163
47518
  } else {
47164
- (function () {
47165
- // use delaunator
47166
- var delaunay = Delaunator.from(points);
47167
- var _loop = function _loop(i, len) {
47168
- var _indices2;
47169
- var inds = [2, 1, 0].map(function (idx) {
47170
- return delaunay.triangles[i + idx];
47171
- }); // reverse wound to have same orientation as earcut
47172
- var triangle = inds.map(function (indice) {
47173
- return points[indice];
47174
- });
47519
+ // use delaunator
47520
+ var delaunay = Delaunator.from(points);
47521
+ var _loop = function _loop(i) {
47522
+ var _indices2;
47523
+ var inds = [2, 1, 0].map(function (idx) {
47524
+ return delaunay.triangles[i + idx];
47525
+ }); // reverse wound to have same orientation as earcut
47526
+ var triangle = inds.map(function (indice) {
47527
+ return points[indice];
47528
+ });
47175
47529
 
47176
- // exclude edge triangles outside polygon perimeter or through holes
47177
- if (inds.some(function (ind) {
47178
- return ind < edgePoints.length;
47179
- })) {
47180
- var triangleCentroid = [0, 1].map(function (coordIdx) {
47181
- return mean(triangle, function (p) {
47182
- return p[coordIdx];
47183
- });
47530
+ // exclude edge triangles outside polygon perimeter or through holes
47531
+ if (inds.some(function (ind) {
47532
+ return ind < edgePoints.length;
47533
+ })) {
47534
+ var triangleCentroid = [0, 1].map(function (coordIdx) {
47535
+ return mean(triangle, function (p) {
47536
+ return p[coordIdx];
47184
47537
  });
47185
- if (!pointInside(triangleCentroid, boundariesGeojson, crossesPoleOrAntimeridian)) return "continue";
47186
- }
47187
- (_indices2 = indices).push.apply(_indices2, _toConsumableArray$2(inds));
47188
- };
47189
- for (var i = 0, len = delaunay.triangles.length; i < len; i += 3) {
47190
- var _ret = _loop(i);
47191
- if (_ret === "continue") continue;
47538
+ });
47539
+ if (!pointInside(triangleCentroid, boundariesGeojson, crossesPoleOrAntimeridian)) return "continue";
47192
47540
  }
47193
- })();
47541
+ (_indices2 = indices).push.apply(_indices2, _toConsumableArray$2(inds));
47542
+ };
47543
+ for (var i = 0, len = delaunay.triangles.length; i < len; i += 3) {
47544
+ var _ret = _loop(i);
47545
+ if (_ret === "continue") continue;
47546
+ }
47194
47547
  }
47195
47548
 
47196
47549
  // calc uvs
@@ -47391,7 +47744,7 @@
47391
47744
  });
47392
47745
  });
47393
47746
  // returns { vertices, holes, coordinates }. Each point generates 3 vertice items (x,y,z).
47394
- return earcut$1.exports.flatten(coords3d);
47747
+ return earcutExports.flatten(coords3d);
47395
47748
  }
47396
47749
  function generateTorso() {
47397
47750
  var _generateVertices = generateVertices(contour, startHeight),
@@ -47419,11 +47772,7 @@
47419
47772
  indices.push(v1Idx + numPoints, v1Idx, v0Idx);
47420
47773
  }
47421
47774
  var uvs = []; // wrap texture around perimeter (u), with v=1 on top
47422
- for (var v = 1; v >= 0; v--) {
47423
- for (var i = 0; i < numPoints; i += 1) {
47424
- uvs.push(i / (numPoints - 1), v);
47425
- }
47426
- }
47775
+ for (var v = 1; v >= 0; v--) for (var i = 0; i < numPoints; i += 1) uvs.push(i / (numPoints - 1), v);
47427
47776
  return {
47428
47777
  indices: indices,
47429
47778
  vertices: vertices,
@@ -61666,14 +62015,12 @@
61666
62015
  Sphere,
61667
62016
  Vector3,
61668
62017
  WireframeGeometry
61669
- }; // support multiple method names for backwards threejs compatibility
62018
+ };
61670
62019
 
62020
+ // support multiple method names for backwards threejs compatibility
61671
62021
  var setAttributeFn$1$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
61672
-
61673
62022
  const _box$1 = new THREE$2$1.Box3();
61674
-
61675
62023
  const _vector = new THREE$2$1.Vector3();
61676
-
61677
62024
  class LineSegmentsGeometry extends THREE$2$1.InstancedBufferGeometry {
61678
62025
  constructor() {
61679
62026
  super();
@@ -61685,37 +62032,29 @@
61685
62032
  this[setAttributeFn$1$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
61686
62033
  this[setAttributeFn$1$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
61687
62034
  }
61688
-
61689
62035
  applyMatrix4(matrix) {
61690
62036
  const start = this.attributes.instanceStart;
61691
62037
  const end = this.attributes.instanceEnd;
61692
-
61693
62038
  if (start !== undefined) {
61694
62039
  start.applyMatrix4(matrix);
61695
62040
  end.applyMatrix4(matrix);
61696
62041
  start.needsUpdate = true;
61697
62042
  }
61698
-
61699
62043
  if (this.boundingBox !== null) {
61700
62044
  this.computeBoundingBox();
61701
62045
  }
61702
-
61703
62046
  if (this.boundingSphere !== null) {
61704
62047
  this.computeBoundingSphere();
61705
62048
  }
61706
-
61707
62049
  return this;
61708
62050
  }
61709
-
61710
62051
  setPositions(array) {
61711
62052
  let lineSegments;
61712
-
61713
62053
  if (array instanceof Float32Array) {
61714
62054
  lineSegments = array;
61715
62055
  } else if (Array.isArray(array)) {
61716
62056
  lineSegments = new Float32Array(array);
61717
62057
  }
61718
-
61719
62058
  const instanceBuffer = new THREE$2$1.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz
61720
62059
 
61721
62060
  this[setAttributeFn$1$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
@@ -61727,16 +62066,13 @@
61727
62066
  this.computeBoundingSphere();
61728
62067
  return this;
61729
62068
  }
61730
-
61731
62069
  setColors(array) {
61732
62070
  let colors;
61733
-
61734
62071
  if (array instanceof Float32Array) {
61735
62072
  colors = array;
61736
62073
  } else if (Array.isArray(array)) {
61737
62074
  colors = new Float32Array(array);
61738
62075
  }
61739
-
61740
62076
  const instanceColorBuffer = new THREE$2$1.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb
61741
62077
 
61742
62078
  this[setAttributeFn$1$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
@@ -61745,26 +62081,21 @@
61745
62081
 
61746
62082
  return this;
61747
62083
  }
61748
-
61749
62084
  fromWireframeGeometry(geometry) {
61750
62085
  this.setPositions(geometry.attributes.position.array);
61751
62086
  return this;
61752
62087
  }
61753
-
61754
62088
  fromEdgesGeometry(geometry) {
61755
62089
  this.setPositions(geometry.attributes.position.array);
61756
62090
  return this;
61757
62091
  }
61758
-
61759
62092
  fromMesh(mesh) {
61760
62093
  this.fromWireframeGeometry(new THREE$2$1.WireframeGeometry(mesh.geometry)); // set colors, maybe
61761
62094
 
61762
62095
  return this;
61763
62096
  }
61764
-
61765
62097
  fromLineSegments(lineSegments) {
61766
62098
  const geometry = lineSegments.geometry;
61767
-
61768
62099
  if (geometry.isGeometry) {
61769
62100
  console.error('LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.');
61770
62101
  return;
@@ -61772,72 +62103,52 @@
61772
62103
  this.setPositions(geometry.attributes.position.array); // assumes non-indexed
61773
62104
  } // set colors, maybe
61774
62105
 
61775
-
61776
62106
  return this;
61777
62107
  }
61778
-
61779
62108
  computeBoundingBox() {
61780
62109
  if (this.boundingBox === null) {
61781
62110
  this.boundingBox = new THREE$2$1.Box3();
61782
62111
  }
61783
-
61784
62112
  const start = this.attributes.instanceStart;
61785
62113
  const end = this.attributes.instanceEnd;
61786
-
61787
62114
  if (start !== undefined && end !== undefined) {
61788
62115
  this.boundingBox.setFromBufferAttribute(start);
61789
-
61790
62116
  _box$1.setFromBufferAttribute(end);
61791
-
61792
62117
  this.boundingBox.union(_box$1);
61793
62118
  }
61794
62119
  }
61795
-
61796
62120
  computeBoundingSphere() {
61797
62121
  if (this.boundingSphere === null) {
61798
62122
  this.boundingSphere = new THREE$2$1.Sphere();
61799
62123
  }
61800
-
61801
62124
  if (this.boundingBox === null) {
61802
62125
  this.computeBoundingBox();
61803
62126
  }
61804
-
61805
62127
  const start = this.attributes.instanceStart;
61806
62128
  const end = this.attributes.instanceEnd;
61807
-
61808
62129
  if (start !== undefined && end !== undefined) {
61809
62130
  const center = this.boundingSphere.center;
61810
62131
  this.boundingBox.getCenter(center);
61811
62132
  let maxRadiusSq = 0;
61812
-
61813
62133
  for (let i = 0, il = start.count; i < il; i++) {
61814
62134
  _vector.fromBufferAttribute(start, i);
61815
-
61816
62135
  maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
61817
-
61818
62136
  _vector.fromBufferAttribute(end, i);
61819
-
61820
62137
  maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
61821
62138
  }
61822
-
61823
62139
  this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
61824
-
61825
62140
  if (isNaN(this.boundingSphere.radius)) {
61826
62141
  console.error('THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this);
61827
62142
  }
61828
62143
  }
61829
62144
  }
61830
-
61831
62145
  toJSON() {// todo
61832
62146
  }
61833
-
61834
62147
  applyMatrix(matrix) {
61835
62148
  console.warn('THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().');
61836
62149
  return this.applyMatrix4(matrix);
61837
62150
  }
61838
-
61839
62151
  }
61840
-
61841
62152
  LineSegmentsGeometry.prototype.isLineSegmentsGeometry = true;
61842
62153
 
61843
62154
  /**
@@ -61882,12 +62193,11 @@
61882
62193
  gapSize: {
61883
62194
  value: 1
61884
62195
  } // todo FIX - maybe change to totalSize
61885
-
61886
62196
  };
62197
+
61887
62198
  THREE$1$1.ShaderLib['line'] = {
61888
62199
  uniforms: THREE$1$1.UniformsUtils.merge([THREE$1$1.UniformsLib.common, THREE$1$1.UniformsLib.fog, THREE$1$1.UniformsLib.line]),
61889
- vertexShader:
61890
- /* glsl */
62200
+ vertexShader: /* glsl */
61891
62201
  `
61892
62202
  #include <common>
61893
62203
  #include <color_pars_vertex>
@@ -62097,8 +62407,7 @@
62097
62407
 
62098
62408
  }
62099
62409
  `,
62100
- fragmentShader:
62101
- /* glsl */
62410
+ fragmentShader: /* glsl */
62102
62411
  `
62103
62412
  uniform vec3 diffuse;
62104
62413
  uniform float opacity;
@@ -62247,7 +62556,6 @@
62247
62556
  }
62248
62557
  `
62249
62558
  };
62250
-
62251
62559
  class LineMaterial extends THREE$1$1.ShaderMaterial {
62252
62560
  constructor(parameters) {
62253
62561
  super({
@@ -62256,8 +62564,8 @@
62256
62564
  vertexShader: THREE$1$1.ShaderLib['line'].vertexShader,
62257
62565
  fragmentShader: THREE$1$1.ShaderLib['line'].fragmentShader,
62258
62566
  clipping: true // required for clipping support
62259
-
62260
62567
  });
62568
+
62261
62569
  Object.defineProperties(this, {
62262
62570
  color: {
62263
62571
  enumerable: true,
@@ -62295,19 +62603,16 @@
62295
62603
  get: function () {
62296
62604
  return Boolean('USE_DASH' in this.defines);
62297
62605
  },
62298
-
62299
62606
  set(value) {
62300
62607
  if (Boolean(value) !== Boolean('USE_DASH' in this.defines)) {
62301
62608
  this.needsUpdate = true;
62302
62609
  }
62303
-
62304
62610
  if (value === true) {
62305
62611
  this.defines.USE_DASH = '';
62306
62612
  } else {
62307
62613
  delete this.defines.USE_DASH;
62308
62614
  }
62309
62615
  }
62310
-
62311
62616
  },
62312
62617
  dashScale: {
62313
62618
  enumerable: true,
@@ -62372,7 +62677,6 @@
62372
62677
  if (Boolean(value) !== Boolean('ALPHA_TO_COVERAGE' in this.defines)) {
62373
62678
  this.needsUpdate = true;
62374
62679
  }
62375
-
62376
62680
  if (value === true) {
62377
62681
  this.defines.ALPHA_TO_COVERAGE = '';
62378
62682
  this.extensions.derivatives = true;
@@ -62385,9 +62689,7 @@
62385
62689
  });
62386
62690
  this.setValues(parameters);
62387
62691
  }
62388
-
62389
62692
  }
62390
-
62391
62693
  LineMaterial.prototype.isLineMaterial = true;
62392
62694
 
62393
62695
  const THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
@@ -62405,32 +62707,20 @@
62405
62707
  Vector4
62406
62708
  };
62407
62709
 
62710
+ // support both modes for backwards threejs compatibility
62408
62711
  var setAttributeFn$2 = new THREE$h.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
62409
-
62410
62712
  const _start = new THREE$h.Vector3();
62411
-
62412
62713
  const _end = new THREE$h.Vector3();
62413
-
62414
62714
  const _start4 = new THREE$h.Vector4();
62415
-
62416
62715
  const _end4 = new THREE$h.Vector4();
62417
-
62418
62716
  const _ssOrigin = new THREE$h.Vector4();
62419
-
62420
62717
  const _ssOrigin3 = new THREE$h.Vector3();
62421
-
62422
62718
  const _mvMatrix = new THREE$h.Matrix4();
62423
-
62424
62719
  const _line = new THREE$h.Line3();
62425
-
62426
62720
  const _closestPoint = new THREE$h.Vector3();
62427
-
62428
62721
  const _box = new THREE$h.Box3();
62429
-
62430
62722
  const _sphere = new THREE$h.Sphere();
62431
-
62432
62723
  const _clipToWorldVector = new THREE$h.Vector4();
62433
-
62434
62724
  class LineSegments2 extends THREE$h.Mesh {
62435
62725
  constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
62436
62726
  color: Math.random() * 0xffffff
@@ -62439,22 +62729,17 @@
62439
62729
  this.type = 'LineSegments2';
62440
62730
  } // for backwards-compatability, but could be a method of LineSegmentsGeometry...
62441
62731
 
62442
-
62443
62732
  computeLineDistances() {
62444
62733
  const geometry = this.geometry;
62445
62734
  const instanceStart = geometry.attributes.instanceStart;
62446
62735
  const instanceEnd = geometry.attributes.instanceEnd;
62447
62736
  const lineDistances = new Float32Array(2 * instanceStart.count);
62448
-
62449
62737
  for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
62450
62738
  _start.fromBufferAttribute(instanceStart, i);
62451
-
62452
62739
  _end.fromBufferAttribute(instanceEnd, i);
62453
-
62454
62740
  lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
62455
62741
  lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
62456
62742
  }
62457
-
62458
62743
  const instanceDistanceBuffer = new THREE$h.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
62459
62744
 
62460
62745
  geometry[setAttributeFn$2]('instanceDistanceStart', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
@@ -62463,12 +62748,10 @@
62463
62748
 
62464
62749
  return this;
62465
62750
  }
62466
-
62467
62751
  raycast(raycaster, intersects) {
62468
62752
  if (raycaster.camera === null) {
62469
62753
  console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');
62470
62754
  }
62471
-
62472
62755
  const threshold = raycaster.params.Line2 !== undefined ? raycaster.params.Line2.threshold || 0 : 0;
62473
62756
  const ray = raycaster.ray;
62474
62757
  const camera = raycaster.camera;
@@ -62490,42 +62773,30 @@
62490
62773
  if (geometry.boundingSphere === null) {
62491
62774
  geometry.computeBoundingSphere();
62492
62775
  }
62493
-
62494
62776
  _sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld);
62495
-
62496
62777
  const distanceToSphere = Math.max(camera.near, _sphere.distanceToPoint(ray.origin)); // get the w component to scale the world space line width
62497
62778
 
62498
62779
  _clipToWorldVector.set(0, 0, -distanceToSphere, 1.0).applyMatrix4(camera.projectionMatrix);
62499
-
62500
62780
  _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w);
62501
-
62502
62781
  _clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse); // increase the sphere bounds by the worst case line screen space width
62503
62782
 
62504
-
62505
62783
  const sphereMargin = Math.abs(ssMaxWidth / _clipToWorldVector.w) * 0.5;
62506
62784
  _sphere.radius += sphereMargin;
62507
-
62508
62785
  if (raycaster.ray.intersectsSphere(_sphere) === false) {
62509
62786
  return;
62510
62787
  } //
62511
62788
  // check if we intersect the box bounds
62512
62789
 
62513
-
62514
62790
  if (geometry.boundingBox === null) {
62515
62791
  geometry.computeBoundingBox();
62516
62792
  }
62517
-
62518
62793
  _box.copy(geometry.boundingBox).applyMatrix4(matrixWorld);
62519
-
62520
62794
  const distanceToBox = Math.max(camera.near, _box.distanceToPoint(ray.origin)); // get the w component to scale the world space line width
62521
62795
 
62522
62796
  _clipToWorldVector.set(0, 0, -distanceToBox, 1.0).applyMatrix4(camera.projectionMatrix);
62523
-
62524
62797
  _clipToWorldVector.multiplyScalar(1.0 / _clipToWorldVector.w);
62525
-
62526
62798
  _clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse); // increase the sphere bounds by the worst case line screen space width
62527
62799
 
62528
-
62529
62800
  const boxMargin = Math.abs(ssMaxWidth / _clipToWorldVector.w) * 0.5;
62530
62801
  _box.max.x += boxMargin;
62531
62802
  _box.max.y += boxMargin;
@@ -62533,7 +62804,6 @@
62533
62804
  _box.min.x -= boxMargin;
62534
62805
  _box.min.y -= boxMargin;
62535
62806
  _box.min.z -= boxMargin;
62536
-
62537
62807
  if (raycaster.ray.intersectsBox(_box) === false) {
62538
62808
  return;
62539
62809
  } //
@@ -62541,100 +62811,69 @@
62541
62811
  // sitting at the camera origin which will cause "w" to be 0 when
62542
62812
  // applying the projection matrix.
62543
62813
 
62544
-
62545
62814
  ray.at(1, _ssOrigin); // ndc space [ - 1.0, 1.0 ]
62546
62815
 
62547
62816
  _ssOrigin.w = 1;
62548
-
62549
62817
  _ssOrigin.applyMatrix4(camera.matrixWorldInverse);
62550
-
62551
62818
  _ssOrigin.applyMatrix4(projectionMatrix);
62552
-
62553
62819
  _ssOrigin.multiplyScalar(1 / _ssOrigin.w); // screen space
62554
62820
 
62555
-
62556
62821
  _ssOrigin.x *= resolution.x / 2;
62557
62822
  _ssOrigin.y *= resolution.y / 2;
62558
62823
  _ssOrigin.z = 0;
62559
-
62560
62824
  _ssOrigin3.copy(_ssOrigin);
62561
-
62562
62825
  _mvMatrix.multiplyMatrices(camera.matrixWorldInverse, matrixWorld);
62563
-
62564
62826
  for (let i = 0, l = instanceStart.count; i < l; i++) {
62565
62827
  _start4.fromBufferAttribute(instanceStart, i);
62566
-
62567
62828
  _end4.fromBufferAttribute(instanceEnd, i);
62568
-
62569
62829
  _start4.w = 1;
62570
62830
  _end4.w = 1; // camera space
62571
62831
 
62572
62832
  _start4.applyMatrix4(_mvMatrix);
62573
-
62574
62833
  _end4.applyMatrix4(_mvMatrix); // skip the segment if it's entirely behind the camera
62575
62834
 
62576
-
62577
62835
  var isBehindCameraNear = _start4.z > near && _end4.z > near;
62578
-
62579
62836
  if (isBehindCameraNear) {
62580
62837
  continue;
62581
62838
  } // trim the segment if it extends behind camera near
62582
62839
 
62583
-
62584
62840
  if (_start4.z > near) {
62585
62841
  const deltaDist = _start4.z - _end4.z;
62586
62842
  const t = (_start4.z - near) / deltaDist;
62587
-
62588
62843
  _start4.lerp(_end4, t);
62589
62844
  } else if (_end4.z > near) {
62590
62845
  const deltaDist = _end4.z - _start4.z;
62591
62846
  const t = (_end4.z - near) / deltaDist;
62592
-
62593
62847
  _end4.lerp(_start4, t);
62594
62848
  } // clip space
62595
62849
 
62596
-
62597
62850
  _start4.applyMatrix4(projectionMatrix);
62598
-
62599
62851
  _end4.applyMatrix4(projectionMatrix); // ndc space [ - 1.0, 1.0 ]
62600
62852
 
62601
-
62602
62853
  _start4.multiplyScalar(1 / _start4.w);
62603
-
62604
62854
  _end4.multiplyScalar(1 / _end4.w); // screen space
62605
62855
 
62606
-
62607
62856
  _start4.x *= resolution.x / 2;
62608
62857
  _start4.y *= resolution.y / 2;
62609
62858
  _end4.x *= resolution.x / 2;
62610
62859
  _end4.y *= resolution.y / 2; // create 2d segment
62611
62860
 
62612
62861
  _line.start.copy(_start4);
62613
-
62614
62862
  _line.start.z = 0;
62615
-
62616
62863
  _line.end.copy(_end4);
62617
-
62618
62864
  _line.end.z = 0; // get closest point on ray to segment
62619
62865
 
62620
62866
  const param = _line.closestPointToPointParameter(_ssOrigin3, true);
62621
-
62622
62867
  _line.at(param, _closestPoint); // check if the intersection point is within clip space
62623
62868
 
62624
-
62625
62869
  const zPos = THREE$h.MathUtils.lerp(_start4.z, _end4.z, param);
62626
62870
  const isInClipSpace = zPos >= -1 && zPos <= 1;
62627
62871
  const isInside = _ssOrigin3.distanceTo(_closestPoint) < lineWidth * 0.5;
62628
-
62629
62872
  if (isInClipSpace && isInside) {
62630
62873
  _line.start.fromBufferAttribute(instanceStart, i);
62631
-
62632
62874
  _line.end.fromBufferAttribute(instanceEnd, i);
62633
-
62634
62875
  _line.start.applyMatrix4(matrixWorld);
62635
-
62636
62876
  _line.end.applyMatrix4(matrixWorld);
62637
-
62638
62877
  const pointOnLine = new THREE$h.Vector3();
62639
62878
  const point = new THREE$h.Vector3();
62640
62879
  ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
@@ -62651,9 +62890,7 @@
62651
62890
  }
62652
62891
  }
62653
62892
  }
62654
-
62655
62893
  }
62656
-
62657
62894
  LineSegments2.prototype.LineSegments2 = true;
62658
62895
 
62659
62896
  class LineGeometry extends LineSegmentsGeometry {
@@ -62661,12 +62898,10 @@
62661
62898
  super();
62662
62899
  this.type = 'LineGeometry';
62663
62900
  }
62664
-
62665
62901
  setPositions(array) {
62666
62902
  // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format
62667
62903
  var length = array.length - 3;
62668
62904
  var points = new Float32Array(2 * length);
62669
-
62670
62905
  for (var i = 0; i < length; i += 3) {
62671
62906
  points[2 * i] = array[i];
62672
62907
  points[2 * i + 1] = array[i + 1];
@@ -62675,16 +62910,13 @@
62675
62910
  points[2 * i + 4] = array[i + 4];
62676
62911
  points[2 * i + 5] = array[i + 5];
62677
62912
  }
62678
-
62679
62913
  super.setPositions(points);
62680
62914
  return this;
62681
62915
  }
62682
-
62683
62916
  setColors(array) {
62684
62917
  // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format
62685
62918
  var length = array.length - 3;
62686
62919
  var colors = new Float32Array(2 * length);
62687
-
62688
62920
  for (var i = 0; i < length; i += 3) {
62689
62921
  colors[2 * i] = array[i];
62690
62922
  colors[2 * i + 1] = array[i + 1];
@@ -62693,14 +62925,11 @@
62693
62925
  colors[2 * i + 4] = array[i + 4];
62694
62926
  colors[2 * i + 5] = array[i + 5];
62695
62927
  }
62696
-
62697
62928
  super.setColors(colors);
62698
62929
  return this;
62699
62930
  }
62700
-
62701
62931
  fromLine(line) {
62702
62932
  var geometry = line.geometry;
62703
-
62704
62933
  if (geometry.isGeometry) {
62705
62934
  console.error('THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.');
62706
62935
  return;
@@ -62708,12 +62937,9 @@
62708
62937
  this.setPositions(geometry.attributes.position.array); // assumes non-indexed
62709
62938
  } // set colors, maybe
62710
62939
 
62711
-
62712
62940
  return this;
62713
62941
  }
62714
-
62715
62942
  }
62716
-
62717
62943
  LineGeometry.prototype.isLineGeometry = true;
62718
62944
 
62719
62945
  class Line2 extends LineSegments2 {
@@ -62723,9 +62949,7 @@
62723
62949
  super(geometry, material);
62724
62950
  this.type = 'Line2';
62725
62951
  }
62726
-
62727
62952
  }
62728
-
62729
62953
  Line2.prototype.isLine2 = true;
62730
62954
 
62731
62955
  /**
@@ -62921,6 +63145,33 @@
62921
63145
 
62922
63146
  }
62923
63147
 
63148
+ function _iterableToArrayLimit$1(arr, i) {
63149
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
63150
+ if (null != _i) {
63151
+ var _s,
63152
+ _e,
63153
+ _x,
63154
+ _r,
63155
+ _arr = [],
63156
+ _n = !0,
63157
+ _d = !1;
63158
+ try {
63159
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
63160
+ if (Object(_i) !== _i) return;
63161
+ _n = !1;
63162
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
63163
+ } catch (err) {
63164
+ _d = !0, _e = err;
63165
+ } finally {
63166
+ try {
63167
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
63168
+ } finally {
63169
+ if (_d) throw _e;
63170
+ }
63171
+ }
63172
+ return _arr;
63173
+ }
63174
+ }
62924
63175
  function ownKeys(object, enumerableOnly) {
62925
63176
  var keys = Object.keys(object);
62926
63177
  if (Object.getOwnPropertySymbols) {
@@ -62953,7 +63204,7 @@
62953
63204
  descriptor.enumerable = descriptor.enumerable || false;
62954
63205
  descriptor.configurable = true;
62955
63206
  if ("value" in descriptor) descriptor.writable = true;
62956
- Object.defineProperty(target, descriptor.key, descriptor);
63207
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
62957
63208
  }
62958
63209
  }
62959
63210
  function _createClass(Constructor, protoProps, staticProps) {
@@ -62965,6 +63216,7 @@
62965
63216
  return Constructor;
62966
63217
  }
62967
63218
  function _defineProperty$1(obj, key, value) {
63219
+ key = _toPropertyKey$1(key);
62968
63220
  if (key in obj) {
62969
63221
  Object.defineProperty(obj, key, {
62970
63222
  value: value,
@@ -63102,30 +63354,6 @@
63102
63354
  function _iterableToArray$1(iter) {
63103
63355
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
63104
63356
  }
63105
- function _iterableToArrayLimit$1(arr, i) {
63106
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
63107
- if (_i == null) return;
63108
- var _arr = [];
63109
- var _n = true;
63110
- var _d = false;
63111
- var _s, _e;
63112
- try {
63113
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
63114
- _arr.push(_s.value);
63115
- if (i && _arr.length === i) break;
63116
- }
63117
- } catch (err) {
63118
- _d = true;
63119
- _e = err;
63120
- } finally {
63121
- try {
63122
- if (!_n && _i["return"] != null) _i["return"]();
63123
- } finally {
63124
- if (_d) throw _e;
63125
- }
63126
- }
63127
- return _arr;
63128
- }
63129
63357
  function _unsupportedIterableToArray$1(o, minLen) {
63130
63358
  if (!o) return;
63131
63359
  if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
@@ -63145,6 +63373,20 @@
63145
63373
  function _nonIterableRest$1() {
63146
63374
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
63147
63375
  }
63376
+ function _toPrimitive$1(input, hint) {
63377
+ if (typeof input !== "object" || input === null) return input;
63378
+ var prim = input[Symbol.toPrimitive];
63379
+ if (prim !== undefined) {
63380
+ var res = prim.call(input, hint || "default");
63381
+ if (typeof res !== "object") return res;
63382
+ throw new TypeError("@@toPrimitive must return a primitive value.");
63383
+ }
63384
+ return (hint === "string" ? String : Number)(input);
63385
+ }
63386
+ function _toPropertyKey$1(arg) {
63387
+ var key = _toPrimitive$1(arg, "string");
63388
+ return typeof key === "symbol" ? key : String(key);
63389
+ }
63148
63390
 
63149
63391
  var materialDispose = function materialDispose(material) {
63150
63392
  if (material instanceof Array) {
@@ -64801,9 +65043,7 @@
64801
65043
  // fatline
64802
65044
  var offset = obj.material.dashOffset - step;
64803
65045
  var dashLength = obj.material.dashSize + obj.material.gapSize;
64804
- while (offset <= -dashLength) {
64805
- offset += dashLength;
64806
- } // cycle within dash length
65046
+ while (offset <= -dashLength) offset += dashLength; // cycle within dash length
64807
65047
  obj.material.dashOffset = offset;
64808
65048
  }
64809
65049
  });
@@ -64999,9 +65239,7 @@
64999
65239
  lineCoords.forEach(function (pnt) {
65000
65240
  if (prevPnt) {
65001
65241
  // cross the anti-meridian if that's the closest distance between points
65002
- while (Math.abs(prevPnt[1] - pnt[1]) > 180) {
65003
- prevPnt[1] += 360 * (prevPnt[1] < pnt[1] ? 1 : -1);
65004
- }
65242
+ while (Math.abs(prevPnt[1] - pnt[1]) > 180) prevPnt[1] += 360 * (prevPnt[1] < pnt[1] ? 1 : -1);
65005
65243
  var dist = Math.sqrt(Math.pow(pnt[0] - prevPnt[0], 2) + Math.pow(pnt[1] - prevPnt[1], 2));
65006
65244
  if (dist > maxDegDistance) {
65007
65245
  var numAdditionalPnts = Math.floor(dist / maxDegDistance);
@@ -67468,22 +67706,62 @@
67468
67706
  switch ( event.code ) {
67469
67707
 
67470
67708
  case scope.keys.UP:
67471
- pan( 0, scope.keyPanSpeed );
67709
+
67710
+ if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
67711
+
67712
+ rotateUp( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
67713
+
67714
+ } else {
67715
+
67716
+ pan( 0, scope.keyPanSpeed );
67717
+
67718
+ }
67719
+
67472
67720
  needsUpdate = true;
67473
67721
  break;
67474
67722
 
67475
67723
  case scope.keys.BOTTOM:
67476
- pan( 0, - scope.keyPanSpeed );
67724
+
67725
+ if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
67726
+
67727
+ rotateUp( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
67728
+
67729
+ } else {
67730
+
67731
+ pan( 0, - scope.keyPanSpeed );
67732
+
67733
+ }
67734
+
67477
67735
  needsUpdate = true;
67478
67736
  break;
67479
67737
 
67480
67738
  case scope.keys.LEFT:
67481
- pan( scope.keyPanSpeed, 0 );
67739
+
67740
+ if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
67741
+
67742
+ rotateLeft( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
67743
+
67744
+ } else {
67745
+
67746
+ pan( scope.keyPanSpeed, 0 );
67747
+
67748
+ }
67749
+
67482
67750
  needsUpdate = true;
67483
67751
  break;
67484
67752
 
67485
67753
  case scope.keys.RIGHT:
67486
- pan( - scope.keyPanSpeed, 0 );
67754
+
67755
+ if ( event.ctrlKey || event.metaKey || event.shiftKey ) {
67756
+
67757
+ rotateLeft( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );
67758
+
67759
+ } else {
67760
+
67761
+ pan( - scope.keyPanSpeed, 0 );
67762
+
67763
+ }
67764
+
67487
67765
  needsUpdate = true;
67488
67766
  break;
67489
67767
 
@@ -68439,15 +68717,15 @@
68439
68717
 
68440
68718
  // https://github.com/mrdoob/three.js/pull/21358
68441
68719
 
68442
- const _geometry$1 = new BufferGeometry();
68443
- _geometry$1.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
68444
- _geometry$1.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
68720
+ const _geometry = new BufferGeometry();
68721
+ _geometry.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
68722
+ _geometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
68445
68723
 
68446
68724
  class FullScreenQuad {
68447
68725
 
68448
68726
  constructor( material ) {
68449
68727
 
68450
- this._mesh = new Mesh( _geometry$1, material );
68728
+ this._mesh = new Mesh( _geometry, material );
68451
68729
 
68452
68730
  }
68453
68731
 
@@ -68679,20 +68957,6 @@
68679
68957
 
68680
68958
  this.passes = [];
68681
68959
 
68682
- // dependencies
68683
-
68684
- if ( CopyShader === undefined ) {
68685
-
68686
- console.error( 'THREE.EffectComposer relies on CopyShader' );
68687
-
68688
- }
68689
-
68690
- if ( ShaderPass === undefined ) {
68691
-
68692
- console.error( 'THREE.EffectComposer relies on ShaderPass' );
68693
-
68694
- }
68695
-
68696
68960
  this.copyPass = new ShaderPass( CopyShader );
68697
68961
 
68698
68962
  this.clock = new Clock();
@@ -68875,16 +69139,6 @@
68875
69139
 
68876
69140
  }
68877
69141
 
68878
- // Helper for passes that need to fill the viewport with a single quad.
68879
-
68880
- new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
68881
-
68882
- // https://github.com/mrdoob/three.js/pull/21358
68883
-
68884
- const _geometry = new BufferGeometry();
68885
- _geometry.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
68886
- _geometry.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
68887
-
68888
69142
  class RenderPass extends Pass {
68889
69143
 
68890
69144
  constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
@@ -69742,7 +69996,35 @@
69742
69996
  var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
69743
69997
  styleInject(css_248z);
69744
69998
 
69999
+ function _iterableToArrayLimit(arr, i) {
70000
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
70001
+ if (null != _i) {
70002
+ var _s,
70003
+ _e,
70004
+ _x,
70005
+ _r,
70006
+ _arr = [],
70007
+ _n = !0,
70008
+ _d = !1;
70009
+ try {
70010
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
70011
+ if (Object(_i) !== _i) return;
70012
+ _n = !1;
70013
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
70014
+ } catch (err) {
70015
+ _d = !0, _e = err;
70016
+ } finally {
70017
+ try {
70018
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
70019
+ } finally {
70020
+ if (_d) throw _e;
70021
+ }
70022
+ }
70023
+ return _arr;
70024
+ }
70025
+ }
69745
70026
  function _defineProperty(obj, key, value) {
70027
+ key = _toPropertyKey(key);
69746
70028
  if (key in obj) {
69747
70029
  Object.defineProperty(obj, key, {
69748
70030
  value: value,
@@ -69770,30 +70052,6 @@
69770
70052
  function _iterableToArray(iter) {
69771
70053
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
69772
70054
  }
69773
- function _iterableToArrayLimit(arr, i) {
69774
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
69775
- if (_i == null) return;
69776
- var _arr = [];
69777
- var _n = true;
69778
- var _d = false;
69779
- var _s, _e;
69780
- try {
69781
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
69782
- _arr.push(_s.value);
69783
- if (i && _arr.length === i) break;
69784
- }
69785
- } catch (err) {
69786
- _d = true;
69787
- _e = err;
69788
- } finally {
69789
- try {
69790
- if (!_n && _i["return"] != null) _i["return"]();
69791
- } finally {
69792
- if (_d) throw _e;
69793
- }
69794
- }
69795
- return _arr;
69796
- }
69797
70055
  function _unsupportedIterableToArray(o, minLen) {
69798
70056
  if (!o) return;
69799
70057
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -69813,6 +70071,20 @@
69813
70071
  function _nonIterableRest() {
69814
70072
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
69815
70073
  }
70074
+ function _toPrimitive(input, hint) {
70075
+ if (typeof input !== "object" || input === null) return input;
70076
+ var prim = input[Symbol.toPrimitive];
70077
+ if (prim !== undefined) {
70078
+ var res = prim.call(input, hint || "default");
70079
+ if (typeof res !== "object") return res;
70080
+ throw new TypeError("@@toPrimitive must return a primitive value.");
70081
+ }
70082
+ return (hint === "string" ? String : Number)(input);
70083
+ }
70084
+ function _toPropertyKey(arg) {
70085
+ var key = _toPrimitive(arg, "string");
70086
+ return typeof key === "symbol" ? key : String(key);
70087
+ }
69816
70088
 
69817
70089
  var three = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
69818
70090
  : {
@@ -70596,12 +70868,8 @@
70596
70868
  setCameraPos(finalGeoCoords);
70597
70869
  } else {
70598
70870
  // Avoid rotating more than 180deg longitude
70599
- while (curGeoCoords.lng - finalGeoCoords.lng > 180) {
70600
- curGeoCoords.lng -= 360;
70601
- }
70602
- while (curGeoCoords.lng - finalGeoCoords.lng < -180) {
70603
- curGeoCoords.lng += 360;
70604
- }
70871
+ while (curGeoCoords.lng - finalGeoCoords.lng > 180) curGeoCoords.lng -= 360;
70872
+ while (curGeoCoords.lng - finalGeoCoords.lng < -180) curGeoCoords.lng += 360;
70605
70873
  new TWEEN$1.Tween(curGeoCoords).to(finalGeoCoords, transitionDuration).easing(TWEEN$1.Easing.Cubic.InOut).onUpdate(setCameraPos).start();
70606
70874
  }
70607
70875
  return this;