globe.gl 2.29.3 → 2.31.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.3 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.31.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) :
@@ -142,7 +142,7 @@
142
142
  * Copyright 2010-2023 Three.js Authors
143
143
  * SPDX-License-Identifier: MIT
144
144
  */
145
- const REVISION = '156';
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 };
@@ -282,6 +282,13 @@
282
282
  const SRGBColorSpace = 'srgb';
283
283
  const LinearSRGBColorSpace = 'srgb-linear';
284
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';
285
292
  const KeepStencilOp = 7680;
286
293
  const AlwaysStencilFunc = 519;
287
294
 
@@ -1627,18 +1634,6 @@
1627
1634
 
1628
1635
  }
1629
1636
 
1630
- function SRGBToLinear( c ) {
1631
-
1632
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1633
-
1634
- }
1635
-
1636
- function LinearToSRGB( c ) {
1637
-
1638
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1639
-
1640
- }
1641
-
1642
1637
  /**
1643
1638
  * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
1644
1639
  * or clipping. Based on W3C specifications for sRGB and Display P3,
@@ -1651,50 +1646,57 @@
1651
1646
  * - http://www.russellcottrell.com/photo/matrixCalculator.htm
1652
1647
  */
1653
1648
 
1654
- const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [
1655
- 0.8224621, 0.0331941, 0.0170827,
1656
- 0.1775380, 0.9668058, 0.0723974,
1657
- - 0.0000001, 0.0000001, 0.9105199
1658
- ] );
1659
-
1660
- const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
1661
- 1.2249401, - 0.0420569, - 0.0196376,
1662
- - 0.2249404, 1.0420571, - 0.0786361,
1663
- 0.0000001, 0.0000000, 1.0982735
1664
- ] );
1665
-
1666
- function DisplayP3ToLinearSRGB( color ) {
1667
-
1668
- // Display P3 uses the sRGB transfer functions
1669
- return color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );
1670
-
1671
- }
1672
-
1673
- function LinearSRGBToDisplayP3( color ) {
1674
-
1675
- // Display P3 uses the sRGB transfer functions
1676
- 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
+ );
1677
1654
 
1678
- }
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
+ );
1679
1660
 
1680
- // Conversions from <source> to Linear-sRGB reference space.
1681
- const TO_LINEAR = {
1682
- [ LinearSRGBColorSpace ]: ( color ) => color,
1683
- [ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),
1684
- [ 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
+ },
1685
1690
  };
1686
1691
 
1687
- // Conversions to <target> from Linear-sRGB reference space.
1688
- const FROM_LINEAR = {
1689
- [ LinearSRGBColorSpace ]: ( color ) => color,
1690
- [ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
1691
- [ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
1692
- };
1692
+ const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
1693
1693
 
1694
1694
  const ColorManagement = {
1695
1695
 
1696
1696
  enabled: true,
1697
1697
 
1698
+ _workingColorSpace: LinearSRGBColorSpace,
1699
+
1698
1700
  get legacyMode() {
1699
1701
 
1700
1702
  console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
@@ -1713,13 +1715,19 @@
1713
1715
 
1714
1716
  get workingColorSpace() {
1715
1717
 
1716
- return LinearSRGBColorSpace;
1718
+ return this._workingColorSpace;
1717
1719
 
1718
1720
  },
1719
1721
 
1720
1722
  set workingColorSpace( colorSpace ) {
1721
1723
 
1722
- 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;
1723
1731
 
1724
1732
  },
1725
1733
 
@@ -1731,33 +1739,54 @@
1731
1739
 
1732
1740
  }
1733
1741
 
1734
- const sourceToLinear = TO_LINEAR[ sourceColorSpace ];
1735
- const targetFromLinear = FROM_LINEAR[ targetColorSpace ];
1742
+ const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
1743
+ const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
1736
1744
 
1737
- if ( sourceToLinear === undefined || targetFromLinear === undefined ) {
1745
+ return targetFromReference( sourceToReference( color ) );
1738
1746
 
1739
- throw new Error( `Unsupported color space conversion, "${ sourceColorSpace }" to "${ targetColorSpace }".` );
1747
+ },
1740
1748
 
1741
- }
1749
+ fromWorkingColorSpace: function ( color, targetColorSpace ) {
1742
1750
 
1743
- return targetFromLinear( sourceToLinear( color ) );
1751
+ return this.convert( color, this._workingColorSpace, targetColorSpace );
1744
1752
 
1745
1753
  },
1746
1754
 
1747
- fromWorkingColorSpace: function ( color, targetColorSpace ) {
1755
+ toWorkingColorSpace: function ( color, sourceColorSpace ) {
1748
1756
 
1749
- return this.convert( color, this.workingColorSpace, targetColorSpace );
1757
+ return this.convert( color, sourceColorSpace, this._workingColorSpace );
1750
1758
 
1751
1759
  },
1752
1760
 
1753
- toWorkingColorSpace: function ( color, sourceColorSpace ) {
1761
+ getPrimaries: function ( colorSpace ) {
1754
1762
 
1755
- return this.convert( color, sourceColorSpace, this.workingColorSpace );
1763
+ return COLOR_SPACES[ colorSpace ].primaries;
1764
+
1765
+ },
1766
+
1767
+ getTransfer: function ( colorSpace ) {
1768
+
1769
+ if ( colorSpace === NoColorSpace ) return LinearTransfer;
1770
+
1771
+ return COLOR_SPACES[ colorSpace ].transfer;
1756
1772
 
1757
1773
  },
1758
1774
 
1759
1775
  };
1760
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
+
1761
1790
  let _canvas;
1762
1791
 
1763
1792
  class ImageUtils {
@@ -1883,7 +1912,7 @@
1883
1912
 
1884
1913
  }
1885
1914
 
1886
- let sourceId = 0;
1915
+ let _sourceId = 0;
1887
1916
 
1888
1917
  class Source {
1889
1918
 
@@ -1891,7 +1920,7 @@
1891
1920
 
1892
1921
  this.isSource = true;
1893
1922
 
1894
- Object.defineProperty( this, 'id', { value: sourceId ++ } );
1923
+ Object.defineProperty( this, 'id', { value: _sourceId ++ } );
1895
1924
 
1896
1925
  this.uuid = generateUUID();
1897
1926
 
@@ -2997,20 +3026,29 @@
2997
3026
 
2998
3027
  }
2999
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
+
3000
3039
  this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
3001
3040
  this.texture.isRenderTargetTexture = true;
3002
3041
 
3003
3042
  this.texture.flipY = false;
3004
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
3005
- this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
3006
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
3043
+ this.texture.generateMipmaps = options.generateMipmaps;
3044
+ this.texture.internalFormat = options.internalFormat;
3007
3045
 
3008
- this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
3009
- this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
3046
+ this.depthBuffer = options.depthBuffer;
3047
+ this.stencilBuffer = options.stencilBuffer;
3010
3048
 
3011
- this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
3049
+ this.depthTexture = options.depthTexture;
3012
3050
 
3013
- this.samples = options.samples !== undefined ? options.samples : 0;
3051
+ this.samples = options.samples;
3014
3052
 
3015
3053
  }
3016
3054
 
@@ -4971,16 +5009,16 @@
4971
5009
  if ( this.isEmpty() ) return this;
4972
5010
 
4973
5011
  // NOTE: I am using a binary pattern to specify all 2^3 combinations below
4974
- _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
4975
- _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
4976
- _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
4977
- _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
4978
- _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
4979
- _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
4980
- _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
4981
- _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
4982
5020
 
4983
- this.setFromPoints( _points );
5021
+ this.setFromPoints( _points$1 );
4984
5022
 
4985
5023
  return this;
4986
5024
 
@@ -5003,7 +5041,7 @@
5003
5041
 
5004
5042
  }
5005
5043
 
5006
- const _points = [
5044
+ const _points$1 = [
5007
5045
  /*@__PURE__*/ new Vector3(),
5008
5046
  /*@__PURE__*/ new Vector3(),
5009
5047
  /*@__PURE__*/ new Vector3(),
@@ -8663,10 +8701,10 @@
8663
8701
 
8664
8702
  if ( this.blending !== NormalBlending ) data.blending = this.blending;
8665
8703
  if ( this.side !== FrontSide ) data.side = this.side;
8666
- if ( this.vertexColors ) data.vertexColors = true;
8704
+ if ( this.vertexColors === true ) data.vertexColors = true;
8667
8705
 
8668
8706
  if ( this.opacity < 1 ) data.opacity = this.opacity;
8669
- if ( this.transparent === true ) data.transparent = this.transparent;
8707
+ if ( this.transparent === true ) data.transparent = true;
8670
8708
 
8671
8709
  data.depthFunc = this.depthFunc;
8672
8710
  data.depthTest = this.depthTest;
@@ -8697,17 +8735,17 @@
8697
8735
  if ( this.dithering === true ) data.dithering = true;
8698
8736
 
8699
8737
  if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
8700
- if ( this.alphaHash === true ) data.alphaHash = this.alphaHash;
8701
- if ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;
8702
- if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
8703
- 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;
8704
8742
 
8705
- if ( this.wireframe === true ) data.wireframe = this.wireframe;
8743
+ if ( this.wireframe === true ) data.wireframe = true;
8706
8744
  if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
8707
8745
  if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
8708
8746
  if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
8709
8747
 
8710
- if ( this.flatShading === true ) data.flatShading = this.flatShading;
8748
+ if ( this.flatShading === true ) data.flatShading = true;
8711
8749
 
8712
8750
  if ( this.visible === false ) data.visible = false;
8713
8751
 
@@ -9288,11 +9326,7 @@
9288
9326
 
9289
9327
  this.getHSL( _hslA );
9290
9328
 
9291
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
9292
-
9293
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
9294
-
9295
- return this;
9329
+ return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
9296
9330
 
9297
9331
  }
9298
9332
 
@@ -11692,7 +11726,7 @@
11692
11726
 
11693
11727
  }
11694
11728
 
11695
- return LinearSRGBColorSpace;
11729
+ return ColorManagement.workingColorSpace;
11696
11730
 
11697
11731
  }
11698
11732
 
@@ -11920,11 +11954,7 @@
11920
11954
 
11921
11955
  getWorldDirection( target ) {
11922
11956
 
11923
- this.updateWorldMatrix( true, false );
11924
-
11925
- const e = this.matrixWorld.elements;
11926
-
11927
- return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
11957
+ return super.getWorldDirection( target ).negate();
11928
11958
 
11929
11959
  }
11930
11960
 
@@ -12194,6 +12224,7 @@
12194
12224
 
12195
12225
  this.renderTarget = renderTarget;
12196
12226
  this.coordinateSystem = null;
12227
+ this.activeMipmapLevel = 0;
12197
12228
 
12198
12229
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
12199
12230
  cameraPX.layers = this.layers;
@@ -12291,7 +12322,7 @@
12291
12322
 
12292
12323
  if ( this.parent === null ) this.updateMatrixWorld();
12293
12324
 
12294
- const renderTarget = this.renderTarget;
12325
+ const { renderTarget, activeMipmapLevel } = this;
12295
12326
 
12296
12327
  if ( this.coordinateSystem !== renderer.coordinateSystem ) {
12297
12328
 
@@ -12304,6 +12335,8 @@
12304
12335
  const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
12305
12336
 
12306
12337
  const currentRenderTarget = renderer.getRenderTarget();
12338
+ const currentActiveCubeFace = renderer.getActiveCubeFace();
12339
+ const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();
12307
12340
 
12308
12341
  const currentXrEnabled = renderer.xr.enabled;
12309
12342
 
@@ -12313,27 +12346,30 @@
12313
12346
 
12314
12347
  renderTarget.texture.generateMipmaps = false;
12315
12348
 
12316
- renderer.setRenderTarget( renderTarget, 0 );
12349
+ renderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );
12317
12350
  renderer.render( scene, cameraPX );
12318
12351
 
12319
- renderer.setRenderTarget( renderTarget, 1 );
12352
+ renderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );
12320
12353
  renderer.render( scene, cameraNX );
12321
12354
 
12322
- renderer.setRenderTarget( renderTarget, 2 );
12355
+ renderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );
12323
12356
  renderer.render( scene, cameraPY );
12324
12357
 
12325
- renderer.setRenderTarget( renderTarget, 3 );
12358
+ renderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );
12326
12359
  renderer.render( scene, cameraNY );
12327
12360
 
12328
- renderer.setRenderTarget( renderTarget, 4 );
12361
+ renderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );
12329
12362
  renderer.render( scene, cameraPZ );
12330
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
+
12331
12367
  renderTarget.texture.generateMipmaps = generateMipmaps;
12332
12368
 
12333
- renderer.setRenderTarget( renderTarget, 5 );
12369
+ renderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );
12334
12370
  renderer.render( scene, cameraNZ );
12335
12371
 
12336
- renderer.setRenderTarget( currentRenderTarget );
12372
+ renderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
12337
12373
 
12338
12374
  renderer.xr.enabled = currentXrEnabled;
12339
12375
 
@@ -13247,7 +13283,7 @@
13247
13283
 
13248
13284
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13249
13285
 
13250
- 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";
13251
13287
 
13252
13288
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13253
13289
 
@@ -13277,7 +13313,7 @@
13277
13313
 
13278
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";
13279
13315
 
13280
- 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";
13281
13317
 
13282
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";
13283
13319
 
@@ -13293,7 +13329,7 @@
13293
13329
 
13294
13330
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13295
13331
 
13296
- 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}";
13297
13333
 
13298
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";
13299
13335
 
@@ -13321,29 +13357,29 @@
13321
13357
 
13322
13358
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
13323
13359
 
13324
- 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";
13325
13361
 
13326
- 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";
13327
13363
 
13328
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";
13329
13365
 
13330
13366
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13331
13367
 
13332
- 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";
13333
13369
 
13334
13370
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
13335
13371
 
13336
- 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";
13337
13373
 
13338
- 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";
13339
13375
 
13340
- 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}";
13341
13377
 
13342
- 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";
13343
13379
 
13344
- 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";
13345
13381
 
13346
- 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";
13347
13383
 
13348
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";
13349
13385
 
@@ -13373,7 +13409,7 @@
13373
13409
 
13374
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";
13375
13411
 
13376
- 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;";
13377
13413
 
13378
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";
13379
13415
 
@@ -13385,7 +13421,7 @@
13385
13421
 
13386
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";
13387
13423
 
13388
- 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";
13389
13425
 
13390
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";
13391
13427
 
@@ -13495,7 +13531,7 @@
13495
13531
 
13496
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}";
13497
13533
 
13498
- 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}";
13499
13535
 
13500
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}";
13501
13537
 
@@ -14331,7 +14367,7 @@
14331
14367
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14332
14368
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14333
14369
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14334
- boxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14370
+ boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14335
14371
 
14336
14372
  if ( currentBackground !== background ||
14337
14373
  currentBackgroundVersion !== background.version ||
@@ -14387,7 +14423,7 @@
14387
14423
 
14388
14424
  planeMesh.material.uniforms.t2D.value = background;
14389
14425
  planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14390
- planeMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14426
+ planeMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14391
14427
 
14392
14428
  if ( background.matrixAutoUpdate === true ) {
14393
14429
 
@@ -18651,15 +18687,38 @@
18651
18687
 
18652
18688
  function getEncodingComponents( colorSpace ) {
18653
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
+
18654
18709
  switch ( colorSpace ) {
18655
18710
 
18656
18711
  case LinearSRGBColorSpace:
18657
- return [ 'Linear', '( value )' ];
18712
+ case LinearDisplayP3ColorSpace:
18713
+ return [ gamutMapping, 'LinearTransferOETF' ];
18714
+
18658
18715
  case SRGBColorSpace:
18659
- return [ 'sRGB', '( value )' ];
18716
+ case DisplayP3ColorSpace:
18717
+ return [ gamutMapping, 'sRGBTransferOETF' ];
18718
+
18660
18719
  default:
18661
18720
  console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
18662
- return [ 'Linear', '( value )' ];
18721
+ return [ gamutMapping, 'LinearTransferOETF' ];
18663
18722
 
18664
18723
  }
18665
18724
 
@@ -18692,7 +18751,7 @@
18692
18751
  function getTexelEncodingFunction( functionName, colorSpace ) {
18693
18752
 
18694
18753
  const components = getEncodingComponents( colorSpace );
18695
- return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';
18754
+ return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;
18696
18755
 
18697
18756
  }
18698
18757
 
@@ -19119,6 +19178,7 @@
19119
19178
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
19120
19179
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
19121
19180
 
19181
+ parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
19122
19182
  parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19123
19183
 
19124
19184
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
@@ -19206,6 +19266,8 @@
19206
19266
 
19207
19267
  parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
19208
19268
 
19269
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19270
+
19209
19271
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19210
19272
 
19211
19273
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
@@ -19388,6 +19450,8 @@
19388
19450
 
19389
19451
  parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',
19390
19452
 
19453
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19454
+
19391
19455
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19392
19456
 
19393
19457
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
@@ -20068,6 +20132,8 @@
20068
20132
  numSpotLightShadows: lights.spotShadowMap.length,
20069
20133
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
20070
20134
 
20135
+ numLightProbes: lights.numLightProbes,
20136
+
20071
20137
  numClippingPlanes: clipping.numPlanes,
20072
20138
  numClipIntersection: clipping.numIntersection,
20073
20139
 
@@ -20079,7 +20145,7 @@
20079
20145
  toneMapping: toneMapping,
20080
20146
  useLegacyLights: renderer._useLegacyLights,
20081
20147
 
20082
- decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( material.map.colorSpace === SRGBColorSpace ),
20148
+ decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
20083
20149
 
20084
20150
  premultipliedAlpha: material.premultipliedAlpha,
20085
20151
 
@@ -20192,6 +20258,7 @@
20192
20258
  array.push( parameters.numPointLightShadows );
20193
20259
  array.push( parameters.numSpotLightShadows );
20194
20260
  array.push( parameters.numSpotLightShadowsWithMaps );
20261
+ array.push( parameters.numLightProbes );
20195
20262
  array.push( parameters.shadowMapType );
20196
20263
  array.push( parameters.toneMapping );
20197
20264
  array.push( parameters.numClippingPlanes );
@@ -20830,7 +20897,9 @@
20830
20897
  numDirectionalShadows: - 1,
20831
20898
  numPointShadows: - 1,
20832
20899
  numSpotShadows: - 1,
20833
- numSpotMaps: - 1
20900
+ numSpotMaps: - 1,
20901
+
20902
+ numLightProbes: - 1
20834
20903
  },
20835
20904
 
20836
20905
  ambient: [ 0, 0, 0 ],
@@ -20852,7 +20921,8 @@
20852
20921
  pointShadowMap: [],
20853
20922
  pointShadowMatrix: [],
20854
20923
  hemi: [],
20855
- numSpotLightShadowsWithMaps: 0
20924
+ numSpotLightShadowsWithMaps: 0,
20925
+ numLightProbes: 0
20856
20926
 
20857
20927
  };
20858
20928
 
@@ -20880,6 +20950,8 @@
20880
20950
  let numSpotMaps = 0;
20881
20951
  let numSpotShadowsWithMaps = 0;
20882
20952
 
20953
+ let numLightProbes = 0;
20954
+
20883
20955
  // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
20884
20956
  lights.sort( shadowCastingAndTexturingLightsFirst );
20885
20957
 
@@ -20910,6 +20982,8 @@
20910
20982
 
20911
20983
  }
20912
20984
 
20985
+ numLightProbes ++;
20986
+
20913
20987
  } else if ( light.isDirectionalLight ) {
20914
20988
 
20915
20989
  const uniforms = cache.get( light );
@@ -21097,7 +21171,8 @@
21097
21171
  hash.numDirectionalShadows !== numDirectionalShadows ||
21098
21172
  hash.numPointShadows !== numPointShadows ||
21099
21173
  hash.numSpotShadows !== numSpotShadows ||
21100
- hash.numSpotMaps !== numSpotMaps ) {
21174
+ hash.numSpotMaps !== numSpotMaps ||
21175
+ hash.numLightProbes !== numLightProbes ) {
21101
21176
 
21102
21177
  state.directional.length = directionalLength;
21103
21178
  state.spot.length = spotLength;
@@ -21116,6 +21191,7 @@
21116
21191
  state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
21117
21192
  state.spotLightMap.length = numSpotMaps;
21118
21193
  state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
21194
+ state.numLightProbes = numLightProbes;
21119
21195
 
21120
21196
  hash.directionalLength = directionalLength;
21121
21197
  hash.pointLength = pointLength;
@@ -21128,6 +21204,8 @@
21128
21204
  hash.numSpotShadows = numSpotShadows;
21129
21205
  hash.numSpotMaps = numSpotMaps;
21130
21206
 
21207
+ hash.numLightProbes = numLightProbes;
21208
+
21131
21209
  state.version = nextVersion ++;
21132
21210
 
21133
21211
  }
@@ -23274,9 +23352,11 @@
23274
23352
 
23275
23353
  if ( glFormat === _gl.RGBA ) {
23276
23354
 
23355
+ const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
23356
+
23277
23357
  if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
23278
23358
  if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
23279
- 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;
23280
23360
  if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
23281
23361
  if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
23282
23362
 
@@ -23831,10 +23911,14 @@
23831
23911
 
23832
23912
  state.activeTexture( _gl.TEXTURE0 + slot );
23833
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
+
23834
23918
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
23835
23919
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
23836
23920
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
23837
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
23921
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
23838
23922
 
23839
23923
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
23840
23924
  let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
@@ -24245,10 +24329,14 @@
24245
24329
 
24246
24330
  state.activeTexture( _gl.TEXTURE0 + slot );
24247
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
+
24248
24336
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24249
24337
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24250
24338
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24251
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24339
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24252
24340
 
24253
24341
  const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
24254
24342
  const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
@@ -24488,7 +24576,7 @@
24488
24576
 
24489
24577
  if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
24490
24578
 
24491
- let glInternalFormat = _gl.DEPTH_COMPONENT16;
24579
+ let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
24492
24580
 
24493
24581
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
24494
24582
 
@@ -25129,7 +25217,7 @@
25129
25217
 
25130
25218
  // sRGB
25131
25219
 
25132
- if ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) {
25220
+ if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
25133
25221
 
25134
25222
  if ( isWebGL2 === false ) {
25135
25223
 
@@ -25195,9 +25283,6 @@
25195
25283
 
25196
25284
  }
25197
25285
 
25198
- const LinearTransferFunction = 0;
25199
- const SRGBTransferFunction = 1;
25200
-
25201
25286
  function WebGLUtils( gl, extensions, capabilities ) {
25202
25287
 
25203
25288
  const isWebGL2 = capabilities.isWebGL2;
@@ -25206,7 +25291,7 @@
25206
25291
 
25207
25292
  let extension;
25208
25293
 
25209
- const transferFunction = ( colorSpace === SRGBColorSpace || colorSpace === DisplayP3ColorSpace ) ? SRGBTransferFunction : LinearTransferFunction;
25294
+ const transfer = ColorManagement.getTransfer( colorSpace );
25210
25295
 
25211
25296
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
25212
25297
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
@@ -25274,7 +25359,7 @@
25274
25359
 
25275
25360
  if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
25276
25361
 
25277
- if ( transferFunction === SRGBTransferFunction ) {
25362
+ if ( transfer === SRGBTransfer ) {
25278
25363
 
25279
25364
  extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
25280
25365
 
@@ -25359,8 +25444,8 @@
25359
25444
 
25360
25445
  if ( extension !== null ) {
25361
25446
 
25362
- if ( p === RGB_ETC2_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25363
- if ( p === RGBA_ETC2_EAC_Format ) return ( transferFunction === SRGBTransferFunction ) ? 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;
25364
25449
 
25365
25450
  } else {
25366
25451
 
@@ -25382,20 +25467,20 @@
25382
25467
 
25383
25468
  if ( extension !== null ) {
25384
25469
 
25385
- if ( p === RGBA_ASTC_4x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25386
- if ( p === RGBA_ASTC_5x4_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25387
- if ( p === RGBA_ASTC_5x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25388
- if ( p === RGBA_ASTC_6x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25389
- if ( p === RGBA_ASTC_6x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25390
- if ( p === RGBA_ASTC_8x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25391
- if ( p === RGBA_ASTC_8x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25392
- if ( p === RGBA_ASTC_8x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25393
- if ( p === RGBA_ASTC_10x5_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25394
- if ( p === RGBA_ASTC_10x6_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25395
- if ( p === RGBA_ASTC_10x8_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25396
- if ( p === RGBA_ASTC_10x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25397
- if ( p === RGBA_ASTC_12x10_Format ) return ( transferFunction === SRGBTransferFunction ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25398
- if ( p === RGBA_ASTC_12x12_Format ) return ( transferFunction === SRGBTransferFunction ) ? 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;
25399
25484
 
25400
25485
  } else {
25401
25486
 
@@ -25413,7 +25498,7 @@
25413
25498
 
25414
25499
  if ( extension !== null ) {
25415
25500
 
25416
- if ( p === RGBA_BPTC_Format ) return ( transferFunction === SRGBTransferFunction ) ? 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;
25417
25502
  if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
25418
25503
  if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
25419
25504
 
@@ -27699,7 +27784,7 @@
27699
27784
 
27700
27785
  // physically based shading
27701
27786
 
27702
- this.outputColorSpace = SRGBColorSpace;
27787
+ this._outputColorSpace = SRGBColorSpace;
27703
27788
 
27704
27789
  // physical lights
27705
27790
 
@@ -29976,6 +30061,22 @@
29976
30061
 
29977
30062
  }
29978
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
+
29979
30080
  get physicallyCorrectLights() { // @deprecated, r150
29980
30081
 
29981
30082
  console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
@@ -32393,10 +32494,13 @@
32393
32494
 
32394
32495
  if ( ! startPoint.equals( endPoint ) ) {
32395
32496
 
32396
- this.curves.push( new LineCurve( endPoint, startPoint ) );
32497
+ const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
32498
+ this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
32397
32499
 
32398
32500
  }
32399
32501
 
32502
+ return this;
32503
+
32400
32504
  }
32401
32505
 
32402
32506
  // To get accurate point with reference to
@@ -39663,6 +39767,27 @@
39663
39767
  return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
39664
39768
  }
39665
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
+
39666
39791
  function mean(values, valueof) {
39667
39792
  let count = 0;
39668
39793
  let sum = 0;
@@ -39707,6 +39832,25 @@
39707
39832
  return range;
39708
39833
  }
39709
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
+
39710
39854
  var epsilon$2 = 1e-6;
39711
39855
  var epsilon2 = 1e-12;
39712
39856
  var pi$1 = Math.PI;
@@ -41202,7 +41346,7 @@
41202
41346
  var coordinates = [null, null],
41203
41347
  object$1 = {type: "LineString", coordinates: coordinates};
41204
41348
 
41205
- function geoDistance(a, b) {
41349
+ function geoDistance$1(a, b) {
41206
41350
  coordinates[0] = a;
41207
41351
  coordinates[1] = b;
41208
41352
  return length(object$1);
@@ -41261,16 +41405,16 @@
41261
41405
  }
41262
41406
 
41263
41407
  function containsPoint(coordinates, point) {
41264
- return geoDistance(coordinates, point) === 0;
41408
+ return geoDistance$1(coordinates, point) === 0;
41265
41409
  }
41266
41410
 
41267
41411
  function containsLine(coordinates, point) {
41268
41412
  var ao, bo, ab;
41269
41413
  for (var i = 0, n = coordinates.length; i < n; i++) {
41270
- bo = geoDistance(coordinates[i], point);
41414
+ bo = geoDistance$1(coordinates[i], point);
41271
41415
  if (bo === 0) return true;
41272
41416
  if (i > 0) {
41273
- ab = geoDistance(coordinates[i], coordinates[i - 1]);
41417
+ ab = geoDistance$1(coordinates[i], coordinates[i - 1]);
41274
41418
  if (
41275
41419
  ab > 0 &&
41276
41420
  ao <= ab &&
@@ -42041,7 +42185,7 @@
42041
42185
  var prevPnt = null;
42042
42186
  lineCoords.forEach(function (pnt) {
42043
42187
  if (prevPnt) {
42044
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
42188
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
42045
42189
  if (dist > maxDegDistance) {
42046
42190
  var interpol = geoInterpolate(prevPnt, pnt);
42047
42191
  var tStep = 1 / Math.ceil(dist / maxDegDistance);
@@ -42057,14 +42201,14 @@
42057
42201
  return result;
42058
42202
  };
42059
42203
 
42060
- 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
42061
42205
  : {
42062
42206
  BufferGeometry: BufferGeometry,
42063
42207
  Float32BufferAttribute: Float32BufferAttribute
42064
42208
  };
42065
42209
 
42066
42210
  // support both modes for backwards threejs compatibility
42067
- var setAttributeFn$4 = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42211
+ var setAttributeFn$3 = new THREE$l.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42068
42212
  var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
42069
42213
  _inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
42070
42214
  var _super = _createSuper$2(GeoJsonGeometry);
@@ -42108,7 +42252,7 @@
42108
42252
 
42109
42253
  // build geometry
42110
42254
  indices.length && _this.setIndex(indices);
42111
- 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));
42112
42256
 
42113
42257
  //
42114
42258
 
@@ -42234,7 +42378,7 @@
42234
42378
  return _this;
42235
42379
  }
42236
42380
  return _createClass$2(GeoJsonGeometry);
42237
- }(THREE$j.BufferGeometry); //
42381
+ }(THREE$l.BufferGeometry); //
42238
42382
  function concatGroup(main, extra) {
42239
42383
  var prevVertCnt = Math.round(main.vertices.length / 3);
42240
42384
  concatArr(main.vertices, extra.vertices);
@@ -42812,7 +42956,7 @@
42812
42956
  }
42813
42957
 
42814
42958
  /**
42815
- * @param {Array<BufferGeometry>} geometry
42959
+ * @param {BufferGeometry} geometry
42816
42960
  * @return {number}
42817
42961
  */
42818
42962
  function estimateBytesUsed( geometry ) {
@@ -42888,8 +43032,10 @@
42888
43032
  }
42889
43033
 
42890
43034
  // convert the error tolerance to an amount of decimal places to truncate to
42891
- const decimalShift = Math.log10( 1 / tolerance );
42892
- 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;
42893
43039
  for ( let i = 0; i < vertexCount; i ++ ) {
42894
43040
 
42895
43041
  const index = indices ? indices.getX( i ) : i;
@@ -42905,7 +43051,7 @@
42905
43051
  for ( let k = 0; k < itemSize; k ++ ) {
42906
43052
 
42907
43053
  // double tilde truncates the decimal value
42908
- hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;
43054
+ hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * hashMultiplier + hashAdditive ) },`;
42909
43055
 
42910
43056
  }
42911
43057
 
@@ -43643,6 +43789,412 @@
43643
43789
  };
43644
43790
  }); // constant
43645
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
+
43646
44198
  // This file is autogenerated. It's used to publish ESM to npm.
43647
44199
  function _typeof(obj) {
43648
44200
  "@babel/helpers - typeof";
@@ -45309,412 +45861,6 @@
45309
45861
  return this;
45310
45862
  }
45311
45863
 
45312
- function define(constructor, factory, prototype) {
45313
- constructor.prototype = factory.prototype = prototype;
45314
- prototype.constructor = constructor;
45315
- }
45316
-
45317
- function extend(parent, definition) {
45318
- var prototype = Object.create(parent.prototype);
45319
- for (var key in definition) prototype[key] = definition[key];
45320
- return prototype;
45321
- }
45322
-
45323
- function Color() {}
45324
-
45325
- var darker = 0.7;
45326
- var brighter = 1 / darker;
45327
-
45328
- var reI = "\\s*([+-]?\\d+)\\s*",
45329
- reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
45330
- reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
45331
- reHex = /^#([0-9a-f]{3,8})$/,
45332
- reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
45333
- reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
45334
- reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
45335
- reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
45336
- reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
45337
- reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
45338
-
45339
- var named = {
45340
- aliceblue: 0xf0f8ff,
45341
- antiquewhite: 0xfaebd7,
45342
- aqua: 0x00ffff,
45343
- aquamarine: 0x7fffd4,
45344
- azure: 0xf0ffff,
45345
- beige: 0xf5f5dc,
45346
- bisque: 0xffe4c4,
45347
- black: 0x000000,
45348
- blanchedalmond: 0xffebcd,
45349
- blue: 0x0000ff,
45350
- blueviolet: 0x8a2be2,
45351
- brown: 0xa52a2a,
45352
- burlywood: 0xdeb887,
45353
- cadetblue: 0x5f9ea0,
45354
- chartreuse: 0x7fff00,
45355
- chocolate: 0xd2691e,
45356
- coral: 0xff7f50,
45357
- cornflowerblue: 0x6495ed,
45358
- cornsilk: 0xfff8dc,
45359
- crimson: 0xdc143c,
45360
- cyan: 0x00ffff,
45361
- darkblue: 0x00008b,
45362
- darkcyan: 0x008b8b,
45363
- darkgoldenrod: 0xb8860b,
45364
- darkgray: 0xa9a9a9,
45365
- darkgreen: 0x006400,
45366
- darkgrey: 0xa9a9a9,
45367
- darkkhaki: 0xbdb76b,
45368
- darkmagenta: 0x8b008b,
45369
- darkolivegreen: 0x556b2f,
45370
- darkorange: 0xff8c00,
45371
- darkorchid: 0x9932cc,
45372
- darkred: 0x8b0000,
45373
- darksalmon: 0xe9967a,
45374
- darkseagreen: 0x8fbc8f,
45375
- darkslateblue: 0x483d8b,
45376
- darkslategray: 0x2f4f4f,
45377
- darkslategrey: 0x2f4f4f,
45378
- darkturquoise: 0x00ced1,
45379
- darkviolet: 0x9400d3,
45380
- deeppink: 0xff1493,
45381
- deepskyblue: 0x00bfff,
45382
- dimgray: 0x696969,
45383
- dimgrey: 0x696969,
45384
- dodgerblue: 0x1e90ff,
45385
- firebrick: 0xb22222,
45386
- floralwhite: 0xfffaf0,
45387
- forestgreen: 0x228b22,
45388
- fuchsia: 0xff00ff,
45389
- gainsboro: 0xdcdcdc,
45390
- ghostwhite: 0xf8f8ff,
45391
- gold: 0xffd700,
45392
- goldenrod: 0xdaa520,
45393
- gray: 0x808080,
45394
- green: 0x008000,
45395
- greenyellow: 0xadff2f,
45396
- grey: 0x808080,
45397
- honeydew: 0xf0fff0,
45398
- hotpink: 0xff69b4,
45399
- indianred: 0xcd5c5c,
45400
- indigo: 0x4b0082,
45401
- ivory: 0xfffff0,
45402
- khaki: 0xf0e68c,
45403
- lavender: 0xe6e6fa,
45404
- lavenderblush: 0xfff0f5,
45405
- lawngreen: 0x7cfc00,
45406
- lemonchiffon: 0xfffacd,
45407
- lightblue: 0xadd8e6,
45408
- lightcoral: 0xf08080,
45409
- lightcyan: 0xe0ffff,
45410
- lightgoldenrodyellow: 0xfafad2,
45411
- lightgray: 0xd3d3d3,
45412
- lightgreen: 0x90ee90,
45413
- lightgrey: 0xd3d3d3,
45414
- lightpink: 0xffb6c1,
45415
- lightsalmon: 0xffa07a,
45416
- lightseagreen: 0x20b2aa,
45417
- lightskyblue: 0x87cefa,
45418
- lightslategray: 0x778899,
45419
- lightslategrey: 0x778899,
45420
- lightsteelblue: 0xb0c4de,
45421
- lightyellow: 0xffffe0,
45422
- lime: 0x00ff00,
45423
- limegreen: 0x32cd32,
45424
- linen: 0xfaf0e6,
45425
- magenta: 0xff00ff,
45426
- maroon: 0x800000,
45427
- mediumaquamarine: 0x66cdaa,
45428
- mediumblue: 0x0000cd,
45429
- mediumorchid: 0xba55d3,
45430
- mediumpurple: 0x9370db,
45431
- mediumseagreen: 0x3cb371,
45432
- mediumslateblue: 0x7b68ee,
45433
- mediumspringgreen: 0x00fa9a,
45434
- mediumturquoise: 0x48d1cc,
45435
- mediumvioletred: 0xc71585,
45436
- midnightblue: 0x191970,
45437
- mintcream: 0xf5fffa,
45438
- mistyrose: 0xffe4e1,
45439
- moccasin: 0xffe4b5,
45440
- navajowhite: 0xffdead,
45441
- navy: 0x000080,
45442
- oldlace: 0xfdf5e6,
45443
- olive: 0x808000,
45444
- olivedrab: 0x6b8e23,
45445
- orange: 0xffa500,
45446
- orangered: 0xff4500,
45447
- orchid: 0xda70d6,
45448
- palegoldenrod: 0xeee8aa,
45449
- palegreen: 0x98fb98,
45450
- paleturquoise: 0xafeeee,
45451
- palevioletred: 0xdb7093,
45452
- papayawhip: 0xffefd5,
45453
- peachpuff: 0xffdab9,
45454
- peru: 0xcd853f,
45455
- pink: 0xffc0cb,
45456
- plum: 0xdda0dd,
45457
- powderblue: 0xb0e0e6,
45458
- purple: 0x800080,
45459
- rebeccapurple: 0x663399,
45460
- red: 0xff0000,
45461
- rosybrown: 0xbc8f8f,
45462
- royalblue: 0x4169e1,
45463
- saddlebrown: 0x8b4513,
45464
- salmon: 0xfa8072,
45465
- sandybrown: 0xf4a460,
45466
- seagreen: 0x2e8b57,
45467
- seashell: 0xfff5ee,
45468
- sienna: 0xa0522d,
45469
- silver: 0xc0c0c0,
45470
- skyblue: 0x87ceeb,
45471
- slateblue: 0x6a5acd,
45472
- slategray: 0x708090,
45473
- slategrey: 0x708090,
45474
- snow: 0xfffafa,
45475
- springgreen: 0x00ff7f,
45476
- steelblue: 0x4682b4,
45477
- tan: 0xd2b48c,
45478
- teal: 0x008080,
45479
- thistle: 0xd8bfd8,
45480
- tomato: 0xff6347,
45481
- turquoise: 0x40e0d0,
45482
- violet: 0xee82ee,
45483
- wheat: 0xf5deb3,
45484
- white: 0xffffff,
45485
- whitesmoke: 0xf5f5f5,
45486
- yellow: 0xffff00,
45487
- yellowgreen: 0x9acd32
45488
- };
45489
-
45490
- define(Color, color, {
45491
- copy(channels) {
45492
- return Object.assign(new this.constructor, this, channels);
45493
- },
45494
- displayable() {
45495
- return this.rgb().displayable();
45496
- },
45497
- hex: color_formatHex, // Deprecated! Use color.formatHex.
45498
- formatHex: color_formatHex,
45499
- formatHex8: color_formatHex8,
45500
- formatHsl: color_formatHsl,
45501
- formatRgb: color_formatRgb,
45502
- toString: color_formatRgb
45503
- });
45504
-
45505
- function color_formatHex() {
45506
- return this.rgb().formatHex();
45507
- }
45508
-
45509
- function color_formatHex8() {
45510
- return this.rgb().formatHex8();
45511
- }
45512
-
45513
- function color_formatHsl() {
45514
- return hslConvert(this).formatHsl();
45515
- }
45516
-
45517
- function color_formatRgb() {
45518
- return this.rgb().formatRgb();
45519
- }
45520
-
45521
- function color(format) {
45522
- var m, l;
45523
- format = (format + "").trim().toLowerCase();
45524
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
45525
- : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
45526
- : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
45527
- : 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
45528
- : null) // invalid hex
45529
- : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
45530
- : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
45531
- : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
45532
- : (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)
45533
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
45534
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
45535
- : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
45536
- : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
45537
- : null;
45538
- }
45539
-
45540
- function rgbn(n) {
45541
- return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
45542
- }
45543
-
45544
- function rgba$1(r, g, b, a) {
45545
- if (a <= 0) r = g = b = NaN;
45546
- return new Rgb(r, g, b, a);
45547
- }
45548
-
45549
- function rgbConvert(o) {
45550
- if (!(o instanceof Color)) o = color(o);
45551
- if (!o) return new Rgb;
45552
- o = o.rgb();
45553
- return new Rgb(o.r, o.g, o.b, o.opacity);
45554
- }
45555
-
45556
- function rgb$2(r, g, b, opacity) {
45557
- return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
45558
- }
45559
-
45560
- function Rgb(r, g, b, opacity) {
45561
- this.r = +r;
45562
- this.g = +g;
45563
- this.b = +b;
45564
- this.opacity = +opacity;
45565
- }
45566
-
45567
- define(Rgb, rgb$2, extend(Color, {
45568
- brighter(k) {
45569
- k = k == null ? brighter : Math.pow(brighter, k);
45570
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45571
- },
45572
- darker(k) {
45573
- k = k == null ? darker : Math.pow(darker, k);
45574
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45575
- },
45576
- rgb() {
45577
- return this;
45578
- },
45579
- clamp() {
45580
- return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
45581
- },
45582
- displayable() {
45583
- return (-0.5 <= this.r && this.r < 255.5)
45584
- && (-0.5 <= this.g && this.g < 255.5)
45585
- && (-0.5 <= this.b && this.b < 255.5)
45586
- && (0 <= this.opacity && this.opacity <= 1);
45587
- },
45588
- hex: rgb_formatHex, // Deprecated! Use color.formatHex.
45589
- formatHex: rgb_formatHex,
45590
- formatHex8: rgb_formatHex8,
45591
- formatRgb: rgb_formatRgb,
45592
- toString: rgb_formatRgb
45593
- }));
45594
-
45595
- function rgb_formatHex() {
45596
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
45597
- }
45598
-
45599
- function rgb_formatHex8() {
45600
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
45601
- }
45602
-
45603
- function rgb_formatRgb() {
45604
- const a = clampa(this.opacity);
45605
- return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
45606
- }
45607
-
45608
- function clampa(opacity) {
45609
- return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
45610
- }
45611
-
45612
- function clampi(value) {
45613
- return Math.max(0, Math.min(255, Math.round(value) || 0));
45614
- }
45615
-
45616
- function hex(value) {
45617
- value = clampi(value);
45618
- return (value < 16 ? "0" : "") + value.toString(16);
45619
- }
45620
-
45621
- function hsla(h, s, l, a) {
45622
- if (a <= 0) h = s = l = NaN;
45623
- else if (l <= 0 || l >= 1) h = s = NaN;
45624
- else if (s <= 0) h = NaN;
45625
- return new Hsl(h, s, l, a);
45626
- }
45627
-
45628
- function hslConvert(o) {
45629
- if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
45630
- if (!(o instanceof Color)) o = color(o);
45631
- if (!o) return new Hsl;
45632
- if (o instanceof Hsl) return o;
45633
- o = o.rgb();
45634
- var r = o.r / 255,
45635
- g = o.g / 255,
45636
- b = o.b / 255,
45637
- min = Math.min(r, g, b),
45638
- max = Math.max(r, g, b),
45639
- h = NaN,
45640
- s = max - min,
45641
- l = (max + min) / 2;
45642
- if (s) {
45643
- if (r === max) h = (g - b) / s + (g < b) * 6;
45644
- else if (g === max) h = (b - r) / s + 2;
45645
- else h = (r - g) / s + 4;
45646
- s /= l < 0.5 ? max + min : 2 - max - min;
45647
- h *= 60;
45648
- } else {
45649
- s = l > 0 && l < 1 ? 0 : h;
45650
- }
45651
- return new Hsl(h, s, l, o.opacity);
45652
- }
45653
-
45654
- function hsl(h, s, l, opacity) {
45655
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
45656
- }
45657
-
45658
- function Hsl(h, s, l, opacity) {
45659
- this.h = +h;
45660
- this.s = +s;
45661
- this.l = +l;
45662
- this.opacity = +opacity;
45663
- }
45664
-
45665
- define(Hsl, hsl, extend(Color, {
45666
- brighter(k) {
45667
- k = k == null ? brighter : Math.pow(brighter, k);
45668
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45669
- },
45670
- darker(k) {
45671
- k = k == null ? darker : Math.pow(darker, k);
45672
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45673
- },
45674
- rgb() {
45675
- var h = this.h % 360 + (this.h < 0) * 360,
45676
- s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
45677
- l = this.l,
45678
- m2 = l + (l < 0.5 ? l : 1 - l) * s,
45679
- m1 = 2 * l - m2;
45680
- return new Rgb(
45681
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
45682
- hsl2rgb(h, m1, m2),
45683
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
45684
- this.opacity
45685
- );
45686
- },
45687
- clamp() {
45688
- return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
45689
- },
45690
- displayable() {
45691
- return (0 <= this.s && this.s <= 1 || isNaN(this.s))
45692
- && (0 <= this.l && this.l <= 1)
45693
- && (0 <= this.opacity && this.opacity <= 1);
45694
- },
45695
- formatHsl() {
45696
- const a = clampa(this.opacity);
45697
- return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
45698
- }
45699
- }));
45700
-
45701
- function clamph(value) {
45702
- value = (value || 0) % 360;
45703
- return value < 0 ? value + 360 : value;
45704
- }
45705
-
45706
- function clampt(value) {
45707
- return Math.max(0, Math.min(1, value || 0));
45708
- }
45709
-
45710
- /* From FvD 13.37, CSS Color Module Level 3 */
45711
- function hsl2rgb(h, m1, m2) {
45712
- return (h < 60 ? m1 + (m2 - m1) * h / 60
45713
- : h < 180 ? m2
45714
- : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
45715
- : m1) * 255;
45716
- }
45717
-
45718
45864
  var constant = x => () => x;
45719
45865
 
45720
45866
  function linear$1(a, d) {
@@ -48554,7 +48700,7 @@
48554
48700
  }
48555
48701
  if (!v.delaunay) return false;
48556
48702
  const _distances = v.delaunay.edges.map(e =>
48557
- geoDistance(v.points[e[0]], v.points[e[1]])
48703
+ geoDistance$1(v.points[e[0]], v.points[e[1]])
48558
48704
  ),
48559
48705
  _urquart = v.delaunay.urquhart(_distances);
48560
48706
  return {
@@ -48614,7 +48760,7 @@
48614
48760
  v._found = undefined;
48615
48761
  v.find = function(x, y, radius) {
48616
48762
  v._found = v.delaunay.find(x, y, v._found);
48617
- if (!radius || geoDistance([x, y], v.points[v._found]) < radius)
48763
+ if (!radius || geoDistance$1([x, y], v.points[v._found]) < radius)
48618
48764
  return v._found;
48619
48765
  };
48620
48766
 
@@ -48926,7 +49072,7 @@
48926
49072
  var prevPnt;
48927
49073
  coords.forEach(function (pnt) {
48928
49074
  if (prevPnt) {
48929
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
49075
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
48930
49076
  if (dist > maxDistance) {
48931
49077
  var interpol = geoInterpolate(prevPnt, pnt);
48932
49078
  var tStep = 1 / Math.ceil(dist / maxDistance);
@@ -49014,14 +49160,14 @@
49014
49160
  return crossesPoleOrAntimeridian ? geoContains(polygon, pnt) : booleanPointInPolygon(pnt, polygon);
49015
49161
  }
49016
49162
 
49017
- 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
49018
49164
  : {
49019
49165
  BufferGeometry: BufferGeometry,
49020
49166
  Float32BufferAttribute: Float32BufferAttribute
49021
49167
  };
49022
49168
 
49023
49169
  // support both modes for backwards threejs compatibility
49024
- var setAttributeFn$3 = new THREE$i.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49170
+ var setAttributeFn$2 = new THREE$k.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49025
49171
  var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
49026
49172
  _inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
49027
49173
  var _super = _createSuper$1(ConicPolygonBufferGeometry);
@@ -49076,8 +49222,8 @@
49076
49222
 
49077
49223
  // build geometry
49078
49224
  _this.setIndex(indices);
49079
- _this[setAttributeFn$3]('position', new THREE$i.Float32BufferAttribute(vertices, 3));
49080
- _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));
49081
49227
 
49082
49228
  // auto-calculate normals
49083
49229
  _this.computeVertexNormals();
@@ -49141,7 +49287,7 @@
49141
49287
  return _this;
49142
49288
  }
49143
49289
  return _createClass$1(ConicPolygonBufferGeometry);
49144
- }(THREE$i.BufferGeometry); //
49290
+ }(THREE$k.BufferGeometry); //
49145
49291
  function polar2Cartesian$1(lat, lng) {
49146
49292
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
49147
49293
  var phi = (90 - lat) * Math.PI / 180;
@@ -64100,6 +64246,449 @@
64100
64246
  return rad * 180 / Math.PI;
64101
64247
  }
64102
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
+
64103
64692
  const THREE$2$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64104
64693
  : {
64105
64694
  Box3,
@@ -64114,7 +64703,7 @@
64114
64703
  };
64115
64704
 
64116
64705
  // support multiple method names for backwards threejs compatibility
64117
- var setAttributeFn$1$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64706
+ var setAttributeFn$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64118
64707
  const _box$1 = new THREE$2$1.Box3();
64119
64708
  const _vector = new THREE$2$1.Vector3();
64120
64709
  class LineSegmentsGeometry extends THREE$2$1.InstancedBufferGeometry {
@@ -64125,8 +64714,8 @@
64125
64714
  const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
64126
64715
  const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
64127
64716
  this.setIndex(index);
64128
- this[setAttributeFn$1$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
64129
- 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));
64130
64719
  }
64131
64720
  applyMatrix4(matrix) {
64132
64721
  const start = this.attributes.instanceStart;
@@ -64153,9 +64742,9 @@
64153
64742
  }
64154
64743
  const instanceBuffer = new THREE$2$1.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz
64155
64744
 
64156
- 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
64157
64746
 
64158
- 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
64159
64748
  //
64160
64749
 
64161
64750
  this.computeBoundingBox();
@@ -64171,9 +64760,9 @@
64171
64760
  }
64172
64761
  const instanceColorBuffer = new THREE$2$1.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb
64173
64762
 
64174
- 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
64175
64764
 
64176
- 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
64177
64766
 
64178
64767
  return this;
64179
64768
  }
@@ -64788,7 +65377,7 @@
64788
65377
  }
64789
65378
  LineMaterial.prototype.isLineMaterial = true;
64790
65379
 
64791
- 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
64792
65381
  : {
64793
65382
  Box3,
64794
65383
  BufferGeometry,
@@ -64804,20 +65393,20 @@
64804
65393
  };
64805
65394
 
64806
65395
  // support both modes for backwards threejs compatibility
64807
- var setAttributeFn$2 = new THREE$h.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64808
- const _start = new THREE$h.Vector3();
64809
- const _end = new THREE$h.Vector3();
64810
- const _start4 = new THREE$h.Vector4();
64811
- const _end4 = new THREE$h.Vector4();
64812
- const _ssOrigin = new THREE$h.Vector4();
64813
- const _ssOrigin3 = new THREE$h.Vector3();
64814
- const _mvMatrix = new THREE$h.Matrix4();
64815
- const _line = new THREE$h.Line3();
64816
- const _closestPoint = new THREE$h.Vector3();
64817
- const _box = new THREE$h.Box3();
64818
- const _sphere = new THREE$h.Sphere();
64819
- const _clipToWorldVector = new THREE$h.Vector4();
64820
- 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 {
64821
65410
  constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
64822
65411
  color: Math.random() * 0xffffff
64823
65412
  })) {
@@ -64836,11 +65425,11 @@
64836
65425
  lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
64837
65426
  lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
64838
65427
  }
64839
- const instanceDistanceBuffer = new THREE$h.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
65428
+ const instanceDistanceBuffer = new THREE$j.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
64840
65429
 
64841
- geometry[setAttributeFn$2]('instanceDistanceStart', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
65430
+ geometry[setAttributeFn]('instanceDistanceStart', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
64842
65431
 
64843
- geometry[setAttributeFn$2]('instanceDistanceEnd', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
65432
+ geometry[setAttributeFn]('instanceDistanceEnd', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
64844
65433
 
64845
65434
  return this;
64846
65435
  }
@@ -64962,7 +65551,7 @@
64962
65551
  const param = _line.closestPointToPointParameter(_ssOrigin3, true);
64963
65552
  _line.at(param, _closestPoint); // check if the intersection point is within clip space
64964
65553
 
64965
- const zPos = THREE$h.MathUtils.lerp(_start4.z, _end4.z, param);
65554
+ const zPos = THREE$j.MathUtils.lerp(_start4.z, _end4.z, param);
64966
65555
  const isInClipSpace = zPos >= -1 && zPos <= 1;
64967
65556
  const isInside = _ssOrigin3.distanceTo(_closestPoint) < lineWidth * 0.5;
64968
65557
  if (isInClipSpace && isInside) {
@@ -64970,8 +65559,8 @@
64970
65559
  _line.end.fromBufferAttribute(instanceEnd, i);
64971
65560
  _line.start.applyMatrix4(matrixWorld);
64972
65561
  _line.end.applyMatrix4(matrixWorld);
64973
- const pointOnLine = new THREE$h.Vector3();
64974
- const point = new THREE$h.Vector3();
65562
+ const pointOnLine = new THREE$j.Vector3();
65563
+ const point = new THREE$j.Vector3();
64975
65564
  ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
64976
65565
  intersects.push({
64977
65566
  point: point,
@@ -65242,53 +65831,53 @@
65242
65831
 
65243
65832
  }
65244
65833
 
65245
- function _iterableToArrayLimit$1(arr, i) {
65246
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
65247
- if (null != _i) {
65248
- var _s,
65249
- _e,
65250
- _x,
65251
- _r,
65252
- _arr = [],
65253
- _n = !0,
65254
- _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;
65255
65844
  try {
65256
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
65257
- if (Object(_i) !== _i) return;
65258
- _n = !1;
65259
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
65260
- } catch (err) {
65261
- _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;
65262
65851
  } finally {
65263
65852
  try {
65264
- 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;
65265
65854
  } finally {
65266
- if (_d) throw _e;
65855
+ if (o) throw n;
65267
65856
  }
65268
65857
  }
65269
- return _arr;
65858
+ return a;
65270
65859
  }
65271
65860
  }
65272
- function ownKeys(object, enumerableOnly) {
65273
- var keys = Object.keys(object);
65861
+ function ownKeys(e, r) {
65862
+ var t = Object.keys(e);
65274
65863
  if (Object.getOwnPropertySymbols) {
65275
- var symbols = Object.getOwnPropertySymbols(object);
65276
- enumerableOnly && (symbols = symbols.filter(function (sym) {
65277
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65278
- })), 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);
65279
65868
  }
65280
- return keys;
65869
+ return t;
65281
65870
  }
65282
- function _objectSpread2(target) {
65283
- for (var i = 1; i < arguments.length; i++) {
65284
- var source = null != arguments[i] ? arguments[i] : {};
65285
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
65286
- _defineProperty$1(target, key, source[key]);
65287
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
65288
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
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));
65289
65878
  });
65290
65879
  }
65291
- return target;
65880
+ return e;
65292
65881
  }
65293
65882
  function _classCallCheck(instance, Constructor) {
65294
65883
  if (!(instance instanceof Constructor)) {
@@ -65484,6 +66073,56 @@
65484
66073
  var key = _toPrimitive$1(arg, "string");
65485
66074
  return typeof key === "symbol" ? key : String(key);
65486
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
+ }
65487
66126
 
65488
66127
  var materialDispose = function materialDispose(material) {
65489
66128
  if (material instanceof Array) {
@@ -65580,7 +66219,7 @@
65580
66219
  return deg * Math.PI / 180;
65581
66220
  }
65582
66221
 
65583
- 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
65584
66223
  : {
65585
66224
  BackSide: BackSide,
65586
66225
  BufferAttribute: BufferAttribute,
@@ -65600,7 +66239,7 @@
65600
66239
 
65601
66240
  // Based off: http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
65602
66241
  function createGlowMaterial(coefficient, color, power) {
65603
- return new THREE$f.ShaderMaterial({
66242
+ return new THREE$h.ShaderMaterial({
65604
66243
  depthWrite: false,
65605
66244
  fragmentShader: fragmentShader,
65606
66245
  transparent: true,
@@ -65609,7 +66248,7 @@
65609
66248
  value: coefficient
65610
66249
  },
65611
66250
  color: {
65612
- value: new THREE$f.Color(color)
66251
+ value: new THREE$h.Color(color)
65613
66252
  },
65614
66253
  power: {
65615
66254
  value: power
@@ -65629,7 +66268,7 @@
65629
66268
  var curPos = geometry.attributes.position.array[idx];
65630
66269
  position[idx] = curPos + normal * size;
65631
66270
  }
65632
- glowGeometry.setAttribute('position', new THREE$f.BufferAttribute(position, 3));
66271
+ glowGeometry.setAttribute('position', new THREE$h.BufferAttribute(position, 3));
65633
66272
  return glowGeometry;
65634
66273
  }
65635
66274
  function createGlowMesh(geometry) {
@@ -65642,12 +66281,12 @@
65642
66281
  var glowGeometry = createGlowGeometry(geometry, size);
65643
66282
  var glowMaterial = createGlowMaterial(coefficient, color, power);
65644
66283
  if (backside) {
65645
- glowMaterial.side = THREE$f.BackSide;
66284
+ glowMaterial.side = THREE$h.BackSide;
65646
66285
  }
65647
- return new THREE$f.Mesh(glowGeometry, glowMaterial);
66286
+ return new THREE$h.Mesh(glowGeometry, glowMaterial);
65648
66287
  }
65649
66288
 
65650
- 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
65651
66290
  : {
65652
66291
  Color: Color$1,
65653
66292
  LineBasicMaterial: LineBasicMaterial,
@@ -65712,16 +66351,16 @@
65712
66351
  },
65713
66352
  stateInit: function stateInit() {
65714
66353
  // create globe
65715
- var globeGeometry = new THREE$e.SphereGeometry(GLOBE_RADIUS, 75, 75);
65716
- var defaultGlobeMaterial = new THREE$e.MeshPhongMaterial({
66354
+ var globeGeometry = new THREE$g.SphereGeometry(GLOBE_RADIUS, 75, 75);
66355
+ var defaultGlobeMaterial = new THREE$g.MeshPhongMaterial({
65717
66356
  color: 0x000000
65718
66357
  });
65719
- var globeObj = new THREE$e.Mesh(globeGeometry, defaultGlobeMaterial);
66358
+ var globeObj = new THREE$g.Mesh(globeGeometry, defaultGlobeMaterial);
65720
66359
  globeObj.rotation.y = -Math.PI / 2; // face prime meridian along Z axis
65721
66360
  globeObj.__globeObjType = 'globe'; // Add object type
65722
66361
 
65723
66362
  // create graticules
65724
- 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({
65725
66364
  color: 'lightgrey',
65726
66365
  transparent: true,
65727
66366
  opacity: 0.1
@@ -65748,10 +66387,10 @@
65748
66387
  if (changedProps.hasOwnProperty('globeImageUrl')) {
65749
66388
  if (!state.globeImageUrl) {
65750
66389
  // Black globe if no image
65751
- !globeMaterial.color && (globeMaterial.color = new THREE$e.Color(0x000000));
66390
+ !globeMaterial.color && (globeMaterial.color = new THREE$g.Color(0x000000));
65752
66391
  } else {
65753
- new THREE$e.TextureLoader().load(state.globeImageUrl, function (texture) {
65754
- texture.colorSpace = THREE$e.SRGBColorSpace;
66392
+ new THREE$g.TextureLoader().load(state.globeImageUrl, function (texture) {
66393
+ texture.colorSpace = THREE$g.SRGBColorSpace;
65755
66394
  globeMaterial.map = texture;
65756
66395
  globeMaterial.color = null;
65757
66396
  globeMaterial.needsUpdate = true;
@@ -65766,7 +66405,7 @@
65766
66405
  globeMaterial.bumpMap = null;
65767
66406
  globeMaterial.needsUpdate = true;
65768
66407
  } else {
65769
- state.bumpImageUrl && new THREE$e.TextureLoader().load(state.bumpImageUrl, function (texture) {
66408
+ state.bumpImageUrl && new THREE$g.TextureLoader().load(state.bumpImageUrl, function (texture) {
65770
66409
  globeMaterial.bumpMap = texture;
65771
66410
  globeMaterial.needsUpdate = true;
65772
66411
  });
@@ -65804,15 +66443,30 @@
65804
66443
  return isNaN(str) ? parseInt(tinycolor(str).toHex(), 16) : str;
65805
66444
  };
65806
66445
  var colorAlpha = function colorAlpha(str) {
65807
- return isNaN(str) ? tinycolor(str).getAlpha() : 1;
66446
+ return str && isNaN(str) ? color(str).opacity : 1;
65808
66447
  };
65809
66448
  var color2ShaderArr = function color2ShaderArr(str) {
65810
66449
  var includeAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
65811
- var rgba = tinycolor(str).toRgb();
65812
- var rgbArr = ['r', 'g', 'b'].map(function (d) {
65813
- return rgba[d] / 255;
65814
- });
65815
- 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;
65816
66470
  };
65817
66471
  function setMaterialOpacity(material, opacity, depthWrite) {
65818
66472
  material.opacity = opacity;
@@ -65822,6 +66476,29 @@
65822
66476
  return material;
65823
66477
  }
65824
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
+
65825
66502
  function threeDigest(data, scene) {
65826
66503
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
65827
66504
  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
@@ -65841,15 +66518,13 @@
65841
66518
  }, options));
65842
66519
  }
65843
66520
 
65844
- 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
65845
66522
  : {
65846
- BufferAttribute: BufferAttribute,
65847
66523
  BufferGeometry: BufferGeometry,
65848
66524
  Color: Color$1,
65849
66525
  CylinderGeometry: CylinderGeometry,
65850
66526
  Matrix4: Matrix4,
65851
66527
  Mesh: Mesh,
65852
- MeshBasicMaterial: MeshBasicMaterial,
65853
66528
  MeshLambertMaterial: MeshLambertMaterial,
65854
66529
  Object3D: Object3D,
65855
66530
  Vector3: Vector3
@@ -65859,8 +66534,6 @@
65859
66534
 
65860
66535
  //
65861
66536
 
65862
- // support multiple method names for backwards threejs compatibility
65863
- var applyMatrix4Fn$1 = new THREE$d.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
65864
66537
  var PointsLayerKapsule = index$2({
65865
66538
  props: {
65866
66539
  pointsData: {
@@ -65915,13 +66588,13 @@
65915
66588
  var colorAccessor = index$1(state.pointColor);
65916
66589
 
65917
66590
  // shared geometry
65918
- var pointGeometry = new THREE$d.CylinderGeometry(1, 1, 1, state.pointResolution);
65919
- pointGeometry[applyMatrix4Fn$1](new THREE$d.Matrix4().makeRotationX(Math.PI / 2));
65920
- 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));
65921
66594
  var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
65922
66595
  var pointMaterials = {}; // indexed by color
65923
66596
 
65924
- 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
65925
66598
 
65926
66599
  threeDigest(state.pointsData, scene, {
65927
66600
  createObj: createObj,
@@ -65929,7 +66602,7 @@
65929
66602
  });
65930
66603
  if (state.pointsMerge) {
65931
66604
  // merge points into a single mesh
65932
- 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) {
65933
66606
  var obj = d.__threeObj;
65934
66607
  d.__threeObj = undefined; // unbind merged points
65935
66608
 
@@ -65937,23 +66610,18 @@
65937
66610
 
65938
66611
  // apply mesh world transform to vertices
65939
66612
  obj.updateMatrix();
65940
- geom[applyMatrix4Fn$1](obj.matrix);
66613
+ geom.applyMatrix4(obj.matrix);
65941
66614
 
65942
66615
  // color vertices
65943
- var color = new THREE$d.Color(colorAccessor(d));
65944
- var nVertices = geom.attributes.position.count;
65945
- var colors = new Float32Array(nVertices * 3);
65946
- for (var i = 0, len = nVertices; i < len; i++) {
65947
- var idx = i * 3;
65948
- colors[idx] = color.r;
65949
- colors[idx + 1] = color.g;
65950
- colors[idx + 2] = color.b;
65951
- }
65952
- 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));
65953
66620
  return geom;
65954
66621
  }));
65955
- var points = new THREE$d.Mesh(pointsGeometry, new THREE$d.MeshBasicMaterial({
66622
+ var points = new THREE$e.Mesh(pointsGeometry, new THREE$e.MeshLambertMaterial({
65956
66623
  color: 0xffffff,
66624
+ transparent: true,
65957
66625
  vertexColors: true
65958
66626
  }));
65959
66627
  points.__globeObjType = 'points'; // Add object type
@@ -65966,7 +66634,7 @@
65966
66634
  //
65967
66635
 
65968
66636
  function createObj() {
65969
- var obj = new THREE$d.Mesh(pointGeometry);
66637
+ var obj = new THREE$e.Mesh(pointGeometry);
65970
66638
  obj.__globeObjType = 'point'; // Add object type
65971
66639
  return obj;
65972
66640
  }
@@ -65982,7 +66650,7 @@
65982
66650
  Object.assign(obj.position, polar2Cartesian(lat, lng));
65983
66651
 
65984
66652
  // orientate outwards
65985
- 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
65986
66654
  obj.lookAt(globeCenter);
65987
66655
 
65988
66656
  // scale radius and altitude
@@ -66018,7 +66686,7 @@
66018
66686
  obj.visible = showCyl;
66019
66687
  if (showCyl) {
66020
66688
  if (!pointMaterials.hasOwnProperty(color)) {
66021
- pointMaterials[color] = new THREE$d.MeshLambertMaterial({
66689
+ pointMaterials[color] = new THREE$e.MeshLambertMaterial({
66022
66690
  color: colorStr2Hex(color),
66023
66691
  transparent: opacity < 1,
66024
66692
  opacity: opacity
@@ -66032,12 +66700,11 @@
66032
66700
  });
66033
66701
 
66034
66702
  var _excluded$1 = ["stroke"];
66035
- 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
66036
66704
  : {
66037
66705
  BufferGeometry: BufferGeometry,
66038
66706
  CubicBezierCurve3: CubicBezierCurve3,
66039
66707
  Curve: Curve,
66040
- Float32BufferAttribute: Float32BufferAttribute,
66041
66708
  Group: Group$1,
66042
66709
  Line: Line,
66043
66710
  Mesh: Mesh,
@@ -66051,8 +66718,6 @@
66051
66718
 
66052
66719
  //
66053
66720
 
66054
- // support both modes for backwards threejs compatibility
66055
- var setAttributeFn$1 = new THREE$c.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
66056
66721
  var gradientShaders$1 = {
66057
66722
  uniforms: {
66058
66723
  // dash param defaults, all relative to full length
@@ -66137,15 +66802,15 @@
66137
66802
  methods: {
66138
66803
  pauseAnimation: function pauseAnimation(state) {
66139
66804
  var _state$ticker;
66140
- (_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();
66141
66806
  },
66142
66807
  resumeAnimation: function resumeAnimation(state) {
66143
66808
  var _state$ticker2;
66144
- (_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();
66145
66810
  },
66146
66811
  _destructor: function _destructor(state) {
66147
66812
  var _state$ticker3;
66148
- (_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();
66149
66814
  }
66150
66815
  },
66151
66816
  init: function init(threeObj, state) {
@@ -66182,13 +66847,13 @@
66182
66847
  var dashGapAccessor = index$1(state.arcDashGap);
66183
66848
  var dashInitialGapAccessor = index$1(state.arcDashInitialGap);
66184
66849
  var dashAnimateTimeAccessor = index$1(state.arcDashAnimateTime);
66185
- var sharedMaterial = new THREE$c.ShaderMaterial(_objectSpread2(_objectSpread2({}, gradientShaders$1), {}, {
66850
+ var sharedMaterial = new THREE$d.ShaderMaterial(_objectSpread2(_objectSpread2({}, gradientShaders$1), {}, {
66186
66851
  transparent: true,
66187
- blending: THREE$c.NormalBlending
66852
+ blending: THREE$d.NormalBlending
66188
66853
  }));
66189
66854
  threeDigest(state.arcsData, state.scene, {
66190
66855
  createObj: function createObj() {
66191
- var obj = new THREE$c.Group(); // populated in updateObj
66856
+ var obj = new THREE$d.Group(); // populated in updateObj
66192
66857
 
66193
66858
  obj.__globeObjType = 'arc'; // Add object type
66194
66859
  return obj;
@@ -66199,7 +66864,7 @@
66199
66864
  if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
66200
66865
  // create or swap object types
66201
66866
  emptyObject(group);
66202
- 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());
66203
66868
  _obj.material = sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
66204
66869
 
66205
66870
  group.add(_obj);
@@ -66239,8 +66904,8 @@
66239
66904
  true // run from end to start, to animate in the correct direction
66240
66905
  );
66241
66906
 
66242
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66243
- obj.geometry[setAttributeFn$1]('vertexRelDistance', vertexRelDistanceArray);
66907
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
66908
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
66244
66909
  var applyUpdate = function applyUpdate(td) {
66245
66910
  var _arc$__currentTargetD = arc.__currentTargetD = td,
66246
66911
  stroke = _arc$__currentTargetD.stroke,
@@ -66248,9 +66913,9 @@
66248
66913
  var curve = calcCurve(curveD);
66249
66914
  if (useTube) {
66250
66915
  obj.geometry && obj.geometry.dispose();
66251
- obj.geometry = new THREE$c.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
66252
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66253
- 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);
66254
66919
  } else {
66255
66920
  obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
66256
66921
  }
@@ -66299,7 +66964,7 @@
66299
66964
  x = _polar2Cartesian.x,
66300
66965
  y = _polar2Cartesian.y,
66301
66966
  z = _polar2Cartesian.z;
66302
- return new THREE$c.Vector3(x, y, z);
66967
+ return new THREE$d.Vector3(x, y, z);
66303
66968
  };
66304
66969
 
66305
66970
  //calculate curve
@@ -66308,7 +66973,7 @@
66308
66973
  var altitude = alt;
66309
66974
  (altitude === null || altitude === undefined) && (
66310
66975
  // by default set altitude proportional to the great-arc distance
66311
- altitude = geoDistance(startPnt, endPnt) / 2 * altAutoScale);
66976
+ altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale);
66312
66977
  if (altitude) {
66313
66978
  var interpolate = geoInterpolate(startPnt, endPnt);
66314
66979
  var _map = [0.25, 0.75].map(function (t) {
@@ -66317,7 +66982,7 @@
66317
66982
  _map2 = _slicedToArray$1(_map, 2),
66318
66983
  m1Pnt = _map2[0],
66319
66984
  m2Pnt = _map2[1];
66320
- 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)));
66321
66986
 
66322
66987
  //const mPnt = [...interpolate(0.5), altitude * 2];
66323
66988
  //curve = new THREE.QuadraticBezierCurve3(...[startPnt, mPnt, endPnt].map(getVec));
@@ -66337,9 +67002,9 @@
66337
67002
  return startVec.clone();
66338
67003
  } // points exactly overlap
66339
67004
  : function (t) {
66340
- 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));
66341
67006
  };
66342
- var sphereArc = new THREE$c.Curve();
67007
+ var sphereArc = new THREE$d.Curve();
66343
67008
  sphereArc.getPoint = getGreatCirclePoint;
66344
67009
  return sphereArc;
66345
67010
  }
@@ -66357,51 +67022,48 @@
66357
67022
  .range(colors) : colors; // already interpolator fn
66358
67023
 
66359
67024
  getVertexColor = function getVertexColor(t) {
66360
- return color2ShaderArr(colorInterpolator(t));
67025
+ return color2ShaderArr(colorInterpolator(t), true, true);
66361
67026
  };
66362
67027
  } else {
66363
67028
  // single color, use constant
66364
- var vertexColor = color2ShaderArr(colors);
67029
+ var vertexColor = color2ShaderArr(colors, true, true);
66365
67030
  getVertexColor = function getVertexColor() {
66366
67031
  return vertexColor;
66367
67032
  };
66368
67033
  }
66369
- var vertexColorArray = new THREE$c.Float32BufferAttribute(numVerticesGroup * 4 * numVerticesPerSegment, 4);
67034
+ var vertexColors = [];
66370
67035
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66371
67036
  var _vertexColor = getVertexColor(v / (l - 1));
66372
67037
  for (var s = 0; s < numVerticesPerSegment; s++) {
66373
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * 4);
67038
+ vertexColors.push(_vertexColor);
66374
67039
  }
66375
67040
  }
66376
- return vertexColorArray;
67041
+ return array2BufferAttr(vertexColors, 4);
66377
67042
  }
66378
67043
  function calcVertexRelDistances(numSegments) {
66379
67044
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
66380
67045
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66381
67046
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
66382
- var arrLen = numVerticesGroup * numVerticesPerSegment;
66383
- var vertexDistanceArray = new THREE$c.Float32BufferAttribute(arrLen, 1);
67047
+
67048
+ var vertexDistances = [];
66384
67049
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66385
67050
  var relDistance = v / (l - 1);
66386
67051
  for (var s = 0; s < numVerticesPerSegment; s++) {
66387
- var idx = v * numVerticesPerSegment + s;
66388
- var pos = invert ? arrLen - 1 - idx : idx;
66389
- vertexDistanceArray.setX(pos, relDistance);
67052
+ vertexDistances.push(relDistance);
66390
67053
  }
66391
67054
  }
66392
- return vertexDistanceArray;
67055
+ invert && vertexDistances.reverse();
67056
+ return array2BufferAttr(vertexDistances, 1);
66393
67057
  }
66394
67058
  }
66395
67059
  });
66396
67060
 
66397
- 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
66398
67062
  : {
66399
- BufferAttribute: BufferAttribute,
66400
67063
  BufferGeometry: BufferGeometry,
66401
67064
  Color: Color$1,
66402
67065
  DoubleSide: DoubleSide,
66403
67066
  Mesh: Mesh,
66404
- MeshBasicMaterial: MeshBasicMaterial,
66405
67067
  MeshLambertMaterial: MeshLambertMaterial,
66406
67068
  Object3D: Object3D
66407
67069
  };
@@ -66410,8 +67072,6 @@
66410
67072
 
66411
67073
  //
66412
67074
 
66413
- // support multiple method names for backwards threejs compatibility
66414
- var applyMatrix4Fn = new THREE$b.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
66415
67075
  var HexBinLayerKapsule = index$2({
66416
67076
  props: {
66417
67077
  hexBinPointsData: {
@@ -66499,7 +67159,7 @@
66499
67159
  });
66500
67160
  var hexMaterials = {}; // indexed by color
66501
67161
 
66502
- 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
66503
67163
 
66504
67164
  threeDigest(hexBins, scene, {
66505
67165
  createObj: createObj,
@@ -66510,7 +67170,7 @@
66510
67170
  });
66511
67171
  if (state.hexBinMerge) {
66512
67172
  // merge points into a single mesh
66513
- 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) {
66514
67174
  var obj = d.__threeObj;
66515
67175
  d.__threeObj = undefined; // unbind merged points
66516
67176
 
@@ -66519,28 +67179,23 @@
66519
67179
 
66520
67180
  // apply mesh world transform to vertices
66521
67181
  obj.updateMatrix();
66522
- geom[applyMatrix4Fn](obj.matrix);
67182
+ geom.applyMatrix4(obj.matrix);
66523
67183
 
66524
67184
  // color vertices
66525
- var topColor = new THREE$b.Color(topColorAccessor(d));
66526
- var sideColor = new THREE$b.Color(sideColorAccessor(d));
66527
- 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;
66528
67188
  var topFaceIdx = geom.groups[0].count; // starting vertex index of top group
66529
- var colors = new Float32Array(nVertices * 3);
66530
- for (var i = 0, len = nVertices; i < len; i++) {
66531
- var idx = i * 3;
66532
- var c = i >= topFaceIdx ? topColor : sideColor;
66533
- colors[idx] = c.r;
66534
- colors[idx + 1] = c.g;
66535
- colors[idx + 2] = c.b;
66536
- }
66537
- 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));
66538
67192
  return geom;
66539
67193
  }));
66540
- var hexPoints = new THREE$b.Mesh(hexPointsGeometry, new THREE$b.MeshBasicMaterial({
67194
+ var hexPoints = new THREE$c.Mesh(hexPointsGeometry, new THREE$c.MeshLambertMaterial({
66541
67195
  color: 0xffffff,
67196
+ transparent: true,
66542
67197
  vertexColors: true,
66543
- side: THREE$b.DoubleSide
67198
+ side: THREE$c.DoubleSide
66544
67199
  }));
66545
67200
  hexPoints.__globeObjType = 'hexBinPoints'; // Add object type
66546
67201
  hexPoints.__data = hexBins; // Attach obj data
@@ -66552,7 +67207,7 @@
66552
67207
  //
66553
67208
 
66554
67209
  function createObj(d) {
66555
- var obj = new THREE$b.Mesh();
67210
+ var obj = new THREE$c.Mesh();
66556
67211
  obj.__hexCenter = cellToLatLng(d.h3Idx);
66557
67212
  obj.__hexGeoJson = cellToBoundary(d.h3Idx, true).reverse(); // correct polygon winding
66558
67213
 
@@ -66621,11 +67276,11 @@
66621
67276
  [sideColor, topColor].forEach(function (color) {
66622
67277
  if (!hexMaterials.hasOwnProperty(color)) {
66623
67278
  var opacity = colorAlpha(color);
66624
- hexMaterials[color] = new THREE$b.MeshLambertMaterial({
67279
+ hexMaterials[color] = new THREE$c.MeshLambertMaterial({
66625
67280
  color: colorStr2Hex(color),
66626
67281
  transparent: opacity < 1,
66627
67282
  opacity: opacity,
66628
- side: THREE$b.DoubleSide
67283
+ side: THREE$c.DoubleSide
66629
67284
  });
66630
67285
  }
66631
67286
  });
@@ -66637,6 +67292,318 @@
66637
67292
  }
66638
67293
  });
66639
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) return 0;
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.map(Math.abs)) || 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(Math.abs(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
+
66640
67607
  var THREE$a = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66641
67608
  : {
66642
67609
  DoubleSide: DoubleSide,
@@ -66859,9 +67826,11 @@
66859
67826
  var THREE$9 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66860
67827
  : {
66861
67828
  BufferGeometry: BufferGeometry,
67829
+ CircleGeometry: CircleGeometry,
66862
67830
  DoubleSide: DoubleSide,
66863
67831
  Mesh: Mesh,
66864
- MeshLambertMaterial: MeshLambertMaterial
67832
+ MeshLambertMaterial: MeshLambertMaterial,
67833
+ Vector3: Vector3
66865
67834
  };
66866
67835
  var bfg = Object.assign({}, _bfg);
66867
67836
  var BufferGeometryUtils = bfg.BufferGeometryUtils || bfg;
@@ -66893,10 +67862,18 @@
66893
67862
  "default": 0.2
66894
67863
  },
66895
67864
  // in fraction of hex diameter
67865
+ hexPolygonUseDots: {
67866
+ "default": false
67867
+ },
67868
+ // if points should be circular instead of hexagonal
66896
67869
  hexPolygonCurvatureResolution: {
66897
67870
  "default": 5
66898
67871
  },
66899
- // in angular degrees
67872
+ // in angular degrees, only relevant for hex tops
67873
+ hexPolygonDotResolution: {
67874
+ "default": 12
67875
+ },
67876
+ // how many slice segments in the dot circle's circumference
66900
67877
  hexPolygonsTransitionDuration: {
66901
67878
  "default": 0,
66902
67879
  triggerUpdate: false
@@ -66916,7 +67893,9 @@
66916
67893
  var altitudeAccessor = index$1(state.hexPolygonAltitude);
66917
67894
  var resolutionAccessor = index$1(state.hexPolygonResolution);
66918
67895
  var marginAccessor = index$1(state.hexPolygonMargin);
67896
+ var useDotsAccessor = index$1(state.hexPolygonUseDots);
66919
67897
  var curvatureResolutionAccessor = index$1(state.hexPolygonCurvatureResolution);
67898
+ var dotResolutionAccessor = index$1(state.hexPolygonDotResolution);
66920
67899
  threeDigest(state.hexPolygonsData, state.scene, {
66921
67900
  createObj: function createObj(d) {
66922
67901
  var obj = new THREE$9.Mesh(undefined, new THREE$9.MeshLambertMaterial({
@@ -66931,7 +67910,9 @@
66931
67910
  var h3Res = resolutionAccessor(d);
66932
67911
  var alt = altitudeAccessor(d);
66933
67912
  var margin = Math.max(0, Math.min(1, +marginAccessor(d)));
67913
+ var useDots = useDotsAccessor(d);
66934
67914
  var curvatureResolution = curvatureResolutionAccessor(d);
67915
+ var dotResolution = dotResolutionAccessor(d);
66935
67916
 
66936
67917
  // update material
66937
67918
  var color = colorAccessor(d);
@@ -66998,25 +67979,37 @@
66998
67979
  curvatureResolution = _obj$__currentTargetD.curvatureResolution;
66999
67980
  obj.geometry && obj.geometry.dispose();
67000
67981
  obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : (BufferGeometryUtils.mergeGeometries || BufferGeometryUtils.mergeBufferGeometries)(hexBins.map(function (h) {
67001
- // compute new geojson with relative margin
67002
- var relNum = function relNum(st, end, rat) {
67003
- return st - (st - end) * rat;
67004
- };
67005
67982
  var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
67006
67983
  clat = _h$hexCenter[0],
67007
67984
  clng = _h$hexCenter[1];
67008
- var geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref) {
67009
- var _ref2 = _slicedToArray$1(_ref, 2),
67010
- elng = _ref2[0],
67011
- elat = _ref2[1];
67012
- return [[elng, clng], [elat, clat]].map(function (_ref3) {
67013
- var _ref4 = _slicedToArray$1(_ref3, 2),
67014
- st = _ref4[0],
67015
- end = _ref4[1];
67016
- return relNum(st, end, margin);
67985
+ if (useDots) {
67986
+ var centerPos = polar2Cartesian(clat, clng, alt);
67987
+ var edgePos = polar2Cartesian(h.hexGeoJson[0][1], h.hexGeoJson[0][0], alt);
67988
+ var r = 0.85 * (1 - margin) * new THREE$9.Vector3(centerPos.x, centerPos.y, centerPos.z).distanceTo(new THREE$9.Vector3(edgePos.x, edgePos.y, edgePos.z));
67989
+ var geometry = new CircleGeometry(r, dotResolution);
67990
+ geometry.rotateX(deg2Rad$1(-clat));
67991
+ geometry.rotateY(deg2Rad$1(clng));
67992
+ geometry.translate(centerPos.x, centerPos.y, centerPos.z);
67993
+ return geometry;
67994
+ } else {
67995
+ var relNum = function relNum(st, end, rat) {
67996
+ return st - (st - end) * rat;
67997
+ };
67998
+
67999
+ // compute new geojson with relative margin
68000
+ var _geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref) {
68001
+ var _ref2 = _slicedToArray$1(_ref, 2),
68002
+ elng = _ref2[0],
68003
+ elat = _ref2[1];
68004
+ return [[elng, clng], [elat, clat]].map(function (_ref3) {
68005
+ var _ref4 = _slicedToArray$1(_ref3, 2),
68006
+ st = _ref4[0],
68007
+ end = _ref4[1];
68008
+ return relNum(st, end, margin);
68009
+ });
67017
68010
  });
67018
- });
67019
- return new ConicPolygonBufferGeometry([geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
68011
+ return new ConicPolygonBufferGeometry([_geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
68012
+ }
67020
68013
  }));
67021
68014
  };
67022
68015
  if (!state.hexPolygonsTransitionDuration || state.hexPolygonsTransitionDuration < 0) {
@@ -67069,7 +68062,6 @@
67069
68062
  : {
67070
68063
  BufferGeometry: BufferGeometry,
67071
68064
  Color: Color$1,
67072
- Float32BufferAttribute: Float32BufferAttribute,
67073
68065
  Group: Group$1,
67074
68066
  Line: Line,
67075
68067
  NormalBlending: NormalBlending,
@@ -67080,8 +68072,6 @@
67080
68072
 
67081
68073
  //
67082
68074
 
67083
- // support both modes for backwards threejs compatibility
67084
- var setAttributeFn = new THREE$7.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
67085
68075
  var gradientShaders = {
67086
68076
  uniforms: {
67087
68077
  // dash param defaults, all relative to full length
@@ -67162,15 +68152,15 @@
67162
68152
  methods: {
67163
68153
  pauseAnimation: function pauseAnimation(state) {
67164
68154
  var _state$ticker;
67165
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
68155
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
67166
68156
  },
67167
68157
  resumeAnimation: function resumeAnimation(state) {
67168
68158
  var _state$ticker2;
67169
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
68159
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
67170
68160
  },
67171
68161
  _destructor: function _destructor(state) {
67172
68162
  var _state$ticker3;
67173
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
68163
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
67174
68164
  }
67175
68165
  },
67176
68166
  init: function init(threeObj, state) {
@@ -67270,8 +68260,8 @@
67270
68260
  true // run from end to start, to animate in the correct direction
67271
68261
  );
67272
68262
 
67273
- obj.geometry[setAttributeFn]('vertexColor', vertexColorArray);
67274
- obj.geometry[setAttributeFn]('vertexRelDistance', vertexRelDistanceArray);
68263
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
68264
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
67275
68265
  } else {
67276
68266
  // fat lines
67277
68267
  obj.material.resolution = state.rendererSize;
@@ -67436,40 +68426,38 @@
67436
68426
  .range(colors) : colors; // already interpolator fn
67437
68427
 
67438
68428
  getVertexColor = function getVertexColor(t) {
67439
- return color2ShaderArr(colorInterpolator(t), includeAlpha);
68429
+ return color2ShaderArr(colorInterpolator(t), includeAlpha, true);
67440
68430
  };
67441
68431
  } else {
67442
68432
  // single color, use constant
67443
- var vertexColor = color2ShaderArr(colors, includeAlpha);
68433
+ var vertexColor = color2ShaderArr(colors, includeAlpha, true);
67444
68434
  getVertexColor = function getVertexColor() {
67445
68435
  return vertexColor;
67446
68436
  };
67447
68437
  }
67448
- var numArgs = includeAlpha ? 4 : 3;
67449
- var vertexColorArray = new THREE$7.Float32BufferAttribute(numVerticesGroup * numArgs * numVerticesPerSegment, numArgs);
68438
+ var vertexColors = [];
67450
68439
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67451
68440
  var _vertexColor = getVertexColor(v / (l - 1));
67452
68441
  for (var s = 0; s < numVerticesPerSegment; s++) {
67453
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * numArgs);
68442
+ vertexColors.push(_vertexColor);
67454
68443
  }
67455
68444
  }
67456
- return vertexColorArray;
68445
+ return array2BufferAttr(vertexColors, includeAlpha ? 4 : 3);
67457
68446
  }
67458
68447
  function calcVertexRelDistances(numSegments) {
67459
68448
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
67460
68449
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
67461
68450
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
67462
- var arrLen = numVerticesGroup * numVerticesPerSegment;
67463
- var vertexDistanceArray = new THREE$7.Float32BufferAttribute(arrLen, 1);
68451
+
68452
+ var vertexDistances = [];
67464
68453
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67465
68454
  var relDistance = v / (l - 1);
67466
68455
  for (var s = 0; s < numVerticesPerSegment; s++) {
67467
- var idx = v * numVerticesPerSegment + s;
67468
- var pos = invert ? arrLen - 1 - idx : idx;
67469
- vertexDistanceArray.setX(pos, relDistance);
68456
+ vertexDistances.push(relDistance);
67470
68457
  }
67471
68458
  }
67472
- return vertexDistanceArray;
68459
+ invert && vertexDistances.reverse();
68460
+ return array2BufferAttr(vertexDistances, 1);
67473
68461
  }
67474
68462
  }
67475
68463
  });
@@ -67899,15 +68887,15 @@
67899
68887
  methods: {
67900
68888
  pauseAnimation: function pauseAnimation(state) {
67901
68889
  var _state$ticker;
67902
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
68890
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
67903
68891
  },
67904
68892
  resumeAnimation: function resumeAnimation(state) {
67905
68893
  var _state$ticker2;
67906
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
68894
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
67907
68895
  },
67908
68896
  _destructor: function _destructor(state) {
67909
68897
  var _state$ticker3;
67910
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
68898
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
67911
68899
  }
67912
68900
  },
67913
68901
  init: function init(threeObj, state) {
@@ -68254,7 +69242,7 @@
68254
69242
  }
68255
69243
  });
68256
69244
 
68257
- var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
69245
+ var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
68258
69246
  : {
68259
69247
  Group: Group$1,
68260
69248
  Vector2: Vector2,
@@ -68263,7 +69251,7 @@
68263
69251
 
68264
69252
  //
68265
69253
 
68266
- var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
69254
+ var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'heatmapsLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
68267
69255
 
68268
69256
  // Expose config from layers
68269
69257
  var bindGlobeLayer = linkKapsule$1('globeLayer', GlobeLayerKapsule);
@@ -68285,8 +69273,12 @@
68285
69273
  var linkedHexBinLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration'].map(function (p) {
68286
69274
  return _defineProperty$1({}, p, bindHexBinLayer.linkProp(p));
68287
69275
  })));
69276
+ var bindHeatmapsLayer = linkKapsule$1('heatmapsLayer', HeatmapsLayerKapsule);
69277
+ var linkedHeatmapsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration'].map(function (p) {
69278
+ return _defineProperty$1({}, p, bindHeatmapsLayer.linkProp(p));
69279
+ })));
68288
69280
  var bindHexedPolygonsLayer = linkKapsule$1('hexedPolygonsLayer', HexedPolygonsLayerKapsule);
68289
- var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
69281
+ var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
68290
69282
  return _defineProperty$1({}, p, bindHexedPolygonsLayer.linkProp(p));
68291
69283
  })));
68292
69284
  var bindPolygonsLayer = linkKapsule$1('polygonsLayer', PolygonsLayerKapsule);
@@ -68325,18 +69317,18 @@
68325
69317
  //
68326
69318
 
68327
69319
  var Globe = index$2({
68328
- props: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
69320
+ props: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
68329
69321
  onGlobeReady: {
68330
69322
  triggerUpdate: false
68331
69323
  },
68332
69324
  rendererSize: {
68333
- "default": new THREE$g.Vector2(window.innerWidth, window.innerHeight),
69325
+ "default": new THREE$i.Vector2(window.innerWidth, window.innerHeight),
68334
69326
  onChange: function onChange(rendererSize, state) {
68335
69327
  state.pathsLayer.rendererSize(rendererSize);
68336
69328
  },
68337
69329
  triggerUpdate: false
68338
69330
  }
68339
- }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
69331
+ }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedHeatmapsLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
68340
69332
  methods: _objectSpread2({
68341
69333
  getGlobeRadius: getGlobeRadius,
68342
69334
  getCoords: function getCoords(state) {
@@ -68421,6 +69413,7 @@
68421
69413
  pointsLayer: PointsLayerKapsule(),
68422
69414
  arcsLayer: ArcsLayerKapsule(),
68423
69415
  hexBinLayer: HexBinLayerKapsule(),
69416
+ heatmapsLayer: HeatmapsLayerKapsule(),
68424
69417
  polygonsLayer: PolygonsLayerKapsule(),
68425
69418
  hexedPolygonsLayer: HexedPolygonsLayerKapsule(),
68426
69419
  pathsLayer: PathsLayerKapsule(),
@@ -68443,21 +69436,21 @@
68443
69436
  })
68444
69437
  });
68445
69438
  },
68446
- init: function init(threeObj, state, _ref15) {
68447
- var _ref15$animateIn = _ref15.animateIn,
68448
- animateIn = _ref15$animateIn === void 0 ? true : _ref15$animateIn,
68449
- _ref15$waitForGlobeRe = _ref15.waitForGlobeReady,
68450
- waitForGlobeReady = _ref15$waitForGlobeRe === void 0 ? true : _ref15$waitForGlobeRe;
69439
+ init: function init(threeObj, state, _ref16) {
69440
+ var _ref16$animateIn = _ref16.animateIn,
69441
+ animateIn = _ref16$animateIn === void 0 ? true : _ref16$animateIn,
69442
+ _ref16$waitForGlobeRe = _ref16.waitForGlobeReady,
69443
+ waitForGlobeReady = _ref16$waitForGlobeRe === void 0 ? true : _ref16$waitForGlobeRe;
68451
69444
  // Clear the scene
68452
69445
  emptyObject(threeObj);
68453
69446
 
68454
69447
  // Main three object to manipulate
68455
- threeObj.add(state.scene = new THREE$g.Group());
69448
+ threeObj.add(state.scene = new THREE$i.Group());
68456
69449
  state.scene.visible = false; // hide scene before globe initialization
68457
69450
 
68458
69451
  // Add all layers groups
68459
69452
  layers.forEach(function (layer) {
68460
- var g = new THREE$g.Group();
69453
+ var g = new THREE$i.Group();
68461
69454
  state.scene.add(g);
68462
69455
  state[layer](g);
68463
69456
  });
@@ -68469,17 +69462,17 @@
68469
69462
  k: 1e-6
68470
69463
  }).to({
68471
69464
  k: 1
68472
- }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref16) {
68473
- var k = _ref16.k;
69465
+ }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref17) {
69466
+ var k = _ref17.k;
68474
69467
  return state.scene.scale.set(k, k, k);
68475
69468
  }).start();
68476
- var rotAxis = new THREE$g.Vector3(0, 1, 0);
69469
+ var rotAxis = new THREE$i.Vector3(0, 1, 0);
68477
69470
  new Tween({
68478
69471
  rot: Math.PI * 2
68479
69472
  }).to({
68480
69473
  rot: 0
68481
- }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref17) {
68482
- var rot = _ref17.rot;
69474
+ }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref18) {
69475
+ var rot = _ref18.rot;
68483
69476
  return state.scene.setRotationFromAxisAngle(rotAxis, rot);
68484
69477
  }).start();
68485
69478
  }
@@ -71667,7 +72660,11 @@
71667
72660
  }
71668
72661
 
71669
72662
  function _isNativeFunction(fn) {
71670
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
72663
+ try {
72664
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
72665
+ } catch (e) {
72666
+ return typeof fn === "function";
72667
+ }
71671
72668
  }
71672
72669
 
71673
72670
  function _isNativeReflectConstruct() {
@@ -73065,7 +74062,7 @@
73065
74062
 
73066
74063
  // Expose config from ThreeGlobe
73067
74064
  var bindGlobe = linkKapsule('globe', threeGlobe);
73068
- 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', '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) {
74065
+ 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', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', '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) {
73069
74066
  return _defineProperty$3({}, p, bindGlobe.linkProp(p));
73070
74067
  })));
73071
74068
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray$5(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
@@ -73146,6 +74143,15 @@
73146
74143
  onPathHover: {
73147
74144
  triggerUpdate: false
73148
74145
  },
74146
+ onHeatmapClick: {
74147
+ triggerUpdate: false
74148
+ },
74149
+ onHeatmapRightClick: {
74150
+ triggerUpdate: false
74151
+ },
74152
+ onHeatmapHover: {
74153
+ triggerUpdate: false
74154
+ },
73149
74155
  hexLabel: {
73150
74156
  triggerUpdate: false
73151
74157
  },
@@ -73347,6 +74353,7 @@
73347
74353
  this.arcsData([]);
73348
74354
  this.polygonsData([]);
73349
74355
  this.pathsData([]);
74356
+ this.heatmapsData([]);
73350
74357
  this.hexBinPointsData([]);
73351
74358
  this.hexPolygonsData([]);
73352
74359
  this.tilesData([]);
@@ -73439,6 +74446,9 @@
73439
74446
  path: function path(d) {
73440
74447
  return d;
73441
74448
  },
74449
+ heatmap: function heatmap(d) {
74450
+ return d;
74451
+ },
73442
74452
  hexbin: function hexbin(d) {
73443
74453
  return d;
73444
74454
  },
@@ -73493,6 +74503,7 @@
73493
74503
  arc: state.onArcHover,
73494
74504
  polygon: state.onPolygonHover,
73495
74505
  path: state.onPathHover,
74506
+ heatmap: state.onHeatmapHover,
73496
74507
  hexbin: state.onHexHover,
73497
74508
  hexPolygon: state.onHexPolygonHover,
73498
74509
  tile: state.onTileHover,
@@ -73506,6 +74517,7 @@
73506
74517
  arc: state.onArcClick,
73507
74518
  polygon: state.onPolygonClick,
73508
74519
  path: state.onPathClick,
74520
+ heatmap: state.onHeatmapClick,
73509
74521
  hexbin: state.onHexClick,
73510
74522
  hexPolygon: state.onHexPolygonClick,
73511
74523
  tile: state.onTileClick,
@@ -73545,6 +74557,7 @@
73545
74557
  arc: state.onArcClick,
73546
74558
  polygon: state.onPolygonClick,
73547
74559
  path: state.onPathClick,
74560
+ heatmap: state.onHeatmapClick,
73548
74561
  hexbin: state.onHexClick,
73549
74562
  hexPolygon: state.onHexPolygonClick,
73550
74563
  tile: state.onTileClick,
@@ -73582,6 +74595,7 @@
73582
74595
  arc: state.onArcRightClick,
73583
74596
  polygon: state.onPolygonRightClick,
73584
74597
  path: state.onPathRightClick,
74598
+ heatmap: state.onHeatmapRightClick,
73585
74599
  hexbin: state.onHexRightClick,
73586
74600
  hexPolygon: state.onHexPolygonRightClick,
73587
74601
  tile: state.onTileRightClick,