react-globe.gl 2.22.1 → 2.22.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.22.1 react-globe.gl - https://github.com/vasturiano/react-globe.gl
1
+ // Version 2.22.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) :
@@ -133,17 +133,11 @@
133
133
  function _typeof(obj) {
134
134
  "@babel/helpers - typeof";
135
135
 
136
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
137
- _typeof = function (obj) {
138
- return typeof obj;
139
- };
140
- } else {
141
- _typeof = function (obj) {
142
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
143
- };
144
- }
145
-
146
- return _typeof(obj);
136
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
137
+ return typeof obj;
138
+ } : function (obj) {
139
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
140
+ }, _typeof(obj);
147
141
  }
148
142
 
149
143
  function _slicedToArray$7(arr, i) {
@@ -167,7 +161,7 @@
167
161
  }
168
162
 
169
163
  function _iterableToArrayLimit$7(arr, i) {
170
- var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
164
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
171
165
 
172
166
  if (_i == null) return;
173
167
  var _arr = [];
@@ -308,7 +302,7 @@
308
302
  * Copyright 2010-2022 Three.js Authors
309
303
  * SPDX-License-Identifier: MIT
310
304
  */
311
- const REVISION = '141';
305
+ const REVISION = '143';
312
306
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
313
307
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
314
308
  const CullFaceNone = 0;
@@ -530,13 +524,7 @@
530
524
 
531
525
  }
532
526
 
533
- const _lut = [];
534
-
535
- for ( let i = 0; i < 256; i ++ ) {
536
-
537
- _lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );
538
-
539
- }
527
+ const _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];
540
528
 
541
529
  let _seed = 1234567;
542
530
 
@@ -861,7 +849,7 @@
861
849
 
862
850
  constructor( x = 0, y = 0 ) {
863
851
 
864
- this.isVector2 = true;
852
+ Vector2.prototype.isVector2 = true;
865
853
 
866
854
  this.x = x;
867
855
  this.y = y;
@@ -967,14 +955,7 @@
967
955
 
968
956
  }
969
957
 
970
- add( v, w ) {
971
-
972
- if ( w !== undefined ) {
973
-
974
- console.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
975
- return this.addVectors( v, w );
976
-
977
- }
958
+ add( v ) {
978
959
 
979
960
  this.x += v.x;
980
961
  this.y += v.y;
@@ -1010,14 +991,7 @@
1010
991
 
1011
992
  }
1012
993
 
1013
- sub( v, w ) {
1014
-
1015
- if ( w !== undefined ) {
1016
-
1017
- console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
1018
- return this.subVectors( v, w );
1019
-
1020
- }
994
+ sub( v ) {
1021
995
 
1022
996
  this.x -= v.x;
1023
997
  this.y -= v.y;
@@ -1293,13 +1267,7 @@
1293
1267
 
1294
1268
  }
1295
1269
 
1296
- fromBufferAttribute( attribute, index, offset ) {
1297
-
1298
- if ( offset !== undefined ) {
1299
-
1300
- console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
1301
-
1302
- }
1270
+ fromBufferAttribute( attribute, index ) {
1303
1271
 
1304
1272
  this.x = attribute.getX( index );
1305
1273
  this.y = attribute.getY( index );
@@ -1344,7 +1312,7 @@
1344
1312
 
1345
1313
  constructor() {
1346
1314
 
1347
- this.isMatrix3 = true;
1315
+ Matrix3.prototype.isMatrix3 = true;
1348
1316
 
1349
1317
  this.elements = [
1350
1318
 
@@ -1354,12 +1322,6 @@
1354
1322
 
1355
1323
  ];
1356
1324
 
1357
- if ( arguments.length > 0 ) {
1358
-
1359
- console.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );
1360
-
1361
- }
1362
-
1363
1325
  }
1364
1326
 
1365
1327
  set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
@@ -2608,7 +2570,7 @@
2608
2570
  // images of DataTexture
2609
2571
 
2610
2572
  return {
2611
- data: Array.prototype.slice.call( image.data ),
2573
+ data: Array.from( image.data ),
2612
2574
  width: image.width,
2613
2575
  height: image.height,
2614
2576
  type: image.data.constructor.name
@@ -2919,7 +2881,7 @@
2919
2881
 
2920
2882
  constructor( x = 0, y = 0, z = 0, w = 1 ) {
2921
2883
 
2922
- this.isVector4 = true;
2884
+ Vector4.prototype.isVector4 = true;
2923
2885
 
2924
2886
  this.x = x;
2925
2887
  this.y = y;
@@ -3053,14 +3015,7 @@
3053
3015
 
3054
3016
  }
3055
3017
 
3056
- add( v, w ) {
3057
-
3058
- if ( w !== undefined ) {
3059
-
3060
- console.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
3061
- return this.addVectors( v, w );
3062
-
3063
- }
3018
+ add( v ) {
3064
3019
 
3065
3020
  this.x += v.x;
3066
3021
  this.y += v.y;
@@ -3104,14 +3059,7 @@
3104
3059
 
3105
3060
  }
3106
3061
 
3107
- sub( v, w ) {
3108
-
3109
- if ( w !== undefined ) {
3110
-
3111
- console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
3112
- return this.subVectors( v, w );
3113
-
3114
- }
3062
+ sub( v ) {
3115
3063
 
3116
3064
  this.x -= v.x;
3117
3065
  this.y -= v.y;
@@ -3539,13 +3487,7 @@
3539
3487
 
3540
3488
  }
3541
3489
 
3542
- fromBufferAttribute( attribute, index, offset ) {
3543
-
3544
- if ( offset !== undefined ) {
3545
-
3546
- console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
3547
-
3548
- }
3490
+ fromBufferAttribute( attribute, index ) {
3549
3491
 
3550
3492
  this.x = attribute.getX( index );
3551
3493
  this.y = attribute.getY( index );
@@ -3748,13 +3690,6 @@
3748
3690
 
3749
3691
  }
3750
3692
 
3751
- static slerp( qa, qb, qm, t ) {
3752
-
3753
- console.warn( 'THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.' );
3754
- return qm.slerpQuaternions( qa, qb, t );
3755
-
3756
- }
3757
-
3758
3693
  static slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {
3759
3694
 
3760
3695
  // fuzz-free, array-based Quaternion SLERP operation
@@ -4232,14 +4167,7 @@
4232
4167
 
4233
4168
  }
4234
4169
 
4235
- multiply( q, p ) {
4236
-
4237
- if ( p !== undefined ) {
4238
-
4239
- console.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );
4240
- return this.multiplyQuaternions( q, p );
4241
-
4242
- }
4170
+ multiply( q ) {
4243
4171
 
4244
4172
  return this.multiplyQuaternions( this, q );
4245
4173
 
@@ -4434,7 +4362,7 @@
4434
4362
 
4435
4363
  constructor( x = 0, y = 0, z = 0 ) {
4436
4364
 
4437
- this.isVector3 = true;
4365
+ Vector3.prototype.isVector3 = true;
4438
4366
 
4439
4367
  this.x = x;
4440
4368
  this.y = y;
@@ -4532,14 +4460,7 @@
4532
4460
 
4533
4461
  }
4534
4462
 
4535
- add( v, w ) {
4536
-
4537
- if ( w !== undefined ) {
4538
-
4539
- console.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );
4540
- return this.addVectors( v, w );
4541
-
4542
- }
4463
+ add( v ) {
4543
4464
 
4544
4465
  this.x += v.x;
4545
4466
  this.y += v.y;
@@ -4579,14 +4500,7 @@
4579
4500
 
4580
4501
  }
4581
4502
 
4582
- sub( v, w ) {
4583
-
4584
- if ( w !== undefined ) {
4585
-
4586
- console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
4587
- return this.subVectors( v, w );
4588
-
4589
- }
4503
+ sub( v ) {
4590
4504
 
4591
4505
  this.x -= v.x;
4592
4506
  this.y -= v.y;
@@ -4616,14 +4530,7 @@
4616
4530
 
4617
4531
  }
4618
4532
 
4619
- multiply( v, w ) {
4620
-
4621
- if ( w !== undefined ) {
4622
-
4623
- console.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );
4624
- return this.multiplyVectors( v, w );
4625
-
4626
- }
4533
+ multiply( v ) {
4627
4534
 
4628
4535
  this.x *= v.x;
4629
4536
  this.y *= v.y;
@@ -4655,12 +4562,6 @@
4655
4562
 
4656
4563
  applyEuler( euler ) {
4657
4564
 
4658
- if ( ! ( euler && euler.isEuler ) ) {
4659
-
4660
- console.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );
4661
-
4662
- }
4663
-
4664
4565
  return this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );
4665
4566
 
4666
4567
  }
@@ -4929,14 +4830,7 @@
4929
4830
 
4930
4831
  }
4931
4832
 
4932
- cross( v, w ) {
4933
-
4934
- if ( w !== undefined ) {
4935
-
4936
- console.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );
4937
- return this.crossVectors( v, w );
4938
-
4939
- }
4833
+ cross( v ) {
4940
4834
 
4941
4835
  return this.crossVectors( this, v );
4942
4836
 
@@ -5126,13 +5020,7 @@
5126
5020
 
5127
5021
  }
5128
5022
 
5129
- fromBufferAttribute( attribute, index, offset ) {
5130
-
5131
- if ( offset !== undefined ) {
5132
-
5133
- console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
5134
-
5135
- }
5023
+ fromBufferAttribute( attribute, index ) {
5136
5024
 
5137
5025
  this.x = attribute.getX( index );
5138
5026
  this.y = attribute.getY( index );
@@ -6431,7 +6319,7 @@
6431
6319
 
6432
6320
  constructor() {
6433
6321
 
6434
- this.isMatrix4 = true;
6322
+ Matrix4.prototype.isMatrix4 = true;
6435
6323
 
6436
6324
  this.elements = [
6437
6325
 
@@ -6442,12 +6330,6 @@
6442
6330
 
6443
6331
  ];
6444
6332
 
6445
- if ( arguments.length > 0 ) {
6446
-
6447
- console.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );
6448
-
6449
- }
6450
-
6451
6333
  }
6452
6334
 
6453
6335
  set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
@@ -6587,12 +6469,6 @@
6587
6469
 
6588
6470
  makeRotationFromEuler( euler ) {
6589
6471
 
6590
- if ( ! ( euler && euler.isEuler ) ) {
6591
-
6592
- console.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );
6593
-
6594
- }
6595
-
6596
6472
  const te = this.elements;
6597
6473
 
6598
6474
  const x = euler.x, y = euler.y, z = euler.z;
@@ -6766,14 +6642,7 @@
6766
6642
 
6767
6643
  }
6768
6644
 
6769
- multiply( m, n ) {
6770
-
6771
- if ( n !== undefined ) {
6772
-
6773
- console.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );
6774
- return this.multiplyMatrices( m, n );
6775
-
6776
- }
6645
+ multiply( m ) {
6777
6646
 
6778
6647
  return this.multiplyMatrices( this, m );
6779
6648
 
@@ -7200,12 +7069,6 @@
7200
7069
 
7201
7070
  makePerspective( left, right, top, bottom, near, far ) {
7202
7071
 
7203
- if ( far === undefined ) {
7204
-
7205
- console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );
7206
-
7207
- }
7208
-
7209
7072
  const te = this.elements;
7210
7073
  const x = 2 * near / ( right - left );
7211
7074
  const y = 2 * near / ( top - bottom );
@@ -8400,7 +8263,7 @@
8400
8263
 
8401
8264
  }
8402
8265
 
8403
- if ( this.environment && this.environment.isTexture ) {
8266
+ if ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {
8404
8267
 
8405
8268
  object.environment = this.environment.toJSON( meta ).uuid;
8406
8269
 
@@ -8600,7 +8463,7 @@
8600
8463
 
8601
8464
  }
8602
8465
 
8603
- Object3D.DefaultUp = new Vector3( 0, 1, 0 );
8466
+ Object3D.DefaultUp = /*@__PURE__*/ new Vector3( 0, 1, 0 );
8604
8467
  Object3D.DefaultMatrixAutoUpdate = true;
8605
8468
 
8606
8469
  const _v0$1 = /*@__PURE__*/ new Vector3();
@@ -9394,31 +9257,8 @@
9394
9257
 
9395
9258
  }
9396
9259
 
9397
- // @deprecated since r131, f5803c62cc4a29d90744e9dc7811d086e354c1d8
9398
-
9399
- get vertexTangents() {
9400
-
9401
- console.warn( 'THREE.' + this.type + ': .vertexTangents has been removed.' );
9402
- return false;
9403
-
9404
- }
9405
-
9406
- set vertexTangents( value ) {
9407
-
9408
- console.warn( 'THREE.' + this.type + ': .vertexTangents has been removed.' );
9409
-
9410
- }
9411
-
9412
9260
  }
9413
9261
 
9414
- Material.fromType = function ( /*type*/ ) {
9415
-
9416
- // TODO: Behavior added in Materials.js
9417
-
9418
- return null;
9419
-
9420
- };
9421
-
9422
9262
  class MeshBasicMaterial extends Material {
9423
9263
 
9424
9264
  constructor( parameters ) {
@@ -9878,7 +9718,7 @@
9878
9718
  const data = {
9879
9719
  itemSize: this.itemSize,
9880
9720
  type: this.array.constructor.name,
9881
- array: Array.prototype.slice.call( this.array ),
9721
+ array: Array.from( this.array ),
9882
9722
  normalized: this.normalized
9883
9723
  };
9884
9724
 
@@ -11651,6 +11491,20 @@
11651
11491
 
11652
11492
  }
11653
11493
 
11494
+ function cloneUniformsGroups( src ) {
11495
+
11496
+ const dst = [];
11497
+
11498
+ for ( let u = 0; u < src.length; u ++ ) {
11499
+
11500
+ dst.push( src[ u ].clone() );
11501
+
11502
+ }
11503
+
11504
+ return dst;
11505
+
11506
+ }
11507
+
11654
11508
  // Legacy
11655
11509
 
11656
11510
  const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };
@@ -11671,6 +11525,7 @@
11671
11525
 
11672
11526
  this.defines = {};
11673
11527
  this.uniforms = {};
11528
+ this.uniformsGroups = [];
11674
11529
 
11675
11530
  this.vertexShader = default_vertex;
11676
11531
  this.fragmentShader = default_fragment;
@@ -11726,6 +11581,7 @@
11726
11581
  this.vertexShader = source.vertexShader;
11727
11582
 
11728
11583
  this.uniforms = cloneUniforms( source.uniforms );
11584
+ this.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );
11729
11585
 
11730
11586
  this.defines = Object.assign( {}, source.defines );
11731
11587
 
@@ -13009,6 +12865,7 @@
13009
12865
  constructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {
13010
12866
 
13011
12867
  super();
12868
+
13012
12869
  this.type = 'PlaneGeometry';
13013
12870
 
13014
12871
  this.parameters = {
@@ -13103,11 +12960,11 @@
13103
12960
 
13104
12961
  var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
13105
12962
 
13106
- var bsdfs = "vec3 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}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\nvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = mix(F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence);\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif";
12963
+ var bsdfs = "vec3 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}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif";
13107
12964
 
13108
- var iridescence_fragment = "#ifdef USE_IRIDESCENCE\nconst mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n);\nvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n}\nvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n}\nfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n}\nvec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( -pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[0] ) * exp( -4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 srgb = XYZ_TO_REC709 * xyz;\n return srgb;\n}\nvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float R21 = R12;\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[0] < iridescenceIOR ) phi23[0] = PI;\n if ( baseIOR[1] < iridescenceIOR ) phi23[1] = PI;\n if ( baseIOR[2] < iridescenceIOR ) phi23[2] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n}\n#endif";
12965
+ var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";
13109
12966
 
13110
- var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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";
12967
+ var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + 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 = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = 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";
13111
12968
 
13112
12969
  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";
13113
12970
 
@@ -13125,7 +12982,7 @@
13125
12982
 
13126
12983
  var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
13127
12984
 
13128
- 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 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.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}";
12985
+ var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\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}";
13129
12986
 
13130
12987
  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\tvec2 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 r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), 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";
13131
12988
 
@@ -13185,7 +13042,7 @@
13185
13042
 
13186
13043
  var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13187
13044
 
13188
- var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\nfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\nif ( material.iridescenceThickness == 0.0 ) {\n\tmaterial.iridescence = 0.0;\n} else {\n\tmaterial.iridescence = saturate( material.iridescence );\n}\nif ( material.iridescence > 0.0 ) {\n\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
13045
+ var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
13189
13046
 
13190
13047
  var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13191
13048
 
@@ -13229,7 +13086,7 @@
13229
13086
 
13230
13087
  var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
13231
13088
 
13232
- var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
13089
+ var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
13233
13090
 
13234
13091
  var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
13235
13092
 
@@ -13510,12 +13367,12 @@
13510
13367
 
13511
13368
  common: {
13512
13369
 
13513
- diffuse: { value: new Color$1( 0xffffff ) },
13370
+ diffuse: { value: /*@__PURE__*/ new Color$1( 0xffffff ) },
13514
13371
  opacity: { value: 1.0 },
13515
13372
 
13516
13373
  map: { value: null },
13517
- uvTransform: { value: new Matrix3() },
13518
- uv2Transform: { value: new Matrix3() },
13374
+ uvTransform: { value: /*@__PURE__*/ new Matrix3() },
13375
+ uv2Transform: { value: /*@__PURE__*/ new Matrix3() },
13519
13376
 
13520
13377
  alphaMap: { value: null },
13521
13378
  alphaTest: { value: 0 }
@@ -13568,7 +13425,7 @@
13568
13425
  normalmap: {
13569
13426
 
13570
13427
  normalMap: { value: null },
13571
- normalScale: { value: new Vector2( 1, 1 ) }
13428
+ normalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }
13572
13429
 
13573
13430
  },
13574
13431
 
@@ -13603,7 +13460,7 @@
13603
13460
  fogDensity: { value: 0.00025 },
13604
13461
  fogNear: { value: 1 },
13605
13462
  fogFar: { value: 2000 },
13606
- fogColor: { value: new Color$1( 0xffffff ) }
13463
+ fogColor: { value: /*@__PURE__*/ new Color$1( 0xffffff ) }
13607
13464
 
13608
13465
  },
13609
13466
 
@@ -13688,27 +13545,27 @@
13688
13545
 
13689
13546
  points: {
13690
13547
 
13691
- diffuse: { value: new Color$1( 0xffffff ) },
13548
+ diffuse: { value: /*@__PURE__*/ new Color$1( 0xffffff ) },
13692
13549
  opacity: { value: 1.0 },
13693
13550
  size: { value: 1.0 },
13694
13551
  scale: { value: 1.0 },
13695
13552
  map: { value: null },
13696
13553
  alphaMap: { value: null },
13697
13554
  alphaTest: { value: 0 },
13698
- uvTransform: { value: new Matrix3() }
13555
+ uvTransform: { value: /*@__PURE__*/ new Matrix3() }
13699
13556
 
13700
13557
  },
13701
13558
 
13702
13559
  sprite: {
13703
13560
 
13704
- diffuse: { value: new Color$1( 0xffffff ) },
13561
+ diffuse: { value: /*@__PURE__*/ new Color$1( 0xffffff ) },
13705
13562
  opacity: { value: 1.0 },
13706
- center: { value: new Vector2( 0.5, 0.5 ) },
13563
+ center: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },
13707
13564
  rotation: { value: 0.0 },
13708
13565
  map: { value: null },
13709
13566
  alphaMap: { value: null },
13710
13567
  alphaTest: { value: 0 },
13711
- uvTransform: { value: new Matrix3() }
13568
+ uvTransform: { value: /*@__PURE__*/ new Matrix3() }
13712
13569
 
13713
13570
  }
13714
13571
 
@@ -13718,7 +13575,7 @@
13718
13575
 
13719
13576
  basic: {
13720
13577
 
13721
- uniforms: mergeUniforms( [
13578
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13722
13579
  UniformsLib.common,
13723
13580
  UniformsLib.specularmap,
13724
13581
  UniformsLib.envmap,
@@ -13734,7 +13591,7 @@
13734
13591
 
13735
13592
  lambert: {
13736
13593
 
13737
- uniforms: mergeUniforms( [
13594
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13738
13595
  UniformsLib.common,
13739
13596
  UniformsLib.specularmap,
13740
13597
  UniformsLib.envmap,
@@ -13744,7 +13601,7 @@
13744
13601
  UniformsLib.fog,
13745
13602
  UniformsLib.lights,
13746
13603
  {
13747
- emissive: { value: new Color$1( 0x000000 ) }
13604
+ emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) }
13748
13605
  }
13749
13606
  ] ),
13750
13607
 
@@ -13755,7 +13612,7 @@
13755
13612
 
13756
13613
  phong: {
13757
13614
 
13758
- uniforms: mergeUniforms( [
13615
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13759
13616
  UniformsLib.common,
13760
13617
  UniformsLib.specularmap,
13761
13618
  UniformsLib.envmap,
@@ -13768,8 +13625,8 @@
13768
13625
  UniformsLib.fog,
13769
13626
  UniformsLib.lights,
13770
13627
  {
13771
- emissive: { value: new Color$1( 0x000000 ) },
13772
- specular: { value: new Color$1( 0x111111 ) },
13628
+ emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
13629
+ specular: { value: /*@__PURE__*/ new Color$1( 0x111111 ) },
13773
13630
  shininess: { value: 30 }
13774
13631
  }
13775
13632
  ] ),
@@ -13781,7 +13638,7 @@
13781
13638
 
13782
13639
  standard: {
13783
13640
 
13784
- uniforms: mergeUniforms( [
13641
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13785
13642
  UniformsLib.common,
13786
13643
  UniformsLib.envmap,
13787
13644
  UniformsLib.aomap,
@@ -13795,7 +13652,7 @@
13795
13652
  UniformsLib.fog,
13796
13653
  UniformsLib.lights,
13797
13654
  {
13798
- emissive: { value: new Color$1( 0x000000 ) },
13655
+ emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
13799
13656
  roughness: { value: 1.0 },
13800
13657
  metalness: { value: 0.0 },
13801
13658
  envMapIntensity: { value: 1 } // temporary
@@ -13809,7 +13666,7 @@
13809
13666
 
13810
13667
  toon: {
13811
13668
 
13812
- uniforms: mergeUniforms( [
13669
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13813
13670
  UniformsLib.common,
13814
13671
  UniformsLib.aomap,
13815
13672
  UniformsLib.lightmap,
@@ -13821,7 +13678,7 @@
13821
13678
  UniformsLib.fog,
13822
13679
  UniformsLib.lights,
13823
13680
  {
13824
- emissive: { value: new Color$1( 0x000000 ) }
13681
+ emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) }
13825
13682
  }
13826
13683
  ] ),
13827
13684
 
@@ -13832,7 +13689,7 @@
13832
13689
 
13833
13690
  matcap: {
13834
13691
 
13835
- uniforms: mergeUniforms( [
13692
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13836
13693
  UniformsLib.common,
13837
13694
  UniformsLib.bumpmap,
13838
13695
  UniformsLib.normalmap,
@@ -13850,7 +13707,7 @@
13850
13707
 
13851
13708
  points: {
13852
13709
 
13853
- uniforms: mergeUniforms( [
13710
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13854
13711
  UniformsLib.points,
13855
13712
  UniformsLib.fog
13856
13713
  ] ),
@@ -13862,7 +13719,7 @@
13862
13719
 
13863
13720
  dashed: {
13864
13721
 
13865
- uniforms: mergeUniforms( [
13722
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13866
13723
  UniformsLib.common,
13867
13724
  UniformsLib.fog,
13868
13725
  {
@@ -13879,7 +13736,7 @@
13879
13736
 
13880
13737
  depth: {
13881
13738
 
13882
- uniforms: mergeUniforms( [
13739
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13883
13740
  UniformsLib.common,
13884
13741
  UniformsLib.displacementmap
13885
13742
  ] ),
@@ -13891,7 +13748,7 @@
13891
13748
 
13892
13749
  normal: {
13893
13750
 
13894
- uniforms: mergeUniforms( [
13751
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13895
13752
  UniformsLib.common,
13896
13753
  UniformsLib.bumpmap,
13897
13754
  UniformsLib.normalmap,
@@ -13908,7 +13765,7 @@
13908
13765
 
13909
13766
  sprite: {
13910
13767
 
13911
- uniforms: mergeUniforms( [
13768
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13912
13769
  UniformsLib.sprite,
13913
13770
  UniformsLib.fog
13914
13771
  ] ),
@@ -13921,7 +13778,7 @@
13921
13778
  background: {
13922
13779
 
13923
13780
  uniforms: {
13924
- uvTransform: { value: new Matrix3() },
13781
+ uvTransform: { value: /*@__PURE__*/ new Matrix3() },
13925
13782
  t2D: { value: null },
13926
13783
  },
13927
13784
 
@@ -13929,13 +13786,10 @@
13929
13786
  fragmentShader: ShaderChunk.background_frag
13930
13787
 
13931
13788
  },
13932
- /* -------------------------------------------------------------------------
13933
- // Cube map shader
13934
- ------------------------------------------------------------------------- */
13935
13789
 
13936
13790
  cube: {
13937
13791
 
13938
- uniforms: mergeUniforms( [
13792
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13939
13793
  UniformsLib.envmap,
13940
13794
  {
13941
13795
  opacity: { value: 1.0 }
@@ -13960,11 +13814,11 @@
13960
13814
 
13961
13815
  distanceRGBA: {
13962
13816
 
13963
- uniforms: mergeUniforms( [
13817
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13964
13818
  UniformsLib.common,
13965
13819
  UniformsLib.displacementmap,
13966
13820
  {
13967
- referencePosition: { value: new Vector3() },
13821
+ referencePosition: { value: /*@__PURE__*/ new Vector3() },
13968
13822
  nearDistance: { value: 1 },
13969
13823
  farDistance: { value: 1000 }
13970
13824
  }
@@ -13977,11 +13831,11 @@
13977
13831
 
13978
13832
  shadow: {
13979
13833
 
13980
- uniforms: mergeUniforms( [
13834
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13981
13835
  UniformsLib.lights,
13982
13836
  UniformsLib.fog,
13983
13837
  {
13984
- color: { value: new Color$1( 0x00000 ) },
13838
+ color: { value: /*@__PURE__*/ new Color$1( 0x00000 ) },
13985
13839
  opacity: { value: 1.0 }
13986
13840
  },
13987
13841
  ] ),
@@ -13995,14 +13849,14 @@
13995
13849
 
13996
13850
  ShaderLib.physical = {
13997
13851
 
13998
- uniforms: mergeUniforms( [
13852
+ uniforms: /*@__PURE__*/ mergeUniforms( [
13999
13853
  ShaderLib.standard.uniforms,
14000
13854
  {
14001
13855
  clearcoat: { value: 0 },
14002
13856
  clearcoatMap: { value: null },
14003
13857
  clearcoatRoughness: { value: 0 },
14004
13858
  clearcoatRoughnessMap: { value: null },
14005
- clearcoatNormalScale: { value: new Vector2( 1, 1 ) },
13859
+ clearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },
14006
13860
  clearcoatNormalMap: { value: null },
14007
13861
  iridescence: { value: 0 },
14008
13862
  iridescenceMap: { value: null },
@@ -14011,21 +13865,21 @@
14011
13865
  iridescenceThicknessMaximum: { value: 400 },
14012
13866
  iridescenceThicknessMap: { value: null },
14013
13867
  sheen: { value: 0 },
14014
- sheenColor: { value: new Color$1( 0x000000 ) },
13868
+ sheenColor: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
14015
13869
  sheenColorMap: { value: null },
14016
13870
  sheenRoughness: { value: 1 },
14017
13871
  sheenRoughnessMap: { value: null },
14018
13872
  transmission: { value: 0 },
14019
13873
  transmissionMap: { value: null },
14020
- transmissionSamplerSize: { value: new Vector2() },
13874
+ transmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },
14021
13875
  transmissionSamplerMap: { value: null },
14022
13876
  thickness: { value: 0 },
14023
13877
  thicknessMap: { value: null },
14024
13878
  attenuationDistance: { value: 0 },
14025
- attenuationColor: { value: new Color$1( 0x000000 ) },
13879
+ attenuationColor: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
14026
13880
  specularIntensity: { value: 1 },
14027
13881
  specularIntensityMap: { value: null },
14028
- specularColor: { value: new Color$1( 1, 1, 1 ) },
13882
+ specularColor: { value: /*@__PURE__*/ new Color$1( 1, 1, 1 ) },
14029
13883
  specularColorMap: { value: null },
14030
13884
  }
14031
13885
  ] ),
@@ -16882,6 +16736,8 @@
16882
16736
  const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
16883
16737
 
16884
16738
  if ( array instanceof Int8Array ) denominator = 127;
16739
+ else if ( array instanceof Uint8Array ) denominator = 255;
16740
+ else if ( array instanceof Uint16Array ) denominator = 65535;
16885
16741
  else if ( array instanceof Int16Array ) denominator = 32767;
16886
16742
  else if ( array instanceof Int32Array ) denominator = 2147483647;
16887
16743
  else console.error( 'THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array );
@@ -17290,10 +17146,10 @@
17290
17146
  *
17291
17147
  */
17292
17148
 
17293
- const emptyTexture = new Texture();
17294
- const emptyArrayTexture = new DataArrayTexture();
17295
- const empty3dTexture = new Data3DTexture();
17296
- const emptyCubeTexture = new CubeTexture();
17149
+ const emptyTexture = /*@__PURE__*/ new Texture();
17150
+ const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
17151
+ const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
17152
+ const emptyCubeTexture = /*@__PURE__*/ new CubeTexture();
17297
17153
 
17298
17154
  // --- Utilities ---
17299
17155
 
@@ -20703,7 +20559,7 @@
20703
20559
 
20704
20560
  let renderStates = new WeakMap();
20705
20561
 
20706
- function get( scene, renderCallDepth ) {
20562
+ function get( scene, renderCallDepth = 0 ) {
20707
20563
 
20708
20564
  let renderState;
20709
20565
 
@@ -20965,20 +20821,9 @@
20965
20821
 
20966
20822
  }
20967
20823
 
20968
- if ( shadow.map === null && ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {
20969
-
20970
- shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );
20971
- shadow.map.texture.name = light.name + '.shadowMap';
20972
-
20973
- shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );
20974
-
20975
- shadow.camera.updateProjectionMatrix();
20976
-
20977
- }
20978
-
20979
20824
  if ( shadow.map === null ) {
20980
20825
 
20981
- const pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
20826
+ const pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};
20982
20827
 
20983
20828
  shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
20984
20829
  shadow.map.texture.name = light.name + '.shadowMap';
@@ -21015,7 +20860,7 @@
21015
20860
 
21016
20861
  // do blur pass for VSM
21017
20862
 
21018
- if ( ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {
20863
+ if ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {
21019
20864
 
21020
20865
  VSMPass( shadow, camera );
21021
20866
 
@@ -21045,6 +20890,12 @@
21045
20890
 
21046
20891
  }
21047
20892
 
20893
+ if ( shadow.mapPass === null ) {
20894
+
20895
+ shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );
20896
+
20897
+ }
20898
+
21048
20899
  // vertical pass
21049
20900
 
21050
20901
  shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
@@ -21081,7 +20932,7 @@
21081
20932
 
21082
20933
  }
21083
20934
 
21084
- if ( ( _renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 ) ||
20935
+ if ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
21085
20936
  ( material.displacementMap && material.displacementScale !== 0 ) ||
21086
20937
  ( material.alphaMap && material.alphaTest > 0 ) ) {
21087
20938
 
@@ -21522,6 +21373,9 @@
21522
21373
  const depthBuffer = new DepthBuffer();
21523
21374
  const stencilBuffer = new StencilBuffer();
21524
21375
 
21376
+ const uboBindings = new WeakMap();
21377
+ const uboProgamMap = new WeakMap();
21378
+
21525
21379
  let enabledCapabilities = {};
21526
21380
 
21527
21381
  let currentBoundFramebuffers = {};
@@ -22272,6 +22126,47 @@
22272
22126
 
22273
22127
  }
22274
22128
 
22129
+ function updateUBOMapping( uniformsGroup, program ) {
22130
+
22131
+ let mapping = uboProgamMap.get( program );
22132
+
22133
+ if ( mapping === undefined ) {
22134
+
22135
+ mapping = new WeakMap();
22136
+
22137
+ uboProgamMap.set( program, mapping );
22138
+
22139
+ }
22140
+
22141
+ let blockIndex = mapping.get( uniformsGroup );
22142
+
22143
+ if ( blockIndex === undefined ) {
22144
+
22145
+ blockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );
22146
+
22147
+ mapping.set( uniformsGroup, blockIndex );
22148
+
22149
+ }
22150
+
22151
+ }
22152
+
22153
+ function uniformBlockBinding( uniformsGroup, program ) {
22154
+
22155
+ const mapping = uboProgamMap.get( program );
22156
+ const blockIndex = mapping.get( uniformsGroup );
22157
+
22158
+ if ( uboBindings.get( uniformsGroup ) !== blockIndex ) {
22159
+
22160
+ // bind shader specific block index to global block point
22161
+
22162
+ gl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );
22163
+
22164
+ uboBindings.set( uniformsGroup, blockIndex );
22165
+
22166
+ }
22167
+
22168
+ }
22169
+
22275
22170
  //
22276
22171
 
22277
22172
  function reset() {
@@ -22399,6 +22294,9 @@
22399
22294
  texImage2D: texImage2D,
22400
22295
  texImage3D: texImage3D,
22401
22296
 
22297
+ updateUBOMapping: updateUBOMapping,
22298
+ uniformBlockBinding: uniformBlockBinding,
22299
+
22402
22300
  texStorage2D: texStorage2D,
22403
22301
  texStorage3D: texStorage3D,
22404
22302
  texSubImage2D: texSubImage2D,
@@ -24354,7 +24252,7 @@
24354
24252
 
24355
24253
  const isWebGL2 = capabilities.isWebGL2;
24356
24254
 
24357
- function convert( p, encoding ) {
24255
+ function convert( p, encoding = null ) {
24358
24256
 
24359
24257
  let extension;
24360
24258
 
@@ -24765,10 +24663,121 @@
24765
24663
 
24766
24664
  if ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {
24767
24665
 
24666
+ if ( hand && inputSource.hand ) {
24667
+
24668
+ handPose = true;
24669
+
24670
+ for ( const inputjoint of inputSource.hand.values() ) {
24671
+
24672
+ // Update the joints groups with the XRJoint poses
24673
+ const jointPose = frame.getJointPose( inputjoint, referenceSpace );
24674
+
24675
+ if ( hand.joints[ inputjoint.jointName ] === undefined ) {
24676
+
24677
+ // The transform of this joint will be updated with the joint pose on each frame
24678
+ const joint = new Group$1();
24679
+ joint.matrixAutoUpdate = false;
24680
+ joint.visible = false;
24681
+ hand.joints[ inputjoint.jointName ] = joint;
24682
+ // ??
24683
+ hand.add( joint );
24684
+
24685
+ }
24686
+
24687
+ const joint = hand.joints[ inputjoint.jointName ];
24688
+
24689
+ if ( jointPose !== null ) {
24690
+
24691
+ joint.matrix.fromArray( jointPose.transform.matrix );
24692
+ joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
24693
+ joint.jointRadius = jointPose.radius;
24694
+
24695
+ }
24696
+
24697
+ joint.visible = jointPose !== null;
24698
+
24699
+ }
24700
+
24701
+ // Custom events
24702
+
24703
+ // Check pinchz
24704
+ const indexTip = hand.joints[ 'index-finger-tip' ];
24705
+ const thumbTip = hand.joints[ 'thumb-tip' ];
24706
+ const distance = indexTip.position.distanceTo( thumbTip.position );
24707
+
24708
+ const distanceToPinch = 0.02;
24709
+ const threshold = 0.005;
24710
+
24711
+ if ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {
24712
+
24713
+ hand.inputState.pinching = false;
24714
+ this.dispatchEvent( {
24715
+ type: 'pinchend',
24716
+ handedness: inputSource.handedness,
24717
+ target: this
24718
+ } );
24719
+
24720
+ } else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {
24721
+
24722
+ hand.inputState.pinching = true;
24723
+ this.dispatchEvent( {
24724
+ type: 'pinchstart',
24725
+ handedness: inputSource.handedness,
24726
+ target: this
24727
+ } );
24728
+
24729
+ }
24730
+
24731
+ } else {
24732
+
24733
+ if ( grip !== null && inputSource.gripSpace ) {
24734
+
24735
+ gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
24736
+
24737
+ if ( gripPose !== null ) {
24738
+
24739
+ grip.matrix.fromArray( gripPose.transform.matrix );
24740
+ grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
24741
+
24742
+ if ( gripPose.linearVelocity ) {
24743
+
24744
+ grip.hasLinearVelocity = true;
24745
+ grip.linearVelocity.copy( gripPose.linearVelocity );
24746
+
24747
+ } else {
24748
+
24749
+ grip.hasLinearVelocity = false;
24750
+
24751
+ }
24752
+
24753
+ if ( gripPose.angularVelocity ) {
24754
+
24755
+ grip.hasAngularVelocity = true;
24756
+ grip.angularVelocity.copy( gripPose.angularVelocity );
24757
+
24758
+ } else {
24759
+
24760
+ grip.hasAngularVelocity = false;
24761
+
24762
+ }
24763
+
24764
+ }
24765
+
24766
+ }
24767
+
24768
+ }
24769
+
24768
24770
  if ( targetRay !== null ) {
24769
24771
 
24770
24772
  inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
24771
24773
 
24774
+ // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
24775
+ if ( inputPose === null && gripPose !== null ) {
24776
+
24777
+ inputPose = gripPose;
24778
+
24779
+ }
24780
+
24772
24781
  if ( inputPose !== null ) {
24773
24782
 
24774
24783
  targetRay.matrix.fromArray( inputPose.transform.matrix );
@@ -24802,109 +24811,6 @@
24802
24811
 
24803
24812
  }
24804
24813
 
24805
- if ( hand && inputSource.hand ) {
24806
-
24807
- handPose = true;
24808
-
24809
- for ( const inputjoint of inputSource.hand.values() ) {
24810
-
24811
- // Update the joints groups with the XRJoint poses
24812
- const jointPose = frame.getJointPose( inputjoint, referenceSpace );
24813
-
24814
- if ( hand.joints[ inputjoint.jointName ] === undefined ) {
24815
-
24816
- // The transform of this joint will be updated with the joint pose on each frame
24817
- const joint = new Group$1();
24818
- joint.matrixAutoUpdate = false;
24819
- joint.visible = false;
24820
- hand.joints[ inputjoint.jointName ] = joint;
24821
- // ??
24822
- hand.add( joint );
24823
-
24824
- }
24825
-
24826
- const joint = hand.joints[ inputjoint.jointName ];
24827
-
24828
- if ( jointPose !== null ) {
24829
-
24830
- joint.matrix.fromArray( jointPose.transform.matrix );
24831
- joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
24832
- joint.jointRadius = jointPose.radius;
24833
-
24834
- }
24835
-
24836
- joint.visible = jointPose !== null;
24837
-
24838
- }
24839
-
24840
- // Custom events
24841
-
24842
- // Check pinchz
24843
- const indexTip = hand.joints[ 'index-finger-tip' ];
24844
- const thumbTip = hand.joints[ 'thumb-tip' ];
24845
- const distance = indexTip.position.distanceTo( thumbTip.position );
24846
-
24847
- const distanceToPinch = 0.02;
24848
- const threshold = 0.005;
24849
-
24850
- if ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {
24851
-
24852
- hand.inputState.pinching = false;
24853
- this.dispatchEvent( {
24854
- type: 'pinchend',
24855
- handedness: inputSource.handedness,
24856
- target: this
24857
- } );
24858
-
24859
- } else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {
24860
-
24861
- hand.inputState.pinching = true;
24862
- this.dispatchEvent( {
24863
- type: 'pinchstart',
24864
- handedness: inputSource.handedness,
24865
- target: this
24866
- } );
24867
-
24868
- }
24869
-
24870
- } else {
24871
-
24872
- if ( grip !== null && inputSource.gripSpace ) {
24873
-
24874
- gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
24875
-
24876
- if ( gripPose !== null ) {
24877
-
24878
- grip.matrix.fromArray( gripPose.transform.matrix );
24879
- grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
24880
-
24881
- if ( gripPose.linearVelocity ) {
24882
-
24883
- grip.hasLinearVelocity = true;
24884
- grip.linearVelocity.copy( gripPose.linearVelocity );
24885
-
24886
- } else {
24887
-
24888
- grip.hasLinearVelocity = false;
24889
-
24890
- }
24891
-
24892
- if ( gripPose.angularVelocity ) {
24893
-
24894
- grip.hasAngularVelocity = true;
24895
- grip.angularVelocity.copy( gripPose.angularVelocity );
24896
-
24897
- } else {
24898
-
24899
- grip.hasAngularVelocity = false;
24900
-
24901
- }
24902
-
24903
- }
24904
-
24905
- }
24906
-
24907
- }
24908
24814
 
24909
24815
  }
24910
24816
 
@@ -24989,7 +24895,7 @@
24989
24895
  let newRenderTarget = null;
24990
24896
 
24991
24897
  const controllers = [];
24992
- const inputSourcesMap = new Map();
24898
+ const controllerInputSources = [];
24993
24899
 
24994
24900
  //
24995
24901
 
@@ -25066,7 +24972,15 @@
25066
24972
 
25067
24973
  function onSessionEvent( event ) {
25068
24974
 
25069
- const controller = inputSourcesMap.get( event.inputSource );
24975
+ const controllerIndex = controllerInputSources.indexOf( event.inputSource );
24976
+
24977
+ if ( controllerIndex === - 1 ) {
24978
+
24979
+ return;
24980
+
24981
+ }
24982
+
24983
+ const controller = controllers[ controllerIndex ];
25070
24984
 
25071
24985
  if ( controller !== undefined ) {
25072
24986
 
@@ -25087,17 +25001,17 @@
25087
25001
  session.removeEventListener( 'end', onSessionEnd );
25088
25002
  session.removeEventListener( 'inputsourceschange', onInputSourcesChange );
25089
25003
 
25090
- inputSourcesMap.forEach( function ( controller, inputSource ) {
25004
+ for ( let i = 0; i < controllers.length; i ++ ) {
25091
25005
 
25092
- if ( controller !== undefined ) {
25006
+ const inputSource = controllerInputSources[ i ];
25093
25007
 
25094
- controller.disconnect( inputSource );
25008
+ if ( inputSource === null ) continue;
25095
25009
 
25096
- }
25010
+ controllerInputSources[ i ] = null;
25097
25011
 
25098
- } );
25012
+ controllers[ i ].disconnect( inputSource );
25099
25013
 
25100
- inputSourcesMap.clear();
25014
+ }
25101
25015
 
25102
25016
  _currentDepthNear = null;
25103
25017
  _currentDepthFar = null;
@@ -25244,7 +25158,7 @@
25244
25158
  }
25245
25159
 
25246
25160
  const projectionlayerInit = {
25247
- colorFormat: ( renderer.outputEncoding === sRGBEncoding ) ? 35907 : 32856,
25161
+ colorFormat: 32856,
25248
25162
  depthFormat: glDepthFormat,
25249
25163
  scaleFactor: framebufferScaleFactor
25250
25164
  };
@@ -25293,28 +25207,17 @@
25293
25207
 
25294
25208
  function onInputSourcesChange( event ) {
25295
25209
 
25296
- const inputSources = session.inputSources;
25297
-
25298
- // Assign controllers to available inputSources
25299
-
25300
- for ( let i = 0; i < inputSources.length; i ++ ) {
25301
-
25302
- const index = inputSources[ i ].handedness === 'right' ? 1 : 0;
25303
- inputSourcesMap.set( inputSources[ i ], controllers[ index ] );
25304
-
25305
- }
25306
-
25307
25210
  // Notify disconnected
25308
25211
 
25309
25212
  for ( let i = 0; i < event.removed.length; i ++ ) {
25310
25213
 
25311
25214
  const inputSource = event.removed[ i ];
25312
- const controller = inputSourcesMap.get( inputSource );
25215
+ const index = controllerInputSources.indexOf( inputSource );
25313
25216
 
25314
- if ( controller ) {
25217
+ if ( index >= 0 ) {
25315
25218
 
25316
- controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
25317
- inputSourcesMap.delete( inputSource );
25219
+ controllerInputSources[ index ] = null;
25220
+ controllers[ index ].dispatchEvent( { type: 'disconnected', data: inputSource } );
25318
25221
 
25319
25222
  }
25320
25223
 
@@ -25325,7 +25228,38 @@
25325
25228
  for ( let i = 0; i < event.added.length; i ++ ) {
25326
25229
 
25327
25230
  const inputSource = event.added[ i ];
25328
- const controller = inputSourcesMap.get( inputSource );
25231
+
25232
+ let controllerIndex = controllerInputSources.indexOf( inputSource );
25233
+
25234
+ if ( controllerIndex === - 1 ) {
25235
+
25236
+ // Assign input source a controller that currently has no input source
25237
+
25238
+ for ( let i = 0; i < controllers.length; i ++ ) {
25239
+
25240
+ if ( i >= controllerInputSources.length ) {
25241
+
25242
+ controllerInputSources.push( inputSource );
25243
+ controllerIndex = i;
25244
+ break;
25245
+
25246
+ } else if ( controllerInputSources[ i ] === null ) {
25247
+
25248
+ controllerInputSources[ i ] = inputSource;
25249
+ controllerIndex = i;
25250
+ break;
25251
+
25252
+ }
25253
+
25254
+ }
25255
+
25256
+ // If all controllers do currently receive input we ignore new ones
25257
+
25258
+ if ( controllerIndex === - 1 ) break;
25259
+
25260
+ }
25261
+
25262
+ const controller = controllers[ controllerIndex ];
25329
25263
 
25330
25264
  if ( controller ) {
25331
25265
 
@@ -25615,14 +25549,12 @@
25615
25549
 
25616
25550
  //
25617
25551
 
25618
- const inputSources = session.inputSources;
25619
-
25620
25552
  for ( let i = 0; i < controllers.length; i ++ ) {
25621
25553
 
25622
- const inputSource = inputSources[ i ];
25623
- const controller = inputSourcesMap.get( inputSource );
25554
+ const inputSource = controllerInputSources[ i ];
25555
+ const controller = controllers[ i ];
25624
25556
 
25625
- if ( controller !== undefined ) {
25557
+ if ( inputSource !== null && controller !== undefined ) {
25626
25558
 
25627
25559
  controller.update( inputSource, frame, customReferenceSpace || referenceSpace );
25628
25560
 
@@ -26326,6 +26258,376 @@
26326
26258
 
26327
26259
  }
26328
26260
 
26261
+ function WebGLUniformsGroups( gl, info, capabilities, state ) {
26262
+
26263
+ let buffers = {};
26264
+ let updateList = {};
26265
+ let allocatedBindingPoints = [];
26266
+
26267
+ const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( 35375 ) : 0; // binding points are global whereas block indices are per shader program
26268
+
26269
+ function bind( uniformsGroup, program ) {
26270
+
26271
+ const webglProgram = program.program;
26272
+ state.uniformBlockBinding( uniformsGroup, webglProgram );
26273
+
26274
+ }
26275
+
26276
+ function update( uniformsGroup, program ) {
26277
+
26278
+ let buffer = buffers[ uniformsGroup.id ];
26279
+
26280
+ if ( buffer === undefined ) {
26281
+
26282
+ prepareUniformsGroup( uniformsGroup );
26283
+
26284
+ buffer = createBuffer( uniformsGroup );
26285
+ buffers[ uniformsGroup.id ] = buffer;
26286
+
26287
+ uniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );
26288
+
26289
+ }
26290
+
26291
+ // ensure to update the binding points/block indices mapping for this program
26292
+
26293
+ const webglProgram = program.program;
26294
+ state.updateUBOMapping( uniformsGroup, webglProgram );
26295
+
26296
+ // update UBO once per frame
26297
+
26298
+ const frame = info.render.frame;
26299
+
26300
+ if ( updateList[ uniformsGroup.id ] !== frame ) {
26301
+
26302
+ updateBufferData( uniformsGroup );
26303
+
26304
+ updateList[ uniformsGroup.id ] = frame;
26305
+
26306
+ }
26307
+
26308
+ }
26309
+
26310
+ function createBuffer( uniformsGroup ) {
26311
+
26312
+ // the setup of an UBO is independent of a particular shader program but global
26313
+
26314
+ const bindingPointIndex = allocateBindingPointIndex();
26315
+ uniformsGroup.__bindingPointIndex = bindingPointIndex;
26316
+
26317
+ const buffer = gl.createBuffer();
26318
+ const size = uniformsGroup.__size;
26319
+ const usage = uniformsGroup.usage;
26320
+
26321
+ gl.bindBuffer( 35345, buffer );
26322
+ gl.bufferData( 35345, size, usage );
26323
+ gl.bindBuffer( 35345, null );
26324
+ gl.bindBufferBase( 35345, bindingPointIndex, buffer );
26325
+
26326
+ return buffer;
26327
+
26328
+ }
26329
+
26330
+ function allocateBindingPointIndex() {
26331
+
26332
+ for ( let i = 0; i < maxBindingPoints; i ++ ) {
26333
+
26334
+ if ( allocatedBindingPoints.indexOf( i ) === - 1 ) {
26335
+
26336
+ allocatedBindingPoints.push( i );
26337
+ return i;
26338
+
26339
+ }
26340
+
26341
+ }
26342
+
26343
+ console.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );
26344
+
26345
+ return 0;
26346
+
26347
+ }
26348
+
26349
+ function updateBufferData( uniformsGroup ) {
26350
+
26351
+ const buffer = buffers[ uniformsGroup.id ];
26352
+ const uniforms = uniformsGroup.uniforms;
26353
+ const cache = uniformsGroup.__cache;
26354
+
26355
+ gl.bindBuffer( 35345, buffer );
26356
+
26357
+ for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
26358
+
26359
+ const uniform = uniforms[ i ];
26360
+
26361
+ // partly update the buffer if necessary
26362
+
26363
+ if ( hasUniformChanged( uniform, i, cache ) === true ) {
26364
+
26365
+ const value = uniform.value;
26366
+ const offset = uniform.__offset;
26367
+
26368
+ if ( typeof value === 'number' ) {
26369
+
26370
+ uniform.__data[ 0 ] = value;
26371
+ gl.bufferSubData( 35345, offset, uniform.__data );
26372
+
26373
+ } else {
26374
+
26375
+ if ( uniform.value.isMatrix3 ) {
26376
+
26377
+ // manually converting 3x3 to 3x4
26378
+
26379
+ uniform.__data[ 0 ] = uniform.value.elements[ 0 ];
26380
+ uniform.__data[ 1 ] = uniform.value.elements[ 1 ];
26381
+ uniform.__data[ 2 ] = uniform.value.elements[ 2 ];
26382
+ uniform.__data[ 3 ] = uniform.value.elements[ 0 ];
26383
+ uniform.__data[ 4 ] = uniform.value.elements[ 3 ];
26384
+ uniform.__data[ 5 ] = uniform.value.elements[ 4 ];
26385
+ uniform.__data[ 6 ] = uniform.value.elements[ 5 ];
26386
+ uniform.__data[ 7 ] = uniform.value.elements[ 0 ];
26387
+ uniform.__data[ 8 ] = uniform.value.elements[ 6 ];
26388
+ uniform.__data[ 9 ] = uniform.value.elements[ 7 ];
26389
+ uniform.__data[ 10 ] = uniform.value.elements[ 8 ];
26390
+ uniform.__data[ 11 ] = uniform.value.elements[ 0 ];
26391
+
26392
+ } else {
26393
+
26394
+ value.toArray( uniform.__data );
26395
+
26396
+ }
26397
+
26398
+ gl.bufferSubData( 35345, offset, uniform.__data );
26399
+
26400
+ }
26401
+
26402
+ }
26403
+
26404
+ }
26405
+
26406
+ gl.bindBuffer( 35345, null );
26407
+
26408
+ }
26409
+
26410
+ function hasUniformChanged( uniform, index, cache ) {
26411
+
26412
+ const value = uniform.value;
26413
+
26414
+ if ( cache[ index ] === undefined ) {
26415
+
26416
+ // cache entry does not exist so far
26417
+
26418
+ if ( typeof value === 'number' ) {
26419
+
26420
+ cache[ index ] = value;
26421
+
26422
+ } else {
26423
+
26424
+ cache[ index ] = value.clone();
26425
+
26426
+ }
26427
+
26428
+ return true;
26429
+
26430
+ } else {
26431
+
26432
+ // compare current value with cached entry
26433
+
26434
+ if ( typeof value === 'number' ) {
26435
+
26436
+ if ( cache[ index ] !== value ) {
26437
+
26438
+ cache[ index ] = value;
26439
+ return true;
26440
+
26441
+ }
26442
+
26443
+ } else {
26444
+
26445
+ const cachedObject = cache[ index ];
26446
+
26447
+ if ( cachedObject.equals( value ) === false ) {
26448
+
26449
+ cachedObject.copy( value );
26450
+ return true;
26451
+
26452
+ }
26453
+
26454
+ }
26455
+
26456
+ }
26457
+
26458
+ return false;
26459
+
26460
+ }
26461
+
26462
+ function prepareUniformsGroup( uniformsGroup ) {
26463
+
26464
+ // determine total buffer size according to the STD140 layout
26465
+ // Hint: STD140 is the only supported layout in WebGL 2
26466
+
26467
+ const uniforms = uniformsGroup.uniforms;
26468
+
26469
+ let offset = 0; // global buffer offset in bytes
26470
+ const chunkSize = 16; // size of a chunk in bytes
26471
+ let chunkOffset = 0; // offset within a single chunk in bytes
26472
+
26473
+ for ( let i = 0, l = uniforms.length; i < l; i ++ ) {
26474
+
26475
+ const uniform = uniforms[ i ];
26476
+ const info = getUniformSize( uniform );
26477
+
26478
+ // the following two properties will be used for partial buffer updates
26479
+
26480
+ uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
26481
+ uniform.__offset = offset;
26482
+
26483
+ //
26484
+
26485
+ if ( i > 0 ) {
26486
+
26487
+ chunkOffset = offset % chunkSize;
26488
+
26489
+ const remainingSizeInChunk = chunkSize - chunkOffset;
26490
+
26491
+ // check for chunk overflow
26492
+
26493
+ if ( chunkOffset !== 0 && ( remainingSizeInChunk - info.boundary ) < 0 ) {
26494
+
26495
+ // add padding and adjust offset
26496
+
26497
+ offset += ( chunkSize - chunkOffset );
26498
+ uniform.__offset = offset;
26499
+
26500
+ }
26501
+
26502
+ }
26503
+
26504
+ offset += info.storage;
26505
+
26506
+ }
26507
+
26508
+ // ensure correct final padding
26509
+
26510
+ chunkOffset = offset % chunkSize;
26511
+
26512
+ if ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );
26513
+
26514
+ //
26515
+
26516
+ uniformsGroup.__size = offset;
26517
+ uniformsGroup.__cache = {};
26518
+
26519
+ return this;
26520
+
26521
+ }
26522
+
26523
+ function getUniformSize( uniform ) {
26524
+
26525
+ const value = uniform.value;
26526
+
26527
+ const info = {
26528
+ boundary: 0, // bytes
26529
+ storage: 0 // bytes
26530
+ };
26531
+
26532
+ // determine sizes according to STD140
26533
+
26534
+ if ( typeof value === 'number' ) {
26535
+
26536
+ // float/int
26537
+
26538
+ info.boundary = 4;
26539
+ info.storage = 4;
26540
+
26541
+ } else if ( value.isVector2 ) {
26542
+
26543
+ // vec2
26544
+
26545
+ info.boundary = 8;
26546
+ info.storage = 8;
26547
+
26548
+ } else if ( value.isVector3 || value.isColor ) {
26549
+
26550
+ // vec3
26551
+
26552
+ info.boundary = 16;
26553
+ info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes
26554
+
26555
+ } else if ( value.isVector4 ) {
26556
+
26557
+ // vec4
26558
+
26559
+ info.boundary = 16;
26560
+ info.storage = 16;
26561
+
26562
+ } else if ( value.isMatrix3 ) {
26563
+
26564
+ // mat3 (in STD140 a 3x3 matrix is represented as 3x4)
26565
+
26566
+ info.boundary = 48;
26567
+ info.storage = 48;
26568
+
26569
+ } else if ( value.isMatrix4 ) {
26570
+
26571
+ // mat4
26572
+
26573
+ info.boundary = 64;
26574
+ info.storage = 64;
26575
+
26576
+ } else if ( value.isTexture ) {
26577
+
26578
+ console.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
26579
+
26580
+ } else {
26581
+
26582
+ console.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );
26583
+
26584
+ }
26585
+
26586
+ return info;
26587
+
26588
+ }
26589
+
26590
+ function onUniformsGroupsDispose( event ) {
26591
+
26592
+ const uniformsGroup = event.target;
26593
+
26594
+ uniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );
26595
+
26596
+ const index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );
26597
+ allocatedBindingPoints.splice( index, 1 );
26598
+
26599
+ gl.deleteBuffer( buffers[ uniformsGroup.id ] );
26600
+
26601
+ delete buffers[ uniformsGroup.id ];
26602
+ delete updateList[ uniformsGroup.id ];
26603
+
26604
+ }
26605
+
26606
+ function dispose() {
26607
+
26608
+ for ( const id in buffers ) {
26609
+
26610
+ gl.deleteBuffer( buffers[ id ] );
26611
+
26612
+ }
26613
+
26614
+ allocatedBindingPoints = [];
26615
+ buffers = {};
26616
+ updateList = {};
26617
+
26618
+ }
26619
+
26620
+ return {
26621
+
26622
+ bind: bind,
26623
+ update: update,
26624
+
26625
+ dispose: dispose
26626
+
26627
+ };
26628
+
26629
+ }
26630
+
26329
26631
  function createCanvasElement() {
26330
26632
 
26331
26633
  const canvas = createElementNS( 'canvas' );
@@ -26587,7 +26889,7 @@
26587
26889
 
26588
26890
  let background, morphtargets, bufferRenderer, indexedBufferRenderer;
26589
26891
 
26590
- let utils, bindingStates;
26892
+ let utils, bindingStates, uniformsGroups;
26591
26893
 
26592
26894
  function initGLContext() {
26593
26895
 
@@ -26601,7 +26903,7 @@
26601
26903
 
26602
26904
  state = new WebGLState( _gl, extensions, capabilities );
26603
26905
 
26604
- info = new WebGLInfo( _gl );
26906
+ info = new WebGLInfo();
26605
26907
  properties = new WebGLProperties();
26606
26908
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
26607
26909
  cubemaps = new WebGLCubeMaps( _this );
@@ -26618,6 +26920,7 @@
26618
26920
  renderStates = new WebGLRenderStates( extensions, capabilities );
26619
26921
  background = new WebGLBackground( _this, cubemaps, state, objects, _alpha, _premultipliedAlpha );
26620
26922
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
26923
+ uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
26621
26924
 
26622
26925
  bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
26623
26926
  indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );
@@ -26883,6 +27186,7 @@
26883
27186
  cubeuvmaps.dispose();
26884
27187
  objects.dispose();
26885
27188
  bindingStates.dispose();
27189
+ uniformsGroups.dispose();
26886
27190
  programCache.dispose();
26887
27191
 
26888
27192
  xr.dispose();
@@ -28063,6 +28367,31 @@
28063
28367
  p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
28064
28368
  p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
28065
28369
 
28370
+ // UBOs
28371
+
28372
+ if ( material.isShaderMaterial || material.isRawShaderMaterial ) {
28373
+
28374
+ const groups = material.uniformsGroups;
28375
+
28376
+ for ( let i = 0, l = groups.length; i < l; i ++ ) {
28377
+
28378
+ if ( capabilities.isWebGL2 ) {
28379
+
28380
+ const group = groups[ i ];
28381
+
28382
+ uniformsGroups.update( group, program );
28383
+ uniformsGroups.bind( group, program );
28384
+
28385
+ } else {
28386
+
28387
+ console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
28388
+
28389
+ }
28390
+
28391
+ }
28392
+
28393
+ }
28394
+
28066
28395
  return program;
28067
28396
 
28068
28397
  }
@@ -28456,7 +28785,23 @@
28456
28785
 
28457
28786
  this.initTexture = function ( texture ) {
28458
28787
 
28459
- textures.setTexture2D( texture, 0 );
28788
+ if ( texture.isCubeTexture ) {
28789
+
28790
+ textures.setTextureCube( texture, 0 );
28791
+
28792
+ } else if ( texture.isData3DTexture ) {
28793
+
28794
+ textures.setTexture3D( texture, 0 );
28795
+
28796
+ } else if ( texture.isDataArrayTexture ) {
28797
+
28798
+ textures.setTexture2DArray( texture, 0 );
28799
+
28800
+ } else {
28801
+
28802
+ textures.setTexture2D( texture, 0 );
28803
+
28804
+ }
28460
28805
 
28461
28806
  state.unbindTexture();
28462
28807
 
@@ -28664,7 +29009,7 @@
28664
29009
 
28665
29010
  if ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {
28666
29011
 
28667
- data.arrayBuffers[ this.array.buffer._uuid ] = Array.prototype.slice.call( new Uint32Array( this.array.buffer ) );
29012
+ data.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );
28668
29013
 
28669
29014
  }
28670
29015
 
@@ -28861,7 +29206,7 @@
28861
29206
 
28862
29207
  if ( data === undefined ) {
28863
29208
 
28864
- console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.' );
29209
+ console.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.' );
28865
29210
 
28866
29211
  const array = [];
28867
29212
 
@@ -28903,7 +29248,7 @@
28903
29248
 
28904
29249
  if ( data === undefined ) {
28905
29250
 
28906
- console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.' );
29251
+ console.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.' );
28907
29252
 
28908
29253
  const array = [];
28909
29254
 
@@ -28930,7 +29275,7 @@
28930
29275
 
28931
29276
  } else {
28932
29277
 
28933
- // save as true interlaved attribtue
29278
+ // save as true interleaved attribtue
28934
29279
 
28935
29280
  if ( data.interleavedBuffers === undefined ) {
28936
29281
 
@@ -28958,31 +29303,25 @@
28958
29303
 
28959
29304
  }
28960
29305
 
28961
- class SpriteMaterial extends Material {
28962
-
28963
- constructor( parameters ) {
28964
-
28965
- super();
29306
+ class InstancedBufferAttribute extends BufferAttribute {
28966
29307
 
28967
- this.isSpriteMaterial = true;
29308
+ constructor( array, itemSize, normalized, meshPerAttribute = 1 ) {
28968
29309
 
28969
- this.type = 'SpriteMaterial';
29310
+ if ( typeof normalized === 'number' ) {
28970
29311
 
28971
- this.color = new Color$1( 0xffffff );
29312
+ meshPerAttribute = normalized;
28972
29313
 
28973
- this.map = null;
29314
+ normalized = false;
28974
29315
 
28975
- this.alphaMap = null;
29316
+ console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );
28976
29317
 
28977
- this.rotation = 0;
28978
-
28979
- this.sizeAttenuation = true;
29318
+ }
28980
29319
 
28981
- this.transparent = true;
29320
+ super( array, itemSize, normalized );
28982
29321
 
28983
- this.fog = true;
29322
+ this.isInstancedBufferAttribute = true;
28984
29323
 
28985
- this.setValues( parameters );
29324
+ this.meshPerAttribute = meshPerAttribute;
28986
29325
 
28987
29326
  }
28988
29327
 
@@ -28990,19 +29329,21 @@
28990
29329
 
28991
29330
  super.copy( source );
28992
29331
 
28993
- this.color.copy( source.color );
29332
+ this.meshPerAttribute = source.meshPerAttribute;
28994
29333
 
28995
- this.map = source.map;
29334
+ return this;
28996
29335
 
28997
- this.alphaMap = source.alphaMap;
29336
+ }
28998
29337
 
28999
- this.rotation = source.rotation;
29338
+ toJSON() {
29000
29339
 
29001
- this.sizeAttenuation = source.sizeAttenuation;
29340
+ const data = super.toJSON();
29002
29341
 
29003
- this.fog = source.fog;
29342
+ data.meshPerAttribute = this.meshPerAttribute;
29004
29343
 
29005
- return this;
29344
+ data.isInstancedBufferAttribute = true;
29345
+
29346
+ return data;
29006
29347
 
29007
29348
  }
29008
29349
 
@@ -29311,52 +29652,6 @@
29311
29652
 
29312
29653
  }
29313
29654
 
29314
- class PointsMaterial extends Material {
29315
-
29316
- constructor( parameters ) {
29317
-
29318
- super();
29319
-
29320
- this.isPointsMaterial = true;
29321
-
29322
- this.type = 'PointsMaterial';
29323
-
29324
- this.color = new Color$1( 0xffffff );
29325
-
29326
- this.map = null;
29327
-
29328
- this.alphaMap = null;
29329
-
29330
- this.size = 1;
29331
- this.sizeAttenuation = true;
29332
-
29333
- this.fog = true;
29334
-
29335
- this.setValues( parameters );
29336
-
29337
- }
29338
-
29339
- copy( source ) {
29340
-
29341
- super.copy( source );
29342
-
29343
- this.color.copy( source.color );
29344
-
29345
- this.map = source.map;
29346
-
29347
- this.alphaMap = source.alphaMap;
29348
-
29349
- this.size = source.size;
29350
- this.sizeAttenuation = source.sizeAttenuation;
29351
-
29352
- this.fog = source.fog;
29353
-
29354
- return this;
29355
-
29356
- }
29357
-
29358
- }
29359
-
29360
29655
  /**
29361
29656
  * Extensible curve object.
29362
29657
  *
@@ -30009,8 +30304,10 @@
30009
30304
 
30010
30305
  //
30011
30306
 
30012
- const tmp = new Vector3();
30013
- const px = new CubicPoly(), py = new CubicPoly(), pz = new CubicPoly();
30307
+ const tmp = /*@__PURE__*/ new Vector3();
30308
+ const px = /*@__PURE__*/ new CubicPoly();
30309
+ const py = /*@__PURE__*/ new CubicPoly();
30310
+ const pz = /*@__PURE__*/ new CubicPoly();
30014
30311
 
30015
30312
  class CatmullRomCurve3 extends Curve {
30016
30313
 
@@ -31060,6 +31357,7 @@
31060
31357
  constructor( points ) {
31061
31358
 
31062
31359
  super();
31360
+
31063
31361
  this.type = 'Path';
31064
31362
 
31065
31363
  this.currentPoint = new Vector2();
@@ -31329,6 +31627,7 @@
31329
31627
  constructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {
31330
31628
 
31331
31629
  super();
31630
+
31332
31631
  this.type = 'CylinderGeometry';
31333
31632
 
31334
31633
  this.parameters = {
@@ -31592,11 +31891,6 @@
31592
31891
 
31593
31892
  }
31594
31893
 
31595
- new Vector3();
31596
- new Vector3();
31597
- new Vector3();
31598
- new Triangle();
31599
-
31600
31894
  class Shape extends Path$1 {
31601
31895
 
31602
31896
  constructor( points ) {
@@ -32637,7 +32931,7 @@
32637
32931
 
32638
32932
  const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
32639
32933
  const steps = options.steps !== undefined ? options.steps : 1;
32640
- let depth = options.depth !== undefined ? options.depth : 1;
32934
+ const depth = options.depth !== undefined ? options.depth : 1;
32641
32935
 
32642
32936
  let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
32643
32937
  let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;
@@ -32649,15 +32943,6 @@
32649
32943
 
32650
32944
  const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;
32651
32945
 
32652
- // deprecated options
32653
-
32654
- if ( options.amount !== undefined ) {
32655
-
32656
- console.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' );
32657
- depth = options.amount;
32658
-
32659
- }
32660
-
32661
32946
  //
32662
32947
 
32663
32948
  let extrudePts, extrudeByPath = false;
@@ -33379,6 +33664,7 @@
33379
33664
  constructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {
33380
33665
 
33381
33666
  super();
33667
+
33382
33668
  this.type = 'SphereGeometry';
33383
33669
 
33384
33670
  this.parameters = {
@@ -33500,6 +33786,7 @@
33500
33786
  constructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {
33501
33787
 
33502
33788
  super();
33789
+
33503
33790
  this.type = 'TubeGeometry';
33504
33791
 
33505
33792
  this.parameters = {
@@ -33684,6 +33971,7 @@
33684
33971
  constructor( geometry = null ) {
33685
33972
 
33686
33973
  super();
33974
+
33687
33975
  this.type = 'WireframeGeometry';
33688
33976
 
33689
33977
  this.parameters = {
@@ -33809,363 +34097,6 @@
33809
34097
 
33810
34098
  }
33811
34099
 
33812
- class ShadowMaterial extends Material {
33813
-
33814
- constructor( parameters ) {
33815
-
33816
- super();
33817
-
33818
- this.isShadowMaterial = true;
33819
-
33820
- this.type = 'ShadowMaterial';
33821
-
33822
- this.color = new Color$1( 0x000000 );
33823
- this.transparent = true;
33824
-
33825
- this.fog = true;
33826
-
33827
- this.setValues( parameters );
33828
-
33829
- }
33830
-
33831
- copy( source ) {
33832
-
33833
- super.copy( source );
33834
-
33835
- this.color.copy( source.color );
33836
-
33837
- this.fog = source.fog;
33838
-
33839
- return this;
33840
-
33841
- }
33842
-
33843
- }
33844
-
33845
- class RawShaderMaterial extends ShaderMaterial {
33846
-
33847
- constructor( parameters ) {
33848
-
33849
- super( parameters );
33850
-
33851
- this.isRawShaderMaterial = true;
33852
-
33853
- this.type = 'RawShaderMaterial';
33854
-
33855
- }
33856
-
33857
- }
33858
-
33859
- class MeshStandardMaterial extends Material {
33860
-
33861
- constructor( parameters ) {
33862
-
33863
- super();
33864
-
33865
- this.isMeshStandardMaterial = true;
33866
-
33867
- this.defines = { 'STANDARD': '' };
33868
-
33869
- this.type = 'MeshStandardMaterial';
33870
-
33871
- this.color = new Color$1( 0xffffff ); // diffuse
33872
- this.roughness = 1.0;
33873
- this.metalness = 0.0;
33874
-
33875
- this.map = null;
33876
-
33877
- this.lightMap = null;
33878
- this.lightMapIntensity = 1.0;
33879
-
33880
- this.aoMap = null;
33881
- this.aoMapIntensity = 1.0;
33882
-
33883
- this.emissive = new Color$1( 0x000000 );
33884
- this.emissiveIntensity = 1.0;
33885
- this.emissiveMap = null;
33886
-
33887
- this.bumpMap = null;
33888
- this.bumpScale = 1;
33889
-
33890
- this.normalMap = null;
33891
- this.normalMapType = TangentSpaceNormalMap;
33892
- this.normalScale = new Vector2( 1, 1 );
33893
-
33894
- this.displacementMap = null;
33895
- this.displacementScale = 1;
33896
- this.displacementBias = 0;
33897
-
33898
- this.roughnessMap = null;
33899
-
33900
- this.metalnessMap = null;
33901
-
33902
- this.alphaMap = null;
33903
-
33904
- this.envMap = null;
33905
- this.envMapIntensity = 1.0;
33906
-
33907
- this.wireframe = false;
33908
- this.wireframeLinewidth = 1;
33909
- this.wireframeLinecap = 'round';
33910
- this.wireframeLinejoin = 'round';
33911
-
33912
- this.flatShading = false;
33913
-
33914
- this.fog = true;
33915
-
33916
- this.setValues( parameters );
33917
-
33918
- }
33919
-
33920
- copy( source ) {
33921
-
33922
- super.copy( source );
33923
-
33924
- this.defines = { 'STANDARD': '' };
33925
-
33926
- this.color.copy( source.color );
33927
- this.roughness = source.roughness;
33928
- this.metalness = source.metalness;
33929
-
33930
- this.map = source.map;
33931
-
33932
- this.lightMap = source.lightMap;
33933
- this.lightMapIntensity = source.lightMapIntensity;
33934
-
33935
- this.aoMap = source.aoMap;
33936
- this.aoMapIntensity = source.aoMapIntensity;
33937
-
33938
- this.emissive.copy( source.emissive );
33939
- this.emissiveMap = source.emissiveMap;
33940
- this.emissiveIntensity = source.emissiveIntensity;
33941
-
33942
- this.bumpMap = source.bumpMap;
33943
- this.bumpScale = source.bumpScale;
33944
-
33945
- this.normalMap = source.normalMap;
33946
- this.normalMapType = source.normalMapType;
33947
- this.normalScale.copy( source.normalScale );
33948
-
33949
- this.displacementMap = source.displacementMap;
33950
- this.displacementScale = source.displacementScale;
33951
- this.displacementBias = source.displacementBias;
33952
-
33953
- this.roughnessMap = source.roughnessMap;
33954
-
33955
- this.metalnessMap = source.metalnessMap;
33956
-
33957
- this.alphaMap = source.alphaMap;
33958
-
33959
- this.envMap = source.envMap;
33960
- this.envMapIntensity = source.envMapIntensity;
33961
-
33962
- this.wireframe = source.wireframe;
33963
- this.wireframeLinewidth = source.wireframeLinewidth;
33964
- this.wireframeLinecap = source.wireframeLinecap;
33965
- this.wireframeLinejoin = source.wireframeLinejoin;
33966
-
33967
- this.flatShading = source.flatShading;
33968
-
33969
- this.fog = source.fog;
33970
-
33971
- return this;
33972
-
33973
- }
33974
-
33975
- }
33976
-
33977
- class MeshPhysicalMaterial extends MeshStandardMaterial {
33978
-
33979
- constructor( parameters ) {
33980
-
33981
- super();
33982
-
33983
- this.isMeshPhysicalMaterial = true;
33984
-
33985
- this.defines = {
33986
-
33987
- 'STANDARD': '',
33988
- 'PHYSICAL': ''
33989
-
33990
- };
33991
-
33992
- this.type = 'MeshPhysicalMaterial';
33993
-
33994
- this.clearcoatMap = null;
33995
- this.clearcoatRoughness = 0.0;
33996
- this.clearcoatRoughnessMap = null;
33997
- this.clearcoatNormalScale = new Vector2( 1, 1 );
33998
- this.clearcoatNormalMap = null;
33999
-
34000
- this.ior = 1.5;
34001
-
34002
- Object.defineProperty( this, 'reflectivity', {
34003
- get: function () {
34004
-
34005
- return ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );
34006
-
34007
- },
34008
- set: function ( reflectivity ) {
34009
-
34010
- this.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );
34011
-
34012
- }
34013
- } );
34014
-
34015
- this.iridescenceMap = null;
34016
- this.iridescenceIOR = 1.3;
34017
- this.iridescenceThicknessRange = [ 100, 400 ];
34018
- this.iridescenceThicknessMap = null;
34019
-
34020
- this.sheenColor = new Color$1( 0x000000 );
34021
- this.sheenColorMap = null;
34022
- this.sheenRoughness = 1.0;
34023
- this.sheenRoughnessMap = null;
34024
-
34025
- this.transmissionMap = null;
34026
-
34027
- this.thickness = 0;
34028
- this.thicknessMap = null;
34029
- this.attenuationDistance = 0.0;
34030
- this.attenuationColor = new Color$1( 1, 1, 1 );
34031
-
34032
- this.specularIntensity = 1.0;
34033
- this.specularIntensityMap = null;
34034
- this.specularColor = new Color$1( 1, 1, 1 );
34035
- this.specularColorMap = null;
34036
-
34037
- this._sheen = 0.0;
34038
- this._clearcoat = 0;
34039
- this._iridescence = 0;
34040
- this._transmission = 0;
34041
-
34042
- this.setValues( parameters );
34043
-
34044
- }
34045
-
34046
- get sheen() {
34047
-
34048
- return this._sheen;
34049
-
34050
- }
34051
-
34052
- set sheen( value ) {
34053
-
34054
- if ( this._sheen > 0 !== value > 0 ) {
34055
-
34056
- this.version ++;
34057
-
34058
- }
34059
-
34060
- this._sheen = value;
34061
-
34062
- }
34063
-
34064
- get clearcoat() {
34065
-
34066
- return this._clearcoat;
34067
-
34068
- }
34069
-
34070
- set clearcoat( value ) {
34071
-
34072
- if ( this._clearcoat > 0 !== value > 0 ) {
34073
-
34074
- this.version ++;
34075
-
34076
- }
34077
-
34078
- this._clearcoat = value;
34079
-
34080
- }
34081
-
34082
- get iridescence() {
34083
-
34084
- return this._iridescence;
34085
-
34086
- }
34087
-
34088
- set iridescence( value ) {
34089
-
34090
- if ( this._iridescence > 0 !== value > 0 ) {
34091
-
34092
- this.version ++;
34093
-
34094
- }
34095
-
34096
- this._iridescence = value;
34097
-
34098
- }
34099
-
34100
- get transmission() {
34101
-
34102
- return this._transmission;
34103
-
34104
- }
34105
-
34106
- set transmission( value ) {
34107
-
34108
- if ( this._transmission > 0 !== value > 0 ) {
34109
-
34110
- this.version ++;
34111
-
34112
- }
34113
-
34114
- this._transmission = value;
34115
-
34116
- }
34117
-
34118
- copy( source ) {
34119
-
34120
- super.copy( source );
34121
-
34122
- this.defines = {
34123
-
34124
- 'STANDARD': '',
34125
- 'PHYSICAL': ''
34126
-
34127
- };
34128
-
34129
- this.clearcoat = source.clearcoat;
34130
- this.clearcoatMap = source.clearcoatMap;
34131
- this.clearcoatRoughness = source.clearcoatRoughness;
34132
- this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
34133
- this.clearcoatNormalMap = source.clearcoatNormalMap;
34134
- this.clearcoatNormalScale.copy( source.clearcoatNormalScale );
34135
-
34136
- this.ior = source.ior;
34137
-
34138
- this.iridescence = source.iridescence;
34139
- this.iridescenceMap = source.iridescenceMap;
34140
- this.iridescenceIOR = source.iridescenceIOR;
34141
- this.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];
34142
- this.iridescenceThicknessMap = source.iridescenceThicknessMap;
34143
-
34144
- this.sheen = source.sheen;
34145
- this.sheenColor.copy( source.sheenColor );
34146
- this.sheenColorMap = source.sheenColorMap;
34147
- this.sheenRoughness = source.sheenRoughness;
34148
- this.sheenRoughnessMap = source.sheenRoughnessMap;
34149
-
34150
- this.transmission = source.transmission;
34151
- this.transmissionMap = source.transmissionMap;
34152
-
34153
- this.thickness = source.thickness;
34154
- this.thicknessMap = source.thicknessMap;
34155
- this.attenuationDistance = source.attenuationDistance;
34156
- this.attenuationColor.copy( source.attenuationColor );
34157
-
34158
- this.specularIntensity = source.specularIntensity;
34159
- this.specularIntensityMap = source.specularIntensityMap;
34160
- this.specularColor.copy( source.specularColor );
34161
- this.specularColorMap = source.specularColorMap;
34162
-
34163
- return this;
34164
-
34165
- }
34166
-
34167
- }
34168
-
34169
34100
  class MeshPhongMaterial extends Material {
34170
34101
 
34171
34102
  constructor( parameters ) {
@@ -34256,176 +34187,24 @@
34256
34187
  this.displacementScale = source.displacementScale;
34257
34188
  this.displacementBias = source.displacementBias;
34258
34189
 
34259
- this.specularMap = source.specularMap;
34260
-
34261
- this.alphaMap = source.alphaMap;
34262
-
34263
- this.envMap = source.envMap;
34264
- this.combine = source.combine;
34265
- this.reflectivity = source.reflectivity;
34266
- this.refractionRatio = source.refractionRatio;
34267
-
34268
- this.wireframe = source.wireframe;
34269
- this.wireframeLinewidth = source.wireframeLinewidth;
34270
- this.wireframeLinecap = source.wireframeLinecap;
34271
- this.wireframeLinejoin = source.wireframeLinejoin;
34272
-
34273
- this.flatShading = source.flatShading;
34274
-
34275
- this.fog = source.fog;
34276
-
34277
- return this;
34278
-
34279
- }
34280
-
34281
- }
34282
-
34283
- class MeshToonMaterial extends Material {
34284
-
34285
- constructor( parameters ) {
34286
-
34287
- super();
34288
-
34289
- this.isMeshToonMaterial = true;
34290
-
34291
- this.defines = { 'TOON': '' };
34292
-
34293
- this.type = 'MeshToonMaterial';
34294
-
34295
- this.color = new Color$1( 0xffffff );
34296
-
34297
- this.map = null;
34298
- this.gradientMap = null;
34299
-
34300
- this.lightMap = null;
34301
- this.lightMapIntensity = 1.0;
34302
-
34303
- this.aoMap = null;
34304
- this.aoMapIntensity = 1.0;
34305
-
34306
- this.emissive = new Color$1( 0x000000 );
34307
- this.emissiveIntensity = 1.0;
34308
- this.emissiveMap = null;
34309
-
34310
- this.bumpMap = null;
34311
- this.bumpScale = 1;
34312
-
34313
- this.normalMap = null;
34314
- this.normalMapType = TangentSpaceNormalMap;
34315
- this.normalScale = new Vector2( 1, 1 );
34316
-
34317
- this.displacementMap = null;
34318
- this.displacementScale = 1;
34319
- this.displacementBias = 0;
34320
-
34321
- this.alphaMap = null;
34322
-
34323
- this.wireframe = false;
34324
- this.wireframeLinewidth = 1;
34325
- this.wireframeLinecap = 'round';
34326
- this.wireframeLinejoin = 'round';
34327
-
34328
- this.fog = true;
34329
-
34330
- this.setValues( parameters );
34331
-
34332
- }
34333
-
34334
- copy( source ) {
34335
-
34336
- super.copy( source );
34337
-
34338
- this.color.copy( source.color );
34339
-
34340
- this.map = source.map;
34341
- this.gradientMap = source.gradientMap;
34342
-
34343
- this.lightMap = source.lightMap;
34344
- this.lightMapIntensity = source.lightMapIntensity;
34345
-
34346
- this.aoMap = source.aoMap;
34347
- this.aoMapIntensity = source.aoMapIntensity;
34348
-
34349
- this.emissive.copy( source.emissive );
34350
- this.emissiveMap = source.emissiveMap;
34351
- this.emissiveIntensity = source.emissiveIntensity;
34352
-
34353
- this.bumpMap = source.bumpMap;
34354
- this.bumpScale = source.bumpScale;
34355
-
34356
- this.normalMap = source.normalMap;
34357
- this.normalMapType = source.normalMapType;
34358
- this.normalScale.copy( source.normalScale );
34359
-
34360
- this.displacementMap = source.displacementMap;
34361
- this.displacementScale = source.displacementScale;
34362
- this.displacementBias = source.displacementBias;
34363
-
34190
+ this.specularMap = source.specularMap;
34191
+
34364
34192
  this.alphaMap = source.alphaMap;
34365
34193
 
34194
+ this.envMap = source.envMap;
34195
+ this.combine = source.combine;
34196
+ this.reflectivity = source.reflectivity;
34197
+ this.refractionRatio = source.refractionRatio;
34198
+
34366
34199
  this.wireframe = source.wireframe;
34367
34200
  this.wireframeLinewidth = source.wireframeLinewidth;
34368
34201
  this.wireframeLinecap = source.wireframeLinecap;
34369
34202
  this.wireframeLinejoin = source.wireframeLinejoin;
34370
34203
 
34371
- this.fog = source.fog;
34372
-
34373
- return this;
34374
-
34375
- }
34376
-
34377
- }
34378
-
34379
- class MeshNormalMaterial extends Material {
34380
-
34381
- constructor( parameters ) {
34382
-
34383
- super();
34384
-
34385
- this.isMeshNormalMaterial = true;
34386
-
34387
- this.type = 'MeshNormalMaterial';
34388
-
34389
- this.bumpMap = null;
34390
- this.bumpScale = 1;
34391
-
34392
- this.normalMap = null;
34393
- this.normalMapType = TangentSpaceNormalMap;
34394
- this.normalScale = new Vector2( 1, 1 );
34395
-
34396
- this.displacementMap = null;
34397
- this.displacementScale = 1;
34398
- this.displacementBias = 0;
34399
-
34400
- this.wireframe = false;
34401
- this.wireframeLinewidth = 1;
34402
-
34403
- this.flatShading = false;
34404
-
34405
- this.setValues( parameters );
34406
-
34407
- }
34408
-
34409
- copy( source ) {
34410
-
34411
- super.copy( source );
34412
-
34413
- this.bumpMap = source.bumpMap;
34414
- this.bumpScale = source.bumpScale;
34415
-
34416
- this.normalMap = source.normalMap;
34417
- this.normalMapType = source.normalMapType;
34418
- this.normalScale.copy( source.normalScale );
34419
-
34420
- this.displacementMap = source.displacementMap;
34421
- this.displacementScale = source.displacementScale;
34422
- this.displacementBias = source.displacementBias;
34423
-
34424
- this.wireframe = source.wireframe;
34425
- this.wireframeLinewidth = source.wireframeLinewidth;
34426
-
34427
34204
  this.flatShading = source.flatShading;
34428
34205
 
34206
+ this.fog = source.fog;
34207
+
34429
34208
  return this;
34430
34209
 
34431
34210
  }
@@ -34516,140 +34295,6 @@
34516
34295
 
34517
34296
  }
34518
34297
 
34519
- class MeshMatcapMaterial extends Material {
34520
-
34521
- constructor( parameters ) {
34522
-
34523
- super();
34524
-
34525
- this.isMeshMatcapMaterial = true;
34526
-
34527
- this.defines = { 'MATCAP': '' };
34528
-
34529
- this.type = 'MeshMatcapMaterial';
34530
-
34531
- this.color = new Color$1( 0xffffff ); // diffuse
34532
-
34533
- this.matcap = null;
34534
-
34535
- this.map = null;
34536
-
34537
- this.bumpMap = null;
34538
- this.bumpScale = 1;
34539
-
34540
- this.normalMap = null;
34541
- this.normalMapType = TangentSpaceNormalMap;
34542
- this.normalScale = new Vector2( 1, 1 );
34543
-
34544
- this.displacementMap = null;
34545
- this.displacementScale = 1;
34546
- this.displacementBias = 0;
34547
-
34548
- this.alphaMap = null;
34549
-
34550
- this.flatShading = false;
34551
-
34552
- this.fog = true;
34553
-
34554
- this.setValues( parameters );
34555
-
34556
- }
34557
-
34558
-
34559
- copy( source ) {
34560
-
34561
- super.copy( source );
34562
-
34563
- this.defines = { 'MATCAP': '' };
34564
-
34565
- this.color.copy( source.color );
34566
-
34567
- this.matcap = source.matcap;
34568
-
34569
- this.map = source.map;
34570
-
34571
- this.bumpMap = source.bumpMap;
34572
- this.bumpScale = source.bumpScale;
34573
-
34574
- this.normalMap = source.normalMap;
34575
- this.normalMapType = source.normalMapType;
34576
- this.normalScale.copy( source.normalScale );
34577
-
34578
- this.displacementMap = source.displacementMap;
34579
- this.displacementScale = source.displacementScale;
34580
- this.displacementBias = source.displacementBias;
34581
-
34582
- this.alphaMap = source.alphaMap;
34583
-
34584
- this.flatShading = source.flatShading;
34585
-
34586
- this.fog = source.fog;
34587
-
34588
- return this;
34589
-
34590
- }
34591
-
34592
- }
34593
-
34594
- class LineDashedMaterial extends LineBasicMaterial {
34595
-
34596
- constructor( parameters ) {
34597
-
34598
- super();
34599
-
34600
- this.isLineDashedMaterial = true;
34601
-
34602
- this.type = 'LineDashedMaterial';
34603
-
34604
- this.scale = 1;
34605
- this.dashSize = 3;
34606
- this.gapSize = 1;
34607
-
34608
- this.setValues( parameters );
34609
-
34610
- }
34611
-
34612
- copy( source ) {
34613
-
34614
- super.copy( source );
34615
-
34616
- this.scale = source.scale;
34617
- this.dashSize = source.dashSize;
34618
- this.gapSize = source.gapSize;
34619
-
34620
- return this;
34621
-
34622
- }
34623
-
34624
- }
34625
-
34626
- const materialLib = {
34627
- ShadowMaterial,
34628
- SpriteMaterial,
34629
- RawShaderMaterial,
34630
- ShaderMaterial,
34631
- PointsMaterial,
34632
- MeshPhysicalMaterial,
34633
- MeshStandardMaterial,
34634
- MeshPhongMaterial,
34635
- MeshToonMaterial,
34636
- MeshNormalMaterial,
34637
- MeshLambertMaterial,
34638
- MeshDepthMaterial,
34639
- MeshDistanceMaterial,
34640
- MeshBasicMaterial,
34641
- MeshMatcapMaterial,
34642
- LineDashedMaterial,
34643
- LineBasicMaterial,
34644
- Material
34645
- };
34646
-
34647
- Material.fromType = function ( type ) {
34648
-
34649
- return new materialLib[ type ]();
34650
-
34651
- };
34652
-
34653
34298
  const Cache = {
34654
34299
 
34655
34300
  enabled: false,
@@ -34829,7 +34474,7 @@
34829
34474
 
34830
34475
  }
34831
34476
 
34832
- const DefaultLoadingManager = new LoadingManager();
34477
+ const DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();
34833
34478
 
34834
34479
  class Loader {
34835
34480
 
@@ -35393,30 +35038,6 @@
35393
35038
 
35394
35039
  }
35395
35040
 
35396
- // Characters [].:/ are reserved for track binding syntax.
35397
- const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
35398
-
35399
- // Attempts to allow node names from any language. ES5's `\w` regexp matches
35400
- // only latin characters, and the unicode \p{L} is not yet supported. So
35401
- // instead, we exclude reserved characters and match everything else.
35402
- const _wordChar = '[^' + _RESERVED_CHARS_RE + ']';
35403
- const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\.', '' ) + ']';
35404
-
35405
- // Parent directories, delimited by '/' or ':'. Currently unused, but must
35406
- // be matched to parse the rest of the track name.
35407
- /((?:WC+[\/:])*)/.source.replace( 'WC', _wordChar );
35408
-
35409
- // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
35410
- /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );
35411
-
35412
- // Object on target node, and accessor. May not contain reserved
35413
- // characters. Accessor may contain any character except closing bracket.
35414
- /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace( 'WC', _wordChar );
35415
-
35416
- // Property and accessor. May not contain reserved characters. Accessor may
35417
- // contain any non-bracket characters.
35418
- /\.(WC+)(?:\[(.+)\])?/.source.replace( 'WC', _wordChar );
35419
-
35420
35041
  class InstancedInterleavedBuffer extends InterleavedBuffer {
35421
35042
 
35422
35043
  constructor( array, stride, meshPerAttribute = 1 ) {
@@ -36049,120 +35670,6 @@
36049
35670
 
36050
35671
  }
36051
35672
 
36052
- const _baseTable = new Uint32Array( 512 );
36053
- const _shiftTable = new Uint32Array( 512 );
36054
-
36055
- for ( let i = 0; i < 256; ++ i ) {
36056
-
36057
- const e = i - 127;
36058
-
36059
- // very small number (0, -0)
36060
-
36061
- if ( e < - 27 ) {
36062
-
36063
- _baseTable[ i ] = 0x0000;
36064
- _baseTable[ i | 0x100 ] = 0x8000;
36065
- _shiftTable[ i ] = 24;
36066
- _shiftTable[ i | 0x100 ] = 24;
36067
-
36068
- // small number (denorm)
36069
-
36070
- } else if ( e < - 14 ) {
36071
-
36072
- _baseTable[ i ] = 0x0400 >> ( - e - 14 );
36073
- _baseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;
36074
- _shiftTable[ i ] = - e - 1;
36075
- _shiftTable[ i | 0x100 ] = - e - 1;
36076
-
36077
- // normal number
36078
-
36079
- } else if ( e <= 15 ) {
36080
-
36081
- _baseTable[ i ] = ( e + 15 ) << 10;
36082
- _baseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;
36083
- _shiftTable[ i ] = 13;
36084
- _shiftTable[ i | 0x100 ] = 13;
36085
-
36086
- // large number (Infinity, -Infinity)
36087
-
36088
- } else if ( e < 128 ) {
36089
-
36090
- _baseTable[ i ] = 0x7c00;
36091
- _baseTable[ i | 0x100 ] = 0xfc00;
36092
- _shiftTable[ i ] = 24;
36093
- _shiftTable[ i | 0x100 ] = 24;
36094
-
36095
- // stay (NaN, Infinity, -Infinity)
36096
-
36097
- } else {
36098
-
36099
- _baseTable[ i ] = 0x7c00;
36100
- _baseTable[ i | 0x100 ] = 0xfc00;
36101
- _shiftTable[ i ] = 13;
36102
- _shiftTable[ i | 0x100 ] = 13;
36103
-
36104
- }
36105
-
36106
- }
36107
-
36108
- // float16 to float32 helpers
36109
-
36110
- const _mantissaTable = new Uint32Array( 2048 );
36111
- const _exponentTable = new Uint32Array( 64 );
36112
- const _offsetTable = new Uint32Array( 64 );
36113
-
36114
- for ( let i = 1; i < 1024; ++ i ) {
36115
-
36116
- let m = i << 13; // zero pad mantissa bits
36117
- let e = 0; // zero exponent
36118
-
36119
- // normalized
36120
- while ( ( m & 0x00800000 ) === 0 ) {
36121
-
36122
- m <<= 1;
36123
- e -= 0x00800000; // decrement exponent
36124
-
36125
- }
36126
-
36127
- m &= ~ 0x00800000; // clear leading 1 bit
36128
- e += 0x38800000; // adjust bias
36129
-
36130
- _mantissaTable[ i ] = m | e;
36131
-
36132
- }
36133
-
36134
- for ( let i = 1024; i < 2048; ++ i ) {
36135
-
36136
- _mantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );
36137
-
36138
- }
36139
-
36140
- for ( let i = 1; i < 31; ++ i ) {
36141
-
36142
- _exponentTable[ i ] = i << 23;
36143
-
36144
- }
36145
-
36146
- _exponentTable[ 31 ] = 0x47800000;
36147
- _exponentTable[ 32 ] = 0x80000000;
36148
- for ( let i = 33; i < 63; ++ i ) {
36149
-
36150
- _exponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );
36151
-
36152
- }
36153
-
36154
- _exponentTable[ 63 ] = 0xc7800000;
36155
-
36156
- for ( let i = 1; i < 64; ++ i ) {
36157
-
36158
- if ( i !== 32 ) {
36159
-
36160
- _offsetTable[ i ] = 1024;
36161
-
36162
- }
36163
-
36164
- }
36165
-
36166
35673
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
36167
35674
 
36168
35675
  __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
@@ -37515,10 +37022,10 @@
37515
37022
 
37516
37023
  // minX, minY and invSize are later used to transform coords into integers for z-order calculation
37517
37024
  invSize = Math.max(maxX - minX, maxY - minY);
37518
- invSize = invSize !== 0 ? 1 / invSize : 0;
37025
+ invSize = invSize !== 0 ? 32767 / invSize : 0;
37519
37026
  }
37520
37027
 
37521
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
37028
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
37522
37029
 
37523
37030
  return triangles;
37524
37031
  }
@@ -37582,9 +37089,9 @@
37582
37089
 
37583
37090
  if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
37584
37091
  // cut off the triangle
37585
- triangles.push(prev.i / dim);
37586
- triangles.push(ear.i / dim);
37587
- triangles.push(next.i / dim);
37092
+ triangles.push(prev.i / dim | 0);
37093
+ triangles.push(ear.i / dim | 0);
37094
+ triangles.push(next.i / dim | 0);
37588
37095
 
37589
37096
  removeNode(ear);
37590
37097
 
@@ -37627,10 +37134,18 @@
37627
37134
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
37628
37135
 
37629
37136
  // now make sure we don't have other points inside the potential ear
37630
- var p = ear.next.next;
37137
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
37631
37138
 
37632
- while (p !== ear.prev) {
37633
- if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
37139
+ // triangle bbox; min & max are calculated like this for speed
37140
+ var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
37141
+ y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
37142
+ x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
37143
+ y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
37144
+
37145
+ var p = c.next;
37146
+ while (p !== a) {
37147
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&
37148
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&
37634
37149
  area(p.prev, p, p.next) >= 0) return false;
37635
37150
  p = p.next;
37636
37151
  }
@@ -37645,45 +37160,43 @@
37645
37160
 
37646
37161
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
37647
37162
 
37163
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
37164
+
37648
37165
  // triangle bbox; min & max are calculated like this for speed
37649
- var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),
37650
- minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),
37651
- maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),
37652
- maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);
37166
+ var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
37167
+ y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
37168
+ x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
37169
+ y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
37653
37170
 
37654
37171
  // z-order range for the current triangle bbox;
37655
- var minZ = zOrder(minTX, minTY, minX, minY, invSize),
37656
- maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
37172
+ var minZ = zOrder(x0, y0, minX, minY, invSize),
37173
+ maxZ = zOrder(x1, y1, minX, minY, invSize);
37657
37174
 
37658
37175
  var p = ear.prevZ,
37659
37176
  n = ear.nextZ;
37660
37177
 
37661
37178
  // look for points inside the triangle in both directions
37662
37179
  while (p && p.z >= minZ && n && n.z <= maxZ) {
37663
- if (p !== ear.prev && p !== ear.next &&
37664
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
37665
- area(p.prev, p, p.next) >= 0) return false;
37180
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
37181
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
37666
37182
  p = p.prevZ;
37667
37183
 
37668
- if (n !== ear.prev && n !== ear.next &&
37669
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
37670
- area(n.prev, n, n.next) >= 0) return false;
37184
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
37185
+ pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
37671
37186
  n = n.nextZ;
37672
37187
  }
37673
37188
 
37674
37189
  // look for remaining points in decreasing z-order
37675
37190
  while (p && p.z >= minZ) {
37676
- if (p !== ear.prev && p !== ear.next &&
37677
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
37678
- area(p.prev, p, p.next) >= 0) return false;
37191
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
37192
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
37679
37193
  p = p.prevZ;
37680
37194
  }
37681
37195
 
37682
37196
  // look for remaining points in increasing z-order
37683
37197
  while (n && n.z <= maxZ) {
37684
- if (n !== ear.prev && n !== ear.next &&
37685
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
37686
- area(n.prev, n, n.next) >= 0) return false;
37198
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
37199
+ pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
37687
37200
  n = n.nextZ;
37688
37201
  }
37689
37202
 
@@ -37699,9 +37212,9 @@
37699
37212
 
37700
37213
  if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
37701
37214
 
37702
- triangles.push(a.i / dim);
37703
- triangles.push(p.i / dim);
37704
- triangles.push(b.i / dim);
37215
+ triangles.push(a.i / dim | 0);
37216
+ triangles.push(p.i / dim | 0);
37217
+ triangles.push(b.i / dim | 0);
37705
37218
 
37706
37219
  // remove two nodes involved
37707
37220
  removeNode(p);
@@ -37731,8 +37244,8 @@
37731
37244
  c = filterPoints(c, c.next);
37732
37245
 
37733
37246
  // run earcut on each half
37734
- earcutLinked(a, triangles, dim, minX, minY, invSize);
37735
- earcutLinked(c, triangles, dim, minX, minY, invSize);
37247
+ earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
37248
+ earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
37736
37249
  return;
37737
37250
  }
37738
37251
  b = b.next;
@@ -37759,7 +37272,6 @@
37759
37272
  // process holes from left to right
37760
37273
  for (i = 0; i < queue.length; i++) {
37761
37274
  outerNode = eliminateHole(queue[i], outerNode);
37762
- outerNode = filterPoints(outerNode, outerNode.next);
37763
37275
  }
37764
37276
 
37765
37277
  return outerNode;
@@ -37779,11 +37291,8 @@
37779
37291
  var bridgeReverse = splitPolygon(bridge, hole);
37780
37292
 
37781
37293
  // filter collinear points around the cuts
37782
- var filteredBridge = filterPoints(bridge, bridge.next);
37783
37294
  filterPoints(bridgeReverse, bridgeReverse.next);
37784
-
37785
- // Check if input node was removed by the filtering
37786
- return outerNode === bridge ? filteredBridge : outerNode;
37295
+ return filterPoints(bridge, bridge.next);
37787
37296
  }
37788
37297
 
37789
37298
  // David Eberly's algorithm for finding a bridge between hole and outer polygon
@@ -37801,11 +37310,8 @@
37801
37310
  var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
37802
37311
  if (x <= hx && x > qx) {
37803
37312
  qx = x;
37804
- if (x === hx) {
37805
- if (hy === p.y) return p;
37806
- if (hy === p.next.y) return p.next;
37807
- }
37808
37313
  m = p.x < p.next.x ? p : p.next;
37314
+ if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
37809
37315
  }
37810
37316
  }
37811
37317
  p = p.next;
@@ -37813,8 +37319,6 @@
37813
37319
 
37814
37320
  if (!m) return null;
37815
37321
 
37816
- if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
37817
-
37818
37322
  // look for points inside the triangle of hole point, segment intersection and endpoint;
37819
37323
  // if there are no points found, we have a valid connection;
37820
37324
  // otherwise choose the point of the minimum angle with the ray as connection point
@@ -37855,7 +37359,7 @@
37855
37359
  function indexCurve(start, minX, minY, invSize) {
37856
37360
  var p = start;
37857
37361
  do {
37858
- if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
37362
+ if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
37859
37363
  p.prevZ = p.prev;
37860
37364
  p.nextZ = p.next;
37861
37365
  p = p.next;
@@ -37923,8 +37427,8 @@
37923
37427
  // z-order of a point given coords and inverse of the longer side of data bbox
37924
37428
  function zOrder(x, y, minX, minY, invSize) {
37925
37429
  // coords are transformed into non-negative 15-bit integer range
37926
- x = 32767 * (x - minX) * invSize;
37927
- y = 32767 * (y - minY) * invSize;
37430
+ x = (x - minX) * invSize | 0;
37431
+ y = (y - minY) * invSize | 0;
37928
37432
 
37929
37433
  x = (x | (x << 8)) & 0x00FF00FF;
37930
37434
  x = (x | (x << 4)) & 0x0F0F0F0F;
@@ -37953,9 +37457,9 @@
37953
37457
 
37954
37458
  // check if a point lies within a convex triangle
37955
37459
  function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
37956
- return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
37957
- (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
37958
- (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
37460
+ return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&
37461
+ (ax - px) * (by - py) >= (bx - px) * (ay - py) &&
37462
+ (bx - px) * (cy - py) >= (cx - px) * (by - py);
37959
37463
  }
37960
37464
 
37961
37465
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
@@ -38098,7 +37602,7 @@
38098
37602
  this.next = null;
38099
37603
 
38100
37604
  // z-order curve value
38101
- this.z = null;
37605
+ this.z = 0;
38102
37606
 
38103
37607
  // previous and next nodes in z-order
38104
37608
  this.prevZ = null;
@@ -38206,7 +37710,7 @@
38206
37710
  return lo;
38207
37711
  }
38208
37712
 
38209
- function right(a, x, lo, hi) {
37713
+ function right(a, x, lo = 0, hi = a.length) {
38210
37714
  if (lo < hi) {
38211
37715
  if (compare1(x, x) !== 0) return hi;
38212
37716
  do {
@@ -38218,7 +37722,7 @@
38218
37722
  return lo;
38219
37723
  }
38220
37724
 
38221
- function center(a, x, lo, hi) {
37725
+ function center(a, x, lo = 0, hi = a.length) {
38222
37726
  const i = left(a, x, lo, hi - 1);
38223
37727
  return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
38224
37728
  }
@@ -43471,7 +42975,7 @@
43471
42975
  }
43472
42976
 
43473
42977
  function _iterableToArrayLimit$4(arr, i) {
43474
- var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
42978
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
43475
42979
 
43476
42980
  if (_i == null) return;
43477
42981
  var _arr = [];
@@ -43654,14 +43158,9 @@
43654
43158
 
43655
43159
  if (Object.getOwnPropertySymbols) {
43656
43160
  var symbols = Object.getOwnPropertySymbols(object);
43657
-
43658
- if (enumerableOnly) {
43659
- symbols = symbols.filter(function (sym) {
43660
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
43661
- });
43662
- }
43663
-
43664
- keys.push.apply(keys, symbols);
43161
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
43162
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
43163
+ })), keys.push.apply(keys, symbols);
43665
43164
  }
43666
43165
 
43667
43166
  return keys;
@@ -43669,19 +43168,12 @@
43669
43168
 
43670
43169
  function _objectSpread2$2(target) {
43671
43170
  for (var i = 1; i < arguments.length; i++) {
43672
- var source = arguments[i] != null ? arguments[i] : {};
43673
-
43674
- if (i % 2) {
43675
- ownKeys$2(Object(source), true).forEach(function (key) {
43676
- _defineProperty$3(target, key, source[key]);
43677
- });
43678
- } else if (Object.getOwnPropertyDescriptors) {
43679
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
43680
- } else {
43681
- ownKeys$2(Object(source)).forEach(function (key) {
43682
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43683
- });
43684
- }
43171
+ var source = null != arguments[i] ? arguments[i] : {};
43172
+ i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
43173
+ _defineProperty$3(target, key, source[key]);
43174
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
43175
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43176
+ });
43685
43177
  }
43686
43178
 
43687
43179
  return target;
@@ -43759,7 +43251,7 @@
43759
43251
  }
43760
43252
 
43761
43253
  function _iterableToArrayLimit$3(arr, i) {
43762
- var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
43254
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
43763
43255
 
43764
43256
  if (_i == null) return;
43765
43257
  var _arr = [];
@@ -43813,6 +43305,8 @@
43813
43305
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43814
43306
  }
43815
43307
 
43308
+ var _excluded$2 = ["createObj", "updateObj", "exitObj", "objBindAttr", "dataBindAttr"];
43309
+
43816
43310
  function diffArrays(prev, next, idAccessor) {
43817
43311
  var result = {
43818
43312
  enter: [],
@@ -43907,7 +43401,7 @@
43907
43401
  objBindAttr = _ref7$objBindAttr === void 0 ? '__obj' : _ref7$objBindAttr,
43908
43402
  _ref7$dataBindAttr = _ref7.dataBindAttr,
43909
43403
  dataBindAttr = _ref7$dataBindAttr === void 0 ? '__data' : _ref7$dataBindAttr,
43910
- dataDiffOptions = _objectWithoutProperties$2(_ref7, ["createObj", "updateObj", "exitObj", "objBindAttr", "dataBindAttr"]);
43404
+ dataDiffOptions = _objectWithoutProperties$2(_ref7, _excluded$2);
43911
43405
 
43912
43406
  var _dataBindDiff = dataBindDiff(data, existingObjs, _objectSpread2$2({
43913
43407
  objBindAttr: objBindAttr,
@@ -43957,13 +43451,13 @@
43957
43451
  }
43958
43452
  }
43959
43453
 
43960
- var FrameTicker$1 = {exports: {}};
43454
+ var FrameTicker$3 = {exports: {}};
43961
43455
 
43962
43456
  (function (module, exports) {
43963
43457
  !function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){var n=i(1),r=function(){function e(e,t,i){void 0===e&&(e=NaN),void 0===t&&(t=NaN),void 0===i&&(i=!1),this._minFPS=t,this._maxFPS=e,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,i||this.resume();}return e.prototype.updateOnce=function(e){e(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick);},e.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce());},e.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle));},e.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll();},Object.defineProperty(e.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeScale",{get:function(){return this._timeScale},set:function(e){this._timeScale!==e&&(this._timeScale=e);},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),e.prototype.animateOnce=function(){var e=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return e.onFrame()});},e.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce();},e.prototype.update=function(e,t){void 0===t&&(t=!0),this._currentTick++,this._currentTime+=e,this._tickDeltaTime=e,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),t&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick);},e.prototype.getTimer=function(){return Date.now()},e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;},function(e,t,i){!function(t,i){e.exports=i();}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t){var i=function(){function e(){this.functions=[];}return e.prototype.add=function(e){return this.functions.indexOf(e)===-1&&(this.functions.push(e),!0)},e.prototype.remove=function(e){var t=this.functions.indexOf(e);return t>-1&&(this.functions.splice(t,1),!0)},e.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=this.functions.concat();i.forEach(function(t){t.apply(void 0,e);});},Object.defineProperty(e.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;}])});}])});
43964
- } (FrameTicker$1));
43458
+ } (FrameTicker$3));
43965
43459
 
43966
- var FrameTicker = /*@__PURE__*/getDefaultExportFromCjs(FrameTicker$1.exports);
43460
+ var _FrameTicker = /*@__PURE__*/getDefaultExportFromCjs(FrameTicker$3.exports);
43967
43461
 
43968
43462
  function initRange(domain, range) {
43969
43463
  switch (arguments.length) {
@@ -46407,6 +45901,8 @@
46407
45901
 
46408
45902
  function defaultLocale(definition) {
46409
45903
  locale = formatLocale(definition);
45904
+ locale.format;
45905
+ locale.parse;
46410
45906
  utcFormat = locale.utcFormat;
46411
45907
  utcParse = locale.utcParse;
46412
45908
  return locale;
@@ -49201,8 +48697,6 @@
49201
48697
  }
49202
48698
  }
49203
48699
 
49204
- var arguments_ = [];
49205
-
49206
48700
  var ENVIRONMENT_IS_WEB = false;
49207
48701
  var ENVIRONMENT_IS_WORKER = false;
49208
48702
  var ENVIRONMENT_IS_NODE = false;
@@ -49259,7 +48753,7 @@
49259
48753
  process["argv"][1].replace(/\\/g, "/");
49260
48754
  }
49261
48755
 
49262
- arguments_ = process["argv"].slice(2);
48756
+ process["argv"].slice(2);
49263
48757
 
49264
48758
  Module["inspect"] = function () {
49265
48759
  return "[Emscripten Module object]";
@@ -49295,9 +48789,7 @@
49295
48789
  };
49296
48790
 
49297
48791
  if (typeof scriptArgs != "undefined") {
49298
- arguments_ = scriptArgs;
49299
- } else if (typeof arguments != "undefined") {
49300
- arguments_ = arguments;
48792
+ scriptArgs;
49301
48793
  }
49302
48794
 
49303
48795
  if (typeof print !== "undefined") {
@@ -49391,8 +48883,8 @@
49391
48883
  }
49392
48884
 
49393
48885
  moduleOverrides = null;
49394
- if (Module["arguments"]) { arguments_ = Module["arguments"]; }
49395
- if (Module["thisProgram"]) ;
48886
+ if (Module["arguments"]) { Module["arguments"]; }
48887
+ if (Module["thisProgram"]) { Module["thisProgram"]; }
49396
48888
 
49397
48889
  var tempRet0 = 0;
49398
48890
 
@@ -50079,7 +49571,6 @@
50079
49571
 
50080
49572
  function Z(a, b) {
50081
49573
  a = a | 0;
50082
- b = b | 0;
50083
49574
  S = a;
50084
49575
  }
50085
49576
 
@@ -61445,7 +60936,6 @@
61445
60936
  };
61446
60937
 
61447
60938
  function run(args) {
61448
- args = args || arguments_;
61449
60939
 
61450
60940
  if (runDependencies > 0) {
61451
60941
  return;
@@ -63152,7 +62642,7 @@
63152
62642
 
63153
62643
  for ( let p = 0, pl = paths.length; p < pl; p ++ ) {
63154
62644
 
63155
- Array.prototype.push.apply( shapes, paths[ p ].toShapes() );
62645
+ shapes.push( ...paths[ p ].toShapes() );
63156
62646
 
63157
62647
  }
63158
62648
 
@@ -64130,6 +63620,7 @@
64130
63620
  TubeBufferGeometry: TubeGeometry,
64131
63621
  Vector3: Vector3
64132
63622
  };
63623
+ var FrameTicker$2 = _FrameTicker["default"] || _FrameTicker;
64133
63624
  // support both modes for backwards threejs compatibility
64134
63625
 
64135
63626
  var setAttributeFn$1 = new THREE$c.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
@@ -64220,7 +63711,7 @@
64220
63711
 
64221
63712
  state.scene = threeObj; // Kick-off dash animations
64222
63713
 
64223
- new FrameTicker().onTick.add(function (_, timeDelta) {
63714
+ new FrameTicker$2().onTick.add(function (_, timeDelta) {
64224
63715
  state.arcsData.filter(function (d) {
64225
63716
  return d.__threeObj && d.__threeObj.children.length && d.__threeObj.children[0].material && d.__threeObj.children[0].__dashAnimateStep;
64226
63717
  }).forEach(function (d) {
@@ -65026,89 +64517,89 @@
65026
64517
  obj.material.color.set(colorStr2Hex(color));
65027
64518
  obj.material.transparent = opacity < 1;
65028
64519
  obj.material.opacity = opacity;
65029
- var h3Idxs = [];
65030
-
65031
- if (geoJson.type === 'Polygon') {
65032
- polyfill(geoJson.coordinates, h3Res, true).forEach(function (idx) {
65033
- return h3Idxs.push(idx);
65034
- });
65035
- } else if (geoJson.type === 'MultiPolygon') {
65036
- geoJson.coordinates.forEach(function (coords) {
65037
- return polyfill(coords, h3Res, true).forEach(function (idx) {
65038
- return h3Idxs.push(idx);
65039
- });
65040
- });
65041
- } else {
65042
- console.warn("Unsupported GeoJson geometry type: ".concat(geoJson.type, ". Skipping geometry..."));
65043
- }
65044
-
65045
- var hexBins = h3Idxs.map(function (h3Idx) {
65046
- var hexCenter = h3ToGeo(h3Idx);
65047
- var hexGeoJson = h3ToGeoBoundary(h3Idx, true).reverse(); // correct polygon winding
65048
- // stitch longitudes at the anti-meridian
65049
-
65050
- var centerLng = hexCenter[1];
65051
- hexGeoJson.forEach(function (d) {
65052
- var edgeLng = d[0];
65053
-
65054
- if (Math.abs(centerLng - edgeLng) > 170) {
65055
- // normalize large lng distances
65056
- d[0] += centerLng > edgeLng ? 360 : -360;
65057
- }
65058
- });
65059
- return {
65060
- h3Idx: h3Idx,
65061
- hexCenter: hexCenter,
65062
- hexGeoJson: hexGeoJson
65063
- };
65064
- });
65065
64520
  var targetD = {
65066
64521
  alt: alt,
65067
64522
  margin: margin,
65068
64523
  curvatureResolution: curvatureResolution
65069
64524
  };
64525
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
64526
+ alt: -1e-3
64527
+ });
65070
64528
 
65071
- var applyUpdate = function applyUpdate(td) {
65072
- var _obj$__currentTargetD = obj.__currentTargetD = td,
65073
- alt = _obj$__currentTargetD.alt,
65074
- margin = _obj$__currentTargetD.margin,
65075
- curvatureResolution = _obj$__currentTargetD.curvatureResolution;
65076
-
65077
- obj.geometry && obj.geometry.dispose();
65078
- obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : BufferGeometryUtils.mergeBufferGeometries(hexBins.map(function (h) {
65079
- // compute new geojson with relative margin
65080
- var relNum = function relNum(st, end, rat) {
65081
- return st - (st - end) * rat;
65082
- };
64529
+ if (Object.keys(targetD).some(function (k) {
64530
+ return currentTargetD[k] !== targetD[k];
64531
+ })) {
64532
+ var h3Idxs = [];
65083
64533
 
65084
- var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
65085
- clat = _h$hexCenter[0],
65086
- clng = _h$hexCenter[1];
64534
+ if (geoJson.type === 'Polygon') {
64535
+ polyfill(geoJson.coordinates, h3Res, true).forEach(function (idx) {
64536
+ return h3Idxs.push(idx);
64537
+ });
64538
+ } else if (geoJson.type === 'MultiPolygon') {
64539
+ geoJson.coordinates.forEach(function (coords) {
64540
+ return polyfill(coords, h3Res, true).forEach(function (idx) {
64541
+ return h3Idxs.push(idx);
64542
+ });
64543
+ });
64544
+ } else {
64545
+ console.warn("Unsupported GeoJson geometry type: ".concat(geoJson.type, ". Skipping geometry..."));
64546
+ }
65087
64547
 
65088
- var geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref) {
65089
- var _ref2 = _slicedToArray$1(_ref, 2),
65090
- elng = _ref2[0],
65091
- elat = _ref2[1];
64548
+ var hexBins = h3Idxs.map(function (h3Idx) {
64549
+ var hexCenter = h3ToGeo(h3Idx);
64550
+ var hexGeoJson = h3ToGeoBoundary(h3Idx, true).reverse(); // correct polygon winding
64551
+ // stitch longitudes at the anti-meridian
65092
64552
 
65093
- return [[elng, clng], [elat, clat]].map(function (_ref3) {
65094
- var _ref4 = _slicedToArray$1(_ref3, 2),
65095
- st = _ref4[0],
65096
- end = _ref4[1];
64553
+ var centerLng = hexCenter[1];
64554
+ hexGeoJson.forEach(function (d) {
64555
+ var edgeLng = d[0];
65097
64556
 
65098
- return relNum(st, end, margin);
65099
- });
64557
+ if (Math.abs(centerLng - edgeLng) > 170) {
64558
+ // normalize large lng distances
64559
+ d[0] += centerLng > edgeLng ? 360 : -360;
64560
+ }
65100
64561
  });
65101
- return new ConicPolygonBufferGeometry([geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
65102
- }));
65103
- };
64562
+ return {
64563
+ h3Idx: h3Idx,
64564
+ hexCenter: hexCenter,
64565
+ hexGeoJson: hexGeoJson
64566
+ };
64567
+ });
65104
64568
 
65105
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
65106
- alt: -1e-3
65107
- });
64569
+ var applyUpdate = function applyUpdate(td) {
64570
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
64571
+ alt = _obj$__currentTargetD.alt,
64572
+ margin = _obj$__currentTargetD.margin,
64573
+ curvatureResolution = _obj$__currentTargetD.curvatureResolution;
64574
+
64575
+ obj.geometry && obj.geometry.dispose();
64576
+ obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : BufferGeometryUtils.mergeBufferGeometries(hexBins.map(function (h) {
64577
+ // compute new geojson with relative margin
64578
+ var relNum = function relNum(st, end, rat) {
64579
+ return st - (st - end) * rat;
64580
+ };
64581
+
64582
+ var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
64583
+ clat = _h$hexCenter[0],
64584
+ clng = _h$hexCenter[1];
64585
+
64586
+ var geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref) {
64587
+ var _ref2 = _slicedToArray$1(_ref, 2),
64588
+ elng = _ref2[0],
64589
+ elat = _ref2[1];
64590
+
64591
+ return [[elng, clng], [elat, clat]].map(function (_ref3) {
64592
+ var _ref4 = _slicedToArray$1(_ref3, 2),
64593
+ st = _ref4[0],
64594
+ end = _ref4[1];
64595
+
64596
+ return relNum(st, end, margin);
64597
+ });
64598
+ });
64599
+ return new ConicPolygonBufferGeometry([geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
64600
+ }));
64601
+ };
65108
64602
 
65109
- if (Object.keys(targetD).some(function (k) {
65110
- return currentTargetD[k] !== targetD[k];
65111
- })) {
65112
64603
  if (!state.hexPolygonsTransitionDuration || state.hexPolygonsTransitionDuration < 0) {
65113
64604
  // set final position
65114
64605
  applyUpdate(targetD);
@@ -65168,6 +64659,7 @@
65168
64659
  ShaderMaterial: ShaderMaterial,
65169
64660
  Vector3: Vector3
65170
64661
  };
64662
+ var FrameTicker$1 = _FrameTicker["default"] || _FrameTicker;
65171
64663
  // support both modes for backwards threejs compatibility
65172
64664
 
65173
64665
  var setAttributeFn = new THREE$7.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
@@ -65254,7 +64746,7 @@
65254
64746
 
65255
64747
  state.scene = threeObj; // Kick-off dash animations
65256
64748
 
65257
- new FrameTicker().onTick.add(function (_, timeDelta) {
64749
+ new FrameTicker$1().onTick.add(function (_, timeDelta) {
65258
64750
  state.pathsData.filter(function (d) {
65259
64751
  return d.__threeObj && d.__threeObj.children.length && d.__threeObj.children[0].material && d.__threeObj.children[0].__dashAnimateStep;
65260
64752
  }).forEach(function (d) {
@@ -65963,6 +65455,7 @@
65963
65455
  LineBasicMaterial: LineBasicMaterial,
65964
65456
  Vector3: Vector3
65965
65457
  };
65458
+ var FrameTicker = _FrameTicker["default"] || _FrameTicker;
65966
65459
  var RingsLayerKapsule = index$2({
65967
65460
  props: {
65968
65461
  ringsData: {
@@ -68338,8 +67831,6 @@
68338
67831
 
68339
67832
  function onMouseMove( event ) {
68340
67833
 
68341
- if ( scope.enabled === false ) return;
68342
-
68343
67834
  switch ( state ) {
68344
67835
 
68345
67836
  case STATE.ROTATE:
@@ -70714,8 +70205,10 @@
70714
70205
  state.pointerPos.y = ev.pageY - offset.top; // Move tooltip
70715
70206
 
70716
70207
  state.toolTipElem.style.top = "".concat(state.pointerPos.y, "px");
70717
- state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px");
70718
- state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, 21px)"); // adjust horizontal position to not exceed canvas boundaries
70208
+ state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px"); // adjust horizontal position to not exceed canvas boundaries
70209
+
70210
+ state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, ").concat( // flip to above if near bottom
70211
+ state.height - state.pointerPos.y < 100 ? 'calc(-100% - 8px)' : '21px', ")");
70719
70212
  }
70720
70213
 
70721
70214
  function getOffset(el) {