globe.gl 2.28.3 → 2.28.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.28.3 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.28.5 globe.gl - https://github.com/vasturiano/globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -142,7 +142,7 @@
142
142
  * Copyright 2010-2023 Three.js Authors
143
143
  * SPDX-License-Identifier: MIT
144
144
  */
145
- const REVISION = '152';
145
+ const REVISION = '153';
146
146
 
147
147
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
148
148
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -283,11 +283,23 @@
283
283
  const KeepStencilOp = 7680;
284
284
  const AlwaysStencilFunc = 519;
285
285
 
286
+ const NeverCompare = 512;
287
+ const LessCompare = 513;
288
+ const EqualCompare = 514;
289
+ const LessEqualCompare = 515;
290
+ const GreaterCompare = 516;
291
+ const NotEqualCompare = 517;
292
+ const GreaterEqualCompare = 518;
293
+ const AlwaysCompare = 519;
294
+
286
295
  const StaticDrawUsage = 35044;
287
296
  const GLSL3 = '300 es';
288
297
 
289
298
  const _SRGBAFormat = 1035; // fallback for WebGL 1
290
299
 
300
+ const WebGLCoordinateSystem = 2000;
301
+ const WebGPUCoordinateSystem = 2001;
302
+
291
303
  /**
292
304
  * https://github.com/mrdoob/eventdispatcher.js/
293
305
  */
@@ -610,6 +622,10 @@
610
622
 
611
623
  return value;
612
624
 
625
+ case Uint32Array:
626
+
627
+ return value / 4294967295.0;
628
+
613
629
  case Uint16Array:
614
630
 
615
631
  return value / 65535.0;
@@ -618,6 +634,10 @@
618
634
 
619
635
  return value / 255.0;
620
636
 
637
+ case Int32Array:
638
+
639
+ return Math.max( value / 2147483647.0, - 1.0 );
640
+
621
641
  case Int16Array:
622
642
 
623
643
  return Math.max( value / 32767.0, - 1.0 );
@@ -642,6 +662,10 @@
642
662
 
643
663
  return value;
644
664
 
665
+ case Uint32Array:
666
+
667
+ return Math.round( value * 4294967295.0 );
668
+
645
669
  case Uint16Array:
646
670
 
647
671
  return Math.round( value * 65535.0 );
@@ -650,6 +674,10 @@
650
674
 
651
675
  return Math.round( value * 255.0 );
652
676
 
677
+ case Int32Array:
678
+
679
+ return Math.round( value * 2147483647.0 );
680
+
653
681
  case Int16Array:
654
682
 
655
683
  return Math.round( value * 32767.0 );
@@ -1172,7 +1200,7 @@
1172
1200
 
1173
1201
  class Matrix3 {
1174
1202
 
1175
- constructor() {
1203
+ constructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
1176
1204
 
1177
1205
  Matrix3.prototype.isMatrix3 = true;
1178
1206
 
@@ -1184,6 +1212,12 @@
1184
1212
 
1185
1213
  ];
1186
1214
 
1215
+ if ( n11 !== undefined ) {
1216
+
1217
+ this.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );
1218
+
1219
+ }
1220
+
1187
1221
  }
1188
1222
 
1189
1223
  set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
@@ -1433,13 +1467,27 @@
1433
1467
 
1434
1468
  makeTranslation( x, y ) {
1435
1469
 
1436
- this.set(
1470
+ if ( x.isVector2 ) {
1437
1471
 
1438
- 1, 0, x,
1439
- 0, 1, y,
1440
- 0, 0, 1
1472
+ this.set(
1441
1473
 
1442
- );
1474
+ 1, 0, x.x,
1475
+ 0, 1, x.y,
1476
+ 0, 0, 1
1477
+
1478
+ );
1479
+
1480
+ } else {
1481
+
1482
+ this.set(
1483
+
1484
+ 1, 0, x,
1485
+ 0, 1, y,
1486
+ 0, 0, 1
1487
+
1488
+ );
1489
+
1490
+ }
1443
1491
 
1444
1492
  return this;
1445
1493
 
@@ -1825,12 +1873,16 @@
1825
1873
 
1826
1874
  }
1827
1875
 
1876
+ let sourceId = 0;
1877
+
1828
1878
  class Source {
1829
1879
 
1830
1880
  constructor( data = null ) {
1831
1881
 
1832
1882
  this.isSource = true;
1833
1883
 
1884
+ Object.defineProperty( this, 'id', { value: sourceId ++ } );
1885
+
1834
1886
  this.uuid = generateUUID();
1835
1887
 
1836
1888
  this.data = data;
@@ -2094,7 +2146,7 @@
2094
2146
  const output = {
2095
2147
 
2096
2148
  metadata: {
2097
- version: 4.5,
2149
+ version: 4.6,
2098
2150
  type: 'Texture',
2099
2151
  generator: 'Texture.toJSON'
2100
2152
  },
@@ -5718,7 +5770,7 @@
5718
5770
 
5719
5771
  class Matrix4 {
5720
5772
 
5721
- constructor() {
5773
+ constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
5722
5774
 
5723
5775
  Matrix4.prototype.isMatrix4 = true;
5724
5776
 
@@ -5731,6 +5783,12 @@
5731
5783
 
5732
5784
  ];
5733
5785
 
5786
+ if ( n11 !== undefined ) {
5787
+
5788
+ this.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );
5789
+
5790
+ }
5791
+
5734
5792
  }
5735
5793
 
5736
5794
  set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
@@ -6270,14 +6328,29 @@
6270
6328
 
6271
6329
  makeTranslation( x, y, z ) {
6272
6330
 
6273
- this.set(
6331
+ if ( x.isVector3 ) {
6274
6332
 
6275
- 1, 0, 0, x,
6276
- 0, 1, 0, y,
6277
- 0, 0, 1, z,
6278
- 0, 0, 0, 1
6333
+ this.set(
6279
6334
 
6280
- );
6335
+ 1, 0, 0, x.x,
6336
+ 0, 1, 0, x.y,
6337
+ 0, 0, 1, x.z,
6338
+ 0, 0, 0, 1
6339
+
6340
+ );
6341
+
6342
+ } else {
6343
+
6344
+ this.set(
6345
+
6346
+ 1, 0, 0, x,
6347
+ 0, 1, 0, y,
6348
+ 0, 0, 1, z,
6349
+ 0, 0, 0, 1
6350
+
6351
+ );
6352
+
6353
+ }
6281
6354
 
6282
6355
  return this;
6283
6356
 
@@ -6468,7 +6541,7 @@
6468
6541
 
6469
6542
  }
6470
6543
 
6471
- makePerspective( left, right, top, bottom, near, far ) {
6544
+ makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
6472
6545
 
6473
6546
  const te = this.elements;
6474
6547
  const x = 2 * near / ( right - left );
@@ -6476,19 +6549,35 @@
6476
6549
 
6477
6550
  const a = ( right + left ) / ( right - left );
6478
6551
  const b = ( top + bottom ) / ( top - bottom );
6479
- const c = - ( far + near ) / ( far - near );
6480
- const d = - 2 * far * near / ( far - near );
6481
6552
 
6482
- te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
6483
- te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
6484
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
6553
+ let c, d;
6554
+
6555
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
6556
+
6557
+ c = - ( far + near ) / ( far - near );
6558
+ d = ( - 2 * far * near ) / ( far - near );
6559
+
6560
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
6561
+
6562
+ c = - far / ( far - near );
6563
+ d = ( - far * near ) / ( far - near );
6564
+
6565
+ } else {
6566
+
6567
+ throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
6568
+
6569
+ }
6570
+
6571
+ te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
6572
+ te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
6573
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
6485
6574
  te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
6486
6575
 
6487
6576
  return this;
6488
6577
 
6489
6578
  }
6490
6579
 
6491
- makeOrthographic( left, right, top, bottom, near, far ) {
6580
+ makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
6492
6581
 
6493
6582
  const te = this.elements;
6494
6583
  const w = 1.0 / ( right - left );
@@ -6497,12 +6586,29 @@
6497
6586
 
6498
6587
  const x = ( right + left ) * w;
6499
6588
  const y = ( top + bottom ) * h;
6500
- const z = ( far + near ) * p;
6501
6589
 
6502
- te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
6503
- te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
6504
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
6505
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
6590
+ let z, zInv;
6591
+
6592
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
6593
+
6594
+ z = ( far + near ) * p;
6595
+ zInv = - 2 * p;
6596
+
6597
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
6598
+
6599
+ z = near * p;
6600
+ zInv = - 1 * p;
6601
+
6602
+ } else {
6603
+
6604
+ throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
6605
+
6606
+ }
6607
+
6608
+ te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
6609
+ te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
6610
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = zInv; te[ 14 ] = - z;
6611
+ te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
6506
6612
 
6507
6613
  return this;
6508
6614
 
@@ -7627,7 +7733,7 @@
7627
7733
  };
7628
7734
 
7629
7735
  output.metadata = {
7630
- version: 4.5,
7736
+ version: 4.6,
7631
7737
  type: 'Object',
7632
7738
  generator: 'Object3D.toJSON'
7633
7739
  };
@@ -8393,7 +8499,7 @@
8393
8499
 
8394
8500
  const data = {
8395
8501
  metadata: {
8396
- version: 4.5,
8502
+ version: 4.6,
8397
8503
  type: 'Material',
8398
8504
  generator: 'Material.toJSON'
8399
8505
  }
@@ -8458,6 +8564,15 @@
8458
8564
 
8459
8565
  }
8460
8566
 
8567
+ if ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;
8568
+ if ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;
8569
+
8570
+ if ( this.anisotropyMap && this.anisotropyMap.isTexture ) {
8571
+
8572
+ data.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;
8573
+
8574
+ }
8575
+
8461
8576
  if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;
8462
8577
  if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;
8463
8578
  if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
@@ -8770,30 +8885,35 @@
8770
8885
  this.g = 1;
8771
8886
  this.b = 1;
8772
8887
 
8888
+ return this.set( r, g, b );
8889
+
8890
+ }
8891
+
8892
+ set( r, g, b ) {
8893
+
8773
8894
  if ( g === undefined && b === undefined ) {
8774
8895
 
8775
8896
  // r is THREE.Color, hex or string
8776
- return this.set( r );
8777
8897
 
8778
- }
8898
+ const value = r;
8779
8899
 
8780
- return this.setRGB( r, g, b );
8900
+ if ( value && value.isColor ) {
8781
8901
 
8782
- }
8902
+ this.copy( value );
8783
8903
 
8784
- set( value ) {
8904
+ } else if ( typeof value === 'number' ) {
8785
8905
 
8786
- if ( value && value.isColor ) {
8906
+ this.setHex( value );
8787
8907
 
8788
- this.copy( value );
8908
+ } else if ( typeof value === 'string' ) {
8789
8909
 
8790
- } else if ( typeof value === 'number' ) {
8910
+ this.setStyle( value );
8791
8911
 
8792
- this.setHex( value );
8912
+ }
8793
8913
 
8794
- } else if ( typeof value === 'string' ) {
8914
+ } else {
8795
8915
 
8796
- this.setStyle( value );
8916
+ this.setRGB( r, g, b );
8797
8917
 
8798
8918
  }
8799
8919
 
@@ -9438,6 +9558,7 @@
9438
9558
 
9439
9559
  this.usage = StaticDrawUsage;
9440
9560
  this.updateRange = { offset: 0, count: - 1 };
9561
+ this.gpuType = FloatType;
9441
9562
 
9442
9563
  this.version = 0;
9443
9564
 
@@ -9468,6 +9589,7 @@
9468
9589
  this.normalized = source.normalized;
9469
9590
 
9470
9591
  this.usage = source.usage;
9592
+ this.gpuType = source.gpuType;
9471
9593
 
9472
9594
  return this;
9473
9595
 
@@ -10656,7 +10778,7 @@
10656
10778
 
10657
10779
  const data = {
10658
10780
  metadata: {
10659
- version: 4.5,
10781
+ version: 4.6,
10660
10782
  type: 'BufferGeometry',
10661
10783
  generator: 'BufferGeometry.toJSON'
10662
10784
  }
@@ -10884,9 +11006,9 @@
10884
11006
 
10885
11007
  }
10886
11008
 
10887
- const _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();
10888
- const _ray$2 = /*@__PURE__*/ new Ray();
10889
- const _sphere$4 = /*@__PURE__*/ new Sphere();
11009
+ const _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();
11010
+ const _ray$3 = /*@__PURE__*/ new Ray();
11011
+ const _sphere$5 = /*@__PURE__*/ new Sphere();
10890
11012
  const _sphereHitAt = /*@__PURE__*/ new Vector3();
10891
11013
 
10892
11014
  const _vA$1 = /*@__PURE__*/ new Vector3();
@@ -11030,41 +11152,45 @@
11030
11152
 
11031
11153
  if ( material === undefined ) return;
11032
11154
 
11033
- // Checking boundingSphere distance to ray
11155
+ // test with bounding sphere in world space
11034
11156
 
11035
11157
  if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
11036
11158
 
11037
- _sphere$4.copy( geometry.boundingSphere );
11038
- _sphere$4.applyMatrix4( matrixWorld );
11159
+ _sphere$5.copy( geometry.boundingSphere );
11160
+ _sphere$5.applyMatrix4( matrixWorld );
11039
11161
 
11040
- _ray$2.copy( raycaster.ray ).recast( raycaster.near );
11162
+ // check distance from ray origin to bounding sphere
11041
11163
 
11042
- if ( _sphere$4.containsPoint( _ray$2.origin ) === false ) {
11164
+ _ray$3.copy( raycaster.ray ).recast( raycaster.near );
11043
11165
 
11044
- if ( _ray$2.intersectSphere( _sphere$4, _sphereHitAt ) === null ) return;
11166
+ if ( _sphere$5.containsPoint( _ray$3.origin ) === false ) {
11045
11167
 
11046
- if ( _ray$2.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;
11168
+ if ( _ray$3.intersectSphere( _sphere$5, _sphereHitAt ) === null ) return;
11169
+
11170
+ if ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;
11047
11171
 
11048
11172
  }
11049
11173
 
11050
- //
11174
+ // convert ray to local space of mesh
11051
11175
 
11052
- _inverseMatrix$2.copy( matrixWorld ).invert();
11053
- _ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );
11176
+ _inverseMatrix$3.copy( matrixWorld ).invert();
11177
+ _ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );
11054
11178
 
11055
- // Check boundingBox before continuing
11179
+ // test with bounding box in local space
11056
11180
 
11057
11181
  if ( geometry.boundingBox !== null ) {
11058
11182
 
11059
- if ( _ray$2.intersectsBox( geometry.boundingBox ) === false ) return;
11183
+ if ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;
11060
11184
 
11061
11185
  }
11062
11186
 
11063
- this._computeIntersections( raycaster, intersects );
11187
+ // test for intersections with geometry
11188
+
11189
+ this._computeIntersections( raycaster, intersects, _ray$3 );
11064
11190
 
11065
11191
  }
11066
11192
 
11067
- _computeIntersections( raycaster, intersects ) {
11193
+ _computeIntersections( raycaster, intersects, rayLocalSpace ) {
11068
11194
 
11069
11195
  let intersection;
11070
11196
 
@@ -11099,7 +11225,7 @@
11099
11225
  const b = index.getX( j + 1 );
11100
11226
  const c = index.getX( j + 2 );
11101
11227
 
11102
- intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv1, normal, a, b, c );
11228
+ intersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
11103
11229
 
11104
11230
  if ( intersection ) {
11105
11231
 
@@ -11124,7 +11250,7 @@
11124
11250
  const b = index.getX( i + 1 );
11125
11251
  const c = index.getX( i + 2 );
11126
11252
 
11127
- intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv, uv1, normal, a, b, c );
11253
+ intersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
11128
11254
 
11129
11255
  if ( intersection ) {
11130
11256
 
@@ -11157,7 +11283,7 @@
11157
11283
  const b = j + 1;
11158
11284
  const c = j + 2;
11159
11285
 
11160
- intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray$2, uv, uv1, normal, a, b, c );
11286
+ intersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
11161
11287
 
11162
11288
  if ( intersection ) {
11163
11289
 
@@ -11182,7 +11308,7 @@
11182
11308
  const b = i + 1;
11183
11309
  const c = i + 2;
11184
11310
 
11185
- intersection = checkGeometryIntersection( this, material, raycaster, _ray$2, uv, uv1, normal, a, b, c );
11311
+ intersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
11186
11312
 
11187
11313
  if ( intersection ) {
11188
11314
 
@@ -11259,7 +11385,7 @@
11259
11385
  _uvC$1.fromBufferAttribute( uv1, c );
11260
11386
 
11261
11387
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
11262
- intersection.uv2 = intersection.uv1; // Backwards compatibility
11388
+ intersection.uv2 = intersection.uv1; // @deprecated, r152
11263
11389
 
11264
11390
  }
11265
11391
 
@@ -11772,6 +11898,8 @@
11772
11898
  this.projectionMatrix = new Matrix4();
11773
11899
  this.projectionMatrixInverse = new Matrix4();
11774
11900
 
11901
+ this.coordinateSystem = WebGLCoordinateSystem;
11902
+
11775
11903
  }
11776
11904
 
11777
11905
  copy( source, recursive ) {
@@ -11783,6 +11911,8 @@
11783
11911
  this.projectionMatrix.copy( source.projectionMatrix );
11784
11912
  this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
11785
11913
 
11914
+ this.coordinateSystem = source.coordinateSystem;
11915
+
11786
11916
  return this;
11787
11917
 
11788
11918
  }
@@ -12020,7 +12150,7 @@
12020
12150
  const skew = this.filmOffset;
12021
12151
  if ( skew !== 0 ) left += near * skew / this.getFilmWidth();
12022
12152
 
12023
- this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far );
12153
+ this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );
12024
12154
 
12025
12155
  this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
12026
12156
 
@@ -12062,51 +12192,114 @@
12062
12192
  this.type = 'CubeCamera';
12063
12193
 
12064
12194
  this.renderTarget = renderTarget;
12195
+ this.coordinateSystem = null;
12065
12196
 
12066
12197
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
12067
12198
  cameraPX.layers = this.layers;
12068
- cameraPX.up.set( 0, 1, 0 );
12069
- cameraPX.lookAt( 1, 0, 0 );
12070
12199
  this.add( cameraPX );
12071
12200
 
12072
12201
  const cameraNX = new PerspectiveCamera( fov, aspect, near, far );
12073
12202
  cameraNX.layers = this.layers;
12074
- cameraNX.up.set( 0, 1, 0 );
12075
- cameraNX.lookAt( - 1, 0, 0 );
12076
12203
  this.add( cameraNX );
12077
12204
 
12078
12205
  const cameraPY = new PerspectiveCamera( fov, aspect, near, far );
12079
12206
  cameraPY.layers = this.layers;
12080
- cameraPY.up.set( 0, 0, - 1 );
12081
- cameraPY.lookAt( 0, 1, 0 );
12082
12207
  this.add( cameraPY );
12083
12208
 
12084
12209
  const cameraNY = new PerspectiveCamera( fov, aspect, near, far );
12085
12210
  cameraNY.layers = this.layers;
12086
- cameraNY.up.set( 0, 0, 1 );
12087
- cameraNY.lookAt( 0, - 1, 0 );
12088
12211
  this.add( cameraNY );
12089
12212
 
12090
12213
  const cameraPZ = new PerspectiveCamera( fov, aspect, near, far );
12091
12214
  cameraPZ.layers = this.layers;
12092
- cameraPZ.up.set( 0, 1, 0 );
12093
- cameraPZ.lookAt( 0, 0, 1 );
12094
12215
  this.add( cameraPZ );
12095
12216
 
12096
12217
  const cameraNZ = new PerspectiveCamera( fov, aspect, near, far );
12097
12218
  cameraNZ.layers = this.layers;
12098
- cameraNZ.up.set( 0, 1, 0 );
12099
- cameraNZ.lookAt( 0, 0, - 1 );
12100
12219
  this.add( cameraNZ );
12101
12220
 
12102
12221
  }
12103
12222
 
12223
+ updateCoordinateSystem() {
12224
+
12225
+ const coordinateSystem = this.coordinateSystem;
12226
+
12227
+ const cameras = this.children.concat();
12228
+
12229
+ const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;
12230
+
12231
+ for ( const camera of cameras ) this.remove( camera );
12232
+
12233
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
12234
+
12235
+ cameraPX.up.set( 0, 1, 0 );
12236
+ cameraPX.lookAt( 1, 0, 0 );
12237
+
12238
+ cameraNX.up.set( 0, 1, 0 );
12239
+ cameraNX.lookAt( - 1, 0, 0 );
12240
+
12241
+ cameraPY.up.set( 0, 0, - 1 );
12242
+ cameraPY.lookAt( 0, 1, 0 );
12243
+
12244
+ cameraNY.up.set( 0, 0, 1 );
12245
+ cameraNY.lookAt( 0, - 1, 0 );
12246
+
12247
+ cameraPZ.up.set( 0, 1, 0 );
12248
+ cameraPZ.lookAt( 0, 0, 1 );
12249
+
12250
+ cameraNZ.up.set( 0, 1, 0 );
12251
+ cameraNZ.lookAt( 0, 0, - 1 );
12252
+
12253
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
12254
+
12255
+ cameraPX.up.set( 0, - 1, 0 );
12256
+ cameraPX.lookAt( - 1, 0, 0 );
12257
+
12258
+ cameraNX.up.set( 0, - 1, 0 );
12259
+ cameraNX.lookAt( 1, 0, 0 );
12260
+
12261
+ cameraPY.up.set( 0, 0, 1 );
12262
+ cameraPY.lookAt( 0, 1, 0 );
12263
+
12264
+ cameraNY.up.set( 0, 0, - 1 );
12265
+ cameraNY.lookAt( 0, - 1, 0 );
12266
+
12267
+ cameraPZ.up.set( 0, - 1, 0 );
12268
+ cameraPZ.lookAt( 0, 0, 1 );
12269
+
12270
+ cameraNZ.up.set( 0, - 1, 0 );
12271
+ cameraNZ.lookAt( 0, 0, - 1 );
12272
+
12273
+ } else {
12274
+
12275
+ throw new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );
12276
+
12277
+ }
12278
+
12279
+ for ( const camera of cameras ) {
12280
+
12281
+ this.add( camera );
12282
+
12283
+ camera.updateMatrixWorld();
12284
+
12285
+ }
12286
+
12287
+ }
12288
+
12104
12289
  update( renderer, scene ) {
12105
12290
 
12106
12291
  if ( this.parent === null ) this.updateMatrixWorld();
12107
12292
 
12108
12293
  const renderTarget = this.renderTarget;
12109
12294
 
12295
+ if ( this.coordinateSystem !== renderer.coordinateSystem ) {
12296
+
12297
+ this.coordinateSystem = renderer.coordinateSystem;
12298
+
12299
+ this.updateCoordinateSystem();
12300
+
12301
+ }
12302
+
12110
12303
  const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
12111
12304
 
12112
12305
  const currentRenderTarget = renderer.getRenderTarget();
@@ -12526,7 +12719,7 @@
12526
12719
 
12527
12720
  }
12528
12721
 
12529
- const _sphere$3 = /*@__PURE__*/ new Sphere();
12722
+ const _sphere$4 = /*@__PURE__*/ new Sphere();
12530
12723
  const _vector$6 = /*@__PURE__*/ new Vector3();
12531
12724
 
12532
12725
  class Frustum {
@@ -12566,7 +12759,7 @@
12566
12759
 
12567
12760
  }
12568
12761
 
12569
- setFromProjectionMatrix( m ) {
12762
+ setFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {
12570
12763
 
12571
12764
  const planes = this.planes;
12572
12765
  const me = m.elements;
@@ -12580,7 +12773,20 @@
12580
12773
  planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
12581
12774
  planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
12582
12775
  planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
12583
- planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
12776
+
12777
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
12778
+
12779
+ planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
12780
+
12781
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
12782
+
12783
+ planes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();
12784
+
12785
+ } else {
12786
+
12787
+ throw new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );
12788
+
12789
+ }
12584
12790
 
12585
12791
  return this;
12586
12792
 
@@ -12592,7 +12798,7 @@
12592
12798
 
12593
12799
  if ( object.boundingSphere === null ) object.computeBoundingSphere();
12594
12800
 
12595
- _sphere$3.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );
12801
+ _sphere$4.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );
12596
12802
 
12597
12803
  } else {
12598
12804
 
@@ -12600,21 +12806,21 @@
12600
12806
 
12601
12807
  if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
12602
12808
 
12603
- _sphere$3.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
12809
+ _sphere$4.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
12604
12810
 
12605
12811
  }
12606
12812
 
12607
- return this.intersectsSphere( _sphere$3 );
12813
+ return this.intersectsSphere( _sphere$4 );
12608
12814
 
12609
12815
  }
12610
12816
 
12611
12817
  intersectsSprite( sprite ) {
12612
12818
 
12613
- _sphere$3.center.set( 0, 0, 0 );
12614
- _sphere$3.radius = 0.7071067811865476;
12615
- _sphere$3.applyMatrix4( sprite.matrixWorld );
12819
+ _sphere$4.center.set( 0, 0, 0 );
12820
+ _sphere$4.radius = 0.7071067811865476;
12821
+ _sphere$4.applyMatrix4( sprite.matrixWorld );
12616
12822
 
12617
- return this.intersectsSphere( _sphere$3 );
12823
+ return this.intersectsSphere( _sphere$4 );
12618
12824
 
12619
12825
  }
12620
12826
 
@@ -13117,7 +13323,7 @@
13117
13323
 
13118
13324
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
13119
13325
 
13120
- var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif";
13326
+ var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13121
13327
 
13122
13328
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13123
13329
 
@@ -13127,13 +13333,13 @@
13127
13333
 
13128
13334
  var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
13129
13335
 
13130
- var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif";
13336
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13131
13337
 
13132
- var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13338
+ var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13133
13339
 
13134
13340
  var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
13135
13341
 
13136
- var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\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";
13342
+ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13137
13343
 
13138
13344
  var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif";
13139
13345
 
@@ -13165,7 +13371,7 @@
13165
13371
 
13166
13372
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
13167
13373
 
13168
- var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_NORMALMAP_TANGENTSPACE\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
13374
+ var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
13169
13375
 
13170
13376
  var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
13171
13377
 
@@ -13175,7 +13381,7 @@
13175
13381
 
13176
13382
  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";
13177
13383
 
13178
- var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
13384
+ var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
13179
13385
 
13180
13386
  var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
13181
13387
 
@@ -13185,7 +13391,7 @@
13185
13391
 
13186
13392
  var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";
13187
13393
 
13188
- var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
13394
+ var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
13189
13395
 
13190
13396
  var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}";
13191
13397
 
@@ -13223,17 +13429,17 @@
13223
13429
 
13224
13430
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13225
13431
 
13226
- var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13432
+ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13227
13433
 
13228
- var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
13434
+ var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
13229
13435
 
13230
- var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
13436
+ var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
13231
13437
 
13232
- var uv_pars_fragment = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
13438
+ var uv_pars_fragment = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
13233
13439
 
13234
- var uv_pars_vertex = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
13440
+ var uv_pars_vertex = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
13235
13441
 
13236
- var uv_vertex = "#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
13442
+ var uv_vertex = "#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
13237
13443
 
13238
13444
  var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
13239
13445
 
@@ -13287,7 +13493,7 @@
13287
13493
 
13288
13494
  const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13289
13495
 
13290
- const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13496
+ const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13291
13497
 
13292
13498
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13293
13499
 
@@ -13649,6 +13855,7 @@
13649
13855
  scale: { value: 1.0 },
13650
13856
  map: { value: null },
13651
13857
  alphaMap: { value: null },
13858
+ alphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },
13652
13859
  alphaTest: { value: 0 },
13653
13860
  uvTransform: { value: /*@__PURE__*/ new Matrix3() }
13654
13861
 
@@ -13663,6 +13870,7 @@
13663
13870
  map: { value: null },
13664
13871
  mapTransform: { value: /*@__PURE__*/ new Matrix3() },
13665
13872
  alphaMap: { value: null },
13873
+ alphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },
13666
13874
  alphaTest: { value: 0 }
13667
13875
 
13668
13876
  }
@@ -14006,7 +14214,10 @@
14006
14214
  specularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },
14007
14215
  specularIntensity: { value: 1 },
14008
14216
  specularIntensityMap: { value: null },
14009
- specularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() }
14217
+ specularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },
14218
+ anisotropyVector: { value: /*@__PURE__*/ new Vector2() },
14219
+ anisotropyMap: { value: null },
14220
+ anisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },
14010
14221
  }
14011
14222
  ] ),
14012
14223
 
@@ -14568,9 +14779,9 @@
14568
14779
 
14569
14780
  }
14570
14781
 
14571
- function vertexAttribPointer( index, size, type, normalized, stride, offset ) {
14782
+ function vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {
14572
14783
 
14573
- if ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT ) ) {
14784
+ if ( integer === true ) {
14574
14785
 
14575
14786
  gl.vertexAttribIPointer( index, size, type, stride, offset );
14576
14787
 
@@ -14628,6 +14839,10 @@
14628
14839
  const type = attribute.type;
14629
14840
  const bytesPerElement = attribute.bytesPerElement;
14630
14841
 
14842
+ // check for integer attributes (WebGL 2 only)
14843
+
14844
+ const integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );
14845
+
14631
14846
  if ( geometryAttribute.isInterleavedBufferAttribute ) {
14632
14847
 
14633
14848
  const data = geometryAttribute.data;
@@ -14668,7 +14883,8 @@
14668
14883
  type,
14669
14884
  normalized,
14670
14885
  stride * bytesPerElement,
14671
- ( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement
14886
+ ( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,
14887
+ integer
14672
14888
  );
14673
14889
 
14674
14890
  }
@@ -14709,7 +14925,8 @@
14709
14925
  type,
14710
14926
  normalized,
14711
14927
  size * bytesPerElement,
14712
- ( size / programAttribute.locationSize ) * i * bytesPerElement
14928
+ ( size / programAttribute.locationSize ) * i * bytesPerElement,
14929
+ integer
14713
14930
  );
14714
14931
 
14715
14932
  }
@@ -15417,7 +15634,7 @@
15417
15634
 
15418
15635
  }
15419
15636
 
15420
- this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );
15637
+ this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );
15421
15638
 
15422
15639
  this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
15423
15640
 
@@ -16558,6 +16775,18 @@
16558
16775
 
16559
16776
  }
16560
16777
 
16778
+ for ( const name in geometry.morphAttributes ) {
16779
+
16780
+ const array = geometry.morphAttributes[ name ];
16781
+
16782
+ for ( let i = 0, l = array.length; i < l; i ++ ) {
16783
+
16784
+ attributes.remove( array[ i ] );
16785
+
16786
+ }
16787
+
16788
+ }
16789
+
16561
16790
  geometry.removeEventListener( 'dispose', onGeometryDispose );
16562
16791
 
16563
16792
  delete geometries[ geometry.id ];
@@ -16847,7 +17076,6 @@
16847
17076
 
16848
17077
  function reset() {
16849
17078
 
16850
- render.frame ++;
16851
17079
  render.calls = 0;
16852
17080
  render.triangles = 0;
16853
17081
  render.points = 0;
@@ -17272,6 +17500,7 @@
17272
17500
  *
17273
17501
  */
17274
17502
 
17503
+
17275
17504
  const emptyTexture = /*@__PURE__*/ new Texture();
17276
17505
  const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
17277
17506
  const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
@@ -18795,6 +19024,9 @@
18795
19024
 
18796
19025
  prefixVertex = [
18797
19026
 
19027
+ '#define SHADER_TYPE ' + parameters.shaderType,
19028
+ '#define SHADER_NAME ' + parameters.shaderName,
19029
+
18798
19030
  customDefines
18799
19031
 
18800
19032
  ].filter( filterEmptyLine ).join( '\n' );
@@ -18808,6 +19040,10 @@
18808
19040
  prefixFragment = [
18809
19041
 
18810
19042
  customExtensions,
19043
+
19044
+ '#define SHADER_TYPE ' + parameters.shaderType,
19045
+ '#define SHADER_NAME ' + parameters.shaderName,
19046
+
18811
19047
  customDefines
18812
19048
 
18813
19049
  ].filter( filterEmptyLine ).join( '\n' );
@@ -18824,6 +19060,7 @@
18824
19060
 
18825
19061
  generatePrecision( parameters ),
18826
19062
 
19063
+ '#define SHADER_TYPE ' + parameters.shaderType,
18827
19064
  '#define SHADER_NAME ' + parameters.shaderName,
18828
19065
 
18829
19066
  customDefines,
@@ -18846,6 +19083,8 @@
18846
19083
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
18847
19084
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
18848
19085
 
19086
+ parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19087
+
18849
19088
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
18850
19089
  parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
18851
19090
  parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
@@ -18882,6 +19121,8 @@
18882
19121
  parameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',
18883
19122
  parameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',
18884
19123
 
19124
+ parameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',
19125
+
18885
19126
  parameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',
18886
19127
  parameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',
18887
19128
  parameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',
@@ -18928,6 +19169,8 @@
18928
19169
 
18929
19170
  parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
18930
19171
 
19172
+ parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19173
+
18931
19174
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
18932
19175
  ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
18933
19176
 
@@ -19031,6 +19274,7 @@
19031
19274
 
19032
19275
  generatePrecision( parameters ),
19033
19276
 
19277
+ '#define SHADER_TYPE ' + parameters.shaderType,
19034
19278
  '#define SHADER_NAME ' + parameters.shaderName,
19035
19279
 
19036
19280
  customDefines,
@@ -19055,6 +19299,9 @@
19055
19299
  parameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
19056
19300
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
19057
19301
 
19302
+ parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
19303
+ parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19304
+
19058
19305
  parameters.clearcoat ? '#define USE_CLEARCOAT' : '',
19059
19306
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
19060
19307
  parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
@@ -19326,6 +19573,7 @@
19326
19573
 
19327
19574
  //
19328
19575
 
19576
+ this.type = parameters.shaderType;
19329
19577
  this.name = parameters.shaderName;
19330
19578
  this.id = programIdCount ++;
19331
19579
  this.cacheKey = cacheKey;
@@ -19493,11 +19741,9 @@
19493
19741
 
19494
19742
  function getChannel( value ) {
19495
19743
 
19496
- if ( value === 1 ) return 'uv1';
19497
- if ( value === 2 ) return 'uv2';
19498
- if ( value === 3 ) return 'uv3';
19744
+ if ( value === 0 ) return 'uv';
19499
19745
 
19500
- return 'uv';
19746
+ return `uv${ value }`;
19501
19747
 
19502
19748
  }
19503
19749
 
@@ -19579,11 +19825,14 @@
19579
19825
  const HAS_METALNESSMAP = !! material.metalnessMap;
19580
19826
  const HAS_ROUGHNESSMAP = !! material.roughnessMap;
19581
19827
 
19828
+ const HAS_ANISOTROPY = material.anisotropy > 0;
19582
19829
  const HAS_CLEARCOAT = material.clearcoat > 0;
19583
19830
  const HAS_IRIDESCENCE = material.iridescence > 0;
19584
19831
  const HAS_SHEEN = material.sheen > 0;
19585
19832
  const HAS_TRANSMISSION = material.transmission > 0;
19586
19833
 
19834
+ const HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;
19835
+
19587
19836
  const HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;
19588
19837
  const HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;
19589
19838
  const HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;
@@ -19618,7 +19867,8 @@
19618
19867
  isWebGL2: IS_WEBGL2,
19619
19868
 
19620
19869
  shaderID: shaderID,
19621
- shaderName: material.type,
19870
+ shaderType: material.type,
19871
+ shaderName: material.name,
19622
19872
 
19623
19873
  vertexShader: vertexShader,
19624
19874
  fragmentShader: fragmentShader,
@@ -19656,6 +19906,9 @@
19656
19906
  metalnessMap: HAS_METALNESSMAP,
19657
19907
  roughnessMap: HAS_ROUGHNESSMAP,
19658
19908
 
19909
+ anisotropy: HAS_ANISOTROPY,
19910
+ anisotropyMap: HAS_ANISOTROPYMAP,
19911
+
19659
19912
  clearcoat: HAS_CLEARCOAT,
19660
19913
  clearcoatMap: HAS_CLEARCOATMAP,
19661
19914
  clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,
@@ -19699,6 +19952,8 @@
19699
19952
  metalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),
19700
19953
  roughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),
19701
19954
 
19955
+ anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),
19956
+
19702
19957
  clearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),
19703
19958
  clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),
19704
19959
  clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),
@@ -19720,7 +19975,7 @@
19720
19975
 
19721
19976
  //
19722
19977
 
19723
- vertexTangents: HAS_NORMALMAP && !! geometry.attributes.tangent,
19978
+ vertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),
19724
19979
  vertexColors: material.vertexColors,
19725
19980
  vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
19726
19981
  vertexUv1s: HAS_ATTRIBUTE_UV1,
@@ -19852,6 +20107,7 @@
19852
20107
  array.push( parameters.emissiveMapUv );
19853
20108
  array.push( parameters.metalnessMapUv );
19854
20109
  array.push( parameters.roughnessMapUv );
20110
+ array.push( parameters.anisotropyMapUv );
19855
20111
  array.push( parameters.clearcoatMapUv );
19856
20112
  array.push( parameters.clearcoatNormalMapUv );
19857
20113
  array.push( parameters.clearcoatRoughnessMapUv );
@@ -19925,6 +20181,8 @@
19925
20181
  _programLayers.enable( 15 );
19926
20182
  if ( parameters.vertexTangents )
19927
20183
  _programLayers.enable( 16 );
20184
+ if ( parameters.anisotropy )
20185
+ _programLayers.enable( 17 );
19928
20186
 
19929
20187
  array.push( _programLayers.mask );
19930
20188
  _programLayers.disableAll();
@@ -23305,6 +23563,17 @@
23305
23563
  [ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR
23306
23564
  };
23307
23565
 
23566
+ const compareToGL = {
23567
+ [ NeverCompare ]: _gl.NEVER,
23568
+ [ AlwaysCompare ]: _gl.ALWAYS,
23569
+ [ LessCompare ]: _gl.LESS,
23570
+ [ LessEqualCompare ]: _gl.LEQUAL,
23571
+ [ EqualCompare ]: _gl.EQUAL,
23572
+ [ GreaterEqualCompare ]: _gl.GEQUAL,
23573
+ [ GreaterCompare ]: _gl.GREATER,
23574
+ [ NotEqualCompare ]: _gl.NOTEQUAL
23575
+ };
23576
+
23308
23577
  function setTextureParameters( textureType, texture, supportsMips ) {
23309
23578
 
23310
23579
  if ( supportsMips ) {
@@ -23349,6 +23618,13 @@
23349
23618
 
23350
23619
  }
23351
23620
 
23621
+ if ( texture.compareFunction ) {
23622
+
23623
+ _gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
23624
+ _gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );
23625
+
23626
+ }
23627
+
23352
23628
  if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
23353
23629
 
23354
23630
  const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
@@ -25442,9 +25718,31 @@
25442
25718
  this.flipY = false;
25443
25719
  this.generateMipmaps = false;
25444
25720
 
25721
+ this.compareFunction = null;
25722
+
25445
25723
  }
25446
25724
 
25447
25725
 
25726
+ copy( source ) {
25727
+
25728
+ super.copy( source );
25729
+
25730
+ this.compareFunction = source.compareFunction;
25731
+
25732
+ return this;
25733
+
25734
+ }
25735
+
25736
+ toJSON( meta ) {
25737
+
25738
+ const data = super.toJSON( meta );
25739
+
25740
+ if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
25741
+
25742
+ return data;
25743
+
25744
+ }
25745
+
25448
25746
  }
25449
25747
 
25450
25748
  class WebXRManager extends EventDispatcher {
@@ -25477,11 +25775,10 @@
25477
25775
  const controllers = [];
25478
25776
  const controllerInputSources = [];
25479
25777
 
25480
- const planes = new Set();
25481
- const planesLastChangedTimes = new Map();
25482
-
25483
25778
  //
25484
25779
 
25780
+ let userCamera = null;
25781
+
25485
25782
  const cameraL = new PerspectiveCamera();
25486
25783
  cameraL.layers.enable( 1 );
25487
25784
  cameraL.viewport = new Vector4();
@@ -25492,20 +25789,28 @@
25492
25789
 
25493
25790
  const cameras = [ cameraL, cameraR ];
25494
25791
 
25495
- const cameraVR = new ArrayCamera();
25496
- cameraVR.layers.enable( 1 );
25497
- cameraVR.layers.enable( 2 );
25792
+ const cameraXR = new ArrayCamera();
25793
+ cameraXR.layers.enable( 1 );
25794
+ cameraXR.layers.enable( 2 );
25498
25795
 
25499
25796
  let _currentDepthNear = null;
25500
25797
  let _currentDepthFar = null;
25501
25798
 
25502
25799
  //
25503
25800
 
25504
- this.cameraAutoUpdate = true;
25801
+ this.cameraAutoUpdate = true; // @deprecated, r153
25505
25802
  this.enabled = false;
25506
25803
 
25507
25804
  this.isPresenting = false;
25508
25805
 
25806
+ this.getCamera = function () {}; // @deprecated, r153
25807
+
25808
+ this.setUserCamera = function ( value ) {
25809
+
25810
+ userCamera = value;
25811
+
25812
+ };
25813
+
25509
25814
  this.getController = function ( index ) {
25510
25815
 
25511
25816
  let controller = controllers[ index ];
@@ -25942,31 +26247,37 @@
25942
26247
 
25943
26248
  }
25944
26249
 
25945
- this.updateCamera = function ( camera ) {
26250
+ this.updateCameraXR = function ( camera ) {
25946
26251
 
25947
- if ( session === null ) return;
26252
+ if ( session === null ) return camera;
25948
26253
 
25949
- cameraVR.near = cameraR.near = cameraL.near = camera.near;
25950
- cameraVR.far = cameraR.far = cameraL.far = camera.far;
26254
+ if ( userCamera ) {
26255
+
26256
+ camera = userCamera;
26257
+
26258
+ }
25951
26259
 
25952
- if ( _currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far ) {
26260
+ cameraXR.near = cameraR.near = cameraL.near = camera.near;
26261
+ cameraXR.far = cameraR.far = cameraL.far = camera.far;
26262
+
26263
+ if ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {
25953
26264
 
25954
26265
  // Note that the new renderState won't apply until the next frame. See #18320
25955
26266
 
25956
26267
  session.updateRenderState( {
25957
- depthNear: cameraVR.near,
25958
- depthFar: cameraVR.far
26268
+ depthNear: cameraXR.near,
26269
+ depthFar: cameraXR.far
25959
26270
  } );
25960
26271
 
25961
- _currentDepthNear = cameraVR.near;
25962
- _currentDepthFar = cameraVR.far;
26272
+ _currentDepthNear = cameraXR.near;
26273
+ _currentDepthFar = cameraXR.far;
25963
26274
 
25964
26275
  }
25965
26276
 
25966
26277
  const parent = camera.parent;
25967
- const cameras = cameraVR.cameras;
26278
+ const cameras = cameraXR.cameras;
25968
26279
 
25969
- updateCamera( cameraVR, parent );
26280
+ updateCamera( cameraXR, parent );
25970
26281
 
25971
26282
  for ( let i = 0; i < cameras.length; i ++ ) {
25972
26283
 
@@ -25978,33 +26289,41 @@
25978
26289
 
25979
26290
  if ( cameras.length === 2 ) {
25980
26291
 
25981
- setProjectionFromUnion( cameraVR, cameraL, cameraR );
26292
+ setProjectionFromUnion( cameraXR, cameraL, cameraR );
25982
26293
 
25983
26294
  } else {
25984
26295
 
25985
26296
  // assume single camera setup (AR)
25986
26297
 
25987
- cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
26298
+ cameraXR.projectionMatrix.copy( cameraL.projectionMatrix );
25988
26299
 
25989
26300
  }
25990
26301
 
25991
26302
  // update user camera and its children
25992
26303
 
25993
- updateUserCamera( camera, cameraVR, parent );
26304
+ if ( userCamera ) {
26305
+
26306
+ updateUserCamera( cameraXR, parent );
26307
+
26308
+ }
26309
+
26310
+ return cameraXR;
25994
26311
 
25995
26312
  };
25996
26313
 
25997
- function updateUserCamera( camera, cameraVR, parent ) {
26314
+ function updateUserCamera( cameraXR, parent ) {
26315
+
26316
+ const camera = userCamera;
25998
26317
 
25999
26318
  if ( parent === null ) {
26000
26319
 
26001
- camera.matrix.copy( cameraVR.matrixWorld );
26320
+ camera.matrix.copy( cameraXR.matrixWorld );
26002
26321
 
26003
26322
  } else {
26004
26323
 
26005
26324
  camera.matrix.copy( parent.matrixWorld );
26006
26325
  camera.matrix.invert();
26007
- camera.matrix.multiply( cameraVR.matrixWorld );
26326
+ camera.matrix.multiply( cameraXR.matrixWorld );
26008
26327
 
26009
26328
  }
26010
26329
 
@@ -26019,8 +26338,8 @@
26019
26338
 
26020
26339
  }
26021
26340
 
26022
- camera.projectionMatrix.copy( cameraVR.projectionMatrix );
26023
- camera.projectionMatrixInverse.copy( cameraVR.projectionMatrixInverse );
26341
+ camera.projectionMatrix.copy( cameraXR.projectionMatrix );
26342
+ camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
26024
26343
 
26025
26344
  if ( camera.isPerspectiveCamera ) {
26026
26345
 
@@ -26031,12 +26350,6 @@
26031
26350
 
26032
26351
  }
26033
26352
 
26034
- this.getCamera = function () {
26035
-
26036
- return cameraVR;
26037
-
26038
- };
26039
-
26040
26353
  this.getFoveation = function () {
26041
26354
 
26042
26355
  if ( glProjLayer === null && glBaseLayer === null ) {
@@ -26070,12 +26383,6 @@
26070
26383
 
26071
26384
  };
26072
26385
 
26073
- this.getPlanes = function () {
26074
-
26075
- return planes;
26076
-
26077
- };
26078
-
26079
26386
  // Animation Loop
26080
26387
 
26081
26388
  let onAnimationFrameCallback = null;
@@ -26096,14 +26403,14 @@
26096
26403
 
26097
26404
  }
26098
26405
 
26099
- let cameraVRNeedsUpdate = false;
26406
+ let cameraXRNeedsUpdate = false;
26100
26407
 
26101
- // check if it's necessary to rebuild cameraVR's camera list
26408
+ // check if it's necessary to rebuild cameraXR's camera list
26102
26409
 
26103
- if ( views.length !== cameraVR.cameras.length ) {
26410
+ if ( views.length !== cameraXR.cameras.length ) {
26104
26411
 
26105
- cameraVR.cameras.length = 0;
26106
- cameraVRNeedsUpdate = true;
26412
+ cameraXR.cameras.length = 0;
26413
+ cameraXRNeedsUpdate = true;
26107
26414
 
26108
26415
  }
26109
26416
 
@@ -26155,14 +26462,14 @@
26155
26462
 
26156
26463
  if ( i === 0 ) {
26157
26464
 
26158
- cameraVR.matrix.copy( camera.matrix );
26159
- cameraVR.matrix.decompose( cameraVR.position, cameraVR.quaternion, cameraVR.scale );
26465
+ cameraXR.matrix.copy( camera.matrix );
26466
+ cameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );
26160
26467
 
26161
26468
  }
26162
26469
 
26163
- if ( cameraVRNeedsUpdate === true ) {
26470
+ if ( cameraXRNeedsUpdate === true ) {
26164
26471
 
26165
- cameraVR.cameras.push( camera );
26472
+ cameraXR.cameras.push( camera );
26166
26473
 
26167
26474
  }
26168
26475
 
@@ -26189,60 +26496,7 @@
26189
26496
 
26190
26497
  if ( frame.detectedPlanes ) {
26191
26498
 
26192
- scope.dispatchEvent( { type: 'planesdetected', data: frame.detectedPlanes } );
26193
-
26194
- let planesToRemove = null;
26195
-
26196
- for ( const plane of planes ) {
26197
-
26198
- if ( ! frame.detectedPlanes.has( plane ) ) {
26199
-
26200
- if ( planesToRemove === null ) {
26201
-
26202
- planesToRemove = [];
26203
-
26204
- }
26205
-
26206
- planesToRemove.push( plane );
26207
-
26208
- }
26209
-
26210
- }
26211
-
26212
- if ( planesToRemove !== null ) {
26213
-
26214
- for ( const plane of planesToRemove ) {
26215
-
26216
- planes.delete( plane );
26217
- planesLastChangedTimes.delete( plane );
26218
- scope.dispatchEvent( { type: 'planeremoved', data: plane } );
26219
-
26220
- }
26221
-
26222
- }
26223
-
26224
- for ( const plane of frame.detectedPlanes ) {
26225
-
26226
- if ( ! planes.has( plane ) ) {
26227
-
26228
- planes.add( plane );
26229
- planesLastChangedTimes.set( plane, frame.lastChangedTime );
26230
- scope.dispatchEvent( { type: 'planeadded', data: plane } );
26231
-
26232
- } else {
26233
-
26234
- const lastKnownTime = planesLastChangedTimes.get( plane );
26235
-
26236
- if ( plane.lastChangedTime > lastKnownTime ) {
26237
-
26238
- planesLastChangedTimes.set( plane, plane.lastChangedTime );
26239
- scope.dispatchEvent( { type: 'planechanged', data: plane } );
26240
-
26241
- }
26242
-
26243
- }
26244
-
26245
- }
26499
+ scope.dispatchEvent( { type: 'planesdetected', data: frame } );
26246
26500
 
26247
26501
  }
26248
26502
 
@@ -26554,6 +26808,8 @@
26554
26808
 
26555
26809
  uniforms.alphaMap.value = material.alphaMap;
26556
26810
 
26811
+ refreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );
26812
+
26557
26813
  }
26558
26814
 
26559
26815
  if ( material.alphaTest > 0 ) {
@@ -26582,6 +26838,8 @@
26582
26838
 
26583
26839
  uniforms.alphaMap.value = material.alphaMap;
26584
26840
 
26841
+ refreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );
26842
+
26585
26843
  }
26586
26844
 
26587
26845
  if ( material.alphaTest > 0 ) {
@@ -26763,6 +27021,20 @@
26763
27021
 
26764
27022
  }
26765
27023
 
27024
+ if ( material.anisotropy > 0 ) {
27025
+
27026
+ uniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );
27027
+
27028
+ if ( material.anisotropyMap ) {
27029
+
27030
+ uniforms.anisotropyMap.value = material.anisotropyMap;
27031
+
27032
+ refreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );
27033
+
27034
+ }
27035
+
27036
+ }
27037
+
26766
27038
  uniforms.specularIntensity.value = material.specularIntensity;
26767
27039
  uniforms.specularColor.value.copy( material.specularColor );
26768
27040
 
@@ -27261,6 +27533,9 @@
27261
27533
 
27262
27534
  }
27263
27535
 
27536
+ const uintClearColor = new Uint32Array( 4 );
27537
+ const intClearColor = new Int32Array( 4 );
27538
+
27264
27539
  let currentRenderList = null;
27265
27540
  let currentRenderState = null;
27266
27541
 
@@ -27337,6 +27612,9 @@
27337
27612
  const _currentScissor = new Vector4();
27338
27613
  let _currentScissorTest = null;
27339
27614
 
27615
+ const _currentClearColor = new Color$1( 0x000000 );
27616
+ let _currentClearAlpha = 0;
27617
+
27340
27618
  //
27341
27619
 
27342
27620
  let _width = canvas.width;
@@ -27367,6 +27645,7 @@
27367
27645
 
27368
27646
  const _projScreenMatrix = new Matrix4();
27369
27647
 
27648
+ const _vector2 = new Vector2();
27370
27649
  const _vector3 = new Vector3();
27371
27650
 
27372
27651
  const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
@@ -27444,6 +27723,12 @@
27444
27723
 
27445
27724
  }
27446
27725
 
27726
+ if ( _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
27727
+
27728
+ console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
27729
+
27730
+ }
27731
+
27447
27732
  // Some experimental-webgl implementations do not have getShaderPrecisionFormat
27448
27733
 
27449
27734
  if ( _gl.getShaderPrecisionFormat === undefined ) {
@@ -27725,7 +28010,65 @@
27725
28010
 
27726
28011
  let bits = 0;
27727
28012
 
27728
- if ( color ) bits |= _gl.COLOR_BUFFER_BIT;
28013
+ if ( color ) {
28014
+
28015
+ // check if we're trying to clear an integer target
28016
+ let isIntegerFormat = false;
28017
+ if ( _currentRenderTarget !== null ) {
28018
+
28019
+ const targetFormat = _currentRenderTarget.texture.format;
28020
+ isIntegerFormat = targetFormat === RGBAIntegerFormat ||
28021
+ targetFormat === RGIntegerFormat ||
28022
+ targetFormat === RedIntegerFormat;
28023
+
28024
+ }
28025
+
28026
+ // use the appropriate clear functions to clear the target if it's a signed
28027
+ // or unsigned integer target
28028
+ if ( isIntegerFormat ) {
28029
+
28030
+ const targetType = _currentRenderTarget.texture.type;
28031
+ const isUnsignedType = targetType === UnsignedByteType ||
28032
+ targetType === UnsignedIntType ||
28033
+ targetType === UnsignedShortType ||
28034
+ targetType === UnsignedInt248Type ||
28035
+ targetType === UnsignedShort4444Type ||
28036
+ targetType === UnsignedShort5551Type;
28037
+
28038
+ const clearColor = background.getClearColor();
28039
+ const a = background.getClearAlpha();
28040
+ const r = clearColor.r;
28041
+ const g = clearColor.g;
28042
+ const b = clearColor.b;
28043
+
28044
+ const __webglFramebuffer = properties.get( _currentRenderTarget ).__webglFramebuffer;
28045
+
28046
+ if ( isUnsignedType ) {
28047
+
28048
+ uintClearColor[ 0 ] = r;
28049
+ uintClearColor[ 1 ] = g;
28050
+ uintClearColor[ 2 ] = b;
28051
+ uintClearColor[ 3 ] = a;
28052
+ _gl.clearBufferuiv( _gl.COLOR, __webglFramebuffer, uintClearColor );
28053
+
28054
+ } else {
28055
+
28056
+ intClearColor[ 0 ] = r;
28057
+ intClearColor[ 1 ] = g;
28058
+ intClearColor[ 2 ] = b;
28059
+ intClearColor[ 3 ] = a;
28060
+ _gl.clearBufferiv( _gl.COLOR, __webglFramebuffer, intClearColor );
28061
+
28062
+ }
28063
+
28064
+ } else {
28065
+
28066
+ bits |= _gl.COLOR_BUFFER_BIT;
28067
+
28068
+ }
28069
+
28070
+ }
28071
+
27729
28072
  if ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;
27730
28073
  if ( stencil ) bits |= _gl.STENCIL_BUFFER_BIT;
27731
28074
 
@@ -28147,9 +28490,7 @@
28147
28490
 
28148
28491
  if ( xr.enabled === true && xr.isPresenting === true ) {
28149
28492
 
28150
- if ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );
28151
-
28152
- camera = xr.getCamera(); // use XR camera for rendering
28493
+ camera = xr.updateCameraXR( camera ); // use XR camera for rendering
28153
28494
 
28154
28495
  }
28155
28496
 
@@ -28196,6 +28537,8 @@
28196
28537
 
28197
28538
  if ( this.info.autoReset === true ) this.info.reset();
28198
28539
 
28540
+ this.info.render.frame ++;
28541
+
28199
28542
  //
28200
28543
 
28201
28544
  background.render( currentRenderList, scene );
@@ -28342,10 +28685,19 @@
28342
28685
 
28343
28686
  if ( sortObjects ) {
28344
28687
 
28345
- if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
28688
+ if ( object.boundingSphere !== undefined ) {
28689
+
28690
+ if ( object.boundingSphere === null ) object.computeBoundingSphere();
28691
+ _vector3.copy( object.boundingSphere.center );
28692
+
28693
+ } else {
28694
+
28695
+ if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
28696
+ _vector3.copy( geometry.boundingSphere.center );
28697
+
28698
+ }
28346
28699
 
28347
28700
  _vector3
28348
- .copy( geometry.boundingSphere.center )
28349
28701
  .applyMatrix4( object.matrixWorld )
28350
28702
  .applyMatrix4( _projScreenMatrix );
28351
28703
 
@@ -28420,11 +28772,11 @@
28420
28772
 
28421
28773
  function renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {
28422
28774
 
28423
- if ( _transmissionRenderTarget === null ) {
28775
+ const isWebGL2 = capabilities.isWebGL2;
28424
28776
 
28425
- const isWebGL2 = capabilities.isWebGL2;
28777
+ if ( _transmissionRenderTarget === null ) {
28426
28778
 
28427
- _transmissionRenderTarget = new WebGLRenderTarget( 1024, 1024, {
28779
+ _transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
28428
28780
  generateMipmaps: true,
28429
28781
  type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
28430
28782
  minFilter: LinearMipmapLinearFilter,
@@ -28443,10 +28795,27 @@
28443
28795
 
28444
28796
  }
28445
28797
 
28798
+ _this.getDrawingBufferSize( _vector2 );
28799
+
28800
+ if ( isWebGL2 ) {
28801
+
28802
+ _transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
28803
+
28804
+ } else {
28805
+
28806
+ _transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
28807
+
28808
+ }
28809
+
28446
28810
  //
28447
28811
 
28448
28812
  const currentRenderTarget = _this.getRenderTarget();
28449
28813
  _this.setRenderTarget( _transmissionRenderTarget );
28814
+
28815
+ _this.getClearColor( _currentClearColor );
28816
+ _currentClearAlpha = _this.getClearAlpha();
28817
+ if ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );
28818
+
28450
28819
  _this.clear();
28451
28820
 
28452
28821
  // Turn off the features which can affect the frag color for opaque objects pass.
@@ -28497,6 +28866,8 @@
28497
28866
 
28498
28867
  _this.setRenderTarget( currentRenderTarget );
28499
28868
 
28869
+ _this.setClearColor( _currentClearColor, _currentClearAlpha );
28870
+
28500
28871
  _this.toneMapping = currentToneMapping;
28501
28872
 
28502
28873
  }
@@ -28700,7 +29071,7 @@
28700
29071
  const colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );
28701
29072
  const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
28702
29073
  const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
28703
- const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
29074
+ const vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );
28704
29075
  const morphTargets = !! geometry.morphAttributes.position;
28705
29076
  const morphNormals = !! geometry.morphAttributes.normal;
28706
29077
  const morphColors = !! geometry.morphAttributes.color;
@@ -29474,6 +29845,12 @@
29474
29845
 
29475
29846
  }
29476
29847
 
29848
+ get coordinateSystem() {
29849
+
29850
+ return WebGLCoordinateSystem;
29851
+
29852
+ }
29853
+
29477
29854
  get physicallyCorrectLights() { // @deprecated, r150
29478
29855
 
29479
29856
  console.warn( 'THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
@@ -30777,7 +31154,7 @@
30777
31154
 
30778
31155
  const data = {
30779
31156
  metadata: {
30780
- version: 4.5,
31157
+ version: 4.6,
30781
31158
  type: 'Curve',
30782
31159
  generator: 'Curve.toJSON'
30783
31160
  }
@@ -33661,6 +34038,7 @@
33661
34038
  * }
33662
34039
  */
33663
34040
 
34041
+
33664
34042
  class ExtrudeGeometry extends BufferGeometry {
33665
34043
 
33666
34044
  constructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {
@@ -36029,6 +36407,7 @@
36029
36407
  * The azimuthal angle (theta) is measured from the positive z-axis.
36030
36408
  */
36031
36409
 
36410
+
36032
36411
  class Spherical {
36033
36412
 
36034
36413
  constructor( radius = 1, phi = 0, theta = 0 ) {
@@ -38246,18 +38625,6 @@
38246
38625
  };
38247
38626
  return Tween;
38248
38627
  }());
38249
-
38250
- var VERSION = '20.0.3';
38251
-
38252
- /**
38253
- * Tween.js - Licensed under the MIT license
38254
- * https://github.com/tweenjs/tween.js
38255
- * ----------------------------------------------
38256
- *
38257
- * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
38258
- * Thank you all, you're awesome!
38259
- */
38260
- var nextId = Sequence.nextId;
38261
38628
  /**
38262
38629
  * Controlling groups of tweens
38263
38630
  *
@@ -38269,26 +38636,11 @@
38269
38636
  // Modules and CommonJS, without build hacks, and so as not to break the
38270
38637
  // existing API.
38271
38638
  // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
38272
- var getAll = TWEEN.getAll.bind(TWEEN);
38273
- var removeAll = TWEEN.removeAll.bind(TWEEN);
38274
- var add = TWEEN.add.bind(TWEEN);
38275
- var remove = TWEEN.remove.bind(TWEEN);
38639
+ TWEEN.getAll.bind(TWEEN);
38640
+ TWEEN.removeAll.bind(TWEEN);
38641
+ TWEEN.add.bind(TWEEN);
38642
+ TWEEN.remove.bind(TWEEN);
38276
38643
  var update = TWEEN.update.bind(TWEEN);
38277
- var exports$1 = {
38278
- Easing: Easing,
38279
- Group: Group,
38280
- Interpolation: Interpolation,
38281
- now: now,
38282
- Sequence: Sequence,
38283
- nextId: nextId,
38284
- Tween: Tween,
38285
- VERSION: VERSION,
38286
- getAll: getAll,
38287
- removeAll: removeAll,
38288
- add: add,
38289
- remove: remove,
38290
- update: update,
38291
- };
38292
38644
 
38293
38645
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
38294
38646
 
@@ -42082,6 +42434,7 @@
42082
42434
  let TypedArray;
42083
42435
  let itemSize;
42084
42436
  let normalized;
42437
+ let gpuType = - 1;
42085
42438
  let arrayLength = 0;
42086
42439
 
42087
42440
  for ( let i = 0; i < attributes.length; ++ i ) {
@@ -42119,6 +42472,14 @@
42119
42472
 
42120
42473
  }
42121
42474
 
42475
+ if ( gpuType === - 1 ) gpuType = attribute.gpuType;
42476
+ if ( gpuType !== attribute.gpuType ) {
42477
+
42478
+ console.error( 'THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.' );
42479
+ return null;
42480
+
42481
+ }
42482
+
42122
42483
  arrayLength += attribute.array.length;
42123
42484
 
42124
42485
  }
@@ -42134,7 +42495,14 @@
42134
42495
 
42135
42496
  }
42136
42497
 
42137
- return new BufferAttribute( array, itemSize, normalized );
42498
+ const result = new BufferAttribute( array, itemSize, normalized );
42499
+ if ( gpuType !== undefined ) {
42500
+
42501
+ result.gpuType = gpuType;
42502
+
42503
+ }
42504
+
42505
+ return result;
42138
42506
 
42139
42507
  }
42140
42508
 
@@ -43130,7 +43498,7 @@
43130
43498
  });
43131
43499
 
43132
43500
  var index$1 = (function (p) {
43133
- return p instanceof Function ? p // fn
43501
+ return typeof p === 'function' ? p // fn
43134
43502
  : typeof p === 'string' ? function (obj) {
43135
43503
  return obj[p];
43136
43504
  } // property name
@@ -46221,8 +46589,6 @@
46221
46589
  const detright = (ax - cx) * (by - cy);
46222
46590
  const det = detleft - detright;
46223
46591
 
46224
- if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) return det;
46225
-
46226
46592
  const detsum = Math.abs(detleft + detright);
46227
46593
  if (Math.abs(det) >= ccwerrboundA * detsum) return det;
46228
46594
 
@@ -64563,6 +64929,7 @@
64563
64929
  * }
64564
64930
  */
64565
64931
 
64932
+
64566
64933
  class TextGeometry extends ExtrudeGeometry {
64567
64934
 
64568
64935
  constructor( text, parameters = {} ) {
@@ -65505,7 +65872,7 @@
65505
65872
  applyUpdate(targetD);
65506
65873
  } else {
65507
65874
  // animate
65508
- new exports$1.Tween(currentTargetD).to(targetD, state.pointsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
65875
+ new Tween(currentTargetD).to(targetD, state.pointsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
65509
65876
  }
65510
65877
  }
65511
65878
  if (!state.pointsMerge) {
@@ -65773,7 +66140,7 @@
65773
66140
  applyUpdate(targetD);
65774
66141
  } else {
65775
66142
  // animate
65776
- new exports$1.Tween(currentTargetD).to(targetD, state.arcsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66143
+ new Tween(currentTargetD).to(targetD, state.arcsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
65777
66144
  }
65778
66145
  }
65779
66146
  }
@@ -66109,7 +66476,7 @@
66109
66476
  applyUpdate(targetD);
66110
66477
  } else {
66111
66478
  // animate
66112
- new exports$1.Tween(currentTargetD).to(targetD, state.hexTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66479
+ new Tween(currentTargetD).to(targetD, state.hexTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66113
66480
  }
66114
66481
  }
66115
66482
  if (!state.hexBinMerge) {
@@ -66333,7 +66700,7 @@
66333
66700
  applyUpdate(targetD);
66334
66701
  } else {
66335
66702
  // animate
66336
- new exports$1.Tween(currentTargetD).to(targetD, state.polygonsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66703
+ new Tween(currentTargetD).to(targetD, state.polygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66337
66704
  }
66338
66705
  }
66339
66706
  }
@@ -66514,7 +66881,7 @@
66514
66881
  applyUpdate(targetD);
66515
66882
  } else {
66516
66883
  // animate
66517
- new exports$1.Tween(currentTargetD).to(targetD, state.hexPolygonsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66884
+ new Tween(currentTargetD).to(targetD, state.hexPolygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66518
66885
  }
66519
66886
  }
66520
66887
  }
@@ -66848,7 +67215,7 @@
66848
67215
  applyUpdate(targetD);
66849
67216
  } else {
66850
67217
  // animate
66851
- new exports$1.Tween(currentTargetD).to(targetD, state.pathTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
67218
+ new Tween(currentTargetD).to(targetD, state.pathTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
66852
67219
  }
66853
67220
  }
66854
67221
  }
@@ -67086,7 +67453,7 @@
67086
67453
  applyPosition(targetD);
67087
67454
  } else {
67088
67455
  // animate
67089
- new exports$1.Tween(currentTargetD).to(targetD, state.tilesTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyPosition).start();
67456
+ new Tween(currentTargetD).to(targetD, state.tilesTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start();
67090
67457
  }
67091
67458
  }
67092
67459
  }
@@ -67292,7 +67659,7 @@
67292
67659
  applyPosition(targetD);
67293
67660
  } else {
67294
67661
  // animate
67295
- new exports$1.Tween(currentTargetD).to(targetD, state.labelsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyPosition).start();
67662
+ new Tween(currentTargetD).to(targetD, state.labelsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start();
67296
67663
  }
67297
67664
  }
67298
67665
  }
@@ -67467,7 +67834,7 @@
67467
67834
  obj.add(circleObj);
67468
67835
  } else {
67469
67836
  var transitionTime = Math.abs(maxRadius / propagationSpeed) * 1000;
67470
- new exports$1.Tween({
67837
+ new Tween({
67471
67838
  t: 0
67472
67839
  }).to({
67473
67840
  t: 1
@@ -67603,7 +67970,7 @@
67603
67970
  applyUpdate(targetD);
67604
67971
  } else {
67605
67972
  // animate
67606
- new exports$1.Tween(obj.__currentTargetD).to(targetD, state.pointsTransitionDuration).easing(exports$1.Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
67973
+ new Tween(obj.__currentTargetD).to(targetD, state.pointsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
67607
67974
  }
67608
67975
  }
67609
67976
  });
@@ -67893,7 +68260,7 @@
67893
68260
  },
67894
68261
  _animationCycle: function _animationCycle(state) {
67895
68262
  state.animationFrameRequestId = requestAnimationFrame(this._animationCycle);
67896
- exports$1.update(); // run tween updates
68263
+ update(); // run tween updates
67897
68264
  },
67898
68265
 
67899
68266
  _destructor: function _destructor(state) {
@@ -67953,20 +68320,20 @@
67953
68320
  if (animateIn) {
67954
68321
  // Animate build-in just once
67955
68322
  state.scene.scale.set(1e-6, 1e-6, 1e-6);
67956
- new exports$1.Tween({
68323
+ new Tween({
67957
68324
  k: 1e-6
67958
68325
  }).to({
67959
68326
  k: 1
67960
- }, 600).easing(exports$1.Easing.Quadratic.Out).onUpdate(function (_ref16) {
68327
+ }, 600).easing(Easing.Quadratic.Out).onUpdate(function (_ref16) {
67961
68328
  var k = _ref16.k;
67962
68329
  return state.scene.scale.set(k, k, k);
67963
68330
  }).start();
67964
68331
  var rotAxis = new THREE$g.Vector3(0, 1, 0);
67965
- new exports$1.Tween({
68332
+ new Tween({
67966
68333
  rot: Math.PI * 2
67967
68334
  }).to({
67968
68335
  rot: 0
67969
- }, 1200).easing(exports$1.Easing.Quintic.Out).onUpdate(function (_ref17) {
68336
+ }, 1200).easing(Easing.Quintic.Out).onUpdate(function (_ref17) {
67970
68337
  var rot = _ref17.rot;
67971
68338
  return state.scene.setRotationFromAxisAngle(rotAxis, rot);
67972
68339
  }).start();
@@ -68991,6 +69358,7 @@
68991
69358
 
68992
69359
  const lastPosition = new Vector3();
68993
69360
  const lastQuaternion = new Quaternion();
69361
+ const lastTargetPosition = new Vector3();
68994
69362
 
68995
69363
  const twoPI = 2 * Math.PI;
68996
69364
 
@@ -69104,12 +69472,15 @@
69104
69472
 
69105
69473
  if ( zoomChanged ||
69106
69474
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
69107
- 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
69475
+ 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||
69476
+ lastTargetPosition.distanceToSquared( scope.target ) > 0 ) {
69108
69477
 
69109
69478
  scope.dispatchEvent( _changeEvent$1 );
69110
69479
 
69111
69480
  lastPosition.copy( scope.object.position );
69112
69481
  lastQuaternion.copy( scope.object.quaternion );
69482
+ lastTargetPosition.copy( scope.target );
69483
+
69113
69484
  zoomChanged = false;
69114
69485
 
69115
69486
  return true;
@@ -70368,6 +70739,8 @@
70368
70739
 
70369
70740
  const CopyShader = {
70370
70741
 
70742
+ name: 'CopyShader',
70743
+
70371
70744
  uniforms: {
70372
70745
 
70373
70746
  'tDiffuse': { value: null },
@@ -70500,6 +70873,7 @@
70500
70873
 
70501
70874
  this.material = new ShaderMaterial( {
70502
70875
 
70876
+ name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
70503
70877
  defines: Object.assign( {}, shader.defines ),
70504
70878
  uniforms: this.uniforms,
70505
70879
  vertexShader: shader.vertexShader,
@@ -70661,7 +71035,7 @@
70661
71035
  this._width = size.width;
70662
71036
  this._height = size.height;
70663
71037
 
70664
- renderTarget = new WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio );
71038
+ renderTarget = new WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: HalfFloatType } );
70665
71039
  renderTarget.texture.name = 'EffectComposer.rt1';
70666
71040
 
70667
71041
  } else {
@@ -71940,7 +72314,7 @@
71940
72314
  state.hoverObj = topObject;
71941
72315
  }
71942
72316
  }
71943
- exports$1.update(); // update camera animation tweens
72317
+ update(); // update camera animation tweens
71944
72318
  }
71945
72319
 
71946
72320
  return this;
@@ -71972,10 +72346,10 @@
71972
72346
  } else {
71973
72347
  var camPos = Object.assign({}, camera.position);
71974
72348
  var camLookAt = getLookAt();
71975
- new exports$1.Tween(camPos).to(finalPos, transitionDuration).easing(exports$1.Easing.Quadratic.Out).onUpdate(setCameraPos).start();
72349
+ new Tween(camPos).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCameraPos).start();
71976
72350
 
71977
72351
  // Face direction in 1/3rd of time
71978
- new exports$1.Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(exports$1.Easing.Quadratic.Out).onUpdate(setLookAt).start();
72352
+ new Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(Easing.Quadratic.Out).onUpdate(setLookAt).start();
71979
72353
  }
71980
72354
  return this;
71981
72355
  }
@@ -72601,7 +72975,7 @@
72601
72975
  // Avoid rotating more than 180deg longitude
72602
72976
  while (curGeoCoords.lng - finalGeoCoords.lng > 180) curGeoCoords.lng -= 360;
72603
72977
  while (curGeoCoords.lng - finalGeoCoords.lng < -180) curGeoCoords.lng += 360;
72604
- new exports$1.Tween(curGeoCoords).to(finalGeoCoords, transitionDuration).easing(exports$1.Easing.Cubic.InOut).onUpdate(setCameraPos).start();
72978
+ new Tween(curGeoCoords).to(finalGeoCoords, transitionDuration).easing(Easing.Cubic.InOut).onUpdate(setCameraPos).start();
72605
72979
  }
72606
72980
  return this;
72607
72981
  }
@@ -72776,7 +73150,7 @@
72776
73150
  };
72777
73151
  state.renderObjs.objects([
72778
73152
  // Populate scene
72779
- new THREE.AmbientLight(0xbbbbbb), new THREE.DirectionalLight(0xffffff, 0.6), state.globe]).hoverOrderComparator(function (a, b) {
73153
+ new THREE.AmbientLight(0xcccccc), new THREE.DirectionalLight(0xffffff, 0.6), state.globe]).hoverOrderComparator(function (a, b) {
72780
73154
  var aObj = getGlobeObj(a);
72781
73155
  var bObj = getGlobeObj(b);
72782
73156