react-globe.gl 2.27.1 → 2.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // Version 2.27.1 react-globe.gl - https://github.com/vasturiano/react-globe.gl
1
+ // Version 2.27.2 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 = '159';
317
+ const REVISION = '161';
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 };
@@ -370,6 +370,7 @@
370
370
  const CineonToneMapping = 3;
371
371
  const ACESFilmicToneMapping = 4;
372
372
  const CustomToneMapping = 5;
373
+ const AgXToneMapping = 6;
373
374
 
374
375
  const UVMapping = 300;
375
376
  const CubeReflectionMapping = 301;
@@ -1873,22 +1874,6 @@
1873
1874
 
1874
1875
  _workingColorSpace: LinearSRGBColorSpace,
1875
1876
 
1876
- get legacyMode() {
1877
-
1878
- console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
1879
-
1880
- return ! this.enabled;
1881
-
1882
- },
1883
-
1884
- set legacyMode( legacyMode ) {
1885
-
1886
- console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
1887
-
1888
- this.enabled = ! legacyMode;
1889
-
1890
- },
1891
-
1892
1877
  get workingColorSpace() {
1893
1878
 
1894
1879
  return this._workingColorSpace;
@@ -2101,6 +2086,7 @@
2101
2086
  this.uuid = generateUUID();
2102
2087
 
2103
2088
  this.data = data;
2089
+ this.dataReady = true;
2104
2090
 
2105
2091
  this.version = 0;
2106
2092
 
@@ -3557,7 +3543,7 @@
3557
3543
 
3558
3544
  }
3559
3545
 
3560
- setFromEuler( euler, update ) {
3546
+ setFromEuler( euler, update = true ) {
3561
3547
 
3562
3548
  const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
3563
3549
 
@@ -3625,7 +3611,7 @@
3625
3611
 
3626
3612
  }
3627
3613
 
3628
- if ( update !== false ) this._onChangeCallback();
3614
+ if ( update === true ) this._onChangeCallback();
3629
3615
 
3630
3616
  return this;
3631
3617
 
@@ -3920,8 +3906,7 @@
3920
3906
  this._y = s * y + t * this._y;
3921
3907
  this._z = s * z + t * this._z;
3922
3908
 
3923
- this.normalize();
3924
- this._onChangeCallback();
3909
+ this.normalize(); // normalize calls _onChangeCallback()
3925
3910
 
3926
3911
  return this;
3927
3912
 
@@ -4009,6 +3994,8 @@
4009
3994
  this._z = attribute.getZ( index );
4010
3995
  this._w = attribute.getW( index );
4011
3996
 
3997
+ this._onChangeCallback();
3998
+
4012
3999
  return this;
4013
4000
 
4014
4001
  }
@@ -5299,6 +5286,8 @@
5299
5286
 
5300
5287
  constructor( center = new Vector3(), radius = - 1 ) {
5301
5288
 
5289
+ this.isSphere = true;
5290
+
5302
5291
  this.center = center;
5303
5292
  this.radius = radius;
5304
5293
 
@@ -8300,7 +8289,7 @@
8300
8289
  const _v0$1 = /*@__PURE__*/ new Vector3();
8301
8290
  const _v1$3 = /*@__PURE__*/ new Vector3();
8302
8291
  const _v2$2 = /*@__PURE__*/ new Vector3();
8303
- const _v3$1 = /*@__PURE__*/ new Vector3();
8292
+ const _v3$2 = /*@__PURE__*/ new Vector3();
8304
8293
 
8305
8294
  const _vab = /*@__PURE__*/ new Vector3();
8306
8295
  const _vac = /*@__PURE__*/ new Vector3();
@@ -8309,8 +8298,6 @@
8309
8298
  const _vbp = /*@__PURE__*/ new Vector3();
8310
8299
  const _vcp = /*@__PURE__*/ new Vector3();
8311
8300
 
8312
- let warnedGetUV = false;
8313
-
8314
8301
  class Triangle {
8315
8302
 
8316
8303
  constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
@@ -8357,9 +8344,8 @@
8357
8344
  // collinear or singular triangle
8358
8345
  if ( denom === 0 ) {
8359
8346
 
8360
- // arbitrary location outside of triangle?
8361
- // not sure if this is the best idea, maybe should be returning undefined
8362
- return target.set( - 2, - 1, - 1 );
8347
+ target.set( 0, 0, 0 );
8348
+ return null;
8363
8349
 
8364
8350
  }
8365
8351
 
@@ -8374,34 +8360,33 @@
8374
8360
 
8375
8361
  static containsPoint( point, a, b, c ) {
8376
8362
 
8377
- this.getBarycoord( point, a, b, c, _v3$1 );
8363
+ // if the triangle is degenerate then we can't contain a point
8364
+ if ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {
8378
8365
 
8379
- return ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );
8380
-
8381
- }
8382
-
8383
- static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151
8384
-
8385
- if ( warnedGetUV === false ) {
8386
-
8387
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8388
-
8389
- warnedGetUV = true;
8366
+ return false;
8390
8367
 
8391
8368
  }
8392
8369
 
8393
- return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
8370
+ return ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );
8394
8371
 
8395
8372
  }
8396
8373
 
8397
8374
  static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
8398
8375
 
8399
- this.getBarycoord( point, p1, p2, p3, _v3$1 );
8376
+ if ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {
8377
+
8378
+ target.x = 0;
8379
+ target.y = 0;
8380
+ if ( 'z' in target ) target.z = 0;
8381
+ if ( 'w' in target ) target.w = 0;
8382
+ return null;
8383
+
8384
+ }
8400
8385
 
8401
8386
  target.setScalar( 0 );
8402
- target.addScaledVector( v1, _v3$1.x );
8403
- target.addScaledVector( v2, _v3$1.y );
8404
- target.addScaledVector( v3, _v3$1.z );
8387
+ target.addScaledVector( v1, _v3$2.x );
8388
+ target.addScaledVector( v2, _v3$2.y );
8389
+ target.addScaledVector( v3, _v3$2.z );
8405
8390
 
8406
8391
  return target;
8407
8392
 
@@ -8496,20 +8481,6 @@
8496
8481
 
8497
8482
  }
8498
8483
 
8499
- getUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151
8500
-
8501
- if ( warnedGetUV === false ) {
8502
-
8503
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8504
-
8505
- warnedGetUV = true;
8506
-
8507
- }
8508
-
8509
- return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
8510
-
8511
- }
8512
-
8513
8484
  getInterpolation( point, v1, v2, v3, target ) {
8514
8485
 
8515
8486
  return Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );
@@ -9874,7 +9845,7 @@
9874
9845
 
9875
9846
  get updateRange() {
9876
9847
 
9877
- console.warn( 'THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.' ); // @deprecated, r159
9848
+ warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
9878
9849
  return this._updateRange;
9879
9850
 
9880
9851
  }
@@ -12042,7 +12013,9 @@
12042
12013
  derivatives: false, // set to use derivatives
12043
12014
  fragDepth: false, // set to use fragment depth values
12044
12015
  drawBuffers: false, // set to use draw buffers
12045
- shaderTextureLOD: false // set to use shader texture LOD
12016
+ shaderTextureLOD: false, // set to use shader texture LOD
12017
+ clipCullDistance: false, // set to use vertex shader clipping
12018
+ multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
12046
12019
  };
12047
12020
 
12048
12021
  // When rendered geometry doesn't include these attributes but the material does,
@@ -12254,6 +12227,11 @@
12254
12227
 
12255
12228
  }
12256
12229
 
12230
+ const _v3$1 = /*@__PURE__*/ new Vector3();
12231
+ const _minTarget = /*@__PURE__*/ new Vector2();
12232
+ const _maxTarget = /*@__PURE__*/ new Vector2();
12233
+
12234
+
12257
12235
  class PerspectiveCamera extends Camera {
12258
12236
 
12259
12237
  constructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {
@@ -12352,6 +12330,34 @@
12352
12330
 
12353
12331
  }
12354
12332
 
12333
+ /**
12334
+ * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
12335
+ * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
12336
+ */
12337
+ getViewBounds( distance, minTarget, maxTarget ) {
12338
+
12339
+ _v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12340
+
12341
+ minTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );
12342
+
12343
+ _v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12344
+
12345
+ maxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );
12346
+
12347
+ }
12348
+
12349
+ /**
12350
+ * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
12351
+ * Copies the result into the target Vector2, where x is width and y is height.
12352
+ */
12353
+ getViewSize( distance, target ) {
12354
+
12355
+ this.getViewBounds( distance, _minTarget, _maxTarget );
12356
+
12357
+ return target.subVectors( _maxTarget, _minTarget );
12358
+
12359
+ }
12360
+
12355
12361
  /**
12356
12362
  * Sets an offset in a larger frustum. This is useful for multi-window or
12357
12363
  * multi-monitor/multi-machine setups.
@@ -13344,7 +13350,7 @@
13344
13350
  function updateBuffer( buffer, attribute, bufferType ) {
13345
13351
 
13346
13352
  const array = attribute.array;
13347
- const updateRange = attribute._updateRange; // deprecated
13353
+ const updateRange = attribute._updateRange; // @deprecated, r159
13348
13354
  const updateRanges = attribute.updateRanges;
13349
13355
 
13350
13356
  gl.bindBuffer( bufferType, buffer );
@@ -13379,7 +13385,7 @@
13379
13385
 
13380
13386
  }
13381
13387
 
13382
- // deprecated
13388
+ // @deprecated, r159
13383
13389
  if ( updateRange.count !== - 1 ) {
13384
13390
 
13385
13391
  if ( isWebGL2 ) {
@@ -13585,7 +13591,7 @@
13585
13591
 
13586
13592
  var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
13587
13593
 
13588
- var alphatest_fragment = "#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif";
13594
+ var alphatest_fragment = "#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif";
13589
13595
 
13590
13596
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13591
13597
 
@@ -13607,7 +13613,7 @@
13607
13613
 
13608
13614
  var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
13609
13615
 
13610
- var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
13616
+ var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif";
13611
13617
 
13612
13618
  var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";
13613
13619
 
@@ -13625,7 +13631,7 @@
13625
13631
 
13626
13632
  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";
13627
13633
 
13628
- 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";
13634
+ 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_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\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";
13629
13635
 
13630
13636
  var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
13631
13637
 
@@ -13777,7 +13783,7 @@
13777
13783
 
13778
13784
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13779
13785
 
13780
- var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13786
+ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13781
13787
 
13782
13788
  var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
13783
13789
 
@@ -13805,11 +13811,11 @@
13805
13811
 
13806
13812
  const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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\tvHighPrecisionZW = gl_Position.zw;\n}";
13807
13813
 
13808
- const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
13814
+ const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
13809
13815
 
13810
13816
  const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
13811
13817
 
13812
- const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\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 <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
13818
+ const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\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 <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
13813
13819
 
13814
13820
  const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
13815
13821
 
@@ -13817,39 +13823,39 @@
13817
13823
 
13818
13824
  const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
13819
13825
 
13820
- const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
13826
+ const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
13821
13827
 
13822
13828
  const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_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 <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
13823
13829
 
13824
- const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_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\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 <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\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}";
13830
+ const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\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}";
13825
13831
 
13826
13832
  const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_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 <batching_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13827
13833
 
13828
- const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
13834
+ const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
13829
13835
 
13830
13836
  const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_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 <batching_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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
13831
13837
 
13832
- const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\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 <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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\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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\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}";
13838
+ const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\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 <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\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}";
13833
13839
 
13834
13840
  const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
13835
13841
 
13836
- const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
13842
+ const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
13837
13843
 
13838
13844
  const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_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 <batching_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 <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13839
13845
 
13840
- const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
13846
+ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
13841
13847
 
13842
13848
  const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\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 <batching_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}";
13843
13849
 
13844
- 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 + sheenSpecularDirect + sheenSpecularIndirect;\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 ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * 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}";
13850
+ 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 + sheenSpecularDirect + sheenSpecularIndirect;\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 ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * 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}";
13845
13851
 
13846
13852
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <batching_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}";
13847
13853
 
13848
- const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\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}";
13854
+ const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\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}";
13849
13855
 
13850
13856
  const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
13851
13857
 
13852
- const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
13858
+ const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
13853
13859
 
13854
13860
  const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13855
13861
 
@@ -13857,7 +13863,7 @@
13857
13863
 
13858
13864
  const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
13859
13865
 
13860
- const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
13866
+ const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
13861
13867
 
13862
13868
  const ShaderChunk = {
13863
13869
  alphahash_fragment: alphahash_fragment,
@@ -15845,7 +15851,7 @@
15845
15851
 
15846
15852
  if ( image && image.height > 0 ) {
15847
15853
 
15848
- const renderTarget = new WebGLCubeRenderTarget( image.height / 2 );
15854
+ const renderTarget = new WebGLCubeRenderTarget( image.height );
15849
15855
  renderTarget.fromEquirectangularTexture( renderer, texture );
15850
15856
  cubemaps.set( texture, renderTarget );
15851
15857
 
@@ -17096,6 +17102,7 @@
17096
17102
  if ( capabilities.isWebGL2 ) {
17097
17103
 
17098
17104
  getExtension( 'EXT_color_buffer_float' );
17105
+ getExtension( 'WEBGL_clip_cull_distance' );
17099
17106
 
17100
17107
  } else {
17101
17108
 
@@ -19222,6 +19229,10 @@
19222
19229
  toneMappingName = 'ACESFilmic';
19223
19230
  break;
19224
19231
 
19232
+ case AgXToneMapping:
19233
+ toneMappingName = 'AgX';
19234
+ break;
19235
+
19225
19236
  case CustomToneMapping:
19226
19237
  toneMappingName = 'Custom';
19227
19238
  break;
@@ -19239,7 +19250,7 @@
19239
19250
  function generateExtensions( parameters ) {
19240
19251
 
19241
19252
  const chunks = [
19242
- ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19253
+ ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19243
19254
  ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
19244
19255
  ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
19245
19256
  ( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
@@ -19249,6 +19260,17 @@
19249
19260
 
19250
19261
  }
19251
19262
 
19263
+ function generateVertexExtensions( parameters ) {
19264
+
19265
+ const chunks = [
19266
+ parameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',
19267
+ parameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',
19268
+ ];
19269
+
19270
+ return chunks.filter( filterEmptyLine ).join( '\n' );
19271
+
19272
+ }
19273
+
19252
19274
  function generateDefines( defines ) {
19253
19275
 
19254
19276
  const chunks = [];
@@ -19401,7 +19423,30 @@
19401
19423
 
19402
19424
  function generatePrecision( parameters ) {
19403
19425
 
19404
- let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
19426
+ let precisionstring = `precision ${parameters.precision} float;
19427
+ precision ${parameters.precision} int;
19428
+ precision ${parameters.precision} sampler2D;
19429
+ precision ${parameters.precision} samplerCube;
19430
+ `;
19431
+
19432
+ if ( parameters.isWebGL2 ) {
19433
+
19434
+ precisionstring += `precision ${parameters.precision} sampler3D;
19435
+ precision ${parameters.precision} sampler2DArray;
19436
+ precision ${parameters.precision} sampler2DShadow;
19437
+ precision ${parameters.precision} samplerCubeShadow;
19438
+ precision ${parameters.precision} sampler2DArrayShadow;
19439
+ precision ${parameters.precision} isampler2D;
19440
+ precision ${parameters.precision} isampler3D;
19441
+ precision ${parameters.precision} isamplerCube;
19442
+ precision ${parameters.precision} isampler2DArray;
19443
+ precision ${parameters.precision} usampler2D;
19444
+ precision ${parameters.precision} usampler3D;
19445
+ precision ${parameters.precision} usamplerCube;
19446
+ precision ${parameters.precision} usampler2DArray;
19447
+ `;
19448
+
19449
+ }
19405
19450
 
19406
19451
  if ( parameters.precision === 'highp' ) {
19407
19452
 
@@ -19553,6 +19598,8 @@
19553
19598
 
19554
19599
  const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
19555
19600
 
19601
+ const customVertexExtensions = generateVertexExtensions( parameters );
19602
+
19556
19603
  const customDefines = generateDefines( defines );
19557
19604
 
19558
19605
  const program = gl.createProgram();
@@ -19605,6 +19652,7 @@
19605
19652
 
19606
19653
  customDefines,
19607
19654
 
19655
+ parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
19608
19656
  parameters.batching ? '#define USE_BATCHING' : '',
19609
19657
  parameters.instancing ? '#define USE_INSTANCING' : '',
19610
19658
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
@@ -19827,6 +19875,7 @@
19827
19875
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
19828
19876
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
19829
19877
 
19878
+ parameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',
19830
19879
  parameters.map ? '#define USE_MAP' : '',
19831
19880
  parameters.matcap ? '#define USE_MATCAP' : '',
19832
19881
  parameters.envMap ? '#define USE_ENVMAP' : '',
@@ -19945,6 +19994,7 @@
19945
19994
  versionString = '#version 300 es\n';
19946
19995
 
19947
19996
  prefixVertex = [
19997
+ customVertexExtensions,
19948
19998
  'precision mediump sampler2DArray;',
19949
19999
  '#define attribute in',
19950
20000
  '#define varying out',
@@ -20027,6 +20077,8 @@
20027
20077
  console.error(
20028
20078
  'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
20029
20079
  'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
20080
+ 'Material Name: ' + self.name + '\n' +
20081
+ 'Material Type: ' + self.type + '\n\n' +
20030
20082
  'Program Info Log: ' + programLog + '\n' +
20031
20083
  vertexErrors + '\n' +
20032
20084
  fragmentErrors
@@ -20290,6 +20342,7 @@
20290
20342
 
20291
20343
  const _programLayers = new Layers();
20292
20344
  const _customShaders = new WebGLShaderCache();
20345
+ const _activeChannels = new Set();
20293
20346
  const programs = [];
20294
20347
 
20295
20348
  const IS_WEBGL2 = capabilities.isWebGL2;
@@ -20318,6 +20371,8 @@
20318
20371
 
20319
20372
  function getChannel( value ) {
20320
20373
 
20374
+ _activeChannels.add( value );
20375
+
20321
20376
  if ( value === 0 ) return 'uv';
20322
20377
 
20323
20378
  return `uv${ value }`;
@@ -20438,10 +20493,6 @@
20438
20493
 
20439
20494
  const HAS_EXTENSIONS = !! material.extensions;
20440
20495
 
20441
- const HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;
20442
- const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
20443
- const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
20444
-
20445
20496
  let toneMapping = NoToneMapping;
20446
20497
 
20447
20498
  if ( material.toneMapped ) {
@@ -20480,6 +20531,7 @@
20480
20531
 
20481
20532
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
20482
20533
  outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
20534
+ alphaToCoverage: !! material.alphaToCoverage,
20483
20535
 
20484
20536
  map: HAS_MAP,
20485
20537
  matcap: HAS_MATCAP,
@@ -20525,7 +20577,7 @@
20525
20577
 
20526
20578
  gradientMap: HAS_GRADIENTMAP,
20527
20579
 
20528
- opaque: material.transparent === false && material.blending === NormalBlending,
20580
+ opaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,
20529
20581
 
20530
20582
  alphaMap: HAS_ALPHAMAP,
20531
20583
  alphaTest: HAS_ALPHATEST,
@@ -20572,15 +20624,12 @@
20572
20624
  vertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),
20573
20625
  vertexColors: material.vertexColors,
20574
20626
  vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
20575
- vertexUv1s: HAS_ATTRIBUTE_UV1,
20576
- vertexUv2s: HAS_ATTRIBUTE_UV2,
20577
- vertexUv3s: HAS_ATTRIBUTE_UV3,
20578
20627
 
20579
20628
  pointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),
20580
20629
 
20581
20630
  fog: !! fog,
20582
20631
  useFog: material.fog === true,
20583
- fogExp2: ( fog && fog.isFogExp2 ),
20632
+ fogExp2: ( !! fog && fog.isFogExp2 ),
20584
20633
 
20585
20634
  flatShading: material.flatShading === true,
20586
20635
 
@@ -20636,6 +20685,8 @@
20636
20685
  extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
20637
20686
  extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
20638
20687
  extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
20688
+ extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
20689
+ extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
20639
20690
 
20640
20691
  rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
20641
20692
  rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
@@ -20646,6 +20697,14 @@
20646
20697
 
20647
20698
  };
20648
20699
 
20700
+ // the usage of getChannel() determines the active texture channels for this shader
20701
+
20702
+ parameters.vertexUv1s = _activeChannels.has( 1 );
20703
+ parameters.vertexUv2s = _activeChannels.has( 2 );
20704
+ parameters.vertexUv3s = _activeChannels.has( 3 );
20705
+
20706
+ _activeChannels.clear();
20707
+
20649
20708
  return parameters;
20650
20709
 
20651
20710
  }
@@ -20831,6 +20890,8 @@
20831
20890
  _programLayers.enable( 18 );
20832
20891
  if ( parameters.decodeVideoTexture )
20833
20892
  _programLayers.enable( 19 );
20893
+ if ( parameters.alphaToCoverage )
20894
+ _programLayers.enable( 20 );
20834
20895
 
20835
20896
  array.push( _programLayers.mask );
20836
20897
 
@@ -21610,8 +21671,17 @@
21610
21671
 
21611
21672
  // WebGL 2
21612
21673
 
21613
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21614
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21674
+ if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
21675
+
21676
+ state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21677
+ state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21678
+
21679
+ } else {
21680
+
21681
+ state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21682
+ state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
21683
+
21684
+ }
21615
21685
 
21616
21686
  } else {
21617
21687
 
@@ -22248,6 +22318,7 @@
22248
22318
 
22249
22319
  cachedMaterial = result.clone();
22250
22320
  materialsForVariant[ keyB ] = cachedMaterial;
22321
+ material.addEventListener( 'dispose', onMaterialDispose );
22251
22322
 
22252
22323
  }
22253
22324
 
@@ -22360,6 +22431,32 @@
22360
22431
 
22361
22432
  }
22362
22433
 
22434
+ function onMaterialDispose( event ) {
22435
+
22436
+ const material = event.target;
22437
+
22438
+ material.removeEventListener( 'dispose', onMaterialDispose );
22439
+
22440
+ // make sure to remove the unique distance/depth materials used for shadow map rendering
22441
+
22442
+ for ( const id in _materialCache ) {
22443
+
22444
+ const cache = _materialCache[ id ];
22445
+
22446
+ const uuid = event.target.uuid;
22447
+
22448
+ if ( uuid in cache ) {
22449
+
22450
+ const shadowMaterial = cache[ uuid ];
22451
+ shadowMaterial.dispose();
22452
+ delete cache[ uuid ];
22453
+
22454
+ }
22455
+
22456
+ }
22457
+
22458
+ }
22459
+
22363
22460
  }
22364
22461
 
22365
22462
  function WebGLState( gl, extensions, capabilities ) {
@@ -23688,10 +23785,6 @@
23688
23785
  function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
23689
23786
 
23690
23787
  const isWebGL2 = capabilities.isWebGL2;
23691
- const maxTextures = capabilities.maxTextures;
23692
- const maxCubemapSize = capabilities.maxCubemapSize;
23693
- const maxTextureSize = capabilities.maxTextureSize;
23694
- const maxSamples = capabilities.maxSamples;
23695
23788
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
23696
23789
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
23697
23790
 
@@ -24110,9 +24203,9 @@
24110
24203
 
24111
24204
  const textureUnit = textureUnits;
24112
24205
 
24113
- if ( textureUnit >= maxTextures ) {
24206
+ if ( textureUnit >= capabilities.maxTextures ) {
24114
24207
 
24115
- console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );
24208
+ console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
24116
24209
 
24117
24210
  }
24118
24211
 
@@ -24252,6 +24345,14 @@
24252
24345
 
24253
24346
  function setTextureParameters( textureType, texture, supportsMips ) {
24254
24347
 
24348
+ if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
24349
+ ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
24350
+ texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {
24351
+
24352
+ console.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );
24353
+
24354
+ }
24355
+
24255
24356
  if ( supportsMips ) {
24256
24357
 
24257
24358
  _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
@@ -24429,7 +24530,7 @@
24429
24530
  _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24430
24531
 
24431
24532
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24432
- let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
24533
+ let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
24433
24534
  image = verifyColorSpace( texture, image );
24434
24535
 
24435
24536
  const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
@@ -24445,6 +24546,7 @@
24445
24546
 
24446
24547
  const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24447
24548
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24549
+ const dataReady = source.dataReady;
24448
24550
  const levels = getMipLevels( texture, image, supportsMips );
24449
24551
 
24450
24552
  if ( texture.isDepthTexture ) {
@@ -24557,7 +24659,11 @@
24557
24659
 
24558
24660
  if ( useTexStorage ) {
24559
24661
 
24560
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
24662
+ if ( dataReady ) {
24663
+
24664
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
24665
+
24666
+ }
24561
24667
 
24562
24668
  } else {
24563
24669
 
@@ -24579,7 +24685,11 @@
24579
24685
 
24580
24686
  }
24581
24687
 
24582
- state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
24688
+ if ( dataReady ) {
24689
+
24690
+ state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
24691
+
24692
+ }
24583
24693
 
24584
24694
  } else {
24585
24695
 
@@ -24609,7 +24719,11 @@
24609
24719
 
24610
24720
  if ( useTexStorage ) {
24611
24721
 
24612
- state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
24722
+ if ( dataReady ) {
24723
+
24724
+ state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
24725
+
24726
+ }
24613
24727
 
24614
24728
  } else {
24615
24729
 
@@ -24627,7 +24741,11 @@
24627
24741
 
24628
24742
  if ( useTexStorage ) {
24629
24743
 
24630
- state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
24744
+ if ( dataReady ) {
24745
+
24746
+ state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
24747
+
24748
+ }
24631
24749
 
24632
24750
  } else {
24633
24751
 
@@ -24657,7 +24775,11 @@
24657
24775
 
24658
24776
  if ( useTexStorage ) {
24659
24777
 
24660
- state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
24778
+ if ( dataReady ) {
24779
+
24780
+ state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
24781
+
24782
+ }
24661
24783
 
24662
24784
  } else {
24663
24785
 
@@ -24675,7 +24797,11 @@
24675
24797
 
24676
24798
  if ( useTexStorage ) {
24677
24799
 
24678
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
24800
+ if ( dataReady ) {
24801
+
24802
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
24803
+
24804
+ }
24679
24805
 
24680
24806
  } else {
24681
24807
 
@@ -24699,7 +24825,11 @@
24699
24825
 
24700
24826
  }
24701
24827
 
24702
- state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
24828
+ if ( dataReady ) {
24829
+
24830
+ state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
24831
+
24832
+ }
24703
24833
 
24704
24834
  } else {
24705
24835
 
@@ -24717,7 +24847,11 @@
24717
24847
 
24718
24848
  }
24719
24849
 
24720
- state.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
24850
+ if ( dataReady ) {
24851
+
24852
+ state.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
24853
+
24854
+ }
24721
24855
 
24722
24856
  } else {
24723
24857
 
@@ -24772,7 +24906,11 @@
24772
24906
 
24773
24907
  if ( useTexStorage ) {
24774
24908
 
24775
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );
24909
+ if ( dataReady ) {
24910
+
24911
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );
24912
+
24913
+ }
24776
24914
 
24777
24915
  } else {
24778
24916
 
@@ -24794,7 +24932,11 @@
24794
24932
 
24795
24933
  }
24796
24934
 
24797
- state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );
24935
+ if ( dataReady ) {
24936
+
24937
+ state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );
24938
+
24939
+ }
24798
24940
 
24799
24941
  } else {
24800
24942
 
@@ -24855,7 +24997,7 @@
24855
24997
 
24856
24998
  if ( ! isCompressed && ! isDataTexture ) {
24857
24999
 
24858
- cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );
25000
+ cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
24859
25001
 
24860
25002
  } else {
24861
25003
 
@@ -24875,6 +25017,7 @@
24875
25017
 
24876
25018
  const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
24877
25019
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
25020
+ const dataReady = source.dataReady;
24878
25021
  let levels = getMipLevels( texture, image, supportsMips );
24879
25022
 
24880
25023
  setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
@@ -24903,7 +25046,11 @@
24903
25046
 
24904
25047
  if ( useTexStorage ) {
24905
25048
 
24906
- state.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25049
+ if ( dataReady ) {
25050
+
25051
+ state.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25052
+
25053
+ }
24907
25054
 
24908
25055
  } else {
24909
25056
 
@@ -24921,7 +25068,11 @@
24921
25068
 
24922
25069
  if ( useTexStorage ) {
24923
25070
 
24924
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25071
+ if ( dataReady ) {
25072
+
25073
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25074
+
25075
+ }
24925
25076
 
24926
25077
  } else {
24927
25078
 
@@ -24957,7 +25108,11 @@
24957
25108
 
24958
25109
  if ( useTexStorage ) {
24959
25110
 
24960
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
25111
+ if ( dataReady ) {
25112
+
25113
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
25114
+
25115
+ }
24961
25116
 
24962
25117
  } else {
24963
25118
 
@@ -24972,7 +25127,11 @@
24972
25127
 
24973
25128
  if ( useTexStorage ) {
24974
25129
 
24975
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
25130
+ if ( dataReady ) {
25131
+
25132
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
25133
+
25134
+ }
24976
25135
 
24977
25136
  } else {
24978
25137
 
@@ -24986,7 +25145,11 @@
24986
25145
 
24987
25146
  if ( useTexStorage ) {
24988
25147
 
24989
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
25148
+ if ( dataReady ) {
25149
+
25150
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
25151
+
25152
+ }
24990
25153
 
24991
25154
  } else {
24992
25155
 
@@ -25000,7 +25163,11 @@
25000
25163
 
25001
25164
  if ( useTexStorage ) {
25002
25165
 
25003
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
25166
+ if ( dataReady ) {
25167
+
25168
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
25169
+
25170
+ }
25004
25171
 
25005
25172
  } else {
25006
25173
 
@@ -25686,7 +25853,7 @@
25686
25853
 
25687
25854
  function getRenderTargetSamples( renderTarget ) {
25688
25855
 
25689
- return Math.min( maxSamples, renderTarget.samples );
25856
+ return Math.min( capabilities.maxSamples, renderTarget.samples );
25690
25857
 
25691
25858
  }
25692
25859
 
@@ -26435,6 +26602,105 @@
26435
26602
 
26436
26603
  }
26437
26604
 
26605
+ const _occlusion_vertex = `
26606
+ void main() {
26607
+
26608
+ gl_Position = vec4( position, 1.0 );
26609
+
26610
+ }`;
26611
+
26612
+ const _occlusion_fragment = `
26613
+ uniform sampler2DArray depthColor;
26614
+ uniform float depthWidth;
26615
+ uniform float depthHeight;
26616
+
26617
+ void main() {
26618
+
26619
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
26620
+
26621
+ if ( coord.x >= 1.0 ) {
26622
+
26623
+ gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
26624
+
26625
+ } else {
26626
+
26627
+ gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
26628
+
26629
+ }
26630
+
26631
+ }`;
26632
+
26633
+ class WebXRDepthSensing {
26634
+
26635
+ constructor() {
26636
+
26637
+ this.texture = null;
26638
+ this.mesh = null;
26639
+
26640
+ this.depthNear = 0;
26641
+ this.depthFar = 0;
26642
+
26643
+ }
26644
+
26645
+ init( renderer, depthData, renderState ) {
26646
+
26647
+ if ( this.texture === null ) {
26648
+
26649
+ const texture = new Texture();
26650
+
26651
+ const texProps = renderer.properties.get( texture );
26652
+ texProps.__webglTexture = depthData.texture;
26653
+
26654
+ if ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {
26655
+
26656
+ this.depthNear = depthData.depthNear;
26657
+ this.depthFar = depthData.depthFar;
26658
+
26659
+ }
26660
+
26661
+ this.texture = texture;
26662
+
26663
+ }
26664
+
26665
+ }
26666
+
26667
+ render( renderer, cameraXR ) {
26668
+
26669
+ if ( this.texture !== null ) {
26670
+
26671
+ if ( this.mesh === null ) {
26672
+
26673
+ const viewport = cameraXR.cameras[ 0 ].viewport;
26674
+ const material = new ShaderMaterial( {
26675
+ extensions: { fragDepth: true },
26676
+ vertexShader: _occlusion_vertex,
26677
+ fragmentShader: _occlusion_fragment,
26678
+ uniforms: {
26679
+ depthColor: { value: this.texture },
26680
+ depthWidth: { value: viewport.z },
26681
+ depthHeight: { value: viewport.w }
26682
+ }
26683
+ } );
26684
+
26685
+ this.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );
26686
+
26687
+ }
26688
+
26689
+ renderer.render( this.mesh, cameraXR );
26690
+
26691
+ }
26692
+
26693
+ }
26694
+
26695
+ reset() {
26696
+
26697
+ this.texture = null;
26698
+ this.mesh = null;
26699
+
26700
+ }
26701
+
26702
+ }
26703
+
26438
26704
  class WebXRManager extends EventDispatcher {
26439
26705
 
26440
26706
  constructor( renderer, gl ) {
@@ -26458,7 +26724,10 @@
26458
26724
  let glProjLayer = null;
26459
26725
  let glBaseLayer = null;
26460
26726
  let xrFrame = null;
26727
+
26728
+ const depthSensing = new WebXRDepthSensing();
26461
26729
  const attributes = gl.getContextAttributes();
26730
+
26462
26731
  let initialRenderTarget = null;
26463
26732
  let newRenderTarget = null;
26464
26733
 
@@ -26588,6 +26857,8 @@
26588
26857
  _currentDepthNear = null;
26589
26858
  _currentDepthFar = null;
26590
26859
 
26860
+ depthSensing.reset();
26861
+
26591
26862
  // restore framebuffer/rendering state
26592
26863
 
26593
26864
  renderer.setRenderTarget( initialRenderTarget );
@@ -26946,6 +27217,13 @@
26946
27217
 
26947
27218
  if ( session === null ) return;
26948
27219
 
27220
+ if ( depthSensing.texture !== null ) {
27221
+
27222
+ camera.near = depthSensing.depthNear;
27223
+ camera.far = depthSensing.depthFar;
27224
+
27225
+ }
27226
+
26949
27227
  cameraXR.near = cameraR.near = cameraL.near = camera.near;
26950
27228
  cameraXR.far = cameraR.far = cameraL.far = camera.far;
26951
27229
 
@@ -26961,6 +27239,15 @@
26961
27239
  _currentDepthNear = cameraXR.near;
26962
27240
  _currentDepthFar = cameraXR.far;
26963
27241
 
27242
+ cameraL.near = _currentDepthNear;
27243
+ cameraL.far = _currentDepthFar;
27244
+ cameraR.near = _currentDepthNear;
27245
+ cameraR.far = _currentDepthFar;
27246
+
27247
+ cameraL.updateProjectionMatrix();
27248
+ cameraR.updateProjectionMatrix();
27249
+ camera.updateProjectionMatrix();
27250
+
26964
27251
  }
26965
27252
 
26966
27253
  const parent = camera.parent;
@@ -27062,6 +27349,12 @@
27062
27349
 
27063
27350
  };
27064
27351
 
27352
+ this.hasDepthSensing = function () {
27353
+
27354
+ return depthSensing.texture !== null;
27355
+
27356
+ };
27357
+
27065
27358
  // Animation Loop
27066
27359
 
27067
27360
  let onAnimationFrameCallback = null;
@@ -27154,6 +27447,22 @@
27154
27447
 
27155
27448
  }
27156
27449
 
27450
+ //
27451
+
27452
+ const enabledFeatures = session.enabledFeatures;
27453
+
27454
+ if ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {
27455
+
27456
+ const depthData = glBinding.getDepthInformation( views[ 0 ] );
27457
+
27458
+ if ( depthData && depthData.isValid && depthData.texture ) {
27459
+
27460
+ depthSensing.init( renderer, depthData, session.renderState );
27461
+
27462
+ }
27463
+
27464
+ }
27465
+
27157
27466
  }
27158
27467
 
27159
27468
  //
@@ -27171,6 +27480,8 @@
27171
27480
 
27172
27481
  }
27173
27482
 
27483
+ depthSensing.render( renderer, cameraXR );
27484
+
27174
27485
  if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
27175
27486
 
27176
27487
  if ( frame.detectedPlanes ) {
@@ -27860,57 +28171,62 @@
27860
28171
 
27861
28172
  for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
27862
28173
 
27863
- const uniform = uniforms[ i ];
28174
+ const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
27864
28175
 
27865
- // partly update the buffer if necessary
28176
+ for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
27866
28177
 
27867
- if ( hasUniformChanged( uniform, i, cache ) === true ) {
28178
+ const uniform = uniformArray[ j ];
27868
28179
 
27869
- const offset = uniform.__offset;
28180
+ if ( hasUniformChanged( uniform, i, j, cache ) === true ) {
27870
28181
 
27871
- const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
28182
+ const offset = uniform.__offset;
27872
28183
 
27873
- let arrayOffset = 0;
28184
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
27874
28185
 
27875
- for ( let i = 0; i < values.length; i ++ ) {
28186
+ let arrayOffset = 0;
27876
28187
 
27877
- const value = values[ i ];
28188
+ for ( let k = 0; k < values.length; k ++ ) {
27878
28189
 
27879
- const info = getUniformSize( value );
28190
+ const value = values[ k ];
27880
28191
 
27881
- if ( typeof value === 'number' ) {
28192
+ const info = getUniformSize( value );
27882
28193
 
27883
- uniform.__data[ 0 ] = value;
27884
- gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
28194
+ // TODO add integer and struct support
28195
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
27885
28196
 
27886
- } else if ( value.isMatrix3 ) {
28197
+ uniform.__data[ 0 ] = value;
28198
+ gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
27887
28199
 
27888
- // manually converting 3x3 to 3x4
28200
+ } else if ( value.isMatrix3 ) {
27889
28201
 
27890
- uniform.__data[ 0 ] = value.elements[ 0 ];
27891
- uniform.__data[ 1 ] = value.elements[ 1 ];
27892
- uniform.__data[ 2 ] = value.elements[ 2 ];
27893
- uniform.__data[ 3 ] = value.elements[ 0 ];
27894
- uniform.__data[ 4 ] = value.elements[ 3 ];
27895
- uniform.__data[ 5 ] = value.elements[ 4 ];
27896
- uniform.__data[ 6 ] = value.elements[ 5 ];
27897
- uniform.__data[ 7 ] = value.elements[ 0 ];
27898
- uniform.__data[ 8 ] = value.elements[ 6 ];
27899
- uniform.__data[ 9 ] = value.elements[ 7 ];
27900
- uniform.__data[ 10 ] = value.elements[ 8 ];
27901
- uniform.__data[ 11 ] = value.elements[ 0 ];
28202
+ // manually converting 3x3 to 3x4
27902
28203
 
27903
- } else {
28204
+ uniform.__data[ 0 ] = value.elements[ 0 ];
28205
+ uniform.__data[ 1 ] = value.elements[ 1 ];
28206
+ uniform.__data[ 2 ] = value.elements[ 2 ];
28207
+ uniform.__data[ 3 ] = 0;
28208
+ uniform.__data[ 4 ] = value.elements[ 3 ];
28209
+ uniform.__data[ 5 ] = value.elements[ 4 ];
28210
+ uniform.__data[ 6 ] = value.elements[ 5 ];
28211
+ uniform.__data[ 7 ] = 0;
28212
+ uniform.__data[ 8 ] = value.elements[ 6 ];
28213
+ uniform.__data[ 9 ] = value.elements[ 7 ];
28214
+ uniform.__data[ 10 ] = value.elements[ 8 ];
28215
+ uniform.__data[ 11 ] = 0;
28216
+
28217
+ } else {
27904
28218
 
27905
- value.toArray( uniform.__data, arrayOffset );
28219
+ value.toArray( uniform.__data, arrayOffset );
27906
28220
 
27907
- arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
28221
+ arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
28222
+
28223
+ }
27908
28224
 
27909
28225
  }
27910
28226
 
27911
- }
28227
+ gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
27912
28228
 
27913
- gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
28229
+ }
27914
28230
 
27915
28231
  }
27916
28232
 
@@ -27920,31 +28236,22 @@
27920
28236
 
27921
28237
  }
27922
28238
 
27923
- function hasUniformChanged( uniform, index, cache ) {
28239
+ function hasUniformChanged( uniform, index, indexArray, cache ) {
27924
28240
 
27925
28241
  const value = uniform.value;
28242
+ const indexString = index + '_' + indexArray;
27926
28243
 
27927
- if ( cache[ index ] === undefined ) {
28244
+ if ( cache[ indexString ] === undefined ) {
27928
28245
 
27929
28246
  // cache entry does not exist so far
27930
28247
 
27931
- if ( typeof value === 'number' ) {
28248
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
27932
28249
 
27933
- cache[ index ] = value;
28250
+ cache[ indexString ] = value;
27934
28251
 
27935
28252
  } else {
27936
28253
 
27937
- const values = Array.isArray( value ) ? value : [ value ];
27938
-
27939
- const tempValues = [];
27940
-
27941
- for ( let i = 0; i < values.length; i ++ ) {
27942
-
27943
- tempValues.push( values[ i ].clone() );
27944
-
27945
- }
27946
-
27947
- cache[ index ] = tempValues;
28254
+ cache[ indexString ] = value.clone();
27948
28255
 
27949
28256
  }
27950
28257
 
@@ -27952,32 +28259,25 @@
27952
28259
 
27953
28260
  } else {
27954
28261
 
28262
+ const cachedObject = cache[ indexString ];
28263
+
27955
28264
  // compare current value with cached entry
27956
28265
 
27957
- if ( typeof value === 'number' ) {
28266
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
27958
28267
 
27959
- if ( cache[ index ] !== value ) {
28268
+ if ( cachedObject !== value ) {
27960
28269
 
27961
- cache[ index ] = value;
28270
+ cache[ indexString ] = value;
27962
28271
  return true;
27963
28272
 
27964
28273
  }
27965
28274
 
27966
28275
  } else {
27967
28276
 
27968
- const cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];
27969
- const values = Array.isArray( value ) ? value : [ value ];
27970
-
27971
- for ( let i = 0; i < cachedObjects.length; i ++ ) {
28277
+ if ( cachedObject.equals( value ) === false ) {
27972
28278
 
27973
- const cachedObject = cachedObjects[ i ];
27974
-
27975
- if ( cachedObject.equals( values[ i ] ) === false ) {
27976
-
27977
- cachedObject.copy( values[ i ] );
27978
- return true;
27979
-
27980
- }
28279
+ cachedObject.copy( value );
28280
+ return true;
27981
28281
 
27982
28282
  }
27983
28283
 
@@ -27998,63 +28298,53 @@
27998
28298
 
27999
28299
  let offset = 0; // global buffer offset in bytes
28000
28300
  const chunkSize = 16; // size of a chunk in bytes
28001
- let chunkOffset = 0; // offset within a single chunk in bytes
28002
28301
 
28003
28302
  for ( let i = 0, l = uniforms.length; i < l; i ++ ) {
28004
28303
 
28005
- const uniform = uniforms[ i ];
28006
-
28007
- const infos = {
28008
- boundary: 0, // bytes
28009
- storage: 0 // bytes
28010
- };
28011
-
28012
- const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
28304
+ const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
28013
28305
 
28014
- for ( let j = 0, jl = values.length; j < jl; j ++ ) {
28306
+ for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
28015
28307
 
28016
- const value = values[ j ];
28308
+ const uniform = uniformArray[ j ];
28017
28309
 
28018
- const info = getUniformSize( value );
28310
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
28019
28311
 
28020
- infos.boundary += info.boundary;
28021
- infos.storage += info.storage;
28312
+ for ( let k = 0, kl = values.length; k < kl; k ++ ) {
28022
28313
 
28023
- }
28314
+ const value = values[ k ];
28024
28315
 
28025
- // the following two properties will be used for partial buffer updates
28316
+ const info = getUniformSize( value );
28026
28317
 
28027
- uniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );
28028
- uniform.__offset = offset;
28318
+ // Calculate the chunk offset
28319
+ const chunkOffsetUniform = offset % chunkSize;
28029
28320
 
28030
- //
28321
+ // Check for chunk overflow
28322
+ if ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {
28031
28323
 
28032
- if ( i > 0 ) {
28324
+ // Add padding and adjust offset
28325
+ offset += ( chunkSize - chunkOffsetUniform );
28033
28326
 
28034
- chunkOffset = offset % chunkSize;
28327
+ }
28035
28328
 
28036
- const remainingSizeInChunk = chunkSize - chunkOffset;
28329
+ // the following two properties will be used for partial buffer updates
28037
28330
 
28038
- // check for chunk overflow
28331
+ uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
28332
+ uniform.__offset = offset;
28039
28333
 
28040
- if ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {
28041
28334
 
28042
- // add padding and adjust offset
28335
+ // Update the global offset
28336
+ offset += info.storage;
28043
28337
 
28044
- offset += ( chunkSize - chunkOffset );
28045
- uniform.__offset = offset;
28046
28338
 
28047
28339
  }
28048
28340
 
28049
28341
  }
28050
28342
 
28051
- offset += infos.storage;
28052
-
28053
28343
  }
28054
28344
 
28055
28345
  // ensure correct final padding
28056
28346
 
28057
- chunkOffset = offset % chunkSize;
28347
+ const chunkOffset = offset % chunkSize;
28058
28348
 
28059
28349
  if ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );
28060
28350
 
@@ -28076,9 +28366,9 @@
28076
28366
 
28077
28367
  // determine sizes according to STD140
28078
28368
 
28079
- if ( typeof value === 'number' ) {
28369
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
28080
28370
 
28081
- // float/int
28371
+ // float/int/bool
28082
28372
 
28083
28373
  info.boundary = 4;
28084
28374
  info.storage = 4;
@@ -29319,7 +29609,11 @@
29319
29609
 
29320
29610
  //
29321
29611
 
29322
- background.render( currentRenderList, scene );
29612
+ if ( xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false ) {
29613
+
29614
+ background.render( currentRenderList, scene );
29615
+
29616
+ }
29323
29617
 
29324
29618
  // render scene
29325
29619
 
@@ -30555,7 +30849,7 @@
30555
30849
  textures.setTexture3D( dstTexture, 0 );
30556
30850
  glTarget = _gl.TEXTURE_3D;
30557
30851
 
30558
- } else if ( dstTexture.isDataArrayTexture ) {
30852
+ } else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {
30559
30853
 
30560
30854
  textures.setTexture2DArray( dstTexture, 0 );
30561
30855
  glTarget = _gl.TEXTURE_2D_ARRAY;
@@ -30577,7 +30871,7 @@
30577
30871
  const unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
30578
30872
  const unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
30579
30873
 
30580
- const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;
30874
+ const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
30581
30875
 
30582
30876
  _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
30583
30877
  _gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
@@ -30682,20 +30976,6 @@
30682
30976
 
30683
30977
  }
30684
30978
 
30685
- get physicallyCorrectLights() { // @deprecated, r150
30686
-
30687
- console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
30688
- return ! this.useLegacyLights;
30689
-
30690
- }
30691
-
30692
- set physicallyCorrectLights( value ) { // @deprecated, r150
30693
-
30694
- console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
30695
- this.useLegacyLights = ! value;
30696
-
30697
- }
30698
-
30699
30979
  get outputEncoding() { // @deprecated, r152
30700
30980
 
30701
30981
  console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
@@ -30820,7 +31100,7 @@
30820
31100
 
30821
31101
  get updateRange() {
30822
31102
 
30823
- console.warn( 'THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.' ); // @deprecated, r159
31103
+ warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
30824
31104
  return this._updateRange;
30825
31105
 
30826
31106
  }
@@ -31035,6 +31315,26 @@
31035
31315
 
31036
31316
  }
31037
31317
 
31318
+ getComponent( index, component ) {
31319
+
31320
+ let value = this.array[ index * this.data.stride + this.offset + component ];
31321
+
31322
+ if ( this.normalized ) value = denormalize( value, this.array );
31323
+
31324
+ return value;
31325
+
31326
+ }
31327
+
31328
+ setComponent( index, component, value ) {
31329
+
31330
+ if ( this.normalized ) value = normalize$1( value, this.array );
31331
+
31332
+ this.data.array[ index * this.data.stride + this.offset + component ] = value;
31333
+
31334
+ return this;
31335
+
31336
+ }
31337
+
31038
31338
  setX( index, x ) {
31039
31339
 
31040
31340
  if ( this.normalized ) x = normalize$1( x, this.array );
@@ -37052,7 +37352,7 @@
37052
37352
 
37053
37353
  start() {
37054
37354
 
37055
- this.startTime = now$3();
37355
+ this.startTime = now$2();
37056
37356
 
37057
37357
  this.oldTime = this.startTime;
37058
37358
  this.elapsedTime = 0;
@@ -37088,7 +37388,7 @@
37088
37388
 
37089
37389
  if ( this.running ) {
37090
37390
 
37091
- const newTime = now$3();
37391
+ const newTime = now$2();
37092
37392
 
37093
37393
  diff = ( newTime - this.oldTime ) / 1000;
37094
37394
  this.oldTime = newTime;
@@ -37103,7 +37403,7 @@
37103
37403
 
37104
37404
  }
37105
37405
 
37106
- function now$3() {
37406
+ function now$2() {
37107
37407
 
37108
37408
  return ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732
37109
37409
 
@@ -38001,15 +38301,11 @@
38001
38301
  /** Detect free variable `global` from Node.js. */
38002
38302
  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
38003
38303
 
38004
- var freeGlobal$1 = freeGlobal;
38005
-
38006
38304
  /** Detect free variable `self`. */
38007
38305
  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
38008
38306
 
38009
38307
  /** Used as a reference to the global object. */
38010
- var root = freeGlobal$1 || freeSelf || Function('return this')();
38011
-
38012
- var root$1 = root;
38308
+ var root = freeGlobal || freeSelf || Function('return this')();
38013
38309
 
38014
38310
  /**
38015
38311
  * Gets the timestamp of the number of milliseconds that have elapsed since
@@ -38028,11 +38324,9 @@
38028
38324
  * // => Logs the number of milliseconds it took for the deferred invocation.
38029
38325
  */
38030
38326
  var now$1 = function() {
38031
- return root$1.Date.now();
38327
+ return root.Date.now();
38032
38328
  };
38033
38329
 
38034
- var now$2 = now$1;
38035
-
38036
38330
  /** Used to match a single whitespace character. */
38037
38331
  var reWhitespace = /\s/;
38038
38332
 
@@ -38068,9 +38362,7 @@
38068
38362
  }
38069
38363
 
38070
38364
  /** Built-in value references. */
38071
- var Symbol$1 = root$1.Symbol;
38072
-
38073
- var Symbol$2 = Symbol$1;
38365
+ var Symbol$1 = root.Symbol;
38074
38366
 
38075
38367
  /** Used for built-in method references. */
38076
38368
  var objectProto$1 = Object.prototype;
@@ -38086,7 +38378,7 @@
38086
38378
  var nativeObjectToString$1 = objectProto$1.toString;
38087
38379
 
38088
38380
  /** Built-in value references. */
38089
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
38381
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
38090
38382
 
38091
38383
  /**
38092
38384
  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
@@ -38141,7 +38433,7 @@
38141
38433
  undefinedTag = '[object Undefined]';
38142
38434
 
38143
38435
  /** Built-in value references. */
38144
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
38436
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
38145
38437
 
38146
38438
  /**
38147
38439
  * The base implementation of `getTag` without fallbacks for buggy environments.
@@ -38396,7 +38688,7 @@
38396
38688
  }
38397
38689
 
38398
38690
  function timerExpired() {
38399
- var time = now$2();
38691
+ var time = now$1();
38400
38692
  if (shouldInvoke(time)) {
38401
38693
  return trailingEdge(time);
38402
38694
  }
@@ -38425,11 +38717,11 @@
38425
38717
  }
38426
38718
 
38427
38719
  function flush() {
38428
- return timerId === undefined ? result : trailingEdge(now$2());
38720
+ return timerId === undefined ? result : trailingEdge(now$1());
38429
38721
  }
38430
38722
 
38431
38723
  function debounced() {
38432
- var time = now$2(),
38724
+ var time = now$1(),
38433
38725
  isInvoking = shouldInvoke(time);
38434
38726
 
38435
38727
  lastArgs = arguments;
@@ -39087,18 +39379,21 @@
39087
39379
  Tween.prototype.isPaused = function () {
39088
39380
  return this._isPaused;
39089
39381
  };
39382
+ Tween.prototype.getDuration = function () {
39383
+ return this._duration;
39384
+ };
39090
39385
  Tween.prototype.to = function (target, duration) {
39091
39386
  if (duration === void 0) { duration = 1000; }
39092
39387
  if (this._isPlaying)
39093
39388
  throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
39094
39389
  this._valuesEnd = target;
39095
39390
  this._propertiesAreSetUp = false;
39096
- this._duration = duration;
39391
+ this._duration = duration < 0 ? 0 : duration;
39097
39392
  return this;
39098
39393
  };
39099
39394
  Tween.prototype.duration = function (duration) {
39100
39395
  if (duration === void 0) { duration = 1000; }
39101
- this._duration = duration;
39396
+ this._duration = duration < 0 ? 0 : duration;
39102
39397
  return this;
39103
39398
  };
39104
39399
  Tween.prototype.dynamic = function (dynamic) {
@@ -39347,12 +39642,13 @@
39347
39642
  * it is still playing, just paused).
39348
39643
  */
39349
39644
  Tween.prototype.update = function (time, autoStart) {
39645
+ var _this = this;
39646
+ var _a;
39350
39647
  if (time === void 0) { time = now(); }
39351
39648
  if (autoStart === void 0) { autoStart = true; }
39352
39649
  if (this._isPaused)
39353
39650
  return true;
39354
39651
  var property;
39355
- var elapsed;
39356
39652
  var endTime = this._startTime + this._duration;
39357
39653
  if (!this._goToEnd && !this._isPlaying) {
39358
39654
  if (time > endTime)
@@ -39376,18 +39672,37 @@
39376
39672
  }
39377
39673
  this._onEveryStartCallbackFired = true;
39378
39674
  }
39379
- elapsed = (time - this._startTime) / this._duration;
39380
- elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
39675
+ var elapsedTime = time - this._startTime;
39676
+ var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
39677
+ var totalTime = this._duration + this._repeat * durationAndDelay;
39678
+ var calculateElapsedPortion = function () {
39679
+ if (_this._duration === 0)
39680
+ return 1;
39681
+ if (elapsedTime > totalTime) {
39682
+ return 1;
39683
+ }
39684
+ var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
39685
+ var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
39686
+ // TODO use %?
39687
+ // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
39688
+ var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
39689
+ if (portion === 0 && elapsedTime === _this._duration) {
39690
+ return 1;
39691
+ }
39692
+ return portion;
39693
+ };
39694
+ var elapsed = calculateElapsedPortion();
39381
39695
  var value = this._easingFunction(elapsed);
39382
39696
  // properties transformations
39383
39697
  this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
39384
39698
  if (this._onUpdateCallback) {
39385
39699
  this._onUpdateCallback(this._object, elapsed);
39386
39700
  }
39387
- if (elapsed === 1) {
39701
+ if (this._duration === 0 || elapsedTime >= this._duration) {
39388
39702
  if (this._repeat > 0) {
39703
+ var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
39389
39704
  if (isFinite(this._repeat)) {
39390
- this._repeat--;
39705
+ this._repeat -= completeCount;
39391
39706
  }
39392
39707
  // Reassign starting values, restart by making startTime = now
39393
39708
  for (property in this._valuesStartRepeat) {
@@ -39405,12 +39720,7 @@
39405
39720
  if (this._yoyo) {
39406
39721
  this._reversed = !this._reversed;
39407
39722
  }
39408
- if (this._repeatDelayTime !== undefined) {
39409
- this._startTime = time + this._repeatDelayTime;
39410
- }
39411
- else {
39412
- this._startTime = time + this._delayTime;
39413
- }
39723
+ this._startTime += durationAndDelay * completeCount;
39414
39724
  if (this._onRepeatCallback) {
39415
39725
  this._onRepeatCallback(this._object);
39416
39726
  }
@@ -40260,7 +40570,6 @@
40260
40570
  const ascendingBisect = bisector(ascending);
40261
40571
  const bisectRight = ascendingBisect.right;
40262
40572
  bisector(number$1).center;
40263
- var bisect = bisectRight;
40264
40573
 
40265
40574
  function extent(values, valueof) {
40266
40575
  let min;
@@ -42596,33 +42905,58 @@
42596
42905
  .clipAngle(142);
42597
42906
  }
42598
42907
 
42599
- function _iterableToArrayLimit$5(arr, i) {
42600
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
42601
- if (null != _i) {
42602
- var _s,
42603
- _e,
42604
- _x,
42605
- _r,
42606
- _arr = [],
42607
- _n = !0,
42608
- _d = !1;
42908
+ function _callSuper$2(t, o, e) {
42909
+ return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf$3(t).constructor) : o.apply(t, e));
42910
+ }
42911
+ function _isNativeReflectConstruct$3() {
42912
+ try {
42913
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
42914
+ } catch (t) {}
42915
+ return (_isNativeReflectConstruct$3 = function () {
42916
+ return !!t;
42917
+ })();
42918
+ }
42919
+ function _iterableToArrayLimit$5(r, l) {
42920
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
42921
+ if (null != t) {
42922
+ var e,
42923
+ n,
42924
+ i,
42925
+ u,
42926
+ a = [],
42927
+ f = !0,
42928
+ o = !1;
42609
42929
  try {
42610
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
42611
- if (Object(_i) !== _i) return;
42612
- _n = !1;
42613
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
42614
- } catch (err) {
42615
- _d = !0, _e = err;
42930
+ if (i = (t = t.call(r)).next, 0 === l) {
42931
+ if (Object(t) !== t) return;
42932
+ f = !1;
42933
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
42934
+ } catch (r) {
42935
+ o = !0, n = r;
42616
42936
  } finally {
42617
42937
  try {
42618
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
42938
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
42619
42939
  } finally {
42620
- if (_d) throw _e;
42940
+ if (o) throw n;
42621
42941
  }
42622
42942
  }
42623
- return _arr;
42943
+ return a;
42624
42944
  }
42625
42945
  }
42946
+ function _toPrimitive$6(t, r) {
42947
+ if ("object" != typeof t || !t) return t;
42948
+ var e = t[Symbol.toPrimitive];
42949
+ if (void 0 !== e) {
42950
+ var i = e.call(t, r || "default");
42951
+ if ("object" != typeof i) return i;
42952
+ throw new TypeError("@@toPrimitive must return a primitive value.");
42953
+ }
42954
+ return ("string" === r ? String : Number)(t);
42955
+ }
42956
+ function _toPropertyKey$6(t) {
42957
+ var i = _toPrimitive$6(t, "string");
42958
+ return "symbol" == typeof i ? i : String(i);
42959
+ }
42626
42960
  function _classCallCheck$2(instance, Constructor) {
42627
42961
  if (!(instance instanceof Constructor)) {
42628
42962
  throw new TypeError("Cannot call a class as a function");
@@ -42674,17 +43008,6 @@
42674
43008
  };
42675
43009
  return _setPrototypeOf$3(o, p);
42676
43010
  }
42677
- function _isNativeReflectConstruct$3() {
42678
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
42679
- if (Reflect.construct.sham) return false;
42680
- if (typeof Proxy === "function") return true;
42681
- try {
42682
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
42683
- return true;
42684
- } catch (e) {
42685
- return false;
42686
- }
42687
- }
42688
43011
  function _assertThisInitialized$3(self) {
42689
43012
  if (self === void 0) {
42690
43013
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -42699,20 +43022,6 @@
42699
43022
  }
42700
43023
  return _assertThisInitialized$3(self);
42701
43024
  }
42702
- function _createSuper$2(Derived) {
42703
- var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
42704
- return function _createSuperInternal() {
42705
- var Super = _getPrototypeOf$3(Derived),
42706
- result;
42707
- if (hasNativeReflectConstruct) {
42708
- var NewTarget = _getPrototypeOf$3(this).constructor;
42709
- result = Reflect.construct(Super, arguments, NewTarget);
42710
- } else {
42711
- result = Super.apply(this, arguments);
42712
- }
42713
- return _possibleConstructorReturn$2(this, result);
42714
- };
42715
- }
42716
43025
  function _slicedToArray$5(arr, i) {
42717
43026
  return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest$5();
42718
43027
  }
@@ -42786,20 +43095,6 @@
42786
43095
  }
42787
43096
  };
42788
43097
  }
42789
- function _toPrimitive$6(input, hint) {
42790
- if (typeof input !== "object" || input === null) return input;
42791
- var prim = input[Symbol.toPrimitive];
42792
- if (prim !== undefined) {
42793
- var res = prim.call(input, hint || "default");
42794
- if (typeof res !== "object") return res;
42795
- throw new TypeError("@@toPrimitive must return a primitive value.");
42796
- }
42797
- return (hint === "string" ? String : Number)(input);
42798
- }
42799
- function _toPropertyKey$6(arg) {
42800
- var key = _toPrimitive$6(arg, "string");
42801
- return typeof key === "symbol" ? key : String(key);
42802
- }
42803
43098
 
42804
43099
  var interpolateLine = function interpolateLine() {
42805
43100
  var lineCoords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -42834,13 +43129,12 @@
42834
43129
  var setAttributeFn$3 = new THREE$l.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
42835
43130
  var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
42836
43131
  _inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
42837
- var _super = _createSuper$2(GeoJsonGeometry);
42838
43132
  function GeoJsonGeometry(geoJson) {
42839
43133
  var _this;
42840
43134
  var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
42841
43135
  var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
42842
43136
  _classCallCheck$2(this, GeoJsonGeometry);
42843
- _this = _super.call(this);
43137
+ _this = _callSuper$2(this, GeoJsonGeometry);
42844
43138
  _this.type = 'GeoJsonGeometry';
42845
43139
  _this.parameters = {
42846
43140
  geoJson: geoJson,
@@ -43335,13 +43629,6 @@
43335
43629
 
43336
43630
  const attribute = attributes[ i ];
43337
43631
 
43338
- if ( attribute.isInterleavedBufferAttribute ) {
43339
-
43340
- console.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported.' );
43341
- return null;
43342
-
43343
- }
43344
-
43345
43632
  if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
43346
43633
  if ( TypedArray !== attribute.array.constructor ) {
43347
43634
 
@@ -43374,22 +43661,41 @@
43374
43661
 
43375
43662
  }
43376
43663
 
43377
- arrayLength += attribute.array.length;
43664
+ arrayLength += attribute.count * itemSize;
43378
43665
 
43379
43666
  }
43380
43667
 
43381
43668
  const array = new TypedArray( arrayLength );
43669
+ const result = new BufferAttribute( array, itemSize, normalized );
43382
43670
  let offset = 0;
43383
43671
 
43384
43672
  for ( let i = 0; i < attributes.length; ++ i ) {
43385
43673
 
43386
- array.set( attributes[ i ].array, offset );
43674
+ const attribute = attributes[ i ];
43675
+ if ( attribute.isInterleavedBufferAttribute ) {
43676
+
43677
+ const tupleOffset = offset / itemSize;
43678
+ for ( let j = 0, l = attribute.count; j < l; j ++ ) {
43679
+
43680
+ for ( let c = 0; c < itemSize; c ++ ) {
43681
+
43682
+ const value = attribute.getComponent( j, c );
43683
+ result.setComponent( j + tupleOffset, c, value );
43684
+
43685
+ }
43686
+
43687
+ }
43387
43688
 
43388
- offset += attributes[ i ].array.length;
43689
+ } else {
43690
+
43691
+ array.set( attribute.array, offset );
43692
+
43693
+ }
43694
+
43695
+ offset += attribute.count * itemSize;
43389
43696
 
43390
43697
  }
43391
43698
 
43392
- const result = new BufferAttribute( array, itemSize, normalized );
43393
43699
  if ( gpuType !== undefined ) {
43394
43700
 
43395
43701
  result.gpuType = gpuType;
@@ -44369,20 +44675,6 @@
44369
44675
 
44370
44676
  }
44371
44677
 
44372
- function mergeBufferGeometries( geometries, useGroups = false ) {
44373
-
44374
- console.warn( 'THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries().' ); // @deprecated, r151
44375
- return mergeGeometries( geometries, useGroups );
44376
-
44377
- }
44378
-
44379
- function mergeBufferAttributes( attributes ) {
44380
-
44381
- console.warn( 'THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().' ); // @deprecated, r151
44382
- return mergeAttributes( attributes );
44383
-
44384
- }
44385
-
44386
44678
  var _bfg = /*#__PURE__*/Object.freeze({
44387
44679
  __proto__: null,
44388
44680
  computeMikkTSpaceTangents: computeMikkTSpaceTangents,
@@ -44393,8 +44685,6 @@
44393
44685
  estimateBytesUsed: estimateBytesUsed,
44394
44686
  interleaveAttributes: interleaveAttributes,
44395
44687
  mergeAttributes: mergeAttributes,
44396
- mergeBufferAttributes: mergeBufferAttributes,
44397
- mergeBufferGeometries: mergeBufferGeometries,
44398
44688
  mergeGeometries: mergeGeometries,
44399
44689
  mergeGroups: mergeGroups,
44400
44690
  mergeVertices: mergeVertices,
@@ -44633,8 +44923,8 @@
44633
44923
  : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
44634
44924
  : (m = reRgbaInteger.exec(format)) ? rgba$1(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
44635
44925
  : (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)
44636
- : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
44637
- : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
44926
+ : (m = reHslPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
44927
+ : (m = reHslaPercent.exec(format)) ? hsla$1(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
44638
44928
  : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
44639
44929
  : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
44640
44930
  : null;
@@ -44721,7 +45011,7 @@
44721
45011
  return (value < 16 ? "0" : "") + value.toString(16);
44722
45012
  }
44723
45013
 
44724
- function hsla(h, s, l, a) {
45014
+ function hsla$1(h, s, l, a) {
44725
45015
  if (a <= 0) h = s = l = NaN;
44726
45016
  else if (l <= 0 || l >= 1) h = s = NaN;
44727
45017
  else if (s <= 0) h = NaN;
@@ -44754,7 +45044,7 @@
44754
45044
  return new Hsl(h, s, l, o.opacity);
44755
45045
  }
44756
45046
 
44757
- function hsl(h, s, l, opacity) {
45047
+ function hsl$1(h, s, l, opacity) {
44758
45048
  return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
44759
45049
  }
44760
45050
 
@@ -44765,7 +45055,7 @@
44765
45055
  this.opacity = +opacity;
44766
45056
  }
44767
45057
 
44768
- define(Hsl, hsl, extend(Color, {
45058
+ define(Hsl, hsl$1, extend(Color, {
44769
45059
  brighter(k) {
44770
45060
  k = k == null ? brighter : Math.pow(brighter, k);
44771
45061
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
@@ -44917,7 +45207,7 @@
44917
45207
  return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
44918
45208
  },
44919
45209
  toHsl: function toHsl() {
44920
- var hsl = rgbToHsl(this._r, this._g, this._b);
45210
+ var hsl = rgbToHsl$1(this._r, this._g, this._b);
44921
45211
  return {
44922
45212
  h: hsl.h * 360,
44923
45213
  s: hsl.s,
@@ -44926,7 +45216,7 @@
44926
45216
  };
44927
45217
  },
44928
45218
  toHslString: function toHslString() {
44929
- var hsl = rgbToHsl(this._r, this._g, this._b);
45219
+ var hsl = rgbToHsl$1(this._r, this._g, this._b);
44930
45220
  var h = Math.round(hsl.h * 360),
44931
45221
  s = Math.round(hsl.s * 100),
44932
45222
  l = Math.round(hsl.l * 100);
@@ -45192,7 +45482,7 @@
45192
45482
  // Converts an RGB color value to HSL.
45193
45483
  // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
45194
45484
  // *Returns:* { h, s, l } in [0,1]
45195
- function rgbToHsl(r, g, b) {
45485
+ function rgbToHsl$1(r, g, b) {
45196
45486
  r = bound01(r, 255);
45197
45487
  g = bound01(g, 255);
45198
45488
  b = bound01(b, 255);
@@ -46738,7 +47028,7 @@
46738
47028
  }
46739
47029
 
46740
47030
  return function(x) {
46741
- var i = bisect(domain, x, 1, j) - 1;
47031
+ var i = bisectRight(domain, x, 1, j) - 1;
46742
47032
  return r[i](d[i](x));
46743
47033
  };
46744
47034
  }
@@ -47534,7 +47824,7 @@
47534
47824
  this._hullPrev = new Uint32Array(n); // edge to prev edge
47535
47825
  this._hullNext = new Uint32Array(n); // edge to next edge
47536
47826
  this._hullTri = new Uint32Array(n); // edge to adjacent triangle
47537
- this._hullHash = new Int32Array(this._hashSize).fill(-1); // angular edge hash
47827
+ this._hullHash = new Int32Array(this._hashSize); // angular edge hash
47538
47828
 
47539
47829
  // temporary arrays for sorting points
47540
47830
  this._ids = new Uint32Array(n);
@@ -47565,11 +47855,10 @@
47565
47855
  const cx = (minX + maxX) / 2;
47566
47856
  const cy = (minY + maxY) / 2;
47567
47857
 
47568
- let minDist = Infinity;
47569
47858
  let i0, i1, i2;
47570
47859
 
47571
47860
  // pick a seed point close to the center
47572
- for (let i = 0; i < n; i++) {
47861
+ for (let i = 0, minDist = Infinity; i < n; i++) {
47573
47862
  const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);
47574
47863
  if (d < minDist) {
47575
47864
  i0 = i;
@@ -47579,10 +47868,8 @@
47579
47868
  const i0x = coords[2 * i0];
47580
47869
  const i0y = coords[2 * i0 + 1];
47581
47870
 
47582
- minDist = Infinity;
47583
-
47584
47871
  // find the point closest to the seed
47585
- for (let i = 0; i < n; i++) {
47872
+ for (let i = 0, minDist = Infinity; i < n; i++) {
47586
47873
  if (i === i0) continue;
47587
47874
  const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);
47588
47875
  if (d < minDist && d > 0) {
@@ -47618,9 +47905,10 @@
47618
47905
  let j = 0;
47619
47906
  for (let i = 0, d0 = -Infinity; i < n; i++) {
47620
47907
  const id = this._ids[i];
47621
- if (this._dists[id] > d0) {
47908
+ const d = this._dists[id];
47909
+ if (d > d0) {
47622
47910
  hull[j++] = id;
47623
- d0 = this._dists[id];
47911
+ d0 = d;
47624
47912
  }
47625
47913
  }
47626
47914
  this.hull = hull.subarray(0, j);
@@ -49404,32 +49692,57 @@
49404
49692
  return data ? v(data) : v;
49405
49693
  }
49406
49694
 
49407
- function _iterableToArrayLimit$2(arr, i) {
49408
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
49409
- if (null != _i) {
49410
- var _s,
49411
- _e,
49412
- _x,
49413
- _r,
49414
- _arr = [],
49415
- _n = !0,
49416
- _d = !1;
49695
+ function _callSuper$1(t, o, e) {
49696
+ return o = _getPrototypeOf$2(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, e || [], _getPrototypeOf$2(t).constructor) : o.apply(t, e));
49697
+ }
49698
+ function _isNativeReflectConstruct$2() {
49699
+ try {
49700
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
49701
+ } catch (t) {}
49702
+ return (_isNativeReflectConstruct$2 = function () {
49703
+ return !!t;
49704
+ })();
49705
+ }
49706
+ function _iterableToArrayLimit$2(r, l) {
49707
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
49708
+ if (null != t) {
49709
+ var e,
49710
+ n,
49711
+ i,
49712
+ u,
49713
+ a = [],
49714
+ f = !0,
49715
+ o = !1;
49417
49716
  try {
49418
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
49419
- if (Object(_i) !== _i) return;
49420
- _n = !1;
49421
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
49422
- } catch (err) {
49423
- _d = !0, _e = err;
49717
+ if (i = (t = t.call(r)).next, 0 === l) {
49718
+ if (Object(t) !== t) return;
49719
+ f = !1;
49720
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
49721
+ } catch (r) {
49722
+ o = !0, n = r;
49424
49723
  } finally {
49425
49724
  try {
49426
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
49725
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
49427
49726
  } finally {
49428
- if (_d) throw _e;
49727
+ if (o) throw n;
49429
49728
  }
49430
49729
  }
49431
- return _arr;
49730
+ return a;
49731
+ }
49732
+ }
49733
+ function _toPrimitive$3(t, r) {
49734
+ if ("object" != typeof t || !t) return t;
49735
+ var e = t[Symbol.toPrimitive];
49736
+ if (void 0 !== e) {
49737
+ var i = e.call(t, r || "default");
49738
+ if ("object" != typeof i) return i;
49739
+ throw new TypeError("@@toPrimitive must return a primitive value.");
49432
49740
  }
49741
+ return ("string" === r ? String : Number)(t);
49742
+ }
49743
+ function _toPropertyKey$3(t) {
49744
+ var i = _toPrimitive$3(t, "string");
49745
+ return "symbol" == typeof i ? i : String(i);
49433
49746
  }
49434
49747
  function _classCallCheck$1(instance, Constructor) {
49435
49748
  if (!(instance instanceof Constructor)) {
@@ -49482,17 +49795,6 @@
49482
49795
  };
49483
49796
  return _setPrototypeOf$2(o, p);
49484
49797
  }
49485
- function _isNativeReflectConstruct$2() {
49486
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
49487
- if (Reflect.construct.sham) return false;
49488
- if (typeof Proxy === "function") return true;
49489
- try {
49490
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
49491
- return true;
49492
- } catch (e) {
49493
- return false;
49494
- }
49495
- }
49496
49798
  function _assertThisInitialized$2(self) {
49497
49799
  if (self === void 0) {
49498
49800
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -49507,20 +49809,6 @@
49507
49809
  }
49508
49810
  return _assertThisInitialized$2(self);
49509
49811
  }
49510
- function _createSuper$1(Derived) {
49511
- var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
49512
- return function _createSuperInternal() {
49513
- var Super = _getPrototypeOf$2(Derived),
49514
- result;
49515
- if (hasNativeReflectConstruct) {
49516
- var NewTarget = _getPrototypeOf$2(this).constructor;
49517
- result = Reflect.construct(Super, arguments, NewTarget);
49518
- } else {
49519
- result = Super.apply(this, arguments);
49520
- }
49521
- return _possibleConstructorReturn$1(this, result);
49522
- };
49523
- }
49524
49812
  function _slicedToArray$2(arr, i) {
49525
49813
  return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$2();
49526
49814
  }
@@ -49555,20 +49843,6 @@
49555
49843
  function _nonIterableRest$2() {
49556
49844
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
49557
49845
  }
49558
- function _toPrimitive$3(input, hint) {
49559
- if (typeof input !== "object" || input === null) return input;
49560
- var prim = input[Symbol.toPrimitive];
49561
- if (prim !== undefined) {
49562
- var res = prim.call(input, hint || "default");
49563
- if (typeof res !== "object") return res;
49564
- throw new TypeError("@@toPrimitive must return a primitive value.");
49565
- }
49566
- return (hint === "string" ? String : Number)(input);
49567
- }
49568
- function _toPropertyKey$3(arg) {
49569
- var key = _toPrimitive$3(arg, "string");
49570
- return typeof key === "symbol" ? key : String(key);
49571
- }
49572
49846
 
49573
49847
  function geoPolygonTriangulate(polygon) {
49574
49848
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
@@ -49655,13 +49929,12 @@
49655
49929
  return p[coordIdx];
49656
49930
  });
49657
49931
  });
49658
- if (!pointInside(triangleCentroid, boundariesGeojson, crossesPoleOrAntimeridian)) return "continue";
49932
+ if (!pointInside(triangleCentroid, boundariesGeojson, crossesPoleOrAntimeridian)) return 1; // continue
49659
49933
  }
49660
49934
  (_indices2 = indices).push.apply(_indices2, _toConsumableArray$3(inds));
49661
49935
  };
49662
49936
  for (var i = 0, len = delaunay.triangles.length; i < len; i += 3) {
49663
- var _ret = _loop(i);
49664
- if (_ret === "continue") continue;
49937
+ if (_loop(i)) continue;
49665
49938
  }
49666
49939
  }
49667
49940
 
@@ -49793,11 +50066,10 @@
49793
50066
  var setAttributeFn$2 = new THREE$k.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
49794
50067
  var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
49795
50068
  _inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
49796
- var _super = _createSuper$1(ConicPolygonBufferGeometry);
49797
50069
  function ConicPolygonBufferGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
49798
50070
  var _this;
49799
50071
  _classCallCheck$1(this, ConicPolygonBufferGeometry);
49800
- _this = _super.call(this);
50072
+ _this = _callSuper$1(this, ConicPolygonBufferGeometry);
49801
50073
  _this.type = 'ConicPolygonBufferGeometry';
49802
50074
  _this.parameters = {
49803
50075
  polygonGeoJson: polygonGeoJson,
@@ -65471,6 +65743,7 @@
65471
65743
  * resolution: <Vector2>, // to be set by renderer
65472
65744
  * }
65473
65745
  */
65746
+
65474
65747
  const THREE$1$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
65475
65748
  : {
65476
65749
  ShaderLib,
@@ -65502,7 +65775,6 @@
65502
65775
  value: 1
65503
65776
  } // todo FIX - maybe change to totalSize
65504
65777
  };
65505
-
65506
65778
  THREE$1$1.ShaderLib['line'] = {
65507
65779
  uniforms: THREE$1$1.UniformsUtils.merge([THREE$1$1.UniformsLib.common, THREE$1$1.UniformsLib.fog, THREE$1$1.UniformsLib.line]),
65508
65780
  vertexShader: /* glsl */
@@ -65873,7 +66145,6 @@
65873
66145
  fragmentShader: THREE$1$1.ShaderLib['line'].fragmentShader,
65874
66146
  clipping: true // required for clipping support
65875
66147
  });
65876
-
65877
66148
  Object.defineProperties(this, {
65878
66149
  color: {
65879
66150
  enumerable: true,
@@ -66454,6 +66725,24 @@
66454
66725
 
66455
66726
  }
66456
66727
 
66728
+ function _callSuper(t, o, e) {
66729
+ return o = _getPrototypeOf$1(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf$1(t).constructor) : o.apply(t, e));
66730
+ }
66731
+ function _construct$1(t, e, r) {
66732
+ if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments);
66733
+ var o = [null];
66734
+ o.push.apply(o, e);
66735
+ var p = new (t.bind.apply(t, o))();
66736
+ return r && _setPrototypeOf$1(p, r.prototype), p;
66737
+ }
66738
+ function _isNativeReflectConstruct$1() {
66739
+ try {
66740
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
66741
+ } catch (t) {}
66742
+ return (_isNativeReflectConstruct$1 = function () {
66743
+ return !!t;
66744
+ })();
66745
+ }
66457
66746
  function _iterableToArrayLimit$1(r, l) {
66458
66747
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
66459
66748
  if (null != t) {
@@ -66502,6 +66791,20 @@
66502
66791
  }
66503
66792
  return e;
66504
66793
  }
66794
+ function _toPrimitive$2(t, r) {
66795
+ if ("object" != typeof t || !t) return t;
66796
+ var e = t[Symbol.toPrimitive];
66797
+ if (void 0 !== e) {
66798
+ var i = e.call(t, r || "default");
66799
+ if ("object" != typeof i) return i;
66800
+ throw new TypeError("@@toPrimitive must return a primitive value.");
66801
+ }
66802
+ return ("string" === r ? String : Number)(t);
66803
+ }
66804
+ function _toPropertyKey$2(t) {
66805
+ var i = _toPrimitive$2(t, "string");
66806
+ return "symbol" == typeof i ? i : String(i);
66807
+ }
66505
66808
  function _classCallCheck(instance, Constructor) {
66506
66809
  if (!(instance instanceof Constructor)) {
66507
66810
  throw new TypeError("Cannot call a class as a function");
@@ -66567,32 +66870,6 @@
66567
66870
  };
66568
66871
  return _setPrototypeOf$1(o, p);
66569
66872
  }
66570
- function _isNativeReflectConstruct$1() {
66571
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
66572
- if (Reflect.construct.sham) return false;
66573
- if (typeof Proxy === "function") return true;
66574
- try {
66575
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
66576
- return true;
66577
- } catch (e) {
66578
- return false;
66579
- }
66580
- }
66581
- function _construct$1(Parent, args, Class) {
66582
- if (_isNativeReflectConstruct$1()) {
66583
- _construct$1 = Reflect.construct.bind();
66584
- } else {
66585
- _construct$1 = function _construct(Parent, args, Class) {
66586
- var a = [null];
66587
- a.push.apply(a, args);
66588
- var Constructor = Function.bind.apply(Parent, a);
66589
- var instance = new Constructor();
66590
- if (Class) _setPrototypeOf$1(instance, Class.prototype);
66591
- return instance;
66592
- };
66593
- }
66594
- return _construct$1.apply(null, arguments);
66595
- }
66596
66873
  function _objectWithoutPropertiesLoose$1(source, excluded) {
66597
66874
  if (source == null) return {};
66598
66875
  var target = {};
@@ -66634,20 +66911,6 @@
66634
66911
  }
66635
66912
  return _assertThisInitialized$1(self);
66636
66913
  }
66637
- function _createSuper(Derived) {
66638
- var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
66639
- return function _createSuperInternal() {
66640
- var Super = _getPrototypeOf$1(Derived),
66641
- result;
66642
- if (hasNativeReflectConstruct) {
66643
- var NewTarget = _getPrototypeOf$1(this).constructor;
66644
- result = Reflect.construct(Super, arguments, NewTarget);
66645
- } else {
66646
- result = Super.apply(this, arguments);
66647
- }
66648
- return _possibleConstructorReturn(this, result);
66649
- };
66650
- }
66651
66914
  function _slicedToArray$1(arr, i) {
66652
66915
  return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$1();
66653
66916
  }
@@ -66682,20 +66945,6 @@
66682
66945
  function _nonIterableRest$1() {
66683
66946
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
66684
66947
  }
66685
- function _toPrimitive$2(input, hint) {
66686
- if (typeof input !== "object" || input === null) return input;
66687
- var prim = input[Symbol.toPrimitive];
66688
- if (prim !== undefined) {
66689
- var res = prim.call(input, hint || "default");
66690
- if (typeof res !== "object") return res;
66691
- throw new TypeError("@@toPrimitive must return a primitive value.");
66692
- }
66693
- return (hint === "string" ? String : Number)(input);
66694
- }
66695
- function _toPropertyKey$2(arg) {
66696
- var key = _toPrimitive$2(arg, "string");
66697
- return typeof key === "symbol" ? key : String(key);
66698
- }
66699
66948
  function _classPrivateFieldGet(receiver, privateMap) {
66700
66949
  var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
66701
66950
  return _classApplyDescriptorGet(receiver, descriptor);
@@ -67280,7 +67529,6 @@
67280
67529
  obj.scale.x = obj.scale.y = Math.min(30, r) * pxPerDeg;
67281
67530
  obj.scale.z = Math.max(alt * GLOBE_RADIUS, 0.1); // avoid non-invertible matrix
67282
67531
  };
67283
-
67284
67532
  var targetD = {
67285
67533
  alt: +altitudeAccessor(d),
67286
67534
  r: +radiusAccessor(d),
@@ -67357,7 +67605,6 @@
67357
67605
  value: 0
67358
67606
  } // used for animating the dash
67359
67607
  },
67360
-
67361
67608
  vertexShader: "\n uniform float dashTranslate; \n\n attribute vec4 vertexColor;\n varying vec4 vColor;\n \n attribute float vertexRelDistance;\n varying float vRelDistance;\n\n void main() {\n // pass through colors and distances\n vColor = vertexColor;\n vRelDistance = vertexRelDistance + dashTranslate;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",
67362
67609
  fragmentShader: "\n uniform float dashOffset; \n uniform float dashSize;\n uniform float gapSize; \n \n varying vec4 vColor;\n varying float vRelDistance;\n \n void main() {\n // ignore pixels in the gap\n if (vRelDistance < dashOffset) discard;\n if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;\n \n // set px color: [r, g, b, a], interpolated between vertices \n gl_FragColor = vColor; \n }\n "
67363
67610
  };
@@ -67421,7 +67668,6 @@
67421
67668
  triggerUpdate: false
67422
67669
  } // ms
67423
67670
  },
67424
-
67425
67671
  methods: {
67426
67672
  pauseAnimation: function pauseAnimation(state) {
67427
67673
  var _state$ticker;
@@ -67526,7 +67772,6 @@
67526
67772
  // num vertices per segment
67527
67773
  true // run from end to start, to animate in the correct direction
67528
67774
  );
67529
-
67530
67775
  obj.geometry.setAttribute('vertexColor', vertexColorArray);
67531
67776
  obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
67532
67777
  var applyUpdate = function applyUpdate(td) {
@@ -67877,7 +68122,6 @@
67877
68122
  alt = _obj$__currentTargetD.alt;
67878
68123
  obj.scale.x = obj.scale.y = obj.scale.z = 1 + alt; // scale according to altitude
67879
68124
  };
67880
-
67881
68125
  var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
67882
68126
  alt: -1e-3
67883
68127
  });
@@ -68413,7 +68657,6 @@
68413
68657
  conicObj.scale.x = conicObj.scale.y = conicObj.scale.z = 1 + alt;
68414
68658
  addStroke && (strokeObj.scale.x = strokeObj.scale.y = strokeObj.scale.z = 1 + alt + 1e-4); // stroke slightly above the conic mesh
68415
68659
  };
68416
-
68417
68660
  var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
68418
68661
  alt: -1e-3
68419
68662
  });
@@ -68711,7 +68954,6 @@
68711
68954
  value: 0
68712
68955
  } // used for animating the dash
68713
68956
  },
68714
-
68715
68957
  vertexShader: "\n uniform float dashTranslate;\n\n attribute vec4 vertexColor;\n varying vec4 vColor;\n\n attribute float vertexRelDistance;\n varying float vRelDistance;\n\n void main() {\n // pass through colors and distances\n vColor = vertexColor;\n vRelDistance = vertexRelDistance + dashTranslate;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",
68716
68958
  fragmentShader: "\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n varying vec4 vColor;\n varying float vRelDistance;\n\n void main() {\n // ignore pixels in the gap\n if (vRelDistance < dashOffset) discard;\n if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;\n\n // set px color: [r, g, b, a], interpolated between vertices\n gl_FragColor = vColor;\n }\n "
68717
68959
  };
@@ -68771,7 +69013,6 @@
68771
69013
  // ms
68772
69014
  rendererSize: {} // necessary to set correct fatline proportions
68773
69015
  },
68774
-
68775
69016
  methods: {
68776
69017
  pauseAnimation: function pauseAnimation(state) {
68777
69018
  var _state$ticker;
@@ -68845,7 +69086,6 @@
68845
69086
  emptyObject(group);
68846
69087
  var _obj = useFatLine ? new Line2(new LineGeometry(), new LineMaterial()) : new THREE$7.Line(new THREE$7.BufferGeometry(), sharedShaderMaterial.clone() // Separate material instance per object to have dedicated uniforms (but shared shaders)
68847
69088
  );
68848
-
68849
69089
  group.add(_obj);
68850
69090
  }
68851
69091
  var obj = group.children[0];
@@ -68882,7 +69122,6 @@
68882
69122
  // num vertices per segment
68883
69123
  true // run from end to start, to animate in the correct direction
68884
69124
  );
68885
-
68886
69125
  obj.geometry.setAttribute('vertexColor', vertexColorArray);
68887
69126
  obj.geometry.setAttribute('vertexRelDistance', vertexRelDistanceArray);
68888
69127
  } else {
@@ -69429,13 +69668,12 @@
69429
69668
  };
69430
69669
  var CircleLineGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
69431
69670
  _inherits(CircleLineGeometry, _THREE$BufferGeometry);
69432
- var _super = _createSuper(CircleLineGeometry);
69433
69671
  function CircleLineGeometry() {
69434
69672
  var _this;
69435
69673
  var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
69436
69674
  var segmentCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 32;
69437
69675
  _classCallCheck(this, CircleLineGeometry);
69438
- _this = _super.call(this);
69676
+ _this = _callSuper(this, CircleLineGeometry);
69439
69677
  _this.type = 'CircleLineGeometry';
69440
69678
  _this.parameters = {
69441
69679
  radius: radius,
@@ -69506,7 +69744,6 @@
69506
69744
  triggerUpdate: false
69507
69745
  } // ms
69508
69746
  },
69509
-
69510
69747
  methods: {
69511
69748
  pauseAnimation: function pauseAnimation(state) {
69512
69749
  var _state$ticker;
@@ -69855,7 +70092,6 @@
69855
70092
  }
69856
70093
  obj.__globeObjType = 'custom'; // Add object type
69857
70094
  }
69858
-
69859
70095
  return obj;
69860
70096
  },
69861
70097
  updateObj: function updateObj(obj, d) {
@@ -70022,7 +70258,6 @@
70022
70258
  state.animationFrameRequestId = requestAnimationFrame(this._animationCycle);
70023
70259
  update(); // run tween updates
70024
70260
  },
70025
-
70026
70261
  _destructor: function _destructor(state) {
70027
70262
  this.pauseAnimation();
70028
70263
  state.destructableLayers.forEach(function (l) {
@@ -70115,14 +70350,13 @@
70115
70350
  var initKapsuleWithSelf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
70116
70351
  var FromKapsule = /*#__PURE__*/function (_baseClass) {
70117
70352
  _inherits(FromKapsule, _baseClass);
70118
- var _super = _createSuper(FromKapsule);
70119
70353
  function FromKapsule() {
70120
70354
  var _this;
70121
70355
  _classCallCheck(this, FromKapsule);
70122
70356
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
70123
70357
  args[_key] = arguments[_key];
70124
70358
  }
70125
- _this = _super.call.apply(_super, [this].concat(args));
70359
+ _this = _callSuper(this, FromKapsule, [].concat(args));
70126
70360
  _this.__kapsuleInstance = kapsule.apply(void 0, args).apply(void 0, [].concat(_toConsumableArray$2(initKapsuleWithSelf ? [_assertThisInitialized$1(_this)] : []), args));
70127
70361
  return _this;
70128
70362
  }
@@ -71325,9 +71559,14 @@
71325
71559
 
71326
71560
  } else if ( scope.object.isOrthographicCamera ) {
71327
71561
 
71328
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
71329
- scope.object.updateProjectionMatrix();
71330
- zoomChanged = true;
71562
+ zoomChanged = scale !== 1;
71563
+
71564
+ if ( zoomChanged ) {
71565
+
71566
+ scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
71567
+ scope.object.updateProjectionMatrix();
71568
+
71569
+ }
71331
71570
 
71332
71571
  }
71333
71572
 
@@ -71429,6 +71668,8 @@
71429
71668
  const pointers = [];
71430
71669
  const pointerPositions = {};
71431
71670
 
71671
+ let controlActive = false;
71672
+
71432
71673
  function getAutoRotationAngle( deltaTime ) {
71433
71674
 
71434
71675
  if ( deltaTime !== null ) {
@@ -71443,9 +71684,10 @@
71443
71684
 
71444
71685
  }
71445
71686
 
71446
- function getZoomScale() {
71687
+ function getZoomScale( delta ) {
71447
71688
 
71448
- return Math.pow( 0.95, scope.zoomSpeed );
71689
+ const normalizedDelta = Math.abs( delta * 0.01 );
71690
+ return Math.pow( 0.95, scope.zoomSpeed * normalizedDelta );
71449
71691
 
71450
71692
  }
71451
71693
 
@@ -71572,7 +71814,7 @@
71572
71814
 
71573
71815
  }
71574
71816
 
71575
- function updateMouseParameters( event ) {
71817
+ function updateZoomParameters( x, y ) {
71576
71818
 
71577
71819
  if ( ! scope.zoomToCursor ) {
71578
71820
 
@@ -71583,13 +71825,13 @@
71583
71825
  performCursorZoom = true;
71584
71826
 
71585
71827
  const rect = scope.domElement.getBoundingClientRect();
71586
- const x = event.clientX - rect.left;
71587
- const y = event.clientY - rect.top;
71828
+ const dx = x - rect.left;
71829
+ const dy = y - rect.top;
71588
71830
  const w = rect.width;
71589
71831
  const h = rect.height;
71590
71832
 
71591
- mouse.x = ( x / w ) * 2 - 1;
71592
- mouse.y = - ( y / h ) * 2 + 1;
71833
+ mouse.x = ( dx / w ) * 2 - 1;
71834
+ mouse.y = - ( dy / h ) * 2 + 1;
71593
71835
 
71594
71836
  dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize();
71595
71837
 
@@ -71613,7 +71855,7 @@
71613
71855
 
71614
71856
  function handleMouseDownDolly( event ) {
71615
71857
 
71616
- updateMouseParameters( event );
71858
+ updateZoomParameters( event.clientX, event.clientX );
71617
71859
  dollyStart.set( event.clientX, event.clientY );
71618
71860
 
71619
71861
  }
@@ -71650,11 +71892,11 @@
71650
71892
 
71651
71893
  if ( dollyDelta.y > 0 ) {
71652
71894
 
71653
- dollyOut( getZoomScale() );
71895
+ dollyOut( getZoomScale( dollyDelta.y ) );
71654
71896
 
71655
71897
  } else if ( dollyDelta.y < 0 ) {
71656
71898
 
71657
- dollyIn( getZoomScale() );
71899
+ dollyIn( getZoomScale( dollyDelta.y ) );
71658
71900
 
71659
71901
  }
71660
71902
 
@@ -71680,15 +71922,15 @@
71680
71922
 
71681
71923
  function handleMouseWheel( event ) {
71682
71924
 
71683
- updateMouseParameters( event );
71925
+ updateZoomParameters( event.clientX, event.clientY );
71684
71926
 
71685
71927
  if ( event.deltaY < 0 ) {
71686
71928
 
71687
- dollyIn( getZoomScale() );
71929
+ dollyIn( getZoomScale( event.deltaY ) );
71688
71930
 
71689
71931
  } else if ( event.deltaY > 0 ) {
71690
71932
 
71691
- dollyOut( getZoomScale() );
71933
+ dollyOut( getZoomScale( event.deltaY ) );
71692
71934
 
71693
71935
  }
71694
71936
 
@@ -71776,16 +72018,18 @@
71776
72018
 
71777
72019
  }
71778
72020
 
71779
- function handleTouchStartRotate() {
72021
+ function handleTouchStartRotate( event ) {
71780
72022
 
71781
72023
  if ( pointers.length === 1 ) {
71782
72024
 
71783
- rotateStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
72025
+ rotateStart.set( event.pageX, event.pageY );
71784
72026
 
71785
72027
  } else {
71786
72028
 
71787
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
71788
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
72029
+ const position = getSecondPointerPosition( event );
72030
+
72031
+ const x = 0.5 * ( event.pageX + position.x );
72032
+ const y = 0.5 * ( event.pageY + position.y );
71789
72033
 
71790
72034
  rotateStart.set( x, y );
71791
72035
 
@@ -71793,16 +72037,18 @@
71793
72037
 
71794
72038
  }
71795
72039
 
71796
- function handleTouchStartPan() {
72040
+ function handleTouchStartPan( event ) {
71797
72041
 
71798
72042
  if ( pointers.length === 1 ) {
71799
72043
 
71800
- panStart.set( pointers[ 0 ].pageX, pointers[ 0 ].pageY );
72044
+ panStart.set( event.pageX, event.pageY );
71801
72045
 
71802
72046
  } else {
71803
72047
 
71804
- const x = 0.5 * ( pointers[ 0 ].pageX + pointers[ 1 ].pageX );
71805
- const y = 0.5 * ( pointers[ 0 ].pageY + pointers[ 1 ].pageY );
72048
+ const position = getSecondPointerPosition( event );
72049
+
72050
+ const x = 0.5 * ( event.pageX + position.x );
72051
+ const y = 0.5 * ( event.pageY + position.y );
71806
72052
 
71807
72053
  panStart.set( x, y );
71808
72054
 
@@ -71810,10 +72056,12 @@
71810
72056
 
71811
72057
  }
71812
72058
 
71813
- function handleTouchStartDolly() {
72059
+ function handleTouchStartDolly( event ) {
71814
72060
 
71815
- const dx = pointers[ 0 ].pageX - pointers[ 1 ].pageX;
71816
- const dy = pointers[ 0 ].pageY - pointers[ 1 ].pageY;
72061
+ const position = getSecondPointerPosition( event );
72062
+
72063
+ const dx = event.pageX - position.x;
72064
+ const dy = event.pageY - position.y;
71817
72065
 
71818
72066
  const distance = Math.sqrt( dx * dx + dy * dy );
71819
72067
 
@@ -71821,19 +72069,19 @@
71821
72069
 
71822
72070
  }
71823
72071
 
71824
- function handleTouchStartDollyPan() {
72072
+ function handleTouchStartDollyPan( event ) {
71825
72073
 
71826
- if ( scope.enableZoom ) handleTouchStartDolly();
72074
+ if ( scope.enableZoom ) handleTouchStartDolly( event );
71827
72075
 
71828
- if ( scope.enablePan ) handleTouchStartPan();
72076
+ if ( scope.enablePan ) handleTouchStartPan( event );
71829
72077
 
71830
72078
  }
71831
72079
 
71832
- function handleTouchStartDollyRotate() {
72080
+ function handleTouchStartDollyRotate( event ) {
71833
72081
 
71834
- if ( scope.enableZoom ) handleTouchStartDolly();
72082
+ if ( scope.enableZoom ) handleTouchStartDolly( event );
71835
72083
 
71836
- if ( scope.enableRotate ) handleTouchStartRotate();
72084
+ if ( scope.enableRotate ) handleTouchStartRotate( event );
71837
72085
 
71838
72086
  }
71839
72087
 
@@ -71908,6 +72156,11 @@
71908
72156
 
71909
72157
  dollyStart.copy( dollyEnd );
71910
72158
 
72159
+ const centerX = ( event.pageX + position.x ) * 0.5;
72160
+ const centerY = ( event.pageY + position.y ) * 0.5;
72161
+
72162
+ updateZoomParameters( centerX, centerY );
72163
+
71911
72164
  }
71912
72165
 
71913
72166
  function handleTouchMoveDollyPan( event ) {
@@ -71979,18 +72232,32 @@
71979
72232
 
71980
72233
  removePointer( event );
71981
72234
 
71982
- if ( pointers.length === 0 ) {
72235
+ switch ( pointers.length ) {
71983
72236
 
71984
- scope.domElement.releasePointerCapture( event.pointerId );
72237
+ case 0:
71985
72238
 
71986
- scope.domElement.removeEventListener( 'pointermove', onPointerMove );
71987
- scope.domElement.removeEventListener( 'pointerup', onPointerUp );
72239
+ scope.domElement.releasePointerCapture( event.pointerId );
71988
72240
 
71989
- }
72241
+ scope.domElement.removeEventListener( 'pointermove', onPointerMove );
72242
+ scope.domElement.removeEventListener( 'pointerup', onPointerUp );
71990
72243
 
71991
- scope.dispatchEvent( _endEvent );
72244
+ scope.dispatchEvent( _endEvent );
71992
72245
 
71993
- state = STATE.NONE;
72246
+ state = STATE.NONE;
72247
+
72248
+ break;
72249
+
72250
+ case 1:
72251
+
72252
+ const pointerId = pointers[ 0 ];
72253
+ const position = pointerPositions[ pointerId ];
72254
+
72255
+ // minimal placeholder event - allows state correction on pointer-up
72256
+ onTouchStart( { pointerId: pointerId, pageX: position.x, pageY: position.y } );
72257
+
72258
+ break;
72259
+
72260
+ }
71994
72261
 
71995
72262
  }
71996
72263
 
@@ -72131,12 +72398,76 @@
72131
72398
 
72132
72399
  scope.dispatchEvent( _startEvent );
72133
72400
 
72134
- handleMouseWheel( event );
72401
+ handleMouseWheel( customWheelEvent( event ) );
72135
72402
 
72136
72403
  scope.dispatchEvent( _endEvent );
72137
72404
 
72138
72405
  }
72139
72406
 
72407
+ function customWheelEvent( event ) {
72408
+
72409
+ const mode = event.deltaMode;
72410
+
72411
+ // minimal wheel event altered to meet delta-zoom demand
72412
+ const newEvent = {
72413
+ clientX: event.clientX,
72414
+ clientY: event.clientY,
72415
+ deltaY: event.deltaY,
72416
+ };
72417
+
72418
+ switch ( mode ) {
72419
+
72420
+ case 1: // LINE_MODE
72421
+ newEvent.deltaY *= 16;
72422
+ break;
72423
+
72424
+ case 2: // PAGE_MODE
72425
+ newEvent.deltaY *= 100;
72426
+ break;
72427
+
72428
+ }
72429
+
72430
+ // detect if event was triggered by pinching
72431
+ if ( event.ctrlKey && ! controlActive ) {
72432
+
72433
+ newEvent.deltaY *= 10;
72434
+
72435
+ }
72436
+
72437
+ return newEvent;
72438
+
72439
+ }
72440
+
72441
+ function interceptControlDown( event ) {
72442
+
72443
+ if ( event.key === 'Control' ) {
72444
+
72445
+ controlActive = true;
72446
+
72447
+
72448
+ const document = scope.domElement.getRootNode(); // offscreen canvas compatibility
72449
+
72450
+ document.addEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } );
72451
+
72452
+ }
72453
+
72454
+ }
72455
+
72456
+ function interceptControlUp( event ) {
72457
+
72458
+ if ( event.key === 'Control' ) {
72459
+
72460
+ controlActive = false;
72461
+
72462
+
72463
+ const document = scope.domElement.getRootNode(); // offscreen canvas compatibility
72464
+
72465
+ document.removeEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } );
72466
+
72467
+ }
72468
+
72469
+ }
72470
+
72140
72471
  function onKeyDown( event ) {
72141
72472
 
72142
72473
  if ( scope.enabled === false || scope.enablePan === false ) return;
@@ -72159,7 +72490,7 @@
72159
72490
 
72160
72491
  if ( scope.enableRotate === false ) return;
72161
72492
 
72162
- handleTouchStartRotate();
72493
+ handleTouchStartRotate( event );
72163
72494
 
72164
72495
  state = STATE.TOUCH_ROTATE;
72165
72496
 
@@ -72169,7 +72500,7 @@
72169
72500
 
72170
72501
  if ( scope.enablePan === false ) return;
72171
72502
 
72172
- handleTouchStartPan();
72503
+ handleTouchStartPan( event );
72173
72504
 
72174
72505
  state = STATE.TOUCH_PAN;
72175
72506
 
@@ -72191,7 +72522,7 @@
72191
72522
 
72192
72523
  if ( scope.enableZoom === false && scope.enablePan === false ) return;
72193
72524
 
72194
- handleTouchStartDollyPan();
72525
+ handleTouchStartDollyPan( event );
72195
72526
 
72196
72527
  state = STATE.TOUCH_DOLLY_PAN;
72197
72528
 
@@ -72201,7 +72532,7 @@
72201
72532
 
72202
72533
  if ( scope.enableZoom === false && scope.enableRotate === false ) return;
72203
72534
 
72204
- handleTouchStartDollyRotate();
72535
+ handleTouchStartDollyRotate( event );
72205
72536
 
72206
72537
  state = STATE.TOUCH_DOLLY_ROTATE;
72207
72538
 
@@ -72293,7 +72624,7 @@
72293
72624
 
72294
72625
  function addPointer( event ) {
72295
72626
 
72296
- pointers.push( event );
72627
+ pointers.push( event.pointerId );
72297
72628
 
72298
72629
  }
72299
72630
 
@@ -72303,7 +72634,7 @@
72303
72634
 
72304
72635
  for ( let i = 0; i < pointers.length; i ++ ) {
72305
72636
 
72306
- if ( pointers[ i ].pointerId == event.pointerId ) {
72637
+ if ( pointers[ i ] == event.pointerId ) {
72307
72638
 
72308
72639
  pointers.splice( i, 1 );
72309
72640
  return;
@@ -72331,9 +72662,9 @@
72331
72662
 
72332
72663
  function getSecondPointerPosition( event ) {
72333
72664
 
72334
- const pointer = ( event.pointerId === pointers[ 0 ].pointerId ) ? pointers[ 1 ] : pointers[ 0 ];
72665
+ const pointerId = ( event.pointerId === pointers[ 0 ] ) ? pointers[ 1 ] : pointers[ 0 ];
72335
72666
 
72336
- return pointerPositions[ pointer.pointerId ];
72667
+ return pointerPositions[ pointerId ];
72337
72668
 
72338
72669
  }
72339
72670
 
@@ -72345,6 +72676,10 @@
72345
72676
  scope.domElement.addEventListener( 'pointercancel', onPointerUp );
72346
72677
  scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );
72347
72678
 
72679
+ const document = scope.domElement.getRootNode(); // offscreen canvas compatibility
72680
+
72681
+ document.addEventListener( 'keydown', interceptControlDown, { passive: true, capture: true } );
72682
+
72348
72683
  // force an update at start
72349
72684
 
72350
72685
  this.update();
@@ -73337,31 +73672,20 @@
73337
73672
  }
73338
73673
 
73339
73674
  function _isNativeReflectConstruct() {
73340
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
73341
- if (Reflect.construct.sham) return false;
73342
- if (typeof Proxy === "function") return true;
73343
73675
  try {
73344
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
73345
- return true;
73346
- } catch (e) {
73347
- return false;
73348
- }
73676
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
73677
+ } catch (t) {}
73678
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
73679
+ return !!t;
73680
+ })();
73349
73681
  }
73350
73682
 
73351
- function _construct(Parent, args, Class) {
73352
- if (_isNativeReflectConstruct()) {
73353
- _construct = Reflect.construct.bind();
73354
- } else {
73355
- _construct = function _construct(Parent, args, Class) {
73356
- var a = [null];
73357
- a.push.apply(a, args);
73358
- var Constructor = Function.bind.apply(Parent, a);
73359
- var instance = new Constructor();
73360
- if (Class) _setPrototypeOf(instance, Class.prototype);
73361
- return instance;
73362
- };
73363
- }
73364
- return _construct.apply(null, arguments);
73683
+ function _construct(t, e, r) {
73684
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
73685
+ var o = [null];
73686
+ o.push.apply(o, e);
73687
+ var p = new (t.bind.apply(t, o))();
73688
+ return r && _setPrototypeOf(p, r.prototype), p;
73365
73689
  }
73366
73690
 
73367
73691
  function _wrapNativeSuper(Class) {
@@ -73392,7 +73716,6 @@
73392
73716
  }
73393
73717
 
73394
73718
  // based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
73395
-
73396
73719
  /**
73397
73720
  * Parse errors.md and turn it into a simple hash of code: message
73398
73721
  * @private
@@ -73477,82 +73800,69 @@
73477
73800
  "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
73478
73801
  "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
73479
73802
  };
73803
+
73480
73804
  /**
73481
73805
  * super basic version of sprintf
73482
73806
  * @private
73483
73807
  */
73484
-
73485
73808
  function format() {
73486
73809
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
73487
73810
  args[_key] = arguments[_key];
73488
73811
  }
73489
-
73490
73812
  var a = args[0];
73491
73813
  var b = [];
73492
73814
  var c;
73493
-
73494
73815
  for (c = 1; c < args.length; c += 1) {
73495
73816
  b.push(args[c]);
73496
73817
  }
73497
-
73498
73818
  b.forEach(function (d) {
73499
73819
  a = a.replace(/%[a-z]/, d);
73500
73820
  });
73501
73821
  return a;
73502
73822
  }
73823
+
73503
73824
  /**
73504
73825
  * Create an error file out of errors.md for development and a simple web link to the full errors
73505
73826
  * in production mode.
73506
73827
  * @private
73507
73828
  */
73508
-
73509
-
73510
73829
  var PolishedError = /*#__PURE__*/function (_Error) {
73511
73830
  _inheritsLoose(PolishedError, _Error);
73512
-
73513
73831
  function PolishedError(code) {
73514
73832
  var _this;
73515
-
73516
73833
  {
73517
73834
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
73518
73835
  args[_key2 - 1] = arguments[_key2];
73519
73836
  }
73520
-
73521
73837
  _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
73522
73838
  }
73523
-
73524
73839
  return _assertThisInitialized(_this);
73525
73840
  }
73526
-
73527
73841
  return PolishedError;
73528
73842
  }( /*#__PURE__*/_wrapNativeSuper(Error));
73529
73843
 
73530
73844
  function colorToInt(color) {
73531
73845
  return Math.round(color * 255);
73532
73846
  }
73533
-
73534
73847
  function convertToInt(red, green, blue) {
73535
73848
  return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
73536
73849
  }
73537
-
73538
73850
  function hslToRgb(hue, saturation, lightness, convert) {
73539
73851
  if (convert === void 0) {
73540
73852
  convert = convertToInt;
73541
73853
  }
73542
-
73543
73854
  if (saturation === 0) {
73544
73855
  // achromatic
73545
73856
  return convert(lightness, lightness, lightness);
73546
- } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
73547
-
73857
+ }
73548
73858
 
73859
+ // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
73549
73860
  var huePrime = (hue % 360 + 360) % 360 / 60;
73550
73861
  var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
73551
73862
  var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
73552
73863
  var red = 0;
73553
73864
  var green = 0;
73554
73865
  var blue = 0;
73555
-
73556
73866
  if (huePrime >= 0 && huePrime < 1) {
73557
73867
  red = chroma;
73558
73868
  green = secondComponent;
@@ -73572,7 +73882,6 @@
73572
73882
  red = chroma;
73573
73883
  blue = secondComponent;
73574
73884
  }
73575
-
73576
73885
  var lightnessModification = lightness - chroma / 2;
73577
73886
  var finalRed = red + lightnessModification;
73578
73887
  var finalGreen = green + lightnessModification;
@@ -73730,11 +74039,11 @@
73730
74039
  yellow: 'ff0',
73731
74040
  yellowgreen: '9acd32'
73732
74041
  };
74042
+
73733
74043
  /**
73734
74044
  * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
73735
74045
  * @private
73736
74046
  */
73737
-
73738
74047
  function nameToHex(color) {
73739
74048
  if (typeof color !== 'string') return color;
73740
74049
  var normalizedColorName = color.toLowerCase();
@@ -73749,6 +74058,7 @@
73749
74058
  var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
73750
74059
  var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
73751
74060
  var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
74061
+
73752
74062
  /**
73753
74063
  * Returns an RgbColor or RgbaColor object. This utility function is only useful
73754
74064
  * if want to extract a color component. With the color util `toColorString` you
@@ -73760,14 +74070,11 @@
73760
74070
  * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
73761
74071
  * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
73762
74072
  */
73763
-
73764
74073
  function parseToRgb(color) {
73765
74074
  if (typeof color !== 'string') {
73766
74075
  throw new PolishedError(3);
73767
74076
  }
73768
-
73769
74077
  var normalizedColor = nameToHex(color);
73770
-
73771
74078
  if (normalizedColor.match(hexRegex)) {
73772
74079
  return {
73773
74080
  red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
@@ -73775,7 +74082,6 @@
73775
74082
  blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
73776
74083
  };
73777
74084
  }
73778
-
73779
74085
  if (normalizedColor.match(hexRgbaRegex)) {
73780
74086
  var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
73781
74087
  return {
@@ -73785,7 +74091,6 @@
73785
74091
  alpha: alpha
73786
74092
  };
73787
74093
  }
73788
-
73789
74094
  if (normalizedColor.match(reducedHexRegex)) {
73790
74095
  return {
73791
74096
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
@@ -73793,10 +74098,8 @@
73793
74098
  blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
73794
74099
  };
73795
74100
  }
73796
-
73797
74101
  if (normalizedColor.match(reducedRgbaHexRegex)) {
73798
74102
  var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
73799
-
73800
74103
  return {
73801
74104
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
73802
74105
  green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
@@ -73804,9 +74107,7 @@
73804
74107
  alpha: _alpha
73805
74108
  };
73806
74109
  }
73807
-
73808
74110
  var rgbMatched = rgbRegex.exec(normalizedColor);
73809
-
73810
74111
  if (rgbMatched) {
73811
74112
  return {
73812
74113
  red: parseInt("" + rgbMatched[1], 10),
@@ -73814,9 +74115,7 @@
73814
74115
  blue: parseInt("" + rgbMatched[3], 10)
73815
74116
  };
73816
74117
  }
73817
-
73818
74118
  var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
73819
-
73820
74119
  if (rgbaMatched) {
73821
74120
  return {
73822
74121
  red: parseInt("" + rgbaMatched[1], 10),
@@ -73825,44 +74124,32 @@
73825
74124
  alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
73826
74125
  };
73827
74126
  }
73828
-
73829
74127
  var hslMatched = hslRegex.exec(normalizedColor);
73830
-
73831
74128
  if (hslMatched) {
73832
74129
  var hue = parseInt("" + hslMatched[1], 10);
73833
74130
  var saturation = parseInt("" + hslMatched[2], 10) / 100;
73834
74131
  var lightness = parseInt("" + hslMatched[3], 10) / 100;
73835
74132
  var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
73836
74133
  var hslRgbMatched = rgbRegex.exec(rgbColorString);
73837
-
73838
74134
  if (!hslRgbMatched) {
73839
74135
  throw new PolishedError(4, normalizedColor, rgbColorString);
73840
74136
  }
73841
-
73842
74137
  return {
73843
74138
  red: parseInt("" + hslRgbMatched[1], 10),
73844
74139
  green: parseInt("" + hslRgbMatched[2], 10),
73845
74140
  blue: parseInt("" + hslRgbMatched[3], 10)
73846
74141
  };
73847
74142
  }
73848
-
73849
74143
  var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
73850
-
73851
74144
  if (hslaMatched) {
73852
74145
  var _hue = parseInt("" + hslaMatched[1], 10);
73853
-
73854
74146
  var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
73855
-
73856
74147
  var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
73857
-
73858
74148
  var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
73859
-
73860
74149
  var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
73861
-
73862
74150
  if (!_hslRgbMatched) {
73863
74151
  throw new PolishedError(4, normalizedColor, _rgbColorString);
73864
74152
  }
73865
-
73866
74153
  return {
73867
74154
  red: parseInt("" + _hslRgbMatched[1], 10),
73868
74155
  green: parseInt("" + _hslRgbMatched[2], 10),
@@ -73870,10 +74157,82 @@
73870
74157
  alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
73871
74158
  };
73872
74159
  }
73873
-
73874
74160
  throw new PolishedError(5);
73875
74161
  }
73876
74162
 
74163
+ function rgbToHsl(color) {
74164
+ // make sure rgb are contained in a set of [0, 255]
74165
+ var red = color.red / 255;
74166
+ var green = color.green / 255;
74167
+ var blue = color.blue / 255;
74168
+ var max = Math.max(red, green, blue);
74169
+ var min = Math.min(red, green, blue);
74170
+ var lightness = (max + min) / 2;
74171
+ if (max === min) {
74172
+ // achromatic
74173
+ if (color.alpha !== undefined) {
74174
+ return {
74175
+ hue: 0,
74176
+ saturation: 0,
74177
+ lightness: lightness,
74178
+ alpha: color.alpha
74179
+ };
74180
+ } else {
74181
+ return {
74182
+ hue: 0,
74183
+ saturation: 0,
74184
+ lightness: lightness
74185
+ };
74186
+ }
74187
+ }
74188
+ var hue;
74189
+ var delta = max - min;
74190
+ var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
74191
+ switch (max) {
74192
+ case red:
74193
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
74194
+ break;
74195
+ case green:
74196
+ hue = (blue - red) / delta + 2;
74197
+ break;
74198
+ default:
74199
+ // blue case
74200
+ hue = (red - green) / delta + 4;
74201
+ break;
74202
+ }
74203
+ hue *= 60;
74204
+ if (color.alpha !== undefined) {
74205
+ return {
74206
+ hue: hue,
74207
+ saturation: saturation,
74208
+ lightness: lightness,
74209
+ alpha: color.alpha
74210
+ };
74211
+ }
74212
+ return {
74213
+ hue: hue,
74214
+ saturation: saturation,
74215
+ lightness: lightness
74216
+ };
74217
+ }
74218
+
74219
+ /**
74220
+ * Returns an HslColor or HslaColor object. This utility function is only useful
74221
+ * if want to extract a color component. With the color util `toColorString` you
74222
+ * can convert a HslColor or HslaColor object back to a string.
74223
+ *
74224
+ * @example
74225
+ * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
74226
+ * const color1 = parseToHsl('rgb(255, 0, 0)');
74227
+ * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
74228
+ * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
74229
+ */
74230
+ function parseToHsl(color) {
74231
+ // Note: At a later stage we can optimize this function as right now a hsl
74232
+ // color would be parsed converted to rgb values and converted back to hsl.
74233
+ return rgbToHsl(parseToRgb(color));
74234
+ }
74235
+
73877
74236
  /**
73878
74237
  * Reduces hex values if possible e.g. #ff8866 to #f86
73879
74238
  * @private
@@ -73882,10 +74241,8 @@
73882
74241
  if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
73883
74242
  return "#" + value[1] + value[3] + value[5];
73884
74243
  }
73885
-
73886
74244
  return value;
73887
74245
  };
73888
-
73889
74246
  var reduceHexValue$1 = reduceHexValue;
73890
74247
 
73891
74248
  function numberToHex(value) {
@@ -73893,6 +74250,83 @@
73893
74250
  return hex.length === 1 ? "0" + hex : hex;
73894
74251
  }
73895
74252
 
74253
+ function colorToHex(color) {
74254
+ return numberToHex(Math.round(color * 255));
74255
+ }
74256
+ function convertToHex(red, green, blue) {
74257
+ return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
74258
+ }
74259
+ function hslToHex(hue, saturation, lightness) {
74260
+ return hslToRgb(hue, saturation, lightness, convertToHex);
74261
+ }
74262
+
74263
+ /**
74264
+ * Returns a string value for the color. The returned result is the smallest possible hex notation.
74265
+ *
74266
+ * @example
74267
+ * // Styles as object usage
74268
+ * const styles = {
74269
+ * background: hsl(359, 0.75, 0.4),
74270
+ * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
74271
+ * }
74272
+ *
74273
+ * // styled-components usage
74274
+ * const div = styled.div`
74275
+ * background: ${hsl(359, 0.75, 0.4)};
74276
+ * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
74277
+ * `
74278
+ *
74279
+ * // CSS in JS Output
74280
+ *
74281
+ * element {
74282
+ * background: "#b3191c";
74283
+ * background: "#b3191c";
74284
+ * }
74285
+ */
74286
+ function hsl(value, saturation, lightness) {
74287
+ if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
74288
+ return hslToHex(value, saturation, lightness);
74289
+ } else if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
74290
+ return hslToHex(value.hue, value.saturation, value.lightness);
74291
+ }
74292
+ throw new PolishedError(1);
74293
+ }
74294
+
74295
+ /**
74296
+ * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
74297
+ *
74298
+ * @example
74299
+ * // Styles as object usage
74300
+ * const styles = {
74301
+ * background: hsla(359, 0.75, 0.4, 0.7),
74302
+ * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
74303
+ * background: hsla(359, 0.75, 0.4, 1),
74304
+ * }
74305
+ *
74306
+ * // styled-components usage
74307
+ * const div = styled.div`
74308
+ * background: ${hsla(359, 0.75, 0.4, 0.7)};
74309
+ * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
74310
+ * background: ${hsla(359, 0.75, 0.4, 1)};
74311
+ * `
74312
+ *
74313
+ * // CSS in JS Output
74314
+ *
74315
+ * element {
74316
+ * background: "rgba(179,25,28,0.7)";
74317
+ * background: "rgba(179,25,28,0.7)";
74318
+ * background: "#b3191c";
74319
+ * }
74320
+ */
74321
+ function hsla(value, saturation, lightness, alpha) {
74322
+ if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
74323
+ return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
74324
+ } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
74325
+ return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
74326
+ }
74327
+ throw new PolishedError(2);
74328
+ }
74329
+
73896
74330
  /**
73897
74331
  * Returns a string value for the color. The returned result is the smallest possible hex notation.
73898
74332
  *
@@ -73922,7 +74356,6 @@
73922
74356
  } else if (typeof value === 'object' && green === undefined && blue === undefined) {
73923
74357
  return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
73924
74358
  }
73925
-
73926
74359
  throw new PolishedError(6);
73927
74360
  }
73928
74361
 
@@ -73969,10 +74402,62 @@
73969
74402
  } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
73970
74403
  return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
73971
74404
  }
73972
-
73973
74405
  throw new PolishedError(7);
73974
74406
  }
73975
74407
 
74408
+ var isRgb = function isRgb(color) {
74409
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
74410
+ };
74411
+ var isRgba = function isRgba(color) {
74412
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
74413
+ };
74414
+ var isHsl = function isHsl(color) {
74415
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
74416
+ };
74417
+ var isHsla = function isHsla(color) {
74418
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
74419
+ };
74420
+
74421
+ /**
74422
+ * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
74423
+ * This util is useful in case you only know on runtime which color object is
74424
+ * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
74425
+ *
74426
+ * @example
74427
+ * // Styles as object usage
74428
+ * const styles = {
74429
+ * background: toColorString({ red: 255, green: 205, blue: 100 }),
74430
+ * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
74431
+ * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
74432
+ * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
74433
+ * }
74434
+ *
74435
+ * // styled-components usage
74436
+ * const div = styled.div`
74437
+ * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
74438
+ * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
74439
+ * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
74440
+ * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
74441
+ * `
74442
+ *
74443
+ * // CSS in JS Output
74444
+ * element {
74445
+ * background: "#ffcd64";
74446
+ * background: "rgba(255,205,100,0.72)";
74447
+ * background: "#00f";
74448
+ * background: "rgba(179,25,25,0.72)";
74449
+ * }
74450
+ */
74451
+
74452
+ function toColorString(color) {
74453
+ if (typeof color !== 'object') throw new PolishedError(8);
74454
+ if (isRgba(color)) return rgba(color);
74455
+ if (isRgb(color)) return rgb(color);
74456
+ if (isHsla(color)) return hsla(color);
74457
+ if (isHsl(color)) return hsl(color);
74458
+ throw new PolishedError(8);
74459
+ }
74460
+
73976
74461
  // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
73977
74462
  // eslint-disable-next-line no-unused-vars
73978
74463
  // eslint-disable-next-line no-unused-vars
@@ -73983,18 +74468,216 @@
73983
74468
  var combined = acc.concat(Array.prototype.slice.call(arguments));
73984
74469
  return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
73985
74470
  };
73986
- } // eslint-disable-next-line no-redeclare
73987
-
74471
+ }
73988
74472
 
74473
+ // eslint-disable-next-line no-redeclare
73989
74474
  function curry(f) {
73990
74475
  // eslint-disable-line no-redeclare
73991
74476
  return curried(f, f.length, []);
73992
74477
  }
73993
74478
 
74479
+ /**
74480
+ * Changes the hue of the color. Hue is a number between 0 to 360. The first
74481
+ * argument for adjustHue is the amount of degrees the color is rotated around
74482
+ * the color wheel, always producing a positive hue value.
74483
+ *
74484
+ * @example
74485
+ * // Styles as object usage
74486
+ * const styles = {
74487
+ * background: adjustHue(180, '#448'),
74488
+ * background: adjustHue('180', 'rgba(101,100,205,0.7)'),
74489
+ * }
74490
+ *
74491
+ * // styled-components usage
74492
+ * const div = styled.div`
74493
+ * background: ${adjustHue(180, '#448')};
74494
+ * background: ${adjustHue('180', 'rgba(101,100,205,0.7)')};
74495
+ * `
74496
+ *
74497
+ * // CSS in JS Output
74498
+ * element {
74499
+ * background: "#888844";
74500
+ * background: "rgba(136,136,68,0.7)";
74501
+ * }
74502
+ */
74503
+ function adjustHue(degree, color) {
74504
+ if (color === 'transparent') return color;
74505
+ var hslColor = parseToHsl(color);
74506
+ return toColorString(_extends({}, hslColor, {
74507
+ hue: hslColor.hue + parseFloat(degree)
74508
+ }));
74509
+ }
74510
+
74511
+ // prettier-ignore
74512
+ curry /* ::<number | string, string, string> */(adjustHue);
74513
+
73994
74514
  function guard(lowerBoundary, upperBoundary, value) {
73995
74515
  return Math.max(lowerBoundary, Math.min(upperBoundary, value));
73996
74516
  }
73997
74517
 
74518
+ /**
74519
+ * Returns a string value for the darkened color.
74520
+ *
74521
+ * @example
74522
+ * // Styles as object usage
74523
+ * const styles = {
74524
+ * background: darken(0.2, '#FFCD64'),
74525
+ * background: darken('0.2', 'rgba(255,205,100,0.7)'),
74526
+ * }
74527
+ *
74528
+ * // styled-components usage
74529
+ * const div = styled.div`
74530
+ * background: ${darken(0.2, '#FFCD64')};
74531
+ * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
74532
+ * `
74533
+ *
74534
+ * // CSS in JS Output
74535
+ *
74536
+ * element {
74537
+ * background: "#ffbd31";
74538
+ * background: "rgba(255,189,49,0.7)";
74539
+ * }
74540
+ */
74541
+ function darken(amount, color) {
74542
+ if (color === 'transparent') return color;
74543
+ var hslColor = parseToHsl(color);
74544
+ return toColorString(_extends({}, hslColor, {
74545
+ lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
74546
+ }));
74547
+ }
74548
+
74549
+ // prettier-ignore
74550
+ curry /* ::<number | string, string, string> */(darken);
74551
+
74552
+ /**
74553
+ * Decreases the intensity of a color. Its range is between 0 to 1. The first
74554
+ * argument of the desaturate function is the amount by how much the color
74555
+ * intensity should be decreased.
74556
+ *
74557
+ * @example
74558
+ * // Styles as object usage
74559
+ * const styles = {
74560
+ * background: desaturate(0.2, '#CCCD64'),
74561
+ * background: desaturate('0.2', 'rgba(204,205,100,0.7)'),
74562
+ * }
74563
+ *
74564
+ * // styled-components usage
74565
+ * const div = styled.div`
74566
+ * background: ${desaturate(0.2, '#CCCD64')};
74567
+ * background: ${desaturate('0.2', 'rgba(204,205,100,0.7)')};
74568
+ * `
74569
+ *
74570
+ * // CSS in JS Output
74571
+ * element {
74572
+ * background: "#b8b979";
74573
+ * background: "rgba(184,185,121,0.7)";
74574
+ * }
74575
+ */
74576
+ function desaturate(amount, color) {
74577
+ if (color === 'transparent') return color;
74578
+ var hslColor = parseToHsl(color);
74579
+ return toColorString(_extends({}, hslColor, {
74580
+ saturation: guard(0, 1, hslColor.saturation - parseFloat(amount))
74581
+ }));
74582
+ }
74583
+
74584
+ // prettier-ignore
74585
+ curry /* ::<number | string, string, string> */(desaturate);
74586
+
74587
+ /**
74588
+ * Returns a string value for the lightened color.
74589
+ *
74590
+ * @example
74591
+ * // Styles as object usage
74592
+ * const styles = {
74593
+ * background: lighten(0.2, '#CCCD64'),
74594
+ * background: lighten('0.2', 'rgba(204,205,100,0.7)'),
74595
+ * }
74596
+ *
74597
+ * // styled-components usage
74598
+ * const div = styled.div`
74599
+ * background: ${lighten(0.2, '#FFCD64')};
74600
+ * background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
74601
+ * `
74602
+ *
74603
+ * // CSS in JS Output
74604
+ *
74605
+ * element {
74606
+ * background: "#e5e6b1";
74607
+ * background: "rgba(229,230,177,0.7)";
74608
+ * }
74609
+ */
74610
+ function lighten(amount, color) {
74611
+ if (color === 'transparent') return color;
74612
+ var hslColor = parseToHsl(color);
74613
+ return toColorString(_extends({}, hslColor, {
74614
+ lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
74615
+ }));
74616
+ }
74617
+
74618
+ // prettier-ignore
74619
+ curry /* ::<number | string, string, string> */(lighten);
74620
+
74621
+ /**
74622
+ * Mixes the two provided colors together by calculating the average of each of the RGB components weighted to the first color by the provided weight.
74623
+ *
74624
+ * @example
74625
+ * // Styles as object usage
74626
+ * const styles = {
74627
+ * background: mix(0.5, '#f00', '#00f')
74628
+ * background: mix(0.25, '#f00', '#00f')
74629
+ * background: mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')
74630
+ * }
74631
+ *
74632
+ * // styled-components usage
74633
+ * const div = styled.div`
74634
+ * background: ${mix(0.5, '#f00', '#00f')};
74635
+ * background: ${mix(0.25, '#f00', '#00f')};
74636
+ * background: ${mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')};
74637
+ * `
74638
+ *
74639
+ * // CSS in JS Output
74640
+ *
74641
+ * element {
74642
+ * background: "#7f007f";
74643
+ * background: "#3f00bf";
74644
+ * background: "rgba(63, 0, 191, 0.75)";
74645
+ * }
74646
+ */
74647
+ function mix(weight, color, otherColor) {
74648
+ if (color === 'transparent') return otherColor;
74649
+ if (otherColor === 'transparent') return color;
74650
+ if (weight === 0) return otherColor;
74651
+ var parsedColor1 = parseToRgb(color);
74652
+ var color1 = _extends({}, parsedColor1, {
74653
+ alpha: typeof parsedColor1.alpha === 'number' ? parsedColor1.alpha : 1
74654
+ });
74655
+ var parsedColor2 = parseToRgb(otherColor);
74656
+ var color2 = _extends({}, parsedColor2, {
74657
+ alpha: typeof parsedColor2.alpha === 'number' ? parsedColor2.alpha : 1
74658
+ });
74659
+
74660
+ // The formula is copied from the original Sass implementation:
74661
+ // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
74662
+ var alphaDelta = color1.alpha - color2.alpha;
74663
+ var x = parseFloat(weight) * 2 - 1;
74664
+ var y = x * alphaDelta === -1 ? x : x + alphaDelta;
74665
+ var z = 1 + x * alphaDelta;
74666
+ var weight1 = (y / z + 1) / 2.0;
74667
+ var weight2 = 1 - weight1;
74668
+ var mixedColor = {
74669
+ red: Math.floor(color1.red * weight1 + color2.red * weight2),
74670
+ green: Math.floor(color1.green * weight1 + color2.green * weight2),
74671
+ blue: Math.floor(color1.blue * weight1 + color2.blue * weight2),
74672
+ alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
74673
+ };
74674
+ return rgba(mixedColor);
74675
+ }
74676
+
74677
+ // prettier-ignore
74678
+ var curriedMix = curry /* ::<number | string, string, string, string> */(mix);
74679
+ var mix$1 = curriedMix;
74680
+
73998
74681
  /**
73999
74682
  * Increases the opacity of a color. Its range for the amount is between 0 to 1.
74000
74683
  *
@@ -74022,25 +74705,257 @@
74022
74705
  * background: "rgba(255,0,0,0.7)";
74023
74706
  * }
74024
74707
  */
74025
-
74026
74708
  function opacify(amount, color) {
74027
74709
  if (color === 'transparent') return color;
74028
74710
  var parsedColor = parseToRgb(color);
74029
74711
  var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
74030
-
74031
74712
  var colorWithAlpha = _extends({}, parsedColor, {
74032
74713
  alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
74033
74714
  });
74034
-
74035
74715
  return rgba(colorWithAlpha);
74036
- } // prettier-ignore
74037
-
74716
+ }
74038
74717
 
74039
- var curriedOpacify = /*#__PURE__*/curry
74040
- /* ::<number | string, string, string> */
74041
- (opacify);
74718
+ // prettier-ignore
74719
+ var curriedOpacify = curry /* ::<number | string, string, string> */(opacify);
74042
74720
  var curriedOpacify$1 = curriedOpacify;
74043
74721
 
74722
+ /**
74723
+ * Increases the intensity of a color. Its range is between 0 to 1. The first
74724
+ * argument of the saturate function is the amount by how much the color
74725
+ * intensity should be increased.
74726
+ *
74727
+ * @example
74728
+ * // Styles as object usage
74729
+ * const styles = {
74730
+ * background: saturate(0.2, '#CCCD64'),
74731
+ * background: saturate('0.2', 'rgba(204,205,100,0.7)'),
74732
+ * }
74733
+ *
74734
+ * // styled-components usage
74735
+ * const div = styled.div`
74736
+ * background: ${saturate(0.2, '#FFCD64')};
74737
+ * background: ${saturate('0.2', 'rgba(204,205,100,0.7)')};
74738
+ * `
74739
+ *
74740
+ * // CSS in JS Output
74741
+ *
74742
+ * element {
74743
+ * background: "#e0e250";
74744
+ * background: "rgba(224,226,80,0.7)";
74745
+ * }
74746
+ */
74747
+ function saturate(amount, color) {
74748
+ if (color === 'transparent') return color;
74749
+ var hslColor = parseToHsl(color);
74750
+ return toColorString(_extends({}, hslColor, {
74751
+ saturation: guard(0, 1, hslColor.saturation + parseFloat(amount))
74752
+ }));
74753
+ }
74754
+
74755
+ // prettier-ignore
74756
+ curry /* ::<number | string, string, string> */(saturate);
74757
+
74758
+ /**
74759
+ * Sets the hue of a color to the provided value. The hue range can be
74760
+ * from 0 and 359.
74761
+ *
74762
+ * @example
74763
+ * // Styles as object usage
74764
+ * const styles = {
74765
+ * background: setHue(42, '#CCCD64'),
74766
+ * background: setHue('244', 'rgba(204,205,100,0.7)'),
74767
+ * }
74768
+ *
74769
+ * // styled-components usage
74770
+ * const div = styled.div`
74771
+ * background: ${setHue(42, '#CCCD64')};
74772
+ * background: ${setHue('244', 'rgba(204,205,100,0.7)')};
74773
+ * `
74774
+ *
74775
+ * // CSS in JS Output
74776
+ * element {
74777
+ * background: "#cdae64";
74778
+ * background: "rgba(107,100,205,0.7)";
74779
+ * }
74780
+ */
74781
+ function setHue(hue, color) {
74782
+ if (color === 'transparent') return color;
74783
+ return toColorString(_extends({}, parseToHsl(color), {
74784
+ hue: parseFloat(hue)
74785
+ }));
74786
+ }
74787
+
74788
+ // prettier-ignore
74789
+ curry /* ::<number | string, string, string> */(setHue);
74790
+
74791
+ /**
74792
+ * Sets the lightness of a color to the provided value. The lightness range can be
74793
+ * from 0 and 1.
74794
+ *
74795
+ * @example
74796
+ * // Styles as object usage
74797
+ * const styles = {
74798
+ * background: setLightness(0.2, '#CCCD64'),
74799
+ * background: setLightness('0.75', 'rgba(204,205,100,0.7)'),
74800
+ * }
74801
+ *
74802
+ * // styled-components usage
74803
+ * const div = styled.div`
74804
+ * background: ${setLightness(0.2, '#CCCD64')};
74805
+ * background: ${setLightness('0.75', 'rgba(204,205,100,0.7)')};
74806
+ * `
74807
+ *
74808
+ * // CSS in JS Output
74809
+ * element {
74810
+ * background: "#4d4d19";
74811
+ * background: "rgba(223,224,159,0.7)";
74812
+ * }
74813
+ */
74814
+ function setLightness(lightness, color) {
74815
+ if (color === 'transparent') return color;
74816
+ return toColorString(_extends({}, parseToHsl(color), {
74817
+ lightness: parseFloat(lightness)
74818
+ }));
74819
+ }
74820
+
74821
+ // prettier-ignore
74822
+ curry /* ::<number | string, string, string> */(setLightness);
74823
+
74824
+ /**
74825
+ * Sets the saturation of a color to the provided value. The saturation range can be
74826
+ * from 0 and 1.
74827
+ *
74828
+ * @example
74829
+ * // Styles as object usage
74830
+ * const styles = {
74831
+ * background: setSaturation(0.2, '#CCCD64'),
74832
+ * background: setSaturation('0.75', 'rgba(204,205,100,0.7)'),
74833
+ * }
74834
+ *
74835
+ * // styled-components usage
74836
+ * const div = styled.div`
74837
+ * background: ${setSaturation(0.2, '#CCCD64')};
74838
+ * background: ${setSaturation('0.75', 'rgba(204,205,100,0.7)')};
74839
+ * `
74840
+ *
74841
+ * // CSS in JS Output
74842
+ * element {
74843
+ * background: "#adad84";
74844
+ * background: "rgba(228,229,76,0.7)";
74845
+ * }
74846
+ */
74847
+ function setSaturation(saturation, color) {
74848
+ if (color === 'transparent') return color;
74849
+ return toColorString(_extends({}, parseToHsl(color), {
74850
+ saturation: parseFloat(saturation)
74851
+ }));
74852
+ }
74853
+
74854
+ // prettier-ignore
74855
+ curry /* ::<number | string, string, string> */(setSaturation);
74856
+
74857
+ /**
74858
+ * Shades a color by mixing it with black. `shade` can produce
74859
+ * hue shifts, where as `darken` manipulates the luminance channel and therefore
74860
+ * doesn't produce hue shifts.
74861
+ *
74862
+ * @example
74863
+ * // Styles as object usage
74864
+ * const styles = {
74865
+ * background: shade(0.25, '#00f')
74866
+ * }
74867
+ *
74868
+ * // styled-components usage
74869
+ * const div = styled.div`
74870
+ * background: ${shade(0.25, '#00f')};
74871
+ * `
74872
+ *
74873
+ * // CSS in JS Output
74874
+ *
74875
+ * element {
74876
+ * background: "#00003f";
74877
+ * }
74878
+ */
74879
+
74880
+ function shade(percentage, color) {
74881
+ if (color === 'transparent') return color;
74882
+ return mix$1(parseFloat(percentage), 'rgb(0, 0, 0)', color);
74883
+ }
74884
+
74885
+ // prettier-ignore
74886
+ curry /* ::<number | string, string, string> */(shade);
74887
+
74888
+ /**
74889
+ * Tints a color by mixing it with white. `tint` can produce
74890
+ * hue shifts, where as `lighten` manipulates the luminance channel and therefore
74891
+ * doesn't produce hue shifts.
74892
+ *
74893
+ * @example
74894
+ * // Styles as object usage
74895
+ * const styles = {
74896
+ * background: tint(0.25, '#00f')
74897
+ * }
74898
+ *
74899
+ * // styled-components usage
74900
+ * const div = styled.div`
74901
+ * background: ${tint(0.25, '#00f')};
74902
+ * `
74903
+ *
74904
+ * // CSS in JS Output
74905
+ *
74906
+ * element {
74907
+ * background: "#bfbfff";
74908
+ * }
74909
+ */
74910
+
74911
+ function tint(percentage, color) {
74912
+ if (color === 'transparent') return color;
74913
+ return mix$1(parseFloat(percentage), 'rgb(255, 255, 255)', color);
74914
+ }
74915
+
74916
+ // prettier-ignore
74917
+ curry /* ::<number | string, string, string> */(tint);
74918
+
74919
+ /**
74920
+ * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
74921
+ *
74922
+ *
74923
+ * @example
74924
+ * // Styles as object usage
74925
+ * const styles = {
74926
+ * background: transparentize(0.1, '#fff'),
74927
+ * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
74928
+ * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
74929
+ * }
74930
+ *
74931
+ * // styled-components usage
74932
+ * const div = styled.div`
74933
+ * background: ${transparentize(0.1, '#fff')};
74934
+ * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
74935
+ * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
74936
+ * `
74937
+ *
74938
+ * // CSS in JS Output
74939
+ *
74940
+ * element {
74941
+ * background: "rgba(255,255,255,0.9)";
74942
+ * background: "rgba(255,255,255,0.8)";
74943
+ * background: "rgba(255,0,0,0.3)";
74944
+ * }
74945
+ */
74946
+ function transparentize(amount, color) {
74947
+ if (color === 'transparent') return color;
74948
+ var parsedColor = parseToRgb(color);
74949
+ var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
74950
+ var colorWithAlpha = _extends({}, parsedColor, {
74951
+ alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
74952
+ });
74953
+ return rgba(colorWithAlpha);
74954
+ }
74955
+
74956
+ // prettier-ignore
74957
+ curry /* ::<number | string, string, string> */(transparentize);
74958
+
74044
74959
  function styleInject$1(css, ref) {
74045
74960
  if (ref === void 0) ref = {};
74046
74961
  var insertAt = ref.insertAt;
@@ -74096,6 +75011,20 @@
74096
75011
  return a;
74097
75012
  }
74098
75013
  }
75014
+ function _toPrimitive$1(t, r) {
75015
+ if ("object" != typeof t || !t) return t;
75016
+ var e = t[Symbol.toPrimitive];
75017
+ if (void 0 !== e) {
75018
+ var i = e.call(t, r || "default");
75019
+ if ("object" != typeof i) return i;
75020
+ throw new TypeError("@@toPrimitive must return a primitive value.");
75021
+ }
75022
+ return ("string" === r ? String : Number)(t);
75023
+ }
75024
+ function _toPropertyKey$1(t) {
75025
+ var i = _toPrimitive$1(t, "string");
75026
+ return "symbol" == typeof i ? i : String(i);
75027
+ }
74099
75028
  function _defineProperty$1(obj, key, value) {
74100
75029
  key = _toPropertyKey$1(key);
74101
75030
  if (key in obj) {
@@ -74144,20 +75073,6 @@
74144
75073
  function _nonIterableRest() {
74145
75074
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74146
75075
  }
74147
- function _toPrimitive$1(input, hint) {
74148
- if (typeof input !== "object" || input === null) return input;
74149
- var prim = input[Symbol.toPrimitive];
74150
- if (prim !== undefined) {
74151
- var res = prim.call(input, hint || "default");
74152
- if (typeof res !== "object") return res;
74153
- throw new TypeError("@@toPrimitive must return a primitive value.");
74154
- }
74155
- return (hint === "string" ? String : Number)(input);
74156
- }
74157
- function _toPropertyKey$1(arg) {
74158
- var key = _toPrimitive$1(arg, "string");
74159
- return typeof key === "symbol" ? key : String(key);
74160
- }
74161
75076
 
74162
75077
  var three = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
74163
75078
  : {
@@ -74293,7 +75208,6 @@
74293
75208
  }
74294
75209
  update(); // update camera animation tweens
74295
75210
  }
74296
-
74297
75211
  return this;
74298
75212
  },
74299
75213
  getPointerPos: function getPointerPos(state) {
@@ -74355,7 +75269,6 @@
74355
75269
  camera.lookAt(lookAtVect); // note: lookAt may be overridden by other controls in some cases
74356
75270
  }
74357
75271
  }
74358
-
74359
75272
  function getLookAt() {
74360
75273
  return Object.assign(new three.Vector3(0, 0, -1000).applyQuaternion(camera.quaternion).add(camera.position));
74361
75274
  }
@@ -74454,7 +75367,6 @@
74454
75367
  return state.controls;
74455
75368
  } // to be deprecated
74456
75369
  },
74457
-
74458
75370
  stateInit: function stateInit() {
74459
75371
  return {
74460
75372
  scene: new three.Scene(),
@@ -74545,14 +75457,12 @@
74545
75457
  state.isPointerDragging = false;
74546
75458
  if (!state.clickAfterDrag) return; // don't trigger onClick after pointer drag (camera motion via controls)
74547
75459
  }
74548
-
74549
75460
  requestAnimationFrame(function () {
74550
75461
  // trigger click events asynchronously, to allow hoverObj to be set (on frame)
74551
75462
  if (ev.button === 0) {
74552
75463
  // left-click
74553
75464
  state.onClick(state.hoverObj || null, ev, state.intersectionPoint); // trigger background clicks with null
74554
75465
  }
74555
-
74556
75466
  if (ev.button === 2 && state.onRightClick) {
74557
75467
  // right-click
74558
75468
  state.onRightClick(state.hoverObj || null, ev, state.intersectionPoint);
@@ -74680,7 +75590,6 @@
74680
75590
  return state.scene.add(light);
74681
75591
  }); // Add to scene
74682
75592
  }
74683
-
74684
75593
  if (changedProps.hasOwnProperty('objects')) {
74685
75594
  (changedProps.objects || []).forEach(function (obj) {
74686
75595
  return state.scene.remove(obj);
@@ -74747,6 +75656,20 @@
74747
75656
  }
74748
75657
  return e;
74749
75658
  }
75659
+ function _toPrimitive(t, r) {
75660
+ if ("object" != typeof t || !t) return t;
75661
+ var e = t[Symbol.toPrimitive];
75662
+ if (void 0 !== e) {
75663
+ var i = e.call(t, r || "default");
75664
+ if ("object" != typeof i) return i;
75665
+ throw new TypeError("@@toPrimitive must return a primitive value.");
75666
+ }
75667
+ return ("string" === r ? String : Number)(t);
75668
+ }
75669
+ function _toPropertyKey(t) {
75670
+ var i = _toPrimitive(t, "string");
75671
+ return "symbol" == typeof i ? i : String(i);
75672
+ }
74750
75673
  function _defineProperty(obj, key, value) {
74751
75674
  key = _toPropertyKey(key);
74752
75675
  if (key in obj) {
@@ -74813,20 +75736,6 @@
74813
75736
  function _nonIterableSpread() {
74814
75737
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74815
75738
  }
74816
- function _toPrimitive(input, hint) {
74817
- if (typeof input !== "object" || input === null) return input;
74818
- var prim = input[Symbol.toPrimitive];
74819
- if (prim !== undefined) {
74820
- var res = prim.call(input, hint || "default");
74821
- if (typeof res !== "object") return res;
74822
- throw new TypeError("@@toPrimitive must return a primitive value.");
74823
- }
74824
- return (hint === "string" ? String : Number)(input);
74825
- }
74826
- function _toPropertyKey(arg) {
74827
- var key = _toPrimitive(arg, "string");
74828
- return typeof key === "symbol" ? key : String(key);
74829
- }
74830
75739
 
74831
75740
  function linkKapsule (kapsulePropName, kapsuleType) {
74832
75741
  var dummyK = new kapsuleType(); // To extract defaults