globe.gl 2.29.2 → 2.30.0

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.29.2 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.30.0 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) :
@@ -35,26 +35,26 @@
35
35
  var css_248z$1 = ".scene-container .clickable {\n cursor: pointer;\n}";
36
36
  styleInject$1(css_248z$1);
37
37
 
38
- function ownKeys$2(object, enumerableOnly) {
39
- var keys = Object.keys(object);
38
+ function ownKeys$2(e, r) {
39
+ var t = Object.keys(e);
40
40
  if (Object.getOwnPropertySymbols) {
41
- var symbols = Object.getOwnPropertySymbols(object);
42
- enumerableOnly && (symbols = symbols.filter(function (sym) {
43
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
44
- })), keys.push.apply(keys, symbols);
41
+ var o = Object.getOwnPropertySymbols(e);
42
+ r && (o = o.filter(function (r) {
43
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
44
+ })), t.push.apply(t, o);
45
45
  }
46
- return keys;
47
- }
48
- function _objectSpread2$2(target) {
49
- for (var i = 1; i < arguments.length; i++) {
50
- var source = null != arguments[i] ? arguments[i] : {};
51
- i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
52
- _defineProperty$3(target, key, source[key]);
53
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
54
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
46
+ return t;
47
+ }
48
+ function _objectSpread2$2(e) {
49
+ for (var r = 1; r < arguments.length; r++) {
50
+ var t = null != arguments[r] ? arguments[r] : {};
51
+ r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) {
52
+ _defineProperty$3(e, r, t[r]);
53
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
54
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
55
55
  });
56
56
  }
57
- return target;
57
+ return e;
58
58
  }
59
59
  function _defineProperty$3(obj, key, value) {
60
60
  key = _toPropertyKey$7(key);
@@ -142,7 +142,7 @@
142
142
  * Copyright 2010-2023 Three.js Authors
143
143
  * SPDX-License-Identifier: MIT
144
144
  */
145
- const REVISION = '155';
145
+ const REVISION = '157';
146
146
 
147
147
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
148
148
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -259,6 +259,8 @@
259
259
  const RGBA_ASTC_12x10_Format = 37820;
260
260
  const RGBA_ASTC_12x12_Format = 37821;
261
261
  const RGBA_BPTC_Format = 36492;
262
+ const RGB_BPTC_SIGNED_Format = 36494;
263
+ const RGB_BPTC_UNSIGNED_Format = 36495;
262
264
  const RED_RGTC1_Format = 36283;
263
265
  const SIGNED_RED_RGTC1_Format = 36284;
264
266
  const RED_GREEN_RGTC2_Format = 36285;
@@ -280,6 +282,13 @@
280
282
  const SRGBColorSpace = 'srgb';
281
283
  const LinearSRGBColorSpace = 'srgb-linear';
282
284
  const DisplayP3ColorSpace = 'display-p3';
285
+ const LinearDisplayP3ColorSpace = 'display-p3-linear';
286
+
287
+ const LinearTransfer = 'linear';
288
+ const SRGBTransfer = 'srgb';
289
+
290
+ const Rec709Primaries = 'rec709';
291
+ const P3Primaries = 'p3';
283
292
  const KeepStencilOp = 7680;
284
293
  const AlwaysStencilFunc = 519;
285
294
 
@@ -1014,8 +1023,8 @@
1014
1023
 
1015
1024
  roundToZero() {
1016
1025
 
1017
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
1018
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
1026
+ this.x = Math.trunc( this.x );
1027
+ this.y = Math.trunc( this.y );
1019
1028
 
1020
1029
  return this;
1021
1030
 
@@ -1605,6 +1614,14 @@
1605
1614
 
1606
1615
  }
1607
1616
 
1617
+ function createCanvasElement() {
1618
+
1619
+ const canvas = createElementNS( 'canvas' );
1620
+ canvas.style.display = 'block';
1621
+ return canvas;
1622
+
1623
+ }
1624
+
1608
1625
  const _cache = {};
1609
1626
 
1610
1627
  function warnOnce( message ) {
@@ -1617,18 +1634,6 @@
1617
1634
 
1618
1635
  }
1619
1636
 
1620
- function SRGBToLinear( c ) {
1621
-
1622
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1623
-
1624
- }
1625
-
1626
- function LinearToSRGB( c ) {
1627
-
1628
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1629
-
1630
- }
1631
-
1632
1637
  /**
1633
1638
  * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
1634
1639
  * or clipping. Based on W3C specifications for sRGB and Display P3,
@@ -1641,50 +1646,57 @@
1641
1646
  * - http://www.russellcottrell.com/photo/matrixCalculator.htm
1642
1647
  */
1643
1648
 
1644
- const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [
1645
- 0.8224621, 0.0331941, 0.0170827,
1646
- 0.1775380, 0.9668058, 0.0723974,
1647
- - 0.0000001, 0.0000001, 0.9105199
1648
- ] );
1649
-
1650
- const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
1651
- 1.2249401, - 0.0420569, - 0.0196376,
1652
- - 0.2249404, 1.0420571, - 0.0786361,
1653
- 0.0000001, 0.0000000, 1.0982735
1654
- ] );
1655
-
1656
- function DisplayP3ToLinearSRGB( color ) {
1657
-
1658
- // Display P3 uses the sRGB transfer functions
1659
- return color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );
1660
-
1661
- }
1662
-
1663
- function LinearSRGBToDisplayP3( color ) {
1664
-
1665
- // Display P3 uses the sRGB transfer functions
1666
- return color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB();
1649
+ const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(
1650
+ 0.8224621, 0.177538, 0.0,
1651
+ 0.0331941, 0.9668058, 0.0,
1652
+ 0.0170827, 0.0723974, 0.9105199,
1653
+ );
1667
1654
 
1668
- }
1655
+ const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(
1656
+ 1.2249401, - 0.2249404, 0.0,
1657
+ - 0.0420569, 1.0420571, 0.0,
1658
+ - 0.0196376, - 0.0786361, 1.0982735
1659
+ );
1669
1660
 
1670
- // Conversions from <source> to Linear-sRGB reference space.
1671
- const TO_LINEAR = {
1672
- [ LinearSRGBColorSpace ]: ( color ) => color,
1673
- [ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),
1674
- [ DisplayP3ColorSpace ]: DisplayP3ToLinearSRGB,
1661
+ /**
1662
+ * Defines supported color spaces by transfer function and primaries,
1663
+ * and provides conversions to/from the Linear-sRGB reference space.
1664
+ */
1665
+ const COLOR_SPACES = {
1666
+ [ LinearSRGBColorSpace ]: {
1667
+ transfer: LinearTransfer,
1668
+ primaries: Rec709Primaries,
1669
+ toReference: ( color ) => color,
1670
+ fromReference: ( color ) => color,
1671
+ },
1672
+ [ SRGBColorSpace ]: {
1673
+ transfer: SRGBTransfer,
1674
+ primaries: Rec709Primaries,
1675
+ toReference: ( color ) => color.convertSRGBToLinear(),
1676
+ fromReference: ( color ) => color.convertLinearToSRGB(),
1677
+ },
1678
+ [ LinearDisplayP3ColorSpace ]: {
1679
+ transfer: LinearTransfer,
1680
+ primaries: P3Primaries,
1681
+ toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1682
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
1683
+ },
1684
+ [ DisplayP3ColorSpace ]: {
1685
+ transfer: SRGBTransfer,
1686
+ primaries: P3Primaries,
1687
+ toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1688
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
1689
+ },
1675
1690
  };
1676
1691
 
1677
- // Conversions to <target> from Linear-sRGB reference space.
1678
- const FROM_LINEAR = {
1679
- [ LinearSRGBColorSpace ]: ( color ) => color,
1680
- [ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
1681
- [ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
1682
- };
1692
+ const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
1683
1693
 
1684
1694
  const ColorManagement = {
1685
1695
 
1686
1696
  enabled: true,
1687
1697
 
1698
+ _workingColorSpace: LinearSRGBColorSpace,
1699
+
1688
1700
  get legacyMode() {
1689
1701
 
1690
1702
  console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
@@ -1703,13 +1715,19 @@
1703
1715
 
1704
1716
  get workingColorSpace() {
1705
1717
 
1706
- return LinearSRGBColorSpace;
1718
+ return this._workingColorSpace;
1707
1719
 
1708
1720
  },
1709
1721
 
1710
1722
  set workingColorSpace( colorSpace ) {
1711
1723
 
1712
- console.warn( 'THREE.ColorManagement: .workingColorSpace is readonly.' );
1724
+ if ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {
1725
+
1726
+ throw new Error( `Unsupported working color space, "${ colorSpace }".` );
1727
+
1728
+ }
1729
+
1730
+ this._workingColorSpace = colorSpace;
1713
1731
 
1714
1732
  },
1715
1733
 
@@ -1721,33 +1739,54 @@
1721
1739
 
1722
1740
  }
1723
1741
 
1724
- const sourceToLinear = TO_LINEAR[ sourceColorSpace ];
1725
- const targetFromLinear = FROM_LINEAR[ targetColorSpace ];
1742
+ const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
1743
+ const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
1726
1744
 
1727
- if ( sourceToLinear === undefined || targetFromLinear === undefined ) {
1745
+ return targetFromReference( sourceToReference( color ) );
1728
1746
 
1729
- throw new Error( `Unsupported color space conversion, "${ sourceColorSpace }" to "${ targetColorSpace }".` );
1747
+ },
1730
1748
 
1731
- }
1749
+ fromWorkingColorSpace: function ( color, targetColorSpace ) {
1732
1750
 
1733
- return targetFromLinear( sourceToLinear( color ) );
1751
+ return this.convert( color, this._workingColorSpace, targetColorSpace );
1734
1752
 
1735
1753
  },
1736
1754
 
1737
- fromWorkingColorSpace: function ( color, targetColorSpace ) {
1755
+ toWorkingColorSpace: function ( color, sourceColorSpace ) {
1738
1756
 
1739
- return this.convert( color, this.workingColorSpace, targetColorSpace );
1757
+ return this.convert( color, sourceColorSpace, this._workingColorSpace );
1740
1758
 
1741
1759
  },
1742
1760
 
1743
- toWorkingColorSpace: function ( color, sourceColorSpace ) {
1761
+ getPrimaries: function ( colorSpace ) {
1762
+
1763
+ return COLOR_SPACES[ colorSpace ].primaries;
1764
+
1765
+ },
1766
+
1767
+ getTransfer: function ( colorSpace ) {
1768
+
1769
+ if ( colorSpace === NoColorSpace ) return LinearTransfer;
1744
1770
 
1745
- return this.convert( color, sourceColorSpace, this.workingColorSpace );
1771
+ return COLOR_SPACES[ colorSpace ].transfer;
1746
1772
 
1747
1773
  },
1748
1774
 
1749
1775
  };
1750
1776
 
1777
+
1778
+ function SRGBToLinear( c ) {
1779
+
1780
+ return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1781
+
1782
+ }
1783
+
1784
+ function LinearToSRGB( c ) {
1785
+
1786
+ return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1787
+
1788
+ }
1789
+
1751
1790
  let _canvas;
1752
1791
 
1753
1792
  class ImageUtils {
@@ -1873,7 +1912,7 @@
1873
1912
 
1874
1913
  }
1875
1914
 
1876
- let sourceId = 0;
1915
+ let _sourceId = 0;
1877
1916
 
1878
1917
  class Source {
1879
1918
 
@@ -1881,7 +1920,7 @@
1881
1920
 
1882
1921
  this.isSource = true;
1883
1922
 
1884
- Object.defineProperty( this, 'id', { value: sourceId ++ } );
1923
+ Object.defineProperty( this, 'id', { value: _sourceId ++ } );
1885
1924
 
1886
1925
  this.uuid = generateUUID();
1887
1926
 
@@ -1996,7 +2035,7 @@
1996
2035
 
1997
2036
  }
1998
2037
 
1999
- let textureId = 0;
2038
+ let _textureId = 0;
2000
2039
 
2001
2040
  class Texture extends EventDispatcher {
2002
2041
 
@@ -2006,7 +2045,7 @@
2006
2045
 
2007
2046
  this.isTexture = true;
2008
2047
 
2009
- Object.defineProperty( this, 'id', { value: textureId ++ } );
2048
+ Object.defineProperty( this, 'id', { value: _textureId ++ } );
2010
2049
 
2011
2050
  this.uuid = generateUUID();
2012
2051
 
@@ -2816,10 +2855,10 @@
2816
2855
 
2817
2856
  roundToZero() {
2818
2857
 
2819
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
2820
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
2821
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
2822
- this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
2858
+ this.x = Math.trunc( this.x );
2859
+ this.y = Math.trunc( this.y );
2860
+ this.z = Math.trunc( this.z );
2861
+ this.w = Math.trunc( this.w );
2823
2862
 
2824
2863
  return this;
2825
2864
 
@@ -2987,20 +3026,29 @@
2987
3026
 
2988
3027
  }
2989
3028
 
3029
+ options = Object.assign( {
3030
+ generateMipmaps: false,
3031
+ internalFormat: null,
3032
+ minFilter: LinearFilter,
3033
+ depthBuffer: true,
3034
+ stencilBuffer: false,
3035
+ depthTexture: null,
3036
+ samples: 0
3037
+ }, options );
3038
+
2990
3039
  this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2991
3040
  this.texture.isRenderTargetTexture = true;
2992
3041
 
2993
3042
  this.texture.flipY = false;
2994
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
2995
- this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
2996
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
3043
+ this.texture.generateMipmaps = options.generateMipmaps;
3044
+ this.texture.internalFormat = options.internalFormat;
2997
3045
 
2998
- this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
2999
- this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
3046
+ this.depthBuffer = options.depthBuffer;
3047
+ this.stencilBuffer = options.stencilBuffer;
3000
3048
 
3001
- this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
3049
+ this.depthTexture = options.depthTexture;
3002
3050
 
3003
- this.samples = options.samples !== undefined ? options.samples : 0;
3051
+ this.samples = options.samples;
3004
3052
 
3005
3053
  }
3006
3054
 
@@ -4212,9 +4260,9 @@
4212
4260
 
4213
4261
  roundToZero() {
4214
4262
 
4215
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
4216
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
4217
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
4263
+ this.x = Math.trunc( this.x );
4264
+ this.y = Math.trunc( this.y );
4265
+ this.z = Math.trunc( this.z );
4218
4266
 
4219
4267
  return this;
4220
4268
 
@@ -4961,16 +5009,16 @@
4961
5009
  if ( this.isEmpty() ) return this;
4962
5010
 
4963
5011
  // NOTE: I am using a binary pattern to specify all 2^3 combinations below
4964
- _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
4965
- _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
4966
- _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
4967
- _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
4968
- _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
4969
- _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
4970
- _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
4971
- _points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
5012
+ _points$1[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
5013
+ _points$1[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
5014
+ _points$1[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
5015
+ _points$1[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
5016
+ _points$1[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
5017
+ _points$1[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
5018
+ _points$1[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
5019
+ _points$1[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
4972
5020
 
4973
- this.setFromPoints( _points );
5021
+ this.setFromPoints( _points$1 );
4974
5022
 
4975
5023
  return this;
4976
5024
 
@@ -4993,7 +5041,7 @@
4993
5041
 
4994
5042
  }
4995
5043
 
4996
- const _points = [
5044
+ const _points$1 = [
4997
5045
  /*@__PURE__*/ new Vector3(),
4998
5046
  /*@__PURE__*/ new Vector3(),
4999
5047
  /*@__PURE__*/ new Vector3(),
@@ -7444,20 +7492,7 @@
7444
7492
 
7445
7493
  clear() {
7446
7494
 
7447
- for ( let i = 0; i < this.children.length; i ++ ) {
7448
-
7449
- const object = this.children[ i ];
7450
-
7451
- object.parent = null;
7452
-
7453
- object.dispatchEvent( _removedEvent );
7454
-
7455
- }
7456
-
7457
- this.children.length = 0;
7458
-
7459
- return this;
7460
-
7495
+ return this.remove( ... this.children );
7461
7496
 
7462
7497
  }
7463
7498
 
@@ -8348,7 +8383,7 @@
8348
8383
 
8349
8384
  }
8350
8385
 
8351
- let materialId = 0;
8386
+ let _materialId = 0;
8352
8387
 
8353
8388
  class Material extends EventDispatcher {
8354
8389
 
@@ -8358,7 +8393,7 @@
8358
8393
 
8359
8394
  this.isMaterial = true;
8360
8395
 
8361
- Object.defineProperty( this, 'id', { value: materialId ++ } );
8396
+ Object.defineProperty( this, 'id', { value: _materialId ++ } );
8362
8397
 
8363
8398
  this.uuid = generateUUID();
8364
8399
 
@@ -8666,10 +8701,10 @@
8666
8701
 
8667
8702
  if ( this.blending !== NormalBlending ) data.blending = this.blending;
8668
8703
  if ( this.side !== FrontSide ) data.side = this.side;
8669
- if ( this.vertexColors ) data.vertexColors = true;
8704
+ if ( this.vertexColors === true ) data.vertexColors = true;
8670
8705
 
8671
8706
  if ( this.opacity < 1 ) data.opacity = this.opacity;
8672
- if ( this.transparent === true ) data.transparent = this.transparent;
8707
+ if ( this.transparent === true ) data.transparent = true;
8673
8708
 
8674
8709
  data.depthFunc = this.depthFunc;
8675
8710
  data.depthTest = this.depthTest;
@@ -8700,17 +8735,17 @@
8700
8735
  if ( this.dithering === true ) data.dithering = true;
8701
8736
 
8702
8737
  if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
8703
- if ( this.alphaHash === true ) data.alphaHash = this.alphaHash;
8704
- if ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;
8705
- if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
8706
- if ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;
8738
+ if ( this.alphaHash === true ) data.alphaHash = true;
8739
+ if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
8740
+ if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
8741
+ if ( this.forceSinglePass === true ) data.forceSinglePass = true;
8707
8742
 
8708
- if ( this.wireframe === true ) data.wireframe = this.wireframe;
8743
+ if ( this.wireframe === true ) data.wireframe = true;
8709
8744
  if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
8710
8745
  if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
8711
8746
  if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
8712
8747
 
8713
- if ( this.flatShading === true ) data.flatShading = this.flatShading;
8748
+ if ( this.flatShading === true ) data.flatShading = true;
8714
8749
 
8715
8750
  if ( this.visible === false ) data.visible = false;
8716
8751
 
@@ -9291,11 +9326,7 @@
9291
9326
 
9292
9327
  this.getHSL( _hslA );
9293
9328
 
9294
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
9295
-
9296
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
9297
-
9298
- return this;
9329
+ return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
9299
9330
 
9300
9331
  }
9301
9332
 
@@ -9944,7 +9975,7 @@
9944
9975
 
9945
9976
  }
9946
9977
 
9947
- let _id$1 = 0;
9978
+ let _id$2 = 0;
9948
9979
 
9949
9980
  const _m1 = /*@__PURE__*/ new Matrix4();
9950
9981
  const _obj = /*@__PURE__*/ new Object3D();
@@ -9961,7 +9992,7 @@
9961
9992
 
9962
9993
  this.isBufferGeometry = true;
9963
9994
 
9964
- Object.defineProperty( this, 'id', { value: _id$1 ++ } );
9995
+ Object.defineProperty( this, 'id', { value: _id$2 ++ } );
9965
9996
 
9966
9997
  this.uuid = generateUUID();
9967
9998
 
@@ -11066,7 +11097,7 @@
11066
11097
 
11067
11098
  }
11068
11099
 
11069
- this.material = source.material;
11100
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
11070
11101
  this.geometry = source.geometry;
11071
11102
 
11072
11103
  return this;
@@ -11695,7 +11726,7 @@
11695
11726
 
11696
11727
  }
11697
11728
 
11698
- return LinearSRGBColorSpace;
11729
+ return ColorManagement.workingColorSpace;
11699
11730
 
11700
11731
  }
11701
11732
 
@@ -11923,11 +11954,7 @@
11923
11954
 
11924
11955
  getWorldDirection( target ) {
11925
11956
 
11926
- this.updateWorldMatrix( true, false );
11927
-
11928
- const e = this.matrixWorld.elements;
11929
-
11930
- return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
11957
+ return super.getWorldDirection( target ).negate();
11931
11958
 
11932
11959
  }
11933
11960
 
@@ -12197,6 +12224,7 @@
12197
12224
 
12198
12225
  this.renderTarget = renderTarget;
12199
12226
  this.coordinateSystem = null;
12227
+ this.activeMipmapLevel = 0;
12200
12228
 
12201
12229
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
12202
12230
  cameraPX.layers = this.layers;
@@ -12294,7 +12322,7 @@
12294
12322
 
12295
12323
  if ( this.parent === null ) this.updateMatrixWorld();
12296
12324
 
12297
- const renderTarget = this.renderTarget;
12325
+ const { renderTarget, activeMipmapLevel } = this;
12298
12326
 
12299
12327
  if ( this.coordinateSystem !== renderer.coordinateSystem ) {
12300
12328
 
@@ -12307,6 +12335,8 @@
12307
12335
  const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
12308
12336
 
12309
12337
  const currentRenderTarget = renderer.getRenderTarget();
12338
+ const currentActiveCubeFace = renderer.getActiveCubeFace();
12339
+ const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();
12310
12340
 
12311
12341
  const currentXrEnabled = renderer.xr.enabled;
12312
12342
 
@@ -12316,27 +12346,30 @@
12316
12346
 
12317
12347
  renderTarget.texture.generateMipmaps = false;
12318
12348
 
12319
- renderer.setRenderTarget( renderTarget, 0 );
12349
+ renderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );
12320
12350
  renderer.render( scene, cameraPX );
12321
12351
 
12322
- renderer.setRenderTarget( renderTarget, 1 );
12352
+ renderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );
12323
12353
  renderer.render( scene, cameraNX );
12324
12354
 
12325
- renderer.setRenderTarget( renderTarget, 2 );
12355
+ renderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );
12326
12356
  renderer.render( scene, cameraPY );
12327
12357
 
12328
- renderer.setRenderTarget( renderTarget, 3 );
12358
+ renderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );
12329
12359
  renderer.render( scene, cameraNY );
12330
12360
 
12331
- renderer.setRenderTarget( renderTarget, 4 );
12361
+ renderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );
12332
12362
  renderer.render( scene, cameraPZ );
12333
12363
 
12364
+ // mipmaps are generated during the last call of render()
12365
+ // at this point, all sides of the cube render target are defined
12366
+
12334
12367
  renderTarget.texture.generateMipmaps = generateMipmaps;
12335
12368
 
12336
- renderer.setRenderTarget( renderTarget, 5 );
12369
+ renderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );
12337
12370
  renderer.render( scene, cameraNZ );
12338
12371
 
12339
- renderer.setRenderTarget( currentRenderTarget );
12372
+ renderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
12340
12373
 
12341
12374
  renderer.xr.enabled = currentXrEnabled;
12342
12375
 
@@ -13250,7 +13283,7 @@
13250
13283
 
13251
13284
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13252
13285
 
13253
- var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
13286
+ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
13254
13287
 
13255
13288
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13256
13289
 
@@ -13280,7 +13313,7 @@
13280
13313
 
13281
13314
  var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
13282
13315
 
13283
- 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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13316
+ 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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13284
13317
 
13285
13318
  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";
13286
13319
 
@@ -13296,7 +13329,7 @@
13296
13329
 
13297
13330
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13298
13331
 
13299
- var colorspace_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
13332
+ var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}";
13300
13333
 
13301
13334
  var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13302
13335
 
@@ -13324,29 +13357,29 @@
13324
13357
 
13325
13358
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
13326
13359
 
13327
- 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";
13360
+ 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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";
13328
13361
 
13329
- 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 ( LEGACY_LIGHTS )\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#else\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#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";
13362
+ var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\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 ( LEGACY_LIGHTS )\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#else\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#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, 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 vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\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 vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\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";
13330
13363
 
13331
13364
  var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13332
13365
 
13333
13366
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13334
13367
 
13335
- 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";
13368
+ var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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";
13336
13369
 
13337
13370
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
13338
13371
 
13339
- 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";
13372
+ 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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";
13340
13373
 
13341
- 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 USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\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, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).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_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13374
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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 USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\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, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).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_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13342
13375
 
13343
- 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\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\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_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\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\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\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}";
13376
+ 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\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, 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( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, 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}";
13344
13377
 
13345
- 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";
13378
+ var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\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, geometryPosition, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\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 ], geometryNormal );\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";
13346
13379
 
13347
- var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\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\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13380
+ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\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( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13348
13381
 
13349
- var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif";
13382
+ var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
13350
13383
 
13351
13384
  var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13352
13385
 
@@ -13356,7 +13389,7 @@
13356
13389
 
13357
13390
  var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13358
13391
 
13359
- var map_fragment = "#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif";
13392
+ var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13360
13393
 
13361
13394
  var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
13362
13395
 
@@ -13376,7 +13409,7 @@
13376
13409
 
13377
13410
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
13378
13411
 
13379
- var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
13412
+ var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
13380
13413
 
13381
13414
  var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
13382
13415
 
@@ -13388,7 +13421,7 @@
13388
13421
 
13389
13422
  var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
13390
13423
 
13391
- var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
13424
+ var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";
13392
13425
 
13393
13426
  var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";
13394
13427
 
@@ -13450,7 +13483,7 @@
13450
13483
 
13451
13484
  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}";
13452
13485
 
13453
- const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13486
+ 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 <colorspace_fragment>\n}";
13454
13487
 
13455
13488
  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}";
13456
13489
 
@@ -13498,7 +13531,7 @@
13498
13531
 
13499
13532
  const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13500
13533
 
13501
- const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13534
+ const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13502
13535
 
13503
13536
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13504
13537
 
@@ -14270,24 +14303,15 @@
14270
14303
 
14271
14304
  }
14272
14305
 
14273
- const xr = renderer.xr;
14274
- const environmentBlendMode = xr.getEnvironmentBlendMode();
14306
+ const environmentBlendMode = renderer.xr.getEnvironmentBlendMode();
14275
14307
 
14276
- switch ( environmentBlendMode ) {
14308
+ if ( environmentBlendMode === 'additive' ) {
14277
14309
 
14278
- case 'opaque':
14279
- forceClear = true;
14280
- break;
14310
+ state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14281
14311
 
14282
- case 'additive':
14283
- state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14284
- forceClear = true;
14285
- break;
14312
+ } else if ( environmentBlendMode === 'alpha-blend' ) {
14286
14313
 
14287
- case 'alpha-blend':
14288
- state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14289
- forceClear = true;
14290
- break;
14314
+ state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14291
14315
 
14292
14316
  }
14293
14317
 
@@ -14343,7 +14367,7 @@
14343
14367
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14344
14368
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14345
14369
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14346
- boxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14370
+ boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14347
14371
 
14348
14372
  if ( currentBackground !== background ||
14349
14373
  currentBackgroundVersion !== background.version ||
@@ -14399,7 +14423,7 @@
14399
14423
 
14400
14424
  planeMesh.material.uniforms.t2D.value = background;
14401
14425
  planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14402
- planeMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14426
+ planeMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14403
14427
 
14404
14428
  if ( background.matrixAutoUpdate === true ) {
14405
14429
 
@@ -18663,15 +18687,38 @@
18663
18687
 
18664
18688
  function getEncodingComponents( colorSpace ) {
18665
18689
 
18690
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
18691
+ const encodingPrimaries = ColorManagement.getPrimaries( colorSpace );
18692
+
18693
+ let gamutMapping;
18694
+
18695
+ if ( workingPrimaries === encodingPrimaries ) {
18696
+
18697
+ gamutMapping = '';
18698
+
18699
+ } else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {
18700
+
18701
+ gamutMapping = 'LinearDisplayP3ToLinearSRGB';
18702
+
18703
+ } else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {
18704
+
18705
+ gamutMapping = 'LinearSRGBToLinearDisplayP3';
18706
+
18707
+ }
18708
+
18666
18709
  switch ( colorSpace ) {
18667
18710
 
18668
18711
  case LinearSRGBColorSpace:
18669
- return [ 'Linear', '( value )' ];
18712
+ case LinearDisplayP3ColorSpace:
18713
+ return [ gamutMapping, 'LinearTransferOETF' ];
18714
+
18670
18715
  case SRGBColorSpace:
18671
- return [ 'sRGB', '( value )' ];
18716
+ case DisplayP3ColorSpace:
18717
+ return [ gamutMapping, 'sRGBTransferOETF' ];
18718
+
18672
18719
  default:
18673
18720
  console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
18674
- return [ 'Linear', '( value )' ];
18721
+ return [ gamutMapping, 'LinearTransferOETF' ];
18675
18722
 
18676
18723
  }
18677
18724
 
@@ -18704,7 +18751,7 @@
18704
18751
  function getTexelEncodingFunction( functionName, colorSpace ) {
18705
18752
 
18706
18753
  const components = getEncodingComponents( colorSpace );
18707
- return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';
18754
+ return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;
18708
18755
 
18709
18756
  }
18710
18757
 
@@ -19131,6 +19178,7 @@
19131
19178
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
19132
19179
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
19133
19180
 
19181
+ parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
19134
19182
  parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19135
19183
 
19136
19184
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
@@ -19218,6 +19266,8 @@
19218
19266
 
19219
19267
  parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
19220
19268
 
19269
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19270
+
19221
19271
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19222
19272
 
19223
19273
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
@@ -19400,8 +19450,12 @@
19400
19450
 
19401
19451
  parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',
19402
19452
 
19453
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19454
+
19403
19455
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19404
19456
 
19457
+ parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
19458
+
19405
19459
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
19406
19460
  ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
19407
19461
 
@@ -19636,7 +19690,7 @@
19636
19690
 
19637
19691
  }
19638
19692
 
19639
- let _id = 0;
19693
+ let _id$1 = 0;
19640
19694
 
19641
19695
  class WebGLShaderCache {
19642
19696
 
@@ -19750,7 +19804,7 @@
19750
19804
 
19751
19805
  constructor( code ) {
19752
19806
 
19753
- this.id = _id ++;
19807
+ this.id = _id$1 ++;
19754
19808
 
19755
19809
  this.code = code;
19756
19810
  this.usedTimes = 0;
@@ -20078,6 +20132,8 @@
20078
20132
  numSpotLightShadows: lights.spotShadowMap.length,
20079
20133
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
20080
20134
 
20135
+ numLightProbes: lights.numLightProbes,
20136
+
20081
20137
  numClippingPlanes: clipping.numPlanes,
20082
20138
  numClipIntersection: clipping.numIntersection,
20083
20139
 
@@ -20089,6 +20145,8 @@
20089
20145
  toneMapping: toneMapping,
20090
20146
  useLegacyLights: renderer._useLegacyLights,
20091
20147
 
20148
+ decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
20149
+
20092
20150
  premultipliedAlpha: material.premultipliedAlpha,
20093
20151
 
20094
20152
  doubleSided: material.side === DoubleSide,
@@ -20200,6 +20258,7 @@
20200
20258
  array.push( parameters.numPointLightShadows );
20201
20259
  array.push( parameters.numSpotLightShadows );
20202
20260
  array.push( parameters.numSpotLightShadowsWithMaps );
20261
+ array.push( parameters.numLightProbes );
20203
20262
  array.push( parameters.shadowMapType );
20204
20263
  array.push( parameters.toneMapping );
20205
20264
  array.push( parameters.numClippingPlanes );
@@ -20290,6 +20349,8 @@
20290
20349
  _programLayers.enable( 17 );
20291
20350
  if ( parameters.pointsUvs )
20292
20351
  _programLayers.enable( 18 );
20352
+ if ( parameters.decodeVideoTexture )
20353
+ _programLayers.enable( 19 );
20293
20354
 
20294
20355
  array.push( _programLayers.mask );
20295
20356
 
@@ -20836,7 +20897,9 @@
20836
20897
  numDirectionalShadows: - 1,
20837
20898
  numPointShadows: - 1,
20838
20899
  numSpotShadows: - 1,
20839
- numSpotMaps: - 1
20900
+ numSpotMaps: - 1,
20901
+
20902
+ numLightProbes: - 1
20840
20903
  },
20841
20904
 
20842
20905
  ambient: [ 0, 0, 0 ],
@@ -20858,7 +20921,8 @@
20858
20921
  pointShadowMap: [],
20859
20922
  pointShadowMatrix: [],
20860
20923
  hemi: [],
20861
- numSpotLightShadowsWithMaps: 0
20924
+ numSpotLightShadowsWithMaps: 0,
20925
+ numLightProbes: 0
20862
20926
 
20863
20927
  };
20864
20928
 
@@ -20886,6 +20950,8 @@
20886
20950
  let numSpotMaps = 0;
20887
20951
  let numSpotShadowsWithMaps = 0;
20888
20952
 
20953
+ let numLightProbes = 0;
20954
+
20889
20955
  // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
20890
20956
  lights.sort( shadowCastingAndTexturingLightsFirst );
20891
20957
 
@@ -20916,6 +20982,8 @@
20916
20982
 
20917
20983
  }
20918
20984
 
20985
+ numLightProbes ++;
20986
+
20919
20987
  } else if ( light.isDirectionalLight ) {
20920
20988
 
20921
20989
  const uniforms = cache.get( light );
@@ -21103,7 +21171,8 @@
21103
21171
  hash.numDirectionalShadows !== numDirectionalShadows ||
21104
21172
  hash.numPointShadows !== numPointShadows ||
21105
21173
  hash.numSpotShadows !== numSpotShadows ||
21106
- hash.numSpotMaps !== numSpotMaps ) {
21174
+ hash.numSpotMaps !== numSpotMaps ||
21175
+ hash.numLightProbes !== numLightProbes ) {
21107
21176
 
21108
21177
  state.directional.length = directionalLength;
21109
21178
  state.spot.length = spotLength;
@@ -21122,6 +21191,7 @@
21122
21191
  state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
21123
21192
  state.spotLightMap.length = numSpotMaps;
21124
21193
  state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
21194
+ state.numLightProbes = numLightProbes;
21125
21195
 
21126
21196
  hash.directionalLength = directionalLength;
21127
21197
  hash.pointLength = pointLength;
@@ -21134,6 +21204,8 @@
21134
21204
  hash.numSpotShadows = numSpotShadows;
21135
21205
  hash.numSpotMaps = numSpotMaps;
21136
21206
 
21207
+ hash.numLightProbes = numLightProbes;
21208
+
21137
21209
  state.version = nextVersion ++;
21138
21210
 
21139
21211
  }
@@ -23280,9 +23352,11 @@
23280
23352
 
23281
23353
  if ( glFormat === _gl.RGBA ) {
23282
23354
 
23355
+ const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
23356
+
23283
23357
  if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
23284
23358
  if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
23285
- if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23359
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23286
23360
  if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
23287
23361
  if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
23288
23362
 
@@ -23837,10 +23911,14 @@
23837
23911
 
23838
23912
  state.activeTexture( _gl.TEXTURE0 + slot );
23839
23913
 
23914
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
23915
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
23916
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
23917
+
23840
23918
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
23841
23919
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
23842
23920
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
23843
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
23921
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
23844
23922
 
23845
23923
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
23846
23924
  let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
@@ -23850,7 +23928,7 @@
23850
23928
  glFormat = utils.convert( texture.format, texture.colorSpace );
23851
23929
 
23852
23930
  let glType = utils.convert( texture.type ),
23853
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
23931
+ glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
23854
23932
 
23855
23933
  setTextureParameters( textureType, texture, supportsMips );
23856
23934
 
@@ -24251,10 +24329,14 @@
24251
24329
 
24252
24330
  state.activeTexture( _gl.TEXTURE0 + slot );
24253
24331
 
24332
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
24333
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
24334
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
24335
+
24254
24336
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24255
24337
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24256
24338
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24257
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24339
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24258
24340
 
24259
24341
  const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
24260
24342
  const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
@@ -24494,7 +24576,7 @@
24494
24576
 
24495
24577
  if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
24496
24578
 
24497
- let glInternalFormat = _gl.DEPTH_COMPONENT16;
24579
+ let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
24498
24580
 
24499
24581
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
24500
24582
 
@@ -25129,13 +25211,13 @@
25129
25211
  const format = texture.format;
25130
25212
  const type = texture.type;
25131
25213
 
25132
- if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
25214
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25133
25215
 
25134
25216
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
25135
25217
 
25136
25218
  // sRGB
25137
25219
 
25138
- if ( colorSpace === SRGBColorSpace ) {
25220
+ if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
25139
25221
 
25140
25222
  if ( isWebGL2 === false ) {
25141
25223
 
@@ -25209,6 +25291,8 @@
25209
25291
 
25210
25292
  let extension;
25211
25293
 
25294
+ const transfer = ColorManagement.getTransfer( colorSpace );
25295
+
25212
25296
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
25213
25297
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
25214
25298
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
@@ -25275,7 +25359,7 @@
25275
25359
 
25276
25360
  if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
25277
25361
 
25278
- if ( colorSpace === SRGBColorSpace ) {
25362
+ if ( transfer === SRGBTransfer ) {
25279
25363
 
25280
25364
  extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
25281
25365
 
@@ -25360,8 +25444,8 @@
25360
25444
 
25361
25445
  if ( extension !== null ) {
25362
25446
 
25363
- if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25364
- if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25447
+ if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25448
+ if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25365
25449
 
25366
25450
  } else {
25367
25451
 
@@ -25383,20 +25467,20 @@
25383
25467
 
25384
25468
  if ( extension !== null ) {
25385
25469
 
25386
- if ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25387
- if ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25388
- if ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25389
- if ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25390
- if ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25391
- if ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25392
- if ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25393
- if ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25394
- if ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25395
- if ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25396
- if ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25397
- if ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25398
- if ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25399
- if ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25470
+ if ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25471
+ if ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25472
+ if ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25473
+ if ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25474
+ if ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25475
+ if ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25476
+ if ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25477
+ if ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25478
+ if ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25479
+ if ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25480
+ if ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25481
+ if ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25482
+ if ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25483
+ if ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25400
25484
 
25401
25485
  } else {
25402
25486
 
@@ -25408,13 +25492,15 @@
25408
25492
 
25409
25493
  // BPTC
25410
25494
 
25411
- if ( p === RGBA_BPTC_Format ) {
25495
+ if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {
25412
25496
 
25413
25497
  extension = extensions.get( 'EXT_texture_compression_bptc' );
25414
25498
 
25415
25499
  if ( extension !== null ) {
25416
25500
 
25417
- if ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25501
+ if ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25502
+ if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
25503
+ if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
25418
25504
 
25419
25505
  } else {
25420
25506
 
@@ -26456,14 +26542,6 @@
26456
26542
  camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
26457
26543
  camera.updateMatrixWorld( true );
26458
26544
 
26459
- const children = camera.children;
26460
-
26461
- for ( let i = 0, l = children.length; i < l; i ++ ) {
26462
-
26463
- children[ i ].updateMatrixWorld( true );
26464
-
26465
- }
26466
-
26467
26545
  camera.projectionMatrix.copy( cameraXR.projectionMatrix );
26468
26546
  camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
26469
26547
 
@@ -27626,14 +27704,6 @@
27626
27704
 
27627
27705
  }
27628
27706
 
27629
- function createCanvasElement() {
27630
-
27631
- const canvas = createElementNS( 'canvas' );
27632
- canvas.style.display = 'block';
27633
- return canvas;
27634
-
27635
- }
27636
-
27637
27707
  class WebGLRenderer {
27638
27708
 
27639
27709
  constructor( parameters = {} ) {
@@ -27714,7 +27784,7 @@
27714
27784
 
27715
27785
  // physically based shading
27716
27786
 
27717
- this.outputColorSpace = SRGBColorSpace;
27787
+ this._outputColorSpace = SRGBColorSpace;
27718
27788
 
27719
27789
  // physical lights
27720
27790
 
@@ -29359,48 +29429,28 @@
29359
29429
 
29360
29430
  if ( refreshProgram || _currentCamera !== camera ) {
29361
29431
 
29362
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
29363
-
29364
- if ( capabilities.logarithmicDepthBuffer ) {
29365
-
29366
- p_uniforms.setValue( _gl, 'logDepthBufFC',
29367
- 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
29368
-
29369
- }
29432
+ // common camera uniforms
29370
29433
 
29371
- if ( _currentCamera !== camera ) {
29434
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
29435
+ p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
29372
29436
 
29373
- _currentCamera = camera;
29437
+ const uCamPos = p_uniforms.map.cameraPosition;
29374
29438
 
29375
- // lighting uniforms depend on the camera so enforce an update
29376
- // now, in case this material supports lights - or later, when
29377
- // the next material that does gets activated:
29439
+ if ( uCamPos !== undefined ) {
29378
29440
 
29379
- refreshMaterial = true; // set to true on material change
29380
- refreshLights = true; // remains set until update done
29441
+ uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
29381
29442
 
29382
29443
  }
29383
29444
 
29384
- // load material specific uniforms
29385
- // (shader material also gets them for the sake of genericity)
29386
-
29387
- if ( material.isShaderMaterial ||
29388
- material.isMeshPhongMaterial ||
29389
- material.isMeshToonMaterial ||
29390
- material.isMeshStandardMaterial ||
29391
- material.envMap ) {
29392
-
29393
- const uCamPos = p_uniforms.map.cameraPosition;
29394
-
29395
- if ( uCamPos !== undefined ) {
29396
-
29397
- uCamPos.setValue( _gl,
29398
- _vector3.setFromMatrixPosition( camera.matrixWorld ) );
29445
+ if ( capabilities.logarithmicDepthBuffer ) {
29399
29446
 
29400
- }
29447
+ p_uniforms.setValue( _gl, 'logDepthBufFC',
29448
+ 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
29401
29449
 
29402
29450
  }
29403
29451
 
29452
+ // consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
29453
+
29404
29454
  if ( material.isMeshPhongMaterial ||
29405
29455
  material.isMeshToonMaterial ||
29406
29456
  material.isMeshLambertMaterial ||
@@ -29412,16 +29462,16 @@
29412
29462
 
29413
29463
  }
29414
29464
 
29415
- if ( material.isMeshPhongMaterial ||
29416
- material.isMeshToonMaterial ||
29417
- material.isMeshLambertMaterial ||
29418
- material.isMeshBasicMaterial ||
29419
- material.isMeshStandardMaterial ||
29420
- material.isShaderMaterial ||
29421
- material.isShadowMaterial ||
29422
- object.isSkinnedMesh ) {
29465
+ if ( _currentCamera !== camera ) {
29466
+
29467
+ _currentCamera = camera;
29468
+
29469
+ // lighting uniforms depend on the camera so enforce an update
29470
+ // now, in case this material supports lights - or later, when
29471
+ // the next material that does gets activated:
29423
29472
 
29424
- p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
29473
+ refreshMaterial = true; // set to true on material change
29474
+ refreshLights = true; // remains set until update done
29425
29475
 
29426
29476
  }
29427
29477
 
@@ -30011,6 +30061,22 @@
30011
30061
 
30012
30062
  }
30013
30063
 
30064
+ get outputColorSpace() {
30065
+
30066
+ return this._outputColorSpace;
30067
+
30068
+ }
30069
+
30070
+ set outputColorSpace( colorSpace ) {
30071
+
30072
+ this._outputColorSpace = colorSpace;
30073
+
30074
+ const gl = this.getContext();
30075
+ gl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';
30076
+ gl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';
30077
+
30078
+ }
30079
+
30014
30080
  get physicallyCorrectLights() { // @deprecated, r150
30015
30081
 
30016
30082
  console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
@@ -30693,7 +30759,7 @@
30693
30759
 
30694
30760
  super.copy( source, recursive );
30695
30761
 
30696
- this.material = source.material;
30762
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
30697
30763
  this.geometry = source.geometry;
30698
30764
 
30699
30765
  return this;
@@ -32428,10 +32494,13 @@
32428
32494
 
32429
32495
  if ( ! startPoint.equals( endPoint ) ) {
32430
32496
 
32431
- this.curves.push( new LineCurve( endPoint, startPoint ) );
32497
+ const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
32498
+ this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
32432
32499
 
32433
32500
  }
32434
32501
 
32502
+ return this;
32503
+
32435
32504
  }
32436
32505
 
32437
32506
  // To get accurate point with reference to
@@ -39698,6 +39767,27 @@
39698
39767
  return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
39699
39768
  }
39700
39769
 
39770
+ function max$1(values, valueof) {
39771
+ let max;
39772
+ if (valueof === undefined) {
39773
+ for (const value of values) {
39774
+ if (value != null
39775
+ && (max < value || (max === undefined && value >= value))) {
39776
+ max = value;
39777
+ }
39778
+ }
39779
+ } else {
39780
+ let index = -1;
39781
+ for (let value of values) {
39782
+ if ((value = valueof(value, ++index, values)) != null
39783
+ && (max < value || (max === undefined && value >= value))) {
39784
+ max = value;
39785
+ }
39786
+ }
39787
+ }
39788
+ return max;
39789
+ }
39790
+
39701
39791
  function mean(values, valueof) {
39702
39792
  let count = 0;
39703
39793
  let sum = 0;
@@ -39742,6 +39832,25 @@
39742
39832
  return range;
39743
39833
  }
39744
39834
 
39835
+ function sum$1(values, valueof) {
39836
+ let sum = 0;
39837
+ if (valueof === undefined) {
39838
+ for (let value of values) {
39839
+ if (value = +value) {
39840
+ sum += value;
39841
+ }
39842
+ }
39843
+ } else {
39844
+ let index = -1;
39845
+ for (let value of values) {
39846
+ if (value = +valueof(value, ++index, values)) {
39847
+ sum += value;
39848
+ }
39849
+ }
39850
+ }
39851
+ return sum;
39852
+ }
39853
+
39745
39854
  var epsilon$2 = 1e-6;
39746
39855
  var epsilon2 = 1e-12;
39747
39856
  var pi$1 = Math.PI;
@@ -41237,7 +41346,7 @@
41237
41346
  var coordinates = [null, null],
41238
41347
  object$1 = {type: "LineString", coordinates: coordinates};
41239
41348
 
41240
- function geoDistance(a, b) {
41349
+ function geoDistance$1(a, b) {
41241
41350
  coordinates[0] = a;
41242
41351
  coordinates[1] = b;
41243
41352
  return length(object$1);
@@ -41296,16 +41405,16 @@
41296
41405
  }
41297
41406
 
41298
41407
  function containsPoint(coordinates, point) {
41299
- return geoDistance(coordinates, point) === 0;
41408
+ return geoDistance$1(coordinates, point) === 0;
41300
41409
  }
41301
41410
 
41302
41411
  function containsLine(coordinates, point) {
41303
41412
  var ao, bo, ab;
41304
41413
  for (var i = 0, n = coordinates.length; i < n; i++) {
41305
- bo = geoDistance(coordinates[i], point);
41414
+ bo = geoDistance$1(coordinates[i], point);
41306
41415
  if (bo === 0) return true;
41307
41416
  if (i > 0) {
41308
- ab = geoDistance(coordinates[i], coordinates[i - 1]);
41417
+ ab = geoDistance$1(coordinates[i], coordinates[i - 1]);
41309
41418
  if (
41310
41419
  ab > 0 &&
41311
41420
  ao <= ab &&
@@ -42076,7 +42185,7 @@
42076
42185
  var prevPnt = null;
42077
42186
  lineCoords.forEach(function (pnt) {
42078
42187
  if (prevPnt) {
42079
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
42188
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
42080
42189
  if (dist > maxDegDistance) {
42081
42190
  var interpol = geoInterpolate(prevPnt, pnt);
42082
42191
  var tStep = 1 / Math.ceil(dist / maxDegDistance);
@@ -42092,14 +42201,14 @@
42092
42201
  return result;
42093
42202
  };
42094
42203
 
42095
- var THREE$j = typeof window !== 'undefined' && window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
42204
+ var THREE$l = typeof window !== 'undefined' && window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
42096
42205
  : {
42097
42206
  BufferGeometry: BufferGeometry,
42098
42207
  Float32BufferAttribute: Float32BufferAttribute
42099
42208
  };
42100
42209
 
42101
42210
  // support both modes for backwards threejs compatibility
42102
- var setAttributeFn$4 = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42211
+ var setAttributeFn$3 = new THREE$l.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42103
42212
  var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
42104
42213
  _inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
42105
42214
  var _super = _createSuper$2(GeoJsonGeometry);
@@ -42143,7 +42252,7 @@
42143
42252
 
42144
42253
  // build geometry
42145
42254
  indices.length && _this.setIndex(indices);
42146
- vertices.length && _this[setAttributeFn$4]('position', new THREE$j.Float32BufferAttribute(vertices, 3));
42255
+ vertices.length && _this[setAttributeFn$3]('position', new THREE$l.Float32BufferAttribute(vertices, 3));
42147
42256
 
42148
42257
  //
42149
42258
 
@@ -42269,7 +42378,7 @@
42269
42378
  return _this;
42270
42379
  }
42271
42380
  return _createClass$2(GeoJsonGeometry);
42272
- }(THREE$j.BufferGeometry); //
42381
+ }(THREE$l.BufferGeometry); //
42273
42382
  function concatGroup(main, extra) {
42274
42383
  var prevVertCnt = Math.round(main.vertices.length / 3);
42275
42384
  concatArr(main.vertices, extra.vertices);
@@ -42847,7 +42956,7 @@
42847
42956
  }
42848
42957
 
42849
42958
  /**
42850
- * @param {Array<BufferGeometry>} geometry
42959
+ * @param {BufferGeometry} geometry
42851
42960
  * @return {number}
42852
42961
  */
42853
42962
  function estimateBytesUsed( geometry ) {
@@ -42923,8 +43032,10 @@
42923
43032
  }
42924
43033
 
42925
43034
  // convert the error tolerance to an amount of decimal places to truncate to
42926
- const decimalShift = Math.log10( 1 / tolerance );
42927
- const shiftMultiplier = Math.pow( 10, decimalShift );
43035
+ const halfTolerance = tolerance * 0.5;
43036
+ const exponent = Math.log10( 1 / tolerance );
43037
+ const hashMultiplier = Math.pow( 10, exponent );
43038
+ const hashAdditive = halfTolerance * hashMultiplier;
42928
43039
  for ( let i = 0; i < vertexCount; i ++ ) {
42929
43040
 
42930
43041
  const index = indices ? indices.getX( i ) : i;
@@ -42940,7 +43051,7 @@
42940
43051
  for ( let k = 0; k < itemSize; k ++ ) {
42941
43052
 
42942
43053
  // double tilde truncates the decimal value
42943
- hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;
43054
+ hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * hashMultiplier + hashAdditive ) },`;
42944
43055
 
42945
43056
  }
42946
43057
 
@@ -43678,6 +43789,412 @@
43678
43789
  };
43679
43790
  }); // constant
43680
43791
 
43792
+ function define(constructor, factory, prototype) {
43793
+ constructor.prototype = factory.prototype = prototype;
43794
+ prototype.constructor = constructor;
43795
+ }
43796
+
43797
+ function extend(parent, definition) {
43798
+ var prototype = Object.create(parent.prototype);
43799
+ for (var key in definition) prototype[key] = definition[key];
43800
+ return prototype;
43801
+ }
43802
+
43803
+ function Color() {}
43804
+
43805
+ var darker = 0.7;
43806
+ var brighter = 1 / darker;
43807
+
43808
+ var reI = "\\s*([+-]?\\d+)\\s*",
43809
+ reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
43810
+ reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
43811
+ reHex = /^#([0-9a-f]{3,8})$/,
43812
+ reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
43813
+ reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
43814
+ reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
43815
+ reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
43816
+ reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
43817
+ reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
43818
+
43819
+ var named = {
43820
+ aliceblue: 0xf0f8ff,
43821
+ antiquewhite: 0xfaebd7,
43822
+ aqua: 0x00ffff,
43823
+ aquamarine: 0x7fffd4,
43824
+ azure: 0xf0ffff,
43825
+ beige: 0xf5f5dc,
43826
+ bisque: 0xffe4c4,
43827
+ black: 0x000000,
43828
+ blanchedalmond: 0xffebcd,
43829
+ blue: 0x0000ff,
43830
+ blueviolet: 0x8a2be2,
43831
+ brown: 0xa52a2a,
43832
+ burlywood: 0xdeb887,
43833
+ cadetblue: 0x5f9ea0,
43834
+ chartreuse: 0x7fff00,
43835
+ chocolate: 0xd2691e,
43836
+ coral: 0xff7f50,
43837
+ cornflowerblue: 0x6495ed,
43838
+ cornsilk: 0xfff8dc,
43839
+ crimson: 0xdc143c,
43840
+ cyan: 0x00ffff,
43841
+ darkblue: 0x00008b,
43842
+ darkcyan: 0x008b8b,
43843
+ darkgoldenrod: 0xb8860b,
43844
+ darkgray: 0xa9a9a9,
43845
+ darkgreen: 0x006400,
43846
+ darkgrey: 0xa9a9a9,
43847
+ darkkhaki: 0xbdb76b,
43848
+ darkmagenta: 0x8b008b,
43849
+ darkolivegreen: 0x556b2f,
43850
+ darkorange: 0xff8c00,
43851
+ darkorchid: 0x9932cc,
43852
+ darkred: 0x8b0000,
43853
+ darksalmon: 0xe9967a,
43854
+ darkseagreen: 0x8fbc8f,
43855
+ darkslateblue: 0x483d8b,
43856
+ darkslategray: 0x2f4f4f,
43857
+ darkslategrey: 0x2f4f4f,
43858
+ darkturquoise: 0x00ced1,
43859
+ darkviolet: 0x9400d3,
43860
+ deeppink: 0xff1493,
43861
+ deepskyblue: 0x00bfff,
43862
+ dimgray: 0x696969,
43863
+ dimgrey: 0x696969,
43864
+ dodgerblue: 0x1e90ff,
43865
+ firebrick: 0xb22222,
43866
+ floralwhite: 0xfffaf0,
43867
+ forestgreen: 0x228b22,
43868
+ fuchsia: 0xff00ff,
43869
+ gainsboro: 0xdcdcdc,
43870
+ ghostwhite: 0xf8f8ff,
43871
+ gold: 0xffd700,
43872
+ goldenrod: 0xdaa520,
43873
+ gray: 0x808080,
43874
+ green: 0x008000,
43875
+ greenyellow: 0xadff2f,
43876
+ grey: 0x808080,
43877
+ honeydew: 0xf0fff0,
43878
+ hotpink: 0xff69b4,
43879
+ indianred: 0xcd5c5c,
43880
+ indigo: 0x4b0082,
43881
+ ivory: 0xfffff0,
43882
+ khaki: 0xf0e68c,
43883
+ lavender: 0xe6e6fa,
43884
+ lavenderblush: 0xfff0f5,
43885
+ lawngreen: 0x7cfc00,
43886
+ lemonchiffon: 0xfffacd,
43887
+ lightblue: 0xadd8e6,
43888
+ lightcoral: 0xf08080,
43889
+ lightcyan: 0xe0ffff,
43890
+ lightgoldenrodyellow: 0xfafad2,
43891
+ lightgray: 0xd3d3d3,
43892
+ lightgreen: 0x90ee90,
43893
+ lightgrey: 0xd3d3d3,
43894
+ lightpink: 0xffb6c1,
43895
+ lightsalmon: 0xffa07a,
43896
+ lightseagreen: 0x20b2aa,
43897
+ lightskyblue: 0x87cefa,
43898
+ lightslategray: 0x778899,
43899
+ lightslategrey: 0x778899,
43900
+ lightsteelblue: 0xb0c4de,
43901
+ lightyellow: 0xffffe0,
43902
+ lime: 0x00ff00,
43903
+ limegreen: 0x32cd32,
43904
+ linen: 0xfaf0e6,
43905
+ magenta: 0xff00ff,
43906
+ maroon: 0x800000,
43907
+ mediumaquamarine: 0x66cdaa,
43908
+ mediumblue: 0x0000cd,
43909
+ mediumorchid: 0xba55d3,
43910
+ mediumpurple: 0x9370db,
43911
+ mediumseagreen: 0x3cb371,
43912
+ mediumslateblue: 0x7b68ee,
43913
+ mediumspringgreen: 0x00fa9a,
43914
+ mediumturquoise: 0x48d1cc,
43915
+ mediumvioletred: 0xc71585,
43916
+ midnightblue: 0x191970,
43917
+ mintcream: 0xf5fffa,
43918
+ mistyrose: 0xffe4e1,
43919
+ moccasin: 0xffe4b5,
43920
+ navajowhite: 0xffdead,
43921
+ navy: 0x000080,
43922
+ oldlace: 0xfdf5e6,
43923
+ olive: 0x808000,
43924
+ olivedrab: 0x6b8e23,
43925
+ orange: 0xffa500,
43926
+ orangered: 0xff4500,
43927
+ orchid: 0xda70d6,
43928
+ palegoldenrod: 0xeee8aa,
43929
+ palegreen: 0x98fb98,
43930
+ paleturquoise: 0xafeeee,
43931
+ palevioletred: 0xdb7093,
43932
+ papayawhip: 0xffefd5,
43933
+ peachpuff: 0xffdab9,
43934
+ peru: 0xcd853f,
43935
+ pink: 0xffc0cb,
43936
+ plum: 0xdda0dd,
43937
+ powderblue: 0xb0e0e6,
43938
+ purple: 0x800080,
43939
+ rebeccapurple: 0x663399,
43940
+ red: 0xff0000,
43941
+ rosybrown: 0xbc8f8f,
43942
+ royalblue: 0x4169e1,
43943
+ saddlebrown: 0x8b4513,
43944
+ salmon: 0xfa8072,
43945
+ sandybrown: 0xf4a460,
43946
+ seagreen: 0x2e8b57,
43947
+ seashell: 0xfff5ee,
43948
+ sienna: 0xa0522d,
43949
+ silver: 0xc0c0c0,
43950
+ skyblue: 0x87ceeb,
43951
+ slateblue: 0x6a5acd,
43952
+ slategray: 0x708090,
43953
+ slategrey: 0x708090,
43954
+ snow: 0xfffafa,
43955
+ springgreen: 0x00ff7f,
43956
+ steelblue: 0x4682b4,
43957
+ tan: 0xd2b48c,
43958
+ teal: 0x008080,
43959
+ thistle: 0xd8bfd8,
43960
+ tomato: 0xff6347,
43961
+ turquoise: 0x40e0d0,
43962
+ violet: 0xee82ee,
43963
+ wheat: 0xf5deb3,
43964
+ white: 0xffffff,
43965
+ whitesmoke: 0xf5f5f5,
43966
+ yellow: 0xffff00,
43967
+ yellowgreen: 0x9acd32
43968
+ };
43969
+
43970
+ define(Color, color, {
43971
+ copy(channels) {
43972
+ return Object.assign(new this.constructor, this, channels);
43973
+ },
43974
+ displayable() {
43975
+ return this.rgb().displayable();
43976
+ },
43977
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
43978
+ formatHex: color_formatHex,
43979
+ formatHex8: color_formatHex8,
43980
+ formatHsl: color_formatHsl,
43981
+ formatRgb: color_formatRgb,
43982
+ toString: color_formatRgb
43983
+ });
43984
+
43985
+ function color_formatHex() {
43986
+ return this.rgb().formatHex();
43987
+ }
43988
+
43989
+ function color_formatHex8() {
43990
+ return this.rgb().formatHex8();
43991
+ }
43992
+
43993
+ function color_formatHsl() {
43994
+ return hslConvert(this).formatHsl();
43995
+ }
43996
+
43997
+ function color_formatRgb() {
43998
+ return this.rgb().formatRgb();
43999
+ }
44000
+
44001
+ function color(format) {
44002
+ var m, l;
44003
+ format = (format + "").trim().toLowerCase();
44004
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
44005
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
44006
+ : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
44007
+ : l === 4 ? rgba$1((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
44008
+ : null) // invalid hex
44009
+ : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
44010
+ : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
44011
+ : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
44012
+ : (m = reRgbaPercent.exec(format)) ? rgba$1(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
44013
+ : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
44014
+ : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
44015
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
44016
+ : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
44017
+ : null;
44018
+ }
44019
+
44020
+ function rgbn(n) {
44021
+ return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
44022
+ }
44023
+
44024
+ function rgba$1(r, g, b, a) {
44025
+ if (a <= 0) r = g = b = NaN;
44026
+ return new Rgb(r, g, b, a);
44027
+ }
44028
+
44029
+ function rgbConvert(o) {
44030
+ if (!(o instanceof Color)) o = color(o);
44031
+ if (!o) return new Rgb;
44032
+ o = o.rgb();
44033
+ return new Rgb(o.r, o.g, o.b, o.opacity);
44034
+ }
44035
+
44036
+ function rgb$2(r, g, b, opacity) {
44037
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
44038
+ }
44039
+
44040
+ function Rgb(r, g, b, opacity) {
44041
+ this.r = +r;
44042
+ this.g = +g;
44043
+ this.b = +b;
44044
+ this.opacity = +opacity;
44045
+ }
44046
+
44047
+ define(Rgb, rgb$2, extend(Color, {
44048
+ brighter(k) {
44049
+ k = k == null ? brighter : Math.pow(brighter, k);
44050
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
44051
+ },
44052
+ darker(k) {
44053
+ k = k == null ? darker : Math.pow(darker, k);
44054
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
44055
+ },
44056
+ rgb() {
44057
+ return this;
44058
+ },
44059
+ clamp() {
44060
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
44061
+ },
44062
+ displayable() {
44063
+ return (-0.5 <= this.r && this.r < 255.5)
44064
+ && (-0.5 <= this.g && this.g < 255.5)
44065
+ && (-0.5 <= this.b && this.b < 255.5)
44066
+ && (0 <= this.opacity && this.opacity <= 1);
44067
+ },
44068
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
44069
+ formatHex: rgb_formatHex,
44070
+ formatHex8: rgb_formatHex8,
44071
+ formatRgb: rgb_formatRgb,
44072
+ toString: rgb_formatRgb
44073
+ }));
44074
+
44075
+ function rgb_formatHex() {
44076
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
44077
+ }
44078
+
44079
+ function rgb_formatHex8() {
44080
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
44081
+ }
44082
+
44083
+ function rgb_formatRgb() {
44084
+ const a = clampa(this.opacity);
44085
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
44086
+ }
44087
+
44088
+ function clampa(opacity) {
44089
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
44090
+ }
44091
+
44092
+ function clampi(value) {
44093
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
44094
+ }
44095
+
44096
+ function hex(value) {
44097
+ value = clampi(value);
44098
+ return (value < 16 ? "0" : "") + value.toString(16);
44099
+ }
44100
+
44101
+ function hsla(h, s, l, a) {
44102
+ if (a <= 0) h = s = l = NaN;
44103
+ else if (l <= 0 || l >= 1) h = s = NaN;
44104
+ else if (s <= 0) h = NaN;
44105
+ return new Hsl(h, s, l, a);
44106
+ }
44107
+
44108
+ function hslConvert(o) {
44109
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
44110
+ if (!(o instanceof Color)) o = color(o);
44111
+ if (!o) return new Hsl;
44112
+ if (o instanceof Hsl) return o;
44113
+ o = o.rgb();
44114
+ var r = o.r / 255,
44115
+ g = o.g / 255,
44116
+ b = o.b / 255,
44117
+ min = Math.min(r, g, b),
44118
+ max = Math.max(r, g, b),
44119
+ h = NaN,
44120
+ s = max - min,
44121
+ l = (max + min) / 2;
44122
+ if (s) {
44123
+ if (r === max) h = (g - b) / s + (g < b) * 6;
44124
+ else if (g === max) h = (b - r) / s + 2;
44125
+ else h = (r - g) / s + 4;
44126
+ s /= l < 0.5 ? max + min : 2 - max - min;
44127
+ h *= 60;
44128
+ } else {
44129
+ s = l > 0 && l < 1 ? 0 : h;
44130
+ }
44131
+ return new Hsl(h, s, l, o.opacity);
44132
+ }
44133
+
44134
+ function hsl(h, s, l, opacity) {
44135
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
44136
+ }
44137
+
44138
+ function Hsl(h, s, l, opacity) {
44139
+ this.h = +h;
44140
+ this.s = +s;
44141
+ this.l = +l;
44142
+ this.opacity = +opacity;
44143
+ }
44144
+
44145
+ define(Hsl, hsl, extend(Color, {
44146
+ brighter(k) {
44147
+ k = k == null ? brighter : Math.pow(brighter, k);
44148
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
44149
+ },
44150
+ darker(k) {
44151
+ k = k == null ? darker : Math.pow(darker, k);
44152
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
44153
+ },
44154
+ rgb() {
44155
+ var h = this.h % 360 + (this.h < 0) * 360,
44156
+ s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
44157
+ l = this.l,
44158
+ m2 = l + (l < 0.5 ? l : 1 - l) * s,
44159
+ m1 = 2 * l - m2;
44160
+ return new Rgb(
44161
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
44162
+ hsl2rgb(h, m1, m2),
44163
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
44164
+ this.opacity
44165
+ );
44166
+ },
44167
+ clamp() {
44168
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
44169
+ },
44170
+ displayable() {
44171
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s))
44172
+ && (0 <= this.l && this.l <= 1)
44173
+ && (0 <= this.opacity && this.opacity <= 1);
44174
+ },
44175
+ formatHsl() {
44176
+ const a = clampa(this.opacity);
44177
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
44178
+ }
44179
+ }));
44180
+
44181
+ function clamph(value) {
44182
+ value = (value || 0) % 360;
44183
+ return value < 0 ? value + 360 : value;
44184
+ }
44185
+
44186
+ function clampt(value) {
44187
+ return Math.max(0, Math.min(1, value || 0));
44188
+ }
44189
+
44190
+ /* From FvD 13.37, CSS Color Module Level 3 */
44191
+ function hsl2rgb(h, m1, m2) {
44192
+ return (h < 60 ? m1 + (m2 - m1) * h / 60
44193
+ : h < 180 ? m2
44194
+ : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
44195
+ : m1) * 255;
44196
+ }
44197
+
43681
44198
  // This file is autogenerated. It's used to publish ESM to npm.
43682
44199
  function _typeof(obj) {
43683
44200
  "@babel/helpers - typeof";
@@ -45344,412 +45861,6 @@
45344
45861
  return this;
45345
45862
  }
45346
45863
 
45347
- function define(constructor, factory, prototype) {
45348
- constructor.prototype = factory.prototype = prototype;
45349
- prototype.constructor = constructor;
45350
- }
45351
-
45352
- function extend(parent, definition) {
45353
- var prototype = Object.create(parent.prototype);
45354
- for (var key in definition) prototype[key] = definition[key];
45355
- return prototype;
45356
- }
45357
-
45358
- function Color() {}
45359
-
45360
- var darker = 0.7;
45361
- var brighter = 1 / darker;
45362
-
45363
- var reI = "\\s*([+-]?\\d+)\\s*",
45364
- reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
45365
- reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
45366
- reHex = /^#([0-9a-f]{3,8})$/,
45367
- reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
45368
- reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
45369
- reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
45370
- reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
45371
- reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
45372
- reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
45373
-
45374
- var named = {
45375
- aliceblue: 0xf0f8ff,
45376
- antiquewhite: 0xfaebd7,
45377
- aqua: 0x00ffff,
45378
- aquamarine: 0x7fffd4,
45379
- azure: 0xf0ffff,
45380
- beige: 0xf5f5dc,
45381
- bisque: 0xffe4c4,
45382
- black: 0x000000,
45383
- blanchedalmond: 0xffebcd,
45384
- blue: 0x0000ff,
45385
- blueviolet: 0x8a2be2,
45386
- brown: 0xa52a2a,
45387
- burlywood: 0xdeb887,
45388
- cadetblue: 0x5f9ea0,
45389
- chartreuse: 0x7fff00,
45390
- chocolate: 0xd2691e,
45391
- coral: 0xff7f50,
45392
- cornflowerblue: 0x6495ed,
45393
- cornsilk: 0xfff8dc,
45394
- crimson: 0xdc143c,
45395
- cyan: 0x00ffff,
45396
- darkblue: 0x00008b,
45397
- darkcyan: 0x008b8b,
45398
- darkgoldenrod: 0xb8860b,
45399
- darkgray: 0xa9a9a9,
45400
- darkgreen: 0x006400,
45401
- darkgrey: 0xa9a9a9,
45402
- darkkhaki: 0xbdb76b,
45403
- darkmagenta: 0x8b008b,
45404
- darkolivegreen: 0x556b2f,
45405
- darkorange: 0xff8c00,
45406
- darkorchid: 0x9932cc,
45407
- darkred: 0x8b0000,
45408
- darksalmon: 0xe9967a,
45409
- darkseagreen: 0x8fbc8f,
45410
- darkslateblue: 0x483d8b,
45411
- darkslategray: 0x2f4f4f,
45412
- darkslategrey: 0x2f4f4f,
45413
- darkturquoise: 0x00ced1,
45414
- darkviolet: 0x9400d3,
45415
- deeppink: 0xff1493,
45416
- deepskyblue: 0x00bfff,
45417
- dimgray: 0x696969,
45418
- dimgrey: 0x696969,
45419
- dodgerblue: 0x1e90ff,
45420
- firebrick: 0xb22222,
45421
- floralwhite: 0xfffaf0,
45422
- forestgreen: 0x228b22,
45423
- fuchsia: 0xff00ff,
45424
- gainsboro: 0xdcdcdc,
45425
- ghostwhite: 0xf8f8ff,
45426
- gold: 0xffd700,
45427
- goldenrod: 0xdaa520,
45428
- gray: 0x808080,
45429
- green: 0x008000,
45430
- greenyellow: 0xadff2f,
45431
- grey: 0x808080,
45432
- honeydew: 0xf0fff0,
45433
- hotpink: 0xff69b4,
45434
- indianred: 0xcd5c5c,
45435
- indigo: 0x4b0082,
45436
- ivory: 0xfffff0,
45437
- khaki: 0xf0e68c,
45438
- lavender: 0xe6e6fa,
45439
- lavenderblush: 0xfff0f5,
45440
- lawngreen: 0x7cfc00,
45441
- lemonchiffon: 0xfffacd,
45442
- lightblue: 0xadd8e6,
45443
- lightcoral: 0xf08080,
45444
- lightcyan: 0xe0ffff,
45445
- lightgoldenrodyellow: 0xfafad2,
45446
- lightgray: 0xd3d3d3,
45447
- lightgreen: 0x90ee90,
45448
- lightgrey: 0xd3d3d3,
45449
- lightpink: 0xffb6c1,
45450
- lightsalmon: 0xffa07a,
45451
- lightseagreen: 0x20b2aa,
45452
- lightskyblue: 0x87cefa,
45453
- lightslategray: 0x778899,
45454
- lightslategrey: 0x778899,
45455
- lightsteelblue: 0xb0c4de,
45456
- lightyellow: 0xffffe0,
45457
- lime: 0x00ff00,
45458
- limegreen: 0x32cd32,
45459
- linen: 0xfaf0e6,
45460
- magenta: 0xff00ff,
45461
- maroon: 0x800000,
45462
- mediumaquamarine: 0x66cdaa,
45463
- mediumblue: 0x0000cd,
45464
- mediumorchid: 0xba55d3,
45465
- mediumpurple: 0x9370db,
45466
- mediumseagreen: 0x3cb371,
45467
- mediumslateblue: 0x7b68ee,
45468
- mediumspringgreen: 0x00fa9a,
45469
- mediumturquoise: 0x48d1cc,
45470
- mediumvioletred: 0xc71585,
45471
- midnightblue: 0x191970,
45472
- mintcream: 0xf5fffa,
45473
- mistyrose: 0xffe4e1,
45474
- moccasin: 0xffe4b5,
45475
- navajowhite: 0xffdead,
45476
- navy: 0x000080,
45477
- oldlace: 0xfdf5e6,
45478
- olive: 0x808000,
45479
- olivedrab: 0x6b8e23,
45480
- orange: 0xffa500,
45481
- orangered: 0xff4500,
45482
- orchid: 0xda70d6,
45483
- palegoldenrod: 0xeee8aa,
45484
- palegreen: 0x98fb98,
45485
- paleturquoise: 0xafeeee,
45486
- palevioletred: 0xdb7093,
45487
- papayawhip: 0xffefd5,
45488
- peachpuff: 0xffdab9,
45489
- peru: 0xcd853f,
45490
- pink: 0xffc0cb,
45491
- plum: 0xdda0dd,
45492
- powderblue: 0xb0e0e6,
45493
- purple: 0x800080,
45494
- rebeccapurple: 0x663399,
45495
- red: 0xff0000,
45496
- rosybrown: 0xbc8f8f,
45497
- royalblue: 0x4169e1,
45498
- saddlebrown: 0x8b4513,
45499
- salmon: 0xfa8072,
45500
- sandybrown: 0xf4a460,
45501
- seagreen: 0x2e8b57,
45502
- seashell: 0xfff5ee,
45503
- sienna: 0xa0522d,
45504
- silver: 0xc0c0c0,
45505
- skyblue: 0x87ceeb,
45506
- slateblue: 0x6a5acd,
45507
- slategray: 0x708090,
45508
- slategrey: 0x708090,
45509
- snow: 0xfffafa,
45510
- springgreen: 0x00ff7f,
45511
- steelblue: 0x4682b4,
45512
- tan: 0xd2b48c,
45513
- teal: 0x008080,
45514
- thistle: 0xd8bfd8,
45515
- tomato: 0xff6347,
45516
- turquoise: 0x40e0d0,
45517
- violet: 0xee82ee,
45518
- wheat: 0xf5deb3,
45519
- white: 0xffffff,
45520
- whitesmoke: 0xf5f5f5,
45521
- yellow: 0xffff00,
45522
- yellowgreen: 0x9acd32
45523
- };
45524
-
45525
- define(Color, color, {
45526
- copy(channels) {
45527
- return Object.assign(new this.constructor, this, channels);
45528
- },
45529
- displayable() {
45530
- return this.rgb().displayable();
45531
- },
45532
- hex: color_formatHex, // Deprecated! Use color.formatHex.
45533
- formatHex: color_formatHex,
45534
- formatHex8: color_formatHex8,
45535
- formatHsl: color_formatHsl,
45536
- formatRgb: color_formatRgb,
45537
- toString: color_formatRgb
45538
- });
45539
-
45540
- function color_formatHex() {
45541
- return this.rgb().formatHex();
45542
- }
45543
-
45544
- function color_formatHex8() {
45545
- return this.rgb().formatHex8();
45546
- }
45547
-
45548
- function color_formatHsl() {
45549
- return hslConvert(this).formatHsl();
45550
- }
45551
-
45552
- function color_formatRgb() {
45553
- return this.rgb().formatRgb();
45554
- }
45555
-
45556
- function color(format) {
45557
- var m, l;
45558
- format = (format + "").trim().toLowerCase();
45559
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
45560
- : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
45561
- : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
45562
- : l === 4 ? rgba$1((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
45563
- : null) // invalid hex
45564
- : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
45565
- : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
45566
- : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
45567
- : (m = reRgbaPercent.exec(format)) ? rgba$1(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
45568
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
45569
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
45570
- : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
45571
- : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
45572
- : null;
45573
- }
45574
-
45575
- function rgbn(n) {
45576
- return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
45577
- }
45578
-
45579
- function rgba$1(r, g, b, a) {
45580
- if (a <= 0) r = g = b = NaN;
45581
- return new Rgb(r, g, b, a);
45582
- }
45583
-
45584
- function rgbConvert(o) {
45585
- if (!(o instanceof Color)) o = color(o);
45586
- if (!o) return new Rgb;
45587
- o = o.rgb();
45588
- return new Rgb(o.r, o.g, o.b, o.opacity);
45589
- }
45590
-
45591
- function rgb$2(r, g, b, opacity) {
45592
- return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
45593
- }
45594
-
45595
- function Rgb(r, g, b, opacity) {
45596
- this.r = +r;
45597
- this.g = +g;
45598
- this.b = +b;
45599
- this.opacity = +opacity;
45600
- }
45601
-
45602
- define(Rgb, rgb$2, extend(Color, {
45603
- brighter(k) {
45604
- k = k == null ? brighter : Math.pow(brighter, k);
45605
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45606
- },
45607
- darker(k) {
45608
- k = k == null ? darker : Math.pow(darker, k);
45609
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45610
- },
45611
- rgb() {
45612
- return this;
45613
- },
45614
- clamp() {
45615
- return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
45616
- },
45617
- displayable() {
45618
- return (-0.5 <= this.r && this.r < 255.5)
45619
- && (-0.5 <= this.g && this.g < 255.5)
45620
- && (-0.5 <= this.b && this.b < 255.5)
45621
- && (0 <= this.opacity && this.opacity <= 1);
45622
- },
45623
- hex: rgb_formatHex, // Deprecated! Use color.formatHex.
45624
- formatHex: rgb_formatHex,
45625
- formatHex8: rgb_formatHex8,
45626
- formatRgb: rgb_formatRgb,
45627
- toString: rgb_formatRgb
45628
- }));
45629
-
45630
- function rgb_formatHex() {
45631
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
45632
- }
45633
-
45634
- function rgb_formatHex8() {
45635
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
45636
- }
45637
-
45638
- function rgb_formatRgb() {
45639
- const a = clampa(this.opacity);
45640
- return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
45641
- }
45642
-
45643
- function clampa(opacity) {
45644
- return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
45645
- }
45646
-
45647
- function clampi(value) {
45648
- return Math.max(0, Math.min(255, Math.round(value) || 0));
45649
- }
45650
-
45651
- function hex(value) {
45652
- value = clampi(value);
45653
- return (value < 16 ? "0" : "") + value.toString(16);
45654
- }
45655
-
45656
- function hsla(h, s, l, a) {
45657
- if (a <= 0) h = s = l = NaN;
45658
- else if (l <= 0 || l >= 1) h = s = NaN;
45659
- else if (s <= 0) h = NaN;
45660
- return new Hsl(h, s, l, a);
45661
- }
45662
-
45663
- function hslConvert(o) {
45664
- if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
45665
- if (!(o instanceof Color)) o = color(o);
45666
- if (!o) return new Hsl;
45667
- if (o instanceof Hsl) return o;
45668
- o = o.rgb();
45669
- var r = o.r / 255,
45670
- g = o.g / 255,
45671
- b = o.b / 255,
45672
- min = Math.min(r, g, b),
45673
- max = Math.max(r, g, b),
45674
- h = NaN,
45675
- s = max - min,
45676
- l = (max + min) / 2;
45677
- if (s) {
45678
- if (r === max) h = (g - b) / s + (g < b) * 6;
45679
- else if (g === max) h = (b - r) / s + 2;
45680
- else h = (r - g) / s + 4;
45681
- s /= l < 0.5 ? max + min : 2 - max - min;
45682
- h *= 60;
45683
- } else {
45684
- s = l > 0 && l < 1 ? 0 : h;
45685
- }
45686
- return new Hsl(h, s, l, o.opacity);
45687
- }
45688
-
45689
- function hsl(h, s, l, opacity) {
45690
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
45691
- }
45692
-
45693
- function Hsl(h, s, l, opacity) {
45694
- this.h = +h;
45695
- this.s = +s;
45696
- this.l = +l;
45697
- this.opacity = +opacity;
45698
- }
45699
-
45700
- define(Hsl, hsl, extend(Color, {
45701
- brighter(k) {
45702
- k = k == null ? brighter : Math.pow(brighter, k);
45703
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45704
- },
45705
- darker(k) {
45706
- k = k == null ? darker : Math.pow(darker, k);
45707
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45708
- },
45709
- rgb() {
45710
- var h = this.h % 360 + (this.h < 0) * 360,
45711
- s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
45712
- l = this.l,
45713
- m2 = l + (l < 0.5 ? l : 1 - l) * s,
45714
- m1 = 2 * l - m2;
45715
- return new Rgb(
45716
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
45717
- hsl2rgb(h, m1, m2),
45718
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
45719
- this.opacity
45720
- );
45721
- },
45722
- clamp() {
45723
- return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
45724
- },
45725
- displayable() {
45726
- return (0 <= this.s && this.s <= 1 || isNaN(this.s))
45727
- && (0 <= this.l && this.l <= 1)
45728
- && (0 <= this.opacity && this.opacity <= 1);
45729
- },
45730
- formatHsl() {
45731
- const a = clampa(this.opacity);
45732
- return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
45733
- }
45734
- }));
45735
-
45736
- function clamph(value) {
45737
- value = (value || 0) % 360;
45738
- return value < 0 ? value + 360 : value;
45739
- }
45740
-
45741
- function clampt(value) {
45742
- return Math.max(0, Math.min(1, value || 0));
45743
- }
45744
-
45745
- /* From FvD 13.37, CSS Color Module Level 3 */
45746
- function hsl2rgb(h, m1, m2) {
45747
- return (h < 60 ? m1 + (m2 - m1) * h / 60
45748
- : h < 180 ? m2
45749
- : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
45750
- : m1) * 255;
45751
- }
45752
-
45753
45864
  var constant = x => () => x;
45754
45865
 
45755
45866
  function linear$1(a, d) {
@@ -48589,7 +48700,7 @@
48589
48700
  }
48590
48701
  if (!v.delaunay) return false;
48591
48702
  const _distances = v.delaunay.edges.map(e =>
48592
- geoDistance(v.points[e[0]], v.points[e[1]])
48703
+ geoDistance$1(v.points[e[0]], v.points[e[1]])
48593
48704
  ),
48594
48705
  _urquart = v.delaunay.urquhart(_distances);
48595
48706
  return {
@@ -48649,7 +48760,7 @@
48649
48760
  v._found = undefined;
48650
48761
  v.find = function(x, y, radius) {
48651
48762
  v._found = v.delaunay.find(x, y, v._found);
48652
- if (!radius || geoDistance([x, y], v.points[v._found]) < radius)
48763
+ if (!radius || geoDistance$1([x, y], v.points[v._found]) < radius)
48653
48764
  return v._found;
48654
48765
  };
48655
48766
 
@@ -48961,7 +49072,7 @@
48961
49072
  var prevPnt;
48962
49073
  coords.forEach(function (pnt) {
48963
49074
  if (prevPnt) {
48964
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
49075
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
48965
49076
  if (dist > maxDistance) {
48966
49077
  var interpol = geoInterpolate(prevPnt, pnt);
48967
49078
  var tStep = 1 / Math.ceil(dist / maxDistance);
@@ -49049,14 +49160,14 @@
49049
49160
  return crossesPoleOrAntimeridian ? geoContains(polygon, pnt) : booleanPointInPolygon(pnt, polygon);
49050
49161
  }
49051
49162
 
49052
- var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
49163
+ var THREE$k = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
49053
49164
  : {
49054
49165
  BufferGeometry: BufferGeometry,
49055
49166
  Float32BufferAttribute: Float32BufferAttribute
49056
49167
  };
49057
49168
 
49058
49169
  // support both modes for backwards threejs compatibility
49059
- var setAttributeFn$3 = new THREE$i.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49170
+ var setAttributeFn$2 = new THREE$k.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49060
49171
  var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
49061
49172
  _inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
49062
49173
  var _super = _createSuper$1(ConicPolygonBufferGeometry);
@@ -49111,8 +49222,8 @@
49111
49222
 
49112
49223
  // build geometry
49113
49224
  _this.setIndex(indices);
49114
- _this[setAttributeFn$3]('position', new THREE$i.Float32BufferAttribute(vertices, 3));
49115
- _this[setAttributeFn$3]('uv', new THREE$i.Float32BufferAttribute(uvs, 2));
49225
+ _this[setAttributeFn$2]('position', new THREE$k.Float32BufferAttribute(vertices, 3));
49226
+ _this[setAttributeFn$2]('uv', new THREE$k.Float32BufferAttribute(uvs, 2));
49116
49227
 
49117
49228
  // auto-calculate normals
49118
49229
  _this.computeVertexNormals();
@@ -49176,7 +49287,7 @@
49176
49287
  return _this;
49177
49288
  }
49178
49289
  return _createClass$1(ConicPolygonBufferGeometry);
49179
- }(THREE$i.BufferGeometry); //
49290
+ }(THREE$k.BufferGeometry); //
49180
49291
  function polar2Cartesian$1(lat, lng) {
49181
49292
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
49182
49293
  var phi = (90 - lat) * Math.PI / 180;
@@ -64135,6 +64246,449 @@
64135
64246
  return rad * 180 / Math.PI;
64136
64247
  }
64137
64248
 
64249
+ function interpolateTurbo(t) {
64250
+ t = Math.max(0, Math.min(1, t));
64251
+ return "rgb("
64252
+ + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", "
64253
+ + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", "
64254
+ + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))
64255
+ + ")";
64256
+ }
64257
+
64258
+ var bounds3 = Bounds3$2;
64259
+
64260
+ function Bounds3$2(x, y, z, half) {
64261
+ this.x = typeof x === 'number' ? x : 0;
64262
+ this.y = typeof y === 'number' ? y : 0;
64263
+ this.z = typeof z === 'number' ? z : 0;
64264
+ this.half = typeof half === 'number' ? half : 0;
64265
+ }
64266
+
64267
+ Bounds3$2.prototype.contains = function contains(x, y, z) {
64268
+ var half = this.half;
64269
+ return this.x - half <= x && x < this.x + half &&
64270
+ this.y - half <= y && y < this.y + half &&
64271
+ this.z - half <= z && z < this.z + half;
64272
+ };
64273
+
64274
+ var Bounds3$1 = bounds3;
64275
+ var MAX_ITEMS = 4;
64276
+
64277
+ var treeNode = TreeNode$1;
64278
+
64279
+ function TreeNode$1(bounds) {
64280
+ this.bounds = bounds;
64281
+ this.q0 = null;
64282
+ this.q1 = null;
64283
+ this.q2 = null;
64284
+ this.q3 = null;
64285
+ this.q4 = null;
64286
+ this.q5 = null;
64287
+ this.q6 = null;
64288
+ this.q7 = null;
64289
+ this.items = null;
64290
+ }
64291
+
64292
+ TreeNode$1.prototype.subdivide = function subdivide() {
64293
+ var bounds = this.bounds;
64294
+ var quarter = bounds.half / 2;
64295
+
64296
+ this.q0 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y - quarter, bounds.z - quarter, quarter));
64297
+ this.q1 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y - quarter, bounds.z - quarter, quarter));
64298
+ this.q2 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y + quarter, bounds.z - quarter, quarter));
64299
+ this.q3 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y + quarter, bounds.z - quarter, quarter));
64300
+ this.q4 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y - quarter, bounds.z + quarter, quarter));
64301
+ this.q5 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y - quarter, bounds.z + quarter, quarter));
64302
+ this.q6 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y + quarter, bounds.z + quarter, quarter));
64303
+ this.q7 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y + quarter, bounds.z + quarter, quarter));
64304
+ };
64305
+
64306
+ TreeNode$1.prototype.insert = function insert(idx, array, depth) {
64307
+ var isLeaf = this.q0 === null;
64308
+ if (isLeaf) {
64309
+ // TODO: this memory could be recycled to avoid GC
64310
+ if (this.items === null) {
64311
+ this.items = [idx];
64312
+ } else {
64313
+ this.items.push(idx);
64314
+ }
64315
+ if (this.items.length >= MAX_ITEMS && depth < 16) {
64316
+ this.subdivide();
64317
+ for (var i = 0; i < this.items.length; ++i) {
64318
+ this.insert(this.items[i], array, depth + 1);
64319
+ }
64320
+ this.items = null;
64321
+ }
64322
+ } else {
64323
+ var x = array[idx],
64324
+ y = array[idx + 1],
64325
+ z = array[idx + 2];
64326
+ var bounds = this.bounds;
64327
+ var quadIdx = 0; // assume NW
64328
+ if (x > bounds.x) {
64329
+ quadIdx += 1; // nope, we are in E part
64330
+ }
64331
+ if (y > bounds.y) {
64332
+ quadIdx += 2; // Somewhere south.
64333
+ }
64334
+ if (z > bounds.z) {
64335
+ quadIdx += 4; // Somewhere far
64336
+ }
64337
+
64338
+ var child = getChild(this, quadIdx);
64339
+ child.insert(idx, array, depth + 1);
64340
+ }
64341
+ };
64342
+
64343
+ TreeNode$1.prototype.query = function queryBounds(results, sourceArray, intersects, preciseCheck) {
64344
+ if (!intersects(this.bounds)) return;
64345
+ var items = this.items;
64346
+ var needsCheck = typeof preciseCheck === 'function';
64347
+ if (items) {
64348
+ for (var i = 0; i < items.length; ++i) {
64349
+ var idx = items[i];
64350
+ if (needsCheck) {
64351
+ if (preciseCheck(sourceArray[idx], sourceArray[idx + 1], sourceArray[idx + 2])) {
64352
+ results.push(idx);
64353
+ }
64354
+ } else {
64355
+ results.push(idx);
64356
+ }
64357
+ }
64358
+ }
64359
+
64360
+ if (!this.q0) return;
64361
+
64362
+ this.q0.query(results, sourceArray, intersects, preciseCheck);
64363
+ this.q1.query(results, sourceArray, intersects, preciseCheck);
64364
+ this.q2.query(results, sourceArray, intersects, preciseCheck);
64365
+ this.q3.query(results, sourceArray, intersects, preciseCheck);
64366
+ this.q4.query(results, sourceArray, intersects, preciseCheck);
64367
+ this.q5.query(results, sourceArray, intersects, preciseCheck);
64368
+ this.q6.query(results, sourceArray, intersects, preciseCheck);
64369
+ this.q7.query(results, sourceArray, intersects, preciseCheck);
64370
+ };
64371
+
64372
+ function getChild(node, idx) {
64373
+ if (idx === 0) return node.q0;
64374
+ if (idx === 1) return node.q1;
64375
+ if (idx === 2) return node.q2;
64376
+ if (idx === 3) return node.q3;
64377
+ if (idx === 4) return node.q4;
64378
+ if (idx === 5) return node.q5;
64379
+ if (idx === 6) return node.q6;
64380
+ if (idx === 7) return node.q7;
64381
+ }
64382
+
64383
+ var rafor = asyncFor$1;
64384
+
64385
+ /**
64386
+ * Iterates over array in async manner. This function attempts to maximize
64387
+ * number of elements visited within single event loop cycle, while at the
64388
+ * same time tries to not exceed a time threshold allowed to stay within
64389
+ * event loop.
64390
+ *
64391
+ * @param {Array} array which needs to be iterated. Array-like objects are OK too.
64392
+ * @param {VisitCalback} visitCallback called for every element within for loop.
64393
+ * @param {DoneCallback} doneCallback called when iterator has reached end of array.
64394
+ * @param {Object=} options - additional configuration:
64395
+ * @param {number} [options.step=1] - default iteration step
64396
+ * @param {number} [options.maxTimeMS=8] - maximum time (in milliseconds) which
64397
+ * iterator should spend within single event loop.
64398
+ * @param {number} [options.probeElements=5000] - how many elements should iterator
64399
+ * visit to measure its iteration speed.
64400
+ */
64401
+ function asyncFor$1(array, visitCallback, doneCallback, options) {
64402
+ var start = 0;
64403
+ var elapsed = 0;
64404
+ options = options || {};
64405
+ var step = options.step || 1;
64406
+ var maxTimeMS = options.maxTimeMS || 8;
64407
+ var pointsPerLoopCycle = options.probeElements || 5000;
64408
+ // we should never block main thread for too long...
64409
+ setTimeout(processSubset, 0);
64410
+
64411
+ function processSubset() {
64412
+ var finish = Math.min(array.length, start + pointsPerLoopCycle);
64413
+ var i = start;
64414
+ var timeStart = new Date();
64415
+ for (i = start; i < finish; i += step) {
64416
+ visitCallback(array[i], i, array);
64417
+ }
64418
+ if (i < array.length) {
64419
+ elapsed += (new Date() - timeStart);
64420
+ start = i;
64421
+
64422
+ pointsPerLoopCycle = Math.round(start * maxTimeMS/elapsed);
64423
+ setTimeout(processSubset, 0);
64424
+ } else {
64425
+ doneCallback(array);
64426
+ }
64427
+ }
64428
+ }
64429
+
64430
+ /**
64431
+ * Represents octree data structure
64432
+ *
64433
+ * https://en.wikipedia.org/wiki/Octree
64434
+ */
64435
+
64436
+ var Bounds3 = bounds3;
64437
+ var TreeNode = treeNode;
64438
+ var EmptyRegion = new Bounds3();
64439
+ var asyncFor = rafor;
64440
+
64441
+ var yaot = createTree;
64442
+
64443
+ function createTree(options) {
64444
+ var noPoints = [];
64445
+
64446
+ var root;
64447
+ var originalArray;
64448
+ var api = {
64449
+ /**
64450
+ * Initializes tree asynchronously. Very useful when you have millions
64451
+ * of points and do not want to block rendering thread for too long.
64452
+ *
64453
+ * @param {number[]} points array of points for which we are building the
64454
+ * tree. Flat sequence of (x, y, z) coordinates. Array length should be
64455
+ * multiple of 3.
64456
+ *
64457
+ * @param {Function=} doneCallback called when tree is initialized. The
64458
+ * callback will be called with single argument which represent current
64459
+ * tree.
64460
+ */
64461
+ initAsync: initAsync,
64462
+
64463
+ /**
64464
+ * Synchronous version of `initAsync()`. Should only be used for small
64465
+ * trees (less than 50-70k of points).
64466
+ *
64467
+ * @param {number[]} points array of points for which we are building the
64468
+ * tree. Flat sequence of (x, y, z) coordinates. Array length should be
64469
+ * multiple of 3.
64470
+ */
64471
+ init: init,
64472
+
64473
+ /**
64474
+ * Gets bounds of the root node. Bounds are represented by center of the
64475
+ * node (x, y, z) and `half` attribute - distance from the center to an
64476
+ * edge of the root node.
64477
+ */
64478
+ bounds: getBounds,
64479
+
64480
+ /**
64481
+ * Fires a ray from `rayOrigin` into `rayDirection` and collects all points
64482
+ * that lie in the octants intersected by the ray.
64483
+ *
64484
+ * This method implements An Efficient Parametric Algorithm for Octree Traversal
64485
+ * described in http://wscg.zcu.cz/wscg2000/Papers_2000/X31.pdf
64486
+ *
64487
+ * @param {Vector3} rayOrigin x,y,z coordinates where ray starts
64488
+ * @param {Vector3} rayDirection normalized x,y,z direction where ray shoots.
64489
+ * @param {number+} near minimum distance from the ray origin. 0 by default.
64490
+ * @param {number+} far maximum length of the ray. POSITIVE_INFINITY by default
64491
+ *
64492
+ * @return {Array} of indices in the source array. Each index represnts a start
64493
+ * of the x,y,z triplet of a point, that lies in the intersected octant.
64494
+ */
64495
+ intersectRay: intersectRay,
64496
+
64497
+ /**
64498
+ * Once you have collected points from the octants intersected by a ray
64499
+ * (`intersectRay()` method), it may be worth to query points from the surrouning
64500
+ * area.
64501
+ */
64502
+ intersectSphere: intersectSphere,
64503
+
64504
+ /**
64505
+ * Gets root node of the tree
64506
+ */
64507
+ getRoot: getRoot
64508
+ };
64509
+
64510
+ return api;
64511
+
64512
+ function getRoot() {
64513
+ return root;
64514
+ }
64515
+
64516
+ function intersectSphere(cx, cy, cz, r) {
64517
+ if (!root) {
64518
+ // Most likely we are not initialized yet
64519
+ return noPoints;
64520
+ }
64521
+ var indices = [];
64522
+ var r2 = r * r;
64523
+ root.query(indices, originalArray, intersectCheck, preciseCheck);
64524
+ return indices;
64525
+
64526
+ // http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test
64527
+ function intersectCheck(candidate) {
64528
+ var dist = r2;
64529
+ var half = candidate.half;
64530
+ if (cx < candidate.x - half) dist -= sqr(cx - (candidate.x - half));
64531
+ else if (cx > candidate.x + half) dist -= sqr(cx - (candidate.x + half));
64532
+
64533
+ if (cy < candidate.y - half) dist -= sqr(cy - (candidate.y - half));
64534
+ else if (cy > candidate.y + half) dist -= sqr(cy - (candidate.y + half));
64535
+
64536
+ if (cz < candidate.z - half) dist -= sqr(cz - (candidate.z - half));
64537
+ else if (cz > candidate.z + half) dist -= sqr(cz - (candidate.z + half));
64538
+ return dist > 0;
64539
+ }
64540
+
64541
+ function preciseCheck(x, y, z) {
64542
+ return sqr(x - cx) + sqr(y - cy) + sqr(z - cz) < r2;
64543
+ }
64544
+ }
64545
+
64546
+ function sqr(x) {
64547
+ return x * x;
64548
+ }
64549
+
64550
+ function intersectRay(rayOrigin, rayDirection, near, far) {
64551
+ if (!root) {
64552
+ // Most likely we are not initialized yet
64553
+ return noPoints;
64554
+ }
64555
+
64556
+ if (near === undefined) near = 0;
64557
+ if (far === undefined) far = Number.POSITIVE_INFINITY;
64558
+ // we save as squar, to avoid expensive sqrt() operation
64559
+ near *= near;
64560
+ far *= far;
64561
+
64562
+ var indices = [];
64563
+ root.query(indices, originalArray, intersectCheck, farEnough);
64564
+ return indices.sort(byDistanceToCamera);
64565
+
64566
+ function intersectCheck(candidate) {
64567
+ // using http://wscg.zcu.cz/wscg2000/Papers_2000/X31.pdf
64568
+ var half = candidate.half;
64569
+ var t1 = (candidate.x - half - rayOrigin.x) / rayDirection.x,
64570
+ t2 = (candidate.x + half - rayOrigin.x) / rayDirection.x,
64571
+ t3 = (candidate.y + half - rayOrigin.y) / rayDirection.y,
64572
+ t4 = (candidate.y - half - rayOrigin.y) / rayDirection.y,
64573
+ t5 = (candidate.z - half - rayOrigin.z) / rayDirection.z,
64574
+ t6 = (candidate.z + half - rayOrigin.z) / rayDirection.z,
64575
+ tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)),
64576
+ tmin;
64577
+
64578
+ if (tmax < 0) return false;
64579
+
64580
+ tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6));
64581
+ return tmin <= tmax && tmin <= far;
64582
+ }
64583
+
64584
+ function farEnough(x, y, z) {
64585
+ var dist = (x - rayOrigin.x) * (x - rayOrigin.x) +
64586
+ (y - rayOrigin.y) * (y - rayOrigin.y) +
64587
+ (z - rayOrigin.z) * (z - rayOrigin.z);
64588
+ return near <= dist && dist <= far;
64589
+ }
64590
+
64591
+ function byDistanceToCamera(idx0, idx1) {
64592
+ var x0 = rayOrigin[idx0];
64593
+ var y0 = rayOrigin[idx0 + 1];
64594
+ var z0 = rayOrigin[idx0 + 2];
64595
+ var dist0 = (x0 - rayOrigin.x) * (x0 - rayOrigin.x) +
64596
+ (y0 - rayOrigin.y) * (y0 - rayOrigin.y) +
64597
+ (z0 - rayOrigin.z) * (z0 - rayOrigin.z);
64598
+
64599
+ var x1 = rayOrigin[idx1];
64600
+ var y1 = rayOrigin[idx1 + 1];
64601
+ var z1 = rayOrigin[idx1 + 2];
64602
+
64603
+ var dist1 = (x1 - rayOrigin.x) * (x1 - rayOrigin.x) +
64604
+ (y1 - rayOrigin.y) * (y1 - rayOrigin.y) +
64605
+ (z1 - rayOrigin.z) * (z1 - rayOrigin.z);
64606
+ return dist0 - dist1;
64607
+ }
64608
+ }
64609
+
64610
+ function init(points) {
64611
+ verifyPointsInvariant(points);
64612
+ originalArray = points;
64613
+ root = createRootNode(points);
64614
+ for (var i = 0; i < points.length; i += 3) {
64615
+ root.insert(i, originalArray, 0);
64616
+ }
64617
+ }
64618
+
64619
+ function initAsync(points, doneCallback) {
64620
+ verifyPointsInvariant(points);
64621
+
64622
+ var tempRoot = createRootNode(points);
64623
+ asyncFor(points, insertToRoot, doneInternal, { step: 3 });
64624
+
64625
+ function insertToRoot(element, i) {
64626
+ tempRoot.insert(i, points, 0);
64627
+ }
64628
+
64629
+ function doneInternal() {
64630
+ originalArray = points;
64631
+ root = tempRoot;
64632
+ if (typeof doneCallback === 'function') {
64633
+ doneCallback(api);
64634
+ }
64635
+ }
64636
+ }
64637
+
64638
+ function verifyPointsInvariant(points) {
64639
+ if (!points) throw new Error('Points array is required for quadtree to work');
64640
+ if (typeof points.length !== 'number') throw new Error('Points should be array-like object');
64641
+ if (points.length % 3 !== 0) throw new Error('Points array should consist of series of x,y,z coordinates and be multiple of 3');
64642
+ }
64643
+
64644
+ function getBounds() {
64645
+ if (!root) return EmptyRegion;
64646
+ return root.bounds;
64647
+ }
64648
+
64649
+ function createRootNode(points) {
64650
+ // Edge case deserves empty region:
64651
+ if (points.length === 0) {
64652
+ var empty = new Bounds3();
64653
+ return new TreeNode(empty);
64654
+ }
64655
+
64656
+ // Otherwise let's figure out how big should be the root region
64657
+ var minX = Number.POSITIVE_INFINITY;
64658
+ var minY = Number.POSITIVE_INFINITY;
64659
+ var minZ = Number.POSITIVE_INFINITY;
64660
+ var maxX = Number.NEGATIVE_INFINITY;
64661
+ var maxY = Number.NEGATIVE_INFINITY;
64662
+ var maxZ = Number.NEGATIVE_INFINITY;
64663
+ for (var i = 0; i < points.length; i += 3) {
64664
+ var x = points[i],
64665
+ y = points[i + 1],
64666
+ z = points[i + 2];
64667
+ if (x < minX) minX = x;
64668
+ if (x > maxX) maxX = x;
64669
+ if (y < minY) minY = y;
64670
+ if (y > maxY) maxY = y;
64671
+ if (z < minZ) minZ = z;
64672
+ if (z > maxZ) maxZ = z;
64673
+ }
64674
+
64675
+ // Make bounds square:
64676
+ var side = Math.max(Math.max(maxX - minX, maxY - minY), maxZ - minZ);
64677
+ // since we need to have both sides inside the area, let's artificially
64678
+ // grow the root region:
64679
+ side += 2;
64680
+ minX -= 1;
64681
+ minY -= 1;
64682
+ minZ -= 1;
64683
+ var half = side / 2;
64684
+
64685
+ var bounds = new Bounds3(minX + half, minY + half, minZ + half, half);
64686
+ return new TreeNode(bounds);
64687
+ }
64688
+ }
64689
+
64690
+ var yaOctree = /*@__PURE__*/getDefaultExportFromCjs(yaot);
64691
+
64138
64692
  const THREE$2$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64139
64693
  : {
64140
64694
  Box3,
@@ -64149,7 +64703,7 @@
64149
64703
  };
64150
64704
 
64151
64705
  // support multiple method names for backwards threejs compatibility
64152
- var setAttributeFn$1$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64706
+ var setAttributeFn$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64153
64707
  const _box$1 = new THREE$2$1.Box3();
64154
64708
  const _vector = new THREE$2$1.Vector3();
64155
64709
  class LineSegmentsGeometry extends THREE$2$1.InstancedBufferGeometry {
@@ -64160,8 +64714,8 @@
64160
64714
  const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
64161
64715
  const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
64162
64716
  this.setIndex(index);
64163
- this[setAttributeFn$1$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
64164
- this[setAttributeFn$1$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
64717
+ this[setAttributeFn$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
64718
+ this[setAttributeFn$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
64165
64719
  }
64166
64720
  applyMatrix4(matrix) {
64167
64721
  const start = this.attributes.instanceStart;
@@ -64188,9 +64742,9 @@
64188
64742
  }
64189
64743
  const instanceBuffer = new THREE$2$1.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz
64190
64744
 
64191
- this[setAttributeFn$1$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
64745
+ this[setAttributeFn$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
64192
64746
 
64193
- this[setAttributeFn$1$1]('instanceEnd', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz
64747
+ this[setAttributeFn$1]('instanceEnd', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz
64194
64748
  //
64195
64749
 
64196
64750
  this.computeBoundingBox();
@@ -64206,9 +64760,9 @@
64206
64760
  }
64207
64761
  const instanceColorBuffer = new THREE$2$1.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb
64208
64762
 
64209
- this[setAttributeFn$1$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
64763
+ this[setAttributeFn$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
64210
64764
 
64211
- this[setAttributeFn$1$1]('instanceColorEnd', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb
64765
+ this[setAttributeFn$1]('instanceColorEnd', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb
64212
64766
 
64213
64767
  return this;
64214
64768
  }
@@ -64823,7 +65377,7 @@
64823
65377
  }
64824
65378
  LineMaterial.prototype.isLineMaterial = true;
64825
65379
 
64826
- const THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65380
+ const THREE$j = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64827
65381
  : {
64828
65382
  Box3,
64829
65383
  BufferGeometry,
@@ -64839,20 +65393,20 @@
64839
65393
  };
64840
65394
 
64841
65395
  // support both modes for backwards threejs compatibility
64842
- var setAttributeFn$2 = new THREE$h.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64843
- const _start = new THREE$h.Vector3();
64844
- const _end = new THREE$h.Vector3();
64845
- const _start4 = new THREE$h.Vector4();
64846
- const _end4 = new THREE$h.Vector4();
64847
- const _ssOrigin = new THREE$h.Vector4();
64848
- const _ssOrigin3 = new THREE$h.Vector3();
64849
- const _mvMatrix = new THREE$h.Matrix4();
64850
- const _line = new THREE$h.Line3();
64851
- const _closestPoint = new THREE$h.Vector3();
64852
- const _box = new THREE$h.Box3();
64853
- const _sphere = new THREE$h.Sphere();
64854
- const _clipToWorldVector = new THREE$h.Vector4();
64855
- class LineSegments2 extends THREE$h.Mesh {
65396
+ var setAttributeFn = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
65397
+ const _start = new THREE$j.Vector3();
65398
+ const _end = new THREE$j.Vector3();
65399
+ const _start4 = new THREE$j.Vector4();
65400
+ const _end4 = new THREE$j.Vector4();
65401
+ const _ssOrigin = new THREE$j.Vector4();
65402
+ const _ssOrigin3 = new THREE$j.Vector3();
65403
+ const _mvMatrix = new THREE$j.Matrix4();
65404
+ const _line = new THREE$j.Line3();
65405
+ const _closestPoint = new THREE$j.Vector3();
65406
+ const _box = new THREE$j.Box3();
65407
+ const _sphere = new THREE$j.Sphere();
65408
+ const _clipToWorldVector = new THREE$j.Vector4();
65409
+ class LineSegments2 extends THREE$j.Mesh {
64856
65410
  constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
64857
65411
  color: Math.random() * 0xffffff
64858
65412
  })) {
@@ -64871,11 +65425,11 @@
64871
65425
  lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
64872
65426
  lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
64873
65427
  }
64874
- const instanceDistanceBuffer = new THREE$h.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
65428
+ const instanceDistanceBuffer = new THREE$j.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
64875
65429
 
64876
- geometry[setAttributeFn$2]('instanceDistanceStart', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
65430
+ geometry[setAttributeFn]('instanceDistanceStart', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
64877
65431
 
64878
- geometry[setAttributeFn$2]('instanceDistanceEnd', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
65432
+ geometry[setAttributeFn]('instanceDistanceEnd', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
64879
65433
 
64880
65434
  return this;
64881
65435
  }
@@ -64997,7 +65551,7 @@
64997
65551
  const param = _line.closestPointToPointParameter(_ssOrigin3, true);
64998
65552
  _line.at(param, _closestPoint); // check if the intersection point is within clip space
64999
65553
 
65000
- const zPos = THREE$h.MathUtils.lerp(_start4.z, _end4.z, param);
65554
+ const zPos = THREE$j.MathUtils.lerp(_start4.z, _end4.z, param);
65001
65555
  const isInClipSpace = zPos >= -1 && zPos <= 1;
65002
65556
  const isInside = _ssOrigin3.distanceTo(_closestPoint) < lineWidth * 0.5;
65003
65557
  if (isInClipSpace && isInside) {
@@ -65005,8 +65559,8 @@
65005
65559
  _line.end.fromBufferAttribute(instanceEnd, i);
65006
65560
  _line.start.applyMatrix4(matrixWorld);
65007
65561
  _line.end.applyMatrix4(matrixWorld);
65008
- const pointOnLine = new THREE$h.Vector3();
65009
- const point = new THREE$h.Vector3();
65562
+ const pointOnLine = new THREE$j.Vector3();
65563
+ const point = new THREE$j.Vector3();
65010
65564
  ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
65011
65565
  intersects.push({
65012
65566
  point: point,
@@ -65277,53 +65831,53 @@
65277
65831
 
65278
65832
  }
65279
65833
 
65280
- function _iterableToArrayLimit$1(arr, i) {
65281
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
65282
- if (null != _i) {
65283
- var _s,
65284
- _e,
65285
- _x,
65286
- _r,
65287
- _arr = [],
65288
- _n = !0,
65289
- _d = !1;
65834
+ function _iterableToArrayLimit$1(r, l) {
65835
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
65836
+ if (null != t) {
65837
+ var e,
65838
+ n,
65839
+ i,
65840
+ u,
65841
+ a = [],
65842
+ f = !0,
65843
+ o = !1;
65290
65844
  try {
65291
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
65292
- if (Object(_i) !== _i) return;
65293
- _n = !1;
65294
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
65295
- } catch (err) {
65296
- _d = !0, _e = err;
65845
+ if (i = (t = t.call(r)).next, 0 === l) {
65846
+ if (Object(t) !== t) return;
65847
+ f = !1;
65848
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
65849
+ } catch (r) {
65850
+ o = !0, n = r;
65297
65851
  } finally {
65298
65852
  try {
65299
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
65853
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
65300
65854
  } finally {
65301
- if (_d) throw _e;
65855
+ if (o) throw n;
65302
65856
  }
65303
65857
  }
65304
- return _arr;
65858
+ return a;
65305
65859
  }
65306
65860
  }
65307
- function ownKeys(object, enumerableOnly) {
65308
- var keys = Object.keys(object);
65861
+ function ownKeys(e, r) {
65862
+ var t = Object.keys(e);
65309
65863
  if (Object.getOwnPropertySymbols) {
65310
- var symbols = Object.getOwnPropertySymbols(object);
65311
- enumerableOnly && (symbols = symbols.filter(function (sym) {
65312
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65313
- })), keys.push.apply(keys, symbols);
65864
+ var o = Object.getOwnPropertySymbols(e);
65865
+ r && (o = o.filter(function (r) {
65866
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
65867
+ })), t.push.apply(t, o);
65314
65868
  }
65315
- return keys;
65316
- }
65317
- function _objectSpread2(target) {
65318
- for (var i = 1; i < arguments.length; i++) {
65319
- var source = null != arguments[i] ? arguments[i] : {};
65320
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
65321
- _defineProperty$1(target, key, source[key]);
65322
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
65323
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
65869
+ return t;
65870
+ }
65871
+ function _objectSpread2(e) {
65872
+ for (var r = 1; r < arguments.length; r++) {
65873
+ var t = null != arguments[r] ? arguments[r] : {};
65874
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
65875
+ _defineProperty$1(e, r, t[r]);
65876
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
65877
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
65324
65878
  });
65325
65879
  }
65326
- return target;
65880
+ return e;
65327
65881
  }
65328
65882
  function _classCallCheck(instance, Constructor) {
65329
65883
  if (!(instance instanceof Constructor)) {
@@ -65519,6 +66073,56 @@
65519
66073
  var key = _toPrimitive$1(arg, "string");
65520
66074
  return typeof key === "symbol" ? key : String(key);
65521
66075
  }
66076
+ function _classPrivateFieldGet(receiver, privateMap) {
66077
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
66078
+ return _classApplyDescriptorGet(receiver, descriptor);
66079
+ }
66080
+ function _classPrivateFieldSet(receiver, privateMap, value) {
66081
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
66082
+ _classApplyDescriptorSet(receiver, descriptor, value);
66083
+ return value;
66084
+ }
66085
+ function _classExtractFieldDescriptor(receiver, privateMap, action) {
66086
+ if (!privateMap.has(receiver)) {
66087
+ throw new TypeError("attempted to " + action + " private field on non-instance");
66088
+ }
66089
+ return privateMap.get(receiver);
66090
+ }
66091
+ function _classApplyDescriptorGet(receiver, descriptor) {
66092
+ if (descriptor.get) {
66093
+ return descriptor.get.call(receiver);
66094
+ }
66095
+ return descriptor.value;
66096
+ }
66097
+ function _classApplyDescriptorSet(receiver, descriptor, value) {
66098
+ if (descriptor.set) {
66099
+ descriptor.set.call(receiver, value);
66100
+ } else {
66101
+ if (!descriptor.writable) {
66102
+ throw new TypeError("attempted to set read only private field");
66103
+ }
66104
+ descriptor.value = value;
66105
+ }
66106
+ }
66107
+ function _classPrivateMethodGet(receiver, privateSet, fn) {
66108
+ if (!privateSet.has(receiver)) {
66109
+ throw new TypeError("attempted to get private field on non-instance");
66110
+ }
66111
+ return fn;
66112
+ }
66113
+ function _checkPrivateRedeclaration(obj, privateCollection) {
66114
+ if (privateCollection.has(obj)) {
66115
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
66116
+ }
66117
+ }
66118
+ function _classPrivateFieldInitSpec(obj, privateMap, value) {
66119
+ _checkPrivateRedeclaration(obj, privateMap);
66120
+ privateMap.set(obj, value);
66121
+ }
66122
+ function _classPrivateMethodInitSpec(obj, privateSet) {
66123
+ _checkPrivateRedeclaration(obj, privateSet);
66124
+ privateSet.add(obj);
66125
+ }
65522
66126
 
65523
66127
  var materialDispose = function materialDispose(material) {
65524
66128
  if (material instanceof Array) {
@@ -65615,7 +66219,7 @@
65615
66219
  return deg * Math.PI / 180;
65616
66220
  }
65617
66221
 
65618
- var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66222
+ var THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65619
66223
  : {
65620
66224
  BackSide: BackSide,
65621
66225
  BufferAttribute: BufferAttribute,
@@ -65635,7 +66239,7 @@
65635
66239
 
65636
66240
  // Based off: http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
65637
66241
  function createGlowMaterial(coefficient, color, power) {
65638
- return new THREE$f.ShaderMaterial({
66242
+ return new THREE$h.ShaderMaterial({
65639
66243
  depthWrite: false,
65640
66244
  fragmentShader: fragmentShader,
65641
66245
  transparent: true,
@@ -65644,7 +66248,7 @@
65644
66248
  value: coefficient
65645
66249
  },
65646
66250
  color: {
65647
- value: new THREE$f.Color(color)
66251
+ value: new THREE$h.Color(color)
65648
66252
  },
65649
66253
  power: {
65650
66254
  value: power
@@ -65664,7 +66268,7 @@
65664
66268
  var curPos = geometry.attributes.position.array[idx];
65665
66269
  position[idx] = curPos + normal * size;
65666
66270
  }
65667
- glowGeometry.setAttribute('position', new THREE$f.BufferAttribute(position, 3));
66271
+ glowGeometry.setAttribute('position', new THREE$h.BufferAttribute(position, 3));
65668
66272
  return glowGeometry;
65669
66273
  }
65670
66274
  function createGlowMesh(geometry) {
@@ -65677,12 +66281,12 @@
65677
66281
  var glowGeometry = createGlowGeometry(geometry, size);
65678
66282
  var glowMaterial = createGlowMaterial(coefficient, color, power);
65679
66283
  if (backside) {
65680
- glowMaterial.side = THREE$f.BackSide;
66284
+ glowMaterial.side = THREE$h.BackSide;
65681
66285
  }
65682
- return new THREE$f.Mesh(glowGeometry, glowMaterial);
66286
+ return new THREE$h.Mesh(glowGeometry, glowMaterial);
65683
66287
  }
65684
66288
 
65685
- var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66289
+ var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65686
66290
  : {
65687
66291
  Color: Color$1,
65688
66292
  LineBasicMaterial: LineBasicMaterial,
@@ -65747,16 +66351,16 @@
65747
66351
  },
65748
66352
  stateInit: function stateInit() {
65749
66353
  // create globe
65750
- var globeGeometry = new THREE$e.SphereGeometry(GLOBE_RADIUS, 75, 75);
65751
- var defaultGlobeMaterial = new THREE$e.MeshPhongMaterial({
66354
+ var globeGeometry = new THREE$g.SphereGeometry(GLOBE_RADIUS, 75, 75);
66355
+ var defaultGlobeMaterial = new THREE$g.MeshPhongMaterial({
65752
66356
  color: 0x000000
65753
66357
  });
65754
- var globeObj = new THREE$e.Mesh(globeGeometry, defaultGlobeMaterial);
66358
+ var globeObj = new THREE$g.Mesh(globeGeometry, defaultGlobeMaterial);
65755
66359
  globeObj.rotation.y = -Math.PI / 2; // face prime meridian along Z axis
65756
66360
  globeObj.__globeObjType = 'globe'; // Add object type
65757
66361
 
65758
66362
  // create graticules
65759
- var graticulesObj = new THREE$e.LineSegments(new GeoJsonGeometry(graticule10(), GLOBE_RADIUS, 2), new THREE$e.LineBasicMaterial({
66363
+ var graticulesObj = new THREE$g.LineSegments(new GeoJsonGeometry(graticule10(), GLOBE_RADIUS, 2), new THREE$g.LineBasicMaterial({
65760
66364
  color: 'lightgrey',
65761
66365
  transparent: true,
65762
66366
  opacity: 0.1
@@ -65783,10 +66387,10 @@
65783
66387
  if (changedProps.hasOwnProperty('globeImageUrl')) {
65784
66388
  if (!state.globeImageUrl) {
65785
66389
  // Black globe if no image
65786
- !globeMaterial.color && (globeMaterial.color = new THREE$e.Color(0x000000));
66390
+ !globeMaterial.color && (globeMaterial.color = new THREE$g.Color(0x000000));
65787
66391
  } else {
65788
- new THREE$e.TextureLoader().load(state.globeImageUrl, function (texture) {
65789
- texture.colorSpace = THREE$e.SRGBColorSpace;
66392
+ new THREE$g.TextureLoader().load(state.globeImageUrl, function (texture) {
66393
+ texture.colorSpace = THREE$g.SRGBColorSpace;
65790
66394
  globeMaterial.map = texture;
65791
66395
  globeMaterial.color = null;
65792
66396
  globeMaterial.needsUpdate = true;
@@ -65801,7 +66405,7 @@
65801
66405
  globeMaterial.bumpMap = null;
65802
66406
  globeMaterial.needsUpdate = true;
65803
66407
  } else {
65804
- state.bumpImageUrl && new THREE$e.TextureLoader().load(state.bumpImageUrl, function (texture) {
66408
+ state.bumpImageUrl && new THREE$g.TextureLoader().load(state.bumpImageUrl, function (texture) {
65805
66409
  globeMaterial.bumpMap = texture;
65806
66410
  globeMaterial.needsUpdate = true;
65807
66411
  });
@@ -65839,15 +66443,30 @@
65839
66443
  return isNaN(str) ? parseInt(tinycolor(str).toHex(), 16) : str;
65840
66444
  };
65841
66445
  var colorAlpha = function colorAlpha(str) {
65842
- return isNaN(str) ? tinycolor(str).getAlpha() : 1;
66446
+ return str && isNaN(str) ? color(str).opacity : 1;
65843
66447
  };
65844
66448
  var color2ShaderArr = function color2ShaderArr(str) {
65845
66449
  var includeAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
65846
- var rgba = tinycolor(str).toRgb();
65847
- var rgbArr = ['r', 'g', 'b'].map(function (d) {
65848
- return rgba[d] / 255;
65849
- });
65850
- return includeAlpha ? [].concat(_toConsumableArray$1(rgbArr), [rgba.a]) : rgbArr;
66450
+ var sRGBColorSpace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66451
+ var color;
66452
+ var alpha = 1;
66453
+ var rgbaMatch = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(str.trim().toLowerCase());
66454
+ if (rgbaMatch) {
66455
+ var _rgbaMatch$slice = rgbaMatch.slice(1),
66456
+ _rgbaMatch$slice2 = _slicedToArray$1(_rgbaMatch$slice, 4),
66457
+ r = _rgbaMatch$slice2[0],
66458
+ g = _rgbaMatch$slice2[1],
66459
+ b = _rgbaMatch$slice2[2],
66460
+ a = _rgbaMatch$slice2[3];
66461
+ color = new Color$1("rgb(".concat(+r, ",").concat(+g, ",").concat(+b, ")"));
66462
+ alpha = Math.min(+a, 1);
66463
+ } else {
66464
+ color = new Color$1(str);
66465
+ }
66466
+ sRGBColorSpace && color.convertLinearToSRGB(); // vertexColors expects linear, but shaders expect sRGB
66467
+
66468
+ var rgbArr = color.toArray();
66469
+ return includeAlpha ? [].concat(_toConsumableArray$1(rgbArr), [alpha]) : rgbArr;
65851
66470
  };
65852
66471
  function setMaterialOpacity(material, opacity, depthWrite) {
65853
66472
  material.opacity = opacity;
@@ -65857,6 +66476,29 @@
65857
66476
  return material;
65858
66477
  }
65859
66478
 
66479
+ var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66480
+ : {
66481
+ Float32BufferAttribute: Float32BufferAttribute
66482
+ };
66483
+ function array2BufferAttr(data, itemSize) {
66484
+ var BufferAttributeClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : THREE$f.Float32BufferAttribute;
66485
+ var ba = new BufferAttributeClass(data.length * itemSize, itemSize);
66486
+ itemSize === 1 ? data.forEach(function (val, idx) {
66487
+ return ba.setX(idx, val);
66488
+ }) : data.forEach(function (val, idx) {
66489
+ return ba.set(val, idx * itemSize);
66490
+ });
66491
+ return ba;
66492
+ }
66493
+ function bufferAttr2Array(ba) {
66494
+ var itemSize = ba.itemSize;
66495
+ var res = [];
66496
+ for (var i = 0; i < ba.count; i++) {
66497
+ res.push(ba.array.slice(i * itemSize, (i + 1) * itemSize));
66498
+ }
66499
+ return res;
66500
+ }
66501
+
65860
66502
  function threeDigest(data, scene) {
65861
66503
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
65862
66504
  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
@@ -65876,15 +66518,13 @@
65876
66518
  }, options));
65877
66519
  }
65878
66520
 
65879
- var THREE$d = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66521
+ var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65880
66522
  : {
65881
- BufferAttribute: BufferAttribute,
65882
66523
  BufferGeometry: BufferGeometry,
65883
66524
  Color: Color$1,
65884
66525
  CylinderGeometry: CylinderGeometry,
65885
66526
  Matrix4: Matrix4,
65886
66527
  Mesh: Mesh,
65887
- MeshBasicMaterial: MeshBasicMaterial,
65888
66528
  MeshLambertMaterial: MeshLambertMaterial,
65889
66529
  Object3D: Object3D,
65890
66530
  Vector3: Vector3
@@ -65894,8 +66534,6 @@
65894
66534
 
65895
66535
  //
65896
66536
 
65897
- // support multiple method names for backwards threejs compatibility
65898
- var applyMatrix4Fn$1 = new THREE$d.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
65899
66537
  var PointsLayerKapsule = index$2({
65900
66538
  props: {
65901
66539
  pointsData: {
@@ -65950,13 +66588,13 @@
65950
66588
  var colorAccessor = index$1(state.pointColor);
65951
66589
 
65952
66590
  // shared geometry
65953
- var pointGeometry = new THREE$d.CylinderGeometry(1, 1, 1, state.pointResolution);
65954
- pointGeometry[applyMatrix4Fn$1](new THREE$d.Matrix4().makeRotationX(Math.PI / 2));
65955
- pointGeometry[applyMatrix4Fn$1](new THREE$d.Matrix4().makeTranslation(0, 0, -0.5));
66591
+ var pointGeometry = new THREE$e.CylinderGeometry(1, 1, 1, state.pointResolution);
66592
+ pointGeometry.applyMatrix4(new THREE$e.Matrix4().makeRotationX(Math.PI / 2));
66593
+ pointGeometry.applyMatrix4(new THREE$e.Matrix4().makeTranslation(0, 0, -0.5));
65956
66594
  var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
65957
66595
  var pointMaterials = {}; // indexed by color
65958
66596
 
65959
- var scene = state.pointsMerge ? new THREE$d.Object3D() : state.scene; // use fake scene if merging points
66597
+ var scene = state.pointsMerge ? new THREE$e.Object3D() : state.scene; // use fake scene if merging points
65960
66598
 
65961
66599
  threeDigest(state.pointsData, scene, {
65962
66600
  createObj: createObj,
@@ -65964,7 +66602,7 @@
65964
66602
  });
65965
66603
  if (state.pointsMerge) {
65966
66604
  // merge points into a single mesh
65967
- var pointsGeometry = !state.pointsData.length ? new THREE$d.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
66605
+ var pointsGeometry = !state.pointsData.length ? new THREE$e.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
65968
66606
  var obj = d.__threeObj;
65969
66607
  d.__threeObj = undefined; // unbind merged points
65970
66608
 
@@ -65972,23 +66610,18 @@
65972
66610
 
65973
66611
  // apply mesh world transform to vertices
65974
66612
  obj.updateMatrix();
65975
- geom[applyMatrix4Fn$1](obj.matrix);
66613
+ geom.applyMatrix4(obj.matrix);
65976
66614
 
65977
66615
  // color vertices
65978
- var color = new THREE$d.Color(colorAccessor(d));
65979
- var nVertices = geom.attributes.position.count;
65980
- var colors = new Float32Array(nVertices * 3);
65981
- for (var i = 0, len = nVertices; i < len; i++) {
65982
- var idx = i * 3;
65983
- colors[idx] = color.r;
65984
- colors[idx + 1] = color.g;
65985
- colors[idx + 2] = color.b;
65986
- }
65987
- geom.setAttribute('color', new THREE$d.BufferAttribute(colors, 3));
66616
+ var color = color2ShaderArr(colorAccessor(d));
66617
+ geom.setAttribute('color', array2BufferAttr(_toConsumableArray$1(new Array(geom.getAttribute('position').count)).map(function () {
66618
+ return color;
66619
+ }), 4));
65988
66620
  return geom;
65989
66621
  }));
65990
- var points = new THREE$d.Mesh(pointsGeometry, new THREE$d.MeshBasicMaterial({
66622
+ var points = new THREE$e.Mesh(pointsGeometry, new THREE$e.MeshLambertMaterial({
65991
66623
  color: 0xffffff,
66624
+ transparent: true,
65992
66625
  vertexColors: true
65993
66626
  }));
65994
66627
  points.__globeObjType = 'points'; // Add object type
@@ -66001,7 +66634,7 @@
66001
66634
  //
66002
66635
 
66003
66636
  function createObj() {
66004
- var obj = new THREE$d.Mesh(pointGeometry);
66637
+ var obj = new THREE$e.Mesh(pointGeometry);
66005
66638
  obj.__globeObjType = 'point'; // Add object type
66006
66639
  return obj;
66007
66640
  }
@@ -66017,7 +66650,7 @@
66017
66650
  Object.assign(obj.position, polar2Cartesian(lat, lng));
66018
66651
 
66019
66652
  // orientate outwards
66020
- var globeCenter = state.pointsMerge ? new THREE$d.Vector3(0, 0, 0) : state.scene.localToWorld(new THREE$d.Vector3(0, 0, 0)); // translate from local to world coords
66653
+ var globeCenter = state.pointsMerge ? new THREE$e.Vector3(0, 0, 0) : state.scene.localToWorld(new THREE$e.Vector3(0, 0, 0)); // translate from local to world coords
66021
66654
  obj.lookAt(globeCenter);
66022
66655
 
66023
66656
  // scale radius and altitude
@@ -66053,7 +66686,7 @@
66053
66686
  obj.visible = showCyl;
66054
66687
  if (showCyl) {
66055
66688
  if (!pointMaterials.hasOwnProperty(color)) {
66056
- pointMaterials[color] = new THREE$d.MeshLambertMaterial({
66689
+ pointMaterials[color] = new THREE$e.MeshLambertMaterial({
66057
66690
  color: colorStr2Hex(color),
66058
66691
  transparent: opacity < 1,
66059
66692
  opacity: opacity
@@ -66067,12 +66700,11 @@
66067
66700
  });
66068
66701
 
66069
66702
  var _excluded$1 = ["stroke"];
66070
- var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66703
+ var THREE$d = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66071
66704
  : {
66072
66705
  BufferGeometry: BufferGeometry,
66073
66706
  CubicBezierCurve3: CubicBezierCurve3,
66074
66707
  Curve: Curve,
66075
- Float32BufferAttribute: Float32BufferAttribute,
66076
66708
  Group: Group$1,
66077
66709
  Line: Line,
66078
66710
  Mesh: Mesh,
@@ -66086,8 +66718,6 @@
66086
66718
 
66087
66719
  //
66088
66720
 
66089
- // support both modes for backwards threejs compatibility
66090
- var setAttributeFn$1 = new THREE$c.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
66091
66721
  var gradientShaders$1 = {
66092
66722
  uniforms: {
66093
66723
  // dash param defaults, all relative to full length
@@ -66172,15 +66802,15 @@
66172
66802
  methods: {
66173
66803
  pauseAnimation: function pauseAnimation(state) {
66174
66804
  var _state$ticker;
66175
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
66805
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
66176
66806
  },
66177
66807
  resumeAnimation: function resumeAnimation(state) {
66178
66808
  var _state$ticker2;
66179
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
66809
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
66180
66810
  },
66181
66811
  _destructor: function _destructor(state) {
66182
66812
  var _state$ticker3;
66183
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
66813
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
66184
66814
  }
66185
66815
  },
66186
66816
  init: function init(threeObj, state) {
@@ -66217,13 +66847,13 @@
66217
66847
  var dashGapAccessor = index$1(state.arcDashGap);
66218
66848
  var dashInitialGapAccessor = index$1(state.arcDashInitialGap);
66219
66849
  var dashAnimateTimeAccessor = index$1(state.arcDashAnimateTime);
66220
- var sharedMaterial = new THREE$c.ShaderMaterial(_objectSpread2(_objectSpread2({}, gradientShaders$1), {}, {
66850
+ var sharedMaterial = new THREE$d.ShaderMaterial(_objectSpread2(_objectSpread2({}, gradientShaders$1), {}, {
66221
66851
  transparent: true,
66222
- blending: THREE$c.NormalBlending
66852
+ blending: THREE$d.NormalBlending
66223
66853
  }));
66224
66854
  threeDigest(state.arcsData, state.scene, {
66225
66855
  createObj: function createObj() {
66226
- var obj = new THREE$c.Group(); // populated in updateObj
66856
+ var obj = new THREE$d.Group(); // populated in updateObj
66227
66857
 
66228
66858
  obj.__globeObjType = 'arc'; // Add object type
66229
66859
  return obj;
@@ -66234,7 +66864,7 @@
66234
66864
  if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
66235
66865
  // create or swap object types
66236
66866
  emptyObject(group);
66237
- var _obj = useTube ? new THREE$c.Mesh() : new THREE$c.Line(new THREE$c.BufferGeometry());
66867
+ var _obj = useTube ? new THREE$d.Mesh() : new THREE$d.Line(new THREE$d.BufferGeometry());
66238
66868
  _obj.material = sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
66239
66869
 
66240
66870
  group.add(_obj);
@@ -66274,8 +66904,8 @@
66274
66904
  true // run from end to start, to animate in the correct direction
66275
66905
  );
66276
66906
 
66277
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66278
- obj.geometry[setAttributeFn$1]('vertexRelDistance', vertexRelDistanceArray);
66907
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
66908
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
66279
66909
  var applyUpdate = function applyUpdate(td) {
66280
66910
  var _arc$__currentTargetD = arc.__currentTargetD = td,
66281
66911
  stroke = _arc$__currentTargetD.stroke,
@@ -66283,9 +66913,9 @@
66283
66913
  var curve = calcCurve(curveD);
66284
66914
  if (useTube) {
66285
66915
  obj.geometry && obj.geometry.dispose();
66286
- obj.geometry = new THREE$c.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
66287
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66288
- obj.geometry[setAttributeFn$1]('vertexRelDistance', vertexRelDistanceArray);
66916
+ obj.geometry = new THREE$d.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
66917
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
66918
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
66289
66919
  } else {
66290
66920
  obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
66291
66921
  }
@@ -66334,7 +66964,7 @@
66334
66964
  x = _polar2Cartesian.x,
66335
66965
  y = _polar2Cartesian.y,
66336
66966
  z = _polar2Cartesian.z;
66337
- return new THREE$c.Vector3(x, y, z);
66967
+ return new THREE$d.Vector3(x, y, z);
66338
66968
  };
66339
66969
 
66340
66970
  //calculate curve
@@ -66343,7 +66973,7 @@
66343
66973
  var altitude = alt;
66344
66974
  (altitude === null || altitude === undefined) && (
66345
66975
  // by default set altitude proportional to the great-arc distance
66346
- altitude = geoDistance(startPnt, endPnt) / 2 * altAutoScale);
66976
+ altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale);
66347
66977
  if (altitude) {
66348
66978
  var interpolate = geoInterpolate(startPnt, endPnt);
66349
66979
  var _map = [0.25, 0.75].map(function (t) {
@@ -66352,7 +66982,7 @@
66352
66982
  _map2 = _slicedToArray$1(_map, 2),
66353
66983
  m1Pnt = _map2[0],
66354
66984
  m2Pnt = _map2[1];
66355
- var curve = _construct$1(THREE$c.CubicBezierCurve3, _toConsumableArray$1([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
66985
+ var curve = _construct$1(THREE$d.CubicBezierCurve3, _toConsumableArray$1([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
66356
66986
 
66357
66987
  //const mPnt = [...interpolate(0.5), altitude * 2];
66358
66988
  //curve = new THREE.QuadraticBezierCurve3(...[startPnt, mPnt, endPnt].map(getVec));
@@ -66372,9 +67002,9 @@
66372
67002
  return startVec.clone();
66373
67003
  } // points exactly overlap
66374
67004
  : function (t) {
66375
- return new THREE$c.Vector3().addVectors(startVec.clone().multiplyScalar(Math.sin((1 - t) * angle)), endVec.clone().multiplyScalar(Math.sin(t * angle))).divideScalar(Math.sin(angle));
67005
+ return new THREE$d.Vector3().addVectors(startVec.clone().multiplyScalar(Math.sin((1 - t) * angle)), endVec.clone().multiplyScalar(Math.sin(t * angle))).divideScalar(Math.sin(angle));
66376
67006
  };
66377
- var sphereArc = new THREE$c.Curve();
67007
+ var sphereArc = new THREE$d.Curve();
66378
67008
  sphereArc.getPoint = getGreatCirclePoint;
66379
67009
  return sphereArc;
66380
67010
  }
@@ -66392,51 +67022,48 @@
66392
67022
  .range(colors) : colors; // already interpolator fn
66393
67023
 
66394
67024
  getVertexColor = function getVertexColor(t) {
66395
- return color2ShaderArr(colorInterpolator(t));
67025
+ return color2ShaderArr(colorInterpolator(t), true, true);
66396
67026
  };
66397
67027
  } else {
66398
67028
  // single color, use constant
66399
- var vertexColor = color2ShaderArr(colors);
67029
+ var vertexColor = color2ShaderArr(colors, true, true);
66400
67030
  getVertexColor = function getVertexColor() {
66401
67031
  return vertexColor;
66402
67032
  };
66403
67033
  }
66404
- var vertexColorArray = new THREE$c.Float32BufferAttribute(numVerticesGroup * 4 * numVerticesPerSegment, 4);
67034
+ var vertexColors = [];
66405
67035
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66406
67036
  var _vertexColor = getVertexColor(v / (l - 1));
66407
67037
  for (var s = 0; s < numVerticesPerSegment; s++) {
66408
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * 4);
67038
+ vertexColors.push(_vertexColor);
66409
67039
  }
66410
67040
  }
66411
- return vertexColorArray;
67041
+ return array2BufferAttr(vertexColors, 4);
66412
67042
  }
66413
67043
  function calcVertexRelDistances(numSegments) {
66414
67044
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
66415
67045
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66416
67046
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
66417
- var arrLen = numVerticesGroup * numVerticesPerSegment;
66418
- var vertexDistanceArray = new THREE$c.Float32BufferAttribute(arrLen, 1);
67047
+
67048
+ var vertexDistances = [];
66419
67049
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66420
67050
  var relDistance = v / (l - 1);
66421
67051
  for (var s = 0; s < numVerticesPerSegment; s++) {
66422
- var idx = v * numVerticesPerSegment + s;
66423
- var pos = invert ? arrLen - 1 - idx : idx;
66424
- vertexDistanceArray.setX(pos, relDistance);
67052
+ vertexDistances.push(relDistance);
66425
67053
  }
66426
67054
  }
66427
- return vertexDistanceArray;
67055
+ invert && vertexDistances.reverse();
67056
+ return array2BufferAttr(vertexDistances, 1);
66428
67057
  }
66429
67058
  }
66430
67059
  });
66431
67060
 
66432
- var THREE$b = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
67061
+ var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66433
67062
  : {
66434
- BufferAttribute: BufferAttribute,
66435
67063
  BufferGeometry: BufferGeometry,
66436
67064
  Color: Color$1,
66437
67065
  DoubleSide: DoubleSide,
66438
67066
  Mesh: Mesh,
66439
- MeshBasicMaterial: MeshBasicMaterial,
66440
67067
  MeshLambertMaterial: MeshLambertMaterial,
66441
67068
  Object3D: Object3D
66442
67069
  };
@@ -66445,8 +67072,6 @@
66445
67072
 
66446
67073
  //
66447
67074
 
66448
- // support multiple method names for backwards threejs compatibility
66449
- var applyMatrix4Fn = new THREE$b.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
66450
67075
  var HexBinLayerKapsule = index$2({
66451
67076
  props: {
66452
67077
  hexBinPointsData: {
@@ -66534,7 +67159,7 @@
66534
67159
  });
66535
67160
  var hexMaterials = {}; // indexed by color
66536
67161
 
66537
- var scene = state.hexBinMerge ? new THREE$b.Object3D() : state.scene; // use fake scene if merging hex points
67162
+ var scene = state.hexBinMerge ? new THREE$c.Object3D() : state.scene; // use fake scene if merging hex points
66538
67163
 
66539
67164
  threeDigest(hexBins, scene, {
66540
67165
  createObj: createObj,
@@ -66545,7 +67170,7 @@
66545
67170
  });
66546
67171
  if (state.hexBinMerge) {
66547
67172
  // merge points into a single mesh
66548
- var hexPointsGeometry = !hexBins.length ? new THREE$b.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
67173
+ var hexPointsGeometry = !hexBins.length ? new THREE$c.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
66549
67174
  var obj = d.__threeObj;
66550
67175
  d.__threeObj = undefined; // unbind merged points
66551
67176
 
@@ -66554,28 +67179,23 @@
66554
67179
 
66555
67180
  // apply mesh world transform to vertices
66556
67181
  obj.updateMatrix();
66557
- geom[applyMatrix4Fn](obj.matrix);
67182
+ geom.applyMatrix4(obj.matrix);
66558
67183
 
66559
67184
  // color vertices
66560
- var topColor = new THREE$b.Color(topColorAccessor(d));
66561
- var sideColor = new THREE$b.Color(sideColorAccessor(d));
66562
- var nVertices = geom.attributes.position.count;
67185
+ var topColor = color2ShaderArr(topColorAccessor(d));
67186
+ var sideColor = color2ShaderArr(sideColorAccessor(d));
67187
+ var nVertices = geom.getAttribute('position').count;
66563
67188
  var topFaceIdx = geom.groups[0].count; // starting vertex index of top group
66564
- var colors = new Float32Array(nVertices * 3);
66565
- for (var i = 0, len = nVertices; i < len; i++) {
66566
- var idx = i * 3;
66567
- var c = i >= topFaceIdx ? topColor : sideColor;
66568
- colors[idx] = c.r;
66569
- colors[idx + 1] = c.g;
66570
- colors[idx + 2] = c.b;
66571
- }
66572
- geom.setAttribute('color', new THREE$b.BufferAttribute(colors, 3));
67189
+ geom.setAttribute('color', array2BufferAttr(_toConsumableArray$1(new Array(nVertices)).map(function (_, idx) {
67190
+ return idx >= topFaceIdx ? topColor : sideColor;
67191
+ }), 4));
66573
67192
  return geom;
66574
67193
  }));
66575
- var hexPoints = new THREE$b.Mesh(hexPointsGeometry, new THREE$b.MeshBasicMaterial({
67194
+ var hexPoints = new THREE$c.Mesh(hexPointsGeometry, new THREE$c.MeshLambertMaterial({
66576
67195
  color: 0xffffff,
67196
+ transparent: true,
66577
67197
  vertexColors: true,
66578
- side: THREE$b.DoubleSide
67198
+ side: THREE$c.DoubleSide
66579
67199
  }));
66580
67200
  hexPoints.__globeObjType = 'hexBinPoints'; // Add object type
66581
67201
  hexPoints.__data = hexBins; // Attach obj data
@@ -66587,7 +67207,7 @@
66587
67207
  //
66588
67208
 
66589
67209
  function createObj(d) {
66590
- var obj = new THREE$b.Mesh();
67210
+ var obj = new THREE$c.Mesh();
66591
67211
  obj.__hexCenter = cellToLatLng(d.h3Idx);
66592
67212
  obj.__hexGeoJson = cellToBoundary(d.h3Idx, true).reverse(); // correct polygon winding
66593
67213
 
@@ -66656,11 +67276,11 @@
66656
67276
  [sideColor, topColor].forEach(function (color) {
66657
67277
  if (!hexMaterials.hasOwnProperty(color)) {
66658
67278
  var opacity = colorAlpha(color);
66659
- hexMaterials[color] = new THREE$b.MeshLambertMaterial({
67279
+ hexMaterials[color] = new THREE$c.MeshLambertMaterial({
66660
67280
  color: colorStr2Hex(color),
66661
67281
  transparent: opacity < 1,
66662
67282
  opacity: opacity,
66663
- side: THREE$b.DoubleSide
67283
+ side: THREE$c.DoubleSide
66664
67284
  });
66665
67285
  }
66666
67286
  });
@@ -66672,6 +67292,318 @@
66672
67292
  }
66673
67293
  });
66674
67294
 
67295
+ var sq = function sq(x) {
67296
+ return x * x;
67297
+ };
67298
+ function geoDistance(a, b) {
67299
+ // on sphere surface, in radians
67300
+ var sqrt = Math.sqrt;
67301
+ var cos = Math.cos;
67302
+ var toRad = function toRad(x) {
67303
+ return x * Math.PI / 180;
67304
+ };
67305
+ var hav = function hav(x) {
67306
+ return sq(Math.sin(x / 2));
67307
+ };
67308
+ var latA = toRad(a[1]);
67309
+ var latB = toRad(b[1]);
67310
+ var lngA = toRad(a[0]);
67311
+ var lngB = toRad(b[0]);
67312
+
67313
+ // Haversine formula
67314
+ return 2 * Math.asin(sqrt(hav(latB - latA) + cos(latA) * cos(latB) * hav(lngB - lngA)));
67315
+ }
67316
+ var sqrt2PI = Math.sqrt(2 * Math.PI);
67317
+ function gaussianKernel(x, bw) {
67318
+ return Math.exp(-sq(x / bw) / 2) / (bw * sqrt2PI);
67319
+ }
67320
+ var getGeoKDE = function getGeoKDE(_ref) {
67321
+ var _ref2 = _slicedToArray$1(_ref, 2),
67322
+ lng = _ref2[0],
67323
+ lat = _ref2[1];
67324
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
67325
+ var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
67326
+ _ref3$lngAccessor = _ref3.lngAccessor,
67327
+ lngAccessor = _ref3$lngAccessor === void 0 ? function (d) {
67328
+ return d[0];
67329
+ } : _ref3$lngAccessor,
67330
+ _ref3$latAccessor = _ref3.latAccessor,
67331
+ latAccessor = _ref3$latAccessor === void 0 ? function (d) {
67332
+ return d[1];
67333
+ } : _ref3$latAccessor,
67334
+ _ref3$weightAccessor = _ref3.weightAccessor,
67335
+ weightAccessor = _ref3$weightAccessor === void 0 ? function () {
67336
+ return 1;
67337
+ } : _ref3$weightAccessor,
67338
+ bandwidth = _ref3.bandwidth;
67339
+ var pnt = [lng, lat];
67340
+ var bwRad = bandwidth * Math.PI / 180;
67341
+ return sum$1(data.map(function (d) {
67342
+ var weight = weightAccessor(d);
67343
+ if (weight <= 0) return;
67344
+ var dist = geoDistance(pnt, [lngAccessor(d), latAccessor(d)]);
67345
+ return gaussianKernel(dist, bwRad) * weight;
67346
+ }));
67347
+ };
67348
+
67349
+ var THREE$b = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
67350
+ : {
67351
+ Mesh: Mesh,
67352
+ MeshLambertMaterial: MeshLambertMaterial,
67353
+ SphereGeometry: SphereGeometry
67354
+ };
67355
+
67356
+ //
67357
+
67358
+ var RES_BW_FACTOR = 3.5; // divider of bandwidth to use in geometry resolution
67359
+ var MIN_RESOLUTION = 0.1; // degrees
67360
+ var BW_RADIUS_INFLUENCE = 3.5; // multiplier of bandwidth to use in octree for max radius of point influence
67361
+ var _getDistance = /*#__PURE__*/new WeakSet();
67362
+ var _points = /*#__PURE__*/new WeakMap();
67363
+ var _pntOctree = /*#__PURE__*/new WeakMap();
67364
+ var _distance = /*#__PURE__*/new WeakMap();
67365
+ var PointsOctree = /*#__PURE__*/function () {
67366
+ function PointsOctree(points, neighborhoodAngularDistance) {
67367
+ _classCallCheck(this, PointsOctree);
67368
+ _classPrivateMethodInitSpec(this, _getDistance);
67369
+ _classPrivateFieldInitSpec(this, _points, {
67370
+ writable: true,
67371
+ value: void 0
67372
+ });
67373
+ _classPrivateFieldInitSpec(this, _pntOctree, {
67374
+ writable: true,
67375
+ value: void 0
67376
+ });
67377
+ _classPrivateFieldInitSpec(this, _distance, {
67378
+ writable: true,
67379
+ value: void 0
67380
+ });
67381
+ _classPrivateFieldSet(this, _points, points);
67382
+ _classPrivateFieldSet(this, _pntOctree, yaOctree());
67383
+ _classPrivateFieldGet(this, _pntOctree).init(points.map(function (d) {
67384
+ return [d.x, d.y, d.z];
67385
+ }).flat());
67386
+ _classPrivateFieldSet(this, _distance, _classPrivateMethodGet(this, _getDistance, _getDistance2).call(this, polar2Cartesian(0, 0), polar2Cartesian(0, Math.min(180, neighborhoodAngularDistance))));
67387
+ }
67388
+ _createClass(PointsOctree, [{
67389
+ key: "getNearPoints",
67390
+ value: function getNearPoints(x, y, z) {
67391
+ var _this = this;
67392
+ return _classPrivateFieldGet(this, _pntOctree).intersectSphere(x, y, z, _classPrivateFieldGet(this, _distance)).map(function (idx) {
67393
+ return _classPrivateFieldGet(_this, _points)[idx / 3];
67394
+ });
67395
+ }
67396
+ }]);
67397
+ return PointsOctree;
67398
+ }();
67399
+ function _getDistance2(a, b) {
67400
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow(a.z - b.z, 2));
67401
+ }
67402
+ var defaultColorInterpolator = function defaultColorInterpolator(t) {
67403
+ var c = color(interpolateTurbo(t)); // turbo, inferno
67404
+ c.opacity = Math.cbrt(t);
67405
+ return c.formatRgb();
67406
+ };
67407
+ var HeatmapsLayerKapsule = index$2({
67408
+ props: {
67409
+ heatmapsData: {
67410
+ "default": []
67411
+ },
67412
+ heatmapPoints: {
67413
+ "default": function _default(pnts) {
67414
+ return pnts;
67415
+ }
67416
+ },
67417
+ heatmapPointLat: {
67418
+ "default": function _default(d) {
67419
+ return d[0];
67420
+ }
67421
+ },
67422
+ heatmapPointLng: {
67423
+ "default": function _default(d) {
67424
+ return d[1];
67425
+ }
67426
+ },
67427
+ heatmapPointWeight: {
67428
+ "default": 1
67429
+ },
67430
+ heatmapBandwidth: {
67431
+ "default": 4
67432
+ },
67433
+ // Gaussian kernel bandwidth, in angular degrees
67434
+ heatmapColorFn: {
67435
+ "default": function _default() {
67436
+ return defaultColorInterpolator;
67437
+ }
67438
+ },
67439
+ heatmapColorSaturation: {
67440
+ "default": 1.5
67441
+ },
67442
+ // multiplier for color scale max
67443
+ heatmapBaseAltitude: {
67444
+ "default": 0.01
67445
+ },
67446
+ // in units of globe radius
67447
+ heatmapTopAltitude: {},
67448
+ // in units of globe radius
67449
+ heatmapsTransitionDuration: {
67450
+ "default": 0,
67451
+ triggerUpdate: false
67452
+ } // ms
67453
+ },
67454
+ init: function init(threeObj, state) {
67455
+ // Clear the scene
67456
+ emptyObject(threeObj);
67457
+
67458
+ // Main three object to manipulate
67459
+ state.scene = threeObj;
67460
+ },
67461
+ update: function update(state) {
67462
+ // Accessors
67463
+ var pointsAccessor = index$1(state.heatmapPoints);
67464
+ var latPntAccessor = index$1(state.heatmapPointLat);
67465
+ var lngPntAccessor = index$1(state.heatmapPointLng);
67466
+ var weightPntAccessor = index$1(state.heatmapPointWeight);
67467
+ var bandwidthAccessor = index$1(state.heatmapBandwidth);
67468
+ var colorFnAccessor = index$1(state.heatmapColorFn);
67469
+ var saturationAccessor = index$1(state.heatmapColorSaturation);
67470
+ var baseAltitudeAccessor = index$1(state.heatmapBaseAltitude);
67471
+ var topAltitudeAccessor = index$1(state.heatmapTopAltitude);
67472
+ threeDigest(state.heatmapsData, state.scene, {
67473
+ createObj: function createObj(d) {
67474
+ var obj = new THREE$b.Mesh(new THREE$b.SphereGeometry(GLOBE_RADIUS), new THREE$b.MeshLambertMaterial({
67475
+ vertexColors: true,
67476
+ transparent: true
67477
+ }));
67478
+ obj.__globeObjType = 'heatmap'; // Add object type
67479
+ return obj;
67480
+ },
67481
+ updateObj: function updateObj(obj, d) {
67482
+ // Accessors
67483
+ var bandwidth = bandwidthAccessor(d);
67484
+ var colorFn = colorFnAccessor(d);
67485
+ var saturation = saturationAccessor(d);
67486
+ var baseAlt = baseAltitudeAccessor(d);
67487
+ var topAlt = topAltitudeAccessor(d);
67488
+ var pnts = pointsAccessor(d).map(function (pnt) {
67489
+ var lat = latPntAccessor(pnt);
67490
+ var lng = lngPntAccessor(pnt);
67491
+ var _polar2Cartesian = polar2Cartesian(lat, lng),
67492
+ x = _polar2Cartesian.x,
67493
+ y = _polar2Cartesian.y,
67494
+ z = _polar2Cartesian.z;
67495
+ return {
67496
+ x: x,
67497
+ y: y,
67498
+ z: z,
67499
+ lat: lat,
67500
+ lng: lng,
67501
+ weight: weightPntAccessor(pnt)
67502
+ };
67503
+ });
67504
+
67505
+ // Check resolution
67506
+ var resolution = Math.max(MIN_RESOLUTION, bandwidth / RES_BW_FACTOR);
67507
+ var equatorNumSegments = Math.ceil(360 / (resolution || -1));
67508
+ if (obj.geometry.parameters.widthSegments !== equatorNumSegments) {
67509
+ obj.geometry.dispose();
67510
+ obj.geometry = new THREE$b.SphereGeometry(GLOBE_RADIUS, equatorNumSegments, equatorNumSegments / 2);
67511
+ }
67512
+
67513
+ // Get vertex polar coordinates
67514
+ var vertexCoords = bufferAttr2Array(obj.geometry.getAttribute('position'));
67515
+ var vertexGeoCoords = vertexCoords.map(function (_ref) {
67516
+ var _ref2 = _slicedToArray$1(_ref, 3),
67517
+ x = _ref2[0],
67518
+ y = _ref2[1],
67519
+ z = _ref2[2];
67520
+ var _cartesian2Polar = cartesian2Polar({
67521
+ x: x,
67522
+ y: y,
67523
+ z: z
67524
+ }),
67525
+ lng = _cartesian2Polar.lng,
67526
+ lat = _cartesian2Polar.lat;
67527
+ return [lng, lat];
67528
+ });
67529
+
67530
+ // Compute KDE
67531
+ var pntsOctree = new PointsOctree(pnts, bandwidth * BW_RADIUS_INFLUENCE);
67532
+ var kdeVals = vertexGeoCoords.map(function (vxCoords, idx) {
67533
+ var _vertexCoords$idx = _slicedToArray$1(vertexCoords[idx], 3),
67534
+ x = _vertexCoords$idx[0],
67535
+ y = _vertexCoords$idx[1],
67536
+ z = _vertexCoords$idx[2];
67537
+ return getGeoKDE(vxCoords, pntsOctree.getNearPoints(x, y, z), {
67538
+ latAccessor: function latAccessor(d) {
67539
+ return d.lat;
67540
+ },
67541
+ lngAccessor: function lngAccessor(d) {
67542
+ return d.lng;
67543
+ },
67544
+ weightAccessor: function weightAccessor(d) {
67545
+ return d.weight;
67546
+ },
67547
+ bandwidth: bandwidth
67548
+ });
67549
+ });
67550
+
67551
+ // Animations
67552
+ var applyUpdate = function applyUpdate(td) {
67553
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
67554
+ kdeVals = _obj$__currentTargetD.kdeVals,
67555
+ topAlt = _obj$__currentTargetD.topAlt,
67556
+ saturation = _obj$__currentTargetD.saturation;
67557
+ var maxVal = max$1(kdeVals) || 1e-15;
67558
+
67559
+ // Set vertex colors
67560
+ obj.geometry.setAttribute('color', array2BufferAttr(
67561
+ // normalization between [0, saturation]
67562
+ kdeVals.map(function (val) {
67563
+ return color2ShaderArr(colorFn(val / maxVal * saturation));
67564
+ }), 4));
67565
+
67566
+ // Set altitudes
67567
+ var altScale = linear([0, maxVal], [baseAlt, topAlt || baseAlt]);
67568
+ obj.geometry.setAttribute('position', array2BufferAttr(kdeVals.map(function (val, idx) {
67569
+ var _vertexGeoCoords$idx = _slicedToArray$1(vertexGeoCoords[idx], 2),
67570
+ lng = _vertexGeoCoords$idx[0],
67571
+ lat = _vertexGeoCoords$idx[1];
67572
+ var alt = altScale(val);
67573
+ var p = polar2Cartesian(lat, lng, alt);
67574
+ return [p.x, p.y, p.z];
67575
+ }), 3));
67576
+ };
67577
+ var targetD = {
67578
+ kdeVals: kdeVals,
67579
+ topAlt: topAlt,
67580
+ saturation: saturation
67581
+ };
67582
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
67583
+ kdeVals: kdeVals.map(function () {
67584
+ return 0;
67585
+ }),
67586
+ topAlt: !topAlt ? topAlt : baseAlt,
67587
+ saturation: 0.5
67588
+ });
67589
+ // do not interpolate between different length arrays
67590
+ currentTargetD.kdeVals.length !== kdeVals.length && (currentTargetD.kdeVals = kdeVals.slice());
67591
+ if (Object.keys(targetD).some(function (k) {
67592
+ return currentTargetD[k] !== targetD[k];
67593
+ })) {
67594
+ if (!state.heatmapsTransitionDuration || state.heatmapsTransitionDuration < 0) {
67595
+ // set final position
67596
+ applyUpdate(targetD);
67597
+ } else {
67598
+ // animate
67599
+ new Tween(currentTargetD).to(targetD, state.heatmapsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
67600
+ }
67601
+ }
67602
+ }
67603
+ });
67604
+ }
67605
+ });
67606
+
66675
67607
  var THREE$a = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66676
67608
  : {
66677
67609
  DoubleSide: DoubleSide,
@@ -67104,7 +68036,6 @@
67104
68036
  : {
67105
68037
  BufferGeometry: BufferGeometry,
67106
68038
  Color: Color$1,
67107
- Float32BufferAttribute: Float32BufferAttribute,
67108
68039
  Group: Group$1,
67109
68040
  Line: Line,
67110
68041
  NormalBlending: NormalBlending,
@@ -67115,8 +68046,6 @@
67115
68046
 
67116
68047
  //
67117
68048
 
67118
- // support both modes for backwards threejs compatibility
67119
- var setAttributeFn = new THREE$7.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
67120
68049
  var gradientShaders = {
67121
68050
  uniforms: {
67122
68051
  // dash param defaults, all relative to full length
@@ -67197,15 +68126,15 @@
67197
68126
  methods: {
67198
68127
  pauseAnimation: function pauseAnimation(state) {
67199
68128
  var _state$ticker;
67200
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
68129
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
67201
68130
  },
67202
68131
  resumeAnimation: function resumeAnimation(state) {
67203
68132
  var _state$ticker2;
67204
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
68133
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
67205
68134
  },
67206
68135
  _destructor: function _destructor(state) {
67207
68136
  var _state$ticker3;
67208
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
68137
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
67209
68138
  }
67210
68139
  },
67211
68140
  init: function init(threeObj, state) {
@@ -67305,8 +68234,8 @@
67305
68234
  true // run from end to start, to animate in the correct direction
67306
68235
  );
67307
68236
 
67308
- obj.geometry[setAttributeFn]('vertexColor', vertexColorArray);
67309
- obj.geometry[setAttributeFn]('vertexRelDistance', vertexRelDistanceArray);
68237
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
68238
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
67310
68239
  } else {
67311
68240
  // fat lines
67312
68241
  obj.material.resolution = state.rendererSize;
@@ -67471,40 +68400,38 @@
67471
68400
  .range(colors) : colors; // already interpolator fn
67472
68401
 
67473
68402
  getVertexColor = function getVertexColor(t) {
67474
- return color2ShaderArr(colorInterpolator(t), includeAlpha);
68403
+ return color2ShaderArr(colorInterpolator(t), includeAlpha, true);
67475
68404
  };
67476
68405
  } else {
67477
68406
  // single color, use constant
67478
- var vertexColor = color2ShaderArr(colors, includeAlpha);
68407
+ var vertexColor = color2ShaderArr(colors, includeAlpha, true);
67479
68408
  getVertexColor = function getVertexColor() {
67480
68409
  return vertexColor;
67481
68410
  };
67482
68411
  }
67483
- var numArgs = includeAlpha ? 4 : 3;
67484
- var vertexColorArray = new THREE$7.Float32BufferAttribute(numVerticesGroup * numArgs * numVerticesPerSegment, numArgs);
68412
+ var vertexColors = [];
67485
68413
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67486
68414
  var _vertexColor = getVertexColor(v / (l - 1));
67487
68415
  for (var s = 0; s < numVerticesPerSegment; s++) {
67488
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * numArgs);
68416
+ vertexColors.push(_vertexColor);
67489
68417
  }
67490
68418
  }
67491
- return vertexColorArray;
68419
+ return array2BufferAttr(vertexColors, includeAlpha ? 4 : 3);
67492
68420
  }
67493
68421
  function calcVertexRelDistances(numSegments) {
67494
68422
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
67495
68423
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
67496
68424
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
67497
- var arrLen = numVerticesGroup * numVerticesPerSegment;
67498
- var vertexDistanceArray = new THREE$7.Float32BufferAttribute(arrLen, 1);
68425
+
68426
+ var vertexDistances = [];
67499
68427
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67500
68428
  var relDistance = v / (l - 1);
67501
68429
  for (var s = 0; s < numVerticesPerSegment; s++) {
67502
- var idx = v * numVerticesPerSegment + s;
67503
- var pos = invert ? arrLen - 1 - idx : idx;
67504
- vertexDistanceArray.setX(pos, relDistance);
68430
+ vertexDistances.push(relDistance);
67505
68431
  }
67506
68432
  }
67507
- return vertexDistanceArray;
68433
+ invert && vertexDistances.reverse();
68434
+ return array2BufferAttr(vertexDistances, 1);
67508
68435
  }
67509
68436
  }
67510
68437
  });
@@ -67934,15 +68861,15 @@
67934
68861
  methods: {
67935
68862
  pauseAnimation: function pauseAnimation(state) {
67936
68863
  var _state$ticker;
67937
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
68864
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
67938
68865
  },
67939
68866
  resumeAnimation: function resumeAnimation(state) {
67940
68867
  var _state$ticker2;
67941
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
68868
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
67942
68869
  },
67943
68870
  _destructor: function _destructor(state) {
67944
68871
  var _state$ticker3;
67945
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
68872
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
67946
68873
  }
67947
68874
  },
67948
68875
  init: function init(threeObj, state) {
@@ -68289,7 +69216,7 @@
68289
69216
  }
68290
69217
  });
68291
69218
 
68292
- var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
69219
+ var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
68293
69220
  : {
68294
69221
  Group: Group$1,
68295
69222
  Vector2: Vector2,
@@ -68298,7 +69225,7 @@
68298
69225
 
68299
69226
  //
68300
69227
 
68301
- var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
69228
+ var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'heatmapsLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
68302
69229
 
68303
69230
  // Expose config from layers
68304
69231
  var bindGlobeLayer = linkKapsule$1('globeLayer', GlobeLayerKapsule);
@@ -68320,6 +69247,10 @@
68320
69247
  var linkedHexBinLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration'].map(function (p) {
68321
69248
  return _defineProperty$1({}, p, bindHexBinLayer.linkProp(p));
68322
69249
  })));
69250
+ var bindHeatmapsLayer = linkKapsule$1('heatmapsLayer', HeatmapsLayerKapsule);
69251
+ var linkedHeatmapsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration'].map(function (p) {
69252
+ return _defineProperty$1({}, p, bindHeatmapsLayer.linkProp(p));
69253
+ })));
68323
69254
  var bindHexedPolygonsLayer = linkKapsule$1('hexedPolygonsLayer', HexedPolygonsLayerKapsule);
68324
69255
  var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
68325
69256
  return _defineProperty$1({}, p, bindHexedPolygonsLayer.linkProp(p));
@@ -68360,18 +69291,18 @@
68360
69291
  //
68361
69292
 
68362
69293
  var Globe = index$2({
68363
- props: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
69294
+ props: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
68364
69295
  onGlobeReady: {
68365
69296
  triggerUpdate: false
68366
69297
  },
68367
69298
  rendererSize: {
68368
- "default": new THREE$g.Vector2(window.innerWidth, window.innerHeight),
69299
+ "default": new THREE$i.Vector2(window.innerWidth, window.innerHeight),
68369
69300
  onChange: function onChange(rendererSize, state) {
68370
69301
  state.pathsLayer.rendererSize(rendererSize);
68371
69302
  },
68372
69303
  triggerUpdate: false
68373
69304
  }
68374
- }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
69305
+ }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedHeatmapsLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
68375
69306
  methods: _objectSpread2({
68376
69307
  getGlobeRadius: getGlobeRadius,
68377
69308
  getCoords: function getCoords(state) {
@@ -68456,6 +69387,7 @@
68456
69387
  pointsLayer: PointsLayerKapsule(),
68457
69388
  arcsLayer: ArcsLayerKapsule(),
68458
69389
  hexBinLayer: HexBinLayerKapsule(),
69390
+ heatmapsLayer: HeatmapsLayerKapsule(),
68459
69391
  polygonsLayer: PolygonsLayerKapsule(),
68460
69392
  hexedPolygonsLayer: HexedPolygonsLayerKapsule(),
68461
69393
  pathsLayer: PathsLayerKapsule(),
@@ -68478,21 +69410,21 @@
68478
69410
  })
68479
69411
  });
68480
69412
  },
68481
- init: function init(threeObj, state, _ref15) {
68482
- var _ref15$animateIn = _ref15.animateIn,
68483
- animateIn = _ref15$animateIn === void 0 ? true : _ref15$animateIn,
68484
- _ref15$waitForGlobeRe = _ref15.waitForGlobeReady,
68485
- waitForGlobeReady = _ref15$waitForGlobeRe === void 0 ? true : _ref15$waitForGlobeRe;
69413
+ init: function init(threeObj, state, _ref16) {
69414
+ var _ref16$animateIn = _ref16.animateIn,
69415
+ animateIn = _ref16$animateIn === void 0 ? true : _ref16$animateIn,
69416
+ _ref16$waitForGlobeRe = _ref16.waitForGlobeReady,
69417
+ waitForGlobeReady = _ref16$waitForGlobeRe === void 0 ? true : _ref16$waitForGlobeRe;
68486
69418
  // Clear the scene
68487
69419
  emptyObject(threeObj);
68488
69420
 
68489
69421
  // Main three object to manipulate
68490
- threeObj.add(state.scene = new THREE$g.Group());
69422
+ threeObj.add(state.scene = new THREE$i.Group());
68491
69423
  state.scene.visible = false; // hide scene before globe initialization
68492
69424
 
68493
69425
  // Add all layers groups
68494
69426
  layers.forEach(function (layer) {
68495
- var g = new THREE$g.Group();
69427
+ var g = new THREE$i.Group();
68496
69428
  state.scene.add(g);
68497
69429
  state[layer](g);
68498
69430
  });
@@ -68504,17 +69436,17 @@
68504
69436
  k: 1e-6
68505
69437
  }).to({
68506
69438
  k: 1
68507
- }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref16) {
68508
- var k = _ref16.k;
69439
+ }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref17) {
69440
+ var k = _ref17.k;
68509
69441
  return state.scene.scale.set(k, k, k);
68510
69442
  }).start();
68511
- var rotAxis = new THREE$g.Vector3(0, 1, 0);
69443
+ var rotAxis = new THREE$i.Vector3(0, 1, 0);
68512
69444
  new Tween({
68513
69445
  rot: Math.PI * 2
68514
69446
  }).to({
68515
69447
  rot: 0
68516
- }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref17) {
68517
- var rot = _ref17.rot;
69448
+ }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref18) {
69449
+ var rot = _ref18.rot;
68518
69450
  return state.scene.setRotationFromAxisAngle(rotAxis, rot);
68519
69451
  }).start();
68520
69452
  }
@@ -69546,7 +70478,7 @@
69546
70478
 
69547
70479
  const twoPI = 2 * Math.PI;
69548
70480
 
69549
- return function update() {
70481
+ return function update( deltaTime = null ) {
69550
70482
 
69551
70483
  const position = scope.object.position;
69552
70484
 
@@ -69560,7 +70492,7 @@
69560
70492
 
69561
70493
  if ( scope.autoRotate && state === STATE.NONE ) {
69562
70494
 
69563
- rotateLeft( getAutoRotationAngle() );
70495
+ rotateLeft( getAutoRotationAngle( deltaTime ) );
69564
70496
 
69565
70497
  }
69566
70498
 
@@ -69839,9 +70771,17 @@
69839
70771
  const pointers = [];
69840
70772
  const pointerPositions = {};
69841
70773
 
69842
- function getAutoRotationAngle() {
70774
+ function getAutoRotationAngle( deltaTime ) {
69843
70775
 
69844
- return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
70776
+ if ( deltaTime !== null ) {
70777
+
70778
+ return ( 2 * Math.PI / 60 * scope.autoRotateSpeed ) * deltaTime;
70779
+
70780
+ } else {
70781
+
70782
+ return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
70783
+
70784
+ }
69845
70785
 
69846
70786
  }
69847
70787
 
@@ -69993,7 +70933,7 @@
69993
70933
  mouse.x = ( x / w ) * 2 - 1;
69994
70934
  mouse.y = - ( y / h ) * 2 + 1;
69995
70935
 
69996
- dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();
70936
+ dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize();
69997
70937
 
69998
70938
  }
69999
70939
 
@@ -71559,7 +72499,7 @@
71559
72499
 
71560
72500
  class RenderPass extends Pass {
71561
72501
 
71562
- constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
72502
+ constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
71563
72503
 
71564
72504
  super();
71565
72505
 
@@ -71569,7 +72509,7 @@
71569
72509
  this.overrideMaterial = overrideMaterial;
71570
72510
 
71571
72511
  this.clearColor = clearColor;
71572
- this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
72512
+ this.clearAlpha = clearAlpha;
71573
72513
 
71574
72514
  this.clear = true;
71575
72515
  this.clearDepth = false;
@@ -71585,7 +72525,7 @@
71585
72525
 
71586
72526
  let oldClearAlpha, oldOverrideMaterial;
71587
72527
 
71588
- if ( this.overrideMaterial !== undefined ) {
72528
+ if ( this.overrideMaterial !== null ) {
71589
72529
 
71590
72530
  oldOverrideMaterial = this.scene.overrideMaterial;
71591
72531
 
@@ -71593,16 +72533,21 @@
71593
72533
 
71594
72534
  }
71595
72535
 
71596
- if ( this.clearColor ) {
72536
+ if ( this.clearColor !== null ) {
71597
72537
 
71598
72538
  renderer.getClearColor( this._oldClearColor );
71599
- oldClearAlpha = renderer.getClearAlpha();
72539
+ renderer.setClearColor( this.clearColor );
71600
72540
 
71601
- renderer.setClearColor( this.clearColor, this.clearAlpha );
72541
+ }
72542
+
72543
+ if ( this.clearAlpha !== null ) {
72544
+
72545
+ oldClearAlpha = renderer.getClearAlpha();
72546
+ renderer.setClearAlpha( this.clearAlpha );
71602
72547
 
71603
72548
  }
71604
72549
 
71605
- if ( this.clearDepth ) {
72550
+ if ( this.clearDepth == true ) {
71606
72551
 
71607
72552
  renderer.clearDepth();
71608
72553
 
@@ -71610,17 +72555,30 @@
71610
72555
 
71611
72556
  renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
71612
72557
 
71613
- // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
71614
- if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
72558
+ if ( this.clear === true ) {
72559
+
72560
+ // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
72561
+ renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
72562
+
72563
+ }
72564
+
71615
72565
  renderer.render( this.scene, this.camera );
71616
72566
 
71617
- if ( this.clearColor ) {
72567
+ // restore
72568
+
72569
+ if ( this.clearColor !== null ) {
72570
+
72571
+ renderer.setClearColor( this._oldClearColor );
72572
+
72573
+ }
72574
+
72575
+ if ( this.clearAlpha !== null ) {
71618
72576
 
71619
- renderer.setClearColor( this._oldClearColor, oldClearAlpha );
72577
+ renderer.setClearAlpha( oldClearAlpha );
71620
72578
 
71621
72579
  }
71622
72580
 
71623
- if ( this.overrideMaterial !== undefined ) {
72581
+ if ( this.overrideMaterial !== null ) {
71624
72582
 
71625
72583
  this.scene.overrideMaterial = oldOverrideMaterial;
71626
72584
 
@@ -73074,10 +74032,10 @@
73074
74032
 
73075
74033
  // Expose config from ThreeGlobe
73076
74034
  var bindGlobe = linkKapsule('globe', threeGlobe);
73077
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray$5(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'globeMaterial', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
74035
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray$5(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
73078
74036
  return _defineProperty$3({}, p, bindGlobe.linkProp(p));
73079
74037
  })));
73080
- var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray$5(['getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
74038
+ var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray$5(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
73081
74039
  return _defineProperty$3({}, p, bindGlobe.linkMethod(p));
73082
74040
  })));
73083
74041
 
@@ -73155,6 +74113,15 @@
73155
74113
  onPathHover: {
73156
74114
  triggerUpdate: false
73157
74115
  },
74116
+ onHeatmapClick: {
74117
+ triggerUpdate: false
74118
+ },
74119
+ onHeatmapRightClick: {
74120
+ triggerUpdate: false
74121
+ },
74122
+ onHeatmapHover: {
74123
+ triggerUpdate: false
74124
+ },
73158
74125
  hexLabel: {
73159
74126
  triggerUpdate: false
73160
74127
  },
@@ -73256,7 +74223,7 @@
73256
74223
  cancelAnimationFrame(state.animationFrameRequestId);
73257
74224
  state.animationFrameRequestId = null;
73258
74225
  }
73259
- (_state$globe = state.globe) === null || _state$globe === void 0 ? void 0 : _state$globe.pauseAnimation();
74226
+ (_state$globe = state.globe) === null || _state$globe === void 0 || _state$globe.pauseAnimation();
73260
74227
  return this;
73261
74228
  },
73262
74229
  resumeAnimation: function resumeAnimation(state) {
@@ -73264,7 +74231,7 @@
73264
74231
  if (state.animationFrameRequestId === null) {
73265
74232
  this._animationCycle();
73266
74233
  }
73267
- (_state$globe2 = state.globe) === null || _state$globe2 === void 0 ? void 0 : _state$globe2.resumeAnimation();
74234
+ (_state$globe2 = state.globe) === null || _state$globe2 === void 0 || _state$globe2.resumeAnimation();
73268
74235
  return this;
73269
74236
  },
73270
74237
  _animationCycle: function _animationCycle(state) {
@@ -73356,6 +74323,7 @@
73356
74323
  this.arcsData([]);
73357
74324
  this.polygonsData([]);
73358
74325
  this.pathsData([]);
74326
+ this.heatmapsData([]);
73359
74327
  this.hexBinPointsData([]);
73360
74328
  this.hexPolygonsData([]);
73361
74329
  this.tilesData([]);
@@ -73448,6 +74416,9 @@
73448
74416
  path: function path(d) {
73449
74417
  return d;
73450
74418
  },
74419
+ heatmap: function heatmap(d) {
74420
+ return d;
74421
+ },
73451
74422
  hexbin: function hexbin(d) {
73452
74423
  return d;
73453
74424
  },
@@ -73502,6 +74473,7 @@
73502
74473
  arc: state.onArcHover,
73503
74474
  polygon: state.onPolygonHover,
73504
74475
  path: state.onPathHover,
74476
+ heatmap: state.onHeatmapHover,
73505
74477
  hexbin: state.onHexHover,
73506
74478
  hexPolygon: state.onHexPolygonHover,
73507
74479
  tile: state.onTileHover,
@@ -73515,6 +74487,7 @@
73515
74487
  arc: state.onArcClick,
73516
74488
  polygon: state.onPolygonClick,
73517
74489
  path: state.onPathClick,
74490
+ heatmap: state.onHeatmapClick,
73518
74491
  hexbin: state.onHexClick,
73519
74492
  hexPolygon: state.onHexPolygonClick,
73520
74493
  tile: state.onTileClick,
@@ -73554,6 +74527,7 @@
73554
74527
  arc: state.onArcClick,
73555
74528
  polygon: state.onPolygonClick,
73556
74529
  path: state.onPathClick,
74530
+ heatmap: state.onHeatmapClick,
73557
74531
  hexbin: state.onHexClick,
73558
74532
  hexPolygon: state.onHexPolygonClick,
73559
74533
  tile: state.onTileClick,
@@ -73591,6 +74565,7 @@
73591
74565
  arc: state.onArcRightClick,
73592
74566
  polygon: state.onPolygonRightClick,
73593
74567
  path: state.onPathRightClick,
74568
+ heatmap: state.onHeatmapRightClick,
73594
74569
  hexbin: state.onHexRightClick,
73595
74570
  hexPolygon: state.onHexPolygonRightClick,
73596
74571
  tile: state.onTileRightClick,