react-globe.gl 2.24.4 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -15
- package/dist/react-globe.gl.d.ts +18 -0
- package/dist/react-globe.gl.js +1843 -813
- package/dist/react-globe.gl.js.map +1 -1
- package/dist/react-globe.gl.min.js +5 -5
- package/dist/react-globe.gl.mjs +16 -0
- package/package.json +15 -15
package/dist/react-globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.
|
|
1
|
+
// Version 2.26.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 = '
|
|
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 };
|
|
@@ -454,6 +454,13 @@
|
|
|
454
454
|
const SRGBColorSpace = 'srgb';
|
|
455
455
|
const LinearSRGBColorSpace = 'srgb-linear';
|
|
456
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';
|
|
457
464
|
const KeepStencilOp = 7680;
|
|
458
465
|
const AlwaysStencilFunc = 519;
|
|
459
466
|
|
|
@@ -1799,18 +1806,6 @@
|
|
|
1799
1806
|
|
|
1800
1807
|
}
|
|
1801
1808
|
|
|
1802
|
-
function SRGBToLinear( c ) {
|
|
1803
|
-
|
|
1804
|
-
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
1805
|
-
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
function LinearToSRGB( c ) {
|
|
1809
|
-
|
|
1810
|
-
return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
|
|
1811
|
-
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
1809
|
/**
|
|
1815
1810
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
1816
1811
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -1823,50 +1818,57 @@
|
|
|
1823
1818
|
* - http://www.russellcottrell.com/photo/matrixCalculator.htm
|
|
1824
1819
|
*/
|
|
1825
1820
|
|
|
1826
|
-
const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().
|
|
1827
|
-
0.8224621, 0.
|
|
1828
|
-
0.
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
|
|
1833
|
-
1.2249401, - 0.0420569, - 0.0196376,
|
|
1834
|
-
- 0.2249404, 1.0420571, - 0.0786361,
|
|
1835
|
-
0.0000001, 0.0000000, 1.0982735
|
|
1836
|
-
] );
|
|
1837
|
-
|
|
1838
|
-
function DisplayP3ToLinearSRGB( color ) {
|
|
1839
|
-
|
|
1840
|
-
// Display P3 uses the sRGB transfer functions
|
|
1841
|
-
return color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
function LinearSRGBToDisplayP3( color ) {
|
|
1846
|
-
|
|
1847
|
-
// Display P3 uses the sRGB transfer functions
|
|
1848
|
-
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
|
+
);
|
|
1849
1826
|
|
|
1850
|
-
|
|
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
|
+
);
|
|
1851
1832
|
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
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
|
+
},
|
|
1857
1862
|
};
|
|
1858
1863
|
|
|
1859
|
-
|
|
1860
|
-
const FROM_LINEAR = {
|
|
1861
|
-
[ LinearSRGBColorSpace ]: ( color ) => color,
|
|
1862
|
-
[ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
|
|
1863
|
-
[ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
|
|
1864
|
-
};
|
|
1864
|
+
const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
|
|
1865
1865
|
|
|
1866
1866
|
const ColorManagement = {
|
|
1867
1867
|
|
|
1868
1868
|
enabled: true,
|
|
1869
1869
|
|
|
1870
|
+
_workingColorSpace: LinearSRGBColorSpace,
|
|
1871
|
+
|
|
1870
1872
|
get legacyMode() {
|
|
1871
1873
|
|
|
1872
1874
|
console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
|
|
@@ -1885,13 +1887,19 @@
|
|
|
1885
1887
|
|
|
1886
1888
|
get workingColorSpace() {
|
|
1887
1889
|
|
|
1888
|
-
return
|
|
1890
|
+
return this._workingColorSpace;
|
|
1889
1891
|
|
|
1890
1892
|
},
|
|
1891
1893
|
|
|
1892
1894
|
set workingColorSpace( colorSpace ) {
|
|
1893
1895
|
|
|
1894
|
-
|
|
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;
|
|
1895
1903
|
|
|
1896
1904
|
},
|
|
1897
1905
|
|
|
@@ -1903,33 +1911,54 @@
|
|
|
1903
1911
|
|
|
1904
1912
|
}
|
|
1905
1913
|
|
|
1906
|
-
const
|
|
1907
|
-
const
|
|
1914
|
+
const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
|
|
1915
|
+
const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
|
|
1908
1916
|
|
|
1909
|
-
|
|
1917
|
+
return targetFromReference( sourceToReference( color ) );
|
|
1910
1918
|
|
|
1911
|
-
|
|
1919
|
+
},
|
|
1912
1920
|
|
|
1913
|
-
|
|
1921
|
+
fromWorkingColorSpace: function ( color, targetColorSpace ) {
|
|
1914
1922
|
|
|
1915
|
-
return
|
|
1923
|
+
return this.convert( color, this._workingColorSpace, targetColorSpace );
|
|
1916
1924
|
|
|
1917
1925
|
},
|
|
1918
1926
|
|
|
1919
|
-
|
|
1927
|
+
toWorkingColorSpace: function ( color, sourceColorSpace ) {
|
|
1920
1928
|
|
|
1921
|
-
return this.convert( color, this.
|
|
1929
|
+
return this.convert( color, sourceColorSpace, this._workingColorSpace );
|
|
1922
1930
|
|
|
1923
1931
|
},
|
|
1924
1932
|
|
|
1925
|
-
|
|
1933
|
+
getPrimaries: function ( colorSpace ) {
|
|
1926
1934
|
|
|
1927
|
-
return
|
|
1935
|
+
return COLOR_SPACES[ colorSpace ].primaries;
|
|
1936
|
+
|
|
1937
|
+
},
|
|
1938
|
+
|
|
1939
|
+
getTransfer: function ( colorSpace ) {
|
|
1940
|
+
|
|
1941
|
+
if ( colorSpace === NoColorSpace ) return LinearTransfer;
|
|
1942
|
+
|
|
1943
|
+
return COLOR_SPACES[ colorSpace ].transfer;
|
|
1928
1944
|
|
|
1929
1945
|
},
|
|
1930
1946
|
|
|
1931
1947
|
};
|
|
1932
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
|
+
|
|
1933
1962
|
let _canvas;
|
|
1934
1963
|
|
|
1935
1964
|
class ImageUtils {
|
|
@@ -2055,7 +2084,7 @@
|
|
|
2055
2084
|
|
|
2056
2085
|
}
|
|
2057
2086
|
|
|
2058
|
-
let
|
|
2087
|
+
let _sourceId = 0;
|
|
2059
2088
|
|
|
2060
2089
|
class Source {
|
|
2061
2090
|
|
|
@@ -2063,7 +2092,7 @@
|
|
|
2063
2092
|
|
|
2064
2093
|
this.isSource = true;
|
|
2065
2094
|
|
|
2066
|
-
Object.defineProperty( this, 'id', { value:
|
|
2095
|
+
Object.defineProperty( this, 'id', { value: _sourceId ++ } );
|
|
2067
2096
|
|
|
2068
2097
|
this.uuid = generateUUID();
|
|
2069
2098
|
|
|
@@ -3169,20 +3198,29 @@
|
|
|
3169
3198
|
|
|
3170
3199
|
}
|
|
3171
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
|
+
|
|
3172
3211
|
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
3173
3212
|
this.texture.isRenderTargetTexture = true;
|
|
3174
3213
|
|
|
3175
3214
|
this.texture.flipY = false;
|
|
3176
|
-
this.texture.generateMipmaps = options.generateMipmaps
|
|
3177
|
-
this.texture.internalFormat = options.internalFormat
|
|
3178
|
-
this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
|
|
3215
|
+
this.texture.generateMipmaps = options.generateMipmaps;
|
|
3216
|
+
this.texture.internalFormat = options.internalFormat;
|
|
3179
3217
|
|
|
3180
|
-
this.depthBuffer = options.depthBuffer
|
|
3181
|
-
this.stencilBuffer = options.stencilBuffer
|
|
3218
|
+
this.depthBuffer = options.depthBuffer;
|
|
3219
|
+
this.stencilBuffer = options.stencilBuffer;
|
|
3182
3220
|
|
|
3183
|
-
this.depthTexture = options.depthTexture
|
|
3221
|
+
this.depthTexture = options.depthTexture;
|
|
3184
3222
|
|
|
3185
|
-
this.samples = options.samples
|
|
3223
|
+
this.samples = options.samples;
|
|
3186
3224
|
|
|
3187
3225
|
}
|
|
3188
3226
|
|
|
@@ -5143,16 +5181,16 @@
|
|
|
5143
5181
|
if ( this.isEmpty() ) return this;
|
|
5144
5182
|
|
|
5145
5183
|
// NOTE: I am using a binary pattern to specify all 2^3 combinations below
|
|
5146
|
-
_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
|
|
5147
|
-
_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
|
|
5148
|
-
_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010
|
|
5149
|
-
_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011
|
|
5150
|
-
_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100
|
|
5151
|
-
_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
|
|
5152
|
-
_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
|
|
5153
|
-
_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
|
|
5154
5192
|
|
|
5155
|
-
this.setFromPoints( _points );
|
|
5193
|
+
this.setFromPoints( _points$1 );
|
|
5156
5194
|
|
|
5157
5195
|
return this;
|
|
5158
5196
|
|
|
@@ -5175,7 +5213,7 @@
|
|
|
5175
5213
|
|
|
5176
5214
|
}
|
|
5177
5215
|
|
|
5178
|
-
const _points = [
|
|
5216
|
+
const _points$1 = [
|
|
5179
5217
|
/*@__PURE__*/ new Vector3(),
|
|
5180
5218
|
/*@__PURE__*/ new Vector3(),
|
|
5181
5219
|
/*@__PURE__*/ new Vector3(),
|
|
@@ -8835,10 +8873,10 @@
|
|
|
8835
8873
|
|
|
8836
8874
|
if ( this.blending !== NormalBlending ) data.blending = this.blending;
|
|
8837
8875
|
if ( this.side !== FrontSide ) data.side = this.side;
|
|
8838
|
-
if ( this.vertexColors ) data.vertexColors = true;
|
|
8876
|
+
if ( this.vertexColors === true ) data.vertexColors = true;
|
|
8839
8877
|
|
|
8840
8878
|
if ( this.opacity < 1 ) data.opacity = this.opacity;
|
|
8841
|
-
if ( this.transparent === true ) data.transparent =
|
|
8879
|
+
if ( this.transparent === true ) data.transparent = true;
|
|
8842
8880
|
|
|
8843
8881
|
data.depthFunc = this.depthFunc;
|
|
8844
8882
|
data.depthTest = this.depthTest;
|
|
@@ -8869,17 +8907,17 @@
|
|
|
8869
8907
|
if ( this.dithering === true ) data.dithering = true;
|
|
8870
8908
|
|
|
8871
8909
|
if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
|
|
8872
|
-
if ( this.alphaHash === true ) data.alphaHash =
|
|
8873
|
-
if ( this.alphaToCoverage === true ) data.alphaToCoverage =
|
|
8874
|
-
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha =
|
|
8875
|
-
if ( this.forceSinglePass === true ) data.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;
|
|
8876
8914
|
|
|
8877
|
-
if ( this.wireframe === true ) data.wireframe =
|
|
8915
|
+
if ( this.wireframe === true ) data.wireframe = true;
|
|
8878
8916
|
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
8879
8917
|
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
|
|
8880
8918
|
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
8881
8919
|
|
|
8882
|
-
if ( this.flatShading === true ) data.flatShading =
|
|
8920
|
+
if ( this.flatShading === true ) data.flatShading = true;
|
|
8883
8921
|
|
|
8884
8922
|
if ( this.visible === false ) data.visible = false;
|
|
8885
8923
|
|
|
@@ -9460,11 +9498,7 @@
|
|
|
9460
9498
|
|
|
9461
9499
|
this.getHSL( _hslA );
|
|
9462
9500
|
|
|
9463
|
-
_hslA.h
|
|
9464
|
-
|
|
9465
|
-
this.setHSL( _hslA.h, _hslA.s, _hslA.l );
|
|
9466
|
-
|
|
9467
|
-
return this;
|
|
9501
|
+
return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
|
|
9468
9502
|
|
|
9469
9503
|
}
|
|
9470
9504
|
|
|
@@ -11864,7 +11898,7 @@
|
|
|
11864
11898
|
|
|
11865
11899
|
}
|
|
11866
11900
|
|
|
11867
|
-
return
|
|
11901
|
+
return ColorManagement.workingColorSpace;
|
|
11868
11902
|
|
|
11869
11903
|
}
|
|
11870
11904
|
|
|
@@ -12092,11 +12126,7 @@
|
|
|
12092
12126
|
|
|
12093
12127
|
getWorldDirection( target ) {
|
|
12094
12128
|
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
const e = this.matrixWorld.elements;
|
|
12098
|
-
|
|
12099
|
-
return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
|
|
12129
|
+
return super.getWorldDirection( target ).negate();
|
|
12100
12130
|
|
|
12101
12131
|
}
|
|
12102
12132
|
|
|
@@ -12366,6 +12396,7 @@
|
|
|
12366
12396
|
|
|
12367
12397
|
this.renderTarget = renderTarget;
|
|
12368
12398
|
this.coordinateSystem = null;
|
|
12399
|
+
this.activeMipmapLevel = 0;
|
|
12369
12400
|
|
|
12370
12401
|
const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
|
|
12371
12402
|
cameraPX.layers = this.layers;
|
|
@@ -12463,7 +12494,7 @@
|
|
|
12463
12494
|
|
|
12464
12495
|
if ( this.parent === null ) this.updateMatrixWorld();
|
|
12465
12496
|
|
|
12466
|
-
const renderTarget = this
|
|
12497
|
+
const { renderTarget, activeMipmapLevel } = this;
|
|
12467
12498
|
|
|
12468
12499
|
if ( this.coordinateSystem !== renderer.coordinateSystem ) {
|
|
12469
12500
|
|
|
@@ -12476,6 +12507,8 @@
|
|
|
12476
12507
|
const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
|
|
12477
12508
|
|
|
12478
12509
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
12510
|
+
const currentActiveCubeFace = renderer.getActiveCubeFace();
|
|
12511
|
+
const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();
|
|
12479
12512
|
|
|
12480
12513
|
const currentXrEnabled = renderer.xr.enabled;
|
|
12481
12514
|
|
|
@@ -12485,27 +12518,30 @@
|
|
|
12485
12518
|
|
|
12486
12519
|
renderTarget.texture.generateMipmaps = false;
|
|
12487
12520
|
|
|
12488
|
-
renderer.setRenderTarget( renderTarget, 0 );
|
|
12521
|
+
renderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );
|
|
12489
12522
|
renderer.render( scene, cameraPX );
|
|
12490
12523
|
|
|
12491
|
-
renderer.setRenderTarget( renderTarget, 1 );
|
|
12524
|
+
renderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );
|
|
12492
12525
|
renderer.render( scene, cameraNX );
|
|
12493
12526
|
|
|
12494
|
-
renderer.setRenderTarget( renderTarget, 2 );
|
|
12527
|
+
renderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );
|
|
12495
12528
|
renderer.render( scene, cameraPY );
|
|
12496
12529
|
|
|
12497
|
-
renderer.setRenderTarget( renderTarget, 3 );
|
|
12530
|
+
renderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );
|
|
12498
12531
|
renderer.render( scene, cameraNY );
|
|
12499
12532
|
|
|
12500
|
-
renderer.setRenderTarget( renderTarget, 4 );
|
|
12533
|
+
renderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );
|
|
12501
12534
|
renderer.render( scene, cameraPZ );
|
|
12502
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
|
+
|
|
12503
12539
|
renderTarget.texture.generateMipmaps = generateMipmaps;
|
|
12504
12540
|
|
|
12505
|
-
renderer.setRenderTarget( renderTarget, 5 );
|
|
12541
|
+
renderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );
|
|
12506
12542
|
renderer.render( scene, cameraNZ );
|
|
12507
12543
|
|
|
12508
|
-
renderer.setRenderTarget( currentRenderTarget );
|
|
12544
|
+
renderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
|
|
12509
12545
|
|
|
12510
12546
|
renderer.xr.enabled = currentXrEnabled;
|
|
12511
12547
|
|
|
@@ -13419,7 +13455,7 @@
|
|
|
13419
13455
|
|
|
13420
13456
|
var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
|
|
13421
13457
|
|
|
13422
|
-
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(
|
|
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";
|
|
13423
13459
|
|
|
13424
13460
|
var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
|
|
13425
13461
|
|
|
@@ -13449,7 +13485,7 @@
|
|
|
13449
13485
|
|
|
13450
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";
|
|
13451
13487
|
|
|
13452
|
-
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};\
|
|
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";
|
|
13453
13489
|
|
|
13454
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";
|
|
13455
13491
|
|
|
@@ -13465,7 +13501,7 @@
|
|
|
13465
13501
|
|
|
13466
13502
|
var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
13467
13503
|
|
|
13468
|
-
var colorspace_pars_fragment = "vec4
|
|
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}";
|
|
13469
13505
|
|
|
13470
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";
|
|
13471
13507
|
|
|
@@ -13493,29 +13529,29 @@
|
|
|
13493
13529
|
|
|
13494
13530
|
var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
13495
13531
|
|
|
13496
|
-
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
|
|
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";
|
|
13497
13533
|
|
|
13498
|
-
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\
|
|
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";
|
|
13499
13535
|
|
|
13500
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";
|
|
13501
13537
|
|
|
13502
13538
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
13503
13539
|
|
|
13504
|
-
var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in
|
|
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";
|
|
13505
13541
|
|
|
13506
13542
|
var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
13507
13543
|
|
|
13508
|
-
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
|
|
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";
|
|
13509
13545
|
|
|
13510
|
-
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx(
|
|
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";
|
|
13511
13547
|
|
|
13512
|
-
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}";
|
|
13513
13549
|
|
|
13514
|
-
var lights_fragment_begin = "\
|
|
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";
|
|
13515
13551
|
|
|
13516
|
-
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(
|
|
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";
|
|
13517
13553
|
|
|
13518
|
-
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance,
|
|
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";
|
|
13519
13555
|
|
|
13520
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";
|
|
13521
13557
|
|
|
@@ -13545,7 +13581,7 @@
|
|
|
13545
13581
|
|
|
13546
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";
|
|
13547
13583
|
|
|
13548
|
-
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
|
|
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;";
|
|
13549
13585
|
|
|
13550
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";
|
|
13551
13587
|
|
|
@@ -13557,7 +13593,7 @@
|
|
|
13557
13593
|
|
|
13558
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";
|
|
13559
13595
|
|
|
13560
|
-
var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal =
|
|
13596
|
+
var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";
|
|
13561
13597
|
|
|
13562
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";
|
|
13563
13599
|
|
|
@@ -13667,7 +13703,7 @@
|
|
|
13667
13703
|
|
|
13668
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}";
|
|
13669
13705
|
|
|
13670
|
-
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(
|
|
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}";
|
|
13671
13707
|
|
|
13672
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}";
|
|
13673
13709
|
|
|
@@ -14503,7 +14539,7 @@
|
|
|
14503
14539
|
boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
14504
14540
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
14505
14541
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
14506
|
-
boxMesh.material.toneMapped = ( background.colorSpace
|
|
14542
|
+
boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
|
|
14507
14543
|
|
|
14508
14544
|
if ( currentBackground !== background ||
|
|
14509
14545
|
currentBackgroundVersion !== background.version ||
|
|
@@ -14559,7 +14595,7 @@
|
|
|
14559
14595
|
|
|
14560
14596
|
planeMesh.material.uniforms.t2D.value = background;
|
|
14561
14597
|
planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
14562
|
-
planeMesh.material.toneMapped = ( background.colorSpace
|
|
14598
|
+
planeMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
|
|
14563
14599
|
|
|
14564
14600
|
if ( background.matrixAutoUpdate === true ) {
|
|
14565
14601
|
|
|
@@ -18823,15 +18859,38 @@
|
|
|
18823
18859
|
|
|
18824
18860
|
function getEncodingComponents( colorSpace ) {
|
|
18825
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
|
+
|
|
18826
18881
|
switch ( colorSpace ) {
|
|
18827
18882
|
|
|
18828
18883
|
case LinearSRGBColorSpace:
|
|
18829
|
-
|
|
18884
|
+
case LinearDisplayP3ColorSpace:
|
|
18885
|
+
return [ gamutMapping, 'LinearTransferOETF' ];
|
|
18886
|
+
|
|
18830
18887
|
case SRGBColorSpace:
|
|
18831
|
-
|
|
18888
|
+
case DisplayP3ColorSpace:
|
|
18889
|
+
return [ gamutMapping, 'sRGBTransferOETF' ];
|
|
18890
|
+
|
|
18832
18891
|
default:
|
|
18833
18892
|
console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
|
|
18834
|
-
return [
|
|
18893
|
+
return [ gamutMapping, 'LinearTransferOETF' ];
|
|
18835
18894
|
|
|
18836
18895
|
}
|
|
18837
18896
|
|
|
@@ -18864,7 +18923,7 @@
|
|
|
18864
18923
|
function getTexelEncodingFunction( functionName, colorSpace ) {
|
|
18865
18924
|
|
|
18866
18925
|
const components = getEncodingComponents( colorSpace );
|
|
18867
|
-
return
|
|
18926
|
+
return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;
|
|
18868
18927
|
|
|
18869
18928
|
}
|
|
18870
18929
|
|
|
@@ -19291,6 +19350,7 @@
|
|
|
19291
19350
|
parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
|
|
19292
19351
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
19293
19352
|
|
|
19353
|
+
parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
|
|
19294
19354
|
parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
|
|
19295
19355
|
|
|
19296
19356
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
@@ -19378,6 +19438,8 @@
|
|
|
19378
19438
|
|
|
19379
19439
|
parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
|
|
19380
19440
|
|
|
19441
|
+
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
19442
|
+
|
|
19381
19443
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19382
19444
|
|
|
19383
19445
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
@@ -19560,6 +19622,8 @@
|
|
|
19560
19622
|
|
|
19561
19623
|
parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',
|
|
19562
19624
|
|
|
19625
|
+
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
19626
|
+
|
|
19563
19627
|
parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
|
|
19564
19628
|
|
|
19565
19629
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
@@ -20240,6 +20304,8 @@
|
|
|
20240
20304
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
20241
20305
|
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
20242
20306
|
|
|
20307
|
+
numLightProbes: lights.numLightProbes,
|
|
20308
|
+
|
|
20243
20309
|
numClippingPlanes: clipping.numPlanes,
|
|
20244
20310
|
numClipIntersection: clipping.numIntersection,
|
|
20245
20311
|
|
|
@@ -20251,7 +20317,7 @@
|
|
|
20251
20317
|
toneMapping: toneMapping,
|
|
20252
20318
|
useLegacyLights: renderer._useLegacyLights,
|
|
20253
20319
|
|
|
20254
|
-
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( material.map.colorSpace ===
|
|
20320
|
+
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
|
|
20255
20321
|
|
|
20256
20322
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
20257
20323
|
|
|
@@ -20364,6 +20430,7 @@
|
|
|
20364
20430
|
array.push( parameters.numPointLightShadows );
|
|
20365
20431
|
array.push( parameters.numSpotLightShadows );
|
|
20366
20432
|
array.push( parameters.numSpotLightShadowsWithMaps );
|
|
20433
|
+
array.push( parameters.numLightProbes );
|
|
20367
20434
|
array.push( parameters.shadowMapType );
|
|
20368
20435
|
array.push( parameters.toneMapping );
|
|
20369
20436
|
array.push( parameters.numClippingPlanes );
|
|
@@ -21002,7 +21069,9 @@
|
|
|
21002
21069
|
numDirectionalShadows: - 1,
|
|
21003
21070
|
numPointShadows: - 1,
|
|
21004
21071
|
numSpotShadows: - 1,
|
|
21005
|
-
numSpotMaps: - 1
|
|
21072
|
+
numSpotMaps: - 1,
|
|
21073
|
+
|
|
21074
|
+
numLightProbes: - 1
|
|
21006
21075
|
},
|
|
21007
21076
|
|
|
21008
21077
|
ambient: [ 0, 0, 0 ],
|
|
@@ -21024,7 +21093,8 @@
|
|
|
21024
21093
|
pointShadowMap: [],
|
|
21025
21094
|
pointShadowMatrix: [],
|
|
21026
21095
|
hemi: [],
|
|
21027
|
-
numSpotLightShadowsWithMaps: 0
|
|
21096
|
+
numSpotLightShadowsWithMaps: 0,
|
|
21097
|
+
numLightProbes: 0
|
|
21028
21098
|
|
|
21029
21099
|
};
|
|
21030
21100
|
|
|
@@ -21052,6 +21122,8 @@
|
|
|
21052
21122
|
let numSpotMaps = 0;
|
|
21053
21123
|
let numSpotShadowsWithMaps = 0;
|
|
21054
21124
|
|
|
21125
|
+
let numLightProbes = 0;
|
|
21126
|
+
|
|
21055
21127
|
// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
|
|
21056
21128
|
lights.sort( shadowCastingAndTexturingLightsFirst );
|
|
21057
21129
|
|
|
@@ -21082,6 +21154,8 @@
|
|
|
21082
21154
|
|
|
21083
21155
|
}
|
|
21084
21156
|
|
|
21157
|
+
numLightProbes ++;
|
|
21158
|
+
|
|
21085
21159
|
} else if ( light.isDirectionalLight ) {
|
|
21086
21160
|
|
|
21087
21161
|
const uniforms = cache.get( light );
|
|
@@ -21269,7 +21343,8 @@
|
|
|
21269
21343
|
hash.numDirectionalShadows !== numDirectionalShadows ||
|
|
21270
21344
|
hash.numPointShadows !== numPointShadows ||
|
|
21271
21345
|
hash.numSpotShadows !== numSpotShadows ||
|
|
21272
|
-
hash.numSpotMaps !== numSpotMaps
|
|
21346
|
+
hash.numSpotMaps !== numSpotMaps ||
|
|
21347
|
+
hash.numLightProbes !== numLightProbes ) {
|
|
21273
21348
|
|
|
21274
21349
|
state.directional.length = directionalLength;
|
|
21275
21350
|
state.spot.length = spotLength;
|
|
@@ -21288,6 +21363,7 @@
|
|
|
21288
21363
|
state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
|
|
21289
21364
|
state.spotLightMap.length = numSpotMaps;
|
|
21290
21365
|
state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
|
|
21366
|
+
state.numLightProbes = numLightProbes;
|
|
21291
21367
|
|
|
21292
21368
|
hash.directionalLength = directionalLength;
|
|
21293
21369
|
hash.pointLength = pointLength;
|
|
@@ -21300,6 +21376,8 @@
|
|
|
21300
21376
|
hash.numSpotShadows = numSpotShadows;
|
|
21301
21377
|
hash.numSpotMaps = numSpotMaps;
|
|
21302
21378
|
|
|
21379
|
+
hash.numLightProbes = numLightProbes;
|
|
21380
|
+
|
|
21303
21381
|
state.version = nextVersion ++;
|
|
21304
21382
|
|
|
21305
21383
|
}
|
|
@@ -23446,9 +23524,11 @@
|
|
|
23446
23524
|
|
|
23447
23525
|
if ( glFormat === _gl.RGBA ) {
|
|
23448
23526
|
|
|
23527
|
+
const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
|
|
23528
|
+
|
|
23449
23529
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
|
|
23450
23530
|
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
|
|
23451
|
-
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = (
|
|
23531
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
23452
23532
|
if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
|
|
23453
23533
|
if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
|
|
23454
23534
|
|
|
@@ -24003,10 +24083,14 @@
|
|
|
24003
24083
|
|
|
24004
24084
|
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
24005
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
|
+
|
|
24006
24090
|
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
24007
24091
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
24008
24092
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
24009
|
-
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
|
|
24093
|
+
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
24010
24094
|
|
|
24011
24095
|
const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
|
|
24012
24096
|
let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
|
|
@@ -24417,10 +24501,14 @@
|
|
|
24417
24501
|
|
|
24418
24502
|
state.activeTexture( _gl.TEXTURE0 + slot );
|
|
24419
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
|
+
|
|
24420
24508
|
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
24421
24509
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
24422
24510
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
24423
|
-
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
|
|
24511
|
+
_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
24424
24512
|
|
|
24425
24513
|
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
24426
24514
|
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
@@ -24660,7 +24748,7 @@
|
|
|
24660
24748
|
|
|
24661
24749
|
if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
24662
24750
|
|
|
24663
|
-
let glInternalFormat = _gl.DEPTH_COMPONENT16;
|
|
24751
|
+
let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
|
|
24664
24752
|
|
|
24665
24753
|
if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
|
|
24666
24754
|
|
|
@@ -25301,7 +25389,7 @@
|
|
|
25301
25389
|
|
|
25302
25390
|
// sRGB
|
|
25303
25391
|
|
|
25304
|
-
if ( colorSpace
|
|
25392
|
+
if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
|
|
25305
25393
|
|
|
25306
25394
|
if ( isWebGL2 === false ) {
|
|
25307
25395
|
|
|
@@ -25367,9 +25455,6 @@
|
|
|
25367
25455
|
|
|
25368
25456
|
}
|
|
25369
25457
|
|
|
25370
|
-
const LinearTransferFunction = 0;
|
|
25371
|
-
const SRGBTransferFunction = 1;
|
|
25372
|
-
|
|
25373
25458
|
function WebGLUtils( gl, extensions, capabilities ) {
|
|
25374
25459
|
|
|
25375
25460
|
const isWebGL2 = capabilities.isWebGL2;
|
|
@@ -25378,7 +25463,7 @@
|
|
|
25378
25463
|
|
|
25379
25464
|
let extension;
|
|
25380
25465
|
|
|
25381
|
-
const
|
|
25466
|
+
const transfer = ColorManagement.getTransfer( colorSpace );
|
|
25382
25467
|
|
|
25383
25468
|
if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
|
|
25384
25469
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
@@ -25446,7 +25531,7 @@
|
|
|
25446
25531
|
|
|
25447
25532
|
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
|
|
25448
25533
|
|
|
25449
|
-
if (
|
|
25534
|
+
if ( transfer === SRGBTransfer ) {
|
|
25450
25535
|
|
|
25451
25536
|
extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
|
|
25452
25537
|
|
|
@@ -25531,8 +25616,8 @@
|
|
|
25531
25616
|
|
|
25532
25617
|
if ( extension !== null ) {
|
|
25533
25618
|
|
|
25534
|
-
if ( p === RGB_ETC2_Format ) return (
|
|
25535
|
-
if ( p === RGBA_ETC2_EAC_Format ) return (
|
|
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;
|
|
25536
25621
|
|
|
25537
25622
|
} else {
|
|
25538
25623
|
|
|
@@ -25554,20 +25639,20 @@
|
|
|
25554
25639
|
|
|
25555
25640
|
if ( extension !== null ) {
|
|
25556
25641
|
|
|
25557
|
-
if ( p === RGBA_ASTC_4x4_Format ) return (
|
|
25558
|
-
if ( p === RGBA_ASTC_5x4_Format ) return (
|
|
25559
|
-
if ( p === RGBA_ASTC_5x5_Format ) return (
|
|
25560
|
-
if ( p === RGBA_ASTC_6x5_Format ) return (
|
|
25561
|
-
if ( p === RGBA_ASTC_6x6_Format ) return (
|
|
25562
|
-
if ( p === RGBA_ASTC_8x5_Format ) return (
|
|
25563
|
-
if ( p === RGBA_ASTC_8x6_Format ) return (
|
|
25564
|
-
if ( p === RGBA_ASTC_8x8_Format ) return (
|
|
25565
|
-
if ( p === RGBA_ASTC_10x5_Format ) return (
|
|
25566
|
-
if ( p === RGBA_ASTC_10x6_Format ) return (
|
|
25567
|
-
if ( p === RGBA_ASTC_10x8_Format ) return (
|
|
25568
|
-
if ( p === RGBA_ASTC_10x10_Format ) return (
|
|
25569
|
-
if ( p === RGBA_ASTC_12x10_Format ) return (
|
|
25570
|
-
if ( p === RGBA_ASTC_12x12_Format ) return (
|
|
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;
|
|
25571
25656
|
|
|
25572
25657
|
} else {
|
|
25573
25658
|
|
|
@@ -25585,7 +25670,7 @@
|
|
|
25585
25670
|
|
|
25586
25671
|
if ( extension !== null ) {
|
|
25587
25672
|
|
|
25588
|
-
if ( p === RGBA_BPTC_Format ) return (
|
|
25673
|
+
if ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
25589
25674
|
if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
|
|
25590
25675
|
if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
|
|
25591
25676
|
|
|
@@ -27871,7 +27956,7 @@
|
|
|
27871
27956
|
|
|
27872
27957
|
// physically based shading
|
|
27873
27958
|
|
|
27874
|
-
this.
|
|
27959
|
+
this._outputColorSpace = SRGBColorSpace;
|
|
27875
27960
|
|
|
27876
27961
|
// physical lights
|
|
27877
27962
|
|
|
@@ -30148,6 +30233,22 @@
|
|
|
30148
30233
|
|
|
30149
30234
|
}
|
|
30150
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
|
+
|
|
30151
30252
|
get physicallyCorrectLights() { // @deprecated, r150
|
|
30152
30253
|
|
|
30153
30254
|
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
@@ -32565,10 +32666,13 @@
|
|
|
32565
32666
|
|
|
32566
32667
|
if ( ! startPoint.equals( endPoint ) ) {
|
|
32567
32668
|
|
|
32568
|
-
|
|
32669
|
+
const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
|
|
32670
|
+
this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
|
|
32569
32671
|
|
|
32570
32672
|
}
|
|
32571
32673
|
|
|
32674
|
+
return this;
|
|
32675
|
+
|
|
32572
32676
|
}
|
|
32573
32677
|
|
|
32574
32678
|
// To get accurate point with reference to
|
|
@@ -39829,6 +39933,27 @@
|
|
|
39829
39933
|
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
39830
39934
|
}
|
|
39831
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
|
+
|
|
39832
39957
|
function mean(values, valueof) {
|
|
39833
39958
|
let count = 0;
|
|
39834
39959
|
let sum = 0;
|
|
@@ -39873,6 +39998,25 @@
|
|
|
39873
39998
|
return range;
|
|
39874
39999
|
}
|
|
39875
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
|
+
|
|
39876
40020
|
var epsilon$2 = 1e-6;
|
|
39877
40021
|
var epsilon2 = 1e-12;
|
|
39878
40022
|
var pi$1 = Math.PI;
|
|
@@ -41368,7 +41512,7 @@
|
|
|
41368
41512
|
var coordinates = [null, null],
|
|
41369
41513
|
object$1 = {type: "LineString", coordinates: coordinates};
|
|
41370
41514
|
|
|
41371
|
-
function geoDistance(a, b) {
|
|
41515
|
+
function geoDistance$1(a, b) {
|
|
41372
41516
|
coordinates[0] = a;
|
|
41373
41517
|
coordinates[1] = b;
|
|
41374
41518
|
return length(object$1);
|
|
@@ -41427,16 +41571,16 @@
|
|
|
41427
41571
|
}
|
|
41428
41572
|
|
|
41429
41573
|
function containsPoint(coordinates, point) {
|
|
41430
|
-
return geoDistance(coordinates, point) === 0;
|
|
41574
|
+
return geoDistance$1(coordinates, point) === 0;
|
|
41431
41575
|
}
|
|
41432
41576
|
|
|
41433
41577
|
function containsLine(coordinates, point) {
|
|
41434
41578
|
var ao, bo, ab;
|
|
41435
41579
|
for (var i = 0, n = coordinates.length; i < n; i++) {
|
|
41436
|
-
bo = geoDistance(coordinates[i], point);
|
|
41580
|
+
bo = geoDistance$1(coordinates[i], point);
|
|
41437
41581
|
if (bo === 0) return true;
|
|
41438
41582
|
if (i > 0) {
|
|
41439
|
-
ab = geoDistance(coordinates[i], coordinates[i - 1]);
|
|
41583
|
+
ab = geoDistance$1(coordinates[i], coordinates[i - 1]);
|
|
41440
41584
|
if (
|
|
41441
41585
|
ab > 0 &&
|
|
41442
41586
|
ao <= ab &&
|
|
@@ -42207,7 +42351,7 @@
|
|
|
42207
42351
|
var prevPnt = null;
|
|
42208
42352
|
lineCoords.forEach(function (pnt) {
|
|
42209
42353
|
if (prevPnt) {
|
|
42210
|
-
var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
|
|
42354
|
+
var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
|
|
42211
42355
|
if (dist > maxDegDistance) {
|
|
42212
42356
|
var interpol = geoInterpolate(prevPnt, pnt);
|
|
42213
42357
|
var tStep = 1 / Math.ceil(dist / maxDegDistance);
|
|
@@ -42223,14 +42367,14 @@
|
|
|
42223
42367
|
return result;
|
|
42224
42368
|
};
|
|
42225
42369
|
|
|
42226
|
-
var THREE$
|
|
42370
|
+
var THREE$l = typeof window !== 'undefined' && window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
42227
42371
|
: {
|
|
42228
42372
|
BufferGeometry: BufferGeometry,
|
|
42229
42373
|
Float32BufferAttribute: Float32BufferAttribute
|
|
42230
42374
|
};
|
|
42231
42375
|
|
|
42232
42376
|
// support both modes for backwards threejs compatibility
|
|
42233
|
-
var setAttributeFn$
|
|
42377
|
+
var setAttributeFn$3 = new THREE$l.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
|
|
42234
42378
|
var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
|
|
42235
42379
|
_inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
|
|
42236
42380
|
var _super = _createSuper$2(GeoJsonGeometry);
|
|
@@ -42274,7 +42418,7 @@
|
|
|
42274
42418
|
|
|
42275
42419
|
// build geometry
|
|
42276
42420
|
indices.length && _this.setIndex(indices);
|
|
42277
|
-
vertices.length && _this[setAttributeFn$
|
|
42421
|
+
vertices.length && _this[setAttributeFn$3]('position', new THREE$l.Float32BufferAttribute(vertices, 3));
|
|
42278
42422
|
|
|
42279
42423
|
//
|
|
42280
42424
|
|
|
@@ -42400,7 +42544,7 @@
|
|
|
42400
42544
|
return _this;
|
|
42401
42545
|
}
|
|
42402
42546
|
return _createClass$2(GeoJsonGeometry);
|
|
42403
|
-
}(THREE$
|
|
42547
|
+
}(THREE$l.BufferGeometry); //
|
|
42404
42548
|
function concatGroup(main, extra) {
|
|
42405
42549
|
var prevVertCnt = Math.round(main.vertices.length / 3);
|
|
42406
42550
|
concatArr(main.vertices, extra.vertices);
|
|
@@ -42978,7 +43122,7 @@
|
|
|
42978
43122
|
}
|
|
42979
43123
|
|
|
42980
43124
|
/**
|
|
42981
|
-
* @param {
|
|
43125
|
+
* @param {BufferGeometry} geometry
|
|
42982
43126
|
* @return {number}
|
|
42983
43127
|
*/
|
|
42984
43128
|
function estimateBytesUsed( geometry ) {
|
|
@@ -43054,8 +43198,10 @@
|
|
|
43054
43198
|
}
|
|
43055
43199
|
|
|
43056
43200
|
// convert the error tolerance to an amount of decimal places to truncate to
|
|
43057
|
-
const
|
|
43058
|
-
const
|
|
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;
|
|
43059
43205
|
for ( let i = 0; i < vertexCount; i ++ ) {
|
|
43060
43206
|
|
|
43061
43207
|
const index = indices ? indices.getX( i ) : i;
|
|
@@ -43071,7 +43217,7 @@
|
|
|
43071
43217
|
for ( let k = 0; k < itemSize; k ++ ) {
|
|
43072
43218
|
|
|
43073
43219
|
// double tilde truncates the decimal value
|
|
43074
|
-
hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) *
|
|
43220
|
+
hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * hashMultiplier + hashAdditive ) },`;
|
|
43075
43221
|
|
|
43076
43222
|
}
|
|
43077
43223
|
|
|
@@ -43809,6 +43955,412 @@
|
|
|
43809
43955
|
};
|
|
43810
43956
|
}); // constant
|
|
43811
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
|
+
|
|
43812
44364
|
// This file is autogenerated. It's used to publish ESM to npm.
|
|
43813
44365
|
function _typeof(obj) {
|
|
43814
44366
|
"@babel/helpers - typeof";
|
|
@@ -45475,412 +46027,6 @@
|
|
|
45475
46027
|
return this;
|
|
45476
46028
|
}
|
|
45477
46029
|
|
|
45478
|
-
function define(constructor, factory, prototype) {
|
|
45479
|
-
constructor.prototype = factory.prototype = prototype;
|
|
45480
|
-
prototype.constructor = constructor;
|
|
45481
|
-
}
|
|
45482
|
-
|
|
45483
|
-
function extend(parent, definition) {
|
|
45484
|
-
var prototype = Object.create(parent.prototype);
|
|
45485
|
-
for (var key in definition) prototype[key] = definition[key];
|
|
45486
|
-
return prototype;
|
|
45487
|
-
}
|
|
45488
|
-
|
|
45489
|
-
function Color() {}
|
|
45490
|
-
|
|
45491
|
-
var darker = 0.7;
|
|
45492
|
-
var brighter = 1 / darker;
|
|
45493
|
-
|
|
45494
|
-
var reI = "\\s*([+-]?\\d+)\\s*",
|
|
45495
|
-
reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
|
45496
|
-
reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
|
45497
|
-
reHex = /^#([0-9a-f]{3,8})$/,
|
|
45498
|
-
reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
|
|
45499
|
-
reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
|
|
45500
|
-
reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
|
|
45501
|
-
reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
|
|
45502
|
-
reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
|
|
45503
|
-
reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
45504
|
-
|
|
45505
|
-
var named = {
|
|
45506
|
-
aliceblue: 0xf0f8ff,
|
|
45507
|
-
antiquewhite: 0xfaebd7,
|
|
45508
|
-
aqua: 0x00ffff,
|
|
45509
|
-
aquamarine: 0x7fffd4,
|
|
45510
|
-
azure: 0xf0ffff,
|
|
45511
|
-
beige: 0xf5f5dc,
|
|
45512
|
-
bisque: 0xffe4c4,
|
|
45513
|
-
black: 0x000000,
|
|
45514
|
-
blanchedalmond: 0xffebcd,
|
|
45515
|
-
blue: 0x0000ff,
|
|
45516
|
-
blueviolet: 0x8a2be2,
|
|
45517
|
-
brown: 0xa52a2a,
|
|
45518
|
-
burlywood: 0xdeb887,
|
|
45519
|
-
cadetblue: 0x5f9ea0,
|
|
45520
|
-
chartreuse: 0x7fff00,
|
|
45521
|
-
chocolate: 0xd2691e,
|
|
45522
|
-
coral: 0xff7f50,
|
|
45523
|
-
cornflowerblue: 0x6495ed,
|
|
45524
|
-
cornsilk: 0xfff8dc,
|
|
45525
|
-
crimson: 0xdc143c,
|
|
45526
|
-
cyan: 0x00ffff,
|
|
45527
|
-
darkblue: 0x00008b,
|
|
45528
|
-
darkcyan: 0x008b8b,
|
|
45529
|
-
darkgoldenrod: 0xb8860b,
|
|
45530
|
-
darkgray: 0xa9a9a9,
|
|
45531
|
-
darkgreen: 0x006400,
|
|
45532
|
-
darkgrey: 0xa9a9a9,
|
|
45533
|
-
darkkhaki: 0xbdb76b,
|
|
45534
|
-
darkmagenta: 0x8b008b,
|
|
45535
|
-
darkolivegreen: 0x556b2f,
|
|
45536
|
-
darkorange: 0xff8c00,
|
|
45537
|
-
darkorchid: 0x9932cc,
|
|
45538
|
-
darkred: 0x8b0000,
|
|
45539
|
-
darksalmon: 0xe9967a,
|
|
45540
|
-
darkseagreen: 0x8fbc8f,
|
|
45541
|
-
darkslateblue: 0x483d8b,
|
|
45542
|
-
darkslategray: 0x2f4f4f,
|
|
45543
|
-
darkslategrey: 0x2f4f4f,
|
|
45544
|
-
darkturquoise: 0x00ced1,
|
|
45545
|
-
darkviolet: 0x9400d3,
|
|
45546
|
-
deeppink: 0xff1493,
|
|
45547
|
-
deepskyblue: 0x00bfff,
|
|
45548
|
-
dimgray: 0x696969,
|
|
45549
|
-
dimgrey: 0x696969,
|
|
45550
|
-
dodgerblue: 0x1e90ff,
|
|
45551
|
-
firebrick: 0xb22222,
|
|
45552
|
-
floralwhite: 0xfffaf0,
|
|
45553
|
-
forestgreen: 0x228b22,
|
|
45554
|
-
fuchsia: 0xff00ff,
|
|
45555
|
-
gainsboro: 0xdcdcdc,
|
|
45556
|
-
ghostwhite: 0xf8f8ff,
|
|
45557
|
-
gold: 0xffd700,
|
|
45558
|
-
goldenrod: 0xdaa520,
|
|
45559
|
-
gray: 0x808080,
|
|
45560
|
-
green: 0x008000,
|
|
45561
|
-
greenyellow: 0xadff2f,
|
|
45562
|
-
grey: 0x808080,
|
|
45563
|
-
honeydew: 0xf0fff0,
|
|
45564
|
-
hotpink: 0xff69b4,
|
|
45565
|
-
indianred: 0xcd5c5c,
|
|
45566
|
-
indigo: 0x4b0082,
|
|
45567
|
-
ivory: 0xfffff0,
|
|
45568
|
-
khaki: 0xf0e68c,
|
|
45569
|
-
lavender: 0xe6e6fa,
|
|
45570
|
-
lavenderblush: 0xfff0f5,
|
|
45571
|
-
lawngreen: 0x7cfc00,
|
|
45572
|
-
lemonchiffon: 0xfffacd,
|
|
45573
|
-
lightblue: 0xadd8e6,
|
|
45574
|
-
lightcoral: 0xf08080,
|
|
45575
|
-
lightcyan: 0xe0ffff,
|
|
45576
|
-
lightgoldenrodyellow: 0xfafad2,
|
|
45577
|
-
lightgray: 0xd3d3d3,
|
|
45578
|
-
lightgreen: 0x90ee90,
|
|
45579
|
-
lightgrey: 0xd3d3d3,
|
|
45580
|
-
lightpink: 0xffb6c1,
|
|
45581
|
-
lightsalmon: 0xffa07a,
|
|
45582
|
-
lightseagreen: 0x20b2aa,
|
|
45583
|
-
lightskyblue: 0x87cefa,
|
|
45584
|
-
lightslategray: 0x778899,
|
|
45585
|
-
lightslategrey: 0x778899,
|
|
45586
|
-
lightsteelblue: 0xb0c4de,
|
|
45587
|
-
lightyellow: 0xffffe0,
|
|
45588
|
-
lime: 0x00ff00,
|
|
45589
|
-
limegreen: 0x32cd32,
|
|
45590
|
-
linen: 0xfaf0e6,
|
|
45591
|
-
magenta: 0xff00ff,
|
|
45592
|
-
maroon: 0x800000,
|
|
45593
|
-
mediumaquamarine: 0x66cdaa,
|
|
45594
|
-
mediumblue: 0x0000cd,
|
|
45595
|
-
mediumorchid: 0xba55d3,
|
|
45596
|
-
mediumpurple: 0x9370db,
|
|
45597
|
-
mediumseagreen: 0x3cb371,
|
|
45598
|
-
mediumslateblue: 0x7b68ee,
|
|
45599
|
-
mediumspringgreen: 0x00fa9a,
|
|
45600
|
-
mediumturquoise: 0x48d1cc,
|
|
45601
|
-
mediumvioletred: 0xc71585,
|
|
45602
|
-
midnightblue: 0x191970,
|
|
45603
|
-
mintcream: 0xf5fffa,
|
|
45604
|
-
mistyrose: 0xffe4e1,
|
|
45605
|
-
moccasin: 0xffe4b5,
|
|
45606
|
-
navajowhite: 0xffdead,
|
|
45607
|
-
navy: 0x000080,
|
|
45608
|
-
oldlace: 0xfdf5e6,
|
|
45609
|
-
olive: 0x808000,
|
|
45610
|
-
olivedrab: 0x6b8e23,
|
|
45611
|
-
orange: 0xffa500,
|
|
45612
|
-
orangered: 0xff4500,
|
|
45613
|
-
orchid: 0xda70d6,
|
|
45614
|
-
palegoldenrod: 0xeee8aa,
|
|
45615
|
-
palegreen: 0x98fb98,
|
|
45616
|
-
paleturquoise: 0xafeeee,
|
|
45617
|
-
palevioletred: 0xdb7093,
|
|
45618
|
-
papayawhip: 0xffefd5,
|
|
45619
|
-
peachpuff: 0xffdab9,
|
|
45620
|
-
peru: 0xcd853f,
|
|
45621
|
-
pink: 0xffc0cb,
|
|
45622
|
-
plum: 0xdda0dd,
|
|
45623
|
-
powderblue: 0xb0e0e6,
|
|
45624
|
-
purple: 0x800080,
|
|
45625
|
-
rebeccapurple: 0x663399,
|
|
45626
|
-
red: 0xff0000,
|
|
45627
|
-
rosybrown: 0xbc8f8f,
|
|
45628
|
-
royalblue: 0x4169e1,
|
|
45629
|
-
saddlebrown: 0x8b4513,
|
|
45630
|
-
salmon: 0xfa8072,
|
|
45631
|
-
sandybrown: 0xf4a460,
|
|
45632
|
-
seagreen: 0x2e8b57,
|
|
45633
|
-
seashell: 0xfff5ee,
|
|
45634
|
-
sienna: 0xa0522d,
|
|
45635
|
-
silver: 0xc0c0c0,
|
|
45636
|
-
skyblue: 0x87ceeb,
|
|
45637
|
-
slateblue: 0x6a5acd,
|
|
45638
|
-
slategray: 0x708090,
|
|
45639
|
-
slategrey: 0x708090,
|
|
45640
|
-
snow: 0xfffafa,
|
|
45641
|
-
springgreen: 0x00ff7f,
|
|
45642
|
-
steelblue: 0x4682b4,
|
|
45643
|
-
tan: 0xd2b48c,
|
|
45644
|
-
teal: 0x008080,
|
|
45645
|
-
thistle: 0xd8bfd8,
|
|
45646
|
-
tomato: 0xff6347,
|
|
45647
|
-
turquoise: 0x40e0d0,
|
|
45648
|
-
violet: 0xee82ee,
|
|
45649
|
-
wheat: 0xf5deb3,
|
|
45650
|
-
white: 0xffffff,
|
|
45651
|
-
whitesmoke: 0xf5f5f5,
|
|
45652
|
-
yellow: 0xffff00,
|
|
45653
|
-
yellowgreen: 0x9acd32
|
|
45654
|
-
};
|
|
45655
|
-
|
|
45656
|
-
define(Color, color, {
|
|
45657
|
-
copy(channels) {
|
|
45658
|
-
return Object.assign(new this.constructor, this, channels);
|
|
45659
|
-
},
|
|
45660
|
-
displayable() {
|
|
45661
|
-
return this.rgb().displayable();
|
|
45662
|
-
},
|
|
45663
|
-
hex: color_formatHex, // Deprecated! Use color.formatHex.
|
|
45664
|
-
formatHex: color_formatHex,
|
|
45665
|
-
formatHex8: color_formatHex8,
|
|
45666
|
-
formatHsl: color_formatHsl,
|
|
45667
|
-
formatRgb: color_formatRgb,
|
|
45668
|
-
toString: color_formatRgb
|
|
45669
|
-
});
|
|
45670
|
-
|
|
45671
|
-
function color_formatHex() {
|
|
45672
|
-
return this.rgb().formatHex();
|
|
45673
|
-
}
|
|
45674
|
-
|
|
45675
|
-
function color_formatHex8() {
|
|
45676
|
-
return this.rgb().formatHex8();
|
|
45677
|
-
}
|
|
45678
|
-
|
|
45679
|
-
function color_formatHsl() {
|
|
45680
|
-
return hslConvert(this).formatHsl();
|
|
45681
|
-
}
|
|
45682
|
-
|
|
45683
|
-
function color_formatRgb() {
|
|
45684
|
-
return this.rgb().formatRgb();
|
|
45685
|
-
}
|
|
45686
|
-
|
|
45687
|
-
function color(format) {
|
|
45688
|
-
var m, l;
|
|
45689
|
-
format = (format + "").trim().toLowerCase();
|
|
45690
|
-
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
|
|
45691
|
-
: l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
|
|
45692
|
-
: l === 8 ? rgba$1(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
|
|
45693
|
-
: 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
|
|
45694
|
-
: null) // invalid hex
|
|
45695
|
-
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
|
|
45696
|
-
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
|
|
45697
|
-
: (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
|
|
45698
|
-
: (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)
|
|
45699
|
-
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
|
|
45700
|
-
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
|
|
45701
|
-
: named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
|
|
45702
|
-
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
|
45703
|
-
: null;
|
|
45704
|
-
}
|
|
45705
|
-
|
|
45706
|
-
function rgbn(n) {
|
|
45707
|
-
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
|
45708
|
-
}
|
|
45709
|
-
|
|
45710
|
-
function rgba$1(r, g, b, a) {
|
|
45711
|
-
if (a <= 0) r = g = b = NaN;
|
|
45712
|
-
return new Rgb(r, g, b, a);
|
|
45713
|
-
}
|
|
45714
|
-
|
|
45715
|
-
function rgbConvert(o) {
|
|
45716
|
-
if (!(o instanceof Color)) o = color(o);
|
|
45717
|
-
if (!o) return new Rgb;
|
|
45718
|
-
o = o.rgb();
|
|
45719
|
-
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
45720
|
-
}
|
|
45721
|
-
|
|
45722
|
-
function rgb$2(r, g, b, opacity) {
|
|
45723
|
-
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
45724
|
-
}
|
|
45725
|
-
|
|
45726
|
-
function Rgb(r, g, b, opacity) {
|
|
45727
|
-
this.r = +r;
|
|
45728
|
-
this.g = +g;
|
|
45729
|
-
this.b = +b;
|
|
45730
|
-
this.opacity = +opacity;
|
|
45731
|
-
}
|
|
45732
|
-
|
|
45733
|
-
define(Rgb, rgb$2, extend(Color, {
|
|
45734
|
-
brighter(k) {
|
|
45735
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
45736
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
45737
|
-
},
|
|
45738
|
-
darker(k) {
|
|
45739
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
45740
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
45741
|
-
},
|
|
45742
|
-
rgb() {
|
|
45743
|
-
return this;
|
|
45744
|
-
},
|
|
45745
|
-
clamp() {
|
|
45746
|
-
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
45747
|
-
},
|
|
45748
|
-
displayable() {
|
|
45749
|
-
return (-0.5 <= this.r && this.r < 255.5)
|
|
45750
|
-
&& (-0.5 <= this.g && this.g < 255.5)
|
|
45751
|
-
&& (-0.5 <= this.b && this.b < 255.5)
|
|
45752
|
-
&& (0 <= this.opacity && this.opacity <= 1);
|
|
45753
|
-
},
|
|
45754
|
-
hex: rgb_formatHex, // Deprecated! Use color.formatHex.
|
|
45755
|
-
formatHex: rgb_formatHex,
|
|
45756
|
-
formatHex8: rgb_formatHex8,
|
|
45757
|
-
formatRgb: rgb_formatRgb,
|
|
45758
|
-
toString: rgb_formatRgb
|
|
45759
|
-
}));
|
|
45760
|
-
|
|
45761
|
-
function rgb_formatHex() {
|
|
45762
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
45763
|
-
}
|
|
45764
|
-
|
|
45765
|
-
function rgb_formatHex8() {
|
|
45766
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
45767
|
-
}
|
|
45768
|
-
|
|
45769
|
-
function rgb_formatRgb() {
|
|
45770
|
-
const a = clampa(this.opacity);
|
|
45771
|
-
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
45772
|
-
}
|
|
45773
|
-
|
|
45774
|
-
function clampa(opacity) {
|
|
45775
|
-
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
45776
|
-
}
|
|
45777
|
-
|
|
45778
|
-
function clampi(value) {
|
|
45779
|
-
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
45780
|
-
}
|
|
45781
|
-
|
|
45782
|
-
function hex(value) {
|
|
45783
|
-
value = clampi(value);
|
|
45784
|
-
return (value < 16 ? "0" : "") + value.toString(16);
|
|
45785
|
-
}
|
|
45786
|
-
|
|
45787
|
-
function hsla(h, s, l, a) {
|
|
45788
|
-
if (a <= 0) h = s = l = NaN;
|
|
45789
|
-
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
45790
|
-
else if (s <= 0) h = NaN;
|
|
45791
|
-
return new Hsl(h, s, l, a);
|
|
45792
|
-
}
|
|
45793
|
-
|
|
45794
|
-
function hslConvert(o) {
|
|
45795
|
-
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
45796
|
-
if (!(o instanceof Color)) o = color(o);
|
|
45797
|
-
if (!o) return new Hsl;
|
|
45798
|
-
if (o instanceof Hsl) return o;
|
|
45799
|
-
o = o.rgb();
|
|
45800
|
-
var r = o.r / 255,
|
|
45801
|
-
g = o.g / 255,
|
|
45802
|
-
b = o.b / 255,
|
|
45803
|
-
min = Math.min(r, g, b),
|
|
45804
|
-
max = Math.max(r, g, b),
|
|
45805
|
-
h = NaN,
|
|
45806
|
-
s = max - min,
|
|
45807
|
-
l = (max + min) / 2;
|
|
45808
|
-
if (s) {
|
|
45809
|
-
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
45810
|
-
else if (g === max) h = (b - r) / s + 2;
|
|
45811
|
-
else h = (r - g) / s + 4;
|
|
45812
|
-
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
45813
|
-
h *= 60;
|
|
45814
|
-
} else {
|
|
45815
|
-
s = l > 0 && l < 1 ? 0 : h;
|
|
45816
|
-
}
|
|
45817
|
-
return new Hsl(h, s, l, o.opacity);
|
|
45818
|
-
}
|
|
45819
|
-
|
|
45820
|
-
function hsl(h, s, l, opacity) {
|
|
45821
|
-
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
45822
|
-
}
|
|
45823
|
-
|
|
45824
|
-
function Hsl(h, s, l, opacity) {
|
|
45825
|
-
this.h = +h;
|
|
45826
|
-
this.s = +s;
|
|
45827
|
-
this.l = +l;
|
|
45828
|
-
this.opacity = +opacity;
|
|
45829
|
-
}
|
|
45830
|
-
|
|
45831
|
-
define(Hsl, hsl, extend(Color, {
|
|
45832
|
-
brighter(k) {
|
|
45833
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
45834
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
45835
|
-
},
|
|
45836
|
-
darker(k) {
|
|
45837
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
45838
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
45839
|
-
},
|
|
45840
|
-
rgb() {
|
|
45841
|
-
var h = this.h % 360 + (this.h < 0) * 360,
|
|
45842
|
-
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
45843
|
-
l = this.l,
|
|
45844
|
-
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
45845
|
-
m1 = 2 * l - m2;
|
|
45846
|
-
return new Rgb(
|
|
45847
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
45848
|
-
hsl2rgb(h, m1, m2),
|
|
45849
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
45850
|
-
this.opacity
|
|
45851
|
-
);
|
|
45852
|
-
},
|
|
45853
|
-
clamp() {
|
|
45854
|
-
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
45855
|
-
},
|
|
45856
|
-
displayable() {
|
|
45857
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
45858
|
-
&& (0 <= this.l && this.l <= 1)
|
|
45859
|
-
&& (0 <= this.opacity && this.opacity <= 1);
|
|
45860
|
-
},
|
|
45861
|
-
formatHsl() {
|
|
45862
|
-
const a = clampa(this.opacity);
|
|
45863
|
-
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
45864
|
-
}
|
|
45865
|
-
}));
|
|
45866
|
-
|
|
45867
|
-
function clamph(value) {
|
|
45868
|
-
value = (value || 0) % 360;
|
|
45869
|
-
return value < 0 ? value + 360 : value;
|
|
45870
|
-
}
|
|
45871
|
-
|
|
45872
|
-
function clampt(value) {
|
|
45873
|
-
return Math.max(0, Math.min(1, value || 0));
|
|
45874
|
-
}
|
|
45875
|
-
|
|
45876
|
-
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
45877
|
-
function hsl2rgb(h, m1, m2) {
|
|
45878
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
45879
|
-
: h < 180 ? m2
|
|
45880
|
-
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
45881
|
-
: m1) * 255;
|
|
45882
|
-
}
|
|
45883
|
-
|
|
45884
46030
|
var constant = x => () => x;
|
|
45885
46031
|
|
|
45886
46032
|
function linear$1(a, d) {
|
|
@@ -48720,7 +48866,7 @@
|
|
|
48720
48866
|
}
|
|
48721
48867
|
if (!v.delaunay) return false;
|
|
48722
48868
|
const _distances = v.delaunay.edges.map(e =>
|
|
48723
|
-
geoDistance(v.points[e[0]], v.points[e[1]])
|
|
48869
|
+
geoDistance$1(v.points[e[0]], v.points[e[1]])
|
|
48724
48870
|
),
|
|
48725
48871
|
_urquart = v.delaunay.urquhart(_distances);
|
|
48726
48872
|
return {
|
|
@@ -48780,7 +48926,7 @@
|
|
|
48780
48926
|
v._found = undefined;
|
|
48781
48927
|
v.find = function(x, y, radius) {
|
|
48782
48928
|
v._found = v.delaunay.find(x, y, v._found);
|
|
48783
|
-
if (!radius || geoDistance([x, y], v.points[v._found]) < radius)
|
|
48929
|
+
if (!radius || geoDistance$1([x, y], v.points[v._found]) < radius)
|
|
48784
48930
|
return v._found;
|
|
48785
48931
|
};
|
|
48786
48932
|
|
|
@@ -49092,7 +49238,7 @@
|
|
|
49092
49238
|
var prevPnt;
|
|
49093
49239
|
coords.forEach(function (pnt) {
|
|
49094
49240
|
if (prevPnt) {
|
|
49095
|
-
var dist = geoDistance(pnt, prevPnt) * 180 / Math.PI;
|
|
49241
|
+
var dist = geoDistance$1(pnt, prevPnt) * 180 / Math.PI;
|
|
49096
49242
|
if (dist > maxDistance) {
|
|
49097
49243
|
var interpol = geoInterpolate(prevPnt, pnt);
|
|
49098
49244
|
var tStep = 1 / Math.ceil(dist / maxDistance);
|
|
@@ -49180,14 +49326,14 @@
|
|
|
49180
49326
|
return crossesPoleOrAntimeridian ? geoContains(polygon, pnt) : booleanPointInPolygon(pnt, polygon);
|
|
49181
49327
|
}
|
|
49182
49328
|
|
|
49183
|
-
var THREE$
|
|
49329
|
+
var THREE$k = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
49184
49330
|
: {
|
|
49185
49331
|
BufferGeometry: BufferGeometry,
|
|
49186
49332
|
Float32BufferAttribute: Float32BufferAttribute
|
|
49187
49333
|
};
|
|
49188
49334
|
|
|
49189
49335
|
// support both modes for backwards threejs compatibility
|
|
49190
|
-
var setAttributeFn$
|
|
49336
|
+
var setAttributeFn$2 = new THREE$k.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
|
|
49191
49337
|
var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
|
|
49192
49338
|
_inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
|
|
49193
49339
|
var _super = _createSuper$1(ConicPolygonBufferGeometry);
|
|
@@ -49242,8 +49388,8 @@
|
|
|
49242
49388
|
|
|
49243
49389
|
// build geometry
|
|
49244
49390
|
_this.setIndex(indices);
|
|
49245
|
-
_this[setAttributeFn$
|
|
49246
|
-
_this[setAttributeFn$
|
|
49391
|
+
_this[setAttributeFn$2]('position', new THREE$k.Float32BufferAttribute(vertices, 3));
|
|
49392
|
+
_this[setAttributeFn$2]('uv', new THREE$k.Float32BufferAttribute(uvs, 2));
|
|
49247
49393
|
|
|
49248
49394
|
// auto-calculate normals
|
|
49249
49395
|
_this.computeVertexNormals();
|
|
@@ -49307,7 +49453,7 @@
|
|
|
49307
49453
|
return _this;
|
|
49308
49454
|
}
|
|
49309
49455
|
return _createClass$1(ConicPolygonBufferGeometry);
|
|
49310
|
-
}(THREE$
|
|
49456
|
+
}(THREE$k.BufferGeometry); //
|
|
49311
49457
|
function polar2Cartesian$1(lat, lng) {
|
|
49312
49458
|
var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
49313
49459
|
var phi = (90 - lat) * Math.PI / 180;
|
|
@@ -64266,6 +64412,449 @@
|
|
|
64266
64412
|
return rad * 180 / Math.PI;
|
|
64267
64413
|
}
|
|
64268
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
|
+
|
|
64269
64858
|
const THREE$2$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
64270
64859
|
: {
|
|
64271
64860
|
Box3,
|
|
@@ -64280,7 +64869,7 @@
|
|
|
64280
64869
|
};
|
|
64281
64870
|
|
|
64282
64871
|
// support multiple method names for backwards threejs compatibility
|
|
64283
|
-
var setAttributeFn$1
|
|
64872
|
+
var setAttributeFn$1 = new THREE$2$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
|
|
64284
64873
|
const _box$1 = new THREE$2$1.Box3();
|
|
64285
64874
|
const _vector = new THREE$2$1.Vector3();
|
|
64286
64875
|
class LineSegmentsGeometry extends THREE$2$1.InstancedBufferGeometry {
|
|
@@ -64291,8 +64880,8 @@
|
|
|
64291
64880
|
const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
|
|
64292
64881
|
const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
|
64293
64882
|
this.setIndex(index);
|
|
64294
|
-
this[setAttributeFn$1
|
|
64295
|
-
this[setAttributeFn$1
|
|
64883
|
+
this[setAttributeFn$1]('position', new THREE$2$1.Float32BufferAttribute(positions, 3));
|
|
64884
|
+
this[setAttributeFn$1]('uv', new THREE$2$1.Float32BufferAttribute(uvs, 2));
|
|
64296
64885
|
}
|
|
64297
64886
|
applyMatrix4(matrix) {
|
|
64298
64887
|
const start = this.attributes.instanceStart;
|
|
@@ -64319,9 +64908,9 @@
|
|
|
64319
64908
|
}
|
|
64320
64909
|
const instanceBuffer = new THREE$2$1.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz
|
|
64321
64910
|
|
|
64322
|
-
this[setAttributeFn$1
|
|
64911
|
+
this[setAttributeFn$1]('instanceStart', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz
|
|
64323
64912
|
|
|
64324
|
-
this[setAttributeFn$1
|
|
64913
|
+
this[setAttributeFn$1]('instanceEnd', new THREE$2$1.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz
|
|
64325
64914
|
//
|
|
64326
64915
|
|
|
64327
64916
|
this.computeBoundingBox();
|
|
@@ -64337,9 +64926,9 @@
|
|
|
64337
64926
|
}
|
|
64338
64927
|
const instanceColorBuffer = new THREE$2$1.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb
|
|
64339
64928
|
|
|
64340
|
-
this[setAttributeFn$1
|
|
64929
|
+
this[setAttributeFn$1]('instanceColorStart', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb
|
|
64341
64930
|
|
|
64342
|
-
this[setAttributeFn$1
|
|
64931
|
+
this[setAttributeFn$1]('instanceColorEnd', new THREE$2$1.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb
|
|
64343
64932
|
|
|
64344
64933
|
return this;
|
|
64345
64934
|
}
|
|
@@ -64954,7 +65543,7 @@
|
|
|
64954
65543
|
}
|
|
64955
65544
|
LineMaterial.prototype.isLineMaterial = true;
|
|
64956
65545
|
|
|
64957
|
-
const THREE$
|
|
65546
|
+
const THREE$j = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
64958
65547
|
: {
|
|
64959
65548
|
Box3,
|
|
64960
65549
|
BufferGeometry,
|
|
@@ -64970,20 +65559,20 @@
|
|
|
64970
65559
|
};
|
|
64971
65560
|
|
|
64972
65561
|
// support both modes for backwards threejs compatibility
|
|
64973
|
-
var setAttributeFn
|
|
64974
|
-
const _start = new THREE$
|
|
64975
|
-
const _end = new THREE$
|
|
64976
|
-
const _start4 = new THREE$
|
|
64977
|
-
const _end4 = new THREE$
|
|
64978
|
-
const _ssOrigin = new THREE$
|
|
64979
|
-
const _ssOrigin3 = new THREE$
|
|
64980
|
-
const _mvMatrix = new THREE$
|
|
64981
|
-
const _line = new THREE$
|
|
64982
|
-
const _closestPoint = new THREE$
|
|
64983
|
-
const _box = new THREE$
|
|
64984
|
-
const _sphere = new THREE$
|
|
64985
|
-
const _clipToWorldVector = new THREE$
|
|
64986
|
-
class LineSegments2 extends THREE$
|
|
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 {
|
|
64987
65576
|
constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
|
|
64988
65577
|
color: Math.random() * 0xffffff
|
|
64989
65578
|
})) {
|
|
@@ -65002,11 +65591,11 @@
|
|
|
65002
65591
|
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
|
65003
65592
|
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
|
65004
65593
|
}
|
|
65005
|
-
const instanceDistanceBuffer = new THREE$
|
|
65594
|
+
const instanceDistanceBuffer = new THREE$j.InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
|
|
65006
65595
|
|
|
65007
|
-
geometry[setAttributeFn
|
|
65596
|
+
geometry[setAttributeFn]('instanceDistanceStart', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
|
|
65008
65597
|
|
|
65009
|
-
geometry[setAttributeFn
|
|
65598
|
+
geometry[setAttributeFn]('instanceDistanceEnd', new THREE$j.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
|
|
65010
65599
|
|
|
65011
65600
|
return this;
|
|
65012
65601
|
}
|
|
@@ -65128,7 +65717,7 @@
|
|
|
65128
65717
|
const param = _line.closestPointToPointParameter(_ssOrigin3, true);
|
|
65129
65718
|
_line.at(param, _closestPoint); // check if the intersection point is within clip space
|
|
65130
65719
|
|
|
65131
|
-
const zPos = THREE$
|
|
65720
|
+
const zPos = THREE$j.MathUtils.lerp(_start4.z, _end4.z, param);
|
|
65132
65721
|
const isInClipSpace = zPos >= -1 && zPos <= 1;
|
|
65133
65722
|
const isInside = _ssOrigin3.distanceTo(_closestPoint) < lineWidth * 0.5;
|
|
65134
65723
|
if (isInClipSpace && isInside) {
|
|
@@ -65136,8 +65725,8 @@
|
|
|
65136
65725
|
_line.end.fromBufferAttribute(instanceEnd, i);
|
|
65137
65726
|
_line.start.applyMatrix4(matrixWorld);
|
|
65138
65727
|
_line.end.applyMatrix4(matrixWorld);
|
|
65139
|
-
const pointOnLine = new THREE$
|
|
65140
|
-
const point = new THREE$
|
|
65728
|
+
const pointOnLine = new THREE$j.Vector3();
|
|
65729
|
+
const point = new THREE$j.Vector3();
|
|
65141
65730
|
ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
|
|
65142
65731
|
intersects.push({
|
|
65143
65732
|
point: point,
|
|
@@ -65408,53 +65997,53 @@
|
|
|
65408
65997
|
|
|
65409
65998
|
}
|
|
65410
65999
|
|
|
65411
|
-
function _iterableToArrayLimit$1(
|
|
65412
|
-
var
|
|
65413
|
-
if (null !=
|
|
65414
|
-
var
|
|
65415
|
-
|
|
65416
|
-
|
|
65417
|
-
|
|
65418
|
-
|
|
65419
|
-
|
|
65420
|
-
|
|
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;
|
|
65421
66010
|
try {
|
|
65422
|
-
if (
|
|
65423
|
-
if (Object(
|
|
65424
|
-
|
|
65425
|
-
} else for (; !(
|
|
65426
|
-
} catch (
|
|
65427
|
-
|
|
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;
|
|
65428
66017
|
} finally {
|
|
65429
66018
|
try {
|
|
65430
|
-
if (!
|
|
66019
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
65431
66020
|
} finally {
|
|
65432
|
-
if (
|
|
66021
|
+
if (o) throw n;
|
|
65433
66022
|
}
|
|
65434
66023
|
}
|
|
65435
|
-
return
|
|
66024
|
+
return a;
|
|
65436
66025
|
}
|
|
65437
66026
|
}
|
|
65438
|
-
function ownKeys$1(
|
|
65439
|
-
var
|
|
66027
|
+
function ownKeys$1(e, r) {
|
|
66028
|
+
var t = Object.keys(e);
|
|
65440
66029
|
if (Object.getOwnPropertySymbols) {
|
|
65441
|
-
var
|
|
65442
|
-
|
|
65443
|
-
return Object.getOwnPropertyDescriptor(
|
|
65444
|
-
})),
|
|
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);
|
|
65445
66034
|
}
|
|
65446
|
-
return
|
|
66035
|
+
return t;
|
|
65447
66036
|
}
|
|
65448
|
-
function _objectSpread2$1(
|
|
65449
|
-
for (var
|
|
65450
|
-
var
|
|
65451
|
-
|
|
65452
|
-
_defineProperty$2(
|
|
65453
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
65454
|
-
Object.defineProperty(
|
|
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));
|
|
65455
66044
|
});
|
|
65456
66045
|
}
|
|
65457
|
-
return
|
|
66046
|
+
return e;
|
|
65458
66047
|
}
|
|
65459
66048
|
function _classCallCheck(instance, Constructor) {
|
|
65460
66049
|
if (!(instance instanceof Constructor)) {
|
|
@@ -65650,6 +66239,56 @@
|
|
|
65650
66239
|
var key = _toPrimitive$2(arg, "string");
|
|
65651
66240
|
return typeof key === "symbol" ? key : String(key);
|
|
65652
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
|
+
}
|
|
65653
66292
|
|
|
65654
66293
|
var materialDispose = function materialDispose(material) {
|
|
65655
66294
|
if (material instanceof Array) {
|
|
@@ -65746,7 +66385,7 @@
|
|
|
65746
66385
|
return deg * Math.PI / 180;
|
|
65747
66386
|
}
|
|
65748
66387
|
|
|
65749
|
-
var THREE$
|
|
66388
|
+
var THREE$h = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
65750
66389
|
: {
|
|
65751
66390
|
BackSide: BackSide,
|
|
65752
66391
|
BufferAttribute: BufferAttribute,
|
|
@@ -65766,7 +66405,7 @@
|
|
|
65766
66405
|
|
|
65767
66406
|
// Based off: http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
|
|
65768
66407
|
function createGlowMaterial(coefficient, color, power) {
|
|
65769
|
-
return new THREE$
|
|
66408
|
+
return new THREE$h.ShaderMaterial({
|
|
65770
66409
|
depthWrite: false,
|
|
65771
66410
|
fragmentShader: fragmentShader,
|
|
65772
66411
|
transparent: true,
|
|
@@ -65775,7 +66414,7 @@
|
|
|
65775
66414
|
value: coefficient
|
|
65776
66415
|
},
|
|
65777
66416
|
color: {
|
|
65778
|
-
value: new THREE$
|
|
66417
|
+
value: new THREE$h.Color(color)
|
|
65779
66418
|
},
|
|
65780
66419
|
power: {
|
|
65781
66420
|
value: power
|
|
@@ -65795,7 +66434,7 @@
|
|
|
65795
66434
|
var curPos = geometry.attributes.position.array[idx];
|
|
65796
66435
|
position[idx] = curPos + normal * size;
|
|
65797
66436
|
}
|
|
65798
|
-
glowGeometry.setAttribute('position', new THREE$
|
|
66437
|
+
glowGeometry.setAttribute('position', new THREE$h.BufferAttribute(position, 3));
|
|
65799
66438
|
return glowGeometry;
|
|
65800
66439
|
}
|
|
65801
66440
|
function createGlowMesh(geometry) {
|
|
@@ -65808,12 +66447,12 @@
|
|
|
65808
66447
|
var glowGeometry = createGlowGeometry(geometry, size);
|
|
65809
66448
|
var glowMaterial = createGlowMaterial(coefficient, color, power);
|
|
65810
66449
|
if (backside) {
|
|
65811
|
-
glowMaterial.side = THREE$
|
|
66450
|
+
glowMaterial.side = THREE$h.BackSide;
|
|
65812
66451
|
}
|
|
65813
|
-
return new THREE$
|
|
66452
|
+
return new THREE$h.Mesh(glowGeometry, glowMaterial);
|
|
65814
66453
|
}
|
|
65815
66454
|
|
|
65816
|
-
var THREE$
|
|
66455
|
+
var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
65817
66456
|
: {
|
|
65818
66457
|
Color: Color$1,
|
|
65819
66458
|
LineBasicMaterial: LineBasicMaterial,
|
|
@@ -65878,16 +66517,16 @@
|
|
|
65878
66517
|
},
|
|
65879
66518
|
stateInit: function stateInit() {
|
|
65880
66519
|
// create globe
|
|
65881
|
-
var globeGeometry = new THREE$
|
|
65882
|
-
var defaultGlobeMaterial = new THREE$
|
|
66520
|
+
var globeGeometry = new THREE$g.SphereGeometry(GLOBE_RADIUS, 75, 75);
|
|
66521
|
+
var defaultGlobeMaterial = new THREE$g.MeshPhongMaterial({
|
|
65883
66522
|
color: 0x000000
|
|
65884
66523
|
});
|
|
65885
|
-
var globeObj = new THREE$
|
|
66524
|
+
var globeObj = new THREE$g.Mesh(globeGeometry, defaultGlobeMaterial);
|
|
65886
66525
|
globeObj.rotation.y = -Math.PI / 2; // face prime meridian along Z axis
|
|
65887
66526
|
globeObj.__globeObjType = 'globe'; // Add object type
|
|
65888
66527
|
|
|
65889
66528
|
// create graticules
|
|
65890
|
-
var graticulesObj = new THREE$
|
|
66529
|
+
var graticulesObj = new THREE$g.LineSegments(new GeoJsonGeometry(graticule10(), GLOBE_RADIUS, 2), new THREE$g.LineBasicMaterial({
|
|
65891
66530
|
color: 'lightgrey',
|
|
65892
66531
|
transparent: true,
|
|
65893
66532
|
opacity: 0.1
|
|
@@ -65914,10 +66553,10 @@
|
|
|
65914
66553
|
if (changedProps.hasOwnProperty('globeImageUrl')) {
|
|
65915
66554
|
if (!state.globeImageUrl) {
|
|
65916
66555
|
// Black globe if no image
|
|
65917
|
-
!globeMaterial.color && (globeMaterial.color = new THREE$
|
|
66556
|
+
!globeMaterial.color && (globeMaterial.color = new THREE$g.Color(0x000000));
|
|
65918
66557
|
} else {
|
|
65919
|
-
new THREE$
|
|
65920
|
-
texture.colorSpace = THREE$
|
|
66558
|
+
new THREE$g.TextureLoader().load(state.globeImageUrl, function (texture) {
|
|
66559
|
+
texture.colorSpace = THREE$g.SRGBColorSpace;
|
|
65921
66560
|
globeMaterial.map = texture;
|
|
65922
66561
|
globeMaterial.color = null;
|
|
65923
66562
|
globeMaterial.needsUpdate = true;
|
|
@@ -65932,7 +66571,7 @@
|
|
|
65932
66571
|
globeMaterial.bumpMap = null;
|
|
65933
66572
|
globeMaterial.needsUpdate = true;
|
|
65934
66573
|
} else {
|
|
65935
|
-
state.bumpImageUrl && new THREE$
|
|
66574
|
+
state.bumpImageUrl && new THREE$g.TextureLoader().load(state.bumpImageUrl, function (texture) {
|
|
65936
66575
|
globeMaterial.bumpMap = texture;
|
|
65937
66576
|
globeMaterial.needsUpdate = true;
|
|
65938
66577
|
});
|
|
@@ -65970,15 +66609,30 @@
|
|
|
65970
66609
|
return isNaN(str) ? parseInt(tinycolor(str).toHex(), 16) : str;
|
|
65971
66610
|
};
|
|
65972
66611
|
var colorAlpha = function colorAlpha(str) {
|
|
65973
|
-
return isNaN(str) ?
|
|
66612
|
+
return str && isNaN(str) ? color(str).opacity : 1;
|
|
65974
66613
|
};
|
|
65975
66614
|
var color2ShaderArr = function color2ShaderArr(str) {
|
|
65976
66615
|
var includeAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
65977
|
-
var
|
|
65978
|
-
var
|
|
65979
|
-
|
|
65980
|
-
|
|
65981
|
-
|
|
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;
|
|
65982
66636
|
};
|
|
65983
66637
|
function setMaterialOpacity(material, opacity, depthWrite) {
|
|
65984
66638
|
material.opacity = opacity;
|
|
@@ -65988,6 +66642,29 @@
|
|
|
65988
66642
|
return material;
|
|
65989
66643
|
}
|
|
65990
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
|
+
|
|
65991
66668
|
function threeDigest(data, scene) {
|
|
65992
66669
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
65993
66670
|
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
@@ -66007,15 +66684,13 @@
|
|
|
66007
66684
|
}, options));
|
|
66008
66685
|
}
|
|
66009
66686
|
|
|
66010
|
-
var THREE$
|
|
66687
|
+
var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
66011
66688
|
: {
|
|
66012
|
-
BufferAttribute: BufferAttribute,
|
|
66013
66689
|
BufferGeometry: BufferGeometry,
|
|
66014
66690
|
Color: Color$1,
|
|
66015
66691
|
CylinderGeometry: CylinderGeometry,
|
|
66016
66692
|
Matrix4: Matrix4,
|
|
66017
66693
|
Mesh: Mesh,
|
|
66018
|
-
MeshBasicMaterial: MeshBasicMaterial,
|
|
66019
66694
|
MeshLambertMaterial: MeshLambertMaterial,
|
|
66020
66695
|
Object3D: Object3D,
|
|
66021
66696
|
Vector3: Vector3
|
|
@@ -66025,8 +66700,6 @@
|
|
|
66025
66700
|
|
|
66026
66701
|
//
|
|
66027
66702
|
|
|
66028
|
-
// support multiple method names for backwards threejs compatibility
|
|
66029
|
-
var applyMatrix4Fn$1 = new THREE$d.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
|
|
66030
66703
|
var PointsLayerKapsule = index$2({
|
|
66031
66704
|
props: {
|
|
66032
66705
|
pointsData: {
|
|
@@ -66081,13 +66754,13 @@
|
|
|
66081
66754
|
var colorAccessor = index$1(state.pointColor);
|
|
66082
66755
|
|
|
66083
66756
|
// shared geometry
|
|
66084
|
-
var pointGeometry = new THREE$
|
|
66085
|
-
pointGeometry
|
|
66086
|
-
pointGeometry
|
|
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));
|
|
66087
66760
|
var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
|
|
66088
66761
|
var pointMaterials = {}; // indexed by color
|
|
66089
66762
|
|
|
66090
|
-
var scene = state.pointsMerge ? new THREE$
|
|
66763
|
+
var scene = state.pointsMerge ? new THREE$e.Object3D() : state.scene; // use fake scene if merging points
|
|
66091
66764
|
|
|
66092
66765
|
threeDigest(state.pointsData, scene, {
|
|
66093
66766
|
createObj: createObj,
|
|
@@ -66095,7 +66768,7 @@
|
|
|
66095
66768
|
});
|
|
66096
66769
|
if (state.pointsMerge) {
|
|
66097
66770
|
// merge points into a single mesh
|
|
66098
|
-
var pointsGeometry = !state.pointsData.length ? new THREE$
|
|
66771
|
+
var pointsGeometry = !state.pointsData.length ? new THREE$e.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
|
|
66099
66772
|
var obj = d.__threeObj;
|
|
66100
66773
|
d.__threeObj = undefined; // unbind merged points
|
|
66101
66774
|
|
|
@@ -66103,23 +66776,18 @@
|
|
|
66103
66776
|
|
|
66104
66777
|
// apply mesh world transform to vertices
|
|
66105
66778
|
obj.updateMatrix();
|
|
66106
|
-
geom
|
|
66779
|
+
geom.applyMatrix4(obj.matrix);
|
|
66107
66780
|
|
|
66108
66781
|
// color vertices
|
|
66109
|
-
var color =
|
|
66110
|
-
|
|
66111
|
-
|
|
66112
|
-
|
|
66113
|
-
var idx = i * 3;
|
|
66114
|
-
colors[idx] = color.r;
|
|
66115
|
-
colors[idx + 1] = color.g;
|
|
66116
|
-
colors[idx + 2] = color.b;
|
|
66117
|
-
}
|
|
66118
|
-
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));
|
|
66119
66786
|
return geom;
|
|
66120
66787
|
}));
|
|
66121
|
-
var points = new THREE$
|
|
66788
|
+
var points = new THREE$e.Mesh(pointsGeometry, new THREE$e.MeshLambertMaterial({
|
|
66122
66789
|
color: 0xffffff,
|
|
66790
|
+
transparent: true,
|
|
66123
66791
|
vertexColors: true
|
|
66124
66792
|
}));
|
|
66125
66793
|
points.__globeObjType = 'points'; // Add object type
|
|
@@ -66132,7 +66800,7 @@
|
|
|
66132
66800
|
//
|
|
66133
66801
|
|
|
66134
66802
|
function createObj() {
|
|
66135
|
-
var obj = new THREE$
|
|
66803
|
+
var obj = new THREE$e.Mesh(pointGeometry);
|
|
66136
66804
|
obj.__globeObjType = 'point'; // Add object type
|
|
66137
66805
|
return obj;
|
|
66138
66806
|
}
|
|
@@ -66148,7 +66816,7 @@
|
|
|
66148
66816
|
Object.assign(obj.position, polar2Cartesian(lat, lng));
|
|
66149
66817
|
|
|
66150
66818
|
// orientate outwards
|
|
66151
|
-
var globeCenter = state.pointsMerge ? new THREE$
|
|
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
|
|
66152
66820
|
obj.lookAt(globeCenter);
|
|
66153
66821
|
|
|
66154
66822
|
// scale radius and altitude
|
|
@@ -66184,7 +66852,7 @@
|
|
|
66184
66852
|
obj.visible = showCyl;
|
|
66185
66853
|
if (showCyl) {
|
|
66186
66854
|
if (!pointMaterials.hasOwnProperty(color)) {
|
|
66187
|
-
pointMaterials[color] = new THREE$
|
|
66855
|
+
pointMaterials[color] = new THREE$e.MeshLambertMaterial({
|
|
66188
66856
|
color: colorStr2Hex(color),
|
|
66189
66857
|
transparent: opacity < 1,
|
|
66190
66858
|
opacity: opacity
|
|
@@ -66198,12 +66866,11 @@
|
|
|
66198
66866
|
});
|
|
66199
66867
|
|
|
66200
66868
|
var _excluded$1 = ["stroke"];
|
|
66201
|
-
var THREE$
|
|
66869
|
+
var THREE$d = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
66202
66870
|
: {
|
|
66203
66871
|
BufferGeometry: BufferGeometry,
|
|
66204
66872
|
CubicBezierCurve3: CubicBezierCurve3,
|
|
66205
66873
|
Curve: Curve,
|
|
66206
|
-
Float32BufferAttribute: Float32BufferAttribute,
|
|
66207
66874
|
Group: Group$1,
|
|
66208
66875
|
Line: Line,
|
|
66209
66876
|
Mesh: Mesh,
|
|
@@ -66217,8 +66884,6 @@
|
|
|
66217
66884
|
|
|
66218
66885
|
//
|
|
66219
66886
|
|
|
66220
|
-
// support both modes for backwards threejs compatibility
|
|
66221
|
-
var setAttributeFn$1 = new THREE$c.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
|
|
66222
66887
|
var gradientShaders$1 = {
|
|
66223
66888
|
uniforms: {
|
|
66224
66889
|
// dash param defaults, all relative to full length
|
|
@@ -66303,15 +66968,15 @@
|
|
|
66303
66968
|
methods: {
|
|
66304
66969
|
pauseAnimation: function pauseAnimation(state) {
|
|
66305
66970
|
var _state$ticker;
|
|
66306
|
-
(_state$ticker = state.ticker) === null || _state$ticker === void 0
|
|
66971
|
+
(_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
|
|
66307
66972
|
},
|
|
66308
66973
|
resumeAnimation: function resumeAnimation(state) {
|
|
66309
66974
|
var _state$ticker2;
|
|
66310
|
-
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0
|
|
66975
|
+
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
|
|
66311
66976
|
},
|
|
66312
66977
|
_destructor: function _destructor(state) {
|
|
66313
66978
|
var _state$ticker3;
|
|
66314
|
-
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0
|
|
66979
|
+
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
|
|
66315
66980
|
}
|
|
66316
66981
|
},
|
|
66317
66982
|
init: function init(threeObj, state) {
|
|
@@ -66348,13 +67013,13 @@
|
|
|
66348
67013
|
var dashGapAccessor = index$1(state.arcDashGap);
|
|
66349
67014
|
var dashInitialGapAccessor = index$1(state.arcDashInitialGap);
|
|
66350
67015
|
var dashAnimateTimeAccessor = index$1(state.arcDashAnimateTime);
|
|
66351
|
-
var sharedMaterial = new THREE$
|
|
67016
|
+
var sharedMaterial = new THREE$d.ShaderMaterial(_objectSpread2$1(_objectSpread2$1({}, gradientShaders$1), {}, {
|
|
66352
67017
|
transparent: true,
|
|
66353
|
-
blending: THREE$
|
|
67018
|
+
blending: THREE$d.NormalBlending
|
|
66354
67019
|
}));
|
|
66355
67020
|
threeDigest(state.arcsData, state.scene, {
|
|
66356
67021
|
createObj: function createObj() {
|
|
66357
|
-
var obj = new THREE$
|
|
67022
|
+
var obj = new THREE$d.Group(); // populated in updateObj
|
|
66358
67023
|
|
|
66359
67024
|
obj.__globeObjType = 'arc'; // Add object type
|
|
66360
67025
|
return obj;
|
|
@@ -66365,7 +67030,7 @@
|
|
|
66365
67030
|
if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
|
|
66366
67031
|
// create or swap object types
|
|
66367
67032
|
emptyObject(group);
|
|
66368
|
-
var _obj = useTube ? new THREE$
|
|
67033
|
+
var _obj = useTube ? new THREE$d.Mesh() : new THREE$d.Line(new THREE$d.BufferGeometry());
|
|
66369
67034
|
_obj.material = sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
|
|
66370
67035
|
|
|
66371
67036
|
group.add(_obj);
|
|
@@ -66405,8 +67070,8 @@
|
|
|
66405
67070
|
true // run from end to start, to animate in the correct direction
|
|
66406
67071
|
);
|
|
66407
67072
|
|
|
66408
|
-
obj.geometry
|
|
66409
|
-
obj.geometry
|
|
67073
|
+
obj.geometry.setAttribute('vertexColor', vertexColorArray);
|
|
67074
|
+
obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
|
|
66410
67075
|
var applyUpdate = function applyUpdate(td) {
|
|
66411
67076
|
var _arc$__currentTargetD = arc.__currentTargetD = td,
|
|
66412
67077
|
stroke = _arc$__currentTargetD.stroke,
|
|
@@ -66414,9 +67079,9 @@
|
|
|
66414
67079
|
var curve = calcCurve(curveD);
|
|
66415
67080
|
if (useTube) {
|
|
66416
67081
|
obj.geometry && obj.geometry.dispose();
|
|
66417
|
-
obj.geometry = new THREE$
|
|
66418
|
-
obj.geometry
|
|
66419
|
-
obj.geometry
|
|
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);
|
|
66420
67085
|
} else {
|
|
66421
67086
|
obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
|
|
66422
67087
|
}
|
|
@@ -66465,7 +67130,7 @@
|
|
|
66465
67130
|
x = _polar2Cartesian.x,
|
|
66466
67131
|
y = _polar2Cartesian.y,
|
|
66467
67132
|
z = _polar2Cartesian.z;
|
|
66468
|
-
return new THREE$
|
|
67133
|
+
return new THREE$d.Vector3(x, y, z);
|
|
66469
67134
|
};
|
|
66470
67135
|
|
|
66471
67136
|
//calculate curve
|
|
@@ -66474,7 +67139,7 @@
|
|
|
66474
67139
|
var altitude = alt;
|
|
66475
67140
|
(altitude === null || altitude === undefined) && (
|
|
66476
67141
|
// by default set altitude proportional to the great-arc distance
|
|
66477
|
-
altitude = geoDistance(startPnt, endPnt) / 2 * altAutoScale);
|
|
67142
|
+
altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale);
|
|
66478
67143
|
if (altitude) {
|
|
66479
67144
|
var interpolate = geoInterpolate(startPnt, endPnt);
|
|
66480
67145
|
var _map = [0.25, 0.75].map(function (t) {
|
|
@@ -66483,7 +67148,7 @@
|
|
|
66483
67148
|
_map2 = _slicedToArray$1(_map, 2),
|
|
66484
67149
|
m1Pnt = _map2[0],
|
|
66485
67150
|
m2Pnt = _map2[1];
|
|
66486
|
-
var curve = _construct$1(THREE$
|
|
67151
|
+
var curve = _construct$1(THREE$d.CubicBezierCurve3, _toConsumableArray$2([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
|
|
66487
67152
|
|
|
66488
67153
|
//const mPnt = [...interpolate(0.5), altitude * 2];
|
|
66489
67154
|
//curve = new THREE.QuadraticBezierCurve3(...[startPnt, mPnt, endPnt].map(getVec));
|
|
@@ -66503,9 +67168,9 @@
|
|
|
66503
67168
|
return startVec.clone();
|
|
66504
67169
|
} // points exactly overlap
|
|
66505
67170
|
: function (t) {
|
|
66506
|
-
return new THREE$
|
|
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));
|
|
66507
67172
|
};
|
|
66508
|
-
var sphereArc = new THREE$
|
|
67173
|
+
var sphereArc = new THREE$d.Curve();
|
|
66509
67174
|
sphereArc.getPoint = getGreatCirclePoint;
|
|
66510
67175
|
return sphereArc;
|
|
66511
67176
|
}
|
|
@@ -66523,51 +67188,48 @@
|
|
|
66523
67188
|
.range(colors) : colors; // already interpolator fn
|
|
66524
67189
|
|
|
66525
67190
|
getVertexColor = function getVertexColor(t) {
|
|
66526
|
-
return color2ShaderArr(colorInterpolator(t));
|
|
67191
|
+
return color2ShaderArr(colorInterpolator(t), true, true);
|
|
66527
67192
|
};
|
|
66528
67193
|
} else {
|
|
66529
67194
|
// single color, use constant
|
|
66530
|
-
var vertexColor = color2ShaderArr(colors);
|
|
67195
|
+
var vertexColor = color2ShaderArr(colors, true, true);
|
|
66531
67196
|
getVertexColor = function getVertexColor() {
|
|
66532
67197
|
return vertexColor;
|
|
66533
67198
|
};
|
|
66534
67199
|
}
|
|
66535
|
-
var
|
|
67200
|
+
var vertexColors = [];
|
|
66536
67201
|
for (var v = 0, l = numVerticesGroup; v < l; v++) {
|
|
66537
67202
|
var _vertexColor = getVertexColor(v / (l - 1));
|
|
66538
67203
|
for (var s = 0; s < numVerticesPerSegment; s++) {
|
|
66539
|
-
|
|
67204
|
+
vertexColors.push(_vertexColor);
|
|
66540
67205
|
}
|
|
66541
67206
|
}
|
|
66542
|
-
return
|
|
67207
|
+
return array2BufferAttr(vertexColors, 4);
|
|
66543
67208
|
}
|
|
66544
67209
|
function calcVertexRelDistances(numSegments) {
|
|
66545
67210
|
var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
66546
67211
|
var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
66547
67212
|
var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
|
|
66548
|
-
|
|
66549
|
-
var
|
|
67213
|
+
|
|
67214
|
+
var vertexDistances = [];
|
|
66550
67215
|
for (var v = 0, l = numVerticesGroup; v < l; v++) {
|
|
66551
67216
|
var relDistance = v / (l - 1);
|
|
66552
67217
|
for (var s = 0; s < numVerticesPerSegment; s++) {
|
|
66553
|
-
|
|
66554
|
-
var pos = invert ? arrLen - 1 - idx : idx;
|
|
66555
|
-
vertexDistanceArray.setX(pos, relDistance);
|
|
67218
|
+
vertexDistances.push(relDistance);
|
|
66556
67219
|
}
|
|
66557
67220
|
}
|
|
66558
|
-
|
|
67221
|
+
invert && vertexDistances.reverse();
|
|
67222
|
+
return array2BufferAttr(vertexDistances, 1);
|
|
66559
67223
|
}
|
|
66560
67224
|
}
|
|
66561
67225
|
});
|
|
66562
67226
|
|
|
66563
|
-
var THREE$
|
|
67227
|
+
var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
66564
67228
|
: {
|
|
66565
|
-
BufferAttribute: BufferAttribute,
|
|
66566
67229
|
BufferGeometry: BufferGeometry,
|
|
66567
67230
|
Color: Color$1,
|
|
66568
67231
|
DoubleSide: DoubleSide,
|
|
66569
67232
|
Mesh: Mesh,
|
|
66570
|
-
MeshBasicMaterial: MeshBasicMaterial,
|
|
66571
67233
|
MeshLambertMaterial: MeshLambertMaterial,
|
|
66572
67234
|
Object3D: Object3D
|
|
66573
67235
|
};
|
|
@@ -66576,8 +67238,6 @@
|
|
|
66576
67238
|
|
|
66577
67239
|
//
|
|
66578
67240
|
|
|
66579
|
-
// support multiple method names for backwards threejs compatibility
|
|
66580
|
-
var applyMatrix4Fn = new THREE$b.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
|
|
66581
67241
|
var HexBinLayerKapsule = index$2({
|
|
66582
67242
|
props: {
|
|
66583
67243
|
hexBinPointsData: {
|
|
@@ -66665,7 +67325,7 @@
|
|
|
66665
67325
|
});
|
|
66666
67326
|
var hexMaterials = {}; // indexed by color
|
|
66667
67327
|
|
|
66668
|
-
var scene = state.hexBinMerge ? new THREE$
|
|
67328
|
+
var scene = state.hexBinMerge ? new THREE$c.Object3D() : state.scene; // use fake scene if merging hex points
|
|
66669
67329
|
|
|
66670
67330
|
threeDigest(hexBins, scene, {
|
|
66671
67331
|
createObj: createObj,
|
|
@@ -66676,7 +67336,7 @@
|
|
|
66676
67336
|
});
|
|
66677
67337
|
if (state.hexBinMerge) {
|
|
66678
67338
|
// merge points into a single mesh
|
|
66679
|
-
var hexPointsGeometry = !hexBins.length ? new THREE$
|
|
67339
|
+
var hexPointsGeometry = !hexBins.length ? new THREE$c.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
|
|
66680
67340
|
var obj = d.__threeObj;
|
|
66681
67341
|
d.__threeObj = undefined; // unbind merged points
|
|
66682
67342
|
|
|
@@ -66685,28 +67345,23 @@
|
|
|
66685
67345
|
|
|
66686
67346
|
// apply mesh world transform to vertices
|
|
66687
67347
|
obj.updateMatrix();
|
|
66688
|
-
geom
|
|
67348
|
+
geom.applyMatrix4(obj.matrix);
|
|
66689
67349
|
|
|
66690
67350
|
// color vertices
|
|
66691
|
-
var topColor =
|
|
66692
|
-
var sideColor =
|
|
66693
|
-
var nVertices = geom.
|
|
67351
|
+
var topColor = color2ShaderArr(topColorAccessor(d));
|
|
67352
|
+
var sideColor = color2ShaderArr(sideColorAccessor(d));
|
|
67353
|
+
var nVertices = geom.getAttribute('position').count;
|
|
66694
67354
|
var topFaceIdx = geom.groups[0].count; // starting vertex index of top group
|
|
66695
|
-
|
|
66696
|
-
|
|
66697
|
-
|
|
66698
|
-
var c = i >= topFaceIdx ? topColor : sideColor;
|
|
66699
|
-
colors[idx] = c.r;
|
|
66700
|
-
colors[idx + 1] = c.g;
|
|
66701
|
-
colors[idx + 2] = c.b;
|
|
66702
|
-
}
|
|
66703
|
-
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));
|
|
66704
67358
|
return geom;
|
|
66705
67359
|
}));
|
|
66706
|
-
var hexPoints = new THREE$
|
|
67360
|
+
var hexPoints = new THREE$c.Mesh(hexPointsGeometry, new THREE$c.MeshLambertMaterial({
|
|
66707
67361
|
color: 0xffffff,
|
|
67362
|
+
transparent: true,
|
|
66708
67363
|
vertexColors: true,
|
|
66709
|
-
side: THREE$
|
|
67364
|
+
side: THREE$c.DoubleSide
|
|
66710
67365
|
}));
|
|
66711
67366
|
hexPoints.__globeObjType = 'hexBinPoints'; // Add object type
|
|
66712
67367
|
hexPoints.__data = hexBins; // Attach obj data
|
|
@@ -66718,7 +67373,7 @@
|
|
|
66718
67373
|
//
|
|
66719
67374
|
|
|
66720
67375
|
function createObj(d) {
|
|
66721
|
-
var obj = new THREE$
|
|
67376
|
+
var obj = new THREE$c.Mesh();
|
|
66722
67377
|
obj.__hexCenter = cellToLatLng(d.h3Idx);
|
|
66723
67378
|
obj.__hexGeoJson = cellToBoundary(d.h3Idx, true).reverse(); // correct polygon winding
|
|
66724
67379
|
|
|
@@ -66787,11 +67442,11 @@
|
|
|
66787
67442
|
[sideColor, topColor].forEach(function (color) {
|
|
66788
67443
|
if (!hexMaterials.hasOwnProperty(color)) {
|
|
66789
67444
|
var opacity = colorAlpha(color);
|
|
66790
|
-
hexMaterials[color] = new THREE$
|
|
67445
|
+
hexMaterials[color] = new THREE$c.MeshLambertMaterial({
|
|
66791
67446
|
color: colorStr2Hex(color),
|
|
66792
67447
|
transparent: opacity < 1,
|
|
66793
67448
|
opacity: opacity,
|
|
66794
|
-
side: THREE$
|
|
67449
|
+
side: THREE$c.DoubleSide
|
|
66795
67450
|
});
|
|
66796
67451
|
}
|
|
66797
67452
|
});
|
|
@@ -66803,6 +67458,318 @@
|
|
|
66803
67458
|
}
|
|
66804
67459
|
});
|
|
66805
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) return 0;
|
|
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.map(Math.abs)) || 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(Math.abs(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
|
+
|
|
66806
67773
|
var THREE$a = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
66807
67774
|
: {
|
|
66808
67775
|
DoubleSide: DoubleSide,
|
|
@@ -67025,9 +67992,11 @@
|
|
|
67025
67992
|
var THREE$9 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
67026
67993
|
: {
|
|
67027
67994
|
BufferGeometry: BufferGeometry,
|
|
67995
|
+
CircleGeometry: CircleGeometry,
|
|
67028
67996
|
DoubleSide: DoubleSide,
|
|
67029
67997
|
Mesh: Mesh,
|
|
67030
|
-
MeshLambertMaterial: MeshLambertMaterial
|
|
67998
|
+
MeshLambertMaterial: MeshLambertMaterial,
|
|
67999
|
+
Vector3: Vector3
|
|
67031
68000
|
};
|
|
67032
68001
|
var bfg = Object.assign({}, _bfg);
|
|
67033
68002
|
var BufferGeometryUtils = bfg.BufferGeometryUtils || bfg;
|
|
@@ -67059,10 +68028,18 @@
|
|
|
67059
68028
|
"default": 0.2
|
|
67060
68029
|
},
|
|
67061
68030
|
// in fraction of hex diameter
|
|
68031
|
+
hexPolygonUseDots: {
|
|
68032
|
+
"default": false
|
|
68033
|
+
},
|
|
68034
|
+
// if points should be circular instead of hexagonal
|
|
67062
68035
|
hexPolygonCurvatureResolution: {
|
|
67063
68036
|
"default": 5
|
|
67064
68037
|
},
|
|
67065
|
-
// in angular degrees
|
|
68038
|
+
// in angular degrees, only relevant for hex tops
|
|
68039
|
+
hexPolygonDotResolution: {
|
|
68040
|
+
"default": 12
|
|
68041
|
+
},
|
|
68042
|
+
// how many slice segments in the dot circle's circumference
|
|
67066
68043
|
hexPolygonsTransitionDuration: {
|
|
67067
68044
|
"default": 0,
|
|
67068
68045
|
triggerUpdate: false
|
|
@@ -67082,7 +68059,9 @@
|
|
|
67082
68059
|
var altitudeAccessor = index$1(state.hexPolygonAltitude);
|
|
67083
68060
|
var resolutionAccessor = index$1(state.hexPolygonResolution);
|
|
67084
68061
|
var marginAccessor = index$1(state.hexPolygonMargin);
|
|
68062
|
+
var useDotsAccessor = index$1(state.hexPolygonUseDots);
|
|
67085
68063
|
var curvatureResolutionAccessor = index$1(state.hexPolygonCurvatureResolution);
|
|
68064
|
+
var dotResolutionAccessor = index$1(state.hexPolygonDotResolution);
|
|
67086
68065
|
threeDigest(state.hexPolygonsData, state.scene, {
|
|
67087
68066
|
createObj: function createObj(d) {
|
|
67088
68067
|
var obj = new THREE$9.Mesh(undefined, new THREE$9.MeshLambertMaterial({
|
|
@@ -67097,7 +68076,9 @@
|
|
|
67097
68076
|
var h3Res = resolutionAccessor(d);
|
|
67098
68077
|
var alt = altitudeAccessor(d);
|
|
67099
68078
|
var margin = Math.max(0, Math.min(1, +marginAccessor(d)));
|
|
68079
|
+
var useDots = useDotsAccessor(d);
|
|
67100
68080
|
var curvatureResolution = curvatureResolutionAccessor(d);
|
|
68081
|
+
var dotResolution = dotResolutionAccessor(d);
|
|
67101
68082
|
|
|
67102
68083
|
// update material
|
|
67103
68084
|
var color = colorAccessor(d);
|
|
@@ -67164,25 +68145,37 @@
|
|
|
67164
68145
|
curvatureResolution = _obj$__currentTargetD.curvatureResolution;
|
|
67165
68146
|
obj.geometry && obj.geometry.dispose();
|
|
67166
68147
|
obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : (BufferGeometryUtils.mergeGeometries || BufferGeometryUtils.mergeBufferGeometries)(hexBins.map(function (h) {
|
|
67167
|
-
// compute new geojson with relative margin
|
|
67168
|
-
var relNum = function relNum(st, end, rat) {
|
|
67169
|
-
return st - (st - end) * rat;
|
|
67170
|
-
};
|
|
67171
68148
|
var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
|
|
67172
68149
|
clat = _h$hexCenter[0],
|
|
67173
68150
|
clng = _h$hexCenter[1];
|
|
67174
|
-
|
|
67175
|
-
var
|
|
67176
|
-
|
|
67177
|
-
|
|
67178
|
-
|
|
67179
|
-
|
|
67180
|
-
|
|
67181
|
-
|
|
67182
|
-
|
|
68151
|
+
if (useDots) {
|
|
68152
|
+
var centerPos = polar2Cartesian(clat, clng, alt);
|
|
68153
|
+
var edgePos = polar2Cartesian(h.hexGeoJson[0][1], h.hexGeoJson[0][0], alt);
|
|
68154
|
+
var r = 0.85 * (1 - margin) * new THREE$9.Vector3(centerPos.x, centerPos.y, centerPos.z).distanceTo(new THREE$9.Vector3(edgePos.x, edgePos.y, edgePos.z));
|
|
68155
|
+
var geometry = new CircleGeometry(r, dotResolution);
|
|
68156
|
+
geometry.rotateX(deg2Rad$1(-clat));
|
|
68157
|
+
geometry.rotateY(deg2Rad$1(clng));
|
|
68158
|
+
geometry.translate(centerPos.x, centerPos.y, centerPos.z);
|
|
68159
|
+
return geometry;
|
|
68160
|
+
} else {
|
|
68161
|
+
var relNum = function relNum(st, end, rat) {
|
|
68162
|
+
return st - (st - end) * rat;
|
|
68163
|
+
};
|
|
68164
|
+
|
|
68165
|
+
// compute new geojson with relative margin
|
|
68166
|
+
var _geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref) {
|
|
68167
|
+
var _ref2 = _slicedToArray$1(_ref, 2),
|
|
68168
|
+
elng = _ref2[0],
|
|
68169
|
+
elat = _ref2[1];
|
|
68170
|
+
return [[elng, clng], [elat, clat]].map(function (_ref3) {
|
|
68171
|
+
var _ref4 = _slicedToArray$1(_ref3, 2),
|
|
68172
|
+
st = _ref4[0],
|
|
68173
|
+
end = _ref4[1];
|
|
68174
|
+
return relNum(st, end, margin);
|
|
68175
|
+
});
|
|
67183
68176
|
});
|
|
67184
|
-
|
|
67185
|
-
|
|
68177
|
+
return new ConicPolygonBufferGeometry([_geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
|
|
68178
|
+
}
|
|
67186
68179
|
}));
|
|
67187
68180
|
};
|
|
67188
68181
|
if (!state.hexPolygonsTransitionDuration || state.hexPolygonsTransitionDuration < 0) {
|
|
@@ -67235,7 +68228,6 @@
|
|
|
67235
68228
|
: {
|
|
67236
68229
|
BufferGeometry: BufferGeometry,
|
|
67237
68230
|
Color: Color$1,
|
|
67238
|
-
Float32BufferAttribute: Float32BufferAttribute,
|
|
67239
68231
|
Group: Group$1,
|
|
67240
68232
|
Line: Line,
|
|
67241
68233
|
NormalBlending: NormalBlending,
|
|
@@ -67246,8 +68238,6 @@
|
|
|
67246
68238
|
|
|
67247
68239
|
//
|
|
67248
68240
|
|
|
67249
|
-
// support both modes for backwards threejs compatibility
|
|
67250
|
-
var setAttributeFn = new THREE$7.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
|
|
67251
68241
|
var gradientShaders = {
|
|
67252
68242
|
uniforms: {
|
|
67253
68243
|
// dash param defaults, all relative to full length
|
|
@@ -67328,15 +68318,15 @@
|
|
|
67328
68318
|
methods: {
|
|
67329
68319
|
pauseAnimation: function pauseAnimation(state) {
|
|
67330
68320
|
var _state$ticker;
|
|
67331
|
-
(_state$ticker = state.ticker) === null || _state$ticker === void 0
|
|
68321
|
+
(_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
|
|
67332
68322
|
},
|
|
67333
68323
|
resumeAnimation: function resumeAnimation(state) {
|
|
67334
68324
|
var _state$ticker2;
|
|
67335
|
-
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0
|
|
68325
|
+
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
|
|
67336
68326
|
},
|
|
67337
68327
|
_destructor: function _destructor(state) {
|
|
67338
68328
|
var _state$ticker3;
|
|
67339
|
-
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0
|
|
68329
|
+
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
|
|
67340
68330
|
}
|
|
67341
68331
|
},
|
|
67342
68332
|
init: function init(threeObj, state) {
|
|
@@ -67436,8 +68426,8 @@
|
|
|
67436
68426
|
true // run from end to start, to animate in the correct direction
|
|
67437
68427
|
);
|
|
67438
68428
|
|
|
67439
|
-
obj.geometry
|
|
67440
|
-
obj.geometry
|
|
68429
|
+
obj.geometry.setAttribute('vertexColor', vertexColorArray);
|
|
68430
|
+
obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
|
|
67441
68431
|
} else {
|
|
67442
68432
|
// fat lines
|
|
67443
68433
|
obj.material.resolution = state.rendererSize;
|
|
@@ -67602,40 +68592,38 @@
|
|
|
67602
68592
|
.range(colors) : colors; // already interpolator fn
|
|
67603
68593
|
|
|
67604
68594
|
getVertexColor = function getVertexColor(t) {
|
|
67605
|
-
return color2ShaderArr(colorInterpolator(t), includeAlpha);
|
|
68595
|
+
return color2ShaderArr(colorInterpolator(t), includeAlpha, true);
|
|
67606
68596
|
};
|
|
67607
68597
|
} else {
|
|
67608
68598
|
// single color, use constant
|
|
67609
|
-
var vertexColor = color2ShaderArr(colors, includeAlpha);
|
|
68599
|
+
var vertexColor = color2ShaderArr(colors, includeAlpha, true);
|
|
67610
68600
|
getVertexColor = function getVertexColor() {
|
|
67611
68601
|
return vertexColor;
|
|
67612
68602
|
};
|
|
67613
68603
|
}
|
|
67614
|
-
var
|
|
67615
|
-
var vertexColorArray = new THREE$7.Float32BufferAttribute(numVerticesGroup * numArgs * numVerticesPerSegment, numArgs);
|
|
68604
|
+
var vertexColors = [];
|
|
67616
68605
|
for (var v = 0, l = numVerticesGroup; v < l; v++) {
|
|
67617
68606
|
var _vertexColor = getVertexColor(v / (l - 1));
|
|
67618
68607
|
for (var s = 0; s < numVerticesPerSegment; s++) {
|
|
67619
|
-
|
|
68608
|
+
vertexColors.push(_vertexColor);
|
|
67620
68609
|
}
|
|
67621
68610
|
}
|
|
67622
|
-
return
|
|
68611
|
+
return array2BufferAttr(vertexColors, includeAlpha ? 4 : 3);
|
|
67623
68612
|
}
|
|
67624
68613
|
function calcVertexRelDistances(numSegments) {
|
|
67625
68614
|
var numVerticesPerSegment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
67626
68615
|
var invert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
67627
68616
|
var numVerticesGroup = numSegments + 1; // one between every two segments and two at the ends
|
|
67628
|
-
|
|
67629
|
-
var
|
|
68617
|
+
|
|
68618
|
+
var vertexDistances = [];
|
|
67630
68619
|
for (var v = 0, l = numVerticesGroup; v < l; v++) {
|
|
67631
68620
|
var relDistance = v / (l - 1);
|
|
67632
68621
|
for (var s = 0; s < numVerticesPerSegment; s++) {
|
|
67633
|
-
|
|
67634
|
-
var pos = invert ? arrLen - 1 - idx : idx;
|
|
67635
|
-
vertexDistanceArray.setX(pos, relDistance);
|
|
68622
|
+
vertexDistances.push(relDistance);
|
|
67636
68623
|
}
|
|
67637
68624
|
}
|
|
67638
|
-
|
|
68625
|
+
invert && vertexDistances.reverse();
|
|
68626
|
+
return array2BufferAttr(vertexDistances, 1);
|
|
67639
68627
|
}
|
|
67640
68628
|
}
|
|
67641
68629
|
});
|
|
@@ -68065,15 +69053,15 @@
|
|
|
68065
69053
|
methods: {
|
|
68066
69054
|
pauseAnimation: function pauseAnimation(state) {
|
|
68067
69055
|
var _state$ticker;
|
|
68068
|
-
(_state$ticker = state.ticker) === null || _state$ticker === void 0
|
|
69056
|
+
(_state$ticker = state.ticker) === null || _state$ticker === void 0 || _state$ticker.pause();
|
|
68069
69057
|
},
|
|
68070
69058
|
resumeAnimation: function resumeAnimation(state) {
|
|
68071
69059
|
var _state$ticker2;
|
|
68072
|
-
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0
|
|
69060
|
+
(_state$ticker2 = state.ticker) === null || _state$ticker2 === void 0 || _state$ticker2.resume();
|
|
68073
69061
|
},
|
|
68074
69062
|
_destructor: function _destructor(state) {
|
|
68075
69063
|
var _state$ticker3;
|
|
68076
|
-
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0
|
|
69064
|
+
(_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
|
|
68077
69065
|
}
|
|
68078
69066
|
},
|
|
68079
69067
|
init: function init(threeObj, state) {
|
|
@@ -68420,7 +69408,7 @@
|
|
|
68420
69408
|
}
|
|
68421
69409
|
});
|
|
68422
69410
|
|
|
68423
|
-
var THREE$
|
|
69411
|
+
var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
68424
69412
|
: {
|
|
68425
69413
|
Group: Group$1,
|
|
68426
69414
|
Vector2: Vector2,
|
|
@@ -68429,7 +69417,7 @@
|
|
|
68429
69417
|
|
|
68430
69418
|
//
|
|
68431
69419
|
|
|
68432
|
-
var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
|
|
69420
|
+
var layers = ['globeLayer', 'pointsLayer', 'arcsLayer', 'hexBinLayer', 'heatmapsLayer', 'polygonsLayer', 'hexedPolygonsLayer', 'pathsLayer', 'tilesLayer', 'labelsLayer', 'ringsLayer', 'htmlElementsLayer', 'objectsLayer', 'customLayer'];
|
|
68433
69421
|
|
|
68434
69422
|
// Expose config from layers
|
|
68435
69423
|
var bindGlobeLayer = linkKapsule$1('globeLayer', GlobeLayerKapsule);
|
|
@@ -68451,8 +69439,12 @@
|
|
|
68451
69439
|
var linkedHexBinLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration'].map(function (p) {
|
|
68452
69440
|
return _defineProperty$2({}, p, bindHexBinLayer.linkProp(p));
|
|
68453
69441
|
})));
|
|
69442
|
+
var bindHeatmapsLayer = linkKapsule$1('heatmapsLayer', HeatmapsLayerKapsule);
|
|
69443
|
+
var linkedHeatmapsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration'].map(function (p) {
|
|
69444
|
+
return _defineProperty$2({}, p, bindHeatmapsLayer.linkProp(p));
|
|
69445
|
+
})));
|
|
68454
69446
|
var bindHexedPolygonsLayer = linkKapsule$1('hexedPolygonsLayer', HexedPolygonsLayerKapsule);
|
|
68455
|
-
var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
|
|
69447
|
+
var linkedHexedPolygonsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration'].map(function (p) {
|
|
68456
69448
|
return _defineProperty$2({}, p, bindHexedPolygonsLayer.linkProp(p));
|
|
68457
69449
|
})));
|
|
68458
69450
|
var bindPolygonsLayer = linkKapsule$1('polygonsLayer', PolygonsLayerKapsule);
|
|
@@ -68491,18 +69483,18 @@
|
|
|
68491
69483
|
//
|
|
68492
69484
|
|
|
68493
69485
|
var Globe$1 = index$2({
|
|
68494
|
-
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({
|
|
69486
|
+
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({
|
|
68495
69487
|
onGlobeReady: {
|
|
68496
69488
|
triggerUpdate: false
|
|
68497
69489
|
},
|
|
68498
69490
|
rendererSize: {
|
|
68499
|
-
"default": new THREE$
|
|
69491
|
+
"default": new THREE$i.Vector2(window.innerWidth, window.innerHeight),
|
|
68500
69492
|
onChange: function onChange(rendererSize, state) {
|
|
68501
69493
|
state.pathsLayer.rendererSize(rendererSize);
|
|
68502
69494
|
},
|
|
68503
69495
|
triggerUpdate: false
|
|
68504
69496
|
}
|
|
68505
|
-
}, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
|
|
69497
|
+
}, linkedGlobeLayerProps), linkedPointsLayerProps), linkedArcsLayerProps), linkedHexBinLayerProps), linkedHeatmapsLayerProps), linkedPolygonsLayerProps), linkedHexedPolygonsLayerProps), linkedPathsLayerProps), linkedTilesLayerProps), linkedLabelsLayerProps), linkedRingsLayerProps), linkedHtmlElementsLayerProps), linkedObjectsLayerProps), linkedCustomLayerProps),
|
|
68506
69498
|
methods: _objectSpread2$1({
|
|
68507
69499
|
getGlobeRadius: getGlobeRadius,
|
|
68508
69500
|
getCoords: function getCoords(state) {
|
|
@@ -68587,6 +69579,7 @@
|
|
|
68587
69579
|
pointsLayer: PointsLayerKapsule(),
|
|
68588
69580
|
arcsLayer: ArcsLayerKapsule(),
|
|
68589
69581
|
hexBinLayer: HexBinLayerKapsule(),
|
|
69582
|
+
heatmapsLayer: HeatmapsLayerKapsule(),
|
|
68590
69583
|
polygonsLayer: PolygonsLayerKapsule(),
|
|
68591
69584
|
hexedPolygonsLayer: HexedPolygonsLayerKapsule(),
|
|
68592
69585
|
pathsLayer: PathsLayerKapsule(),
|
|
@@ -68609,21 +69602,21 @@
|
|
|
68609
69602
|
})
|
|
68610
69603
|
});
|
|
68611
69604
|
},
|
|
68612
|
-
init: function init(threeObj, state,
|
|
68613
|
-
var
|
|
68614
|
-
animateIn =
|
|
68615
|
-
|
|
68616
|
-
waitForGlobeReady =
|
|
69605
|
+
init: function init(threeObj, state, _ref16) {
|
|
69606
|
+
var _ref16$animateIn = _ref16.animateIn,
|
|
69607
|
+
animateIn = _ref16$animateIn === void 0 ? true : _ref16$animateIn,
|
|
69608
|
+
_ref16$waitForGlobeRe = _ref16.waitForGlobeReady,
|
|
69609
|
+
waitForGlobeReady = _ref16$waitForGlobeRe === void 0 ? true : _ref16$waitForGlobeRe;
|
|
68617
69610
|
// Clear the scene
|
|
68618
69611
|
emptyObject(threeObj);
|
|
68619
69612
|
|
|
68620
69613
|
// Main three object to manipulate
|
|
68621
|
-
threeObj.add(state.scene = new THREE$
|
|
69614
|
+
threeObj.add(state.scene = new THREE$i.Group());
|
|
68622
69615
|
state.scene.visible = false; // hide scene before globe initialization
|
|
68623
69616
|
|
|
68624
69617
|
// Add all layers groups
|
|
68625
69618
|
layers.forEach(function (layer) {
|
|
68626
|
-
var g = new THREE$
|
|
69619
|
+
var g = new THREE$i.Group();
|
|
68627
69620
|
state.scene.add(g);
|
|
68628
69621
|
state[layer](g);
|
|
68629
69622
|
});
|
|
@@ -68635,17 +69628,17 @@
|
|
|
68635
69628
|
k: 1e-6
|
|
68636
69629
|
}).to({
|
|
68637
69630
|
k: 1
|
|
68638
|
-
}, 600).easing(Easing.Quadratic.Out).onUpdate(function (
|
|
68639
|
-
var k =
|
|
69631
|
+
}, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref17) {
|
|
69632
|
+
var k = _ref17.k;
|
|
68640
69633
|
return state.scene.scale.set(k, k, k);
|
|
68641
69634
|
}).start();
|
|
68642
|
-
var rotAxis = new THREE$
|
|
69635
|
+
var rotAxis = new THREE$i.Vector3(0, 1, 0);
|
|
68643
69636
|
new Tween({
|
|
68644
69637
|
rot: Math.PI * 2
|
|
68645
69638
|
}).to({
|
|
68646
69639
|
rot: 0
|
|
68647
|
-
}, 1200).easing(Easing.Quintic.Out).onUpdate(function (
|
|
68648
|
-
var rot =
|
|
69640
|
+
}, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref18) {
|
|
69641
|
+
var rot = _ref18.rot;
|
|
68649
69642
|
return state.scene.setRotationFromAxisAngle(rotAxis, rot);
|
|
68650
69643
|
}).start();
|
|
68651
69644
|
}
|
|
@@ -71833,7 +72826,11 @@
|
|
|
71833
72826
|
}
|
|
71834
72827
|
|
|
71835
72828
|
function _isNativeFunction(fn) {
|
|
71836
|
-
|
|
72829
|
+
try {
|
|
72830
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
72831
|
+
} catch (e) {
|
|
72832
|
+
return typeof fn === "function";
|
|
72833
|
+
}
|
|
71837
72834
|
}
|
|
71838
72835
|
|
|
71839
72836
|
function _isNativeReflectConstruct() {
|
|
@@ -73359,7 +74356,7 @@
|
|
|
73359
74356
|
|
|
73360
74357
|
// Expose config from ThreeGlobe
|
|
73361
74358
|
var bindGlobe = linkKapsule('globe', threeGlobe);
|
|
73362
|
-
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', '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) {
|
|
74359
|
+
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', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
|
|
73363
74360
|
return _defineProperty({}, p, bindGlobe.linkProp(p));
|
|
73364
74361
|
})));
|
|
73365
74362
|
var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
|
|
@@ -73440,6 +74437,15 @@
|
|
|
73440
74437
|
onPathHover: {
|
|
73441
74438
|
triggerUpdate: false
|
|
73442
74439
|
},
|
|
74440
|
+
onHeatmapClick: {
|
|
74441
|
+
triggerUpdate: false
|
|
74442
|
+
},
|
|
74443
|
+
onHeatmapRightClick: {
|
|
74444
|
+
triggerUpdate: false
|
|
74445
|
+
},
|
|
74446
|
+
onHeatmapHover: {
|
|
74447
|
+
triggerUpdate: false
|
|
74448
|
+
},
|
|
73443
74449
|
hexLabel: {
|
|
73444
74450
|
triggerUpdate: false
|
|
73445
74451
|
},
|
|
@@ -73641,6 +74647,7 @@
|
|
|
73641
74647
|
this.arcsData([]);
|
|
73642
74648
|
this.polygonsData([]);
|
|
73643
74649
|
this.pathsData([]);
|
|
74650
|
+
this.heatmapsData([]);
|
|
73644
74651
|
this.hexBinPointsData([]);
|
|
73645
74652
|
this.hexPolygonsData([]);
|
|
73646
74653
|
this.tilesData([]);
|
|
@@ -73733,6 +74740,9 @@
|
|
|
73733
74740
|
path: function path(d) {
|
|
73734
74741
|
return d;
|
|
73735
74742
|
},
|
|
74743
|
+
heatmap: function heatmap(d) {
|
|
74744
|
+
return d;
|
|
74745
|
+
},
|
|
73736
74746
|
hexbin: function hexbin(d) {
|
|
73737
74747
|
return d;
|
|
73738
74748
|
},
|
|
@@ -73787,6 +74797,7 @@
|
|
|
73787
74797
|
arc: state.onArcHover,
|
|
73788
74798
|
polygon: state.onPolygonHover,
|
|
73789
74799
|
path: state.onPathHover,
|
|
74800
|
+
heatmap: state.onHeatmapHover,
|
|
73790
74801
|
hexbin: state.onHexHover,
|
|
73791
74802
|
hexPolygon: state.onHexPolygonHover,
|
|
73792
74803
|
tile: state.onTileHover,
|
|
@@ -73800,6 +74811,7 @@
|
|
|
73800
74811
|
arc: state.onArcClick,
|
|
73801
74812
|
polygon: state.onPolygonClick,
|
|
73802
74813
|
path: state.onPathClick,
|
|
74814
|
+
heatmap: state.onHeatmapClick,
|
|
73803
74815
|
hexbin: state.onHexClick,
|
|
73804
74816
|
hexPolygon: state.onHexPolygonClick,
|
|
73805
74817
|
tile: state.onTileClick,
|
|
@@ -73839,6 +74851,7 @@
|
|
|
73839
74851
|
arc: state.onArcClick,
|
|
73840
74852
|
polygon: state.onPolygonClick,
|
|
73841
74853
|
path: state.onPathClick,
|
|
74854
|
+
heatmap: state.onHeatmapClick,
|
|
73842
74855
|
hexbin: state.onHexClick,
|
|
73843
74856
|
hexPolygon: state.onHexPolygonClick,
|
|
73844
74857
|
tile: state.onTileClick,
|
|
@@ -73876,6 +74889,7 @@
|
|
|
73876
74889
|
arc: state.onArcRightClick,
|
|
73877
74890
|
polygon: state.onPolygonRightClick,
|
|
73878
74891
|
path: state.onPathRightClick,
|
|
74892
|
+
heatmap: state.onHeatmapRightClick,
|
|
73879
74893
|
hexbin: state.onHexRightClick,
|
|
73880
74894
|
hexPolygon: state.onHexPolygonRightClick,
|
|
73881
74895
|
tile: state.onTileRightClick,
|
|
@@ -75015,6 +76029,20 @@
|
|
|
75015
76029
|
onPathClick: PropTypes.func,
|
|
75016
76030
|
onPathRightClick: PropTypes.func,
|
|
75017
76031
|
onPathHover: PropTypes.func,
|
|
76032
|
+
heatmapsData: PropTypes.array,
|
|
76033
|
+
heatmapPoints: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.func]),
|
|
76034
|
+
heatmapPointLat: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76035
|
+
heatmapPointLng: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76036
|
+
heatmapPointWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76037
|
+
heatmapBandwidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76038
|
+
heatmapColorFn: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
76039
|
+
heatmapColorSaturation: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76040
|
+
heatmapBaseAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76041
|
+
heatmapTopAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76042
|
+
heatmapsTransitionDuration: PropTypes.number,
|
|
76043
|
+
onHeatmapClick: PropTypes.func,
|
|
76044
|
+
onHeatmapRightClick: PropTypes.func,
|
|
76045
|
+
onHeatmapHover: PropTypes.func,
|
|
75018
76046
|
hexBinPointsData: PropTypes.arrayOf(PropTypes.object),
|
|
75019
76047
|
hexBinPointLat: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
75020
76048
|
hexBinPointLng: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
@@ -75037,7 +76065,9 @@
|
|
|
75037
76065
|
hexPolygonAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
75038
76066
|
hexPolygonResolution: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
75039
76067
|
hexPolygonMargin: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76068
|
+
hexPolygonUseDots: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.func]),
|
|
75040
76069
|
hexPolygonCurvatureResolution: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
76070
|
+
hexPolygonDotResolution: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
75041
76071
|
hexPolygonsTransitionDuration: PropTypes.number,
|
|
75042
76072
|
hexPolygonLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
75043
76073
|
onHexPolygonClick: PropTypes.func,
|