3d-force-graph 1.73.2 → 1.73.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // Version 1.73.2 3d-force-graph - https://github.com/vasturiano/3d-force-graph
1
+ // Version 1.73.3 3d-force-graph - https://github.com/vasturiano/3d-force-graph
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) :
@@ -68,7 +68,7 @@
68
68
  }
69
69
  function _toPropertyKey$5(t) {
70
70
  var i = _toPrimitive$5(t, "string");
71
- return "symbol" == typeof i ? i : String(i);
71
+ return "symbol" == typeof i ? i : i + "";
72
72
  }
73
73
  function _defineProperty$3(obj, key, value) {
74
74
  key = _toPropertyKey$5(key);
@@ -115,7 +115,7 @@
115
115
  * Copyright 2010-2023 Three.js Authors
116
116
  * SPDX-License-Identifier: MIT
117
117
  */
118
- const REVISION = '161';
118
+ const REVISION = '162';
119
119
 
120
120
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
121
121
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -172,6 +172,7 @@
172
172
  const ACESFilmicToneMapping = 4;
173
173
  const CustomToneMapping = 5;
174
174
  const AgXToneMapping = 6;
175
+ const NeutralToneMapping = 7;
175
176
 
176
177
  const UVMapping = 300;
177
178
  const CubeReflectionMapping = 301;
@@ -243,10 +244,6 @@
243
244
  const SIGNED_RED_RGTC1_Format = 36284;
244
245
  const RED_GREEN_RGTC2_Format = 36285;
245
246
  const SIGNED_RED_GREEN_RGTC2_Format = 36286;
246
- /** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */
247
- const LinearEncoding = 3000;
248
- /** @deprecated Use SRGBColorSpace in three.js r152+. */
249
- const sRGBEncoding = 3001;
250
247
  const BasicDepthPacking = 3200;
251
248
  const RGBADepthPacking = 3201;
252
249
  const TangentSpaceNormalMap = 0;
@@ -2042,17 +2039,7 @@
2042
2039
  this.flipY = true;
2043
2040
  this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
2044
2041
 
2045
- if ( typeof colorSpace === 'string' ) {
2046
-
2047
- this.colorSpace = colorSpace;
2048
-
2049
- } else { // @deprecated, r152
2050
-
2051
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2052
- this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2053
-
2054
- }
2055
-
2042
+ this.colorSpace = colorSpace;
2056
2043
 
2057
2044
  this.userData = {};
2058
2045
 
@@ -2291,20 +2278,6 @@
2291
2278
 
2292
2279
  }
2293
2280
 
2294
- get encoding() { // @deprecated, r152
2295
-
2296
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2297
- return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
2298
-
2299
- }
2300
-
2301
- set encoding( encoding ) { // @deprecated, r152
2302
-
2303
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2304
- this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2305
-
2306
- }
2307
-
2308
2281
  }
2309
2282
 
2310
2283
  Texture.DEFAULT_IMAGE = null;
@@ -2978,14 +2951,6 @@
2978
2951
 
2979
2952
  const image = { width: width, height: height, depth: 1 };
2980
2953
 
2981
- if ( options.encoding !== undefined ) {
2982
-
2983
- // @deprecated, r152
2984
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
2985
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2986
-
2987
- }
2988
-
2989
2954
  options = Object.assign( {
2990
2955
  generateMipmaps: false,
2991
2956
  internalFormat: null,
@@ -2993,15 +2958,25 @@
2993
2958
  depthBuffer: true,
2994
2959
  stencilBuffer: false,
2995
2960
  depthTexture: null,
2996
- samples: 0
2961
+ samples: 0,
2962
+ count: 1
2997
2963
  }, options );
2998
2964
 
2999
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
3000
- this.texture.isRenderTargetTexture = true;
2965
+ const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2966
+
2967
+ texture.flipY = false;
2968
+ texture.generateMipmaps = options.generateMipmaps;
2969
+ texture.internalFormat = options.internalFormat;
2970
+
2971
+ this.textures = [];
2972
+
2973
+ const count = options.count;
2974
+ for ( let i = 0; i < count; i ++ ) {
3001
2975
 
3002
- this.texture.flipY = false;
3003
- this.texture.generateMipmaps = options.generateMipmaps;
3004
- this.texture.internalFormat = options.internalFormat;
2976
+ this.textures[ i ] = texture.clone();
2977
+ this.textures[ i ].isRenderTargetTexture = true;
2978
+
2979
+ }
3005
2980
 
3006
2981
  this.depthBuffer = options.depthBuffer;
3007
2982
  this.stencilBuffer = options.stencilBuffer;
@@ -3012,6 +2987,18 @@
3012
2987
 
3013
2988
  }
3014
2989
 
2990
+ get texture() {
2991
+
2992
+ return this.textures[ 0 ];
2993
+
2994
+ }
2995
+
2996
+ set texture( value ) {
2997
+
2998
+ this.textures[ 0 ] = value;
2999
+
3000
+ }
3001
+
3015
3002
  setSize( width, height, depth = 1 ) {
3016
3003
 
3017
3004
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -3020,9 +3007,13 @@
3020
3007
  this.height = height;
3021
3008
  this.depth = depth;
3022
3009
 
3023
- this.texture.image.width = width;
3024
- this.texture.image.height = height;
3025
- this.texture.image.depth = depth;
3010
+ for ( let i = 0, il = this.textures.length; i < il; i ++ ) {
3011
+
3012
+ this.textures[ i ].image.width = width;
3013
+ this.textures[ i ].image.height = height;
3014
+ this.textures[ i ].image.depth = depth;
3015
+
3016
+ }
3026
3017
 
3027
3018
  this.dispose();
3028
3019
 
@@ -3050,8 +3041,14 @@
3050
3041
 
3051
3042
  this.viewport.copy( source.viewport );
3052
3043
 
3053
- this.texture = source.texture.clone();
3054
- this.texture.isRenderTargetTexture = true;
3044
+ this.textures.length = 0;
3045
+
3046
+ for ( let i = 0, il = source.textures.length; i < il; i ++ ) {
3047
+
3048
+ this.textures[ i ] = source.textures[ i ].clone();
3049
+ this.textures[ i ].isRenderTargetTexture = true;
3050
+
3051
+ }
3055
3052
 
3056
3053
  // ensure image object is not shared, see #20328
3057
3054
 
@@ -3734,23 +3731,24 @@
3734
3731
 
3735
3732
  random() {
3736
3733
 
3737
- // Derived from http://planning.cs.uiuc.edu/node198.html
3738
- // Note, this source uses w, x, y, z ordering,
3739
- // so we swap the order below.
3734
+ // sets this quaternion to a uniform random unit quaternnion
3740
3735
 
3741
- const u1 = Math.random();
3742
- const sqrt1u1 = Math.sqrt( 1 - u1 );
3743
- const sqrtu1 = Math.sqrt( u1 );
3736
+ // Ken Shoemake
3737
+ // Uniform random rotations
3738
+ // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
3744
3739
 
3745
- const u2 = 2 * Math.PI * Math.random();
3740
+ const theta1 = 2 * Math.PI * Math.random();
3741
+ const theta2 = 2 * Math.PI * Math.random();
3746
3742
 
3747
- const u3 = 2 * Math.PI * Math.random();
3743
+ const x0 = Math.random();
3744
+ const r1 = Math.sqrt( 1 - x0 );
3745
+ const r2 = Math.sqrt( x0 );
3748
3746
 
3749
3747
  return this.set(
3750
- sqrt1u1 * Math.cos( u2 ),
3751
- sqrtu1 * Math.sin( u3 ),
3752
- sqrtu1 * Math.cos( u3 ),
3753
- sqrt1u1 * Math.sin( u2 ),
3748
+ r1 * Math.sin( theta1 ),
3749
+ r1 * Math.cos( theta1 ),
3750
+ r2 * Math.sin( theta2 ),
3751
+ r2 * Math.cos( theta2 ),
3754
3752
  );
3755
3753
 
3756
3754
  }
@@ -4518,15 +4516,15 @@
4518
4516
 
4519
4517
  randomDirection() {
4520
4518
 
4521
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
4519
+ // https://mathworld.wolfram.com/SpherePointPicking.html
4522
4520
 
4523
- const u = ( Math.random() - 0.5 ) * 2;
4524
- const t = Math.random() * Math.PI * 2;
4525
- const f = Math.sqrt( 1 - u ** 2 );
4521
+ const theta = Math.random() * Math.PI * 2;
4522
+ const u = Math.random() * 2 - 1;
4523
+ const c = Math.sqrt( 1 - u * u );
4526
4524
 
4527
- this.x = f * Math.cos( t );
4528
- this.y = f * Math.sin( t );
4529
- this.z = u;
4525
+ this.x = c * Math.cos( theta );
4526
+ this.y = u;
4527
+ this.z = c * Math.sin( theta );
4530
4528
 
4531
4529
  return this;
4532
4530
 
@@ -5320,7 +5318,7 @@
5320
5318
  const _vector$a = /*@__PURE__*/ new Vector3();
5321
5319
  const _segCenter = /*@__PURE__*/ new Vector3();
5322
5320
  const _segDir = /*@__PURE__*/ new Vector3();
5323
- const _diff = /*@__PURE__*/ new Vector3();
5321
+ const _diff$1 = /*@__PURE__*/ new Vector3();
5324
5322
 
5325
5323
  const _edge1 = /*@__PURE__*/ new Vector3();
5326
5324
  const _edge2 = /*@__PURE__*/ new Vector3();
@@ -5426,13 +5424,13 @@
5426
5424
 
5427
5425
  _segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );
5428
5426
  _segDir.copy( v1 ).sub( v0 ).normalize();
5429
- _diff.copy( this.origin ).sub( _segCenter );
5427
+ _diff$1.copy( this.origin ).sub( _segCenter );
5430
5428
 
5431
5429
  const segExtent = v0.distanceTo( v1 ) * 0.5;
5432
5430
  const a01 = - this.direction.dot( _segDir );
5433
- const b0 = _diff.dot( this.direction );
5434
- const b1 = - _diff.dot( _segDir );
5435
- const c = _diff.lengthSq();
5431
+ const b0 = _diff$1.dot( this.direction );
5432
+ const b1 = - _diff$1.dot( _segDir );
5433
+ const c = _diff$1.lengthSq();
5436
5434
  const det = Math.abs( 1 - a01 * a01 );
5437
5435
  let s0, s1, sqrDist, extDet;
5438
5436
 
@@ -5743,8 +5741,8 @@
5743
5741
 
5744
5742
  }
5745
5743
 
5746
- _diff.subVectors( this.origin, a );
5747
- const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );
5744
+ _diff$1.subVectors( this.origin, a );
5745
+ const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff$1, _edge2 ) );
5748
5746
 
5749
5747
  // b1 < 0, no intersection
5750
5748
  if ( DdQxE2 < 0 ) {
@@ -5753,7 +5751,7 @@
5753
5751
 
5754
5752
  }
5755
5753
 
5756
- const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );
5754
+ const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff$1 ) );
5757
5755
 
5758
5756
  // b2 < 0, no intersection
5759
5757
  if ( DdE1xQ < 0 ) {
@@ -5770,7 +5768,7 @@
5770
5768
  }
5771
5769
 
5772
5770
  // Line intersects triangle, check if ray does.
5773
- const QdN = - sign * _diff.dot( _normal$1 );
5771
+ const QdN = - sign * _diff$1.dot( _normal$1 );
5774
5772
 
5775
5773
  // t < 0, no intersection
5776
5774
  if ( QdN < 0 ) {
@@ -6552,25 +6550,25 @@
6552
6550
  position.z = te[ 14 ];
6553
6551
 
6554
6552
  // scale the rotation part
6555
- _m1$2.copy( this );
6553
+ _m1$4.copy( this );
6556
6554
 
6557
6555
  const invSX = 1 / sx;
6558
6556
  const invSY = 1 / sy;
6559
6557
  const invSZ = 1 / sz;
6560
6558
 
6561
- _m1$2.elements[ 0 ] *= invSX;
6562
- _m1$2.elements[ 1 ] *= invSX;
6563
- _m1$2.elements[ 2 ] *= invSX;
6559
+ _m1$4.elements[ 0 ] *= invSX;
6560
+ _m1$4.elements[ 1 ] *= invSX;
6561
+ _m1$4.elements[ 2 ] *= invSX;
6564
6562
 
6565
- _m1$2.elements[ 4 ] *= invSY;
6566
- _m1$2.elements[ 5 ] *= invSY;
6567
- _m1$2.elements[ 6 ] *= invSY;
6563
+ _m1$4.elements[ 4 ] *= invSY;
6564
+ _m1$4.elements[ 5 ] *= invSY;
6565
+ _m1$4.elements[ 6 ] *= invSY;
6568
6566
 
6569
- _m1$2.elements[ 8 ] *= invSZ;
6570
- _m1$2.elements[ 9 ] *= invSZ;
6571
- _m1$2.elements[ 10 ] *= invSZ;
6567
+ _m1$4.elements[ 8 ] *= invSZ;
6568
+ _m1$4.elements[ 9 ] *= invSZ;
6569
+ _m1$4.elements[ 10 ] *= invSZ;
6572
6570
 
6573
- quaternion.setFromRotationMatrix( _m1$2 );
6571
+ quaternion.setFromRotationMatrix( _m1$4 );
6574
6572
 
6575
6573
  scale.x = sx;
6576
6574
  scale.y = sy;
@@ -6711,14 +6709,14 @@
6711
6709
  }
6712
6710
 
6713
6711
  const _v1$5 = /*@__PURE__*/ new Vector3();
6714
- const _m1$2 = /*@__PURE__*/ new Matrix4();
6712
+ const _m1$4 = /*@__PURE__*/ new Matrix4();
6715
6713
  const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
6716
6714
  const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
6717
6715
  const _x = /*@__PURE__*/ new Vector3();
6718
6716
  const _y = /*@__PURE__*/ new Vector3();
6719
6717
  const _z = /*@__PURE__*/ new Vector3();
6720
6718
 
6721
- const _matrix$1 = /*@__PURE__*/ new Matrix4();
6719
+ const _matrix$2 = /*@__PURE__*/ new Matrix4();
6722
6720
  const _quaternion$3 = /*@__PURE__*/ new Quaternion();
6723
6721
 
6724
6722
  class Euler {
@@ -6953,9 +6951,9 @@
6953
6951
 
6954
6952
  setFromQuaternion( q, order, update ) {
6955
6953
 
6956
- _matrix$1.makeRotationFromQuaternion( q );
6954
+ _matrix$2.makeRotationFromQuaternion( q );
6957
6955
 
6958
- return this.setFromRotationMatrix( _matrix$1, order, update );
6956
+ return this.setFromRotationMatrix( _matrix$2, order, update );
6959
6957
 
6960
6958
  }
6961
6959
 
@@ -7090,7 +7088,7 @@
7090
7088
 
7091
7089
  const _v1$4 = /*@__PURE__*/ new Vector3();
7092
7090
  const _q1 = /*@__PURE__*/ new Quaternion();
7093
- const _m1$1 = /*@__PURE__*/ new Matrix4();
7091
+ const _m1$3 = /*@__PURE__*/ new Matrix4();
7094
7092
  const _target = /*@__PURE__*/ new Vector3();
7095
7093
 
7096
7094
  const _position$3 = /*@__PURE__*/ new Vector3();
@@ -7104,6 +7102,9 @@
7104
7102
  const _addedEvent = { type: 'added' };
7105
7103
  const _removedEvent = { type: 'removed' };
7106
7104
 
7105
+ const _childaddedEvent = { type: 'childadded', child: null };
7106
+ const _childremovedEvent = { type: 'childremoved', child: null };
7107
+
7107
7108
  class Object3D extends EventDispatcher {
7108
7109
 
7109
7110
  constructor() {
@@ -7340,7 +7341,7 @@
7340
7341
 
7341
7342
  this.updateWorldMatrix( true, false );
7342
7343
 
7343
- return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );
7344
+ return vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );
7344
7345
 
7345
7346
  }
7346
7347
 
@@ -7366,20 +7367,20 @@
7366
7367
 
7367
7368
  if ( this.isCamera || this.isLight ) {
7368
7369
 
7369
- _m1$1.lookAt( _position$3, _target, this.up );
7370
+ _m1$3.lookAt( _position$3, _target, this.up );
7370
7371
 
7371
7372
  } else {
7372
7373
 
7373
- _m1$1.lookAt( _target, _position$3, this.up );
7374
+ _m1$3.lookAt( _target, _position$3, this.up );
7374
7375
 
7375
7376
  }
7376
7377
 
7377
- this.quaternion.setFromRotationMatrix( _m1$1 );
7378
+ this.quaternion.setFromRotationMatrix( _m1$3 );
7378
7379
 
7379
7380
  if ( parent ) {
7380
7381
 
7381
- _m1$1.extractRotation( parent.matrixWorld );
7382
- _q1.setFromRotationMatrix( _m1$1 );
7382
+ _m1$3.extractRotation( parent.matrixWorld );
7383
+ _q1.setFromRotationMatrix( _m1$3 );
7383
7384
  this.quaternion.premultiply( _q1.invert() );
7384
7385
 
7385
7386
  }
@@ -7420,6 +7421,10 @@
7420
7421
 
7421
7422
  object.dispatchEvent( _addedEvent );
7422
7423
 
7424
+ _childaddedEvent.child = object;
7425
+ this.dispatchEvent( _childaddedEvent );
7426
+ _childaddedEvent.child = null;
7427
+
7423
7428
  } else {
7424
7429
 
7425
7430
  console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );
@@ -7453,6 +7458,10 @@
7453
7458
 
7454
7459
  object.dispatchEvent( _removedEvent );
7455
7460
 
7461
+ _childremovedEvent.child = object;
7462
+ this.dispatchEvent( _childremovedEvent );
7463
+ _childremovedEvent.child = null;
7464
+
7456
7465
  }
7457
7466
 
7458
7467
  return this;
@@ -7487,17 +7496,17 @@
7487
7496
 
7488
7497
  this.updateWorldMatrix( true, false );
7489
7498
 
7490
- _m1$1.copy( this.matrixWorld ).invert();
7499
+ _m1$3.copy( this.matrixWorld ).invert();
7491
7500
 
7492
7501
  if ( object.parent !== null ) {
7493
7502
 
7494
7503
  object.parent.updateWorldMatrix( true, false );
7495
7504
 
7496
- _m1$1.multiply( object.parent.matrixWorld );
7505
+ _m1$3.multiply( object.parent.matrixWorld );
7497
7506
 
7498
7507
  }
7499
7508
 
7500
- object.applyMatrix4( _m1$1 );
7509
+ object.applyMatrix4( _m1$3 );
7501
7510
 
7502
7511
  this.add( object );
7503
7512
 
@@ -9197,7 +9206,7 @@
9197
9206
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
9198
9207
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
9199
9208
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
9200
- if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9209
+ if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9201
9210
 
9202
9211
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
9203
9212
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -9307,6 +9316,7 @@
9307
9316
 
9308
9317
  }
9309
9318
 
9319
+ if ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();
9310
9320
  if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
9311
9321
  if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
9312
9322
  if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
@@ -9551,6 +9561,7 @@
9551
9561
  this.alphaMap = null;
9552
9562
 
9553
9563
  this.envMap = null;
9564
+ this.envMapRotation = new Euler();
9554
9565
  this.combine = MultiplyOperation;
9555
9566
  this.reflectivity = 1;
9556
9567
  this.refractionRatio = 0.98;
@@ -9585,6 +9596,7 @@
9585
9596
  this.alphaMap = source.alphaMap;
9586
9597
 
9587
9598
  this.envMap = source.envMap;
9599
+ this.envMapRotation.copy( source.envMapRotation );
9588
9600
  this.combine = source.combine;
9589
9601
  this.reflectivity = source.reflectivity;
9590
9602
  this.refractionRatio = source.refractionRatio;
@@ -10018,7 +10030,7 @@
10018
10030
 
10019
10031
  let _id$2 = 0;
10020
10032
 
10021
- const _m1 = /*@__PURE__*/ new Matrix4();
10033
+ const _m1$2 = /*@__PURE__*/ new Matrix4();
10022
10034
  const _obj = /*@__PURE__*/ new Object3D();
10023
10035
  const _offset$1 = /*@__PURE__*/ new Vector3();
10024
10036
  const _box$2 = /*@__PURE__*/ new Box3();
@@ -10184,9 +10196,9 @@
10184
10196
 
10185
10197
  applyQuaternion( q ) {
10186
10198
 
10187
- _m1.makeRotationFromQuaternion( q );
10199
+ _m1$2.makeRotationFromQuaternion( q );
10188
10200
 
10189
- this.applyMatrix4( _m1 );
10201
+ this.applyMatrix4( _m1$2 );
10190
10202
 
10191
10203
  return this;
10192
10204
 
@@ -10196,9 +10208,9 @@
10196
10208
 
10197
10209
  // rotate geometry around world x-axis
10198
10210
 
10199
- _m1.makeRotationX( angle );
10211
+ _m1$2.makeRotationX( angle );
10200
10212
 
10201
- this.applyMatrix4( _m1 );
10213
+ this.applyMatrix4( _m1$2 );
10202
10214
 
10203
10215
  return this;
10204
10216
 
@@ -10208,9 +10220,9 @@
10208
10220
 
10209
10221
  // rotate geometry around world y-axis
10210
10222
 
10211
- _m1.makeRotationY( angle );
10223
+ _m1$2.makeRotationY( angle );
10212
10224
 
10213
- this.applyMatrix4( _m1 );
10225
+ this.applyMatrix4( _m1$2 );
10214
10226
 
10215
10227
  return this;
10216
10228
 
@@ -10220,9 +10232,9 @@
10220
10232
 
10221
10233
  // rotate geometry around world z-axis
10222
10234
 
10223
- _m1.makeRotationZ( angle );
10235
+ _m1$2.makeRotationZ( angle );
10224
10236
 
10225
- this.applyMatrix4( _m1 );
10237
+ this.applyMatrix4( _m1$2 );
10226
10238
 
10227
10239
  return this;
10228
10240
 
@@ -10232,9 +10244,9 @@
10232
10244
 
10233
10245
  // translate geometry
10234
10246
 
10235
- _m1.makeTranslation( x, y, z );
10247
+ _m1$2.makeTranslation( x, y, z );
10236
10248
 
10237
- this.applyMatrix4( _m1 );
10249
+ this.applyMatrix4( _m1$2 );
10238
10250
 
10239
10251
  return this;
10240
10252
 
@@ -10244,9 +10256,9 @@
10244
10256
 
10245
10257
  // scale geometry
10246
10258
 
10247
- _m1.makeScale( x, y, z );
10259
+ _m1$2.makeScale( x, y, z );
10248
10260
 
10249
- this.applyMatrix4( _m1 );
10261
+ this.applyMatrix4( _m1$2 );
10250
10262
 
10251
10263
  return this;
10252
10264
 
@@ -10306,7 +10318,7 @@
10306
10318
 
10307
10319
  if ( position && position.isGLBufferAttribute ) {
10308
10320
 
10309
- console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
10321
+ console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
10310
10322
 
10311
10323
  this.boundingBox.set(
10312
10324
  new Vector3( - Infinity, - Infinity, - Infinity ),
@@ -10376,7 +10388,7 @@
10376
10388
 
10377
10389
  if ( position && position.isGLBufferAttribute ) {
10378
10390
 
10379
- console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
10391
+ console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
10380
10392
 
10381
10393
  this.boundingSphere.set( new Vector3(), Infinity );
10382
10394
 
@@ -10493,24 +10505,21 @@
10493
10505
 
10494
10506
  }
10495
10507
 
10496
- const indices = index.array;
10497
- const positions = attributes.position.array;
10498
- const normals = attributes.normal.array;
10499
- const uvs = attributes.uv.array;
10500
-
10501
- const nVertices = positions.length / 3;
10508
+ const positionAttribute = attributes.position;
10509
+ const normalAttribute = attributes.normal;
10510
+ const uvAttribute = attributes.uv;
10502
10511
 
10503
10512
  if ( this.hasAttribute( 'tangent' ) === false ) {
10504
10513
 
10505
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
10514
+ this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
10506
10515
 
10507
10516
  }
10508
10517
 
10509
- const tangents = this.getAttribute( 'tangent' ).array;
10518
+ const tangentAttribute = this.getAttribute( 'tangent' );
10510
10519
 
10511
10520
  const tan1 = [], tan2 = [];
10512
10521
 
10513
- for ( let i = 0; i < nVertices; i ++ ) {
10522
+ for ( let i = 0; i < positionAttribute.count; i ++ ) {
10514
10523
 
10515
10524
  tan1[ i ] = new Vector3();
10516
10525
  tan2[ i ] = new Vector3();
@@ -10530,13 +10539,13 @@
10530
10539
 
10531
10540
  function handleTriangle( a, b, c ) {
10532
10541
 
10533
- vA.fromArray( positions, a * 3 );
10534
- vB.fromArray( positions, b * 3 );
10535
- vC.fromArray( positions, c * 3 );
10542
+ vA.fromBufferAttribute( positionAttribute, a );
10543
+ vB.fromBufferAttribute( positionAttribute, b );
10544
+ vC.fromBufferAttribute( positionAttribute, c );
10536
10545
 
10537
- uvA.fromArray( uvs, a * 2 );
10538
- uvB.fromArray( uvs, b * 2 );
10539
- uvC.fromArray( uvs, c * 2 );
10546
+ uvA.fromBufferAttribute( uvAttribute, a );
10547
+ uvB.fromBufferAttribute( uvAttribute, b );
10548
+ uvC.fromBufferAttribute( uvAttribute, c );
10540
10549
 
10541
10550
  vB.sub( vA );
10542
10551
  vC.sub( vA );
@@ -10569,7 +10578,7 @@
10569
10578
 
10570
10579
  groups = [ {
10571
10580
  start: 0,
10572
- count: indices.length
10581
+ count: index.count
10573
10582
  } ];
10574
10583
 
10575
10584
  }
@@ -10584,9 +10593,9 @@
10584
10593
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
10585
10594
 
10586
10595
  handleTriangle(
10587
- indices[ j + 0 ],
10588
- indices[ j + 1 ],
10589
- indices[ j + 2 ]
10596
+ index.getX( j + 0 ),
10597
+ index.getX( j + 1 ),
10598
+ index.getX( j + 2 )
10590
10599
  );
10591
10600
 
10592
10601
  }
@@ -10598,7 +10607,7 @@
10598
10607
 
10599
10608
  function handleVertex( v ) {
10600
10609
 
10601
- n.fromArray( normals, v * 3 );
10610
+ n.fromBufferAttribute( normalAttribute, v );
10602
10611
  n2.copy( n );
10603
10612
 
10604
10613
  const t = tan1[ v ];
@@ -10614,10 +10623,7 @@
10614
10623
  const test = tmp2.dot( tan2[ v ] );
10615
10624
  const w = ( test < 0.0 ) ? - 1.0 : 1.0;
10616
10625
 
10617
- tangents[ v * 4 ] = tmp.x;
10618
- tangents[ v * 4 + 1 ] = tmp.y;
10619
- tangents[ v * 4 + 2 ] = tmp.z;
10620
- tangents[ v * 4 + 3 ] = w;
10626
+ tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
10621
10627
 
10622
10628
  }
10623
10629
 
@@ -10630,9 +10636,9 @@
10630
10636
 
10631
10637
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
10632
10638
 
10633
- handleVertex( indices[ j + 0 ] );
10634
- handleVertex( indices[ j + 1 ] );
10635
- handleVertex( indices[ j + 2 ] );
10639
+ handleVertex( index.getX( j + 0 ) );
10640
+ handleVertex( index.getX( j + 1 ) );
10641
+ handleVertex( index.getX( j + 2 ) );
10636
10642
 
10637
10643
  }
10638
10644
 
@@ -11461,7 +11467,6 @@
11461
11467
  _uvC$1.fromBufferAttribute( uv1, c );
11462
11468
 
11463
11469
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
11464
- intersection.uv2 = intersection.uv1; // @deprecated, r152
11465
11470
 
11466
11471
  }
11467
11472
 
@@ -12495,14 +12500,6 @@
12495
12500
  const image = { width: size, height: size, depth: 1 };
12496
12501
  const images = [ image, image, image, image, image, image ];
12497
12502
 
12498
- if ( options.encoding !== undefined ) {
12499
-
12500
- // @deprecated, r152
12501
- warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
12502
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
12503
-
12504
- }
12505
-
12506
12503
  this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
12507
12504
 
12508
12505
  // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
@@ -13445,9 +13442,9 @@
13445
13442
 
13446
13443
  var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}";
13447
13444
 
13448
- var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13445
+ var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13449
13446
 
13450
- var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
13447
+ var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
13451
13448
 
13452
13449
  var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
13453
13450
 
@@ -13475,7 +13472,7 @@
13475
13472
 
13476
13473
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
13477
13474
 
13478
- 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";
13475
+ 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, envMapRotation * 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, envMapRotation * 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";
13479
13476
 
13480
13477
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13481
13478
 
@@ -13515,11 +13512,13 @@
13515
13512
 
13516
13513
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
13517
13514
 
13515
+ var morphinstance_vertex = "#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";
13516
+
13518
13517
  var morphcolor_vertex = "#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif";
13519
13518
 
13520
13519
  var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
13521
13520
 
13522
- var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
13521
+ var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t#endif\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\t#ifndef USE_INSTANCING_MORPH\n\t\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\t#endif\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
13523
13522
 
13524
13523
  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";
13525
13524
 
@@ -13581,7 +13580,7 @@
13581
13580
 
13582
13581
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13583
13582
 
13584
- var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13583
+ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13585
13584
 
13586
13585
  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";
13587
13586
 
@@ -13601,17 +13600,17 @@
13601
13600
 
13602
13601
  const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
13603
13602
 
13604
- const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13603
+ const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13605
13604
 
13606
13605
  const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
13607
13606
 
13608
13607
  const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13609
13608
 
13610
- const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
13609
+ const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
13611
13610
 
13612
13611
  const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
13613
13612
 
13614
- const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
13613
+ const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
13615
13614
 
13616
13615
  const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
13617
13616
 
@@ -13619,43 +13618,43 @@
13619
13618
 
13620
13619
  const fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13621
13620
 
13622
- const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
13621
+ const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
13623
13622
 
13624
13623
  const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
13625
13624
 
13626
- const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
13625
+ const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
13627
13626
 
13628
13627
  const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13629
13628
 
13630
- const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13629
+ const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13631
13630
 
13632
13631
  const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13633
13632
 
13634
- const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
13633
+ const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
13635
13634
 
13636
13635
  const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13637
13636
 
13638
- const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
13637
+ const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
13639
13638
 
13640
13639
  const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
13641
13640
 
13642
- const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13641
+ const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13643
13642
 
13644
13643
  const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13645
13644
 
13646
- const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13645
+ const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13647
13646
 
13648
13647
  const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13649
13648
 
13650
- const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13649
+ const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13651
13650
 
13652
13651
  const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13653
13652
 
13654
- const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
13653
+ const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
13655
13654
 
13656
13655
  const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
13657
13656
 
13658
- const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13657
+ const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13659
13658
 
13660
13659
  const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
13661
13660
 
@@ -13731,6 +13730,7 @@
13731
13730
  map_particle_pars_fragment: map_particle_pars_fragment,
13732
13731
  metalnessmap_fragment: metalnessmap_fragment,
13733
13732
  metalnessmap_pars_fragment: metalnessmap_pars_fragment,
13733
+ morphinstance_vertex: morphinstance_vertex,
13734
13734
  morphcolor_vertex: morphcolor_vertex,
13735
13735
  morphnormal_vertex: morphnormal_vertex,
13736
13736
  morphtarget_pars_vertex: morphtarget_pars_vertex,
@@ -13839,6 +13839,7 @@
13839
13839
  envmap: {
13840
13840
 
13841
13841
  envMap: { value: null },
13842
+ envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
13842
13843
  flipEnvMap: { value: - 1 },
13843
13844
  reflectivity: { value: 1.0 }, // basic, lambert, phong
13844
13845
  ior: { value: 1.5 }, // physical
@@ -14259,7 +14260,8 @@
14259
14260
  envMap: { value: null },
14260
14261
  flipEnvMap: { value: - 1 },
14261
14262
  backgroundBlurriness: { value: 0 },
14262
- backgroundIntensity: { value: 1 }
14263
+ backgroundIntensity: { value: 1 },
14264
+ backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
14263
14265
  },
14264
14266
 
14265
14267
  vertexShader: ShaderChunk.backgroundCube_vert,
@@ -14383,6 +14385,8 @@
14383
14385
  };
14384
14386
 
14385
14387
  const _rgb = { r: 0, b: 0, g: 0 };
14388
+ const _e1$1 = /*@__PURE__*/ new Euler();
14389
+ const _m1$1 = /*@__PURE__*/ new Matrix4();
14386
14390
 
14387
14391
  function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
14388
14392
 
@@ -14479,10 +14483,24 @@
14479
14483
 
14480
14484
  }
14481
14485
 
14486
+ _e1$1.copy( scene.backgroundRotation );
14487
+
14488
+ // accommodate left-handed frame
14489
+ _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
14490
+
14491
+ if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
14492
+
14493
+ // environment maps which are not cube render targets or PMREMs follow a different convention
14494
+ _e1$1.y *= - 1;
14495
+ _e1$1.z *= - 1;
14496
+
14497
+ }
14498
+
14482
14499
  boxMesh.material.uniforms.envMap.value = background;
14483
14500
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14484
14501
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14485
14502
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14503
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
14486
14504
  boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14487
14505
 
14488
14506
  if ( currentBackground !== background ||
@@ -15947,6 +15965,7 @@
15947
15965
  * Generates a PMREM from an equirectangular texture, which can be either LDR
15948
15966
  * or HDR. The ideal input image size is 1k (1024 x 512),
15949
15967
  * as this matches best with the 256 x 256 cubemap output.
15968
+ * The smallest supported equirectangular image size is 64 x 32.
15950
15969
  */
15951
15970
  fromEquirectangular( equirectangular, renderTarget = null ) {
15952
15971
 
@@ -15958,6 +15977,7 @@
15958
15977
  * Generates a PMREM from an cubemap texture, which can be either LDR
15959
15978
  * or HDR. The ideal input cube size is 256 x 256,
15960
15979
  * as this matches best with the 256 x 256 cubemap output.
15980
+ * The smallest supported cube size is 16 x 16.
15961
15981
  */
15962
15982
  fromCubemap( cubemap, renderTarget = null ) {
15963
15983
 
@@ -17465,24 +17485,31 @@
17465
17485
  }
17466
17486
 
17467
17487
  //
17488
+ if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17468
17489
 
17469
- let morphInfluencesSum = 0;
17490
+ program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17470
17491
 
17471
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
17492
+ } else {
17472
17493
 
17473
- morphInfluencesSum += objectInfluences[ i ];
17494
+ let morphInfluencesSum = 0;
17474
17495
 
17475
- }
17496
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
17476
17497
 
17477
- const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17498
+ morphInfluencesSum += objectInfluences[ i ];
17478
17499
 
17479
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17480
- program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17500
+ }
17501
+
17502
+ const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17503
+
17504
+
17505
+ program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17506
+ program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17507
+
17508
+ }
17481
17509
 
17482
17510
  program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17483
17511
  program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17484
17512
 
17485
-
17486
17513
  } else {
17487
17514
 
17488
17515
  // When object doesn't have morph target influences defined, we treat it as a 0-length array
@@ -19031,6 +19058,10 @@
19031
19058
  toneMappingName = 'AgX';
19032
19059
  break;
19033
19060
 
19061
+ case NeutralToneMapping:
19062
+ toneMappingName = 'Neutral';
19063
+ break;
19064
+
19034
19065
  case CustomToneMapping:
19035
19066
  toneMappingName = 'Custom';
19036
19067
  break;
@@ -19454,6 +19485,7 @@
19454
19485
  parameters.batching ? '#define USE_BATCHING' : '',
19455
19486
  parameters.instancing ? '#define USE_INSTANCING' : '',
19456
19487
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
19488
+ parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
19457
19489
 
19458
19490
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
19459
19491
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
@@ -19585,6 +19617,12 @@
19585
19617
 
19586
19618
  '#endif',
19587
19619
 
19620
+ '#ifdef USE_INSTANCING_MORPH',
19621
+
19622
+ ' uniform sampler2D morphTexture;',
19623
+
19624
+ '#endif',
19625
+
19588
19626
  'attribute vec3 position;',
19589
19627
  'attribute vec3 normal;',
19590
19628
  'attribute vec2 uv;',
@@ -20326,6 +20364,7 @@
20326
20364
  batching: IS_BATCHEDMESH,
20327
20365
  instancing: IS_INSTANCEDMESH,
20328
20366
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
20367
+ instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
20329
20368
 
20330
20369
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
20331
20370
  outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
@@ -20612,38 +20651,40 @@
20612
20651
  _programLayers.enable( 2 );
20613
20652
  if ( parameters.instancingColor )
20614
20653
  _programLayers.enable( 3 );
20615
- if ( parameters.matcap )
20654
+ if ( parameters.instancingMorph )
20616
20655
  _programLayers.enable( 4 );
20617
- if ( parameters.envMap )
20656
+ if ( parameters.matcap )
20618
20657
  _programLayers.enable( 5 );
20619
- if ( parameters.normalMapObjectSpace )
20658
+ if ( parameters.envMap )
20620
20659
  _programLayers.enable( 6 );
20621
- if ( parameters.normalMapTangentSpace )
20660
+ if ( parameters.normalMapObjectSpace )
20622
20661
  _programLayers.enable( 7 );
20623
- if ( parameters.clearcoat )
20662
+ if ( parameters.normalMapTangentSpace )
20624
20663
  _programLayers.enable( 8 );
20625
- if ( parameters.iridescence )
20664
+ if ( parameters.clearcoat )
20626
20665
  _programLayers.enable( 9 );
20627
- if ( parameters.alphaTest )
20666
+ if ( parameters.iridescence )
20628
20667
  _programLayers.enable( 10 );
20629
- if ( parameters.vertexColors )
20668
+ if ( parameters.alphaTest )
20630
20669
  _programLayers.enable( 11 );
20631
- if ( parameters.vertexAlphas )
20670
+ if ( parameters.vertexColors )
20632
20671
  _programLayers.enable( 12 );
20633
- if ( parameters.vertexUv1s )
20672
+ if ( parameters.vertexAlphas )
20634
20673
  _programLayers.enable( 13 );
20635
- if ( parameters.vertexUv2s )
20674
+ if ( parameters.vertexUv1s )
20636
20675
  _programLayers.enable( 14 );
20637
- if ( parameters.vertexUv3s )
20676
+ if ( parameters.vertexUv2s )
20638
20677
  _programLayers.enable( 15 );
20639
- if ( parameters.vertexTangents )
20678
+ if ( parameters.vertexUv3s )
20640
20679
  _programLayers.enable( 16 );
20641
- if ( parameters.anisotropy )
20680
+ if ( parameters.vertexTangents )
20642
20681
  _programLayers.enable( 17 );
20643
- if ( parameters.alphaHash )
20682
+ if ( parameters.anisotropy )
20644
20683
  _programLayers.enable( 18 );
20645
- if ( parameters.batching )
20684
+ if ( parameters.alphaHash )
20646
20685
  _programLayers.enable( 19 );
20686
+ if ( parameters.batching )
20687
+ _programLayers.enable( 20 );
20647
20688
 
20648
20689
  array.push( _programLayers.mask );
20649
20690
  _programLayers.disableAll();
@@ -22748,33 +22789,19 @@
22748
22789
 
22749
22790
  }
22750
22791
 
22751
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
22752
-
22753
- const textures = renderTarget.texture;
22754
-
22755
- if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22756
-
22757
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
22792
+ const textures = renderTarget.textures;
22758
22793
 
22759
- drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
22794
+ if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22760
22795
 
22761
- }
22796
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
22762
22797
 
22763
- drawBuffers.length = textures.length;
22764
-
22765
- needsUpdate = true;
22798
+ drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
22766
22799
 
22767
22800
  }
22768
22801
 
22769
- } else {
22770
-
22771
- if ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22772
-
22773
- drawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;
22774
-
22775
- needsUpdate = true;
22802
+ drawBuffers.length = textures.length;
22776
22803
 
22777
- }
22804
+ needsUpdate = true;
22778
22805
 
22779
22806
  }
22780
22807
 
@@ -22796,10 +22823,14 @@
22796
22823
 
22797
22824
  gl.drawBuffers( drawBuffers );
22798
22825
 
22799
- } else {
22826
+ } else if ( extensions.has( 'WEBGL_draw_buffers' ) === true ) {
22800
22827
 
22801
22828
  extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
22802
22829
 
22830
+ } else {
22831
+
22832
+ throw new Error( 'THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension' );
22833
+
22803
22834
  }
22804
22835
 
22805
22836
  }
@@ -23586,6 +23617,7 @@
23586
23617
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
23587
23618
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
23588
23619
 
23620
+ const _imageDimensions = new Vector2();
23589
23621
  const _videoTextures = new WeakMap();
23590
23622
  let _canvas;
23591
23623
 
@@ -23623,11 +23655,13 @@
23623
23655
 
23624
23656
  let scale = 1;
23625
23657
 
23658
+ const dimensions = getDimensions( image );
23659
+
23626
23660
  // handle case if texture exceeds max size
23627
23661
 
23628
- if ( image.width > maxSize || image.height > maxSize ) {
23662
+ if ( dimensions.width > maxSize || dimensions.height > maxSize ) {
23629
23663
 
23630
- scale = maxSize / Math.max( image.width, image.height );
23664
+ scale = maxSize / Math.max( dimensions.width, dimensions.height );
23631
23665
 
23632
23666
  }
23633
23667
 
@@ -23639,12 +23673,13 @@
23639
23673
 
23640
23674
  if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
23641
23675
  ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
23642
- ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
23676
+ ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
23677
+ ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
23643
23678
 
23644
23679
  const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
23645
23680
 
23646
- const width = floor( scale * image.width );
23647
- const height = floor( scale * image.height );
23681
+ const width = floor( scale * dimensions.width );
23682
+ const height = floor( scale * dimensions.height );
23648
23683
 
23649
23684
  if ( _canvas === undefined ) _canvas = createCanvas( width, height );
23650
23685
 
@@ -23658,7 +23693,7 @@
23658
23693
  const context = canvas.getContext( '2d' );
23659
23694
  context.drawImage( image, 0, 0, width, height );
23660
23695
 
23661
- console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );
23696
+ console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
23662
23697
 
23663
23698
  return canvas;
23664
23699
 
@@ -23666,7 +23701,7 @@
23666
23701
 
23667
23702
  if ( 'data' in image ) {
23668
23703
 
23669
- console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
23704
+ console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
23670
23705
 
23671
23706
  }
23672
23707
 
@@ -23682,7 +23717,9 @@
23682
23717
 
23683
23718
  function isPowerOfTwo$1( image ) {
23684
23719
 
23685
- return isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );
23720
+ const dimensions = getDimensions( image );
23721
+
23722
+ return isPowerOfTwo( dimensions.width ) && isPowerOfTwo( dimensions.height );
23686
23723
 
23687
23724
  }
23688
23725
 
@@ -23749,6 +23786,17 @@
23749
23786
 
23750
23787
  }
23751
23788
 
23789
+ if ( glFormat === _gl.RG_INTEGER ) {
23790
+
23791
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;
23792
+ if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;
23793
+ if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;
23794
+ if ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;
23795
+ if ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;
23796
+ if ( glType === _gl.INT ) internalFormat = _gl.RG32I;
23797
+
23798
+ }
23799
+
23752
23800
  if ( glFormat === _gl.RGBA ) {
23753
23801
 
23754
23802
  const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
@@ -23896,18 +23944,7 @@
23896
23944
 
23897
23945
  function deallocateRenderTarget( renderTarget ) {
23898
23946
 
23899
- const texture = renderTarget.texture;
23900
-
23901
23947
  const renderTargetProperties = properties.get( renderTarget );
23902
- const textureProperties = properties.get( texture );
23903
-
23904
- if ( textureProperties.__webglTexture !== undefined ) {
23905
-
23906
- _gl.deleteTexture( textureProperties.__webglTexture );
23907
-
23908
- info.memory.textures --;
23909
-
23910
- }
23911
23948
 
23912
23949
  if ( renderTarget.depthTexture ) {
23913
23950
 
@@ -23962,27 +23999,24 @@
23962
23999
 
23963
24000
  }
23964
24001
 
23965
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
23966
-
23967
- for ( let i = 0, il = texture.length; i < il; i ++ ) {
24002
+ const textures = renderTarget.textures;
23968
24003
 
23969
- const attachmentProperties = properties.get( texture[ i ] );
24004
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
23970
24005
 
23971
- if ( attachmentProperties.__webglTexture ) {
24006
+ const attachmentProperties = properties.get( textures[ i ] );
23972
24007
 
23973
- _gl.deleteTexture( attachmentProperties.__webglTexture );
24008
+ if ( attachmentProperties.__webglTexture ) {
23974
24009
 
23975
- info.memory.textures --;
24010
+ _gl.deleteTexture( attachmentProperties.__webglTexture );
23976
24011
 
23977
- }
23978
-
23979
- properties.remove( texture[ i ] );
24012
+ info.memory.textures --;
23980
24013
 
23981
24014
  }
23982
24015
 
24016
+ properties.remove( textures[ i ] );
24017
+
23983
24018
  }
23984
24019
 
23985
- properties.remove( texture );
23986
24020
  properties.remove( renderTarget );
23987
24021
 
23988
24022
  }
@@ -24202,8 +24236,6 @@
24202
24236
 
24203
24237
  if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
24204
24238
 
24205
- const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24206
-
24207
24239
  if ( texture.magFilter === NearestFilter ) return;
24208
24240
  if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
24209
24241
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
@@ -24211,6 +24243,7 @@
24211
24243
 
24212
24244
  if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
24213
24245
 
24246
+ const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24214
24247
  _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );
24215
24248
  properties.get( texture ).__currentAnisotropy = texture.anisotropy;
24216
24249
 
@@ -24694,7 +24727,9 @@
24694
24727
 
24695
24728
  if ( useTexStorage && allocateMemory ) {
24696
24729
 
24697
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
24730
+ const dimensions = getDimensions( mipmaps[ 0 ] );
24731
+
24732
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
24698
24733
 
24699
24734
  }
24700
24735
 
@@ -24726,7 +24761,9 @@
24726
24761
 
24727
24762
  if ( allocateMemory ) {
24728
24763
 
24729
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
24764
+ const dimensions = getDimensions( image );
24765
+
24766
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
24730
24767
 
24731
24768
  }
24732
24769
 
@@ -24896,7 +24933,9 @@
24896
24933
 
24897
24934
  if ( mipmaps.length > 0 ) levels ++;
24898
24935
 
24899
- state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
24936
+ const dimensions = getDimensions( cubeImage[ 0 ] );
24937
+
24938
+ state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );
24900
24939
 
24901
24940
  }
24902
24941
 
@@ -25112,7 +25151,7 @@
25112
25151
 
25113
25152
  } else {
25114
25153
 
25115
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25154
+ const textures = renderTarget.textures;
25116
25155
 
25117
25156
  for ( let i = 0; i < textures.length; i ++ ) {
25118
25157
 
@@ -25276,7 +25315,13 @@
25276
25315
 
25277
25316
  renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
25278
25317
 
25279
- if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
25318
+ const textures = renderTarget.textures;
25319
+
25320
+ const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
25321
+ const isMultipleRenderTargets = ( textures.length > 1 );
25322
+ const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25323
+
25324
+ if ( ! isMultipleRenderTargets ) {
25280
25325
 
25281
25326
  if ( textureProperties.__webglTexture === undefined ) {
25282
25327
 
@@ -25289,10 +25334,6 @@
25289
25334
 
25290
25335
  }
25291
25336
 
25292
- const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
25293
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25294
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25295
-
25296
25337
  // Setup framebuffer
25297
25338
 
25298
25339
  if ( isCube ) {
@@ -25341,8 +25382,6 @@
25341
25382
 
25342
25383
  if ( capabilities.drawBuffers ) {
25343
25384
 
25344
- const textures = renderTarget.texture;
25345
-
25346
25385
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
25347
25386
 
25348
25387
  const attachmentProperties = properties.get( textures[ i ] );
@@ -25367,8 +25406,6 @@
25367
25406
 
25368
25407
  if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25369
25408
 
25370
- const textures = isMultipleRenderTargets ? texture : [ texture ];
25371
-
25372
25409
  renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
25373
25410
  renderTargetProperties.__webglColorRenderbuffer = [];
25374
25411
 
@@ -25441,8 +25478,6 @@
25441
25478
 
25442
25479
  } else if ( isMultipleRenderTargets ) {
25443
25480
 
25444
- const textures = renderTarget.texture;
25445
-
25446
25481
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
25447
25482
 
25448
25483
  const attachment = textures[ i ];
@@ -25521,7 +25556,7 @@
25521
25556
 
25522
25557
  const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25523
25558
 
25524
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25559
+ const textures = renderTarget.textures;
25525
25560
 
25526
25561
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
25527
25562
 
@@ -25546,14 +25581,14 @@
25546
25581
 
25547
25582
  if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25548
25583
 
25549
- const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
25584
+ const textures = renderTarget.textures;
25550
25585
  const width = renderTarget.width;
25551
25586
  const height = renderTarget.height;
25552
25587
  let mask = _gl.COLOR_BUFFER_BIT;
25553
25588
  const invalidationArray = [];
25554
25589
  const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
25555
25590
  const renderTargetProperties = properties.get( renderTarget );
25556
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25591
+ const isMultipleRenderTargets = ( textures.length > 1 );
25557
25592
 
25558
25593
  // If MRT we need to remove FBO attachments
25559
25594
  if ( isMultipleRenderTargets ) {
@@ -25737,6 +25772,31 @@
25737
25772
 
25738
25773
  }
25739
25774
 
25775
+ function getDimensions( image ) {
25776
+
25777
+ if ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {
25778
+
25779
+ // if intrinsic data are not available, fallback to width/height
25780
+
25781
+ _imageDimensions.width = image.naturalWidth || image.width;
25782
+ _imageDimensions.height = image.naturalHeight || image.height;
25783
+
25784
+ } else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {
25785
+
25786
+ _imageDimensions.width = image.displayWidth;
25787
+ _imageDimensions.height = image.displayHeight;
25788
+
25789
+ } else {
25790
+
25791
+ _imageDimensions.width = image.width;
25792
+ _imageDimensions.height = image.height;
25793
+
25794
+ }
25795
+
25796
+ return _imageDimensions;
25797
+
25798
+ }
25799
+
25740
25800
  //
25741
25801
 
25742
25802
  this.allocateTextureUnit = allocateTextureUnit;
@@ -27308,6 +27368,9 @@ void main() {
27308
27368
 
27309
27369
  }
27310
27370
 
27371
+ const _e1 = /*@__PURE__*/ new Euler();
27372
+ const _m1 = /*@__PURE__*/ new Matrix4();
27373
+
27311
27374
  function WebGLMaterials( renderer, properties ) {
27312
27375
 
27313
27376
  function refreshTransformUniform( map, uniform ) {
@@ -27516,12 +27579,30 @@ void main() {
27516
27579
 
27517
27580
  }
27518
27581
 
27519
- const envMap = properties.get( material ).envMap;
27582
+ const materialProperties = properties.get( material );
27583
+
27584
+ const envMap = materialProperties.envMap;
27585
+ const envMapRotation = materialProperties.envMapRotation;
27520
27586
 
27521
27587
  if ( envMap ) {
27522
27588
 
27523
27589
  uniforms.envMap.value = envMap;
27524
27590
 
27591
+ _e1.copy( envMapRotation );
27592
+
27593
+ // accommodate left-handed frame
27594
+ _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
27595
+
27596
+ if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
27597
+
27598
+ // environment maps which are not cube render targets or PMREMs follow a different convention
27599
+ _e1.y *= - 1;
27600
+ _e1.z *= - 1;
27601
+
27602
+ }
27603
+
27604
+ uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
27605
+
27525
27606
  uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
27526
27607
 
27527
27608
  uniforms.reflectivity.value = material.reflectivity;
@@ -28689,7 +28770,7 @@ void main() {
28689
28770
 
28690
28771
  }
28691
28772
 
28692
- state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
28773
+ state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );
28693
28774
 
28694
28775
  };
28695
28776
 
@@ -28711,7 +28792,7 @@ void main() {
28711
28792
 
28712
28793
  }
28713
28794
 
28714
- state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
28795
+ state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );
28715
28796
 
28716
28797
  };
28717
28798
 
@@ -29812,6 +29893,7 @@ void main() {
29812
29893
  materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
29813
29894
  materialProperties.fog = scene.fog;
29814
29895
  materialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );
29896
+ materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
29815
29897
 
29816
29898
  if ( programs === undefined ) {
29817
29899
 
@@ -29924,6 +30006,7 @@ void main() {
29924
30006
  materialProperties.batching = parameters.batching;
29925
30007
  materialProperties.instancing = parameters.instancing;
29926
30008
  materialProperties.instancingColor = parameters.instancingColor;
30009
+ materialProperties.instancingMorph = parameters.instancingMorph;
29927
30010
  materialProperties.skinning = parameters.skinning;
29928
30011
  materialProperties.morphTargets = parameters.morphTargets;
29929
30012
  materialProperties.morphNormals = parameters.morphNormals;
@@ -30034,6 +30117,14 @@ void main() {
30034
30117
 
30035
30118
  needsProgramChange = true;
30036
30119
 
30120
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {
30121
+
30122
+ needsProgramChange = true;
30123
+
30124
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {
30125
+
30126
+ needsProgramChange = true;
30127
+
30037
30128
  } else if ( materialProperties.envMap !== envMap ) {
30038
30129
 
30039
30130
  needsProgramChange = true;
@@ -30362,20 +30453,16 @@ void main() {
30362
30453
  const renderTargetProperties = properties.get( renderTarget );
30363
30454
  renderTargetProperties.__hasExternalTextures = true;
30364
30455
 
30365
- if ( renderTargetProperties.__hasExternalTextures ) {
30456
+ renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
30366
30457
 
30367
- renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
30458
+ if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
30368
30459
 
30369
- if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
30460
+ // The multisample_render_to_texture extension doesn't work properly if there
30461
+ // are midframe flushes and an external depth buffer. Disable use of the extension.
30462
+ if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
30370
30463
 
30371
- // The multisample_render_to_texture extension doesn't work properly if there
30372
- // are midframe flushes and an external depth buffer. Disable use of the extension.
30373
- if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
30374
-
30375
- console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
30376
- renderTargetProperties.__useRenderToTexture = false;
30377
-
30378
- }
30464
+ console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
30465
+ renderTargetProperties.__useRenderToTexture = false;
30379
30466
 
30380
30467
  }
30381
30468
 
@@ -30635,8 +30722,8 @@ void main() {
30635
30722
 
30636
30723
  }
30637
30724
 
30638
- const width = sourceBox.max.x - sourceBox.min.x + 1;
30639
- const height = sourceBox.max.y - sourceBox.min.y + 1;
30725
+ const width = Math.round( sourceBox.max.x - sourceBox.min.x );
30726
+ const height = Math.round( sourceBox.max.y - sourceBox.min.y );
30640
30727
  const depth = sourceBox.max.z - sourceBox.min.z + 1;
30641
30728
  const glFormat = utils.convert( dstTexture.format );
30642
30729
  const glType = utils.convert( dstTexture.type );
@@ -30683,9 +30770,8 @@ void main() {
30683
30770
 
30684
30771
  } else {
30685
30772
 
30686
- if ( srcTexture.isCompressedArrayTexture ) {
30773
+ if ( dstTexture.isCompressedArrayTexture ) {
30687
30774
 
30688
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
30689
30775
  _gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
30690
30776
 
30691
30777
  } else {
@@ -30774,20 +30860,6 @@ void main() {
30774
30860
 
30775
30861
  }
30776
30862
 
30777
- get outputEncoding() { // @deprecated, r152
30778
-
30779
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30780
- return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
30781
-
30782
- }
30783
-
30784
- set outputEncoding( encoding ) { // @deprecated, r152
30785
-
30786
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30787
- this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
30788
-
30789
- }
30790
-
30791
30863
  get useLegacyLights() { // @deprecated, r155
30792
30864
 
30793
30865
  console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
@@ -30824,6 +30896,8 @@ void main() {
30824
30896
 
30825
30897
  this.backgroundBlurriness = 0;
30826
30898
  this.backgroundIntensity = 1;
30899
+ this.backgroundRotation = new Euler();
30900
+ this.environmentRotation = new Euler();
30827
30901
 
30828
30902
  this.overrideMaterial = null;
30829
30903
 
@@ -30845,6 +30919,8 @@ void main() {
30845
30919
 
30846
30920
  this.backgroundBlurriness = source.backgroundBlurriness;
30847
30921
  this.backgroundIntensity = source.backgroundIntensity;
30922
+ this.backgroundRotation.copy( source.backgroundRotation );
30923
+ this.environmentRotation.copy( source.environmentRotation );
30848
30924
 
30849
30925
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
30850
30926
 
@@ -30862,6 +30938,9 @@ void main() {
30862
30938
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
30863
30939
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
30864
30940
 
30941
+ data.object.backgroundRotation = this.backgroundRotation.toArray();
30942
+ data.object.environmentRotation = this.environmentRotation.toArray();
30943
+
30865
30944
  return data;
30866
30945
 
30867
30946
  }
@@ -31559,9 +31638,9 @@ void main() {
31559
31638
 
31560
31639
  }
31561
31640
 
31562
- getPoint( t, optionalTarget ) {
31641
+ getPoint( t, optionalTarget = new Vector2() ) {
31563
31642
 
31564
- const point = optionalTarget || new Vector2();
31643
+ const point = optionalTarget;
31565
31644
 
31566
31645
  const twoPi = Math.PI * 2;
31567
31646
  let deltaAngle = this.aEndAngle - this.aStartAngle;
@@ -33271,6 +33350,7 @@ void main() {
33271
33350
  this.alphaMap = null;
33272
33351
 
33273
33352
  this.envMap = null;
33353
+ this.envMapRotation = new Euler();
33274
33354
  this.combine = MultiplyOperation;
33275
33355
  this.reflectivity = 1;
33276
33356
  this.refractionRatio = 0.98;
@@ -33322,6 +33402,7 @@ void main() {
33322
33402
  this.alphaMap = source.alphaMap;
33323
33403
 
33324
33404
  this.envMap = source.envMap;
33405
+ this.envMapRotation.copy( source.envMapRotation );
33325
33406
  this.combine = source.combine;
33326
33407
  this.reflectivity = source.reflectivity;
33327
33408
  this.refractionRatio = source.refractionRatio;
@@ -34042,6 +34123,8 @@ void main() {
34042
34123
 
34043
34124
  }
34044
34125
 
34126
+ const _matrix = /*@__PURE__*/ new Matrix4();
34127
+
34045
34128
  class Raycaster {
34046
34129
 
34047
34130
  constructor( origin, direction, near = 0, far = Infinity ) {
@@ -34094,9 +34177,20 @@ void main() {
34094
34177
 
34095
34178
  }
34096
34179
 
34180
+ setFromXRController( controller ) {
34181
+
34182
+ _matrix.identity().extractRotation( controller.matrixWorld );
34183
+
34184
+ this.ray.origin.setFromMatrixPosition( controller.matrixWorld );
34185
+ this.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );
34186
+
34187
+ return this;
34188
+
34189
+ }
34190
+
34097
34191
  intersectObject( object, recursive = true, intersects = [] ) {
34098
34192
 
34099
- intersectObject( object, this, intersects, recursive );
34193
+ intersect( object, this, intersects, recursive );
34100
34194
 
34101
34195
  intersects.sort( ascSort );
34102
34196
 
@@ -34108,7 +34202,7 @@ void main() {
34108
34202
 
34109
34203
  for ( let i = 0, l = objects.length; i < l; i ++ ) {
34110
34204
 
34111
- intersectObject( objects[ i ], this, intersects, recursive );
34205
+ intersect( objects[ i ], this, intersects, recursive );
34112
34206
 
34113
34207
  }
34114
34208
 
@@ -34126,7 +34220,7 @@ void main() {
34126
34220
 
34127
34221
  }
34128
34222
 
34129
- function intersectObject( object, raycaster, intersects, recursive ) {
34223
+ function intersect( object, raycaster, intersects, recursive ) {
34130
34224
 
34131
34225
  if ( object.layers.test( raycaster.layers ) ) {
34132
34226
 
@@ -34140,7 +34234,7 @@ void main() {
34140
34234
 
34141
34235
  for ( let i = 0, l = children.length; i < l; i ++ ) {
34142
34236
 
34143
- intersectObject( children[ i ], raycaster, intersects, true );
34237
+ intersect( children[ i ], raycaster, intersects, true );
34144
34238
 
34145
34239
  }
34146
34240
 
@@ -34259,10 +34353,15 @@ void main() {
34259
34353
 
34260
34354
  const _pointer = new Vector2();
34261
34355
  const _offset = new Vector3();
34356
+ const _diff = new Vector2();
34357
+ const _previousPointer = new Vector2();
34262
34358
  const _intersection = new Vector3();
34263
34359
  const _worldPosition = new Vector3();
34264
34360
  const _inverseMatrix = new Matrix4();
34265
34361
 
34362
+ const _up = new Vector3();
34363
+ const _right = new Vector3();
34364
+
34266
34365
  class DragControls extends EventDispatcher {
34267
34366
 
34268
34367
  constructor( _objects, _camera, _domElement ) {
@@ -34275,6 +34374,10 @@ void main() {
34275
34374
 
34276
34375
  const _intersections = [];
34277
34376
 
34377
+ this.mode = 'translate';
34378
+
34379
+ this.rotateSpeed = 1;
34380
+
34278
34381
  //
34279
34382
 
34280
34383
  const scope = this;
@@ -34311,6 +34414,12 @@ void main() {
34311
34414
 
34312
34415
  }
34313
34416
 
34417
+ function setObjects( objects ) {
34418
+
34419
+ _objects = objects;
34420
+
34421
+ }
34422
+
34314
34423
  function getRaycaster() {
34315
34424
 
34316
34425
  return _raycaster;
@@ -34327,59 +34436,71 @@ void main() {
34327
34436
 
34328
34437
  if ( _selected ) {
34329
34438
 
34330
- if ( _raycaster.ray.intersectPlane( _plane$1, _intersection ) ) {
34439
+ if ( scope.mode === 'translate' ) {
34440
+
34441
+ if ( _raycaster.ray.intersectPlane( _plane$1, _intersection ) ) {
34442
+
34443
+ _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
34444
+
34445
+ }
34446
+
34447
+ } else if ( scope.mode === 'rotate' ) {
34331
34448
 
34332
- _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
34449
+ _diff.subVectors( _pointer, _previousPointer ).multiplyScalar( scope.rotateSpeed );
34450
+ _selected.rotateOnWorldAxis( _up, _diff.x );
34451
+ _selected.rotateOnWorldAxis( _right.normalize(), - _diff.y );
34333
34452
 
34334
34453
  }
34335
34454
 
34336
34455
  scope.dispatchEvent( { type: 'drag', object: _selected } );
34337
34456
 
34338
- return;
34457
+ _previousPointer.copy( _pointer );
34339
34458
 
34340
- }
34459
+ } else {
34341
34460
 
34342
- // hover support
34461
+ // hover support
34343
34462
 
34344
- if ( event.pointerType === 'mouse' || event.pointerType === 'pen' ) {
34463
+ if ( event.pointerType === 'mouse' || event.pointerType === 'pen' ) {
34345
34464
 
34346
- _intersections.length = 0;
34465
+ _intersections.length = 0;
34347
34466
 
34348
- _raycaster.setFromCamera( _pointer, _camera );
34349
- _raycaster.intersectObjects( _objects, scope.recursive, _intersections );
34467
+ _raycaster.setFromCamera( _pointer, _camera );
34468
+ _raycaster.intersectObjects( _objects, scope.recursive, _intersections );
34350
34469
 
34351
- if ( _intersections.length > 0 ) {
34470
+ if ( _intersections.length > 0 ) {
34352
34471
 
34353
- const object = _intersections[ 0 ].object;
34472
+ const object = _intersections[ 0 ].object;
34354
34473
 
34355
- _plane$1.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane$1.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
34474
+ _plane$1.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane$1.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
34356
34475
 
34357
- if ( _hovered !== object && _hovered !== null ) {
34476
+ if ( _hovered !== object && _hovered !== null ) {
34358
34477
 
34359
- scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
34478
+ scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
34360
34479
 
34361
- _domElement.style.cursor = 'auto';
34362
- _hovered = null;
34480
+ _domElement.style.cursor = 'auto';
34481
+ _hovered = null;
34363
34482
 
34364
- }
34483
+ }
34365
34484
 
34366
- if ( _hovered !== object ) {
34485
+ if ( _hovered !== object ) {
34367
34486
 
34368
- scope.dispatchEvent( { type: 'hoveron', object: object } );
34487
+ scope.dispatchEvent( { type: 'hoveron', object: object } );
34369
34488
 
34370
- _domElement.style.cursor = 'pointer';
34371
- _hovered = object;
34489
+ _domElement.style.cursor = 'pointer';
34490
+ _hovered = object;
34372
34491
 
34373
- }
34492
+ }
34374
34493
 
34375
- } else {
34494
+ } else {
34376
34495
 
34377
- if ( _hovered !== null ) {
34496
+ if ( _hovered !== null ) {
34378
34497
 
34379
- scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
34498
+ scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
34380
34499
 
34381
- _domElement.style.cursor = 'auto';
34382
- _hovered = null;
34500
+ _domElement.style.cursor = 'auto';
34501
+ _hovered = null;
34502
+
34503
+ }
34383
34504
 
34384
34505
  }
34385
34506
 
@@ -34387,6 +34508,8 @@ void main() {
34387
34508
 
34388
34509
  }
34389
34510
 
34511
+ _previousPointer.copy( _pointer );
34512
+
34390
34513
  }
34391
34514
 
34392
34515
  function onPointerDown( event ) {
@@ -34402,14 +34525,34 @@ void main() {
34402
34525
 
34403
34526
  if ( _intersections.length > 0 ) {
34404
34527
 
34405
- _selected = ( scope.transformGroup === true ) ? _objects[ 0 ] : _intersections[ 0 ].object;
34528
+ if ( scope.transformGroup === true ) {
34529
+
34530
+ // look for the outermost group in the object's upper hierarchy
34531
+
34532
+ _selected = findGroup( _intersections[ 0 ].object );
34533
+
34534
+ } else {
34535
+
34536
+ _selected = _intersections[ 0 ].object;
34537
+
34538
+ }
34406
34539
 
34407
34540
  _plane$1.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane$1.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
34408
34541
 
34409
34542
  if ( _raycaster.ray.intersectPlane( _plane$1, _intersection ) ) {
34410
34543
 
34411
- _inverseMatrix.copy( _selected.parent.matrixWorld ).invert();
34412
- _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
34544
+ if ( scope.mode === 'translate' ) {
34545
+
34546
+ _inverseMatrix.copy( _selected.parent.matrixWorld ).invert();
34547
+ _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
34548
+
34549
+ } else if ( scope.mode === 'rotate' ) {
34550
+
34551
+ // the controls only support Y+ up
34552
+ _up.set( 0, 1, 0 ).applyQuaternion( _camera.quaternion ).normalize();
34553
+ _right.set( 1, 0, 0 ).applyQuaternion( _camera.quaternion ).normalize();
34554
+
34555
+ }
34413
34556
 
34414
34557
  }
34415
34558
 
@@ -34419,6 +34562,7 @@ void main() {
34419
34562
 
34420
34563
  }
34421
34564
 
34565
+ _previousPointer.copy( _pointer );
34422
34566
 
34423
34567
  }
34424
34568
 
@@ -34447,6 +34591,16 @@ void main() {
34447
34591
 
34448
34592
  }
34449
34593
 
34594
+ function findGroup( obj, group = null ) {
34595
+
34596
+ if ( obj.isGroup ) group = obj;
34597
+
34598
+ if ( obj.parent === null ) return group;
34599
+
34600
+ return findGroup( obj.parent, group );
34601
+
34602
+ }
34603
+
34450
34604
  activate();
34451
34605
 
34452
34606
  // API
@@ -34460,6 +34614,7 @@ void main() {
34460
34614
  this.dispose = dispose;
34461
34615
  this.getObjects = getObjects;
34462
34616
  this.getRaycaster = getRaycaster;
34617
+ this.setObjects = setObjects;
34463
34618
 
34464
34619
  }
34465
34620
 
@@ -43998,6 +44153,7 @@ function InsertStackElement(node, body) {
43998
44153
  scope.target.clampLength( scope.minTargetRadius, scope.maxTargetRadius );
43999
44154
  scope.target.add( scope.cursor );
44000
44155
 
44156
+ let zoomChanged = false;
44001
44157
  // adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
44002
44158
  // we adjust zoom later in these cases
44003
44159
  if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
@@ -44006,7 +44162,9 @@ function InsertStackElement(node, body) {
44006
44162
 
44007
44163
  } else {
44008
44164
 
44165
+ const prevRadius = spherical.radius;
44009
44166
  spherical.radius = clampDistance( spherical.radius * scale );
44167
+ zoomChanged = prevRadius != spherical.radius;
44010
44168
 
44011
44169
  }
44012
44170
 
@@ -44035,7 +44193,6 @@ function InsertStackElement(node, body) {
44035
44193
  }
44036
44194
 
44037
44195
  // adjust camera position
44038
- let zoomChanged = false;
44039
44196
  if ( scope.zoomToCursor && performCursorZoom ) {
44040
44197
 
44041
44198
  let newRadius = null;
@@ -44050,15 +44207,19 @@ function InsertStackElement(node, body) {
44050
44207
  scope.object.position.addScaledVector( dollyDirection, radiusDelta );
44051
44208
  scope.object.updateMatrixWorld();
44052
44209
 
44210
+ zoomChanged = !! radiusDelta;
44211
+
44053
44212
  } else if ( scope.object.isOrthographicCamera ) {
44054
44213
 
44055
44214
  // adjust the ortho camera position based on zoom changes
44056
44215
  const mouseBefore = new Vector3( mouse.x, mouse.y, 0 );
44057
44216
  mouseBefore.unproject( scope.object );
44058
44217
 
44218
+ const prevZoom = scope.object.zoom;
44059
44219
  scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
44060
44220
  scope.object.updateProjectionMatrix();
44061
- zoomChanged = true;
44221
+
44222
+ zoomChanged = prevZoom !== scope.object.zoom;
44062
44223
 
44063
44224
  const mouseAfter = new Vector3( mouse.x, mouse.y, 0 );
44064
44225
  mouseAfter.unproject( scope.object );
@@ -44111,12 +44272,13 @@ function InsertStackElement(node, body) {
44111
44272
 
44112
44273
  } else if ( scope.object.isOrthographicCamera ) {
44113
44274
 
44114
- zoomChanged = scale !== 1;
44275
+ const prevZoom = scope.object.zoom;
44276
+ scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
44115
44277
 
44116
- if ( zoomChanged ) {
44278
+ if ( prevZoom !== scope.object.zoom ) {
44117
44279
 
44118
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
44119
44280
  scope.object.updateProjectionMatrix();
44281
+ zoomChanged = true;
44120
44282
 
44121
44283
  }
44122
44284
 
@@ -44132,7 +44294,7 @@ function InsertStackElement(node, body) {
44132
44294
  if ( zoomChanged ||
44133
44295
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
44134
44296
  8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||
44135
- lastTargetPosition.distanceToSquared( scope.target ) > 0 ) {
44297
+ lastTargetPosition.distanceToSquared( scope.target ) > EPS ) {
44136
44298
 
44137
44299
  scope.dispatchEvent( _changeEvent$1 );
44138
44300
 
@@ -44161,6 +44323,9 @@ function InsertStackElement(node, body) {
44161
44323
  scope.domElement.removeEventListener( 'pointermove', onPointerMove );
44162
44324
  scope.domElement.removeEventListener( 'pointerup', onPointerUp );
44163
44325
 
44326
+ const document = scope.domElement.getRootNode(); // offscreen canvas compatibility
44327
+
44328
+ document.removeEventListener( 'keydown', interceptControlDown, { capture: true } );
44164
44329
 
44165
44330
  if ( scope._domElementKeyEvents !== null ) {
44166
44331
 
@@ -44750,6 +44915,10 @@ function InsertStackElement(node, body) {
44750
44915
 
44751
44916
  //
44752
44917
 
44918
+ if ( isTrackingPointer( event ) ) return;
44919
+
44920
+ //
44921
+
44753
44922
  addPointer( event );
44754
44923
 
44755
44924
  if ( event.pointerType === 'touch' ) {
@@ -45197,6 +45366,18 @@ function InsertStackElement(node, body) {
45197
45366
 
45198
45367
  }
45199
45368
 
45369
+ function isTrackingPointer( event ) {
45370
+
45371
+ for ( let i = 0; i < pointers.length; i ++ ) {
45372
+
45373
+ if ( pointers[ i ] == event.pointerId ) return true;
45374
+
45375
+ }
45376
+
45377
+ return false;
45378
+
45379
+ }
45380
+
45200
45381
  function trackPointer( event ) {
45201
45382
 
45202
45383
  let position = pointerPositions[ event.pointerId ];
@@ -49042,7 +49223,8 @@ function InsertStackElement(node, body) {
49042
49223
  : {
49043
49224
  AmbientLight: AmbientLight,
49044
49225
  DirectionalLight: DirectionalLight,
49045
- Vector3: Vector3
49226
+ Vector3: Vector3,
49227
+ REVISION: REVISION
49046
49228
  };
49047
49229
 
49048
49230
  //
@@ -49378,7 +49560,7 @@ function InsertStackElement(node, body) {
49378
49560
  });
49379
49561
 
49380
49562
  // config renderObjs
49381
- state.renderObjs.renderer().useLegacyLights = false; // force behavior for three < 155
49563
+ three.REVISION < 155 && (state.renderObjs.renderer().useLegacyLights = false); // force behavior for three < 155
49382
49564
  state.renderObjs.hoverOrderComparator(function (a, b) {
49383
49565
  // Prioritize graph objects
49384
49566
  var aObj = getGraphObj(a);