react-globe.gl 2.24.3 → 2.25.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.
@@ -1,4 +1,4 @@
1
- // Version 2.24.3 react-globe.gl - https://github.com/vasturiano/react-globe.gl
1
+ // Version 2.25.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['react'], factory) :
@@ -314,7 +314,7 @@
314
314
  * Copyright 2010-2023 Three.js Authors
315
315
  * SPDX-License-Identifier: MIT
316
316
  */
317
- const REVISION = '155';
317
+ const REVISION = '157';
318
318
 
319
319
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
320
320
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -431,6 +431,8 @@
431
431
  const RGBA_ASTC_12x10_Format = 37820;
432
432
  const RGBA_ASTC_12x12_Format = 37821;
433
433
  const RGBA_BPTC_Format = 36492;
434
+ const RGB_BPTC_SIGNED_Format = 36494;
435
+ const RGB_BPTC_UNSIGNED_Format = 36495;
434
436
  const RED_RGTC1_Format = 36283;
435
437
  const SIGNED_RED_RGTC1_Format = 36284;
436
438
  const RED_GREEN_RGTC2_Format = 36285;
@@ -452,6 +454,13 @@
452
454
  const SRGBColorSpace = 'srgb';
453
455
  const LinearSRGBColorSpace = 'srgb-linear';
454
456
  const DisplayP3ColorSpace = 'display-p3';
457
+ const LinearDisplayP3ColorSpace = 'display-p3-linear';
458
+
459
+ const LinearTransfer = 'linear';
460
+ const SRGBTransfer = 'srgb';
461
+
462
+ const Rec709Primaries = 'rec709';
463
+ const P3Primaries = 'p3';
455
464
  const KeepStencilOp = 7680;
456
465
  const AlwaysStencilFunc = 519;
457
466
 
@@ -1186,8 +1195,8 @@
1186
1195
 
1187
1196
  roundToZero() {
1188
1197
 
1189
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
1190
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
1198
+ this.x = Math.trunc( this.x );
1199
+ this.y = Math.trunc( this.y );
1191
1200
 
1192
1201
  return this;
1193
1202
 
@@ -1777,6 +1786,14 @@
1777
1786
 
1778
1787
  }
1779
1788
 
1789
+ function createCanvasElement() {
1790
+
1791
+ const canvas = createElementNS( 'canvas' );
1792
+ canvas.style.display = 'block';
1793
+ return canvas;
1794
+
1795
+ }
1796
+
1780
1797
  const _cache = {};
1781
1798
 
1782
1799
  function warnOnce( message ) {
@@ -1789,18 +1806,6 @@
1789
1806
 
1790
1807
  }
1791
1808
 
1792
- function SRGBToLinear( c ) {
1793
-
1794
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1795
-
1796
- }
1797
-
1798
- function LinearToSRGB( c ) {
1799
-
1800
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1801
-
1802
- }
1803
-
1804
1809
  /**
1805
1810
  * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
1806
1811
  * or clipping. Based on W3C specifications for sRGB and Display P3,
@@ -1813,50 +1818,57 @@
1813
1818
  * - http://www.russellcottrell.com/photo/matrixCalculator.htm
1814
1819
  */
1815
1820
 
1816
- const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [
1817
- 0.8224621, 0.0331941, 0.0170827,
1818
- 0.1775380, 0.9668058, 0.0723974,
1819
- - 0.0000001, 0.0000001, 0.9105199
1820
- ] );
1821
-
1822
- const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
1823
- 1.2249401, - 0.0420569, - 0.0196376,
1824
- - 0.2249404, 1.0420571, - 0.0786361,
1825
- 0.0000001, 0.0000000, 1.0982735
1826
- ] );
1827
-
1828
- function DisplayP3ToLinearSRGB( color ) {
1829
-
1830
- // Display P3 uses the sRGB transfer functions
1831
- return color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );
1832
-
1833
- }
1834
-
1835
- function LinearSRGBToDisplayP3( color ) {
1836
-
1837
- // Display P3 uses the sRGB transfer functions
1838
- return color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB();
1821
+ const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(
1822
+ 0.8224621, 0.177538, 0.0,
1823
+ 0.0331941, 0.9668058, 0.0,
1824
+ 0.0170827, 0.0723974, 0.9105199,
1825
+ );
1839
1826
 
1840
- }
1827
+ const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(
1828
+ 1.2249401, - 0.2249404, 0.0,
1829
+ - 0.0420569, 1.0420571, 0.0,
1830
+ - 0.0196376, - 0.0786361, 1.0982735
1831
+ );
1841
1832
 
1842
- // Conversions from <source> to Linear-sRGB reference space.
1843
- const TO_LINEAR = {
1844
- [ LinearSRGBColorSpace ]: ( color ) => color,
1845
- [ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),
1846
- [ DisplayP3ColorSpace ]: DisplayP3ToLinearSRGB,
1833
+ /**
1834
+ * Defines supported color spaces by transfer function and primaries,
1835
+ * and provides conversions to/from the Linear-sRGB reference space.
1836
+ */
1837
+ const COLOR_SPACES = {
1838
+ [ LinearSRGBColorSpace ]: {
1839
+ transfer: LinearTransfer,
1840
+ primaries: Rec709Primaries,
1841
+ toReference: ( color ) => color,
1842
+ fromReference: ( color ) => color,
1843
+ },
1844
+ [ SRGBColorSpace ]: {
1845
+ transfer: SRGBTransfer,
1846
+ primaries: Rec709Primaries,
1847
+ toReference: ( color ) => color.convertSRGBToLinear(),
1848
+ fromReference: ( color ) => color.convertLinearToSRGB(),
1849
+ },
1850
+ [ LinearDisplayP3ColorSpace ]: {
1851
+ transfer: LinearTransfer,
1852
+ primaries: P3Primaries,
1853
+ toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1854
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
1855
+ },
1856
+ [ DisplayP3ColorSpace ]: {
1857
+ transfer: SRGBTransfer,
1858
+ primaries: P3Primaries,
1859
+ toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1860
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
1861
+ },
1847
1862
  };
1848
1863
 
1849
- // Conversions to <target> from Linear-sRGB reference space.
1850
- const FROM_LINEAR = {
1851
- [ LinearSRGBColorSpace ]: ( color ) => color,
1852
- [ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
1853
- [ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
1854
- };
1864
+ const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
1855
1865
 
1856
1866
  const ColorManagement = {
1857
1867
 
1858
1868
  enabled: true,
1859
1869
 
1870
+ _workingColorSpace: LinearSRGBColorSpace,
1871
+
1860
1872
  get legacyMode() {
1861
1873
 
1862
1874
  console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
@@ -1875,13 +1887,19 @@
1875
1887
 
1876
1888
  get workingColorSpace() {
1877
1889
 
1878
- return LinearSRGBColorSpace;
1890
+ return this._workingColorSpace;
1879
1891
 
1880
1892
  },
1881
1893
 
1882
1894
  set workingColorSpace( colorSpace ) {
1883
1895
 
1884
- console.warn( 'THREE.ColorManagement: .workingColorSpace is readonly.' );
1896
+ if ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {
1897
+
1898
+ throw new Error( `Unsupported working color space, "${ colorSpace }".` );
1899
+
1900
+ }
1901
+
1902
+ this._workingColorSpace = colorSpace;
1885
1903
 
1886
1904
  },
1887
1905
 
@@ -1893,33 +1911,54 @@
1893
1911
 
1894
1912
  }
1895
1913
 
1896
- const sourceToLinear = TO_LINEAR[ sourceColorSpace ];
1897
- const targetFromLinear = FROM_LINEAR[ targetColorSpace ];
1914
+ const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
1915
+ const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
1898
1916
 
1899
- if ( sourceToLinear === undefined || targetFromLinear === undefined ) {
1917
+ return targetFromReference( sourceToReference( color ) );
1900
1918
 
1901
- throw new Error( `Unsupported color space conversion, "${ sourceColorSpace }" to "${ targetColorSpace }".` );
1919
+ },
1902
1920
 
1903
- }
1921
+ fromWorkingColorSpace: function ( color, targetColorSpace ) {
1904
1922
 
1905
- return targetFromLinear( sourceToLinear( color ) );
1923
+ return this.convert( color, this._workingColorSpace, targetColorSpace );
1906
1924
 
1907
1925
  },
1908
1926
 
1909
- fromWorkingColorSpace: function ( color, targetColorSpace ) {
1927
+ toWorkingColorSpace: function ( color, sourceColorSpace ) {
1910
1928
 
1911
- return this.convert( color, this.workingColorSpace, targetColorSpace );
1929
+ return this.convert( color, sourceColorSpace, this._workingColorSpace );
1912
1930
 
1913
1931
  },
1914
1932
 
1915
- toWorkingColorSpace: function ( color, sourceColorSpace ) {
1933
+ getPrimaries: function ( colorSpace ) {
1934
+
1935
+ return COLOR_SPACES[ colorSpace ].primaries;
1936
+
1937
+ },
1916
1938
 
1917
- return this.convert( color, sourceColorSpace, this.workingColorSpace );
1939
+ getTransfer: function ( colorSpace ) {
1940
+
1941
+ if ( colorSpace === NoColorSpace ) return LinearTransfer;
1942
+
1943
+ return COLOR_SPACES[ colorSpace ].transfer;
1918
1944
 
1919
1945
  },
1920
1946
 
1921
1947
  };
1922
1948
 
1949
+
1950
+ function SRGBToLinear( c ) {
1951
+
1952
+ return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1953
+
1954
+ }
1955
+
1956
+ function LinearToSRGB( c ) {
1957
+
1958
+ return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1959
+
1960
+ }
1961
+
1923
1962
  let _canvas;
1924
1963
 
1925
1964
  class ImageUtils {
@@ -2045,7 +2084,7 @@
2045
2084
 
2046
2085
  }
2047
2086
 
2048
- let sourceId = 0;
2087
+ let _sourceId = 0;
2049
2088
 
2050
2089
  class Source {
2051
2090
 
@@ -2053,7 +2092,7 @@
2053
2092
 
2054
2093
  this.isSource = true;
2055
2094
 
2056
- Object.defineProperty( this, 'id', { value: sourceId ++ } );
2095
+ Object.defineProperty( this, 'id', { value: _sourceId ++ } );
2057
2096
 
2058
2097
  this.uuid = generateUUID();
2059
2098
 
@@ -2168,7 +2207,7 @@
2168
2207
 
2169
2208
  }
2170
2209
 
2171
- let textureId = 0;
2210
+ let _textureId = 0;
2172
2211
 
2173
2212
  class Texture extends EventDispatcher {
2174
2213
 
@@ -2178,7 +2217,7 @@
2178
2217
 
2179
2218
  this.isTexture = true;
2180
2219
 
2181
- Object.defineProperty( this, 'id', { value: textureId ++ } );
2220
+ Object.defineProperty( this, 'id', { value: _textureId ++ } );
2182
2221
 
2183
2222
  this.uuid = generateUUID();
2184
2223
 
@@ -2988,10 +3027,10 @@
2988
3027
 
2989
3028
  roundToZero() {
2990
3029
 
2991
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
2992
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
2993
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
2994
- this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
3030
+ this.x = Math.trunc( this.x );
3031
+ this.y = Math.trunc( this.y );
3032
+ this.z = Math.trunc( this.z );
3033
+ this.w = Math.trunc( this.w );
2995
3034
 
2996
3035
  return this;
2997
3036
 
@@ -3159,20 +3198,29 @@
3159
3198
 
3160
3199
  }
3161
3200
 
3201
+ options = Object.assign( {
3202
+ generateMipmaps: false,
3203
+ internalFormat: null,
3204
+ minFilter: LinearFilter,
3205
+ depthBuffer: true,
3206
+ stencilBuffer: false,
3207
+ depthTexture: null,
3208
+ samples: 0
3209
+ }, options );
3210
+
3162
3211
  this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
3163
3212
  this.texture.isRenderTargetTexture = true;
3164
3213
 
3165
3214
  this.texture.flipY = false;
3166
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
3167
- this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
3168
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
3215
+ this.texture.generateMipmaps = options.generateMipmaps;
3216
+ this.texture.internalFormat = options.internalFormat;
3169
3217
 
3170
- this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
3171
- this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
3218
+ this.depthBuffer = options.depthBuffer;
3219
+ this.stencilBuffer = options.stencilBuffer;
3172
3220
 
3173
- this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
3221
+ this.depthTexture = options.depthTexture;
3174
3222
 
3175
- this.samples = options.samples !== undefined ? options.samples : 0;
3223
+ this.samples = options.samples;
3176
3224
 
3177
3225
  }
3178
3226
 
@@ -4384,9 +4432,9 @@
4384
4432
 
4385
4433
  roundToZero() {
4386
4434
 
4387
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
4388
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
4389
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
4435
+ this.x = Math.trunc( this.x );
4436
+ this.y = Math.trunc( this.y );
4437
+ this.z = Math.trunc( this.z );
4390
4438
 
4391
4439
  return this;
4392
4440
 
@@ -5133,16 +5181,16 @@
5133
5181
  if ( this.isEmpty() ) return this;
5134
5182
 
5135
5183
  // NOTE: I am using a binary pattern to specify all 2^3 combinations below
5136
- _points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
5137
- _points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
5138
- _points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
5139
- _points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
5140
- _points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
5141
- _points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
5142
- _points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
5143
- _points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
5184
+ _points$1[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
5185
+ _points$1[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
5186
+ _points$1[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
5187
+ _points$1[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
5188
+ _points$1[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
5189
+ _points$1[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
5190
+ _points$1[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
5191
+ _points$1[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
5144
5192
 
5145
- this.setFromPoints( _points );
5193
+ this.setFromPoints( _points$1 );
5146
5194
 
5147
5195
  return this;
5148
5196
 
@@ -5165,7 +5213,7 @@
5165
5213
 
5166
5214
  }
5167
5215
 
5168
- const _points = [
5216
+ const _points$1 = [
5169
5217
  /*@__PURE__*/ new Vector3(),
5170
5218
  /*@__PURE__*/ new Vector3(),
5171
5219
  /*@__PURE__*/ new Vector3(),
@@ -7616,20 +7664,7 @@
7616
7664
 
7617
7665
  clear() {
7618
7666
 
7619
- for ( let i = 0; i < this.children.length; i ++ ) {
7620
-
7621
- const object = this.children[ i ];
7622
-
7623
- object.parent = null;
7624
-
7625
- object.dispatchEvent( _removedEvent );
7626
-
7627
- }
7628
-
7629
- this.children.length = 0;
7630
-
7631
- return this;
7632
-
7667
+ return this.remove( ... this.children );
7633
7668
 
7634
7669
  }
7635
7670
 
@@ -8520,7 +8555,7 @@
8520
8555
 
8521
8556
  }
8522
8557
 
8523
- let materialId = 0;
8558
+ let _materialId = 0;
8524
8559
 
8525
8560
  class Material extends EventDispatcher {
8526
8561
 
@@ -8530,7 +8565,7 @@
8530
8565
 
8531
8566
  this.isMaterial = true;
8532
8567
 
8533
- Object.defineProperty( this, 'id', { value: materialId ++ } );
8568
+ Object.defineProperty( this, 'id', { value: _materialId ++ } );
8534
8569
 
8535
8570
  this.uuid = generateUUID();
8536
8571
 
@@ -8838,10 +8873,10 @@
8838
8873
 
8839
8874
  if ( this.blending !== NormalBlending ) data.blending = this.blending;
8840
8875
  if ( this.side !== FrontSide ) data.side = this.side;
8841
- if ( this.vertexColors ) data.vertexColors = true;
8876
+ if ( this.vertexColors === true ) data.vertexColors = true;
8842
8877
 
8843
8878
  if ( this.opacity < 1 ) data.opacity = this.opacity;
8844
- if ( this.transparent === true ) data.transparent = this.transparent;
8879
+ if ( this.transparent === true ) data.transparent = true;
8845
8880
 
8846
8881
  data.depthFunc = this.depthFunc;
8847
8882
  data.depthTest = this.depthTest;
@@ -8872,17 +8907,17 @@
8872
8907
  if ( this.dithering === true ) data.dithering = true;
8873
8908
 
8874
8909
  if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
8875
- if ( this.alphaHash === true ) data.alphaHash = this.alphaHash;
8876
- if ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;
8877
- if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
8878
- if ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;
8910
+ if ( this.alphaHash === true ) data.alphaHash = true;
8911
+ if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
8912
+ if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
8913
+ if ( this.forceSinglePass === true ) data.forceSinglePass = true;
8879
8914
 
8880
- if ( this.wireframe === true ) data.wireframe = this.wireframe;
8915
+ if ( this.wireframe === true ) data.wireframe = true;
8881
8916
  if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
8882
8917
  if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
8883
8918
  if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
8884
8919
 
8885
- if ( this.flatShading === true ) data.flatShading = this.flatShading;
8920
+ if ( this.flatShading === true ) data.flatShading = true;
8886
8921
 
8887
8922
  if ( this.visible === false ) data.visible = false;
8888
8923
 
@@ -9463,11 +9498,7 @@
9463
9498
 
9464
9499
  this.getHSL( _hslA );
9465
9500
 
9466
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
9467
-
9468
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
9469
-
9470
- return this;
9501
+ return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
9471
9502
 
9472
9503
  }
9473
9504
 
@@ -10116,7 +10147,7 @@
10116
10147
 
10117
10148
  }
10118
10149
 
10119
- let _id$1 = 0;
10150
+ let _id$2 = 0;
10120
10151
 
10121
10152
  const _m1 = /*@__PURE__*/ new Matrix4();
10122
10153
  const _obj = /*@__PURE__*/ new Object3D();
@@ -10133,7 +10164,7 @@
10133
10164
 
10134
10165
  this.isBufferGeometry = true;
10135
10166
 
10136
- Object.defineProperty( this, 'id', { value: _id$1 ++ } );
10167
+ Object.defineProperty( this, 'id', { value: _id$2 ++ } );
10137
10168
 
10138
10169
  this.uuid = generateUUID();
10139
10170
 
@@ -11238,7 +11269,7 @@
11238
11269
 
11239
11270
  }
11240
11271
 
11241
- this.material = source.material;
11272
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
11242
11273
  this.geometry = source.geometry;
11243
11274
 
11244
11275
  return this;
@@ -11867,7 +11898,7 @@
11867
11898
 
11868
11899
  }
11869
11900
 
11870
- return LinearSRGBColorSpace;
11901
+ return ColorManagement.workingColorSpace;
11871
11902
 
11872
11903
  }
11873
11904
 
@@ -12095,11 +12126,7 @@
12095
12126
 
12096
12127
  getWorldDirection( target ) {
12097
12128
 
12098
- this.updateWorldMatrix( true, false );
12099
-
12100
- const e = this.matrixWorld.elements;
12101
-
12102
- return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
12129
+ return super.getWorldDirection( target ).negate();
12103
12130
 
12104
12131
  }
12105
12132
 
@@ -12369,6 +12396,7 @@
12369
12396
 
12370
12397
  this.renderTarget = renderTarget;
12371
12398
  this.coordinateSystem = null;
12399
+ this.activeMipmapLevel = 0;
12372
12400
 
12373
12401
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
12374
12402
  cameraPX.layers = this.layers;
@@ -12466,7 +12494,7 @@
12466
12494
 
12467
12495
  if ( this.parent === null ) this.updateMatrixWorld();
12468
12496
 
12469
- const renderTarget = this.renderTarget;
12497
+ const { renderTarget, activeMipmapLevel } = this;
12470
12498
 
12471
12499
  if ( this.coordinateSystem !== renderer.coordinateSystem ) {
12472
12500
 
@@ -12479,6 +12507,8 @@
12479
12507
  const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
12480
12508
 
12481
12509
  const currentRenderTarget = renderer.getRenderTarget();
12510
+ const currentActiveCubeFace = renderer.getActiveCubeFace();
12511
+ const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();
12482
12512
 
12483
12513
  const currentXrEnabled = renderer.xr.enabled;
12484
12514
 
@@ -12488,27 +12518,30 @@
12488
12518
 
12489
12519
  renderTarget.texture.generateMipmaps = false;
12490
12520
 
12491
- renderer.setRenderTarget( renderTarget, 0 );
12521
+ renderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );
12492
12522
  renderer.render( scene, cameraPX );
12493
12523
 
12494
- renderer.setRenderTarget( renderTarget, 1 );
12524
+ renderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );
12495
12525
  renderer.render( scene, cameraNX );
12496
12526
 
12497
- renderer.setRenderTarget( renderTarget, 2 );
12527
+ renderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );
12498
12528
  renderer.render( scene, cameraPY );
12499
12529
 
12500
- renderer.setRenderTarget( renderTarget, 3 );
12530
+ renderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );
12501
12531
  renderer.render( scene, cameraNY );
12502
12532
 
12503
- renderer.setRenderTarget( renderTarget, 4 );
12533
+ renderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );
12504
12534
  renderer.render( scene, cameraPZ );
12505
12535
 
12536
+ // mipmaps are generated during the last call of render()
12537
+ // at this point, all sides of the cube render target are defined
12538
+
12506
12539
  renderTarget.texture.generateMipmaps = generateMipmaps;
12507
12540
 
12508
- renderer.setRenderTarget( renderTarget, 5 );
12541
+ renderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );
12509
12542
  renderer.render( scene, cameraNZ );
12510
12543
 
12511
- renderer.setRenderTarget( currentRenderTarget );
12544
+ renderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
12512
12545
 
12513
12546
  renderer.xr.enabled = currentXrEnabled;
12514
12547
 
@@ -13422,7 +13455,7 @@
13422
13455
 
13423
13456
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13424
13457
 
13425
- 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";
13458
+ 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";
13426
13459
 
13427
13460
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13428
13461
 
@@ -13452,7 +13485,7 @@
13452
13485
 
13453
13486
  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";
13454
13487
 
13455
- 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";
13488
+ 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";
13456
13489
 
13457
13490
  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";
13458
13491
 
@@ -13468,7 +13501,7 @@
13468
13501
 
13469
13502
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13470
13503
 
13471
- 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}";
13504
+ 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}";
13472
13505
 
13473
13506
  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";
13474
13507
 
@@ -13496,29 +13529,29 @@
13496
13529
 
13497
13530
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
13498
13531
 
13499
- 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";
13532
+ 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";
13500
13533
 
13501
- 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";
13534
+ 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";
13502
13535
 
13503
13536
  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";
13504
13537
 
13505
13538
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13506
13539
 
13507
- 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";
13540
+ 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";
13508
13541
 
13509
13542
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
13510
13543
 
13511
- 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";
13544
+ 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";
13512
13545
 
13513
- 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";
13546
+ 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";
13514
13547
 
13515
- 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}";
13548
+ 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}";
13516
13549
 
13517
- 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";
13550
+ 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";
13518
13551
 
13519
- 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";
13552
+ 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";
13520
13553
 
13521
- 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";
13554
+ 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";
13522
13555
 
13523
13556
  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";
13524
13557
 
@@ -13528,7 +13561,7 @@
13528
13561
 
13529
13562
  var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13530
13563
 
13531
- var map_fragment = "#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif";
13564
+ var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13532
13565
 
13533
13566
  var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
13534
13567
 
@@ -13548,7 +13581,7 @@
13548
13581
 
13549
13582
  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";
13550
13583
 
13551
- 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;";
13584
+ 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;";
13552
13585
 
13553
13586
  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";
13554
13587
 
@@ -13560,7 +13593,7 @@
13560
13593
 
13561
13594
  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";
13562
13595
 
13563
- var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
13596
+ var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";
13564
13597
 
13565
13598
  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";
13566
13599
 
@@ -13622,7 +13655,7 @@
13622
13655
 
13623
13656
  const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
13624
13657
 
13625
- const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13658
+ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13626
13659
 
13627
13660
  const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
13628
13661
 
@@ -13670,7 +13703,7 @@
13670
13703
 
13671
13704
  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}";
13672
13705
 
13673
- 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}";
13706
+ 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}";
13674
13707
 
13675
13708
  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}";
13676
13709
 
@@ -14442,24 +14475,15 @@
14442
14475
 
14443
14476
  }
14444
14477
 
14445
- const xr = renderer.xr;
14446
- const environmentBlendMode = xr.getEnvironmentBlendMode();
14478
+ const environmentBlendMode = renderer.xr.getEnvironmentBlendMode();
14447
14479
 
14448
- switch ( environmentBlendMode ) {
14480
+ if ( environmentBlendMode === 'additive' ) {
14449
14481
 
14450
- case 'opaque':
14451
- forceClear = true;
14452
- break;
14482
+ state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14453
14483
 
14454
- case 'additive':
14455
- state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14456
- forceClear = true;
14457
- break;
14484
+ } else if ( environmentBlendMode === 'alpha-blend' ) {
14458
14485
 
14459
- case 'alpha-blend':
14460
- state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14461
- forceClear = true;
14462
- break;
14486
+ state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14463
14487
 
14464
14488
  }
14465
14489
 
@@ -14515,7 +14539,7 @@
14515
14539
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14516
14540
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14517
14541
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14518
- boxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14542
+ boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14519
14543
 
14520
14544
  if ( currentBackground !== background ||
14521
14545
  currentBackgroundVersion !== background.version ||
@@ -14571,7 +14595,7 @@
14571
14595
 
14572
14596
  planeMesh.material.uniforms.t2D.value = background;
14573
14597
  planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14574
- planeMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14598
+ planeMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14575
14599
 
14576
14600
  if ( background.matrixAutoUpdate === true ) {
14577
14601
 
@@ -18835,15 +18859,38 @@
18835
18859
 
18836
18860
  function getEncodingComponents( colorSpace ) {
18837
18861
 
18862
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
18863
+ const encodingPrimaries = ColorManagement.getPrimaries( colorSpace );
18864
+
18865
+ let gamutMapping;
18866
+
18867
+ if ( workingPrimaries === encodingPrimaries ) {
18868
+
18869
+ gamutMapping = '';
18870
+
18871
+ } else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {
18872
+
18873
+ gamutMapping = 'LinearDisplayP3ToLinearSRGB';
18874
+
18875
+ } else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {
18876
+
18877
+ gamutMapping = 'LinearSRGBToLinearDisplayP3';
18878
+
18879
+ }
18880
+
18838
18881
  switch ( colorSpace ) {
18839
18882
 
18840
18883
  case LinearSRGBColorSpace:
18841
- return [ 'Linear', '( value )' ];
18884
+ case LinearDisplayP3ColorSpace:
18885
+ return [ gamutMapping, 'LinearTransferOETF' ];
18886
+
18842
18887
  case SRGBColorSpace:
18843
- return [ 'sRGB', '( value )' ];
18888
+ case DisplayP3ColorSpace:
18889
+ return [ gamutMapping, 'sRGBTransferOETF' ];
18890
+
18844
18891
  default:
18845
18892
  console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
18846
- return [ 'Linear', '( value )' ];
18893
+ return [ gamutMapping, 'LinearTransferOETF' ];
18847
18894
 
18848
18895
  }
18849
18896
 
@@ -18876,7 +18923,7 @@
18876
18923
  function getTexelEncodingFunction( functionName, colorSpace ) {
18877
18924
 
18878
18925
  const components = getEncodingComponents( colorSpace );
18879
- return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';
18926
+ return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;
18880
18927
 
18881
18928
  }
18882
18929
 
@@ -19303,6 +19350,7 @@
19303
19350
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
19304
19351
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
19305
19352
 
19353
+ parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
19306
19354
  parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19307
19355
 
19308
19356
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
@@ -19390,6 +19438,8 @@
19390
19438
 
19391
19439
  parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
19392
19440
 
19441
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19442
+
19393
19443
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19394
19444
 
19395
19445
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
@@ -19572,8 +19622,12 @@
19572
19622
 
19573
19623
  parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',
19574
19624
 
19625
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19626
+
19575
19627
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19576
19628
 
19629
+ parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
19630
+
19577
19631
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
19578
19632
  ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
19579
19633
 
@@ -19808,7 +19862,7 @@
19808
19862
 
19809
19863
  }
19810
19864
 
19811
- let _id = 0;
19865
+ let _id$1 = 0;
19812
19866
 
19813
19867
  class WebGLShaderCache {
19814
19868
 
@@ -19922,7 +19976,7 @@
19922
19976
 
19923
19977
  constructor( code ) {
19924
19978
 
19925
- this.id = _id ++;
19979
+ this.id = _id$1 ++;
19926
19980
 
19927
19981
  this.code = code;
19928
19982
  this.usedTimes = 0;
@@ -20250,6 +20304,8 @@
20250
20304
  numSpotLightShadows: lights.spotShadowMap.length,
20251
20305
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
20252
20306
 
20307
+ numLightProbes: lights.numLightProbes,
20308
+
20253
20309
  numClippingPlanes: clipping.numPlanes,
20254
20310
  numClipIntersection: clipping.numIntersection,
20255
20311
 
@@ -20261,6 +20317,8 @@
20261
20317
  toneMapping: toneMapping,
20262
20318
  useLegacyLights: renderer._useLegacyLights,
20263
20319
 
20320
+ decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
20321
+
20264
20322
  premultipliedAlpha: material.premultipliedAlpha,
20265
20323
 
20266
20324
  doubleSided: material.side === DoubleSide,
@@ -20372,6 +20430,7 @@
20372
20430
  array.push( parameters.numPointLightShadows );
20373
20431
  array.push( parameters.numSpotLightShadows );
20374
20432
  array.push( parameters.numSpotLightShadowsWithMaps );
20433
+ array.push( parameters.numLightProbes );
20375
20434
  array.push( parameters.shadowMapType );
20376
20435
  array.push( parameters.toneMapping );
20377
20436
  array.push( parameters.numClippingPlanes );
@@ -20462,6 +20521,8 @@
20462
20521
  _programLayers.enable( 17 );
20463
20522
  if ( parameters.pointsUvs )
20464
20523
  _programLayers.enable( 18 );
20524
+ if ( parameters.decodeVideoTexture )
20525
+ _programLayers.enable( 19 );
20465
20526
 
20466
20527
  array.push( _programLayers.mask );
20467
20528
 
@@ -21008,7 +21069,9 @@
21008
21069
  numDirectionalShadows: - 1,
21009
21070
  numPointShadows: - 1,
21010
21071
  numSpotShadows: - 1,
21011
- numSpotMaps: - 1
21072
+ numSpotMaps: - 1,
21073
+
21074
+ numLightProbes: - 1
21012
21075
  },
21013
21076
 
21014
21077
  ambient: [ 0, 0, 0 ],
@@ -21030,7 +21093,8 @@
21030
21093
  pointShadowMap: [],
21031
21094
  pointShadowMatrix: [],
21032
21095
  hemi: [],
21033
- numSpotLightShadowsWithMaps: 0
21096
+ numSpotLightShadowsWithMaps: 0,
21097
+ numLightProbes: 0
21034
21098
 
21035
21099
  };
21036
21100
 
@@ -21058,6 +21122,8 @@
21058
21122
  let numSpotMaps = 0;
21059
21123
  let numSpotShadowsWithMaps = 0;
21060
21124
 
21125
+ let numLightProbes = 0;
21126
+
21061
21127
  // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
21062
21128
  lights.sort( shadowCastingAndTexturingLightsFirst );
21063
21129
 
@@ -21088,6 +21154,8 @@
21088
21154
 
21089
21155
  }
21090
21156
 
21157
+ numLightProbes ++;
21158
+
21091
21159
  } else if ( light.isDirectionalLight ) {
21092
21160
 
21093
21161
  const uniforms = cache.get( light );
@@ -21275,7 +21343,8 @@
21275
21343
  hash.numDirectionalShadows !== numDirectionalShadows ||
21276
21344
  hash.numPointShadows !== numPointShadows ||
21277
21345
  hash.numSpotShadows !== numSpotShadows ||
21278
- hash.numSpotMaps !== numSpotMaps ) {
21346
+ hash.numSpotMaps !== numSpotMaps ||
21347
+ hash.numLightProbes !== numLightProbes ) {
21279
21348
 
21280
21349
  state.directional.length = directionalLength;
21281
21350
  state.spot.length = spotLength;
@@ -21294,6 +21363,7 @@
21294
21363
  state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
21295
21364
  state.spotLightMap.length = numSpotMaps;
21296
21365
  state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
21366
+ state.numLightProbes = numLightProbes;
21297
21367
 
21298
21368
  hash.directionalLength = directionalLength;
21299
21369
  hash.pointLength = pointLength;
@@ -21306,6 +21376,8 @@
21306
21376
  hash.numSpotShadows = numSpotShadows;
21307
21377
  hash.numSpotMaps = numSpotMaps;
21308
21378
 
21379
+ hash.numLightProbes = numLightProbes;
21380
+
21309
21381
  state.version = nextVersion ++;
21310
21382
 
21311
21383
  }
@@ -23452,9 +23524,11 @@
23452
23524
 
23453
23525
  if ( glFormat === _gl.RGBA ) {
23454
23526
 
23527
+ const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
23528
+
23455
23529
  if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
23456
23530
  if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
23457
- if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23531
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23458
23532
  if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
23459
23533
  if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
23460
23534
 
@@ -24009,10 +24083,14 @@
24009
24083
 
24010
24084
  state.activeTexture( _gl.TEXTURE0 + slot );
24011
24085
 
24086
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
24087
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
24088
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
24089
+
24012
24090
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24013
24091
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24014
24092
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24015
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24093
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24016
24094
 
24017
24095
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24018
24096
  let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
@@ -24022,7 +24100,7 @@
24022
24100
  glFormat = utils.convert( texture.format, texture.colorSpace );
24023
24101
 
24024
24102
  let glType = utils.convert( texture.type ),
24025
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
24103
+ glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
24026
24104
 
24027
24105
  setTextureParameters( textureType, texture, supportsMips );
24028
24106
 
@@ -24423,10 +24501,14 @@
24423
24501
 
24424
24502
  state.activeTexture( _gl.TEXTURE0 + slot );
24425
24503
 
24504
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
24505
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
24506
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
24507
+
24426
24508
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24427
24509
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24428
24510
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24429
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24511
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24430
24512
 
24431
24513
  const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
24432
24514
  const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
@@ -24666,7 +24748,7 @@
24666
24748
 
24667
24749
  if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
24668
24750
 
24669
- let glInternalFormat = _gl.DEPTH_COMPONENT16;
24751
+ let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
24670
24752
 
24671
24753
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
24672
24754
 
@@ -25301,13 +25383,13 @@
25301
25383
  const format = texture.format;
25302
25384
  const type = texture.type;
25303
25385
 
25304
- if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
25386
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25305
25387
 
25306
25388
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
25307
25389
 
25308
25390
  // sRGB
25309
25391
 
25310
- if ( colorSpace === SRGBColorSpace ) {
25392
+ if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
25311
25393
 
25312
25394
  if ( isWebGL2 === false ) {
25313
25395
 
@@ -25381,6 +25463,8 @@
25381
25463
 
25382
25464
  let extension;
25383
25465
 
25466
+ const transfer = ColorManagement.getTransfer( colorSpace );
25467
+
25384
25468
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
25385
25469
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
25386
25470
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
@@ -25447,7 +25531,7 @@
25447
25531
 
25448
25532
  if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
25449
25533
 
25450
- if ( colorSpace === SRGBColorSpace ) {
25534
+ if ( transfer === SRGBTransfer ) {
25451
25535
 
25452
25536
  extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
25453
25537
 
@@ -25532,8 +25616,8 @@
25532
25616
 
25533
25617
  if ( extension !== null ) {
25534
25618
 
25535
- if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25536
- if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25619
+ if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25620
+ if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25537
25621
 
25538
25622
  } else {
25539
25623
 
@@ -25555,20 +25639,20 @@
25555
25639
 
25556
25640
  if ( extension !== null ) {
25557
25641
 
25558
- if ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25559
- if ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25560
- if ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25561
- if ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25562
- if ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25563
- if ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25564
- if ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25565
- if ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25566
- if ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25567
- if ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25568
- if ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25569
- if ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25570
- if ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25571
- if ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25642
+ if ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25643
+ if ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25644
+ if ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25645
+ if ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25646
+ if ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25647
+ if ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25648
+ if ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25649
+ if ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25650
+ if ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25651
+ if ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25652
+ if ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25653
+ if ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25654
+ if ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25655
+ if ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25572
25656
 
25573
25657
  } else {
25574
25658
 
@@ -25580,13 +25664,15 @@
25580
25664
 
25581
25665
  // BPTC
25582
25666
 
25583
- if ( p === RGBA_BPTC_Format ) {
25667
+ if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {
25584
25668
 
25585
25669
  extension = extensions.get( 'EXT_texture_compression_bptc' );
25586
25670
 
25587
25671
  if ( extension !== null ) {
25588
25672
 
25589
- if ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25673
+ if ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25674
+ if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
25675
+ if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
25590
25676
 
25591
25677
  } else {
25592
25678
 
@@ -26628,14 +26714,6 @@
26628
26714
  camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
26629
26715
  camera.updateMatrixWorld( true );
26630
26716
 
26631
- const children = camera.children;
26632
-
26633
- for ( let i = 0, l = children.length; i < l; i ++ ) {
26634
-
26635
- children[ i ].updateMatrixWorld( true );
26636
-
26637
- }
26638
-
26639
26717
  camera.projectionMatrix.copy( cameraXR.projectionMatrix );
26640
26718
  camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
26641
26719
 
@@ -27798,14 +27876,6 @@
27798
27876
 
27799
27877
  }
27800
27878
 
27801
- function createCanvasElement() {
27802
-
27803
- const canvas = createElementNS( 'canvas' );
27804
- canvas.style.display = 'block';
27805
- return canvas;
27806
-
27807
- }
27808
-
27809
27879
  class WebGLRenderer {
27810
27880
 
27811
27881
  constructor( parameters = {} ) {
@@ -27886,7 +27956,7 @@
27886
27956
 
27887
27957
  // physically based shading
27888
27958
 
27889
- this.outputColorSpace = SRGBColorSpace;
27959
+ this._outputColorSpace = SRGBColorSpace;
27890
27960
 
27891
27961
  // physical lights
27892
27962
 
@@ -29531,48 +29601,28 @@
29531
29601
 
29532
29602
  if ( refreshProgram || _currentCamera !== camera ) {
29533
29603
 
29534
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
29535
-
29536
- if ( capabilities.logarithmicDepthBuffer ) {
29604
+ // common camera uniforms
29537
29605
 
29538
- p_uniforms.setValue( _gl, 'logDepthBufFC',
29539
- 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
29540
-
29541
- }
29606
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
29607
+ p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
29542
29608
 
29543
- if ( _currentCamera !== camera ) {
29609
+ const uCamPos = p_uniforms.map.cameraPosition;
29544
29610
 
29545
- _currentCamera = camera;
29611
+ if ( uCamPos !== undefined ) {
29546
29612
 
29547
- // lighting uniforms depend on the camera so enforce an update
29548
- // now, in case this material supports lights - or later, when
29549
- // the next material that does gets activated:
29550
-
29551
- refreshMaterial = true; // set to true on material change
29552
- refreshLights = true; // remains set until update done
29613
+ uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
29553
29614
 
29554
29615
  }
29555
29616
 
29556
- // load material specific uniforms
29557
- // (shader material also gets them for the sake of genericity)
29558
-
29559
- if ( material.isShaderMaterial ||
29560
- material.isMeshPhongMaterial ||
29561
- material.isMeshToonMaterial ||
29562
- material.isMeshStandardMaterial ||
29563
- material.envMap ) {
29564
-
29565
- const uCamPos = p_uniforms.map.cameraPosition;
29566
-
29567
- if ( uCamPos !== undefined ) {
29568
-
29569
- uCamPos.setValue( _gl,
29570
- _vector3.setFromMatrixPosition( camera.matrixWorld ) );
29617
+ if ( capabilities.logarithmicDepthBuffer ) {
29571
29618
 
29572
- }
29619
+ p_uniforms.setValue( _gl, 'logDepthBufFC',
29620
+ 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
29573
29621
 
29574
29622
  }
29575
29623
 
29624
+ // consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
29625
+
29576
29626
  if ( material.isMeshPhongMaterial ||
29577
29627
  material.isMeshToonMaterial ||
29578
29628
  material.isMeshLambertMaterial ||
@@ -29584,16 +29634,16 @@
29584
29634
 
29585
29635
  }
29586
29636
 
29587
- if ( material.isMeshPhongMaterial ||
29588
- material.isMeshToonMaterial ||
29589
- material.isMeshLambertMaterial ||
29590
- material.isMeshBasicMaterial ||
29591
- material.isMeshStandardMaterial ||
29592
- material.isShaderMaterial ||
29593
- material.isShadowMaterial ||
29594
- object.isSkinnedMesh ) {
29637
+ if ( _currentCamera !== camera ) {
29638
+
29639
+ _currentCamera = camera;
29640
+
29641
+ // lighting uniforms depend on the camera so enforce an update
29642
+ // now, in case this material supports lights - or later, when
29643
+ // the next material that does gets activated:
29595
29644
 
29596
- p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
29645
+ refreshMaterial = true; // set to true on material change
29646
+ refreshLights = true; // remains set until update done
29597
29647
 
29598
29648
  }
29599
29649
 
@@ -30183,6 +30233,22 @@
30183
30233
 
30184
30234
  }
30185
30235
 
30236
+ get outputColorSpace() {
30237
+
30238
+ return this._outputColorSpace;
30239
+
30240
+ }
30241
+
30242
+ set outputColorSpace( colorSpace ) {
30243
+
30244
+ this._outputColorSpace = colorSpace;
30245
+
30246
+ const gl = this.getContext();
30247
+ gl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';
30248
+ gl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';
30249
+
30250
+ }
30251
+
30186
30252
  get physicallyCorrectLights() { // @deprecated, r150
30187
30253
 
30188
30254
  console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
@@ -30865,7 +30931,7 @@
30865
30931
 
30866
30932
  super.copy( source, recursive );
30867
30933
 
30868
- this.material = source.material;
30934
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
30869
30935
  this.geometry = source.geometry;
30870
30936
 
30871
30937
  return this;
@@ -32600,10 +32666,13 @@
32600
32666
 
32601
32667
  if ( ! startPoint.equals( endPoint ) ) {
32602
32668
 
32603
- this.curves.push( new LineCurve( endPoint, startPoint ) );
32669
+ const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
32670
+ this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
32604
32671
 
32605
32672
  }
32606
32673
 
32674
+ return this;
32675
+
32607
32676
  }
32608
32677
 
32609
32678
  // To get accurate point with reference to
@@ -39864,6 +39933,27 @@
39864
39933
  return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
39865
39934
  }
39866
39935
 
39936
+ function max$1(values, valueof) {
39937
+ let max;
39938
+ if (valueof === undefined) {
39939
+ for (const value of values) {
39940
+ if (value != null
39941
+ && (max < value || (max === undefined && value >= value))) {
39942
+ max = value;
39943
+ }
39944
+ }
39945
+ } else {
39946
+ let index = -1;
39947
+ for (let value of values) {
39948
+ if ((value = valueof(value, ++index, values)) != null
39949
+ && (max < value || (max === undefined && value >= value))) {
39950
+ max = value;
39951
+ }
39952
+ }
39953
+ }
39954
+ return max;
39955
+ }
39956
+
39867
39957
  function mean(values, valueof) {
39868
39958
  let count = 0;
39869
39959
  let sum = 0;
@@ -39908,6 +39998,25 @@
39908
39998
  return range;
39909
39999
  }
39910
40000
 
40001
+ function sum$1(values, valueof) {
40002
+ let sum = 0;
40003
+ if (valueof === undefined) {
40004
+ for (let value of values) {
40005
+ if (value = +value) {
40006
+ sum += value;
40007
+ }
40008
+ }
40009
+ } else {
40010
+ let index = -1;
40011
+ for (let value of values) {
40012
+ if (value = +valueof(value, ++index, values)) {
40013
+ sum += value;
40014
+ }
40015
+ }
40016
+ }
40017
+ return sum;
40018
+ }
40019
+
39911
40020
  var epsilon$2 = 1e-6;
39912
40021
  var epsilon2 = 1e-12;
39913
40022
  var pi$1 = Math.PI;
@@ -41403,7 +41512,7 @@
41403
41512
  var coordinates = [null, null],
41404
41513
  object$1 = {type: "LineString", coordinates: coordinates};
41405
41514
 
41406
- function geoDistance(a, b) {
41515
+ function geoDistance$1(a, b) {
41407
41516
  coordinates[0] = a;
41408
41517
  coordinates[1] = b;
41409
41518
  return length(object$1);
@@ -41462,16 +41571,16 @@
41462
41571
  }
41463
41572
 
41464
41573
  function containsPoint(coordinates, point) {
41465
- return geoDistance(coordinates, point) === 0;
41574
+ return geoDistance$1(coordinates, point) === 0;
41466
41575
  }
41467
41576
 
41468
41577
  function containsLine(coordinates, point) {
41469
41578
  var ao, bo, ab;
41470
41579
  for (var i = 0, n = coordinates.length; i < n; i++) {
41471
- bo = geoDistance(coordinates[i], point);
41580
+ bo = geoDistance$1(coordinates[i], point);
41472
41581
  if (bo === 0) return true;
41473
41582
  if (i > 0) {
41474
- ab = geoDistance(coordinates[i], coordinates[i - 1]);
41583
+ ab = geoDistance$1(coordinates[i], coordinates[i - 1]);
41475
41584
  if (
41476
41585
  ab > 0 &&
41477
41586
  ao <= ab &&
@@ -42242,7 +42351,7 @@
42242
42351
  var prevPnt = null;
42243
42352
  lineCoords.forEach(function (pnt) {
42244
42353
  if (prevPnt) {
42245
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
42354
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
42246
42355
  if (dist > maxDegDistance) {
42247
42356
  var interpol = geoInterpolate(prevPnt, pnt);
42248
42357
  var tStep = 1 / Math.ceil(dist / maxDegDistance);
@@ -42258,14 +42367,14 @@
42258
42367
  return result;
42259
42368
  };
42260
42369
 
42261
- var THREE$j = typeof window !== 'undefined' && window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
42370
+ var THREE$l = typeof window !== 'undefined' && window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
42262
42371
  : {
42263
42372
  BufferGeometry: BufferGeometry,
42264
42373
  Float32BufferAttribute: Float32BufferAttribute
42265
42374
  };
42266
42375
 
42267
42376
  // support both modes for backwards threejs compatibility
42268
- var setAttributeFn$4 = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42377
+ var setAttributeFn$3 = new THREE$l.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42269
42378
  var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
42270
42379
  _inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
42271
42380
  var _super = _createSuper$2(GeoJsonGeometry);
@@ -42309,7 +42418,7 @@
42309
42418
 
42310
42419
  // build geometry
42311
42420
  indices.length && _this.setIndex(indices);
42312
- vertices.length && _this[setAttributeFn$4]('position', new THREE$j.Float32BufferAttribute(vertices, 3));
42421
+ vertices.length && _this[setAttributeFn$3]('position', new THREE$l.Float32BufferAttribute(vertices, 3));
42313
42422
 
42314
42423
  //
42315
42424
 
@@ -42435,7 +42544,7 @@
42435
42544
  return _this;
42436
42545
  }
42437
42546
  return _createClass$2(GeoJsonGeometry);
42438
- }(THREE$j.BufferGeometry); //
42547
+ }(THREE$l.BufferGeometry); //
42439
42548
  function concatGroup(main, extra) {
42440
42549
  var prevVertCnt = Math.round(main.vertices.length / 3);
42441
42550
  concatArr(main.vertices, extra.vertices);
@@ -43013,7 +43122,7 @@
43013
43122
  }
43014
43123
 
43015
43124
  /**
43016
- * @param {Array<BufferGeometry>} geometry
43125
+ * @param {BufferGeometry} geometry
43017
43126
  * @return {number}
43018
43127
  */
43019
43128
  function estimateBytesUsed( geometry ) {
@@ -43089,8 +43198,10 @@
43089
43198
  }
43090
43199
 
43091
43200
  // convert the error tolerance to an amount of decimal places to truncate to
43092
- const decimalShift = Math.log10( 1 / tolerance );
43093
- const shiftMultiplier = Math.pow( 10, decimalShift );
43201
+ const halfTolerance = tolerance * 0.5;
43202
+ const exponent = Math.log10( 1 / tolerance );
43203
+ const hashMultiplier = Math.pow( 10, exponent );
43204
+ const hashAdditive = halfTolerance * hashMultiplier;
43094
43205
  for ( let i = 0; i < vertexCount; i ++ ) {
43095
43206
 
43096
43207
  const index = indices ? indices.getX( i ) : i;
@@ -43106,7 +43217,7 @@
43106
43217
  for ( let k = 0; k < itemSize; k ++ ) {
43107
43218
 
43108
43219
  // double tilde truncates the decimal value
43109
- hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;
43220
+ hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * hashMultiplier + hashAdditive ) },`;
43110
43221
 
43111
43222
  }
43112
43223
 
@@ -43844,6 +43955,412 @@
43844
43955
  };
43845
43956
  }); // constant
43846
43957
 
43958
+ function define(constructor, factory, prototype) {
43959
+ constructor.prototype = factory.prototype = prototype;
43960
+ prototype.constructor = constructor;
43961
+ }
43962
+
43963
+ function extend(parent, definition) {
43964
+ var prototype = Object.create(parent.prototype);
43965
+ for (var key in definition) prototype[key] = definition[key];
43966
+ return prototype;
43967
+ }
43968
+
43969
+ function Color() {}
43970
+
43971
+ var darker = 0.7;
43972
+ var brighter = 1 / darker;
43973
+
43974
+ var reI = "\\s*([+-]?\\d+)\\s*",
43975
+ reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
43976
+ reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
43977
+ reHex = /^#([0-9a-f]{3,8})$/,
43978
+ reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
43979
+ reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
43980
+ reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
43981
+ reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
43982
+ reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
43983
+ reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
43984
+
43985
+ var named = {
43986
+ aliceblue: 0xf0f8ff,
43987
+ antiquewhite: 0xfaebd7,
43988
+ aqua: 0x00ffff,
43989
+ aquamarine: 0x7fffd4,
43990
+ azure: 0xf0ffff,
43991
+ beige: 0xf5f5dc,
43992
+ bisque: 0xffe4c4,
43993
+ black: 0x000000,
43994
+ blanchedalmond: 0xffebcd,
43995
+ blue: 0x0000ff,
43996
+ blueviolet: 0x8a2be2,
43997
+ brown: 0xa52a2a,
43998
+ burlywood: 0xdeb887,
43999
+ cadetblue: 0x5f9ea0,
44000
+ chartreuse: 0x7fff00,
44001
+ chocolate: 0xd2691e,
44002
+ coral: 0xff7f50,
44003
+ cornflowerblue: 0x6495ed,
44004
+ cornsilk: 0xfff8dc,
44005
+ crimson: 0xdc143c,
44006
+ cyan: 0x00ffff,
44007
+ darkblue: 0x00008b,
44008
+ darkcyan: 0x008b8b,
44009
+ darkgoldenrod: 0xb8860b,
44010
+ darkgray: 0xa9a9a9,
44011
+ darkgreen: 0x006400,
44012
+ darkgrey: 0xa9a9a9,
44013
+ darkkhaki: 0xbdb76b,
44014
+ darkmagenta: 0x8b008b,
44015
+ darkolivegreen: 0x556b2f,
44016
+ darkorange: 0xff8c00,
44017
+ darkorchid: 0x9932cc,
44018
+ darkred: 0x8b0000,
44019
+ darksalmon: 0xe9967a,
44020
+ darkseagreen: 0x8fbc8f,
44021
+ darkslateblue: 0x483d8b,
44022
+ darkslategray: 0x2f4f4f,
44023
+ darkslategrey: 0x2f4f4f,
44024
+ darkturquoise: 0x00ced1,
44025
+ darkviolet: 0x9400d3,
44026
+ deeppink: 0xff1493,
44027
+ deepskyblue: 0x00bfff,
44028
+ dimgray: 0x696969,
44029
+ dimgrey: 0x696969,
44030
+ dodgerblue: 0x1e90ff,
44031
+ firebrick: 0xb22222,
44032
+ floralwhite: 0xfffaf0,
44033
+ forestgreen: 0x228b22,
44034
+ fuchsia: 0xff00ff,
44035
+ gainsboro: 0xdcdcdc,
44036
+ ghostwhite: 0xf8f8ff,
44037
+ gold: 0xffd700,
44038
+ goldenrod: 0xdaa520,
44039
+ gray: 0x808080,
44040
+ green: 0x008000,
44041
+ greenyellow: 0xadff2f,
44042
+ grey: 0x808080,
44043
+ honeydew: 0xf0fff0,
44044
+ hotpink: 0xff69b4,
44045
+ indianred: 0xcd5c5c,
44046
+ indigo: 0x4b0082,
44047
+ ivory: 0xfffff0,
44048
+ khaki: 0xf0e68c,
44049
+ lavender: 0xe6e6fa,
44050
+ lavenderblush: 0xfff0f5,
44051
+ lawngreen: 0x7cfc00,
44052
+ lemonchiffon: 0xfffacd,
44053
+ lightblue: 0xadd8e6,
44054
+ lightcoral: 0xf08080,
44055
+ lightcyan: 0xe0ffff,
44056
+ lightgoldenrodyellow: 0xfafad2,
44057
+ lightgray: 0xd3d3d3,
44058
+ lightgreen: 0x90ee90,
44059
+ lightgrey: 0xd3d3d3,
44060
+ lightpink: 0xffb6c1,
44061
+ lightsalmon: 0xffa07a,
44062
+ lightseagreen: 0x20b2aa,
44063
+ lightskyblue: 0x87cefa,
44064
+ lightslategray: 0x778899,
44065
+ lightslategrey: 0x778899,
44066
+ lightsteelblue: 0xb0c4de,
44067
+ lightyellow: 0xffffe0,
44068
+ lime: 0x00ff00,
44069
+ limegreen: 0x32cd32,
44070
+ linen: 0xfaf0e6,
44071
+ magenta: 0xff00ff,
44072
+ maroon: 0x800000,
44073
+ mediumaquamarine: 0x66cdaa,
44074
+ mediumblue: 0x0000cd,
44075
+ mediumorchid: 0xba55d3,
44076
+ mediumpurple: 0x9370db,
44077
+ mediumseagreen: 0x3cb371,
44078
+ mediumslateblue: 0x7b68ee,
44079
+ mediumspringgreen: 0x00fa9a,
44080
+ mediumturquoise: 0x48d1cc,
44081
+ mediumvioletred: 0xc71585,
44082
+ midnightblue: 0x191970,
44083
+ mintcream: 0xf5fffa,
44084
+ mistyrose: 0xffe4e1,
44085
+ moccasin: 0xffe4b5,
44086
+ navajowhite: 0xffdead,
44087
+ navy: 0x000080,
44088
+ oldlace: 0xfdf5e6,
44089
+ olive: 0x808000,
44090
+ olivedrab: 0x6b8e23,
44091
+ orange: 0xffa500,
44092
+ orangered: 0xff4500,
44093
+ orchid: 0xda70d6,
44094
+ palegoldenrod: 0xeee8aa,
44095
+ palegreen: 0x98fb98,
44096
+ paleturquoise: 0xafeeee,
44097
+ palevioletred: 0xdb7093,
44098
+ papayawhip: 0xffefd5,
44099
+ peachpuff: 0xffdab9,
44100
+ peru: 0xcd853f,
44101
+ pink: 0xffc0cb,
44102
+ plum: 0xdda0dd,
44103
+ powderblue: 0xb0e0e6,
44104
+ purple: 0x800080,
44105
+ rebeccapurple: 0x663399,
44106
+ red: 0xff0000,
44107
+ rosybrown: 0xbc8f8f,
44108
+ royalblue: 0x4169e1,
44109
+ saddlebrown: 0x8b4513,
44110
+ salmon: 0xfa8072,
44111
+ sandybrown: 0xf4a460,
44112
+ seagreen: 0x2e8b57,
44113
+ seashell: 0xfff5ee,
44114
+ sienna: 0xa0522d,
44115
+ silver: 0xc0c0c0,
44116
+ skyblue: 0x87ceeb,
44117
+ slateblue: 0x6a5acd,
44118
+ slategray: 0x708090,
44119
+ slategrey: 0x708090,
44120
+ snow: 0xfffafa,
44121
+ springgreen: 0x00ff7f,
44122
+ steelblue: 0x4682b4,
44123
+ tan: 0xd2b48c,
44124
+ teal: 0x008080,
44125
+ thistle: 0xd8bfd8,
44126
+ tomato: 0xff6347,
44127
+ turquoise: 0x40e0d0,
44128
+ violet: 0xee82ee,
44129
+ wheat: 0xf5deb3,
44130
+ white: 0xffffff,
44131
+ whitesmoke: 0xf5f5f5,
44132
+ yellow: 0xffff00,
44133
+ yellowgreen: 0x9acd32
44134
+ };
44135
+
44136
+ define(Color, color, {
44137
+ copy(channels) {
44138
+ return Object.assign(new this.constructor, this, channels);
44139
+ },
44140
+ displayable() {
44141
+ return this.rgb().displayable();
44142
+ },
44143
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
44144
+ formatHex: color_formatHex,
44145
+ formatHex8: color_formatHex8,
44146
+ formatHsl: color_formatHsl,
44147
+ formatRgb: color_formatRgb,
44148
+ toString: color_formatRgb
44149
+ });
44150
+
44151
+ function color_formatHex() {
44152
+ return this.rgb().formatHex();
44153
+ }
44154
+
44155
+ function color_formatHex8() {
44156
+ return this.rgb().formatHex8();
44157
+ }
44158
+
44159
+ function color_formatHsl() {
44160
+ return hslConvert(this).formatHsl();
44161
+ }
44162
+
44163
+ function color_formatRgb() {
44164
+ return this.rgb().formatRgb();
44165
+ }
44166
+
44167
+ function color(format) {
44168
+ var m, l;
44169
+ format = (format + "").trim().toLowerCase();
44170
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
44171
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
44172
+ : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
44173
+ : 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
44174
+ : null) // invalid hex
44175
+ : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
44176
+ : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
44177
+ : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
44178
+ : (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)
44179
+ : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
44180
+ : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
44181
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
44182
+ : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
44183
+ : null;
44184
+ }
44185
+
44186
+ function rgbn(n) {
44187
+ return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
44188
+ }
44189
+
44190
+ function rgba$1(r, g, b, a) {
44191
+ if (a <= 0) r = g = b = NaN;
44192
+ return new Rgb(r, g, b, a);
44193
+ }
44194
+
44195
+ function rgbConvert(o) {
44196
+ if (!(o instanceof Color)) o = color(o);
44197
+ if (!o) return new Rgb;
44198
+ o = o.rgb();
44199
+ return new Rgb(o.r, o.g, o.b, o.opacity);
44200
+ }
44201
+
44202
+ function rgb$2(r, g, b, opacity) {
44203
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
44204
+ }
44205
+
44206
+ function Rgb(r, g, b, opacity) {
44207
+ this.r = +r;
44208
+ this.g = +g;
44209
+ this.b = +b;
44210
+ this.opacity = +opacity;
44211
+ }
44212
+
44213
+ define(Rgb, rgb$2, extend(Color, {
44214
+ brighter(k) {
44215
+ k = k == null ? brighter : Math.pow(brighter, k);
44216
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
44217
+ },
44218
+ darker(k) {
44219
+ k = k == null ? darker : Math.pow(darker, k);
44220
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
44221
+ },
44222
+ rgb() {
44223
+ return this;
44224
+ },
44225
+ clamp() {
44226
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
44227
+ },
44228
+ displayable() {
44229
+ return (-0.5 <= this.r && this.r < 255.5)
44230
+ && (-0.5 <= this.g && this.g < 255.5)
44231
+ && (-0.5 <= this.b && this.b < 255.5)
44232
+ && (0 <= this.opacity && this.opacity <= 1);
44233
+ },
44234
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
44235
+ formatHex: rgb_formatHex,
44236
+ formatHex8: rgb_formatHex8,
44237
+ formatRgb: rgb_formatRgb,
44238
+ toString: rgb_formatRgb
44239
+ }));
44240
+
44241
+ function rgb_formatHex() {
44242
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
44243
+ }
44244
+
44245
+ function rgb_formatHex8() {
44246
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
44247
+ }
44248
+
44249
+ function rgb_formatRgb() {
44250
+ const a = clampa(this.opacity);
44251
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
44252
+ }
44253
+
44254
+ function clampa(opacity) {
44255
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
44256
+ }
44257
+
44258
+ function clampi(value) {
44259
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
44260
+ }
44261
+
44262
+ function hex(value) {
44263
+ value = clampi(value);
44264
+ return (value < 16 ? "0" : "") + value.toString(16);
44265
+ }
44266
+
44267
+ function hsla(h, s, l, a) {
44268
+ if (a <= 0) h = s = l = NaN;
44269
+ else if (l <= 0 || l >= 1) h = s = NaN;
44270
+ else if (s <= 0) h = NaN;
44271
+ return new Hsl(h, s, l, a);
44272
+ }
44273
+
44274
+ function hslConvert(o) {
44275
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
44276
+ if (!(o instanceof Color)) o = color(o);
44277
+ if (!o) return new Hsl;
44278
+ if (o instanceof Hsl) return o;
44279
+ o = o.rgb();
44280
+ var r = o.r / 255,
44281
+ g = o.g / 255,
44282
+ b = o.b / 255,
44283
+ min = Math.min(r, g, b),
44284
+ max = Math.max(r, g, b),
44285
+ h = NaN,
44286
+ s = max - min,
44287
+ l = (max + min) / 2;
44288
+ if (s) {
44289
+ if (r === max) h = (g - b) / s + (g < b) * 6;
44290
+ else if (g === max) h = (b - r) / s + 2;
44291
+ else h = (r - g) / s + 4;
44292
+ s /= l < 0.5 ? max + min : 2 - max - min;
44293
+ h *= 60;
44294
+ } else {
44295
+ s = l > 0 && l < 1 ? 0 : h;
44296
+ }
44297
+ return new Hsl(h, s, l, o.opacity);
44298
+ }
44299
+
44300
+ function hsl(h, s, l, opacity) {
44301
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
44302
+ }
44303
+
44304
+ function Hsl(h, s, l, opacity) {
44305
+ this.h = +h;
44306
+ this.s = +s;
44307
+ this.l = +l;
44308
+ this.opacity = +opacity;
44309
+ }
44310
+
44311
+ define(Hsl, hsl, extend(Color, {
44312
+ brighter(k) {
44313
+ k = k == null ? brighter : Math.pow(brighter, k);
44314
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
44315
+ },
44316
+ darker(k) {
44317
+ k = k == null ? darker : Math.pow(darker, k);
44318
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
44319
+ },
44320
+ rgb() {
44321
+ var h = this.h % 360 + (this.h < 0) * 360,
44322
+ s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
44323
+ l = this.l,
44324
+ m2 = l + (l < 0.5 ? l : 1 - l) * s,
44325
+ m1 = 2 * l - m2;
44326
+ return new Rgb(
44327
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
44328
+ hsl2rgb(h, m1, m2),
44329
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
44330
+ this.opacity
44331
+ );
44332
+ },
44333
+ clamp() {
44334
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
44335
+ },
44336
+ displayable() {
44337
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s))
44338
+ && (0 <= this.l && this.l <= 1)
44339
+ && (0 <= this.opacity && this.opacity <= 1);
44340
+ },
44341
+ formatHsl() {
44342
+ const a = clampa(this.opacity);
44343
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
44344
+ }
44345
+ }));
44346
+
44347
+ function clamph(value) {
44348
+ value = (value || 0) % 360;
44349
+ return value < 0 ? value + 360 : value;
44350
+ }
44351
+
44352
+ function clampt(value) {
44353
+ return Math.max(0, Math.min(1, value || 0));
44354
+ }
44355
+
44356
+ /* From FvD 13.37, CSS Color Module Level 3 */
44357
+ function hsl2rgb(h, m1, m2) {
44358
+ return (h < 60 ? m1 + (m2 - m1) * h / 60
44359
+ : h < 180 ? m2
44360
+ : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
44361
+ : m1) * 255;
44362
+ }
44363
+
43847
44364
  // This file is autogenerated. It's used to publish ESM to npm.
43848
44365
  function _typeof(obj) {
43849
44366
  "@babel/helpers - typeof";
@@ -45510,412 +46027,6 @@
45510
46027
  return this;
45511
46028
  }
45512
46029
 
45513
- function define(constructor, factory, prototype) {
45514
- constructor.prototype = factory.prototype = prototype;
45515
- prototype.constructor = constructor;
45516
- }
45517
-
45518
- function extend(parent, definition) {
45519
- var prototype = Object.create(parent.prototype);
45520
- for (var key in definition) prototype[key] = definition[key];
45521
- return prototype;
45522
- }
45523
-
45524
- function Color() {}
45525
-
45526
- var darker = 0.7;
45527
- var brighter = 1 / darker;
45528
-
45529
- var reI = "\\s*([+-]?\\d+)\\s*",
45530
- reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
45531
- reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
45532
- reHex = /^#([0-9a-f]{3,8})$/,
45533
- reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
45534
- reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
45535
- reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
45536
- reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
45537
- reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
45538
- reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
45539
-
45540
- var named = {
45541
- aliceblue: 0xf0f8ff,
45542
- antiquewhite: 0xfaebd7,
45543
- aqua: 0x00ffff,
45544
- aquamarine: 0x7fffd4,
45545
- azure: 0xf0ffff,
45546
- beige: 0xf5f5dc,
45547
- bisque: 0xffe4c4,
45548
- black: 0x000000,
45549
- blanchedalmond: 0xffebcd,
45550
- blue: 0x0000ff,
45551
- blueviolet: 0x8a2be2,
45552
- brown: 0xa52a2a,
45553
- burlywood: 0xdeb887,
45554
- cadetblue: 0x5f9ea0,
45555
- chartreuse: 0x7fff00,
45556
- chocolate: 0xd2691e,
45557
- coral: 0xff7f50,
45558
- cornflowerblue: 0x6495ed,
45559
- cornsilk: 0xfff8dc,
45560
- crimson: 0xdc143c,
45561
- cyan: 0x00ffff,
45562
- darkblue: 0x00008b,
45563
- darkcyan: 0x008b8b,
45564
- darkgoldenrod: 0xb8860b,
45565
- darkgray: 0xa9a9a9,
45566
- darkgreen: 0x006400,
45567
- darkgrey: 0xa9a9a9,
45568
- darkkhaki: 0xbdb76b,
45569
- darkmagenta: 0x8b008b,
45570
- darkolivegreen: 0x556b2f,
45571
- darkorange: 0xff8c00,
45572
- darkorchid: 0x9932cc,
45573
- darkred: 0x8b0000,
45574
- darksalmon: 0xe9967a,
45575
- darkseagreen: 0x8fbc8f,
45576
- darkslateblue: 0x483d8b,
45577
- darkslategray: 0x2f4f4f,
45578
- darkslategrey: 0x2f4f4f,
45579
- darkturquoise: 0x00ced1,
45580
- darkviolet: 0x9400d3,
45581
- deeppink: 0xff1493,
45582
- deepskyblue: 0x00bfff,
45583
- dimgray: 0x696969,
45584
- dimgrey: 0x696969,
45585
- dodgerblue: 0x1e90ff,
45586
- firebrick: 0xb22222,
45587
- floralwhite: 0xfffaf0,
45588
- forestgreen: 0x228b22,
45589
- fuchsia: 0xff00ff,
45590
- gainsboro: 0xdcdcdc,
45591
- ghostwhite: 0xf8f8ff,
45592
- gold: 0xffd700,
45593
- goldenrod: 0xdaa520,
45594
- gray: 0x808080,
45595
- green: 0x008000,
45596
- greenyellow: 0xadff2f,
45597
- grey: 0x808080,
45598
- honeydew: 0xf0fff0,
45599
- hotpink: 0xff69b4,
45600
- indianred: 0xcd5c5c,
45601
- indigo: 0x4b0082,
45602
- ivory: 0xfffff0,
45603
- khaki: 0xf0e68c,
45604
- lavender: 0xe6e6fa,
45605
- lavenderblush: 0xfff0f5,
45606
- lawngreen: 0x7cfc00,
45607
- lemonchiffon: 0xfffacd,
45608
- lightblue: 0xadd8e6,
45609
- lightcoral: 0xf08080,
45610
- lightcyan: 0xe0ffff,
45611
- lightgoldenrodyellow: 0xfafad2,
45612
- lightgray: 0xd3d3d3,
45613
- lightgreen: 0x90ee90,
45614
- lightgrey: 0xd3d3d3,
45615
- lightpink: 0xffb6c1,
45616
- lightsalmon: 0xffa07a,
45617
- lightseagreen: 0x20b2aa,
45618
- lightskyblue: 0x87cefa,
45619
- lightslategray: 0x778899,
45620
- lightslategrey: 0x778899,
45621
- lightsteelblue: 0xb0c4de,
45622
- lightyellow: 0xffffe0,
45623
- lime: 0x00ff00,
45624
- limegreen: 0x32cd32,
45625
- linen: 0xfaf0e6,
45626
- magenta: 0xff00ff,
45627
- maroon: 0x800000,
45628
- mediumaquamarine: 0x66cdaa,
45629
- mediumblue: 0x0000cd,
45630
- mediumorchid: 0xba55d3,
45631
- mediumpurple: 0x9370db,
45632
- mediumseagreen: 0x3cb371,
45633
- mediumslateblue: 0x7b68ee,
45634
- mediumspringgreen: 0x00fa9a,
45635
- mediumturquoise: 0x48d1cc,
45636
- mediumvioletred: 0xc71585,
45637
- midnightblue: 0x191970,
45638
- mintcream: 0xf5fffa,
45639
- mistyrose: 0xffe4e1,
45640
- moccasin: 0xffe4b5,
45641
- navajowhite: 0xffdead,
45642
- navy: 0x000080,
45643
- oldlace: 0xfdf5e6,
45644
- olive: 0x808000,
45645
- olivedrab: 0x6b8e23,
45646
- orange: 0xffa500,
45647
- orangered: 0xff4500,
45648
- orchid: 0xda70d6,
45649
- palegoldenrod: 0xeee8aa,
45650
- palegreen: 0x98fb98,
45651
- paleturquoise: 0xafeeee,
45652
- palevioletred: 0xdb7093,
45653
- papayawhip: 0xffefd5,
45654
- peachpuff: 0xffdab9,
45655
- peru: 0xcd853f,
45656
- pink: 0xffc0cb,
45657
- plum: 0xdda0dd,
45658
- powderblue: 0xb0e0e6,
45659
- purple: 0x800080,
45660
- rebeccapurple: 0x663399,
45661
- red: 0xff0000,
45662
- rosybrown: 0xbc8f8f,
45663
- royalblue: 0x4169e1,
45664
- saddlebrown: 0x8b4513,
45665
- salmon: 0xfa8072,
45666
- sandybrown: 0xf4a460,
45667
- seagreen: 0x2e8b57,
45668
- seashell: 0xfff5ee,
45669
- sienna: 0xa0522d,
45670
- silver: 0xc0c0c0,
45671
- skyblue: 0x87ceeb,
45672
- slateblue: 0x6a5acd,
45673
- slategray: 0x708090,
45674
- slategrey: 0x708090,
45675
- snow: 0xfffafa,
45676
- springgreen: 0x00ff7f,
45677
- steelblue: 0x4682b4,
45678
- tan: 0xd2b48c,
45679
- teal: 0x008080,
45680
- thistle: 0xd8bfd8,
45681
- tomato: 0xff6347,
45682
- turquoise: 0x40e0d0,
45683
- violet: 0xee82ee,
45684
- wheat: 0xf5deb3,
45685
- white: 0xffffff,
45686
- whitesmoke: 0xf5f5f5,
45687
- yellow: 0xffff00,
45688
- yellowgreen: 0x9acd32
45689
- };
45690
-
45691
- define(Color, color, {
45692
- copy(channels) {
45693
- return Object.assign(new this.constructor, this, channels);
45694
- },
45695
- displayable() {
45696
- return this.rgb().displayable();
45697
- },
45698
- hex: color_formatHex, // Deprecated! Use color.formatHex.
45699
- formatHex: color_formatHex,
45700
- formatHex8: color_formatHex8,
45701
- formatHsl: color_formatHsl,
45702
- formatRgb: color_formatRgb,
45703
- toString: color_formatRgb
45704
- });
45705
-
45706
- function color_formatHex() {
45707
- return this.rgb().formatHex();
45708
- }
45709
-
45710
- function color_formatHex8() {
45711
- return this.rgb().formatHex8();
45712
- }
45713
-
45714
- function color_formatHsl() {
45715
- return hslConvert(this).formatHsl();
45716
- }
45717
-
45718
- function color_formatRgb() {
45719
- return this.rgb().formatRgb();
45720
- }
45721
-
45722
- function color(format) {
45723
- var m, l;
45724
- format = (format + "").trim().toLowerCase();
45725
- return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
45726
- : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
45727
- : l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
45728
- : 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
45729
- : null) // invalid hex
45730
- : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
45731
- : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
45732
- : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
45733
- : (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)
45734
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
45735
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
45736
- : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
45737
- : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
45738
- : null;
45739
- }
45740
-
45741
- function rgbn(n) {
45742
- return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
45743
- }
45744
-
45745
- function rgba$1(r, g, b, a) {
45746
- if (a <= 0) r = g = b = NaN;
45747
- return new Rgb(r, g, b, a);
45748
- }
45749
-
45750
- function rgbConvert(o) {
45751
- if (!(o instanceof Color)) o = color(o);
45752
- if (!o) return new Rgb;
45753
- o = o.rgb();
45754
- return new Rgb(o.r, o.g, o.b, o.opacity);
45755
- }
45756
-
45757
- function rgb$2(r, g, b, opacity) {
45758
- return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
45759
- }
45760
-
45761
- function Rgb(r, g, b, opacity) {
45762
- this.r = +r;
45763
- this.g = +g;
45764
- this.b = +b;
45765
- this.opacity = +opacity;
45766
- }
45767
-
45768
- define(Rgb, rgb$2, extend(Color, {
45769
- brighter(k) {
45770
- k = k == null ? brighter : Math.pow(brighter, k);
45771
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45772
- },
45773
- darker(k) {
45774
- k = k == null ? darker : Math.pow(darker, k);
45775
- return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
45776
- },
45777
- rgb() {
45778
- return this;
45779
- },
45780
- clamp() {
45781
- return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
45782
- },
45783
- displayable() {
45784
- return (-0.5 <= this.r && this.r < 255.5)
45785
- && (-0.5 <= this.g && this.g < 255.5)
45786
- && (-0.5 <= this.b && this.b < 255.5)
45787
- && (0 <= this.opacity && this.opacity <= 1);
45788
- },
45789
- hex: rgb_formatHex, // Deprecated! Use color.formatHex.
45790
- formatHex: rgb_formatHex,
45791
- formatHex8: rgb_formatHex8,
45792
- formatRgb: rgb_formatRgb,
45793
- toString: rgb_formatRgb
45794
- }));
45795
-
45796
- function rgb_formatHex() {
45797
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
45798
- }
45799
-
45800
- function rgb_formatHex8() {
45801
- return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
45802
- }
45803
-
45804
- function rgb_formatRgb() {
45805
- const a = clampa(this.opacity);
45806
- return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
45807
- }
45808
-
45809
- function clampa(opacity) {
45810
- return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
45811
- }
45812
-
45813
- function clampi(value) {
45814
- return Math.max(0, Math.min(255, Math.round(value) || 0));
45815
- }
45816
-
45817
- function hex(value) {
45818
- value = clampi(value);
45819
- return (value < 16 ? "0" : "") + value.toString(16);
45820
- }
45821
-
45822
- function hsla(h, s, l, a) {
45823
- if (a <= 0) h = s = l = NaN;
45824
- else if (l <= 0 || l >= 1) h = s = NaN;
45825
- else if (s <= 0) h = NaN;
45826
- return new Hsl(h, s, l, a);
45827
- }
45828
-
45829
- function hslConvert(o) {
45830
- if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
45831
- if (!(o instanceof Color)) o = color(o);
45832
- if (!o) return new Hsl;
45833
- if (o instanceof Hsl) return o;
45834
- o = o.rgb();
45835
- var r = o.r / 255,
45836
- g = o.g / 255,
45837
- b = o.b / 255,
45838
- min = Math.min(r, g, b),
45839
- max = Math.max(r, g, b),
45840
- h = NaN,
45841
- s = max - min,
45842
- l = (max + min) / 2;
45843
- if (s) {
45844
- if (r === max) h = (g - b) / s + (g < b) * 6;
45845
- else if (g === max) h = (b - r) / s + 2;
45846
- else h = (r - g) / s + 4;
45847
- s /= l < 0.5 ? max + min : 2 - max - min;
45848
- h *= 60;
45849
- } else {
45850
- s = l > 0 && l < 1 ? 0 : h;
45851
- }
45852
- return new Hsl(h, s, l, o.opacity);
45853
- }
45854
-
45855
- function hsl(h, s, l, opacity) {
45856
- return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
45857
- }
45858
-
45859
- function Hsl(h, s, l, opacity) {
45860
- this.h = +h;
45861
- this.s = +s;
45862
- this.l = +l;
45863
- this.opacity = +opacity;
45864
- }
45865
-
45866
- define(Hsl, hsl, extend(Color, {
45867
- brighter(k) {
45868
- k = k == null ? brighter : Math.pow(brighter, k);
45869
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45870
- },
45871
- darker(k) {
45872
- k = k == null ? darker : Math.pow(darker, k);
45873
- return new Hsl(this.h, this.s, this.l * k, this.opacity);
45874
- },
45875
- rgb() {
45876
- var h = this.h % 360 + (this.h < 0) * 360,
45877
- s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
45878
- l = this.l,
45879
- m2 = l + (l < 0.5 ? l : 1 - l) * s,
45880
- m1 = 2 * l - m2;
45881
- return new Rgb(
45882
- hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
45883
- hsl2rgb(h, m1, m2),
45884
- hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
45885
- this.opacity
45886
- );
45887
- },
45888
- clamp() {
45889
- return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
45890
- },
45891
- displayable() {
45892
- return (0 <= this.s && this.s <= 1 || isNaN(this.s))
45893
- && (0 <= this.l && this.l <= 1)
45894
- && (0 <= this.opacity && this.opacity <= 1);
45895
- },
45896
- formatHsl() {
45897
- const a = clampa(this.opacity);
45898
- return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
45899
- }
45900
- }));
45901
-
45902
- function clamph(value) {
45903
- value = (value || 0) % 360;
45904
- return value < 0 ? value + 360 : value;
45905
- }
45906
-
45907
- function clampt(value) {
45908
- return Math.max(0, Math.min(1, value || 0));
45909
- }
45910
-
45911
- /* From FvD 13.37, CSS Color Module Level 3 */
45912
- function hsl2rgb(h, m1, m2) {
45913
- return (h < 60 ? m1 + (m2 - m1) * h / 60
45914
- : h < 180 ? m2
45915
- : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
45916
- : m1) * 255;
45917
- }
45918
-
45919
46030
  var constant = x => () => x;
45920
46031
 
45921
46032
  function linear$1(a, d) {
@@ -48755,7 +48866,7 @@
48755
48866
  }
48756
48867
  if (!v.delaunay) return false;
48757
48868
  const _distances = v.delaunay.edges.map(e =>
48758
- geoDistance(v.points[e[0]], v.points[e[1]])
48869
+ geoDistance$1(v.points[e[0]], v.points[e[1]])
48759
48870
  ),
48760
48871
  _urquart = v.delaunay.urquhart(_distances);
48761
48872
  return {
@@ -48815,7 +48926,7 @@
48815
48926
  v._found = undefined;
48816
48927
  v.find = function(x, y, radius) {
48817
48928
  v._found = v.delaunay.find(x, y, v._found);
48818
- if (!radius || geoDistance([x, y], v.points[v._found]) < radius)
48929
+ if (!radius || geoDistance$1([x, y], v.points[v._found]) < radius)
48819
48930
  return v._found;
48820
48931
  };
48821
48932
 
@@ -49127,7 +49238,7 @@
49127
49238
  var prevPnt;
49128
49239
  coords.forEach(function (pnt) {
49129
49240
  if (prevPnt) {
49130
- var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
49241
+ var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
49131
49242
  if (dist > maxDistance) {
49132
49243
  var interpol = geoInterpolate(prevPnt, pnt);
49133
49244
  var tStep = 1 / Math.ceil(dist / maxDistance);
@@ -49215,14 +49326,14 @@
49215
49326
  return crossesPoleOrAntimeridian ? geoContains(polygon, pnt) : booleanPointInPolygon(pnt, polygon);
49216
49327
  }
49217
49328
 
49218
- var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
49329
+ var THREE$k = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
49219
49330
  : {
49220
49331
  BufferGeometry: BufferGeometry,
49221
49332
  Float32BufferAttribute: Float32BufferAttribute
49222
49333
  };
49223
49334
 
49224
49335
  // support both modes for backwards threejs compatibility
49225
- var setAttributeFn$3 = new THREE$i.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49336
+ var setAttributeFn$2 = new THREE$k.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49226
49337
  var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
49227
49338
  _inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
49228
49339
  var _super = _createSuper$1(ConicPolygonBufferGeometry);
@@ -49277,8 +49388,8 @@
49277
49388
 
49278
49389
  // build geometry
49279
49390
  _this.setIndex(indices);
49280
- _this[setAttributeFn$3]('position', new THREE$i.Float32BufferAttribute(vertices, 3));
49281
- _this[setAttributeFn$3]('uv', new THREE$i.Float32BufferAttribute(uvs, 2));
49391
+ _this[setAttributeFn$2]('position', new THREE$k.Float32BufferAttribute(vertices, 3));
49392
+ _this[setAttributeFn$2]('uv', new THREE$k.Float32BufferAttribute(uvs, 2));
49282
49393
 
49283
49394
  // auto-calculate normals
49284
49395
  _this.computeVertexNormals();
@@ -49342,7 +49453,7 @@
49342
49453
  return _this;
49343
49454
  }
49344
49455
  return _createClass$1(ConicPolygonBufferGeometry);
49345
- }(THREE$i.BufferGeometry); //
49456
+ }(THREE$k.BufferGeometry); //
49346
49457
  function polar2Cartesian$1(lat, lng) {
49347
49458
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
49348
49459
  var phi = (90 - lat) * Math.PI / 180;
@@ -64301,6 +64412,449 @@
64301
64412
  return rad * 180 / Math.PI;
64302
64413
  }
64303
64414
 
64415
+ function interpolateTurbo(t) {
64416
+ t = Math.max(0, Math.min(1, t));
64417
+ return "rgb("
64418
+ + 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))))))) + ", "
64419
+ + 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))))))) + ", "
64420
+ + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))
64421
+ + ")";
64422
+ }
64423
+
64424
+ var bounds3 = Bounds3$2;
64425
+
64426
+ function Bounds3$2(x, y, z, half) {
64427
+ this.x = typeof x === 'number' ? x : 0;
64428
+ this.y = typeof y === 'number' ? y : 0;
64429
+ this.z = typeof z === 'number' ? z : 0;
64430
+ this.half = typeof half === 'number' ? half : 0;
64431
+ }
64432
+
64433
+ Bounds3$2.prototype.contains = function contains(x, y, z) {
64434
+ var half = this.half;
64435
+ return this.x - half <= x && x < this.x + half &&
64436
+ this.y - half <= y && y < this.y + half &&
64437
+ this.z - half <= z && z < this.z + half;
64438
+ };
64439
+
64440
+ var Bounds3$1 = bounds3;
64441
+ var MAX_ITEMS = 4;
64442
+
64443
+ var treeNode = TreeNode$1;
64444
+
64445
+ function TreeNode$1(bounds) {
64446
+ this.bounds = bounds;
64447
+ this.q0 = null;
64448
+ this.q1 = null;
64449
+ this.q2 = null;
64450
+ this.q3 = null;
64451
+ this.q4 = null;
64452
+ this.q5 = null;
64453
+ this.q6 = null;
64454
+ this.q7 = null;
64455
+ this.items = null;
64456
+ }
64457
+
64458
+ TreeNode$1.prototype.subdivide = function subdivide() {
64459
+ var bounds = this.bounds;
64460
+ var quarter = bounds.half / 2;
64461
+
64462
+ this.q0 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y - quarter, bounds.z - quarter, quarter));
64463
+ this.q1 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y - quarter, bounds.z - quarter, quarter));
64464
+ this.q2 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y + quarter, bounds.z - quarter, quarter));
64465
+ this.q3 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y + quarter, bounds.z - quarter, quarter));
64466
+ this.q4 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y - quarter, bounds.z + quarter, quarter));
64467
+ this.q5 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y - quarter, bounds.z + quarter, quarter));
64468
+ this.q6 = new TreeNode$1(new Bounds3$1(bounds.x - quarter, bounds.y + quarter, bounds.z + quarter, quarter));
64469
+ this.q7 = new TreeNode$1(new Bounds3$1(bounds.x + quarter, bounds.y + quarter, bounds.z + quarter, quarter));
64470
+ };
64471
+
64472
+ TreeNode$1.prototype.insert = function insert(idx, array, depth) {
64473
+ var isLeaf = this.q0 === null;
64474
+ if (isLeaf) {
64475
+ // TODO: this memory could be recycled to avoid GC
64476
+ if (this.items === null) {
64477
+ this.items = [idx];
64478
+ } else {
64479
+ this.items.push(idx);
64480
+ }
64481
+ if (this.items.length >= MAX_ITEMS && depth < 16) {
64482
+ this.subdivide();
64483
+ for (var i = 0; i < this.items.length; ++i) {
64484
+ this.insert(this.items[i], array, depth + 1);
64485
+ }
64486
+ this.items = null;
64487
+ }
64488
+ } else {
64489
+ var x = array[idx],
64490
+ y = array[idx + 1],
64491
+ z = array[idx + 2];
64492
+ var bounds = this.bounds;
64493
+ var quadIdx = 0; // assume NW
64494
+ if (x > bounds.x) {
64495
+ quadIdx += 1; // nope, we are in E part
64496
+ }
64497
+ if (y > bounds.y) {
64498
+ quadIdx += 2; // Somewhere south.
64499
+ }
64500
+ if (z > bounds.z) {
64501
+ quadIdx += 4; // Somewhere far
64502
+ }
64503
+
64504
+ var child = getChild(this, quadIdx);
64505
+ child.insert(idx, array, depth + 1);
64506
+ }
64507
+ };
64508
+
64509
+ TreeNode$1.prototype.query = function queryBounds(results, sourceArray, intersects, preciseCheck) {
64510
+ if (!intersects(this.bounds)) return;
64511
+ var items = this.items;
64512
+ var needsCheck = typeof preciseCheck === 'function';
64513
+ if (items) {
64514
+ for (var i = 0; i < items.length; ++i) {
64515
+ var idx = items[i];
64516
+ if (needsCheck) {
64517
+ if (preciseCheck(sourceArray[idx], sourceArray[idx + 1], sourceArray[idx + 2])) {
64518
+ results.push(idx);
64519
+ }
64520
+ } else {
64521
+ results.push(idx);
64522
+ }
64523
+ }
64524
+ }
64525
+
64526
+ if (!this.q0) return;
64527
+
64528
+ this.q0.query(results, sourceArray, intersects, preciseCheck);
64529
+ this.q1.query(results, sourceArray, intersects, preciseCheck);
64530
+ this.q2.query(results, sourceArray, intersects, preciseCheck);
64531
+ this.q3.query(results, sourceArray, intersects, preciseCheck);
64532
+ this.q4.query(results, sourceArray, intersects, preciseCheck);
64533
+ this.q5.query(results, sourceArray, intersects, preciseCheck);
64534
+ this.q6.query(results, sourceArray, intersects, preciseCheck);
64535
+ this.q7.query(results, sourceArray, intersects, preciseCheck);
64536
+ };
64537
+
64538
+ function getChild(node, idx) {
64539
+ if (idx === 0) return node.q0;
64540
+ if (idx === 1) return node.q1;
64541
+ if (idx === 2) return node.q2;
64542
+ if (idx === 3) return node.q3;
64543
+ if (idx === 4) return node.q4;
64544
+ if (idx === 5) return node.q5;
64545
+ if (idx === 6) return node.q6;
64546
+ if (idx === 7) return node.q7;
64547
+ }
64548
+
64549
+ var rafor = asyncFor$1;
64550
+
64551
+ /**
64552
+ * Iterates over array in async manner. This function attempts to maximize
64553
+ * number of elements visited within single event loop cycle, while at the
64554
+ * same time tries to not exceed a time threshold allowed to stay within
64555
+ * event loop.
64556
+ *
64557
+ * @param {Array} array which needs to be iterated. Array-like objects are OK too.
64558
+ * @param {VisitCalback} visitCallback called for every element within for loop.
64559
+ * @param {DoneCallback} doneCallback called when iterator has reached end of array.
64560
+ * @param {Object=} options - additional configuration:
64561
+ * @param {number} [options.step=1] - default iteration step
64562
+ * @param {number} [options.maxTimeMS=8] - maximum time (in milliseconds) which
64563
+ * iterator should spend within single event loop.
64564
+ * @param {number} [options.probeElements=5000] - how many elements should iterator
64565
+ * visit to measure its iteration speed.
64566
+ */
64567
+ function asyncFor$1(array, visitCallback, doneCallback, options) {
64568
+ var start = 0;
64569
+ var elapsed = 0;
64570
+ options = options || {};
64571
+ var step = options.step || 1;
64572
+ var maxTimeMS = options.maxTimeMS || 8;
64573
+ var pointsPerLoopCycle = options.probeElements || 5000;
64574
+ // we should never block main thread for too long...
64575
+ setTimeout(processSubset, 0);
64576
+
64577
+ function processSubset() {
64578
+ var finish = Math.min(array.length, start + pointsPerLoopCycle);
64579
+ var i = start;
64580
+ var timeStart = new Date();
64581
+ for (i = start; i < finish; i += step) {
64582
+ visitCallback(array[i], i, array);
64583
+ }
64584
+ if (i < array.length) {
64585
+ elapsed += (new Date() - timeStart);
64586
+ start = i;
64587
+
64588
+ pointsPerLoopCycle = Math.round(start * maxTimeMS/elapsed);
64589
+ setTimeout(processSubset, 0);
64590
+ } else {
64591
+ doneCallback(array);
64592
+ }
64593
+ }
64594
+ }
64595
+
64596
+ /**
64597
+ * Represents octree data structure
64598
+ *
64599
+ * https://en.wikipedia.org/wiki/Octree
64600
+ */
64601
+
64602
+ var Bounds3 = bounds3;
64603
+ var TreeNode = treeNode;
64604
+ var EmptyRegion = new Bounds3();
64605
+ var asyncFor = rafor;
64606
+
64607
+ var yaot = createTree;
64608
+
64609
+ function createTree(options) {
64610
+ var noPoints = [];
64611
+
64612
+ var root;
64613
+ var originalArray;
64614
+ var api = {
64615
+ /**
64616
+ * Initializes tree asynchronously. Very useful when you have millions
64617
+ * of points and do not want to block rendering thread for too long.
64618
+ *
64619
+ * @param {number[]} points array of points for which we are building the
64620
+ * tree. Flat sequence of (x, y, z) coordinates. Array length should be
64621
+ * multiple of 3.
64622
+ *
64623
+ * @param {Function=} doneCallback called when tree is initialized. The
64624
+ * callback will be called with single argument which represent current
64625
+ * tree.
64626
+ */
64627
+ initAsync: initAsync,
64628
+
64629
+ /**
64630
+ * Synchronous version of `initAsync()`. Should only be used for small
64631
+ * trees (less than 50-70k of points).
64632
+ *
64633
+ * @param {number[]} points array of points for which we are building the
64634
+ * tree. Flat sequence of (x, y, z) coordinates. Array length should be
64635
+ * multiple of 3.
64636
+ */
64637
+ init: init,
64638
+
64639
+ /**
64640
+ * Gets bounds of the root node. Bounds are represented by center of the
64641
+ * node (x, y, z) and `half` attribute - distance from the center to an
64642
+ * edge of the root node.
64643
+ */
64644
+ bounds: getBounds,
64645
+
64646
+ /**
64647
+ * Fires a ray from `rayOrigin` into `rayDirection` and collects all points
64648
+ * that lie in the octants intersected by the ray.
64649
+ *
64650
+ * This method implements An Efficient Parametric Algorithm for Octree Traversal
64651
+ * described in http://wscg.zcu.cz/wscg2000/Papers_2000/X31.pdf
64652
+ *
64653
+ * @param {Vector3} rayOrigin x,y,z coordinates where ray starts
64654
+ * @param {Vector3} rayDirection normalized x,y,z direction where ray shoots.
64655
+ * @param {number+} near minimum distance from the ray origin. 0 by default.
64656
+ * @param {number+} far maximum length of the ray. POSITIVE_INFINITY by default
64657
+ *
64658
+ * @return {Array} of indices in the source array. Each index represnts a start
64659
+ * of the x,y,z triplet of a point, that lies in the intersected octant.
64660
+ */
64661
+ intersectRay: intersectRay,
64662
+
64663
+ /**
64664
+ * Once you have collected points from the octants intersected by a ray
64665
+ * (`intersectRay()` method), it may be worth to query points from the surrouning
64666
+ * area.
64667
+ */
64668
+ intersectSphere: intersectSphere,
64669
+
64670
+ /**
64671
+ * Gets root node of the tree
64672
+ */
64673
+ getRoot: getRoot
64674
+ };
64675
+
64676
+ return api;
64677
+
64678
+ function getRoot() {
64679
+ return root;
64680
+ }
64681
+
64682
+ function intersectSphere(cx, cy, cz, r) {
64683
+ if (!root) {
64684
+ // Most likely we are not initialized yet
64685
+ return noPoints;
64686
+ }
64687
+ var indices = [];
64688
+ var r2 = r * r;
64689
+ root.query(indices, originalArray, intersectCheck, preciseCheck);
64690
+ return indices;
64691
+
64692
+ // http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test
64693
+ function intersectCheck(candidate) {
64694
+ var dist = r2;
64695
+ var half = candidate.half;
64696
+ if (cx < candidate.x - half) dist -= sqr(cx - (candidate.x - half));
64697
+ else if (cx > candidate.x + half) dist -= sqr(cx - (candidate.x + half));
64698
+
64699
+ if (cy < candidate.y - half) dist -= sqr(cy - (candidate.y - half));
64700
+ else if (cy > candidate.y + half) dist -= sqr(cy - (candidate.y + half));
64701
+
64702
+ if (cz < candidate.z - half) dist -= sqr(cz - (candidate.z - half));
64703
+ else if (cz > candidate.z + half) dist -= sqr(cz - (candidate.z + half));
64704
+ return dist > 0;
64705
+ }
64706
+
64707
+ function preciseCheck(x, y, z) {
64708
+ return sqr(x - cx) + sqr(y - cy) + sqr(z - cz) < r2;
64709
+ }
64710
+ }
64711
+
64712
+ function sqr(x) {
64713
+ return x * x;
64714
+ }
64715
+
64716
+ function intersectRay(rayOrigin, rayDirection, near, far) {
64717
+ if (!root) {
64718
+ // Most likely we are not initialized yet
64719
+ return noPoints;
64720
+ }
64721
+
64722
+ if (near === undefined) near = 0;
64723
+ if (far === undefined) far = Number.POSITIVE_INFINITY;
64724
+ // we save as squar, to avoid expensive sqrt() operation
64725
+ near *= near;
64726
+ far *= far;
64727
+
64728
+ var indices = [];
64729
+ root.query(indices, originalArray, intersectCheck, farEnough);
64730
+ return indices.sort(byDistanceToCamera);
64731
+
64732
+ function intersectCheck(candidate) {
64733
+ // using http://wscg.zcu.cz/wscg2000/Papers_2000/X31.pdf
64734
+ var half = candidate.half;
64735
+ var t1 = (candidate.x - half - rayOrigin.x) / rayDirection.x,
64736
+ t2 = (candidate.x + half - rayOrigin.x) / rayDirection.x,
64737
+ t3 = (candidate.y + half - rayOrigin.y) / rayDirection.y,
64738
+ t4 = (candidate.y - half - rayOrigin.y) / rayDirection.y,
64739
+ t5 = (candidate.z - half - rayOrigin.z) / rayDirection.z,
64740
+ t6 = (candidate.z + half - rayOrigin.z) / rayDirection.z,
64741
+ tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)),
64742
+ tmin;
64743
+
64744
+ if (tmax < 0) return false;
64745
+
64746
+ tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6));
64747
+ return tmin <= tmax && tmin <= far;
64748
+ }
64749
+
64750
+ function farEnough(x, y, z) {
64751
+ var dist = (x - rayOrigin.x) * (x - rayOrigin.x) +
64752
+ (y - rayOrigin.y) * (y - rayOrigin.y) +
64753
+ (z - rayOrigin.z) * (z - rayOrigin.z);
64754
+ return near <= dist && dist <= far;
64755
+ }
64756
+
64757
+ function byDistanceToCamera(idx0, idx1) {
64758
+ var x0 = rayOrigin[idx0];
64759
+ var y0 = rayOrigin[idx0 + 1];
64760
+ var z0 = rayOrigin[idx0 + 2];
64761
+ var dist0 = (x0 - rayOrigin.x) * (x0 - rayOrigin.x) +
64762
+ (y0 - rayOrigin.y) * (y0 - rayOrigin.y) +
64763
+ (z0 - rayOrigin.z) * (z0 - rayOrigin.z);
64764
+
64765
+ var x1 = rayOrigin[idx1];
64766
+ var y1 = rayOrigin[idx1 + 1];
64767
+ var z1 = rayOrigin[idx1 + 2];
64768
+
64769
+ var dist1 = (x1 - rayOrigin.x) * (x1 - rayOrigin.x) +
64770
+ (y1 - rayOrigin.y) * (y1 - rayOrigin.y) +
64771
+ (z1 - rayOrigin.z) * (z1 - rayOrigin.z);
64772
+ return dist0 - dist1;
64773
+ }
64774
+ }
64775
+
64776
+ function init(points) {
64777
+ verifyPointsInvariant(points);
64778
+ originalArray = points;
64779
+ root = createRootNode(points);
64780
+ for (var i = 0; i < points.length; i += 3) {
64781
+ root.insert(i, originalArray, 0);
64782
+ }
64783
+ }
64784
+
64785
+ function initAsync(points, doneCallback) {
64786
+ verifyPointsInvariant(points);
64787
+
64788
+ var tempRoot = createRootNode(points);
64789
+ asyncFor(points, insertToRoot, doneInternal, { step: 3 });
64790
+
64791
+ function insertToRoot(element, i) {
64792
+ tempRoot.insert(i, points, 0);
64793
+ }
64794
+
64795
+ function doneInternal() {
64796
+ originalArray = points;
64797
+ root = tempRoot;
64798
+ if (typeof doneCallback === 'function') {
64799
+ doneCallback(api);
64800
+ }
64801
+ }
64802
+ }
64803
+
64804
+ function verifyPointsInvariant(points) {
64805
+ if (!points) throw new Error('Points array is required for quadtree to work');
64806
+ if (typeof points.length !== 'number') throw new Error('Points should be array-like object');
64807
+ if (points.length % 3 !== 0) throw new Error('Points array should consist of series of x,y,z coordinates and be multiple of 3');
64808
+ }
64809
+
64810
+ function getBounds() {
64811
+ if (!root) return EmptyRegion;
64812
+ return root.bounds;
64813
+ }
64814
+
64815
+ function createRootNode(points) {
64816
+ // Edge case deserves empty region:
64817
+ if (points.length === 0) {
64818
+ var empty = new Bounds3();
64819
+ return new TreeNode(empty);
64820
+ }
64821
+
64822
+ // Otherwise let's figure out how big should be the root region
64823
+ var minX = Number.POSITIVE_INFINITY;
64824
+ var minY = Number.POSITIVE_INFINITY;
64825
+ var minZ = Number.POSITIVE_INFINITY;
64826
+ var maxX = Number.NEGATIVE_INFINITY;
64827
+ var maxY = Number.NEGATIVE_INFINITY;
64828
+ var maxZ = Number.NEGATIVE_INFINITY;
64829
+ for (var i = 0; i < points.length; i += 3) {
64830
+ var x = points[i],
64831
+ y = points[i + 1],
64832
+ z = points[i + 2];
64833
+ if (x < minX) minX = x;
64834
+ if (x > maxX) maxX = x;
64835
+ if (y < minY) minY = y;
64836
+ if (y > maxY) maxY = y;
64837
+ if (z < minZ) minZ = z;
64838
+ if (z > maxZ) maxZ = z;
64839
+ }
64840
+
64841
+ // Make bounds square:
64842
+ var side = Math.max(Math.max(maxX - minX, maxY - minY), maxZ - minZ);
64843
+ // since we need to have both sides inside the area, let's artificially
64844
+ // grow the root region:
64845
+ side += 2;
64846
+ minX -= 1;
64847
+ minY -= 1;
64848
+ minZ -= 1;
64849
+ var half = side / 2;
64850
+
64851
+ var bounds = new Bounds3(minX + half, minY + half, minZ + half, half);
64852
+ return new TreeNode(bounds);
64853
+ }
64854
+ }
64855
+
64856
+ var yaOctree = /*@__PURE__*/getDefaultExportFromCjs(yaot);
64857
+
64304
64858
  const THREE$2$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64305
64859
  : {
64306
64860
  Box3,
@@ -64315,7 +64869,7 @@
64315
64869
  };
64316
64870
 
64317
64871
  // support multiple method names for backwards threejs compatibility
64318
- var setAttributeFn$1$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64872
+ var setAttributeFn$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
64319
64873
  const _box$1 = new THREE$2$1.Box3();
64320
64874
  const _vector = new THREE$2$1.Vector3();
64321
64875
  class LineSegmentsGeometry extends THREE$2$1.InstancedBufferGeometry {
@@ -64326,8 +64880,8 @@
64326
64880
  const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
64327
64881
  const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
64328
64882
  this.setIndex(index);
64329
- this[setAttributeFn$1$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
64330
- this[setAttributeFn$1$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
64883
+ this[setAttributeFn$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
64884
+ this[setAttributeFn$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
64331
64885
  }
64332
64886
  applyMatrix4(matrix) {
64333
64887
  const start = this.attributes.instanceStart;
@@ -64354,9 +64908,9 @@
64354
64908
  }
64355
64909
  const instanceBuffer = new THREE$2$1.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz
64356
64910
 
64357
- this[setAttributeFn$1$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
64911
+ this[setAttributeFn$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
64358
64912
 
64359
- this[setAttributeFn$1$1]('instanceEnd', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz
64913
+ this[setAttributeFn$1]('instanceEnd', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz
64360
64914
  //
64361
64915
 
64362
64916
  this.computeBoundingBox();
@@ -64372,9 +64926,9 @@
64372
64926
  }
64373
64927
  const instanceColorBuffer = new THREE$2$1.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb
64374
64928
 
64375
- this[setAttributeFn$1$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
64929
+ this[setAttributeFn$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
64376
64930
 
64377
- this[setAttributeFn$1$1]('instanceColorEnd', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb
64931
+ this[setAttributeFn$1]('instanceColorEnd', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb
64378
64932
 
64379
64933
  return this;
64380
64934
  }
@@ -64989,7 +65543,7 @@
64989
65543
  }
64990
65544
  LineMaterial.prototype.isLineMaterial = true;
64991
65545
 
64992
- const THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65546
+ const THREE$j = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64993
65547
  : {
64994
65548
  Box3,
64995
65549
  BufferGeometry,
@@ -65005,20 +65559,20 @@
65005
65559
  };
65006
65560
 
65007
65561
  // support both modes for backwards threejs compatibility
65008
- var setAttributeFn$2 = new THREE$h.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
65009
- const _start = new THREE$h.Vector3();
65010
- const _end = new THREE$h.Vector3();
65011
- const _start4 = new THREE$h.Vector4();
65012
- const _end4 = new THREE$h.Vector4();
65013
- const _ssOrigin = new THREE$h.Vector4();
65014
- const _ssOrigin3 = new THREE$h.Vector3();
65015
- const _mvMatrix = new THREE$h.Matrix4();
65016
- const _line = new THREE$h.Line3();
65017
- const _closestPoint = new THREE$h.Vector3();
65018
- const _box = new THREE$h.Box3();
65019
- const _sphere = new THREE$h.Sphere();
65020
- const _clipToWorldVector = new THREE$h.Vector4();
65021
- class LineSegments2 extends THREE$h.Mesh {
65562
+ var setAttributeFn = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
65563
+ const _start = new THREE$j.Vector3();
65564
+ const _end = new THREE$j.Vector3();
65565
+ const _start4 = new THREE$j.Vector4();
65566
+ const _end4 = new THREE$j.Vector4();
65567
+ const _ssOrigin = new THREE$j.Vector4();
65568
+ const _ssOrigin3 = new THREE$j.Vector3();
65569
+ const _mvMatrix = new THREE$j.Matrix4();
65570
+ const _line = new THREE$j.Line3();
65571
+ const _closestPoint = new THREE$j.Vector3();
65572
+ const _box = new THREE$j.Box3();
65573
+ const _sphere = new THREE$j.Sphere();
65574
+ const _clipToWorldVector = new THREE$j.Vector4();
65575
+ class LineSegments2 extends THREE$j.Mesh {
65022
65576
  constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
65023
65577
  color: Math.random() * 0xffffff
65024
65578
  })) {
@@ -65037,11 +65591,11 @@
65037
65591
  lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
65038
65592
  lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
65039
65593
  }
65040
- const instanceDistanceBuffer = new THREE$h.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
65594
+ const instanceDistanceBuffer = new THREE$j.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
65041
65595
 
65042
- geometry[setAttributeFn$2]('instanceDistanceStart', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
65596
+ geometry[setAttributeFn]('instanceDistanceStart', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
65043
65597
 
65044
- geometry[setAttributeFn$2]('instanceDistanceEnd', new THREE$h.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
65598
+ geometry[setAttributeFn]('instanceDistanceEnd', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
65045
65599
 
65046
65600
  return this;
65047
65601
  }
@@ -65163,7 +65717,7 @@
65163
65717
  const param = _line.closestPointToPointParameter(_ssOrigin3, true);
65164
65718
  _line.at(param, _closestPoint); // check if the intersection point is within clip space
65165
65719
 
65166
- const zPos = THREE$h.MathUtils.lerp(_start4.z, _end4.z, param);
65720
+ const zPos = THREE$j.MathUtils.lerp(_start4.z, _end4.z, param);
65167
65721
  const isInClipSpace = zPos >= -1 && zPos <= 1;
65168
65722
  const isInside = _ssOrigin3.distanceTo(_closestPoint) < lineWidth * 0.5;
65169
65723
  if (isInClipSpace && isInside) {
@@ -65171,8 +65725,8 @@
65171
65725
  _line.end.fromBufferAttribute(instanceEnd, i);
65172
65726
  _line.start.applyMatrix4(matrixWorld);
65173
65727
  _line.end.applyMatrix4(matrixWorld);
65174
- const pointOnLine = new THREE$h.Vector3();
65175
- const point = new THREE$h.Vector3();
65728
+ const pointOnLine = new THREE$j.Vector3();
65729
+ const point = new THREE$j.Vector3();
65176
65730
  ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
65177
65731
  intersects.push({
65178
65732
  point: point,
@@ -65443,53 +65997,53 @@
65443
65997
 
65444
65998
  }
65445
65999
 
65446
- function _iterableToArrayLimit$1(arr, i) {
65447
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
65448
- if (null != _i) {
65449
- var _s,
65450
- _e,
65451
- _x,
65452
- _r,
65453
- _arr = [],
65454
- _n = !0,
65455
- _d = !1;
66000
+ function _iterableToArrayLimit$1(r, l) {
66001
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
66002
+ if (null != t) {
66003
+ var e,
66004
+ n,
66005
+ i,
66006
+ u,
66007
+ a = [],
66008
+ f = !0,
66009
+ o = !1;
65456
66010
  try {
65457
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
65458
- if (Object(_i) !== _i) return;
65459
- _n = !1;
65460
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
65461
- } catch (err) {
65462
- _d = !0, _e = err;
66011
+ if (i = (t = t.call(r)).next, 0 === l) {
66012
+ if (Object(t) !== t) return;
66013
+ f = !1;
66014
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
66015
+ } catch (r) {
66016
+ o = !0, n = r;
65463
66017
  } finally {
65464
66018
  try {
65465
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
66019
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
65466
66020
  } finally {
65467
- if (_d) throw _e;
66021
+ if (o) throw n;
65468
66022
  }
65469
66023
  }
65470
- return _arr;
66024
+ return a;
65471
66025
  }
65472
66026
  }
65473
- function ownKeys$1(object, enumerableOnly) {
65474
- var keys = Object.keys(object);
66027
+ function ownKeys$1(e, r) {
66028
+ var t = Object.keys(e);
65475
66029
  if (Object.getOwnPropertySymbols) {
65476
- var symbols = Object.getOwnPropertySymbols(object);
65477
- enumerableOnly && (symbols = symbols.filter(function (sym) {
65478
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65479
- })), keys.push.apply(keys, symbols);
66030
+ var o = Object.getOwnPropertySymbols(e);
66031
+ r && (o = o.filter(function (r) {
66032
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
66033
+ })), t.push.apply(t, o);
65480
66034
  }
65481
- return keys;
65482
- }
65483
- function _objectSpread2$1(target) {
65484
- for (var i = 1; i < arguments.length; i++) {
65485
- var source = null != arguments[i] ? arguments[i] : {};
65486
- i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
65487
- _defineProperty$2(target, key, source[key]);
65488
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
65489
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
66035
+ return t;
66036
+ }
66037
+ function _objectSpread2$1(e) {
66038
+ for (var r = 1; r < arguments.length; r++) {
66039
+ var t = null != arguments[r] ? arguments[r] : {};
66040
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
66041
+ _defineProperty$2(e, r, t[r]);
66042
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
66043
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
65490
66044
  });
65491
66045
  }
65492
- return target;
66046
+ return e;
65493
66047
  }
65494
66048
  function _classCallCheck(instance, Constructor) {
65495
66049
  if (!(instance instanceof Constructor)) {
@@ -65685,6 +66239,56 @@
65685
66239
  var key = _toPrimitive$2(arg, "string");
65686
66240
  return typeof key === "symbol" ? key : String(key);
65687
66241
  }
66242
+ function _classPrivateFieldGet(receiver, privateMap) {
66243
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
66244
+ return _classApplyDescriptorGet(receiver, descriptor);
66245
+ }
66246
+ function _classPrivateFieldSet(receiver, privateMap, value) {
66247
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
66248
+ _classApplyDescriptorSet(receiver, descriptor, value);
66249
+ return value;
66250
+ }
66251
+ function _classExtractFieldDescriptor(receiver, privateMap, action) {
66252
+ if (!privateMap.has(receiver)) {
66253
+ throw new TypeError("attempted to " + action + " private field on non-instance");
66254
+ }
66255
+ return privateMap.get(receiver);
66256
+ }
66257
+ function _classApplyDescriptorGet(receiver, descriptor) {
66258
+ if (descriptor.get) {
66259
+ return descriptor.get.call(receiver);
66260
+ }
66261
+ return descriptor.value;
66262
+ }
66263
+ function _classApplyDescriptorSet(receiver, descriptor, value) {
66264
+ if (descriptor.set) {
66265
+ descriptor.set.call(receiver, value);
66266
+ } else {
66267
+ if (!descriptor.writable) {
66268
+ throw new TypeError("attempted to set read only private field");
66269
+ }
66270
+ descriptor.value = value;
66271
+ }
66272
+ }
66273
+ function _classPrivateMethodGet(receiver, privateSet, fn) {
66274
+ if (!privateSet.has(receiver)) {
66275
+ throw new TypeError("attempted to get private field on non-instance");
66276
+ }
66277
+ return fn;
66278
+ }
66279
+ function _checkPrivateRedeclaration(obj, privateCollection) {
66280
+ if (privateCollection.has(obj)) {
66281
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
66282
+ }
66283
+ }
66284
+ function _classPrivateFieldInitSpec(obj, privateMap, value) {
66285
+ _checkPrivateRedeclaration(obj, privateMap);
66286
+ privateMap.set(obj, value);
66287
+ }
66288
+ function _classPrivateMethodInitSpec(obj, privateSet) {
66289
+ _checkPrivateRedeclaration(obj, privateSet);
66290
+ privateSet.add(obj);
66291
+ }
65688
66292
 
65689
66293
  var materialDispose = function materialDispose(material) {
65690
66294
  if (material instanceof Array) {
@@ -65781,7 +66385,7 @@
65781
66385
  return deg * Math.PI / 180;
65782
66386
  }
65783
66387
 
65784
- var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66388
+ var THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65785
66389
  : {
65786
66390
  BackSide: BackSide,
65787
66391
  BufferAttribute: BufferAttribute,
@@ -65801,7 +66405,7 @@
65801
66405
 
65802
66406
  // Based off: http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
65803
66407
  function createGlowMaterial(coefficient, color, power) {
65804
- return new THREE$f.ShaderMaterial({
66408
+ return new THREE$h.ShaderMaterial({
65805
66409
  depthWrite: false,
65806
66410
  fragmentShader: fragmentShader,
65807
66411
  transparent: true,
@@ -65810,7 +66414,7 @@
65810
66414
  value: coefficient
65811
66415
  },
65812
66416
  color: {
65813
- value: new THREE$f.Color(color)
66417
+ value: new THREE$h.Color(color)
65814
66418
  },
65815
66419
  power: {
65816
66420
  value: power
@@ -65830,7 +66434,7 @@
65830
66434
  var curPos = geometry.attributes.position.array[idx];
65831
66435
  position[idx] = curPos + normal * size;
65832
66436
  }
65833
- glowGeometry.setAttribute('position', new THREE$f.BufferAttribute(position, 3));
66437
+ glowGeometry.setAttribute('position', new THREE$h.BufferAttribute(position, 3));
65834
66438
  return glowGeometry;
65835
66439
  }
65836
66440
  function createGlowMesh(geometry) {
@@ -65843,12 +66447,12 @@
65843
66447
  var glowGeometry = createGlowGeometry(geometry, size);
65844
66448
  var glowMaterial = createGlowMaterial(coefficient, color, power);
65845
66449
  if (backside) {
65846
- glowMaterial.side = THREE$f.BackSide;
66450
+ glowMaterial.side = THREE$h.BackSide;
65847
66451
  }
65848
- return new THREE$f.Mesh(glowGeometry, glowMaterial);
66452
+ return new THREE$h.Mesh(glowGeometry, glowMaterial);
65849
66453
  }
65850
66454
 
65851
- var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66455
+ var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65852
66456
  : {
65853
66457
  Color: Color$1,
65854
66458
  LineBasicMaterial: LineBasicMaterial,
@@ -65913,17 +66517,16 @@
65913
66517
  },
65914
66518
  stateInit: function stateInit() {
65915
66519
  // create globe
65916
- var globeGeometry = new THREE$e.SphereGeometry(GLOBE_RADIUS, 75, 75);
65917
- var defaultGlobeMaterial = new THREE$e.MeshPhongMaterial({
65918
- color: 0x000000,
65919
- transparent: true
66520
+ var globeGeometry = new THREE$g.SphereGeometry(GLOBE_RADIUS, 75, 75);
66521
+ var defaultGlobeMaterial = new THREE$g.MeshPhongMaterial({
66522
+ color: 0x000000
65920
66523
  });
65921
- var globeObj = new THREE$e.Mesh(globeGeometry, defaultGlobeMaterial);
66524
+ var globeObj = new THREE$g.Mesh(globeGeometry, defaultGlobeMaterial);
65922
66525
  globeObj.rotation.y = -Math.PI / 2; // face prime meridian along Z axis
65923
66526
  globeObj.__globeObjType = 'globe'; // Add object type
65924
66527
 
65925
66528
  // create graticules
65926
- var graticulesObj = new THREE$e.LineSegments(new GeoJsonGeometry(graticule10(), GLOBE_RADIUS, 2), new THREE$e.LineBasicMaterial({
66529
+ var graticulesObj = new THREE$g.LineSegments(new GeoJsonGeometry(graticule10(), GLOBE_RADIUS, 2), new THREE$g.LineBasicMaterial({
65927
66530
  color: 'lightgrey',
65928
66531
  transparent: true,
65929
66532
  opacity: 0.1
@@ -65950,10 +66553,10 @@
65950
66553
  if (changedProps.hasOwnProperty('globeImageUrl')) {
65951
66554
  if (!state.globeImageUrl) {
65952
66555
  // Black globe if no image
65953
- !globeMaterial.color && (globeMaterial.color = new THREE$e.Color(0x000000));
66556
+ !globeMaterial.color && (globeMaterial.color = new THREE$g.Color(0x000000));
65954
66557
  } else {
65955
- new THREE$e.TextureLoader().load(state.globeImageUrl, function (texture) {
65956
- texture.colorSpace = THREE$e.SRGBColorSpace;
66558
+ new THREE$g.TextureLoader().load(state.globeImageUrl, function (texture) {
66559
+ texture.colorSpace = THREE$g.SRGBColorSpace;
65957
66560
  globeMaterial.map = texture;
65958
66561
  globeMaterial.color = null;
65959
66562
  globeMaterial.needsUpdate = true;
@@ -65968,7 +66571,7 @@
65968
66571
  globeMaterial.bumpMap = null;
65969
66572
  globeMaterial.needsUpdate = true;
65970
66573
  } else {
65971
- state.bumpImageUrl && new THREE$e.TextureLoader().load(state.bumpImageUrl, function (texture) {
66574
+ state.bumpImageUrl && new THREE$g.TextureLoader().load(state.bumpImageUrl, function (texture) {
65972
66575
  globeMaterial.bumpMap = texture;
65973
66576
  globeMaterial.needsUpdate = true;
65974
66577
  });
@@ -66006,15 +66609,30 @@
66006
66609
  return isNaN(str) ? parseInt(tinycolor(str).toHex(), 16) : str;
66007
66610
  };
66008
66611
  var colorAlpha = function colorAlpha(str) {
66009
- return isNaN(str) ? tinycolor(str).getAlpha() : 1;
66612
+ return str && isNaN(str) ? color(str).opacity : 1;
66010
66613
  };
66011
66614
  var color2ShaderArr = function color2ShaderArr(str) {
66012
66615
  var includeAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
66013
- var rgba = tinycolor(str).toRgb();
66014
- var rgbArr = ['r', 'g', 'b'].map(function (d) {
66015
- return rgba[d] / 255;
66016
- });
66017
- return includeAlpha ? [].concat(_toConsumableArray$2(rgbArr), [rgba.a]) : rgbArr;
66616
+ var sRGBColorSpace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66617
+ var color;
66618
+ var alpha = 1;
66619
+ var rgbaMatch = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(str.trim().toLowerCase());
66620
+ if (rgbaMatch) {
66621
+ var _rgbaMatch$slice = rgbaMatch.slice(1),
66622
+ _rgbaMatch$slice2 = _slicedToArray$1(_rgbaMatch$slice, 4),
66623
+ r = _rgbaMatch$slice2[0],
66624
+ g = _rgbaMatch$slice2[1],
66625
+ b = _rgbaMatch$slice2[2],
66626
+ a = _rgbaMatch$slice2[3];
66627
+ color = new Color$1("rgb(".concat(+r, ",").concat(+g, ",").concat(+b, ")"));
66628
+ alpha = Math.min(+a, 1);
66629
+ } else {
66630
+ color = new Color$1(str);
66631
+ }
66632
+ sRGBColorSpace && color.convertLinearToSRGB(); // vertexColors expects linear, but shaders expect sRGB
66633
+
66634
+ var rgbArr = color.toArray();
66635
+ return includeAlpha ? [].concat(_toConsumableArray$2(rgbArr), [alpha]) : rgbArr;
66018
66636
  };
66019
66637
  function setMaterialOpacity(material, opacity, depthWrite) {
66020
66638
  material.opacity = opacity;
@@ -66024,6 +66642,29 @@
66024
66642
  return material;
66025
66643
  }
66026
66644
 
66645
+ var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66646
+ : {
66647
+ Float32BufferAttribute: Float32BufferAttribute
66648
+ };
66649
+ function array2BufferAttr(data, itemSize) {
66650
+ var BufferAttributeClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : THREE$f.Float32BufferAttribute;
66651
+ var ba = new BufferAttributeClass(data.length * itemSize, itemSize);
66652
+ itemSize === 1 ? data.forEach(function (val, idx) {
66653
+ return ba.setX(idx, val);
66654
+ }) : data.forEach(function (val, idx) {
66655
+ return ba.set(val, idx * itemSize);
66656
+ });
66657
+ return ba;
66658
+ }
66659
+ function bufferAttr2Array(ba) {
66660
+ var itemSize = ba.itemSize;
66661
+ var res = [];
66662
+ for (var i = 0; i < ba.count; i++) {
66663
+ res.push(ba.array.slice(i * itemSize, (i + 1) * itemSize));
66664
+ }
66665
+ return res;
66666
+ }
66667
+
66027
66668
  function threeDigest(data, scene) {
66028
66669
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
66029
66670
  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
@@ -66043,15 +66684,13 @@
66043
66684
  }, options));
66044
66685
  }
66045
66686
 
66046
- var THREE$d = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66687
+ var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66047
66688
  : {
66048
- BufferAttribute: BufferAttribute,
66049
66689
  BufferGeometry: BufferGeometry,
66050
66690
  Color: Color$1,
66051
66691
  CylinderGeometry: CylinderGeometry,
66052
66692
  Matrix4: Matrix4,
66053
66693
  Mesh: Mesh,
66054
- MeshBasicMaterial: MeshBasicMaterial,
66055
66694
  MeshLambertMaterial: MeshLambertMaterial,
66056
66695
  Object3D: Object3D,
66057
66696
  Vector3: Vector3
@@ -66061,8 +66700,6 @@
66061
66700
 
66062
66701
  //
66063
66702
 
66064
- // support multiple method names for backwards threejs compatibility
66065
- var applyMatrix4Fn$1 = new THREE$d.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
66066
66703
  var PointsLayerKapsule = index$2({
66067
66704
  props: {
66068
66705
  pointsData: {
@@ -66117,13 +66754,13 @@
66117
66754
  var colorAccessor = index$1(state.pointColor);
66118
66755
 
66119
66756
  // shared geometry
66120
- var pointGeometry = new THREE$d.CylinderGeometry(1, 1, 1, state.pointResolution);
66121
- pointGeometry[applyMatrix4Fn$1](new THREE$d.Matrix4().makeRotationX(Math.PI / 2));
66122
- pointGeometry[applyMatrix4Fn$1](new THREE$d.Matrix4().makeTranslation(0, 0, -0.5));
66757
+ var pointGeometry = new THREE$e.CylinderGeometry(1, 1, 1, state.pointResolution);
66758
+ pointGeometry.applyMatrix4(new THREE$e.Matrix4().makeRotationX(Math.PI / 2));
66759
+ pointGeometry.applyMatrix4(new THREE$e.Matrix4().makeTranslation(0, 0, -0.5));
66123
66760
  var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
66124
66761
  var pointMaterials = {}; // indexed by color
66125
66762
 
66126
- var scene = state.pointsMerge ? new THREE$d.Object3D() : state.scene; // use fake scene if merging points
66763
+ var scene = state.pointsMerge ? new THREE$e.Object3D() : state.scene; // use fake scene if merging points
66127
66764
 
66128
66765
  threeDigest(state.pointsData, scene, {
66129
66766
  createObj: createObj,
@@ -66131,7 +66768,7 @@
66131
66768
  });
66132
66769
  if (state.pointsMerge) {
66133
66770
  // merge points into a single mesh
66134
- var pointsGeometry = !state.pointsData.length ? new THREE$d.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
66771
+ var pointsGeometry = !state.pointsData.length ? new THREE$e.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
66135
66772
  var obj = d.__threeObj;
66136
66773
  d.__threeObj = undefined; // unbind merged points
66137
66774
 
@@ -66139,23 +66776,18 @@
66139
66776
 
66140
66777
  // apply mesh world transform to vertices
66141
66778
  obj.updateMatrix();
66142
- geom[applyMatrix4Fn$1](obj.matrix);
66779
+ geom.applyMatrix4(obj.matrix);
66143
66780
 
66144
66781
  // color vertices
66145
- var color = new THREE$d.Color(colorAccessor(d));
66146
- var nVertices = geom.attributes.position.count;
66147
- var colors = new Float32Array(nVertices * 3);
66148
- for (var i = 0, len = nVertices; i < len; i++) {
66149
- var idx = i * 3;
66150
- colors[idx] = color.r;
66151
- colors[idx + 1] = color.g;
66152
- colors[idx + 2] = color.b;
66153
- }
66154
- geom.setAttribute('color', new THREE$d.BufferAttribute(colors, 3));
66782
+ var color = color2ShaderArr(colorAccessor(d));
66783
+ geom.setAttribute('color', array2BufferAttr(_toConsumableArray$2(new Array(geom.getAttribute('position').count)).map(function () {
66784
+ return color;
66785
+ }), 4));
66155
66786
  return geom;
66156
66787
  }));
66157
- var points = new THREE$d.Mesh(pointsGeometry, new THREE$d.MeshBasicMaterial({
66788
+ var points = new THREE$e.Mesh(pointsGeometry, new THREE$e.MeshLambertMaterial({
66158
66789
  color: 0xffffff,
66790
+ transparent: true,
66159
66791
  vertexColors: true
66160
66792
  }));
66161
66793
  points.__globeObjType = 'points'; // Add object type
@@ -66168,7 +66800,7 @@
66168
66800
  //
66169
66801
 
66170
66802
  function createObj() {
66171
- var obj = new THREE$d.Mesh(pointGeometry);
66803
+ var obj = new THREE$e.Mesh(pointGeometry);
66172
66804
  obj.__globeObjType = 'point'; // Add object type
66173
66805
  return obj;
66174
66806
  }
@@ -66184,7 +66816,7 @@
66184
66816
  Object.assign(obj.position, polar2Cartesian(lat, lng));
66185
66817
 
66186
66818
  // orientate outwards
66187
- 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
66819
+ 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
66188
66820
  obj.lookAt(globeCenter);
66189
66821
 
66190
66822
  // scale radius and altitude
@@ -66220,7 +66852,7 @@
66220
66852
  obj.visible = showCyl;
66221
66853
  if (showCyl) {
66222
66854
  if (!pointMaterials.hasOwnProperty(color)) {
66223
- pointMaterials[color] = new THREE$d.MeshLambertMaterial({
66855
+ pointMaterials[color] = new THREE$e.MeshLambertMaterial({
66224
66856
  color: colorStr2Hex(color),
66225
66857
  transparent: opacity < 1,
66226
66858
  opacity: opacity
@@ -66234,12 +66866,11 @@
66234
66866
  });
66235
66867
 
66236
66868
  var _excluded$1 = ["stroke"];
66237
- var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66869
+ var THREE$d = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66238
66870
  : {
66239
66871
  BufferGeometry: BufferGeometry,
66240
66872
  CubicBezierCurve3: CubicBezierCurve3,
66241
66873
  Curve: Curve,
66242
- Float32BufferAttribute: Float32BufferAttribute,
66243
66874
  Group: Group$1,
66244
66875
  Line: Line,
66245
66876
  Mesh: Mesh,
@@ -66253,8 +66884,6 @@
66253
66884
 
66254
66885
  //
66255
66886
 
66256
- // support both modes for backwards threejs compatibility
66257
- var setAttributeFn$1 = new THREE$c.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
66258
66887
  var gradientShaders$1 = {
66259
66888
  uniforms: {
66260
66889
  // dash param defaults, all relative to full length
@@ -66339,15 +66968,15 @@
66339
66968
  methods: {
66340
66969
  pauseAnimation: function pauseAnimation(state) {
66341
66970
  var _state$ticker;
66342
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
66971
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
66343
66972
  },
66344
66973
  resumeAnimation: function resumeAnimation(state) {
66345
66974
  var _state$ticker2;
66346
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
66975
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
66347
66976
  },
66348
66977
  _destructor: function _destructor(state) {
66349
66978
  var _state$ticker3;
66350
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
66979
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
66351
66980
  }
66352
66981
  },
66353
66982
  init: function init(threeObj, state) {
@@ -66384,13 +67013,13 @@
66384
67013
  var dashGapAccessor = index$1(state.arcDashGap);
66385
67014
  var dashInitialGapAccessor = index$1(state.arcDashInitialGap);
66386
67015
  var dashAnimateTimeAccessor = index$1(state.arcDashAnimateTime);
66387
- var sharedMaterial = new THREE$c.ShaderMaterial(_objectSpread2$1(_objectSpread2$1({}, gradientShaders$1), {}, {
67016
+ var sharedMaterial = new THREE$d.ShaderMaterial(_objectSpread2$1(_objectSpread2$1({}, gradientShaders$1), {}, {
66388
67017
  transparent: true,
66389
- blending: THREE$c.NormalBlending
67018
+ blending: THREE$d.NormalBlending
66390
67019
  }));
66391
67020
  threeDigest(state.arcsData, state.scene, {
66392
67021
  createObj: function createObj() {
66393
- var obj = new THREE$c.Group(); // populated in updateObj
67022
+ var obj = new THREE$d.Group(); // populated in updateObj
66394
67023
 
66395
67024
  obj.__globeObjType = 'arc'; // Add object type
66396
67025
  return obj;
@@ -66401,7 +67030,7 @@
66401
67030
  if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
66402
67031
  // create or swap object types
66403
67032
  emptyObject(group);
66404
- var _obj = useTube ? new THREE$c.Mesh() : new THREE$c.Line(new THREE$c.BufferGeometry());
67033
+ var _obj = useTube ? new THREE$d.Mesh() : new THREE$d.Line(new THREE$d.BufferGeometry());
66405
67034
  _obj.material = sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
66406
67035
 
66407
67036
  group.add(_obj);
@@ -66441,8 +67070,8 @@
66441
67070
  true // run from end to start, to animate in the correct direction
66442
67071
  );
66443
67072
 
66444
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66445
- obj.geometry[setAttributeFn$1]('vertexRelDistance', vertexRelDistanceArray);
67073
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
67074
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
66446
67075
  var applyUpdate = function applyUpdate(td) {
66447
67076
  var _arc$__currentTargetD = arc.__currentTargetD = td,
66448
67077
  stroke = _arc$__currentTargetD.stroke,
@@ -66450,9 +67079,9 @@
66450
67079
  var curve = calcCurve(curveD);
66451
67080
  if (useTube) {
66452
67081
  obj.geometry && obj.geometry.dispose();
66453
- obj.geometry = new THREE$c.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
66454
- obj.geometry[setAttributeFn$1]('vertexColor', vertexColorArray);
66455
- obj.geometry[setAttributeFn$1]('vertexRelDistance', vertexRelDistanceArray);
67082
+ obj.geometry = new THREE$d.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
67083
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
67084
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
66456
67085
  } else {
66457
67086
  obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
66458
67087
  }
@@ -66501,7 +67130,7 @@
66501
67130
  x = _polar2Cartesian.x,
66502
67131
  y = _polar2Cartesian.y,
66503
67132
  z = _polar2Cartesian.z;
66504
- return new THREE$c.Vector3(x, y, z);
67133
+ return new THREE$d.Vector3(x, y, z);
66505
67134
  };
66506
67135
 
66507
67136
  //calculate curve
@@ -66510,7 +67139,7 @@
66510
67139
  var altitude = alt;
66511
67140
  (altitude === null || altitude === undefined) && (
66512
67141
  // by default set altitude proportional to the great-arc distance
66513
- altitude = geoDistance(startPnt, endPnt) / 2 * altAutoScale);
67142
+ altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale);
66514
67143
  if (altitude) {
66515
67144
  var interpolate = geoInterpolate(startPnt, endPnt);
66516
67145
  var _map = [0.25, 0.75].map(function (t) {
@@ -66519,7 +67148,7 @@
66519
67148
  _map2 = _slicedToArray$1(_map, 2),
66520
67149
  m1Pnt = _map2[0],
66521
67150
  m2Pnt = _map2[1];
66522
- var curve = _construct$1(THREE$c.CubicBezierCurve3, _toConsumableArray$2([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
67151
+ var curve = _construct$1(THREE$d.CubicBezierCurve3, _toConsumableArray$2([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
66523
67152
 
66524
67153
  //const mPnt = [...interpolate(0.5), altitude * 2];
66525
67154
  //curve = new THREE.QuadraticBezierCurve3(...[startPnt, mPnt, endPnt].map(getVec));
@@ -66539,9 +67168,9 @@
66539
67168
  return startVec.clone();
66540
67169
  } // points exactly overlap
66541
67170
  : function (t) {
66542
- 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));
67171
+ 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));
66543
67172
  };
66544
- var sphereArc = new THREE$c.Curve();
67173
+ var sphereArc = new THREE$d.Curve();
66545
67174
  sphereArc.getPoint = getGreatCirclePoint;
66546
67175
  return sphereArc;
66547
67176
  }
@@ -66559,51 +67188,48 @@
66559
67188
  .range(colors) : colors; // already interpolator fn
66560
67189
 
66561
67190
  getVertexColor = function getVertexColor(t) {
66562
- return color2ShaderArr(colorInterpolator(t));
67191
+ return color2ShaderArr(colorInterpolator(t), true, true);
66563
67192
  };
66564
67193
  } else {
66565
67194
  // single color, use constant
66566
- var vertexColor = color2ShaderArr(colors);
67195
+ var vertexColor = color2ShaderArr(colors, true, true);
66567
67196
  getVertexColor = function getVertexColor() {
66568
67197
  return vertexColor;
66569
67198
  };
66570
67199
  }
66571
- var vertexColorArray = new THREE$c.Float32BufferAttribute(numVerticesGroup * 4 * numVerticesPerSegment, 4);
67200
+ var vertexColors = [];
66572
67201
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66573
67202
  var _vertexColor = getVertexColor(v / (l - 1));
66574
67203
  for (var s = 0; s < numVerticesPerSegment; s++) {
66575
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * 4);
67204
+ vertexColors.push(_vertexColor);
66576
67205
  }
66577
67206
  }
66578
- return vertexColorArray;
67207
+ return array2BufferAttr(vertexColors, 4);
66579
67208
  }
66580
67209
  function calcVertexRelDistances(numSegments) {
66581
67210
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
66582
67211
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
66583
67212
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
66584
- var arrLen = numVerticesGroup * numVerticesPerSegment;
66585
- var vertexDistanceArray = new THREE$c.Float32BufferAttribute(arrLen, 1);
67213
+
67214
+ var vertexDistances = [];
66586
67215
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
66587
67216
  var relDistance = v / (l - 1);
66588
67217
  for (var s = 0; s < numVerticesPerSegment; s++) {
66589
- var idx = v * numVerticesPerSegment + s;
66590
- var pos = invert ? arrLen - 1 - idx : idx;
66591
- vertexDistanceArray.setX(pos, relDistance);
67218
+ vertexDistances.push(relDistance);
66592
67219
  }
66593
67220
  }
66594
- return vertexDistanceArray;
67221
+ invert && vertexDistances.reverse();
67222
+ return array2BufferAttr(vertexDistances, 1);
66595
67223
  }
66596
67224
  }
66597
67225
  });
66598
67226
 
66599
- var THREE$b = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
67227
+ var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66600
67228
  : {
66601
- BufferAttribute: BufferAttribute,
66602
67229
  BufferGeometry: BufferGeometry,
66603
67230
  Color: Color$1,
66604
67231
  DoubleSide: DoubleSide,
66605
67232
  Mesh: Mesh,
66606
- MeshBasicMaterial: MeshBasicMaterial,
66607
67233
  MeshLambertMaterial: MeshLambertMaterial,
66608
67234
  Object3D: Object3D
66609
67235
  };
@@ -66612,8 +67238,6 @@
66612
67238
 
66613
67239
  //
66614
67240
 
66615
- // support multiple method names for backwards threejs compatibility
66616
- var applyMatrix4Fn = new THREE$b.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
66617
67241
  var HexBinLayerKapsule = index$2({
66618
67242
  props: {
66619
67243
  hexBinPointsData: {
@@ -66701,7 +67325,7 @@
66701
67325
  });
66702
67326
  var hexMaterials = {}; // indexed by color
66703
67327
 
66704
- var scene = state.hexBinMerge ? new THREE$b.Object3D() : state.scene; // use fake scene if merging hex points
67328
+ var scene = state.hexBinMerge ? new THREE$c.Object3D() : state.scene; // use fake scene if merging hex points
66705
67329
 
66706
67330
  threeDigest(hexBins, scene, {
66707
67331
  createObj: createObj,
@@ -66712,7 +67336,7 @@
66712
67336
  });
66713
67337
  if (state.hexBinMerge) {
66714
67338
  // merge points into a single mesh
66715
- var hexPointsGeometry = !hexBins.length ? new THREE$b.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
67339
+ var hexPointsGeometry = !hexBins.length ? new THREE$c.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
66716
67340
  var obj = d.__threeObj;
66717
67341
  d.__threeObj = undefined; // unbind merged points
66718
67342
 
@@ -66721,28 +67345,23 @@
66721
67345
 
66722
67346
  // apply mesh world transform to vertices
66723
67347
  obj.updateMatrix();
66724
- geom[applyMatrix4Fn](obj.matrix);
67348
+ geom.applyMatrix4(obj.matrix);
66725
67349
 
66726
67350
  // color vertices
66727
- var topColor = new THREE$b.Color(topColorAccessor(d));
66728
- var sideColor = new THREE$b.Color(sideColorAccessor(d));
66729
- var nVertices = geom.attributes.position.count;
67351
+ var topColor = color2ShaderArr(topColorAccessor(d));
67352
+ var sideColor = color2ShaderArr(sideColorAccessor(d));
67353
+ var nVertices = geom.getAttribute('position').count;
66730
67354
  var topFaceIdx = geom.groups[0].count; // starting vertex index of top group
66731
- var colors = new Float32Array(nVertices * 3);
66732
- for (var i = 0, len = nVertices; i < len; i++) {
66733
- var idx = i * 3;
66734
- var c = i >= topFaceIdx ? topColor : sideColor;
66735
- colors[idx] = c.r;
66736
- colors[idx + 1] = c.g;
66737
- colors[idx + 2] = c.b;
66738
- }
66739
- geom.setAttribute('color', new THREE$b.BufferAttribute(colors, 3));
67355
+ geom.setAttribute('color', array2BufferAttr(_toConsumableArray$2(new Array(nVertices)).map(function (_, idx) {
67356
+ return idx >= topFaceIdx ? topColor : sideColor;
67357
+ }), 4));
66740
67358
  return geom;
66741
67359
  }));
66742
- var hexPoints = new THREE$b.Mesh(hexPointsGeometry, new THREE$b.MeshBasicMaterial({
67360
+ var hexPoints = new THREE$c.Mesh(hexPointsGeometry, new THREE$c.MeshLambertMaterial({
66743
67361
  color: 0xffffff,
67362
+ transparent: true,
66744
67363
  vertexColors: true,
66745
- side: THREE$b.DoubleSide
67364
+ side: THREE$c.DoubleSide
66746
67365
  }));
66747
67366
  hexPoints.__globeObjType = 'hexBinPoints'; // Add object type
66748
67367
  hexPoints.__data = hexBins; // Attach obj data
@@ -66754,7 +67373,7 @@
66754
67373
  //
66755
67374
 
66756
67375
  function createObj(d) {
66757
- var obj = new THREE$b.Mesh();
67376
+ var obj = new THREE$c.Mesh();
66758
67377
  obj.__hexCenter = cellToLatLng(d.h3Idx);
66759
67378
  obj.__hexGeoJson = cellToBoundary(d.h3Idx, true).reverse(); // correct polygon winding
66760
67379
 
@@ -66823,11 +67442,11 @@
66823
67442
  [sideColor, topColor].forEach(function (color) {
66824
67443
  if (!hexMaterials.hasOwnProperty(color)) {
66825
67444
  var opacity = colorAlpha(color);
66826
- hexMaterials[color] = new THREE$b.MeshLambertMaterial({
67445
+ hexMaterials[color] = new THREE$c.MeshLambertMaterial({
66827
67446
  color: colorStr2Hex(color),
66828
67447
  transparent: opacity < 1,
66829
67448
  opacity: opacity,
66830
- side: THREE$b.DoubleSide
67449
+ side: THREE$c.DoubleSide
66831
67450
  });
66832
67451
  }
66833
67452
  });
@@ -66839,6 +67458,318 @@
66839
67458
  }
66840
67459
  });
66841
67460
 
67461
+ var sq = function sq(x) {
67462
+ return x * x;
67463
+ };
67464
+ function geoDistance(a, b) {
67465
+ // on sphere surface, in radians
67466
+ var sqrt = Math.sqrt;
67467
+ var cos = Math.cos;
67468
+ var toRad = function toRad(x) {
67469
+ return x * Math.PI / 180;
67470
+ };
67471
+ var hav = function hav(x) {
67472
+ return sq(Math.sin(x / 2));
67473
+ };
67474
+ var latA = toRad(a[1]);
67475
+ var latB = toRad(b[1]);
67476
+ var lngA = toRad(a[0]);
67477
+ var lngB = toRad(b[0]);
67478
+
67479
+ // Haversine formula
67480
+ return 2 * Math.asin(sqrt(hav(latB - latA) + cos(latA) * cos(latB) * hav(lngB - lngA)));
67481
+ }
67482
+ var sqrt2PI = Math.sqrt(2 * Math.PI);
67483
+ function gaussianKernel(x, bw) {
67484
+ return Math.exp(-sq(x / bw) / 2) / (bw * sqrt2PI);
67485
+ }
67486
+ var getGeoKDE = function getGeoKDE(_ref) {
67487
+ var _ref2 = _slicedToArray$1(_ref, 2),
67488
+ lng = _ref2[0],
67489
+ lat = _ref2[1];
67490
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
67491
+ var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
67492
+ _ref3$lngAccessor = _ref3.lngAccessor,
67493
+ lngAccessor = _ref3$lngAccessor === void 0 ? function (d) {
67494
+ return d[0];
67495
+ } : _ref3$lngAccessor,
67496
+ _ref3$latAccessor = _ref3.latAccessor,
67497
+ latAccessor = _ref3$latAccessor === void 0 ? function (d) {
67498
+ return d[1];
67499
+ } : _ref3$latAccessor,
67500
+ _ref3$weightAccessor = _ref3.weightAccessor,
67501
+ weightAccessor = _ref3$weightAccessor === void 0 ? function () {
67502
+ return 1;
67503
+ } : _ref3$weightAccessor,
67504
+ bandwidth = _ref3.bandwidth;
67505
+ var pnt = [lng, lat];
67506
+ var bwRad = bandwidth * Math.PI / 180;
67507
+ return sum$1(data.map(function (d) {
67508
+ var weight = weightAccessor(d);
67509
+ if (weight <= 0) return;
67510
+ var dist = geoDistance(pnt, [lngAccessor(d), latAccessor(d)]);
67511
+ return gaussianKernel(dist, bwRad) * weight;
67512
+ }));
67513
+ };
67514
+
67515
+ var THREE$b = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
67516
+ : {
67517
+ Mesh: Mesh,
67518
+ MeshLambertMaterial: MeshLambertMaterial,
67519
+ SphereGeometry: SphereGeometry
67520
+ };
67521
+
67522
+ //
67523
+
67524
+ var RES_BW_FACTOR = 3.5; // divider of bandwidth to use in geometry resolution
67525
+ var MIN_RESOLUTION = 0.1; // degrees
67526
+ var BW_RADIUS_INFLUENCE = 3.5; // multiplier of bandwidth to use in octree for max radius of point influence
67527
+ var _getDistance = /*#__PURE__*/new WeakSet();
67528
+ var _points = /*#__PURE__*/new WeakMap();
67529
+ var _pntOctree = /*#__PURE__*/new WeakMap();
67530
+ var _distance = /*#__PURE__*/new WeakMap();
67531
+ var PointsOctree = /*#__PURE__*/function () {
67532
+ function PointsOctree(points, neighborhoodAngularDistance) {
67533
+ _classCallCheck(this, PointsOctree);
67534
+ _classPrivateMethodInitSpec(this, _getDistance);
67535
+ _classPrivateFieldInitSpec(this, _points, {
67536
+ writable: true,
67537
+ value: void 0
67538
+ });
67539
+ _classPrivateFieldInitSpec(this, _pntOctree, {
67540
+ writable: true,
67541
+ value: void 0
67542
+ });
67543
+ _classPrivateFieldInitSpec(this, _distance, {
67544
+ writable: true,
67545
+ value: void 0
67546
+ });
67547
+ _classPrivateFieldSet(this, _points, points);
67548
+ _classPrivateFieldSet(this, _pntOctree, yaOctree());
67549
+ _classPrivateFieldGet(this, _pntOctree).init(points.map(function (d) {
67550
+ return [d.x, d.y, d.z];
67551
+ }).flat());
67552
+ _classPrivateFieldSet(this, _distance, _classPrivateMethodGet(this, _getDistance, _getDistance2).call(this, polar2Cartesian(0, 0), polar2Cartesian(0, Math.min(180, neighborhoodAngularDistance))));
67553
+ }
67554
+ _createClass(PointsOctree, [{
67555
+ key: "getNearPoints",
67556
+ value: function getNearPoints(x, y, z) {
67557
+ var _this = this;
67558
+ return _classPrivateFieldGet(this, _pntOctree).intersectSphere(x, y, z, _classPrivateFieldGet(this, _distance)).map(function (idx) {
67559
+ return _classPrivateFieldGet(_this, _points)[idx / 3];
67560
+ });
67561
+ }
67562
+ }]);
67563
+ return PointsOctree;
67564
+ }();
67565
+ function _getDistance2(a, b) {
67566
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2) + Math.pow(a.z - b.z, 2));
67567
+ }
67568
+ var defaultColorInterpolator = function defaultColorInterpolator(t) {
67569
+ var c = color(interpolateTurbo(t)); // turbo, inferno
67570
+ c.opacity = Math.cbrt(t);
67571
+ return c.formatRgb();
67572
+ };
67573
+ var HeatmapsLayerKapsule = index$2({
67574
+ props: {
67575
+ heatmapsData: {
67576
+ "default": []
67577
+ },
67578
+ heatmapPoints: {
67579
+ "default": function _default(pnts) {
67580
+ return pnts;
67581
+ }
67582
+ },
67583
+ heatmapPointLat: {
67584
+ "default": function _default(d) {
67585
+ return d[0];
67586
+ }
67587
+ },
67588
+ heatmapPointLng: {
67589
+ "default": function _default(d) {
67590
+ return d[1];
67591
+ }
67592
+ },
67593
+ heatmapPointWeight: {
67594
+ "default": 1
67595
+ },
67596
+ heatmapBandwidth: {
67597
+ "default": 4
67598
+ },
67599
+ // Gaussian kernel bandwidth, in angular degrees
67600
+ heatmapColorFn: {
67601
+ "default": function _default() {
67602
+ return defaultColorInterpolator;
67603
+ }
67604
+ },
67605
+ heatmapColorSaturation: {
67606
+ "default": 1.5
67607
+ },
67608
+ // multiplier for color scale max
67609
+ heatmapBaseAltitude: {
67610
+ "default": 0.01
67611
+ },
67612
+ // in units of globe radius
67613
+ heatmapTopAltitude: {},
67614
+ // in units of globe radius
67615
+ heatmapsTransitionDuration: {
67616
+ "default": 0,
67617
+ triggerUpdate: false
67618
+ } // ms
67619
+ },
67620
+ init: function init(threeObj, state) {
67621
+ // Clear the scene
67622
+ emptyObject(threeObj);
67623
+
67624
+ // Main three object to manipulate
67625
+ state.scene = threeObj;
67626
+ },
67627
+ update: function update(state) {
67628
+ // Accessors
67629
+ var pointsAccessor = index$1(state.heatmapPoints);
67630
+ var latPntAccessor = index$1(state.heatmapPointLat);
67631
+ var lngPntAccessor = index$1(state.heatmapPointLng);
67632
+ var weightPntAccessor = index$1(state.heatmapPointWeight);
67633
+ var bandwidthAccessor = index$1(state.heatmapBandwidth);
67634
+ var colorFnAccessor = index$1(state.heatmapColorFn);
67635
+ var saturationAccessor = index$1(state.heatmapColorSaturation);
67636
+ var baseAltitudeAccessor = index$1(state.heatmapBaseAltitude);
67637
+ var topAltitudeAccessor = index$1(state.heatmapTopAltitude);
67638
+ threeDigest(state.heatmapsData, state.scene, {
67639
+ createObj: function createObj(d) {
67640
+ var obj = new THREE$b.Mesh(new THREE$b.SphereGeometry(GLOBE_RADIUS), new THREE$b.MeshLambertMaterial({
67641
+ vertexColors: true,
67642
+ transparent: true
67643
+ }));
67644
+ obj.__globeObjType = 'heatmap'; // Add object type
67645
+ return obj;
67646
+ },
67647
+ updateObj: function updateObj(obj, d) {
67648
+ // Accessors
67649
+ var bandwidth = bandwidthAccessor(d);
67650
+ var colorFn = colorFnAccessor(d);
67651
+ var saturation = saturationAccessor(d);
67652
+ var baseAlt = baseAltitudeAccessor(d);
67653
+ var topAlt = topAltitudeAccessor(d);
67654
+ var pnts = pointsAccessor(d).map(function (pnt) {
67655
+ var lat = latPntAccessor(pnt);
67656
+ var lng = lngPntAccessor(pnt);
67657
+ var _polar2Cartesian = polar2Cartesian(lat, lng),
67658
+ x = _polar2Cartesian.x,
67659
+ y = _polar2Cartesian.y,
67660
+ z = _polar2Cartesian.z;
67661
+ return {
67662
+ x: x,
67663
+ y: y,
67664
+ z: z,
67665
+ lat: lat,
67666
+ lng: lng,
67667
+ weight: weightPntAccessor(pnt)
67668
+ };
67669
+ });
67670
+
67671
+ // Check resolution
67672
+ var resolution = Math.max(MIN_RESOLUTION, bandwidth / RES_BW_FACTOR);
67673
+ var equatorNumSegments = Math.ceil(360 / (resolution || -1));
67674
+ if (obj.geometry.parameters.widthSegments !== equatorNumSegments) {
67675
+ obj.geometry.dispose();
67676
+ obj.geometry = new THREE$b.SphereGeometry(GLOBE_RADIUS, equatorNumSegments, equatorNumSegments / 2);
67677
+ }
67678
+
67679
+ // Get vertex polar coordinates
67680
+ var vertexCoords = bufferAttr2Array(obj.geometry.getAttribute('position'));
67681
+ var vertexGeoCoords = vertexCoords.map(function (_ref) {
67682
+ var _ref2 = _slicedToArray$1(_ref, 3),
67683
+ x = _ref2[0],
67684
+ y = _ref2[1],
67685
+ z = _ref2[2];
67686
+ var _cartesian2Polar = cartesian2Polar({
67687
+ x: x,
67688
+ y: y,
67689
+ z: z
67690
+ }),
67691
+ lng = _cartesian2Polar.lng,
67692
+ lat = _cartesian2Polar.lat;
67693
+ return [lng, lat];
67694
+ });
67695
+
67696
+ // Compute KDE
67697
+ var pntsOctree = new PointsOctree(pnts, bandwidth * BW_RADIUS_INFLUENCE);
67698
+ var kdeVals = vertexGeoCoords.map(function (vxCoords, idx) {
67699
+ var _vertexCoords$idx = _slicedToArray$1(vertexCoords[idx], 3),
67700
+ x = _vertexCoords$idx[0],
67701
+ y = _vertexCoords$idx[1],
67702
+ z = _vertexCoords$idx[2];
67703
+ return getGeoKDE(vxCoords, pntsOctree.getNearPoints(x, y, z), {
67704
+ latAccessor: function latAccessor(d) {
67705
+ return d.lat;
67706
+ },
67707
+ lngAccessor: function lngAccessor(d) {
67708
+ return d.lng;
67709
+ },
67710
+ weightAccessor: function weightAccessor(d) {
67711
+ return d.weight;
67712
+ },
67713
+ bandwidth: bandwidth
67714
+ });
67715
+ });
67716
+
67717
+ // Animations
67718
+ var applyUpdate = function applyUpdate(td) {
67719
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
67720
+ kdeVals = _obj$__currentTargetD.kdeVals,
67721
+ topAlt = _obj$__currentTargetD.topAlt,
67722
+ saturation = _obj$__currentTargetD.saturation;
67723
+ var maxVal = max$1(kdeVals) || 1e-15;
67724
+
67725
+ // Set vertex colors
67726
+ obj.geometry.setAttribute('color', array2BufferAttr(
67727
+ // normalization between [0, saturation]
67728
+ kdeVals.map(function (val) {
67729
+ return color2ShaderArr(colorFn(val / maxVal * saturation));
67730
+ }), 4));
67731
+
67732
+ // Set altitudes
67733
+ var altScale = linear([0, maxVal], [baseAlt, topAlt || baseAlt]);
67734
+ obj.geometry.setAttribute('position', array2BufferAttr(kdeVals.map(function (val, idx) {
67735
+ var _vertexGeoCoords$idx = _slicedToArray$1(vertexGeoCoords[idx], 2),
67736
+ lng = _vertexGeoCoords$idx[0],
67737
+ lat = _vertexGeoCoords$idx[1];
67738
+ var alt = altScale(val);
67739
+ var p = polar2Cartesian(lat, lng, alt);
67740
+ return [p.x, p.y, p.z];
67741
+ }), 3));
67742
+ };
67743
+ var targetD = {
67744
+ kdeVals: kdeVals,
67745
+ topAlt: topAlt,
67746
+ saturation: saturation
67747
+ };
67748
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
67749
+ kdeVals: kdeVals.map(function () {
67750
+ return 0;
67751
+ }),
67752
+ topAlt: !topAlt ? topAlt : baseAlt,
67753
+ saturation: 0.5
67754
+ });
67755
+ // do not interpolate between different length arrays
67756
+ currentTargetD.kdeVals.length !== kdeVals.length && (currentTargetD.kdeVals = kdeVals.slice());
67757
+ if (Object.keys(targetD).some(function (k) {
67758
+ return currentTargetD[k] !== targetD[k];
67759
+ })) {
67760
+ if (!state.heatmapsTransitionDuration || state.heatmapsTransitionDuration < 0) {
67761
+ // set final position
67762
+ applyUpdate(targetD);
67763
+ } else {
67764
+ // animate
67765
+ new Tween(currentTargetD).to(targetD, state.heatmapsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
67766
+ }
67767
+ }
67768
+ }
67769
+ });
67770
+ }
67771
+ });
67772
+
66842
67773
  var THREE$a = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
66843
67774
  : {
66844
67775
  DoubleSide: DoubleSide,
@@ -67271,7 +68202,6 @@
67271
68202
  : {
67272
68203
  BufferGeometry: BufferGeometry,
67273
68204
  Color: Color$1,
67274
- Float32BufferAttribute: Float32BufferAttribute,
67275
68205
  Group: Group$1,
67276
68206
  Line: Line,
67277
68207
  NormalBlending: NormalBlending,
@@ -67282,8 +68212,6 @@
67282
68212
 
67283
68213
  //
67284
68214
 
67285
- // support both modes for backwards threejs compatibility
67286
- var setAttributeFn = new THREE$7.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
67287
68215
  var gradientShaders = {
67288
68216
  uniforms: {
67289
68217
  // dash param defaults, all relative to full length
@@ -67364,15 +68292,15 @@
67364
68292
  methods: {
67365
68293
  pauseAnimation: function pauseAnimation(state) {
67366
68294
  var _state$ticker;
67367
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
68295
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
67368
68296
  },
67369
68297
  resumeAnimation: function resumeAnimation(state) {
67370
68298
  var _state$ticker2;
67371
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
68299
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
67372
68300
  },
67373
68301
  _destructor: function _destructor(state) {
67374
68302
  var _state$ticker3;
67375
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
68303
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
67376
68304
  }
67377
68305
  },
67378
68306
  init: function init(threeObj, state) {
@@ -67472,8 +68400,8 @@
67472
68400
  true // run from end to start, to animate in the correct direction
67473
68401
  );
67474
68402
 
67475
- obj.geometry[setAttributeFn]('vertexColor', vertexColorArray);
67476
- obj.geometry[setAttributeFn]('vertexRelDistance', vertexRelDistanceArray);
68403
+ obj.geometry.setAttribute('vertexColor', vertexColorArray);
68404
+ obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
67477
68405
  } else {
67478
68406
  // fat lines
67479
68407
  obj.material.resolution = state.rendererSize;
@@ -67638,40 +68566,38 @@
67638
68566
  .range(colors) : colors; // already interpolator fn
67639
68567
 
67640
68568
  getVertexColor = function getVertexColor(t) {
67641
- return color2ShaderArr(colorInterpolator(t), includeAlpha);
68569
+ return color2ShaderArr(colorInterpolator(t), includeAlpha, true);
67642
68570
  };
67643
68571
  } else {
67644
68572
  // single color, use constant
67645
- var vertexColor = color2ShaderArr(colors, includeAlpha);
68573
+ var vertexColor = color2ShaderArr(colors, includeAlpha, true);
67646
68574
  getVertexColor = function getVertexColor() {
67647
68575
  return vertexColor;
67648
68576
  };
67649
68577
  }
67650
- var numArgs = includeAlpha ? 4 : 3;
67651
- var vertexColorArray = new THREE$7.Float32BufferAttribute(numVerticesGroup * numArgs * numVerticesPerSegment, numArgs);
68578
+ var vertexColors = [];
67652
68579
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67653
68580
  var _vertexColor = getVertexColor(v / (l - 1));
67654
68581
  for (var s = 0; s < numVerticesPerSegment; s++) {
67655
- vertexColorArray.set(_vertexColor, (v * numVerticesPerSegment + s) * numArgs);
68582
+ vertexColors.push(_vertexColor);
67656
68583
  }
67657
68584
  }
67658
- return vertexColorArray;
68585
+ return array2BufferAttr(vertexColors, includeAlpha ? 4 : 3);
67659
68586
  }
67660
68587
  function calcVertexRelDistances(numSegments) {
67661
68588
  var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
67662
68589
  var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
67663
68590
  var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
67664
- var arrLen = numVerticesGroup * numVerticesPerSegment;
67665
- var vertexDistanceArray = new THREE$7.Float32BufferAttribute(arrLen, 1);
68591
+
68592
+ var vertexDistances = [];
67666
68593
  for (var v = 0, l = numVerticesGroup; v < l; v++) {
67667
68594
  var relDistance = v / (l - 1);
67668
68595
  for (var s = 0; s < numVerticesPerSegment; s++) {
67669
- var idx = v * numVerticesPerSegment + s;
67670
- var pos = invert ? arrLen - 1 - idx : idx;
67671
- vertexDistanceArray.setX(pos, relDistance);
68596
+ vertexDistances.push(relDistance);
67672
68597
  }
67673
68598
  }
67674
- return vertexDistanceArray;
68599
+ invert && vertexDistances.reverse();
68600
+ return array2BufferAttr(vertexDistances, 1);
67675
68601
  }
67676
68602
  }
67677
68603
  });
@@ -68101,15 +69027,15 @@
68101
69027
  methods: {
68102
69028
  pauseAnimation: function pauseAnimation(state) {
68103
69029
  var _state$ticker;
68104
- (_state$ticker = state.ticker) === null || _state$ticker === void 0 ? void 0 : _state$ticker.pause();
69030
+ (_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
68105
69031
  },
68106
69032
  resumeAnimation: function resumeAnimation(state) {
68107
69033
  var _state$ticker2;
68108
- (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 ? void 0 : _state$ticker2.resume();
69034
+ (_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
68109
69035
  },
68110
69036
  _destructor: function _destructor(state) {
68111
69037
  var _state$ticker3;
68112
- (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 ? void 0 : _state$ticker3.dispose();
69038
+ (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
68113
69039
  }
68114
69040
  },
68115
69041
  init: function init(threeObj, state) {
@@ -68456,7 +69382,7 @@
68456
69382
  }
68457
69383
  });
68458
69384
 
68459
- var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
69385
+ var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
68460
69386
  : {
68461
69387
  Group: Group$1,
68462
69388
  Vector2: Vector2,
@@ -68465,7 +69391,7 @@
68465
69391
 
68466
69392
  //
68467
69393
 
68468
- var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
69394
+ var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'heatmapsLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
68469
69395
 
68470
69396
  // Expose config from layers
68471
69397
  var bindGlobeLayer = linkKapsule$1('globeLayer', GlobeLayerKapsule);
@@ -68487,6 +69413,10 @@
68487
69413
  var linkedHexBinLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration'].map(function (p) {
68488
69414
  return _defineProperty$2({}, p, bindHexBinLayer.linkProp(p));
68489
69415
  })));
69416
+ var bindHeatmapsLayer = linkKapsule$1('heatmapsLayer', HeatmapsLayerKapsule);
69417
+ var linkedHeatmapsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration'].map(function (p) {
69418
+ return _defineProperty$2({}, p, bindHeatmapsLayer.linkProp(p));
69419
+ })));
68490
69420
  var bindHexedPolygonsLayer = linkKapsule$1('hexedPolygonsLayer', HexedPolygonsLayerKapsule);
68491
69421
  var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
68492
69422
  return _defineProperty$2({}, p, bindHexedPolygonsLayer.linkProp(p));
@@ -68527,18 +69457,18 @@
68527
69457
  //
68528
69458
 
68529
69459
  var Globe$1 = index$2({
68530
- props: _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
69460
+ props: _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
68531
69461
  onGlobeReady: {
68532
69462
  triggerUpdate: false
68533
69463
  },
68534
69464
  rendererSize: {
68535
- "default": new THREE$g.Vector2(window.innerWidth, window.innerHeight),
69465
+ "default": new THREE$i.Vector2(window.innerWidth, window.innerHeight),
68536
69466
  onChange: function onChange(rendererSize, state) {
68537
69467
  state.pathsLayer.rendererSize(rendererSize);
68538
69468
  },
68539
69469
  triggerUpdate: false
68540
69470
  }
68541
- }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
69471
+ }, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedHeatmapsLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
68542
69472
  methods: _objectSpread2$1({
68543
69473
  getGlobeRadius: getGlobeRadius,
68544
69474
  getCoords: function getCoords(state) {
@@ -68623,6 +69553,7 @@
68623
69553
  pointsLayer: PointsLayerKapsule(),
68624
69554
  arcsLayer: ArcsLayerKapsule(),
68625
69555
  hexBinLayer: HexBinLayerKapsule(),
69556
+ heatmapsLayer: HeatmapsLayerKapsule(),
68626
69557
  polygonsLayer: PolygonsLayerKapsule(),
68627
69558
  hexedPolygonsLayer: HexedPolygonsLayerKapsule(),
68628
69559
  pathsLayer: PathsLayerKapsule(),
@@ -68645,21 +69576,21 @@
68645
69576
  })
68646
69577
  });
68647
69578
  },
68648
- init: function init(threeObj, state, _ref15) {
68649
- var _ref15$animateIn = _ref15.animateIn,
68650
- animateIn = _ref15$animateIn === void 0 ? true : _ref15$animateIn,
68651
- _ref15$waitForGlobeRe = _ref15.waitForGlobeReady,
68652
- waitForGlobeReady = _ref15$waitForGlobeRe === void 0 ? true : _ref15$waitForGlobeRe;
69579
+ init: function init(threeObj, state, _ref16) {
69580
+ var _ref16$animateIn = _ref16.animateIn,
69581
+ animateIn = _ref16$animateIn === void 0 ? true : _ref16$animateIn,
69582
+ _ref16$waitForGlobeRe = _ref16.waitForGlobeReady,
69583
+ waitForGlobeReady = _ref16$waitForGlobeRe === void 0 ? true : _ref16$waitForGlobeRe;
68653
69584
  // Clear the scene
68654
69585
  emptyObject(threeObj);
68655
69586
 
68656
69587
  // Main three object to manipulate
68657
- threeObj.add(state.scene = new THREE$g.Group());
69588
+ threeObj.add(state.scene = new THREE$i.Group());
68658
69589
  state.scene.visible = false; // hide scene before globe initialization
68659
69590
 
68660
69591
  // Add all layers groups
68661
69592
  layers.forEach(function (layer) {
68662
- var g = new THREE$g.Group();
69593
+ var g = new THREE$i.Group();
68663
69594
  state.scene.add(g);
68664
69595
  state[layer](g);
68665
69596
  });
@@ -68671,17 +69602,17 @@
68671
69602
  k: 1e-6
68672
69603
  }).to({
68673
69604
  k: 1
68674
- }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref16) {
68675
- var k = _ref16.k;
69605
+ }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref17) {
69606
+ var k = _ref17.k;
68676
69607
  return state.scene.scale.set(k, k, k);
68677
69608
  }).start();
68678
- var rotAxis = new THREE$g.Vector3(0, 1, 0);
69609
+ var rotAxis = new THREE$i.Vector3(0, 1, 0);
68679
69610
  new Tween({
68680
69611
  rot: Math.PI * 2
68681
69612
  }).to({
68682
69613
  rot: 0
68683
- }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref17) {
68684
- var rot = _ref17.rot;
69614
+ }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref18) {
69615
+ var rot = _ref18.rot;
68685
69616
  return state.scene.setRotationFromAxisAngle(rotAxis, rot);
68686
69617
  }).start();
68687
69618
  }
@@ -69713,7 +70644,7 @@
69713
70644
 
69714
70645
  const twoPI = 2 * Math.PI;
69715
70646
 
69716
- return function update() {
70647
+ return function update( deltaTime = null ) {
69717
70648
 
69718
70649
  const position = scope.object.position;
69719
70650
 
@@ -69727,7 +70658,7 @@
69727
70658
 
69728
70659
  if ( scope.autoRotate && state === STATE.NONE ) {
69729
70660
 
69730
- rotateLeft( getAutoRotationAngle() );
70661
+ rotateLeft( getAutoRotationAngle( deltaTime ) );
69731
70662
 
69732
70663
  }
69733
70664
 
@@ -70006,9 +70937,17 @@
70006
70937
  const pointers = [];
70007
70938
  const pointerPositions = {};
70008
70939
 
70009
- function getAutoRotationAngle() {
70940
+ function getAutoRotationAngle( deltaTime ) {
70941
+
70942
+ if ( deltaTime !== null ) {
70943
+
70944
+ return ( 2 * Math.PI / 60 * scope.autoRotateSpeed ) * deltaTime;
70010
70945
 
70011
- return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
70946
+ } else {
70947
+
70948
+ return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
70949
+
70950
+ }
70012
70951
 
70013
70952
  }
70014
70953
 
@@ -70160,7 +71099,7 @@
70160
71099
  mouse.x = ( x / w ) * 2 - 1;
70161
71100
  mouse.y = - ( y / h ) * 2 + 1;
70162
71101
 
70163
- dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( object ).sub( object.position ).normalize();
71102
+ dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize();
70164
71103
 
70165
71104
  }
70166
71105
 
@@ -71726,7 +72665,7 @@
71726
72665
 
71727
72666
  class RenderPass extends Pass {
71728
72667
 
71729
- constructor( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
72668
+ constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
71730
72669
 
71731
72670
  super();
71732
72671
 
@@ -71736,7 +72675,7 @@
71736
72675
  this.overrideMaterial = overrideMaterial;
71737
72676
 
71738
72677
  this.clearColor = clearColor;
71739
- this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
72678
+ this.clearAlpha = clearAlpha;
71740
72679
 
71741
72680
  this.clear = true;
71742
72681
  this.clearDepth = false;
@@ -71752,7 +72691,7 @@
71752
72691
 
71753
72692
  let oldClearAlpha, oldOverrideMaterial;
71754
72693
 
71755
- if ( this.overrideMaterial !== undefined ) {
72694
+ if ( this.overrideMaterial !== null ) {
71756
72695
 
71757
72696
  oldOverrideMaterial = this.scene.overrideMaterial;
71758
72697
 
@@ -71760,16 +72699,21 @@
71760
72699
 
71761
72700
  }
71762
72701
 
71763
- if ( this.clearColor ) {
72702
+ if ( this.clearColor !== null ) {
71764
72703
 
71765
72704
  renderer.getClearColor( this._oldClearColor );
71766
- oldClearAlpha = renderer.getClearAlpha();
72705
+ renderer.setClearColor( this.clearColor );
72706
+
72707
+ }
72708
+
72709
+ if ( this.clearAlpha !== null ) {
71767
72710
 
71768
- renderer.setClearColor( this.clearColor, this.clearAlpha );
72711
+ oldClearAlpha = renderer.getClearAlpha();
72712
+ renderer.setClearAlpha( this.clearAlpha );
71769
72713
 
71770
72714
  }
71771
72715
 
71772
- if ( this.clearDepth ) {
72716
+ if ( this.clearDepth == true ) {
71773
72717
 
71774
72718
  renderer.clearDepth();
71775
72719
 
@@ -71777,17 +72721,30 @@
71777
72721
 
71778
72722
  renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
71779
72723
 
71780
- // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
71781
- if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
72724
+ if ( this.clear === true ) {
72725
+
72726
+ // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
72727
+ renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
72728
+
72729
+ }
72730
+
71782
72731
  renderer.render( this.scene, this.camera );
71783
72732
 
71784
- if ( this.clearColor ) {
72733
+ // restore
72734
+
72735
+ if ( this.clearColor !== null ) {
71785
72736
 
71786
- renderer.setClearColor( this._oldClearColor, oldClearAlpha );
72737
+ renderer.setClearColor( this._oldClearColor );
71787
72738
 
71788
72739
  }
71789
72740
 
71790
- if ( this.overrideMaterial !== undefined ) {
72741
+ if ( this.clearAlpha !== null ) {
72742
+
72743
+ renderer.setClearAlpha( oldClearAlpha );
72744
+
72745
+ }
72746
+
72747
+ if ( this.overrideMaterial !== null ) {
71791
72748
 
71792
72749
  this.scene.overrideMaterial = oldOverrideMaterial;
71793
72750
 
@@ -73224,26 +74181,26 @@
73224
74181
  var css_248z = ".scene-container .clickable {\n cursor: pointer;\n}";
73225
74182
  styleInject(css_248z);
73226
74183
 
73227
- function ownKeys(object, enumerableOnly) {
73228
- var keys = Object.keys(object);
74184
+ function ownKeys(e, r) {
74185
+ var t = Object.keys(e);
73229
74186
  if (Object.getOwnPropertySymbols) {
73230
- var symbols = Object.getOwnPropertySymbols(object);
73231
- enumerableOnly && (symbols = symbols.filter(function (sym) {
73232
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
73233
- })), keys.push.apply(keys, symbols);
74187
+ var o = Object.getOwnPropertySymbols(e);
74188
+ r && (o = o.filter(function (r) {
74189
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
74190
+ })), t.push.apply(t, o);
73234
74191
  }
73235
- return keys;
73236
- }
73237
- function _objectSpread2(target) {
73238
- for (var i = 1; i < arguments.length; i++) {
73239
- var source = null != arguments[i] ? arguments[i] : {};
73240
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
73241
- _defineProperty(target, key, source[key]);
73242
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
73243
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
74192
+ return t;
74193
+ }
74194
+ function _objectSpread2(e) {
74195
+ for (var r = 1; r < arguments.length; r++) {
74196
+ var t = null != arguments[r] ? arguments[r] : {};
74197
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
74198
+ _defineProperty(e, r, t[r]);
74199
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
74200
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
73244
74201
  });
73245
74202
  }
73246
- return target;
74203
+ return e;
73247
74204
  }
73248
74205
  function _defineProperty(obj, key, value) {
73249
74206
  key = _toPropertyKey(key);
@@ -73328,7 +74285,7 @@
73328
74285
 
73329
74286
  function linkKapsule (kapsulePropName, kapsuleType) {
73330
74287
  var dummyK = new kapsuleType(); // To extract defaults
73331
-
74288
+ dummyK._destructor && dummyK._destructor();
73332
74289
  return {
73333
74290
  linkProp: function linkProp(prop) {
73334
74291
  // link property config
@@ -73369,10 +74326,10 @@
73369
74326
 
73370
74327
  // Expose config from ThreeGlobe
73371
74328
  var bindGlobe = linkKapsule('globe', threeGlobe);
73372
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'globeMaterial', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
74329
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
73373
74330
  return _defineProperty({}, p, bindGlobe.linkProp(p));
73374
74331
  })));
73375
- var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
74332
+ var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
73376
74333
  return _defineProperty({}, p, bindGlobe.linkMethod(p));
73377
74334
  })));
73378
74335
 
@@ -73450,6 +74407,15 @@
73450
74407
  onPathHover: {
73451
74408
  triggerUpdate: false
73452
74409
  },
74410
+ onHeatmapClick: {
74411
+ triggerUpdate: false
74412
+ },
74413
+ onHeatmapRightClick: {
74414
+ triggerUpdate: false
74415
+ },
74416
+ onHeatmapHover: {
74417
+ triggerUpdate: false
74418
+ },
73453
74419
  hexLabel: {
73454
74420
  triggerUpdate: false
73455
74421
  },
@@ -73551,7 +74517,7 @@
73551
74517
  cancelAnimationFrame(state.animationFrameRequestId);
73552
74518
  state.animationFrameRequestId = null;
73553
74519
  }
73554
- (_state$globe = state.globe) === null || _state$globe === void 0 ? void 0 : _state$globe.pauseAnimation();
74520
+ (_state$globe = state.globe) === null || _state$globe === void 0 || _state$globe.pauseAnimation();
73555
74521
  return this;
73556
74522
  },
73557
74523
  resumeAnimation: function resumeAnimation(state) {
@@ -73559,7 +74525,7 @@
73559
74525
  if (state.animationFrameRequestId === null) {
73560
74526
  this._animationCycle();
73561
74527
  }
73562
- (_state$globe2 = state.globe) === null || _state$globe2 === void 0 ? void 0 : _state$globe2.resumeAnimation();
74528
+ (_state$globe2 = state.globe) === null || _state$globe2 === void 0 || _state$globe2.resumeAnimation();
73563
74529
  return this;
73564
74530
  },
73565
74531
  _animationCycle: function _animationCycle(state) {
@@ -73651,6 +74617,7 @@
73651
74617
  this.arcsData([]);
73652
74618
  this.polygonsData([]);
73653
74619
  this.pathsData([]);
74620
+ this.heatmapsData([]);
73654
74621
  this.hexBinPointsData([]);
73655
74622
  this.hexPolygonsData([]);
73656
74623
  this.tilesData([]);
@@ -73743,6 +74710,9 @@
73743
74710
  path: function path(d) {
73744
74711
  return d;
73745
74712
  },
74713
+ heatmap: function heatmap(d) {
74714
+ return d;
74715
+ },
73746
74716
  hexbin: function hexbin(d) {
73747
74717
  return d;
73748
74718
  },
@@ -73797,6 +74767,7 @@
73797
74767
  arc: state.onArcHover,
73798
74768
  polygon: state.onPolygonHover,
73799
74769
  path: state.onPathHover,
74770
+ heatmap: state.onHeatmapHover,
73800
74771
  hexbin: state.onHexHover,
73801
74772
  hexPolygon: state.onHexPolygonHover,
73802
74773
  tile: state.onTileHover,
@@ -73810,6 +74781,7 @@
73810
74781
  arc: state.onArcClick,
73811
74782
  polygon: state.onPolygonClick,
73812
74783
  path: state.onPathClick,
74784
+ heatmap: state.onHeatmapClick,
73813
74785
  hexbin: state.onHexClick,
73814
74786
  hexPolygon: state.onHexPolygonClick,
73815
74787
  tile: state.onTileClick,
@@ -73849,6 +74821,7 @@
73849
74821
  arc: state.onArcClick,
73850
74822
  polygon: state.onPolygonClick,
73851
74823
  path: state.onPathClick,
74824
+ heatmap: state.onHeatmapClick,
73852
74825
  hexbin: state.onHexClick,
73853
74826
  hexPolygon: state.onHexPolygonClick,
73854
74827
  tile: state.onTileClick,
@@ -73886,6 +74859,7 @@
73886
74859
  arc: state.onArcRightClick,
73887
74860
  polygon: state.onPolygonRightClick,
73888
74861
  path: state.onPathRightClick,
74862
+ heatmap: state.onHeatmapRightClick,
73889
74863
  hexbin: state.onHexRightClick,
73890
74864
  hexPolygon: state.onHexPolygonRightClick,
73891
74865
  tile: state.onTileRightClick,
@@ -75025,6 +75999,20 @@
75025
75999
  onPathClick: PropTypes.func,
75026
76000
  onPathRightClick: PropTypes.func,
75027
76001
  onPathHover: PropTypes.func,
76002
+ heatmapsData: PropTypes.array,
76003
+ heatmapPoints: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.func]),
76004
+ heatmapPointLat: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76005
+ heatmapPointLng: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76006
+ heatmapPointWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76007
+ heatmapBandwidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76008
+ heatmapColorFn: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
76009
+ heatmapColorSaturation: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76010
+ heatmapBaseAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76011
+ heatmapTopAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
76012
+ heatmapsTransitionDuration: PropTypes.number,
76013
+ onHeatmapClick: PropTypes.func,
76014
+ onHeatmapRightClick: PropTypes.func,
76015
+ onHeatmapHover: PropTypes.func,
75028
76016
  hexBinPointsData: PropTypes.arrayOf(PropTypes.object),
75029
76017
  hexBinPointLat: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
75030
76018
  hexBinPointLng: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),