globe.gl 2.32.2 → 2.32.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.32.2 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.32.4 globe.gl - https://github.com/vasturiano/globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -6,22 +6,16 @@
6
6
  })(this, (function () { 'use strict';
7
7
 
8
8
  function styleInject$1(css, ref) {
9
- if ( ref === void 0 ) ref = {};
10
- var insertAt = ref.insertAt;
9
+ ref = {};
10
+ ref.insertAt;
11
11
 
12
- if (!css || typeof document === 'undefined') { return; }
12
+ if (typeof document === 'undefined') { return; }
13
13
 
14
14
  var head = document.head || document.getElementsByTagName('head')[0];
15
15
  var style = document.createElement('style');
16
16
  style.type = 'text/css';
17
17
 
18
- if (insertAt === 'top') {
19
- if (head.firstChild) {
20
- head.insertBefore(style, head.firstChild);
21
- } else {
22
- head.appendChild(style);
23
- }
24
- } else {
18
+ {
25
19
  head.appendChild(style);
26
20
  }
27
21
 
@@ -56,22 +50,22 @@
56
50
  }
57
51
  return e;
58
52
  }
59
- function _toPrimitive$7(t, r) {
53
+ function _toPrimitive$4(t, r) {
60
54
  if ("object" != typeof t || !t) return t;
61
55
  var e = t[Symbol.toPrimitive];
62
56
  if (void 0 !== e) {
63
- var i = e.call(t, r || "default");
57
+ var i = e.call(t, r );
64
58
  if ("object" != typeof i) return i;
65
59
  throw new TypeError("@@toPrimitive must return a primitive value.");
66
60
  }
67
- return ("string" === r ? String : Number)(t);
61
+ return (String )(t);
68
62
  }
69
- function _toPropertyKey$7(t) {
70
- var i = _toPrimitive$7(t, "string");
71
- return "symbol" == typeof i ? i : String(i);
63
+ function _toPropertyKey$4(t) {
64
+ var i = _toPrimitive$4(t, "string");
65
+ return "symbol" == typeof i ? i : i + "";
72
66
  }
73
67
  function _defineProperty$3(obj, key, value) {
74
- key = _toPropertyKey$7(key);
68
+ key = _toPropertyKey$4(key);
75
69
  if (key in obj) {
76
70
  Object.defineProperty(obj, key, {
77
71
  value: value,
@@ -129,7 +123,7 @@
129
123
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
130
124
  }
131
125
  function _arrayLikeToArray$7(arr, len) {
132
- if (len == null || len > arr.length) len = arr.length;
126
+ len = arr.length;
133
127
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
134
128
  return arr2;
135
129
  }
@@ -142,7 +136,7 @@
142
136
  * Copyright 2010-2023 Three.js Authors
143
137
  * SPDX-License-Identifier: MIT
144
138
  */
145
- const REVISION = '161';
139
+ const REVISION = '163';
146
140
 
147
141
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
148
142
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -199,6 +193,7 @@
199
193
  const ACESFilmicToneMapping = 4;
200
194
  const CustomToneMapping = 5;
201
195
  const AgXToneMapping = 6;
196
+ const NeutralToneMapping = 7;
202
197
 
203
198
  const UVMapping = 300;
204
199
  const CubeReflectionMapping = 301;
@@ -226,7 +221,9 @@
226
221
  const UnsignedShort4444Type = 1017;
227
222
  const UnsignedShort5551Type = 1018;
228
223
  const UnsignedInt248Type = 1020;
224
+ const UnsignedInt5999Type = 35902;
229
225
  const AlphaFormat = 1021;
226
+ const RGBFormat = 1022;
230
227
  const RGBAFormat = 1023;
231
228
  const LuminanceFormat = 1024;
232
229
  const LuminanceAlphaFormat = 1025;
@@ -273,10 +270,6 @@
273
270
  const TrianglesDrawMode = 0;
274
271
  const TriangleStripDrawMode = 1;
275
272
  const TriangleFanDrawMode = 2;
276
- /** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */
277
- const LinearEncoding = 3000;
278
- /** @deprecated Use SRGBColorSpace in three.js r152+. */
279
- const sRGBEncoding = 3001;
280
273
  const BasicDepthPacking = 3200;
281
274
  const RGBADepthPacking = 3201;
282
275
  const TangentSpaceNormalMap = 0;
@@ -309,8 +302,6 @@
309
302
  const StaticDrawUsage = 35044;
310
303
  const GLSL3 = '300 es';
311
304
 
312
- const _SRGBAFormat = 1035; // fallback for WebGL 1
313
-
314
305
  const WebGLCoordinateSystem = 2000;
315
306
  const WebGPUCoordinateSystem = 2001;
316
307
 
@@ -2072,17 +2063,7 @@
2072
2063
  this.flipY = true;
2073
2064
  this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
2074
2065
 
2075
- if ( typeof colorSpace === 'string' ) {
2076
-
2077
- this.colorSpace = colorSpace;
2078
-
2079
- } else { // @deprecated, r152
2080
-
2081
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2082
- this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2083
-
2084
- }
2085
-
2066
+ this.colorSpace = colorSpace;
2086
2067
 
2087
2068
  this.userData = {};
2088
2069
 
@@ -2090,7 +2071,7 @@
2090
2071
  this.onUpdate = null;
2091
2072
 
2092
2073
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
2093
- this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
2074
+ this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
2094
2075
 
2095
2076
  }
2096
2077
 
@@ -2321,17 +2302,13 @@
2321
2302
 
2322
2303
  }
2323
2304
 
2324
- get encoding() { // @deprecated, r152
2305
+ set needsPMREMUpdate( value ) {
2325
2306
 
2326
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2327
- return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
2328
-
2329
- }
2307
+ if ( value === true ) {
2330
2308
 
2331
- set encoding( encoding ) { // @deprecated, r152
2309
+ this.pmremVersion ++;
2332
2310
 
2333
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2334
- this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2311
+ }
2335
2312
 
2336
2313
  }
2337
2314
 
@@ -3008,14 +2985,6 @@
3008
2985
 
3009
2986
  const image = { width: width, height: height, depth: 1 };
3010
2987
 
3011
- if ( options.encoding !== undefined ) {
3012
-
3013
- // @deprecated, r152
3014
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
3015
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
3016
-
3017
- }
3018
-
3019
2988
  options = Object.assign( {
3020
2989
  generateMipmaps: false,
3021
2990
  internalFormat: null,
@@ -3023,15 +2992,25 @@
3023
2992
  depthBuffer: true,
3024
2993
  stencilBuffer: false,
3025
2994
  depthTexture: null,
3026
- samples: 0
2995
+ samples: 0,
2996
+ count: 1
3027
2997
  }, options );
3028
2998
 
3029
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
3030
- this.texture.isRenderTargetTexture = true;
2999
+ const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
3000
+
3001
+ texture.flipY = false;
3002
+ texture.generateMipmaps = options.generateMipmaps;
3003
+ texture.internalFormat = options.internalFormat;
3004
+
3005
+ this.textures = [];
3006
+
3007
+ const count = options.count;
3008
+ for ( let i = 0; i < count; i ++ ) {
3009
+
3010
+ this.textures[ i ] = texture.clone();
3011
+ this.textures[ i ].isRenderTargetTexture = true;
3031
3012
 
3032
- this.texture.flipY = false;
3033
- this.texture.generateMipmaps = options.generateMipmaps;
3034
- this.texture.internalFormat = options.internalFormat;
3013
+ }
3035
3014
 
3036
3015
  this.depthBuffer = options.depthBuffer;
3037
3016
  this.stencilBuffer = options.stencilBuffer;
@@ -3042,6 +3021,18 @@
3042
3021
 
3043
3022
  }
3044
3023
 
3024
+ get texture() {
3025
+
3026
+ return this.textures[ 0 ];
3027
+
3028
+ }
3029
+
3030
+ set texture( value ) {
3031
+
3032
+ this.textures[ 0 ] = value;
3033
+
3034
+ }
3035
+
3045
3036
  setSize( width, height, depth = 1 ) {
3046
3037
 
3047
3038
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -3050,9 +3041,13 @@
3050
3041
  this.height = height;
3051
3042
  this.depth = depth;
3052
3043
 
3053
- this.texture.image.width = width;
3054
- this.texture.image.height = height;
3055
- this.texture.image.depth = depth;
3044
+ for ( let i = 0, il = this.textures.length; i < il; i ++ ) {
3045
+
3046
+ this.textures[ i ].image.width = width;
3047
+ this.textures[ i ].image.height = height;
3048
+ this.textures[ i ].image.depth = depth;
3049
+
3050
+ }
3056
3051
 
3057
3052
  this.dispose();
3058
3053
 
@@ -3080,8 +3075,14 @@
3080
3075
 
3081
3076
  this.viewport.copy( source.viewport );
3082
3077
 
3083
- this.texture = source.texture.clone();
3084
- this.texture.isRenderTargetTexture = true;
3078
+ this.textures.length = 0;
3079
+
3080
+ for ( let i = 0, il = source.textures.length; i < il; i ++ ) {
3081
+
3082
+ this.textures[ i ] = source.textures[ i ].clone();
3083
+ this.textures[ i ].isRenderTargetTexture = true;
3084
+
3085
+ }
3085
3086
 
3086
3087
  // ensure image object is not shared, see #20328
3087
3088
 
@@ -3764,23 +3765,24 @@
3764
3765
 
3765
3766
  random() {
3766
3767
 
3767
- // Derived from http://planning.cs.uiuc.edu/node198.html
3768
- // Note, this source uses w, x, y, z ordering,
3769
- // so we swap the order below.
3768
+ // sets this quaternion to a uniform random unit quaternnion
3770
3769
 
3771
- const u1 = Math.random();
3772
- const sqrt1u1 = Math.sqrt( 1 - u1 );
3773
- const sqrtu1 = Math.sqrt( u1 );
3770
+ // Ken Shoemake
3771
+ // Uniform random rotations
3772
+ // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
3774
3773
 
3775
- const u2 = 2 * Math.PI * Math.random();
3774
+ const theta1 = 2 * Math.PI * Math.random();
3775
+ const theta2 = 2 * Math.PI * Math.random();
3776
3776
 
3777
- const u3 = 2 * Math.PI * Math.random();
3777
+ const x0 = Math.random();
3778
+ const r1 = Math.sqrt( 1 - x0 );
3779
+ const r2 = Math.sqrt( x0 );
3778
3780
 
3779
3781
  return this.set(
3780
- sqrt1u1 * Math.cos( u2 ),
3781
- sqrtu1 * Math.sin( u3 ),
3782
- sqrtu1 * Math.cos( u3 ),
3783
- sqrt1u1 * Math.sin( u2 ),
3782
+ r1 * Math.sin( theta1 ),
3783
+ r1 * Math.cos( theta1 ),
3784
+ r2 * Math.sin( theta2 ),
3785
+ r2 * Math.cos( theta2 ),
3784
3786
  );
3785
3787
 
3786
3788
  }
@@ -4548,15 +4550,15 @@
4548
4550
 
4549
4551
  randomDirection() {
4550
4552
 
4551
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
4553
+ // https://mathworld.wolfram.com/SpherePointPicking.html
4552
4554
 
4553
- const u = ( Math.random() - 0.5 ) * 2;
4554
- const t = Math.random() * Math.PI * 2;
4555
- const f = Math.sqrt( 1 - u ** 2 );
4555
+ const theta = Math.random() * Math.PI * 2;
4556
+ const u = Math.random() * 2 - 1;
4557
+ const c = Math.sqrt( 1 - u * u );
4556
4558
 
4557
- this.x = f * Math.cos( t );
4558
- this.y = f * Math.sin( t );
4559
- this.z = u;
4559
+ this.x = c * Math.cos( theta );
4560
+ this.y = u;
4561
+ this.z = c * Math.sin( theta );
4560
4562
 
4561
4563
  return this;
4562
4564
 
@@ -6582,25 +6584,25 @@
6582
6584
  position.z = te[ 14 ];
6583
6585
 
6584
6586
  // scale the rotation part
6585
- _m1$2.copy( this );
6587
+ _m1$4.copy( this );
6586
6588
 
6587
6589
  const invSX = 1 / sx;
6588
6590
  const invSY = 1 / sy;
6589
6591
  const invSZ = 1 / sz;
6590
6592
 
6591
- _m1$2.elements[ 0 ] *= invSX;
6592
- _m1$2.elements[ 1 ] *= invSX;
6593
- _m1$2.elements[ 2 ] *= invSX;
6593
+ _m1$4.elements[ 0 ] *= invSX;
6594
+ _m1$4.elements[ 1 ] *= invSX;
6595
+ _m1$4.elements[ 2 ] *= invSX;
6594
6596
 
6595
- _m1$2.elements[ 4 ] *= invSY;
6596
- _m1$2.elements[ 5 ] *= invSY;
6597
- _m1$2.elements[ 6 ] *= invSY;
6597
+ _m1$4.elements[ 4 ] *= invSY;
6598
+ _m1$4.elements[ 5 ] *= invSY;
6599
+ _m1$4.elements[ 6 ] *= invSY;
6598
6600
 
6599
- _m1$2.elements[ 8 ] *= invSZ;
6600
- _m1$2.elements[ 9 ] *= invSZ;
6601
- _m1$2.elements[ 10 ] *= invSZ;
6601
+ _m1$4.elements[ 8 ] *= invSZ;
6602
+ _m1$4.elements[ 9 ] *= invSZ;
6603
+ _m1$4.elements[ 10 ] *= invSZ;
6602
6604
 
6603
- quaternion.setFromRotationMatrix( _m1$2 );
6605
+ quaternion.setFromRotationMatrix( _m1$4 );
6604
6606
 
6605
6607
  scale.x = sx;
6606
6608
  scale.y = sy;
@@ -6741,14 +6743,14 @@
6741
6743
  }
6742
6744
 
6743
6745
  const _v1$5 = /*@__PURE__*/ new Vector3();
6744
- const _m1$2 = /*@__PURE__*/ new Matrix4();
6746
+ const _m1$4 = /*@__PURE__*/ new Matrix4();
6745
6747
  const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
6746
6748
  const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
6747
6749
  const _x = /*@__PURE__*/ new Vector3();
6748
6750
  const _y = /*@__PURE__*/ new Vector3();
6749
6751
  const _z = /*@__PURE__*/ new Vector3();
6750
6752
 
6751
- const _matrix$1 = /*@__PURE__*/ new Matrix4();
6753
+ const _matrix$2 = /*@__PURE__*/ new Matrix4();
6752
6754
  const _quaternion$3 = /*@__PURE__*/ new Quaternion();
6753
6755
 
6754
6756
  class Euler {
@@ -6983,9 +6985,9 @@
6983
6985
 
6984
6986
  setFromQuaternion( q, order, update ) {
6985
6987
 
6986
- _matrix$1.makeRotationFromQuaternion( q );
6988
+ _matrix$2.makeRotationFromQuaternion( q );
6987
6989
 
6988
- return this.setFromRotationMatrix( _matrix$1, order, update );
6990
+ return this.setFromRotationMatrix( _matrix$2, order, update );
6989
6991
 
6990
6992
  }
6991
6993
 
@@ -7120,7 +7122,7 @@
7120
7122
 
7121
7123
  const _v1$4 = /*@__PURE__*/ new Vector3();
7122
7124
  const _q1 = /*@__PURE__*/ new Quaternion();
7123
- const _m1$1 = /*@__PURE__*/ new Matrix4();
7125
+ const _m1$3 = /*@__PURE__*/ new Matrix4();
7124
7126
  const _target = /*@__PURE__*/ new Vector3();
7125
7127
 
7126
7128
  const _position$3 = /*@__PURE__*/ new Vector3();
@@ -7134,6 +7136,9 @@
7134
7136
  const _addedEvent = { type: 'added' };
7135
7137
  const _removedEvent = { type: 'removed' };
7136
7138
 
7139
+ const _childaddedEvent = { type: 'childadded', child: null };
7140
+ const _childremovedEvent = { type: 'childremoved', child: null };
7141
+
7137
7142
  class Object3D extends EventDispatcher {
7138
7143
 
7139
7144
  constructor() {
@@ -7370,7 +7375,7 @@
7370
7375
 
7371
7376
  this.updateWorldMatrix( true, false );
7372
7377
 
7373
- return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );
7378
+ return vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );
7374
7379
 
7375
7380
  }
7376
7381
 
@@ -7396,20 +7401,20 @@
7396
7401
 
7397
7402
  if ( this.isCamera || this.isLight ) {
7398
7403
 
7399
- _m1$1.lookAt( _position$3, _target, this.up );
7404
+ _m1$3.lookAt( _position$3, _target, this.up );
7400
7405
 
7401
7406
  } else {
7402
7407
 
7403
- _m1$1.lookAt( _target, _position$3, this.up );
7408
+ _m1$3.lookAt( _target, _position$3, this.up );
7404
7409
 
7405
7410
  }
7406
7411
 
7407
- this.quaternion.setFromRotationMatrix( _m1$1 );
7412
+ this.quaternion.setFromRotationMatrix( _m1$3 );
7408
7413
 
7409
7414
  if ( parent ) {
7410
7415
 
7411
- _m1$1.extractRotation( parent.matrixWorld );
7412
- _q1.setFromRotationMatrix( _m1$1 );
7416
+ _m1$3.extractRotation( parent.matrixWorld );
7417
+ _q1.setFromRotationMatrix( _m1$3 );
7413
7418
  this.quaternion.premultiply( _q1.invert() );
7414
7419
 
7415
7420
  }
@@ -7439,17 +7444,16 @@
7439
7444
 
7440
7445
  if ( object && object.isObject3D ) {
7441
7446
 
7442
- if ( object.parent !== null ) {
7443
-
7444
- object.parent.remove( object );
7445
-
7446
- }
7447
-
7447
+ object.removeFromParent();
7448
7448
  object.parent = this;
7449
7449
  this.children.push( object );
7450
7450
 
7451
7451
  object.dispatchEvent( _addedEvent );
7452
7452
 
7453
+ _childaddedEvent.child = object;
7454
+ this.dispatchEvent( _childaddedEvent );
7455
+ _childaddedEvent.child = null;
7456
+
7453
7457
  } else {
7454
7458
 
7455
7459
  console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );
@@ -7483,6 +7487,10 @@
7483
7487
 
7484
7488
  object.dispatchEvent( _removedEvent );
7485
7489
 
7490
+ _childremovedEvent.child = object;
7491
+ this.dispatchEvent( _childremovedEvent );
7492
+ _childremovedEvent.child = null;
7493
+
7486
7494
  }
7487
7495
 
7488
7496
  return this;
@@ -7517,22 +7525,30 @@
7517
7525
 
7518
7526
  this.updateWorldMatrix( true, false );
7519
7527
 
7520
- _m1$1.copy( this.matrixWorld ).invert();
7528
+ _m1$3.copy( this.matrixWorld ).invert();
7521
7529
 
7522
7530
  if ( object.parent !== null ) {
7523
7531
 
7524
7532
  object.parent.updateWorldMatrix( true, false );
7525
7533
 
7526
- _m1$1.multiply( object.parent.matrixWorld );
7534
+ _m1$3.multiply( object.parent.matrixWorld );
7527
7535
 
7528
7536
  }
7529
7537
 
7530
- object.applyMatrix4( _m1$1 );
7538
+ object.applyMatrix4( _m1$3 );
7531
7539
 
7532
- this.add( object );
7540
+ object.removeFromParent();
7541
+ object.parent = this;
7542
+ this.children.push( object );
7533
7543
 
7534
7544
  object.updateWorldMatrix( false, true );
7535
7545
 
7546
+ object.dispatchEvent( _addedEvent );
7547
+
7548
+ _childaddedEvent.child = object;
7549
+ this.dispatchEvent( _childaddedEvent );
7550
+ _childaddedEvent.child = null;
7551
+
7536
7552
  return this;
7537
7553
 
7538
7554
  }
@@ -9227,7 +9243,7 @@
9227
9243
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
9228
9244
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
9229
9245
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
9230
- if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9246
+ if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9231
9247
 
9232
9248
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
9233
9249
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -9337,6 +9353,7 @@
9337
9353
 
9338
9354
  }
9339
9355
 
9356
+ if ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();
9340
9357
  if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
9341
9358
  if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
9342
9359
  if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
@@ -9581,6 +9598,7 @@
9581
9598
  this.alphaMap = null;
9582
9599
 
9583
9600
  this.envMap = null;
9601
+ this.envMapRotation = new Euler();
9584
9602
  this.combine = MultiplyOperation;
9585
9603
  this.reflectivity = 1;
9586
9604
  this.refractionRatio = 0.98;
@@ -9615,6 +9633,7 @@
9615
9633
  this.alphaMap = source.alphaMap;
9616
9634
 
9617
9635
  this.envMap = source.envMap;
9636
+ this.envMapRotation.copy( source.envMapRotation );
9618
9637
  this.combine = source.combine;
9619
9638
  this.reflectivity = source.reflectivity;
9620
9639
  this.refractionRatio = source.refractionRatio;
@@ -10048,7 +10067,7 @@
10048
10067
 
10049
10068
  let _id$2 = 0;
10050
10069
 
10051
- const _m1 = /*@__PURE__*/ new Matrix4();
10070
+ const _m1$2 = /*@__PURE__*/ new Matrix4();
10052
10071
  const _obj = /*@__PURE__*/ new Object3D();
10053
10072
  const _offset = /*@__PURE__*/ new Vector3();
10054
10073
  const _box$2 = /*@__PURE__*/ new Box3();
@@ -10214,9 +10233,9 @@
10214
10233
 
10215
10234
  applyQuaternion( q ) {
10216
10235
 
10217
- _m1.makeRotationFromQuaternion( q );
10236
+ _m1$2.makeRotationFromQuaternion( q );
10218
10237
 
10219
- this.applyMatrix4( _m1 );
10238
+ this.applyMatrix4( _m1$2 );
10220
10239
 
10221
10240
  return this;
10222
10241
 
@@ -10226,9 +10245,9 @@
10226
10245
 
10227
10246
  // rotate geometry around world x-axis
10228
10247
 
10229
- _m1.makeRotationX( angle );
10248
+ _m1$2.makeRotationX( angle );
10230
10249
 
10231
- this.applyMatrix4( _m1 );
10250
+ this.applyMatrix4( _m1$2 );
10232
10251
 
10233
10252
  return this;
10234
10253
 
@@ -10238,9 +10257,9 @@
10238
10257
 
10239
10258
  // rotate geometry around world y-axis
10240
10259
 
10241
- _m1.makeRotationY( angle );
10260
+ _m1$2.makeRotationY( angle );
10242
10261
 
10243
- this.applyMatrix4( _m1 );
10262
+ this.applyMatrix4( _m1$2 );
10244
10263
 
10245
10264
  return this;
10246
10265
 
@@ -10250,9 +10269,9 @@
10250
10269
 
10251
10270
  // rotate geometry around world z-axis
10252
10271
 
10253
- _m1.makeRotationZ( angle );
10272
+ _m1$2.makeRotationZ( angle );
10254
10273
 
10255
- this.applyMatrix4( _m1 );
10274
+ this.applyMatrix4( _m1$2 );
10256
10275
 
10257
10276
  return this;
10258
10277
 
@@ -10262,9 +10281,9 @@
10262
10281
 
10263
10282
  // translate geometry
10264
10283
 
10265
- _m1.makeTranslation( x, y, z );
10284
+ _m1$2.makeTranslation( x, y, z );
10266
10285
 
10267
- this.applyMatrix4( _m1 );
10286
+ this.applyMatrix4( _m1$2 );
10268
10287
 
10269
10288
  return this;
10270
10289
 
@@ -10274,9 +10293,9 @@
10274
10293
 
10275
10294
  // scale geometry
10276
10295
 
10277
- _m1.makeScale( x, y, z );
10296
+ _m1$2.makeScale( x, y, z );
10278
10297
 
10279
- this.applyMatrix4( _m1 );
10298
+ this.applyMatrix4( _m1$2 );
10280
10299
 
10281
10300
  return this;
10282
10301
 
@@ -10336,7 +10355,7 @@
10336
10355
 
10337
10356
  if ( position && position.isGLBufferAttribute ) {
10338
10357
 
10339
- console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
10358
+ console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
10340
10359
 
10341
10360
  this.boundingBox.set(
10342
10361
  new Vector3( - Infinity, - Infinity, - Infinity ),
@@ -10406,7 +10425,7 @@
10406
10425
 
10407
10426
  if ( position && position.isGLBufferAttribute ) {
10408
10427
 
10409
- console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
10428
+ console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
10410
10429
 
10411
10430
  this.boundingSphere.set( new Vector3(), Infinity );
10412
10431
 
@@ -10523,24 +10542,21 @@
10523
10542
 
10524
10543
  }
10525
10544
 
10526
- const indices = index.array;
10527
- const positions = attributes.position.array;
10528
- const normals = attributes.normal.array;
10529
- const uvs = attributes.uv.array;
10530
-
10531
- const nVertices = positions.length / 3;
10545
+ const positionAttribute = attributes.position;
10546
+ const normalAttribute = attributes.normal;
10547
+ const uvAttribute = attributes.uv;
10532
10548
 
10533
10549
  if ( this.hasAttribute( 'tangent' ) === false ) {
10534
10550
 
10535
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
10551
+ this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
10536
10552
 
10537
10553
  }
10538
10554
 
10539
- const tangents = this.getAttribute( 'tangent' ).array;
10555
+ const tangentAttribute = this.getAttribute( 'tangent' );
10540
10556
 
10541
10557
  const tan1 = [], tan2 = [];
10542
10558
 
10543
- for ( let i = 0; i < nVertices; i ++ ) {
10559
+ for ( let i = 0; i < positionAttribute.count; i ++ ) {
10544
10560
 
10545
10561
  tan1[ i ] = new Vector3();
10546
10562
  tan2[ i ] = new Vector3();
@@ -10560,13 +10576,13 @@
10560
10576
 
10561
10577
  function handleTriangle( a, b, c ) {
10562
10578
 
10563
- vA.fromArray( positions, a * 3 );
10564
- vB.fromArray( positions, b * 3 );
10565
- vC.fromArray( positions, c * 3 );
10579
+ vA.fromBufferAttribute( positionAttribute, a );
10580
+ vB.fromBufferAttribute( positionAttribute, b );
10581
+ vC.fromBufferAttribute( positionAttribute, c );
10566
10582
 
10567
- uvA.fromArray( uvs, a * 2 );
10568
- uvB.fromArray( uvs, b * 2 );
10569
- uvC.fromArray( uvs, c * 2 );
10583
+ uvA.fromBufferAttribute( uvAttribute, a );
10584
+ uvB.fromBufferAttribute( uvAttribute, b );
10585
+ uvC.fromBufferAttribute( uvAttribute, c );
10570
10586
 
10571
10587
  vB.sub( vA );
10572
10588
  vC.sub( vA );
@@ -10599,7 +10615,7 @@
10599
10615
 
10600
10616
  groups = [ {
10601
10617
  start: 0,
10602
- count: indices.length
10618
+ count: index.count
10603
10619
  } ];
10604
10620
 
10605
10621
  }
@@ -10614,9 +10630,9 @@
10614
10630
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
10615
10631
 
10616
10632
  handleTriangle(
10617
- indices[ j + 0 ],
10618
- indices[ j + 1 ],
10619
- indices[ j + 2 ]
10633
+ index.getX( j + 0 ),
10634
+ index.getX( j + 1 ),
10635
+ index.getX( j + 2 )
10620
10636
  );
10621
10637
 
10622
10638
  }
@@ -10628,7 +10644,7 @@
10628
10644
 
10629
10645
  function handleVertex( v ) {
10630
10646
 
10631
- n.fromArray( normals, v * 3 );
10647
+ n.fromBufferAttribute( normalAttribute, v );
10632
10648
  n2.copy( n );
10633
10649
 
10634
10650
  const t = tan1[ v ];
@@ -10644,10 +10660,7 @@
10644
10660
  const test = tmp2.dot( tan2[ v ] );
10645
10661
  const w = ( test < 0.0 ) ? - 1.0 : 1.0;
10646
10662
 
10647
- tangents[ v * 4 ] = tmp.x;
10648
- tangents[ v * 4 + 1 ] = tmp.y;
10649
- tangents[ v * 4 + 2 ] = tmp.z;
10650
- tangents[ v * 4 + 3 ] = w;
10663
+ tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
10651
10664
 
10652
10665
  }
10653
10666
 
@@ -10660,9 +10673,9 @@
10660
10673
 
10661
10674
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
10662
10675
 
10663
- handleVertex( indices[ j + 0 ] );
10664
- handleVertex( indices[ j + 1 ] );
10665
- handleVertex( indices[ j + 2 ] );
10676
+ handleVertex( index.getX( j + 0 ) );
10677
+ handleVertex( index.getX( j + 1 ) );
10678
+ handleVertex( index.getX( j + 2 ) );
10666
10679
 
10667
10680
  }
10668
10681
 
@@ -11491,7 +11504,6 @@
11491
11504
  _uvC$1.fromBufferAttribute( uv1, c );
11492
11505
 
11493
11506
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
11494
- intersection.uv2 = intersection.uv1; // @deprecated, r152
11495
11507
 
11496
11508
  }
11497
11509
 
@@ -11790,13 +11802,22 @@
11790
11802
 
11791
11803
  function getUnlitUniformColorSpace( renderer ) {
11792
11804
 
11793
- if ( renderer.getRenderTarget() === null ) {
11805
+ const currentRenderTarget = renderer.getRenderTarget();
11806
+
11807
+ if ( currentRenderTarget === null ) {
11794
11808
 
11795
11809
  // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
11796
11810
  return renderer.outputColorSpace;
11797
11811
 
11798
11812
  }
11799
11813
 
11814
+ // https://github.com/mrdoob/three.js/issues/27868
11815
+ if ( currentRenderTarget.isXRRenderTarget === true ) {
11816
+
11817
+ return currentRenderTarget.texture.colorSpace;
11818
+
11819
+ }
11820
+
11800
11821
  return ColorManagement.workingColorSpace;
11801
11822
 
11802
11823
  }
@@ -11838,10 +11859,6 @@
11838
11859
  this.forceSinglePass = true;
11839
11860
 
11840
11861
  this.extensions = {
11841
- derivatives: false, // set to use derivatives
11842
- fragDepth: false, // set to use fragment depth values
11843
- drawBuffers: false, // set to use draw buffers
11844
- shaderTextureLOD: false, // set to use shader texture LOD
11845
11862
  clipCullDistance: false, // set to use vertex shader clipping
11846
11863
  multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
11847
11864
  };
@@ -12525,14 +12542,6 @@
12525
12542
  const image = { width: size, height: size, depth: 1 };
12526
12543
  const images = [ image, image, image, image, image, image ];
12527
12544
 
12528
- if ( options.encoding !== undefined ) {
12529
-
12530
- // @deprecated, r152
12531
- warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
12532
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
12533
-
12534
- }
12535
-
12536
12545
  this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
12537
12546
 
12538
12547
  // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
@@ -13090,9 +13099,7 @@
13090
13099
 
13091
13100
  }
13092
13101
 
13093
- function WebGLAttributes( gl, capabilities ) {
13094
-
13095
- const isWebGL2 = capabilities.isWebGL2;
13102
+ function WebGLAttributes( gl ) {
13096
13103
 
13097
13104
  const buffers = new WeakMap();
13098
13105
 
@@ -13119,15 +13126,7 @@
13119
13126
 
13120
13127
  if ( attribute.isFloat16BufferAttribute ) {
13121
13128
 
13122
- if ( isWebGL2 ) {
13123
-
13124
- type = gl.HALF_FLOAT;
13125
-
13126
- } else {
13127
-
13128
- throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
13129
-
13130
- }
13129
+ type = gl.HALF_FLOAT;
13131
13130
 
13132
13131
  } else {
13133
13132
 
@@ -13195,17 +13194,9 @@
13195
13194
  for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
13196
13195
 
13197
13196
  const range = updateRanges[ i ];
13198
- if ( isWebGL2 ) {
13199
-
13200
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13201
- array, range.start, range.count );
13202
13197
 
13203
- } else {
13204
-
13205
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13206
- array.subarray( range.start, range.start + range.count ) );
13207
-
13208
- }
13198
+ gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13199
+ array, range.start, range.count );
13209
13200
 
13210
13201
  }
13211
13202
 
@@ -13216,17 +13207,8 @@
13216
13207
  // @deprecated, r159
13217
13208
  if ( updateRange.count !== - 1 ) {
13218
13209
 
13219
- if ( isWebGL2 ) {
13220
-
13221
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13222
- array, updateRange.offset, updateRange.count );
13223
-
13224
- } else {
13225
-
13226
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13227
- array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
13228
-
13229
- }
13210
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13211
+ array, updateRange.offset, updateRange.count );
13230
13212
 
13231
13213
  updateRange.count = - 1; // reset range
13232
13214
 
@@ -13475,9 +13457,9 @@
13475
13457
 
13476
13458
  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}";
13477
13459
 
13478
- 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";
13460
+ 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";
13479
13461
 
13480
- 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";
13462
+ 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";
13481
13463
 
13482
13464
  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";
13483
13465
 
@@ -13505,7 +13487,7 @@
13505
13487
 
13506
13488
  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";
13507
13489
 
13508
- 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";
13490
+ 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";
13509
13491
 
13510
13492
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13511
13493
 
@@ -13525,13 +13507,13 @@
13525
13507
 
13526
13508
  var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
13527
13509
 
13528
- var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13510
+ var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13529
13511
 
13530
- var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13512
+ var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13531
13513
 
13532
- var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif";
13514
+ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13533
13515
 
13534
- var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13516
+ var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
13535
13517
 
13536
13518
  var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13537
13519
 
@@ -13545,11 +13527,13 @@
13545
13527
 
13546
13528
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
13547
13529
 
13530
+ 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";
13531
+
13548
13532
  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";
13549
13533
 
13550
13534
  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";
13551
13535
 
13552
- 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";
13536
+ 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";
13553
13537
 
13554
13538
  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";
13555
13539
 
@@ -13589,7 +13573,7 @@
13589
13573
 
13590
13574
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
13591
13575
 
13592
- var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
13576
+ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif";
13593
13577
 
13594
13578
  var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
13595
13579
 
@@ -13611,7 +13595,7 @@
13611
13595
 
13612
13596
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13613
13597
 
13614
- 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; }";
13598
+ 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, newPeak * vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13615
13599
 
13616
13600
  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";
13617
13601
 
@@ -13631,17 +13615,17 @@
13631
13615
 
13632
13616
  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}";
13633
13617
 
13634
- 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}";
13618
+ 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}";
13635
13619
 
13636
13620
  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}";
13637
13621
 
13638
13622
  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}";
13639
13623
 
13640
- 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}";
13624
+ 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}";
13641
13625
 
13642
13626
  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}";
13643
13627
 
13644
- 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}";
13628
+ 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}";
13645
13629
 
13646
13630
  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}";
13647
13631
 
@@ -13649,43 +13633,43 @@
13649
13633
 
13650
13634
  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}";
13651
13635
 
13652
- 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}";
13636
+ 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}";
13653
13637
 
13654
13638
  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}";
13655
13639
 
13656
- 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}";
13640
+ 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}";
13657
13641
 
13658
13642
  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}";
13659
13643
 
13660
- 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}";
13644
+ 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}";
13661
13645
 
13662
13646
  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}";
13663
13647
 
13664
- 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}";
13648
+ 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}";
13665
13649
 
13666
13650
  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}";
13667
13651
 
13668
- 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}";
13652
+ 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}";
13669
13653
 
13670
13654
  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}";
13671
13655
 
13672
- 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}";
13656
+ 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}";
13673
13657
 
13674
13658
  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}";
13675
13659
 
13676
- 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}";
13660
+ 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}";
13677
13661
 
13678
13662
  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}";
13679
13663
 
13680
- 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}";
13664
+ 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}";
13681
13665
 
13682
13666
  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}";
13683
13667
 
13684
- 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}";
13668
+ 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}";
13685
13669
 
13686
13670
  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}";
13687
13671
 
13688
- 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}";
13672
+ 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}";
13689
13673
 
13690
13674
  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}";
13691
13675
 
@@ -13761,6 +13745,7 @@
13761
13745
  map_particle_pars_fragment: map_particle_pars_fragment,
13762
13746
  metalnessmap_fragment: metalnessmap_fragment,
13763
13747
  metalnessmap_pars_fragment: metalnessmap_pars_fragment,
13748
+ morphinstance_vertex: morphinstance_vertex,
13764
13749
  morphcolor_vertex: morphcolor_vertex,
13765
13750
  morphnormal_vertex: morphnormal_vertex,
13766
13751
  morphtarget_pars_vertex: morphtarget_pars_vertex,
@@ -13869,6 +13854,7 @@
13869
13854
  envmap: {
13870
13855
 
13871
13856
  envMap: { value: null },
13857
+ envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
13872
13858
  flipEnvMap: { value: - 1 },
13873
13859
  reflectivity: { value: 1.0 }, // basic, lambert, phong
13874
13860
  ior: { value: 1.5 }, // physical
@@ -14150,7 +14136,7 @@
14150
14136
  emissive: { value: /*@__PURE__*/ new Color$1( 0x000000 ) },
14151
14137
  roughness: { value: 1.0 },
14152
14138
  metalness: { value: 0.0 },
14153
- envMapIntensity: { value: 1 } // temporary
14139
+ envMapIntensity: { value: 1 }
14154
14140
  }
14155
14141
  ] ),
14156
14142
 
@@ -14289,7 +14275,8 @@
14289
14275
  envMap: { value: null },
14290
14276
  flipEnvMap: { value: - 1 },
14291
14277
  backgroundBlurriness: { value: 0 },
14292
- backgroundIntensity: { value: 1 }
14278
+ backgroundIntensity: { value: 1 },
14279
+ backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
14293
14280
  },
14294
14281
 
14295
14282
  vertexShader: ShaderChunk.backgroundCube_vert,
@@ -14413,6 +14400,8 @@
14413
14400
  };
14414
14401
 
14415
14402
  const _rgb = { r: 0, b: 0, g: 0 };
14403
+ const _e1$1 = /*@__PURE__*/ new Euler();
14404
+ const _m1$1 = /*@__PURE__*/ new Matrix4();
14416
14405
 
14417
14406
  function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
14418
14407
 
@@ -14509,10 +14498,24 @@
14509
14498
 
14510
14499
  }
14511
14500
 
14501
+ _e1$1.copy( scene.backgroundRotation );
14502
+
14503
+ // accommodate left-handed frame
14504
+ _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
14505
+
14506
+ if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
14507
+
14508
+ // environment maps which are not cube render targets or PMREMs follow a different convention
14509
+ _e1$1.y *= - 1;
14510
+ _e1$1.z *= - 1;
14511
+
14512
+ }
14513
+
14512
14514
  boxMesh.material.uniforms.envMap.value = background;
14513
14515
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14514
14516
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14515
14517
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14518
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
14516
14519
  boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14517
14520
 
14518
14521
  if ( currentBackground !== background ||
@@ -14639,13 +14642,10 @@
14639
14642
 
14640
14643
  }
14641
14644
 
14642
- function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
14645
+ function WebGLBindingStates( gl, attributes ) {
14643
14646
 
14644
14647
  const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
14645
14648
 
14646
- const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
14647
- const vaoAvailable = capabilities.isWebGL2 || extension !== null;
14648
-
14649
14649
  const bindingStates = {};
14650
14650
 
14651
14651
  const defaultState = createBindingState( null );
@@ -14656,38 +14656,18 @@
14656
14656
 
14657
14657
  let updateBuffers = false;
14658
14658
 
14659
- if ( vaoAvailable ) {
14659
+ const state = getBindingState( geometry, program, material );
14660
14660
 
14661
- const state = getBindingState( geometry, program, material );
14661
+ if ( currentState !== state ) {
14662
14662
 
14663
- if ( currentState !== state ) {
14663
+ currentState = state;
14664
+ bindVertexArrayObject( currentState.object );
14664
14665
 
14665
- currentState = state;
14666
- bindVertexArrayObject( currentState.object );
14667
-
14668
- }
14669
-
14670
- updateBuffers = needsUpdate( object, geometry, program, index );
14671
-
14672
- if ( updateBuffers ) saveCache( object, geometry, program, index );
14673
-
14674
- } else {
14675
-
14676
- const wireframe = ( material.wireframe === true );
14677
-
14678
- if ( currentState.geometry !== geometry.id ||
14679
- currentState.program !== program.id ||
14680
- currentState.wireframe !== wireframe ) {
14681
-
14682
- currentState.geometry = geometry.id;
14683
- currentState.program = program.id;
14684
- currentState.wireframe = wireframe;
14685
-
14686
- updateBuffers = true;
14666
+ }
14687
14667
 
14688
- }
14668
+ updateBuffers = needsUpdate( object, geometry, program, index );
14689
14669
 
14690
- }
14670
+ if ( updateBuffers ) saveCache( object, geometry, program, index );
14691
14671
 
14692
14672
  if ( index !== null ) {
14693
14673
 
@@ -14713,25 +14693,19 @@
14713
14693
 
14714
14694
  function createVertexArrayObject() {
14715
14695
 
14716
- if ( capabilities.isWebGL2 ) return gl.createVertexArray();
14717
-
14718
- return extension.createVertexArrayOES();
14696
+ return gl.createVertexArray();
14719
14697
 
14720
14698
  }
14721
14699
 
14722
14700
  function bindVertexArrayObject( vao ) {
14723
14701
 
14724
- if ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );
14725
-
14726
- return extension.bindVertexArrayOES( vao );
14702
+ return gl.bindVertexArray( vao );
14727
14703
 
14728
14704
  }
14729
14705
 
14730
14706
  function deleteVertexArrayObject( vao ) {
14731
14707
 
14732
- if ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );
14733
-
14734
- return extension.deleteVertexArrayOES( vao );
14708
+ return gl.deleteVertexArray( vao );
14735
14709
 
14736
14710
  }
14737
14711
 
@@ -14929,9 +14903,7 @@
14929
14903
 
14930
14904
  if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
14931
14905
 
14932
- const extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );
14933
-
14934
- extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );
14906
+ gl.vertexAttribDivisor( attribute, meshPerAttribute );
14935
14907
  attributeDivisors[ attribute ] = meshPerAttribute;
14936
14908
 
14937
14909
  }
@@ -14972,12 +14944,6 @@
14972
14944
 
14973
14945
  function setupVertexAttributes( object, material, program, geometry ) {
14974
14946
 
14975
- if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
14976
-
14977
- if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
14978
-
14979
- }
14980
-
14981
14947
  initAttributes();
14982
14948
 
14983
14949
  const geometryAttributes = geometry.attributes;
@@ -15016,9 +14982,9 @@
15016
14982
  const type = attribute.type;
15017
14983
  const bytesPerElement = attribute.bytesPerElement;
15018
14984
 
15019
- // check for integer attributes (WebGL 2 only)
14985
+ // check for integer attributes
15020
14986
 
15021
- const integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );
14987
+ const integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );
15022
14988
 
15023
14989
  if ( geometryAttribute.isInterleavedBufferAttribute ) {
15024
14990
 
@@ -15266,9 +15232,7 @@
15266
15232
 
15267
15233
  }
15268
15234
 
15269
- function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15270
-
15271
- const isWebGL2 = capabilities.isWebGL2;
15235
+ function WebGLBufferRenderer( gl, extensions, info ) {
15272
15236
 
15273
15237
  let mode;
15274
15238
 
@@ -15290,28 +15254,7 @@
15290
15254
 
15291
15255
  if ( primcount === 0 ) return;
15292
15256
 
15293
- let extension, methodName;
15294
-
15295
- if ( isWebGL2 ) {
15296
-
15297
- extension = gl;
15298
- methodName = 'drawArraysInstanced';
15299
-
15300
- } else {
15301
-
15302
- extension = extensions.get( 'ANGLE_instanced_arrays' );
15303
- methodName = 'drawArraysInstancedANGLE';
15304
-
15305
- if ( extension === null ) {
15306
-
15307
- console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
15308
- return;
15309
-
15310
- }
15311
-
15312
- }
15313
-
15314
- extension[ methodName ]( mode, start, count, primcount );
15257
+ gl.drawArraysInstanced( mode, start, count, primcount );
15315
15258
 
15316
15259
  info.update( count, mode, primcount );
15317
15260
 
@@ -15322,6 +15265,7 @@
15322
15265
  if ( drawCount === 0 ) return;
15323
15266
 
15324
15267
  const extension = extensions.get( 'WEBGL_multi_draw' );
15268
+
15325
15269
  if ( extension === null ) {
15326
15270
 
15327
15271
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -15410,8 +15354,6 @@
15410
15354
 
15411
15355
  }
15412
15356
 
15413
- const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
15414
-
15415
15357
  let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
15416
15358
  const maxPrecision = getMaxPrecision( precision );
15417
15359
 
@@ -15422,8 +15364,6 @@
15422
15364
 
15423
15365
  }
15424
15366
 
15425
- const drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );
15426
-
15427
15367
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
15428
15368
 
15429
15369
  const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
@@ -15437,16 +15377,12 @@
15437
15377
  const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
15438
15378
 
15439
15379
  const vertexTextures = maxVertexTextures > 0;
15440
- const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
15441
- const floatVertexTextures = vertexTextures && floatFragmentTextures;
15442
15380
 
15443
- const maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
15381
+ const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
15444
15382
 
15445
15383
  return {
15446
15384
 
15447
- isWebGL2: isWebGL2,
15448
-
15449
- drawBuffers: drawBuffers,
15385
+ isWebGL2: true, // keeping this for backwards compatibility
15450
15386
 
15451
15387
  getMaxAnisotropy: getMaxAnisotropy,
15452
15388
  getMaxPrecision: getMaxPrecision,
@@ -15465,8 +15401,6 @@
15465
15401
  maxFragmentUniforms: maxFragmentUniforms,
15466
15402
 
15467
15403
  vertexTextures: vertexTextures,
15468
- floatFragmentTextures: floatFragmentTextures,
15469
- floatVertexTextures: floatVertexTextures,
15470
15404
 
15471
15405
  maxSamples: maxSamples
15472
15406
 
@@ -15885,6 +15819,7 @@
15885
15819
  let _oldTarget = null;
15886
15820
  let _oldActiveCubeFace = 0;
15887
15821
  let _oldActiveMipmapLevel = 0;
15822
+ let _oldXrEnabled = false;
15888
15823
 
15889
15824
  // Golden Ratio
15890
15825
  const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
@@ -15952,6 +15887,9 @@
15952
15887
  _oldTarget = this._renderer.getRenderTarget();
15953
15888
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
15954
15889
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
15890
+ _oldXrEnabled = this._renderer.xr.enabled;
15891
+
15892
+ this._renderer.xr.enabled = false;
15955
15893
 
15956
15894
  this._setSize( 256 );
15957
15895
 
@@ -15977,6 +15915,7 @@
15977
15915
  * Generates a PMREM from an equirectangular texture, which can be either LDR
15978
15916
  * or HDR. The ideal input image size is 1k (1024 x 512),
15979
15917
  * as this matches best with the 256 x 256 cubemap output.
15918
+ * The smallest supported equirectangular image size is 64 x 32.
15980
15919
  */
15981
15920
  fromEquirectangular( equirectangular, renderTarget = null ) {
15982
15921
 
@@ -15988,6 +15927,7 @@
15988
15927
  * Generates a PMREM from an cubemap texture, which can be either LDR
15989
15928
  * or HDR. The ideal input cube size is 256 x 256,
15990
15929
  * as this matches best with the 256 x 256 cubemap output.
15930
+ * The smallest supported cube size is 16 x 16.
15991
15931
  */
15992
15932
  fromCubemap( cubemap, renderTarget = null ) {
15993
15933
 
@@ -16065,6 +16005,8 @@
16065
16005
  _cleanup( outputTarget ) {
16066
16006
 
16067
16007
  this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
16008
+ this._renderer.xr.enabled = _oldXrEnabled;
16009
+
16068
16010
  outputTarget.scissorTest = false;
16069
16011
  _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
16070
16012
 
@@ -16085,6 +16027,9 @@
16085
16027
  _oldTarget = this._renderer.getRenderTarget();
16086
16028
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
16087
16029
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
16030
+ _oldXrEnabled = this._renderer.xr.enabled;
16031
+
16032
+ this._renderer.xr.enabled = false;
16088
16033
 
16089
16034
  const cubeUVRenderTarget = renderTarget || this._allocateTargets();
16090
16035
  this._textureToCubeUV( texture, cubeUVRenderTarget );
@@ -16767,24 +16712,26 @@
16767
16712
 
16768
16713
  if ( isEquirectMap || isCubeMap ) {
16769
16714
 
16770
- if ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {
16715
+ let renderTarget = cubeUVmaps.get( texture );
16771
16716
 
16772
- texture.needsPMREMUpdate = false;
16717
+ const currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;
16773
16718
 
16774
- let renderTarget = cubeUVmaps.get( texture );
16719
+ if ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {
16775
16720
 
16776
16721
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
16777
16722
 
16778
16723
  renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );
16724
+ renderTarget.texture.pmremVersion = texture.pmremVersion;
16725
+
16779
16726
  cubeUVmaps.set( texture, renderTarget );
16780
16727
 
16781
16728
  return renderTarget.texture;
16782
16729
 
16783
16730
  } else {
16784
16731
 
16785
- if ( cubeUVmaps.has( texture ) ) {
16732
+ if ( renderTarget !== undefined ) {
16786
16733
 
16787
- return cubeUVmaps.get( texture ).texture;
16734
+ return renderTarget.texture;
16788
16735
 
16789
16736
  } else {
16790
16737
 
@@ -16794,7 +16741,9 @@
16794
16741
 
16795
16742
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
16796
16743
 
16797
- const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
16744
+ renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
16745
+ renderTarget.texture.pmremVersion = texture.pmremVersion;
16746
+
16798
16747
  cubeUVmaps.set( texture, renderTarget );
16799
16748
 
16800
16749
  texture.addEventListener( 'dispose', onTextureDispose );
@@ -16925,29 +16874,14 @@
16925
16874
 
16926
16875
  },
16927
16876
 
16928
- init: function ( capabilities ) {
16929
-
16930
- if ( capabilities.isWebGL2 ) {
16931
-
16932
- getExtension( 'EXT_color_buffer_float' );
16933
- getExtension( 'WEBGL_clip_cull_distance' );
16934
-
16935
- } else {
16936
-
16937
- getExtension( 'WEBGL_depth_texture' );
16938
- getExtension( 'OES_texture_float' );
16939
- getExtension( 'OES_texture_half_float' );
16940
- getExtension( 'OES_texture_half_float_linear' );
16941
- getExtension( 'OES_standard_derivatives' );
16942
- getExtension( 'OES_element_index_uint' );
16943
- getExtension( 'OES_vertex_array_object' );
16944
- getExtension( 'ANGLE_instanced_arrays' );
16945
-
16946
- }
16877
+ init: function () {
16947
16878
 
16879
+ getExtension( 'EXT_color_buffer_float' );
16880
+ getExtension( 'WEBGL_clip_cull_distance' );
16948
16881
  getExtension( 'OES_texture_float_linear' );
16949
16882
  getExtension( 'EXT_color_buffer_half_float' );
16950
16883
  getExtension( 'WEBGL_multisampled_render_to_texture' );
16884
+ getExtension( 'WEBGL_render_shared_exponent' );
16951
16885
 
16952
16886
  },
16953
16887
 
@@ -17175,9 +17109,7 @@
17175
17109
 
17176
17110
  }
17177
17111
 
17178
- function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17179
-
17180
- const isWebGL2 = capabilities.isWebGL2;
17112
+ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
17181
17113
 
17182
17114
  let mode;
17183
17115
 
@@ -17208,28 +17140,7 @@
17208
17140
 
17209
17141
  if ( primcount === 0 ) return;
17210
17142
 
17211
- let extension, methodName;
17212
-
17213
- if ( isWebGL2 ) {
17214
-
17215
- extension = gl;
17216
- methodName = 'drawElementsInstanced';
17217
-
17218
- } else {
17219
-
17220
- extension = extensions.get( 'ANGLE_instanced_arrays' );
17221
- methodName = 'drawElementsInstancedANGLE';
17222
-
17223
- if ( extension === null ) {
17224
-
17225
- console.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
17226
- return;
17227
-
17228
- }
17229
-
17230
- }
17231
-
17232
- extension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );
17143
+ gl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );
17233
17144
 
17234
17145
  info.update( count, mode, primcount );
17235
17146
 
@@ -17240,6 +17151,7 @@
17240
17151
  if ( drawCount === 0 ) return;
17241
17152
 
17242
17153
  const extension = extensions.get( 'WEBGL_multi_draw' );
17154
+
17243
17155
  if ( extension === null ) {
17244
17156
 
17245
17157
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -17344,289 +17256,158 @@
17344
17256
 
17345
17257
  }
17346
17258
 
17347
- function numericalSort( a, b ) {
17348
-
17349
- return a[ 0 ] - b[ 0 ];
17350
-
17351
- }
17352
-
17353
- function absNumericalSort( a, b ) {
17354
-
17355
- return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );
17356
-
17357
- }
17358
-
17359
17259
  function WebGLMorphtargets( gl, capabilities, textures ) {
17360
17260
 
17361
- const influencesList = {};
17362
- const morphInfluences = new Float32Array( 8 );
17363
17261
  const morphTextures = new WeakMap();
17364
17262
  const morph = new Vector4();
17365
17263
 
17366
- const workInfluences = [];
17367
-
17368
- for ( let i = 0; i < 8; i ++ ) {
17369
-
17370
- workInfluences[ i ] = [ i, 0 ];
17371
-
17372
- }
17373
-
17374
17264
  function update( object, geometry, program ) {
17375
17265
 
17376
17266
  const objectInfluences = object.morphTargetInfluences;
17377
17267
 
17378
- if ( capabilities.isWebGL2 === true ) {
17379
-
17380
- // instead of using attributes, the WebGL 2 code path encodes morph targets
17381
- // into an array of data textures. Each layer represents a single morph target.
17382
-
17383
- const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17384
- const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
17385
-
17386
- let entry = morphTextures.get( geometry );
17268
+ // instead of using attributes, the WebGL 2 code path encodes morph targets
17269
+ // into an array of data textures. Each layer represents a single morph target.
17387
17270
 
17388
- if ( entry === undefined || entry.count !== morphTargetsCount ) {
17389
-
17390
- if ( entry !== undefined ) entry.texture.dispose();
17391
-
17392
- const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17393
- const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17394
- const hasMorphColors = geometry.morphAttributes.color !== undefined;
17395
-
17396
- const morphTargets = geometry.morphAttributes.position || [];
17397
- const morphNormals = geometry.morphAttributes.normal || [];
17398
- const morphColors = geometry.morphAttributes.color || [];
17271
+ const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17272
+ const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
17399
17273
 
17400
- let vertexDataCount = 0;
17274
+ let entry = morphTextures.get( geometry );
17401
17275
 
17402
- if ( hasMorphPosition === true ) vertexDataCount = 1;
17403
- if ( hasMorphNormals === true ) vertexDataCount = 2;
17404
- if ( hasMorphColors === true ) vertexDataCount = 3;
17276
+ if ( entry === undefined || entry.count !== morphTargetsCount ) {
17405
17277
 
17406
- let width = geometry.attributes.position.count * vertexDataCount;
17407
- let height = 1;
17278
+ if ( entry !== undefined ) entry.texture.dispose();
17408
17279
 
17409
- if ( width > capabilities.maxTextureSize ) {
17280
+ const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17281
+ const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17282
+ const hasMorphColors = geometry.morphAttributes.color !== undefined;
17410
17283
 
17411
- height = Math.ceil( width / capabilities.maxTextureSize );
17412
- width = capabilities.maxTextureSize;
17284
+ const morphTargets = geometry.morphAttributes.position || [];
17285
+ const morphNormals = geometry.morphAttributes.normal || [];
17286
+ const morphColors = geometry.morphAttributes.color || [];
17413
17287
 
17414
- }
17288
+ let vertexDataCount = 0;
17415
17289
 
17416
- const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17290
+ if ( hasMorphPosition === true ) vertexDataCount = 1;
17291
+ if ( hasMorphNormals === true ) vertexDataCount = 2;
17292
+ if ( hasMorphColors === true ) vertexDataCount = 3;
17417
17293
 
17418
- const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17419
- texture.type = FloatType;
17420
- texture.needsUpdate = true;
17294
+ let width = geometry.attributes.position.count * vertexDataCount;
17295
+ let height = 1;
17421
17296
 
17422
- // fill buffer
17297
+ if ( width > capabilities.maxTextureSize ) {
17423
17298
 
17424
- const vertexDataStride = vertexDataCount * 4;
17299
+ height = Math.ceil( width / capabilities.maxTextureSize );
17300
+ width = capabilities.maxTextureSize;
17425
17301
 
17426
- for ( let i = 0; i < morphTargetsCount; i ++ ) {
17302
+ }
17427
17303
 
17428
- const morphTarget = morphTargets[ i ];
17429
- const morphNormal = morphNormals[ i ];
17430
- const morphColor = morphColors[ i ];
17304
+ const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17431
17305
 
17432
- const offset = width * height * 4 * i;
17306
+ const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17307
+ texture.type = FloatType;
17308
+ texture.needsUpdate = true;
17433
17309
 
17434
- for ( let j = 0; j < morphTarget.count; j ++ ) {
17310
+ // fill buffer
17435
17311
 
17436
- const stride = j * vertexDataStride;
17312
+ const vertexDataStride = vertexDataCount * 4;
17437
17313
 
17438
- if ( hasMorphPosition === true ) {
17314
+ for ( let i = 0; i < morphTargetsCount; i ++ ) {
17439
17315
 
17440
- morph.fromBufferAttribute( morphTarget, j );
17316
+ const morphTarget = morphTargets[ i ];
17317
+ const morphNormal = morphNormals[ i ];
17318
+ const morphColor = morphColors[ i ];
17441
17319
 
17442
- buffer[ offset + stride + 0 ] = morph.x;
17443
- buffer[ offset + stride + 1 ] = morph.y;
17444
- buffer[ offset + stride + 2 ] = morph.z;
17445
- buffer[ offset + stride + 3 ] = 0;
17320
+ const offset = width * height * 4 * i;
17446
17321
 
17447
- }
17322
+ for ( let j = 0; j < morphTarget.count; j ++ ) {
17448
17323
 
17449
- if ( hasMorphNormals === true ) {
17324
+ const stride = j * vertexDataStride;
17450
17325
 
17451
- morph.fromBufferAttribute( morphNormal, j );
17326
+ if ( hasMorphPosition === true ) {
17452
17327
 
17453
- buffer[ offset + stride + 4 ] = morph.x;
17454
- buffer[ offset + stride + 5 ] = morph.y;
17455
- buffer[ offset + stride + 6 ] = morph.z;
17456
- buffer[ offset + stride + 7 ] = 0;
17328
+ morph.fromBufferAttribute( morphTarget, j );
17457
17329
 
17458
- }
17330
+ buffer[ offset + stride + 0 ] = morph.x;
17331
+ buffer[ offset + stride + 1 ] = morph.y;
17332
+ buffer[ offset + stride + 2 ] = morph.z;
17333
+ buffer[ offset + stride + 3 ] = 0;
17459
17334
 
17460
- if ( hasMorphColors === true ) {
17335
+ }
17461
17336
 
17462
- morph.fromBufferAttribute( morphColor, j );
17337
+ if ( hasMorphNormals === true ) {
17463
17338
 
17464
- buffer[ offset + stride + 8 ] = morph.x;
17465
- buffer[ offset + stride + 9 ] = morph.y;
17466
- buffer[ offset + stride + 10 ] = morph.z;
17467
- buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
17339
+ morph.fromBufferAttribute( morphNormal, j );
17468
17340
 
17469
- }
17341
+ buffer[ offset + stride + 4 ] = morph.x;
17342
+ buffer[ offset + stride + 5 ] = morph.y;
17343
+ buffer[ offset + stride + 6 ] = morph.z;
17344
+ buffer[ offset + stride + 7 ] = 0;
17470
17345
 
17471
17346
  }
17472
17347
 
17473
- }
17474
-
17475
- entry = {
17476
- count: morphTargetsCount,
17477
- texture: texture,
17478
- size: new Vector2( width, height )
17479
- };
17480
-
17481
- morphTextures.set( geometry, entry );
17482
-
17483
- function disposeTexture() {
17348
+ if ( hasMorphColors === true ) {
17484
17349
 
17485
- texture.dispose();
17350
+ morph.fromBufferAttribute( morphColor, j );
17486
17351
 
17487
- morphTextures.delete( geometry );
17352
+ buffer[ offset + stride + 8 ] = morph.x;
17353
+ buffer[ offset + stride + 9 ] = morph.y;
17354
+ buffer[ offset + stride + 10 ] = morph.z;
17355
+ buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
17488
17356
 
17489
- geometry.removeEventListener( 'dispose', disposeTexture );
17357
+ }
17490
17358
 
17491
17359
  }
17492
17360
 
17493
- geometry.addEventListener( 'dispose', disposeTexture );
17494
-
17495
- }
17496
-
17497
- //
17498
-
17499
- let morphInfluencesSum = 0;
17500
-
17501
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
17502
-
17503
- morphInfluencesSum += objectInfluences[ i ];
17504
-
17505
17361
  }
17506
17362
 
17507
- const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17508
-
17509
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17510
- program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17511
-
17512
- program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17513
- program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17514
-
17515
-
17516
- } else {
17517
-
17518
- // When object doesn't have morph target influences defined, we treat it as a 0-length array
17519
- // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
17520
-
17521
- const length = objectInfluences === undefined ? 0 : objectInfluences.length;
17522
-
17523
- let influences = influencesList[ geometry.id ];
17524
-
17525
- if ( influences === undefined || influences.length !== length ) {
17526
-
17527
- // initialise list
17528
-
17529
- influences = [];
17530
-
17531
- for ( let i = 0; i < length; i ++ ) {
17532
-
17533
- influences[ i ] = [ i, 0 ];
17534
-
17535
- }
17536
-
17537
- influencesList[ geometry.id ] = influences;
17363
+ entry = {
17364
+ count: morphTargetsCount,
17365
+ texture: texture,
17366
+ size: new Vector2( width, height )
17367
+ };
17538
17368
 
17539
- }
17369
+ morphTextures.set( geometry, entry );
17540
17370
 
17541
- // Collect influences
17371
+ function disposeTexture() {
17542
17372
 
17543
- for ( let i = 0; i < length; i ++ ) {
17373
+ texture.dispose();
17544
17374
 
17545
- const influence = influences[ i ];
17375
+ morphTextures.delete( geometry );
17546
17376
 
17547
- influence[ 0 ] = i;
17548
- influence[ 1 ] = objectInfluences[ i ];
17377
+ geometry.removeEventListener( 'dispose', disposeTexture );
17549
17378
 
17550
17379
  }
17551
17380
 
17552
- influences.sort( absNumericalSort );
17553
-
17554
- for ( let i = 0; i < 8; i ++ ) {
17555
-
17556
- if ( i < length && influences[ i ][ 1 ] ) {
17557
-
17558
- workInfluences[ i ][ 0 ] = influences[ i ][ 0 ];
17559
- workInfluences[ i ][ 1 ] = influences[ i ][ 1 ];
17560
-
17561
- } else {
17381
+ geometry.addEventListener( 'dispose', disposeTexture );
17562
17382
 
17563
- workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;
17564
- workInfluences[ i ][ 1 ] = 0;
17565
-
17566
- }
17383
+ }
17567
17384
 
17568
- }
17385
+ //
17386
+ if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17569
17387
 
17570
- workInfluences.sort( numericalSort );
17388
+ program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17571
17389
 
17572
- const morphTargets = geometry.morphAttributes.position;
17573
- const morphNormals = geometry.morphAttributes.normal;
17390
+ } else {
17574
17391
 
17575
17392
  let morphInfluencesSum = 0;
17576
17393
 
17577
- for ( let i = 0; i < 8; i ++ ) {
17578
-
17579
- const influence = workInfluences[ i ];
17580
- const index = influence[ 0 ];
17581
- const value = influence[ 1 ];
17582
-
17583
- if ( index !== Number.MAX_SAFE_INTEGER && value ) {
17584
-
17585
- if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {
17586
-
17587
- geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );
17588
-
17589
- }
17590
-
17591
- if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {
17592
-
17593
- geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );
17594
-
17595
- }
17596
-
17597
- morphInfluences[ i ] = value;
17598
- morphInfluencesSum += value;
17599
-
17600
- } else {
17601
-
17602
- if ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {
17603
-
17604
- geometry.deleteAttribute( 'morphTarget' + i );
17605
-
17606
- }
17607
-
17608
- if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {
17609
-
17610
- geometry.deleteAttribute( 'morphNormal' + i );
17611
-
17612
- }
17613
-
17614
- morphInfluences[ i ] = 0;
17394
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
17615
17395
 
17616
- }
17396
+ morphInfluencesSum += objectInfluences[ i ];
17617
17397
 
17618
17398
  }
17619
17399
 
17620
- // GLSL shader uses formula baseinfluence * base + sum(target * influence)
17621
- // This allows us to switch between absolute morphs and relative morphs without changing shader code
17622
- // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
17623
17400
  const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17624
17401
 
17402
+
17625
17403
  program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17626
- program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );
17404
+ program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17627
17405
 
17628
17406
  }
17629
17407
 
17408
+ program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17409
+ program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17410
+
17630
17411
  }
17631
17412
 
17632
17413
  return {
@@ -19061,6 +18842,10 @@
19061
18842
  toneMappingName = 'AgX';
19062
18843
  break;
19063
18844
 
18845
+ case NeutralToneMapping:
18846
+ toneMappingName = 'Neutral';
18847
+ break;
18848
+
19064
18849
  case CustomToneMapping:
19065
18850
  toneMappingName = 'Custom';
19066
18851
  break;
@@ -19075,19 +18860,6 @@
19075
18860
 
19076
18861
  }
19077
18862
 
19078
- function generateExtensions( parameters ) {
19079
-
19080
- const chunks = [
19081
- ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19082
- ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
19083
- ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
19084
- ( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
19085
- ];
19086
-
19087
- return chunks.filter( filterEmptyLine ).join( '\n' );
19088
-
19089
- }
19090
-
19091
18863
  function generateVertexExtensions( parameters ) {
19092
18864
 
19093
18865
  const chunks = [
@@ -19255,27 +19027,21 @@
19255
19027
  precision ${parameters.precision} int;
19256
19028
  precision ${parameters.precision} sampler2D;
19257
19029
  precision ${parameters.precision} samplerCube;
19030
+ precision ${parameters.precision} sampler3D;
19031
+ precision ${parameters.precision} sampler2DArray;
19032
+ precision ${parameters.precision} sampler2DShadow;
19033
+ precision ${parameters.precision} samplerCubeShadow;
19034
+ precision ${parameters.precision} sampler2DArrayShadow;
19035
+ precision ${parameters.precision} isampler2D;
19036
+ precision ${parameters.precision} isampler3D;
19037
+ precision ${parameters.precision} isamplerCube;
19038
+ precision ${parameters.precision} isampler2DArray;
19039
+ precision ${parameters.precision} usampler2D;
19040
+ precision ${parameters.precision} usampler3D;
19041
+ precision ${parameters.precision} usamplerCube;
19042
+ precision ${parameters.precision} usampler2DArray;
19258
19043
  `;
19259
19044
 
19260
- if ( parameters.isWebGL2 ) {
19261
-
19262
- precisionstring += `precision ${parameters.precision} sampler3D;
19263
- precision ${parameters.precision} sampler2DArray;
19264
- precision ${parameters.precision} sampler2DShadow;
19265
- precision ${parameters.precision} samplerCubeShadow;
19266
- precision ${parameters.precision} sampler2DArrayShadow;
19267
- precision ${parameters.precision} isampler2D;
19268
- precision ${parameters.precision} isampler3D;
19269
- precision ${parameters.precision} isamplerCube;
19270
- precision ${parameters.precision} isampler2DArray;
19271
- precision ${parameters.precision} usampler2D;
19272
- precision ${parameters.precision} usampler3D;
19273
- precision ${parameters.precision} usamplerCube;
19274
- precision ${parameters.precision} usampler2DArray;
19275
- `;
19276
-
19277
- }
19278
-
19279
19045
  if ( parameters.precision === 'highp' ) {
19280
19046
 
19281
19047
  precisionstring += '\n#define HIGH_PRECISION';
@@ -19424,8 +19190,6 @@
19424
19190
  const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
19425
19191
  const envMapCubeUVSize = generateCubeUVSize( parameters );
19426
19192
 
19427
- const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
19428
-
19429
19193
  const customVertexExtensions = generateVertexExtensions( parameters );
19430
19194
 
19431
19195
  const customDefines = generateDefines( defines );
@@ -19454,8 +19218,6 @@
19454
19218
 
19455
19219
  prefixFragment = [
19456
19220
 
19457
- customExtensions,
19458
-
19459
19221
  '#define SHADER_TYPE ' + parameters.shaderType,
19460
19222
  '#define SHADER_NAME ' + parameters.shaderName,
19461
19223
 
@@ -19484,6 +19246,7 @@
19484
19246
  parameters.batching ? '#define USE_BATCHING' : '',
19485
19247
  parameters.instancing ? '#define USE_INSTANCING' : '',
19486
19248
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
19249
+ parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
19487
19250
 
19488
19251
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
19489
19252
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
@@ -19576,10 +19339,10 @@
19576
19339
 
19577
19340
  parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
19578
19341
  parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
19579
- ( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',
19580
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
19581
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
19582
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
19342
+ ( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',
19343
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',
19344
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
19345
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
19583
19346
  parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
19584
19347
  parameters.flipSided ? '#define FLIP_SIDED' : '',
19585
19348
 
@@ -19593,7 +19356,6 @@
19593
19356
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19594
19357
 
19595
19358
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
19596
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
19597
19359
 
19598
19360
  'uniform mat4 modelMatrix;',
19599
19361
  'uniform mat4 modelViewMatrix;',
@@ -19615,6 +19377,12 @@
19615
19377
 
19616
19378
  '#endif',
19617
19379
 
19380
+ '#ifdef USE_INSTANCING_MORPH',
19381
+
19382
+ ' uniform sampler2D morphTexture;',
19383
+
19384
+ '#endif',
19385
+
19618
19386
  'attribute vec3 position;',
19619
19387
  'attribute vec3 normal;',
19620
19388
  'attribute vec2 uv;',
@@ -19691,8 +19459,6 @@
19691
19459
 
19692
19460
  prefixFragment = [
19693
19461
 
19694
- customExtensions,
19695
-
19696
19462
  generatePrecision( parameters ),
19697
19463
 
19698
19464
  '#define SHADER_TYPE ' + parameters.shaderType,
@@ -19780,7 +19546,6 @@
19780
19546
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
19781
19547
 
19782
19548
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
19783
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
19784
19549
 
19785
19550
  'uniform mat4 viewMatrix;',
19786
19551
  'uniform vec3 cameraPosition;',
@@ -19815,7 +19580,7 @@
19815
19580
  vertexShader = unrollLoops( vertexShader );
19816
19581
  fragmentShader = unrollLoops( fragmentShader );
19817
19582
 
19818
- if ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {
19583
+ if ( parameters.isRawShaderMaterial !== true ) {
19819
19584
 
19820
19585
  // GLSL 3.0 conversion for built-in materials and ShaderMaterial
19821
19586
 
@@ -19823,14 +19588,12 @@
19823
19588
 
19824
19589
  prefixVertex = [
19825
19590
  customVertexExtensions,
19826
- 'precision mediump sampler2DArray;',
19827
19591
  '#define attribute in',
19828
19592
  '#define varying out',
19829
19593
  '#define texture2D texture'
19830
19594
  ].join( '\n' ) + '\n' + prefixVertex;
19831
19595
 
19832
19596
  prefixFragment = [
19833
- 'precision mediump sampler2DArray;',
19834
19597
  '#define varying in',
19835
19598
  ( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
19836
19599
  ( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
@@ -20173,7 +19936,6 @@
20173
19936
  const _activeChannels = new Set();
20174
19937
  const programs = [];
20175
19938
 
20176
- const IS_WEBGL2 = capabilities.isWebGL2;
20177
19939
  const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
20178
19940
  const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
20179
19941
 
@@ -20335,8 +20097,6 @@
20335
20097
 
20336
20098
  const parameters = {
20337
20099
 
20338
- isWebGL2: IS_WEBGL2,
20339
-
20340
20100
  shaderID: shaderID,
20341
20101
  shaderType: material.type,
20342
20102
  shaderName: material.name,
@@ -20356,6 +20116,7 @@
20356
20116
  batching: IS_BATCHEDMESH,
20357
20117
  instancing: IS_INSTANCEDMESH,
20358
20118
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
20119
+ instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
20359
20120
 
20360
20121
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
20361
20122
  outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
@@ -20509,16 +20270,9 @@
20509
20270
 
20510
20271
  index0AttributeName: material.index0AttributeName,
20511
20272
 
20512
- extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,
20513
- extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
20514
- extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
20515
- extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
20516
20273
  extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
20517
20274
  extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
20518
20275
 
20519
- rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
20520
- rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
20521
- rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
20522
20276
  rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
20523
20277
 
20524
20278
  customProgramCacheKey: material.customProgramCacheKey()
@@ -20634,13 +20388,13 @@
20634
20388
 
20635
20389
  _programLayers.disableAll();
20636
20390
 
20637
- if ( parameters.isWebGL2 )
20638
- _programLayers.enable( 0 );
20639
20391
  if ( parameters.supportsVertexTextures )
20640
- _programLayers.enable( 1 );
20392
+ _programLayers.enable( 0 );
20641
20393
  if ( parameters.instancing )
20642
- _programLayers.enable( 2 );
20394
+ _programLayers.enable( 1 );
20643
20395
  if ( parameters.instancingColor )
20396
+ _programLayers.enable( 2 );
20397
+ if ( parameters.instancingMorph )
20644
20398
  _programLayers.enable( 3 );
20645
20399
  if ( parameters.matcap )
20646
20400
  _programLayers.enable( 4 );
@@ -21246,7 +21000,7 @@
21246
21000
 
21247
21001
  }
21248
21002
 
21249
- function WebGLLights( extensions, capabilities ) {
21003
+ function WebGLLights( extensions ) {
21250
21004
 
21251
21005
  const cache = new UniformsCache();
21252
21006
 
@@ -21495,41 +21249,15 @@
21495
21249
 
21496
21250
  if ( rectAreaLength > 0 ) {
21497
21251
 
21498
- if ( capabilities.isWebGL2 ) {
21499
-
21500
- // WebGL 2
21252
+ if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
21501
21253
 
21502
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
21503
-
21504
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21505
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21506
-
21507
- } else {
21508
-
21509
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21510
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
21511
-
21512
- }
21254
+ state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21255
+ state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21513
21256
 
21514
21257
  } else {
21515
21258
 
21516
- // WebGL 1
21517
-
21518
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
21519
-
21520
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21521
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21522
-
21523
- } else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
21524
-
21525
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21526
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
21527
-
21528
- } else {
21529
-
21530
- console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
21531
-
21532
- }
21259
+ state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21260
+ state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
21533
21261
 
21534
21262
  }
21535
21263
 
@@ -21682,9 +21410,9 @@
21682
21410
 
21683
21411
  }
21684
21412
 
21685
- function WebGLRenderState( extensions, capabilities ) {
21413
+ function WebGLRenderState( extensions ) {
21686
21414
 
21687
- const lights = new WebGLLights( extensions, capabilities );
21415
+ const lights = new WebGLLights( extensions );
21688
21416
 
21689
21417
  const lightsArray = [];
21690
21418
  const shadowsArray = [];
@@ -21724,7 +21452,9 @@
21724
21452
  lightsArray: lightsArray,
21725
21453
  shadowsArray: shadowsArray,
21726
21454
 
21727
- lights: lights
21455
+ lights: lights,
21456
+
21457
+ transmissionRenderTarget: null
21728
21458
  };
21729
21459
 
21730
21460
  return {
@@ -21739,7 +21469,7 @@
21739
21469
 
21740
21470
  }
21741
21471
 
21742
- function WebGLRenderStates( extensions, capabilities ) {
21472
+ function WebGLRenderStates( extensions ) {
21743
21473
 
21744
21474
  let renderStates = new WeakMap();
21745
21475
 
@@ -21750,14 +21480,14 @@
21750
21480
 
21751
21481
  if ( renderStateArray === undefined ) {
21752
21482
 
21753
- renderState = new WebGLRenderState( extensions, capabilities );
21483
+ renderState = new WebGLRenderState( extensions );
21754
21484
  renderStates.set( scene, [ renderState ] );
21755
21485
 
21756
21486
  } else {
21757
21487
 
21758
21488
  if ( renderCallDepth >= renderStateArray.length ) {
21759
21489
 
21760
- renderState = new WebGLRenderState( extensions, capabilities );
21490
+ renderState = new WebGLRenderState( extensions );
21761
21491
  renderStateArray.push( renderState );
21762
21492
 
21763
21493
  } else {
@@ -22287,9 +22017,7 @@
22287
22017
 
22288
22018
  }
22289
22019
 
22290
- function WebGLState( gl, extensions, capabilities ) {
22291
-
22292
- const isWebGL2 = capabilities.isWebGL2;
22020
+ function WebGLState( gl ) {
22293
22021
 
22294
22022
  function ColorBuffer() {
22295
22023
 
@@ -22661,7 +22389,7 @@
22661
22389
 
22662
22390
  for ( let i = 0; i < count; i ++ ) {
22663
22391
 
22664
- if ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {
22392
+ if ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {
22665
22393
 
22666
22394
  gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
22667
22395
 
@@ -22680,13 +22408,8 @@
22680
22408
  const emptyTextures = {};
22681
22409
  emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
22682
22410
  emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
22683
-
22684
- if ( isWebGL2 ) {
22685
-
22686
- emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
22687
- emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
22688
-
22689
- }
22411
+ emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
22412
+ emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
22690
22413
 
22691
22414
  // init
22692
22415
 
@@ -22735,21 +22458,17 @@
22735
22458
 
22736
22459
  currentBoundFramebuffers[ target ] = framebuffer;
22737
22460
 
22738
- if ( isWebGL2 ) {
22739
-
22740
- // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
22741
-
22742
- if ( target === gl.DRAW_FRAMEBUFFER ) {
22461
+ // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
22743
22462
 
22744
- currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
22463
+ if ( target === gl.DRAW_FRAMEBUFFER ) {
22745
22464
 
22746
- }
22465
+ currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
22747
22466
 
22748
- if ( target === gl.FRAMEBUFFER ) {
22467
+ }
22749
22468
 
22750
- currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
22469
+ if ( target === gl.FRAMEBUFFER ) {
22751
22470
 
22752
- }
22471
+ currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
22753
22472
 
22754
22473
  }
22755
22474
 
@@ -22778,33 +22497,19 @@
22778
22497
 
22779
22498
  }
22780
22499
 
22781
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
22782
-
22783
- const textures = renderTarget.texture;
22500
+ const textures = renderTarget.textures;
22784
22501
 
22785
- if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22786
-
22787
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
22788
-
22789
- drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
22790
-
22791
- }
22502
+ if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22792
22503
 
22793
- drawBuffers.length = textures.length;
22504
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
22794
22505
 
22795
- needsUpdate = true;
22506
+ drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
22796
22507
 
22797
22508
  }
22798
22509
 
22799
- } else {
22800
-
22801
- if ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
22802
-
22803
- drawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;
22510
+ drawBuffers.length = textures.length;
22804
22511
 
22805
- needsUpdate = true;
22806
-
22807
- }
22512
+ needsUpdate = true;
22808
22513
 
22809
22514
  }
22810
22515
 
@@ -22822,19 +22527,10 @@
22822
22527
 
22823
22528
  if ( needsUpdate ) {
22824
22529
 
22825
- if ( capabilities.isWebGL2 ) {
22826
-
22827
- gl.drawBuffers( drawBuffers );
22828
-
22829
- } else {
22830
-
22831
- extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
22832
-
22833
- }
22530
+ gl.drawBuffers( drawBuffers );
22834
22531
 
22835
22532
  }
22836
22533
 
22837
-
22838
22534
  }
22839
22535
 
22840
22536
  function useProgram( program ) {
@@ -22859,23 +22555,8 @@
22859
22555
  [ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
22860
22556
  };
22861
22557
 
22862
- if ( isWebGL2 ) {
22863
-
22864
- equationToGL[ MinEquation ] = gl.MIN;
22865
- equationToGL[ MaxEquation ] = gl.MAX;
22866
-
22867
- } else {
22868
-
22869
- const extension = extensions.get( 'EXT_blend_minmax' );
22870
-
22871
- if ( extension !== null ) {
22872
-
22873
- equationToGL[ MinEquation ] = extension.MIN_EXT;
22874
- equationToGL[ MaxEquation ] = extension.MAX_EXT;
22875
-
22876
- }
22877
-
22878
- }
22558
+ equationToGL[ MinEquation ] = gl.MIN;
22559
+ equationToGL[ MaxEquation ] = gl.MAX;
22879
22560
 
22880
22561
  const factorToGL = {
22881
22562
  [ ZeroFactor ]: gl.ZERO,
@@ -23499,13 +23180,8 @@
23499
23180
  gl.activeTexture( gl.TEXTURE0 );
23500
23181
 
23501
23182
  gl.bindFramebuffer( gl.FRAMEBUFFER, null );
23502
-
23503
- if ( isWebGL2 === true ) {
23504
-
23505
- gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
23506
- gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
23507
-
23508
- }
23183
+ gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
23184
+ gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
23509
23185
 
23510
23186
  gl.useProgram( null );
23511
23187
 
@@ -23612,10 +23288,10 @@
23612
23288
 
23613
23289
  function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
23614
23290
 
23615
- const isWebGL2 = capabilities.isWebGL2;
23616
23291
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
23617
23292
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
23618
23293
 
23294
+ const _imageDimensions = new Vector2();
23619
23295
  const _videoTextures = new WeakMap();
23620
23296
  let _canvas;
23621
23297
 
@@ -23649,32 +23325,33 @@
23649
23325
 
23650
23326
  }
23651
23327
 
23652
- function resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {
23328
+ function resizeImage( image, needsNewCanvas, maxSize ) {
23653
23329
 
23654
23330
  let scale = 1;
23655
23331
 
23332
+ const dimensions = getDimensions( image );
23333
+
23656
23334
  // handle case if texture exceeds max size
23657
23335
 
23658
- if ( image.width > maxSize || image.height > maxSize ) {
23336
+ if ( dimensions.width > maxSize || dimensions.height > maxSize ) {
23659
23337
 
23660
- scale = maxSize / Math.max( image.width, image.height );
23338
+ scale = maxSize / Math.max( dimensions.width, dimensions.height );
23661
23339
 
23662
23340
  }
23663
23341
 
23664
23342
  // only perform resize if necessary
23665
23343
 
23666
- if ( scale < 1 || needsPowerOfTwo === true ) {
23344
+ if ( scale < 1 ) {
23667
23345
 
23668
23346
  // only perform resize for certain image types
23669
23347
 
23670
23348
  if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
23671
23349
  ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
23672
- ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
23350
+ ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
23351
+ ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
23673
23352
 
23674
- const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
23675
-
23676
- const width = floor( scale * image.width );
23677
- const height = floor( scale * image.height );
23353
+ const width = Math.floor( scale * dimensions.width );
23354
+ const height = Math.floor( scale * dimensions.height );
23678
23355
 
23679
23356
  if ( _canvas === undefined ) _canvas = createCanvas( width, height );
23680
23357
 
@@ -23688,7 +23365,7 @@
23688
23365
  const context = canvas.getContext( '2d' );
23689
23366
  context.drawImage( image, 0, 0, width, height );
23690
23367
 
23691
- console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );
23368
+ console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
23692
23369
 
23693
23370
  return canvas;
23694
23371
 
@@ -23696,7 +23373,7 @@
23696
23373
 
23697
23374
  if ( 'data' in image ) {
23698
23375
 
23699
- console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
23376
+ console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
23700
23377
 
23701
23378
  }
23702
23379
 
@@ -23710,25 +23387,9 @@
23710
23387
 
23711
23388
  }
23712
23389
 
23713
- function isPowerOfTwo$1( image ) {
23390
+ function textureNeedsGenerateMipmaps( texture ) {
23714
23391
 
23715
- return isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );
23716
-
23717
- }
23718
-
23719
- function textureNeedsPowerOfTwo( texture ) {
23720
-
23721
- if ( isWebGL2 ) return false;
23722
-
23723
- return ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||
23724
- ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
23725
-
23726
- }
23727
-
23728
- function textureNeedsGenerateMipmaps( texture, supportsMips ) {
23729
-
23730
- return texture.generateMipmaps && supportsMips &&
23731
- texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
23392
+ return texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
23732
23393
 
23733
23394
  }
23734
23395
 
@@ -23740,8 +23401,6 @@
23740
23401
 
23741
23402
  function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
23742
23403
 
23743
- if ( isWebGL2 === false ) return glFormat;
23744
-
23745
23404
  if ( internalFormatName !== null ) {
23746
23405
 
23747
23406
  if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
@@ -23779,6 +23438,23 @@
23779
23438
 
23780
23439
  }
23781
23440
 
23441
+ if ( glFormat === _gl.RG_INTEGER ) {
23442
+
23443
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;
23444
+ if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;
23445
+ if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;
23446
+ if ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;
23447
+ if ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;
23448
+ if ( glType === _gl.INT ) internalFormat = _gl.RG32I;
23449
+
23450
+ }
23451
+
23452
+ if ( glFormat === _gl.RGB ) {
23453
+
23454
+ if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
23455
+
23456
+ }
23457
+
23782
23458
  if ( glFormat === _gl.RGBA ) {
23783
23459
 
23784
23460
  const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
@@ -23803,9 +23479,9 @@
23803
23479
 
23804
23480
  }
23805
23481
 
23806
- function getMipLevels( texture, image, supportsMips ) {
23482
+ function getMipLevels( texture, image ) {
23807
23483
 
23808
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
23484
+ if ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
23809
23485
 
23810
23486
  return Math.log2( Math.max( image.width, image.height ) ) + 1;
23811
23487
 
@@ -23829,20 +23505,6 @@
23829
23505
 
23830
23506
  }
23831
23507
 
23832
- // Fallback filters for non-power-of-2 textures
23833
-
23834
- function filterFallback( f ) {
23835
-
23836
- if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
23837
-
23838
- return _gl.NEAREST;
23839
-
23840
- }
23841
-
23842
- return _gl.LINEAR;
23843
-
23844
- }
23845
-
23846
23508
  //
23847
23509
 
23848
23510
  function onTextureDispose( event ) {
@@ -23926,18 +23588,7 @@
23926
23588
 
23927
23589
  function deallocateRenderTarget( renderTarget ) {
23928
23590
 
23929
- const texture = renderTarget.texture;
23930
-
23931
23591
  const renderTargetProperties = properties.get( renderTarget );
23932
- const textureProperties = properties.get( texture );
23933
-
23934
- if ( textureProperties.__webglTexture !== undefined ) {
23935
-
23936
- _gl.deleteTexture( textureProperties.__webglTexture );
23937
-
23938
- info.memory.textures --;
23939
-
23940
- }
23941
23592
 
23942
23593
  if ( renderTarget.depthTexture ) {
23943
23594
 
@@ -23992,27 +23643,24 @@
23992
23643
 
23993
23644
  }
23994
23645
 
23995
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
23996
-
23997
- for ( let i = 0, il = texture.length; i < il; i ++ ) {
23646
+ const textures = renderTarget.textures;
23998
23647
 
23999
- const attachmentProperties = properties.get( texture[ i ] );
24000
-
24001
- if ( attachmentProperties.__webglTexture ) {
23648
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
24002
23649
 
24003
- _gl.deleteTexture( attachmentProperties.__webglTexture );
23650
+ const attachmentProperties = properties.get( textures[ i ] );
24004
23651
 
24005
- info.memory.textures --;
23652
+ if ( attachmentProperties.__webglTexture ) {
24006
23653
 
24007
- }
23654
+ _gl.deleteTexture( attachmentProperties.__webglTexture );
24008
23655
 
24009
- properties.remove( texture[ i ] );
23656
+ info.memory.textures --;
24010
23657
 
24011
23658
  }
24012
23659
 
23660
+ properties.remove( textures[ i ] );
23661
+
24013
23662
  }
24014
23663
 
24015
- properties.remove( texture );
24016
23664
  properties.remove( renderTarget );
24017
23665
 
24018
23666
  }
@@ -24171,7 +23819,7 @@
24171
23819
  [ NotEqualCompare ]: _gl.NOTEQUAL
24172
23820
  };
24173
23821
 
24174
- function setTextureParameters( textureType, texture, supportsMips ) {
23822
+ function setTextureParameters( textureType, texture ) {
24175
23823
 
24176
23824
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
24177
23825
  ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
@@ -24181,48 +23829,18 @@
24181
23829
 
24182
23830
  }
24183
23831
 
24184
- if ( supportsMips ) {
24185
-
24186
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
24187
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
24188
-
24189
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24190
-
24191
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
23832
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
23833
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
24192
23834
 
24193
- }
24194
-
24195
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
24196
- _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
24197
-
24198
- } else {
23835
+ if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24199
23836
 
24200
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
24201
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
24202
-
24203
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24204
-
24205
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
24206
-
24207
- }
24208
-
24209
- if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
24210
-
24211
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
24212
-
24213
- }
24214
-
24215
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
24216
- _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
24217
-
24218
- if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {
24219
-
24220
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
24221
-
24222
- }
23837
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
24223
23838
 
24224
23839
  }
24225
23840
 
23841
+ _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
23842
+ _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
23843
+
24226
23844
  if ( texture.compareFunction ) {
24227
23845
 
24228
23846
  _gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
@@ -24232,15 +23850,13 @@
24232
23850
 
24233
23851
  if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
24234
23852
 
24235
- const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24236
-
24237
23853
  if ( texture.magFilter === NearestFilter ) return;
24238
23854
  if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
24239
- if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
24240
- if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only
23855
+ if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
24241
23856
 
24242
23857
  if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
24243
23858
 
23859
+ const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24244
23860
  _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );
24245
23861
  properties.get( texture ).__currentAnisotropy = texture.anisotropy;
24246
23862
 
@@ -24357,97 +23973,41 @@
24357
23973
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24358
23974
  _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24359
23975
 
24360
- const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24361
- let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
23976
+ let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
24362
23977
  image = verifyColorSpace( texture, image );
24363
23978
 
24364
- const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
24365
- glFormat = utils.convert( texture.format, texture.colorSpace );
23979
+ const glFormat = utils.convert( texture.format, texture.colorSpace );
24366
23980
 
24367
- let glType = utils.convert( texture.type ),
24368
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
23981
+ const glType = utils.convert( texture.type );
23982
+ let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
24369
23983
 
24370
- setTextureParameters( textureType, texture, supportsMips );
23984
+ setTextureParameters( textureType, texture );
24371
23985
 
24372
23986
  let mipmap;
24373
23987
  const mipmaps = texture.mipmaps;
24374
23988
 
24375
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
23989
+ const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24376
23990
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24377
23991
  const dataReady = source.dataReady;
24378
- const levels = getMipLevels( texture, image, supportsMips );
23992
+ const levels = getMipLevels( texture, image );
24379
23993
 
24380
23994
  if ( texture.isDepthTexture ) {
24381
23995
 
24382
23996
  // populate depth texture with dummy data
24383
23997
 
24384
- glInternalFormat = _gl.DEPTH_COMPONENT;
24385
-
24386
- if ( isWebGL2 ) {
24387
-
24388
- if ( texture.type === FloatType ) {
24389
-
24390
- glInternalFormat = _gl.DEPTH_COMPONENT32F;
24391
-
24392
- } else if ( texture.type === UnsignedIntType ) {
24393
-
24394
- glInternalFormat = _gl.DEPTH_COMPONENT24;
24395
-
24396
- } else if ( texture.type === UnsignedInt248Type ) {
24397
-
24398
- glInternalFormat = _gl.DEPTH24_STENCIL8;
24399
-
24400
- } else {
24401
-
24402
- glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
24403
-
24404
- }
24405
-
24406
- } else {
24407
-
24408
- if ( texture.type === FloatType ) {
24409
-
24410
- console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
24411
-
24412
- }
24413
-
24414
- }
24415
-
24416
- // validation checks for WebGL 1
24417
-
24418
- if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
24419
-
24420
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
24421
- // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
24422
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
24423
- if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
24424
-
24425
- console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
24426
-
24427
- texture.type = UnsignedIntType;
24428
- glType = utils.convert( texture.type );
24429
-
24430
- }
24431
-
24432
- }
23998
+ glInternalFormat = _gl.DEPTH_COMPONENT16;
24433
23999
 
24434
- if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
24000
+ if ( texture.type === FloatType ) {
24435
24001
 
24436
- // Depth stencil textures need the DEPTH_STENCIL internal format
24437
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
24438
- glInternalFormat = _gl.DEPTH_STENCIL;
24002
+ glInternalFormat = _gl.DEPTH_COMPONENT32F;
24439
24003
 
24440
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
24441
- // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
24442
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
24443
- if ( texture.type !== UnsignedInt248Type ) {
24004
+ } else if ( texture.type === UnsignedIntType ) {
24444
24005
 
24445
- console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
24006
+ glInternalFormat = _gl.DEPTH_COMPONENT24;
24446
24007
 
24447
- texture.type = UnsignedInt248Type;
24448
- glType = utils.convert( texture.type );
24008
+ } else if ( texture.type === UnsignedInt248Type ) {
24449
24009
 
24450
- }
24010
+ glInternalFormat = _gl.DEPTH24_STENCIL8;
24451
24011
 
24452
24012
  }
24453
24013
 
@@ -24473,7 +24033,7 @@
24473
24033
  // if there are no manual mipmaps
24474
24034
  // set 0 level mipmap and then use GL to generate other mipmap levels
24475
24035
 
24476
- if ( mipmaps.length > 0 && supportsMips ) {
24036
+ if ( mipmaps.length > 0 ) {
24477
24037
 
24478
24038
  if ( useTexStorage && allocateMemory ) {
24479
24039
 
@@ -24720,11 +24280,13 @@
24720
24280
  // if there are no manual mipmaps
24721
24281
  // set 0 level mipmap and then use GL to generate other mipmap levels
24722
24282
 
24723
- if ( mipmaps.length > 0 && supportsMips ) {
24283
+ if ( mipmaps.length > 0 ) {
24724
24284
 
24725
24285
  if ( useTexStorage && allocateMemory ) {
24726
24286
 
24727
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
24287
+ const dimensions = getDimensions( mipmaps[ 0 ] );
24288
+
24289
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
24728
24290
 
24729
24291
  }
24730
24292
 
@@ -24756,7 +24318,9 @@
24756
24318
 
24757
24319
  if ( allocateMemory ) {
24758
24320
 
24759
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
24321
+ const dimensions = getDimensions( image );
24322
+
24323
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
24760
24324
 
24761
24325
  }
24762
24326
 
@@ -24776,7 +24340,7 @@
24776
24340
 
24777
24341
  }
24778
24342
 
24779
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
24343
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
24780
24344
 
24781
24345
  generateMipmap( textureType );
24782
24346
 
@@ -24825,7 +24389,7 @@
24825
24389
 
24826
24390
  if ( ! isCompressed && ! isDataTexture ) {
24827
24391
 
24828
- cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
24392
+ cubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );
24829
24393
 
24830
24394
  } else {
24831
24395
 
@@ -24838,17 +24402,16 @@
24838
24402
  }
24839
24403
 
24840
24404
  const image = cubeImage[ 0 ],
24841
- supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
24842
24405
  glFormat = utils.convert( texture.format, texture.colorSpace ),
24843
24406
  glType = utils.convert( texture.type ),
24844
24407
  glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
24845
24408
 
24846
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
24409
+ const useTexStorage = ( texture.isVideoTexture !== true );
24847
24410
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24848
24411
  const dataReady = source.dataReady;
24849
- let levels = getMipLevels( texture, image, supportsMips );
24412
+ let levels = getMipLevels( texture, image );
24850
24413
 
24851
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
24414
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
24852
24415
 
24853
24416
  let mipmaps;
24854
24417
 
@@ -24926,7 +24489,9 @@
24926
24489
 
24927
24490
  if ( mipmaps.length > 0 ) levels ++;
24928
24491
 
24929
- state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
24492
+ const dimensions = getDimensions( cubeImage[ 0 ] );
24493
+
24494
+ state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );
24930
24495
 
24931
24496
  }
24932
24497
 
@@ -25011,7 +24576,7 @@
25011
24576
 
25012
24577
  }
25013
24578
 
25014
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
24579
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25015
24580
 
25016
24581
  // We assume images for cube map have the same size.
25017
24582
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
@@ -25079,7 +24644,7 @@
25079
24644
 
25080
24645
  if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
25081
24646
 
25082
- let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
24647
+ let glInternalFormat = _gl.DEPTH_COMPONENT24;
25083
24648
 
25084
24649
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
25085
24650
 
@@ -25142,7 +24707,7 @@
25142
24707
 
25143
24708
  } else {
25144
24709
 
25145
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
24710
+ const textures = renderTarget.textures;
25146
24711
 
25147
24712
  for ( let i = 0; i < textures.length; i ++ ) {
25148
24713
 
@@ -25306,7 +24871,12 @@
25306
24871
 
25307
24872
  renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
25308
24873
 
25309
- if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
24874
+ const textures = renderTarget.textures;
24875
+
24876
+ const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
24877
+ const isMultipleRenderTargets = ( textures.length > 1 );
24878
+
24879
+ if ( ! isMultipleRenderTargets ) {
25310
24880
 
25311
24881
  if ( textureProperties.__webglTexture === undefined ) {
25312
24882
 
@@ -25319,10 +24889,6 @@
25319
24889
 
25320
24890
  }
25321
24891
 
25322
- const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
25323
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25324
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25325
-
25326
24892
  // Setup framebuffer
25327
24893
 
25328
24894
  if ( isCube ) {
@@ -25331,7 +24897,7 @@
25331
24897
 
25332
24898
  for ( let i = 0; i < 6; i ++ ) {
25333
24899
 
25334
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
24900
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
25335
24901
 
25336
24902
  renderTargetProperties.__webglFramebuffer[ i ] = [];
25337
24903
 
@@ -25351,7 +24917,7 @@
25351
24917
 
25352
24918
  } else {
25353
24919
 
25354
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
24920
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
25355
24921
 
25356
24922
  renderTargetProperties.__webglFramebuffer = [];
25357
24923
 
@@ -25369,35 +24935,23 @@
25369
24935
 
25370
24936
  if ( isMultipleRenderTargets ) {
25371
24937
 
25372
- if ( capabilities.drawBuffers ) {
25373
-
25374
- const textures = renderTarget.texture;
24938
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
25375
24939
 
25376
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
24940
+ const attachmentProperties = properties.get( textures[ i ] );
25377
24941
 
25378
- const attachmentProperties = properties.get( textures[ i ] );
24942
+ if ( attachmentProperties.__webglTexture === undefined ) {
25379
24943
 
25380
- if ( attachmentProperties.__webglTexture === undefined ) {
24944
+ attachmentProperties.__webglTexture = _gl.createTexture();
25381
24945
 
25382
- attachmentProperties.__webglTexture = _gl.createTexture();
25383
-
25384
- info.memory.textures ++;
25385
-
25386
- }
24946
+ info.memory.textures ++;
25387
24947
 
25388
24948
  }
25389
24949
 
25390
- } else {
25391
-
25392
- console.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
25393
-
25394
24950
  }
25395
24951
 
25396
24952
  }
25397
24953
 
25398
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25399
-
25400
- const textures = isMultipleRenderTargets ? texture : [ texture ];
24954
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25401
24955
 
25402
24956
  renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
25403
24957
  renderTargetProperties.__webglColorRenderbuffer = [];
@@ -25441,11 +24995,11 @@
25441
24995
  if ( isCube ) {
25442
24996
 
25443
24997
  state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
25444
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
24998
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
25445
24999
 
25446
25000
  for ( let i = 0; i < 6; i ++ ) {
25447
25001
 
25448
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25002
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
25449
25003
 
25450
25004
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
25451
25005
 
@@ -25461,7 +25015,7 @@
25461
25015
 
25462
25016
  }
25463
25017
 
25464
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25018
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25465
25019
 
25466
25020
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
25467
25021
 
@@ -25471,18 +25025,16 @@
25471
25025
 
25472
25026
  } else if ( isMultipleRenderTargets ) {
25473
25027
 
25474
- const textures = renderTarget.texture;
25475
-
25476
25028
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
25477
25029
 
25478
25030
  const attachment = textures[ i ];
25479
25031
  const attachmentProperties = properties.get( attachment );
25480
25032
 
25481
25033
  state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
25482
- setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
25034
+ setTextureParameters( _gl.TEXTURE_2D, attachment );
25483
25035
  setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
25484
25036
 
25485
- if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
25037
+ if ( textureNeedsGenerateMipmaps( attachment ) ) {
25486
25038
 
25487
25039
  generateMipmap( _gl.TEXTURE_2D );
25488
25040
 
@@ -25498,22 +25050,14 @@
25498
25050
 
25499
25051
  if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
25500
25052
 
25501
- if ( isWebGL2 ) {
25502
-
25503
- glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
25504
-
25505
- } else {
25506
-
25507
- console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
25508
-
25509
- }
25053
+ glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
25510
25054
 
25511
25055
  }
25512
25056
 
25513
25057
  state.bindTexture( glTextureType, textureProperties.__webglTexture );
25514
- setTextureParameters( glTextureType, texture, supportsMips );
25058
+ setTextureParameters( glTextureType, texture );
25515
25059
 
25516
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25060
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
25517
25061
 
25518
25062
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
25519
25063
 
@@ -25527,7 +25071,7 @@
25527
25071
 
25528
25072
  }
25529
25073
 
25530
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25074
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25531
25075
 
25532
25076
  generateMipmap( glTextureType );
25533
25077
 
@@ -25549,15 +25093,13 @@
25549
25093
 
25550
25094
  function updateRenderTargetMipmap( renderTarget ) {
25551
25095
 
25552
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25553
-
25554
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25096
+ const textures = renderTarget.textures;
25555
25097
 
25556
25098
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
25557
25099
 
25558
25100
  const texture = textures[ i ];
25559
25101
 
25560
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25102
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25561
25103
 
25562
25104
  const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
25563
25105
  const webglTexture = properties.get( texture ).__webglTexture;
@@ -25574,16 +25116,16 @@
25574
25116
 
25575
25117
  function updateMultisampleRenderTarget( renderTarget ) {
25576
25118
 
25577
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25119
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25578
25120
 
25579
- const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
25121
+ const textures = renderTarget.textures;
25580
25122
  const width = renderTarget.width;
25581
25123
  const height = renderTarget.height;
25582
25124
  let mask = _gl.COLOR_BUFFER_BIT;
25583
25125
  const invalidationArray = [];
25584
25126
  const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
25585
25127
  const renderTargetProperties = properties.get( renderTarget );
25586
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25128
+ const isMultipleRenderTargets = ( textures.length > 1 );
25587
25129
 
25588
25130
  // If MRT we need to remove FBO attachments
25589
25131
  if ( isMultipleRenderTargets ) {
@@ -25618,7 +25160,10 @@
25618
25160
  if ( ignoreDepthValues === false ) {
25619
25161
 
25620
25162
  if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
25621
- if ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;
25163
+
25164
+ // resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
25165
+
25166
+ if ( renderTarget.stencilBuffer && renderTargetProperties.__isTransmissionRenderTarget !== true ) mask |= _gl.STENCIL_BUFFER_BIT;
25622
25167
 
25623
25168
  }
25624
25169
 
@@ -25689,7 +25234,7 @@
25689
25234
 
25690
25235
  const renderTargetProperties = properties.get( renderTarget );
25691
25236
 
25692
- return isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
25237
+ return renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
25693
25238
 
25694
25239
  }
25695
25240
 
@@ -25714,7 +25259,7 @@
25714
25259
  const format = texture.format;
25715
25260
  const type = texture.type;
25716
25261
 
25717
- if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25262
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;
25718
25263
 
25719
25264
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
25720
25265
 
@@ -25722,48 +25267,48 @@
25722
25267
 
25723
25268
  if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
25724
25269
 
25725
- if ( isWebGL2 === false ) {
25726
-
25727
- // in WebGL 1, try to use EXT_sRGB extension and unsized formats
25270
+ // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
25728
25271
 
25729
- if ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {
25272
+ if ( format !== RGBAFormat || type !== UnsignedByteType ) {
25730
25273
 
25731
- texture.format = _SRGBAFormat;
25274
+ console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
25732
25275
 
25733
- // it's not possible to generate mips in WebGL 1 with this extension
25276
+ }
25734
25277
 
25735
- texture.minFilter = LinearFilter;
25736
- texture.generateMipmaps = false;
25278
+ } else {
25737
25279
 
25738
- } else {
25280
+ console.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );
25739
25281
 
25740
- // slow fallback (CPU decode)
25282
+ }
25741
25283
 
25742
- image = ImageUtils.sRGBToLinear( image );
25284
+ }
25743
25285
 
25744
- }
25286
+ return image;
25745
25287
 
25746
- } else {
25288
+ }
25747
25289
 
25748
- // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
25290
+ function getDimensions( image ) {
25749
25291
 
25750
- if ( format !== RGBAFormat || type !== UnsignedByteType ) {
25292
+ if ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {
25751
25293
 
25752
- console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
25294
+ // if intrinsic data are not available, fallback to width/height
25753
25295
 
25754
- }
25296
+ _imageDimensions.width = image.naturalWidth || image.width;
25297
+ _imageDimensions.height = image.naturalHeight || image.height;
25755
25298
 
25756
- }
25299
+ } else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {
25757
25300
 
25758
- } else {
25301
+ _imageDimensions.width = image.displayWidth;
25302
+ _imageDimensions.height = image.displayHeight;
25759
25303
 
25760
- console.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );
25304
+ } else {
25761
25305
 
25762
- }
25306
+ _imageDimensions.width = image.width;
25307
+ _imageDimensions.height = image.height;
25763
25308
 
25764
25309
  }
25765
25310
 
25766
- return image;
25311
+ return _imageDimensions;
25767
25312
 
25768
25313
  }
25769
25314
 
@@ -25786,9 +25331,7 @@
25786
25331
 
25787
25332
  }
25788
25333
 
25789
- function WebGLUtils( gl, extensions, capabilities ) {
25790
-
25791
- const isWebGL2 = capabilities.isWebGL2;
25334
+ function WebGLUtils( gl, extensions ) {
25792
25335
 
25793
25336
  function convert( p, colorSpace = NoColorSpace ) {
25794
25337
 
@@ -25799,6 +25342,7 @@
25799
25342
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
25800
25343
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
25801
25344
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
25345
+ if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
25802
25346
 
25803
25347
  if ( p === ByteType ) return gl.BYTE;
25804
25348
  if ( p === ShortType ) return gl.SHORT;
@@ -25806,50 +25350,16 @@
25806
25350
  if ( p === IntType ) return gl.INT;
25807
25351
  if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
25808
25352
  if ( p === FloatType ) return gl.FLOAT;
25809
-
25810
- if ( p === HalfFloatType ) {
25811
-
25812
- if ( isWebGL2 ) return gl.HALF_FLOAT;
25813
-
25814
- extension = extensions.get( 'OES_texture_half_float' );
25815
-
25816
- if ( extension !== null ) {
25817
-
25818
- return extension.HALF_FLOAT_OES;
25819
-
25820
- } else {
25821
-
25822
- return null;
25823
-
25824
- }
25825
-
25826
- }
25353
+ if ( p === HalfFloatType ) return gl.HALF_FLOAT;
25827
25354
 
25828
25355
  if ( p === AlphaFormat ) return gl.ALPHA;
25356
+ if ( p === RGBFormat ) return gl.RGB;
25829
25357
  if ( p === RGBAFormat ) return gl.RGBA;
25830
25358
  if ( p === LuminanceFormat ) return gl.LUMINANCE;
25831
25359
  if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
25832
25360
  if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
25833
25361
  if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
25834
25362
 
25835
- // WebGL 1 sRGB fallback
25836
-
25837
- if ( p === _SRGBAFormat ) {
25838
-
25839
- extension = extensions.get( 'EXT_sRGB' );
25840
-
25841
- if ( extension !== null ) {
25842
-
25843
- return extension.SRGB_ALPHA_EXT;
25844
-
25845
- } else {
25846
-
25847
- return null;
25848
-
25849
- }
25850
-
25851
- }
25852
-
25853
25363
  // WebGL2 formats.
25854
25364
 
25855
25365
  if ( p === RedFormat ) return gl.RED;
@@ -26036,23 +25546,7 @@
26036
25546
 
26037
25547
  //
26038
25548
 
26039
- if ( p === UnsignedInt248Type ) {
26040
-
26041
- if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
26042
-
26043
- extension = extensions.get( 'WEBGL_depth_texture' );
26044
-
26045
- if ( extension !== null ) {
26046
-
26047
- return extension.UNSIGNED_INT_24_8_WEBGL;
26048
-
26049
- } else {
26050
-
26051
- return null;
26052
-
26053
- }
26054
-
26055
- }
25549
+ if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
26056
25550
 
26057
25551
  // if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
26058
25552
 
@@ -26448,11 +25942,11 @@ void main() {
26448
25942
 
26449
25943
  if ( coord.x >= 1.0 ) {
26450
25944
 
26451
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
25945
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
26452
25946
 
26453
25947
  } else {
26454
25948
 
26455
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
25949
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
26456
25950
 
26457
25951
  }
26458
25952
 
@@ -26500,7 +25994,6 @@ void main() {
26500
25994
 
26501
25995
  const viewport = cameraXR.cameras[ 0 ].viewport;
26502
25996
  const material = new ShaderMaterial( {
26503
- extensions: { fragDepth: true },
26504
25997
  vertexShader: _occlusion_vertex,
26505
25998
  fragmentShader: _occlusion_fragment,
26506
25999
  uniforms: {
@@ -26796,10 +26289,10 @@ void main() {
26796
26289
  currentPixelRatio = renderer.getPixelRatio();
26797
26290
  renderer.getSize( currentSize );
26798
26291
 
26799
- if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
26292
+ if ( session.renderState.layers === undefined ) {
26800
26293
 
26801
26294
  const layerInit = {
26802
- antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
26295
+ antialias: attributes.antialias,
26803
26296
  alpha: true,
26804
26297
  depth: attributes.depth,
26805
26298
  stencil: attributes.stencil,
@@ -27338,6 +26831,9 @@ void main() {
27338
26831
 
27339
26832
  }
27340
26833
 
26834
+ const _e1 = /*@__PURE__*/ new Euler();
26835
+ const _m1 = /*@__PURE__*/ new Matrix4();
26836
+
27341
26837
  function WebGLMaterials( renderer, properties ) {
27342
26838
 
27343
26839
  function refreshTransformUniform( map, uniform ) {
@@ -27546,12 +27042,30 @@ void main() {
27546
27042
 
27547
27043
  }
27548
27044
 
27549
- const envMap = properties.get( material ).envMap;
27045
+ const materialProperties = properties.get( material );
27046
+
27047
+ const envMap = materialProperties.envMap;
27048
+ const envMapRotation = materialProperties.envMapRotation;
27550
27049
 
27551
27050
  if ( envMap ) {
27552
27051
 
27553
27052
  uniforms.envMap.value = envMap;
27554
27053
 
27054
+ _e1.copy( envMapRotation );
27055
+
27056
+ // accommodate left-handed frame
27057
+ _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
27058
+
27059
+ if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
27060
+
27061
+ // environment maps which are not cube render targets or PMREMs follow a different convention
27062
+ _e1.y *= - 1;
27063
+ _e1.z *= - 1;
27064
+
27065
+ }
27066
+
27067
+ uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
27068
+
27555
27069
  uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
27556
27070
 
27557
27071
  uniforms.reflectivity.value = material.reflectivity;
@@ -27707,11 +27221,10 @@ void main() {
27707
27221
 
27708
27222
  }
27709
27223
 
27710
- const envMap = properties.get( material ).envMap;
27711
-
27712
- if ( envMap ) {
27224
+ if ( material.envMap ) {
27713
27225
 
27714
27226
  //uniforms.envMap.value = material.envMap; // part of uniforms common
27227
+
27715
27228
  uniforms.envMapIntensity.value = material.envMapIntensity;
27716
27229
 
27717
27230
  }
@@ -27907,7 +27420,7 @@ void main() {
27907
27420
  let updateList = {};
27908
27421
  let allocatedBindingPoints = [];
27909
27422
 
27910
- const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program
27423
+ const maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program
27911
27424
 
27912
27425
  function bind( uniformsGroup, program ) {
27913
27426
 
@@ -28299,7 +27812,7 @@ void main() {
28299
27812
  canvas = createCanvasElement(),
28300
27813
  context = null,
28301
27814
  depth = true,
28302
- stencil = true,
27815
+ stencil = false,
28303
27816
  alpha = false,
28304
27817
  antialias = false,
28305
27818
  premultipliedAlpha = true,
@@ -28314,6 +27827,12 @@ void main() {
28314
27827
 
28315
27828
  if ( context !== null ) {
28316
27829
 
27830
+ if ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {
27831
+
27832
+ throw new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );
27833
+
27834
+ }
27835
+
28317
27836
  _alpha = context.getContextAttributes().alpha;
28318
27837
 
28319
27838
  } else {
@@ -28426,10 +27945,6 @@ void main() {
28426
27945
  let _clippingEnabled = false;
28427
27946
  let _localClippingEnabled = false;
28428
27947
 
28429
- // transmission
28430
-
28431
- let _transmissionRenderTarget = null;
28432
-
28433
27948
  // camera matrices cache
28434
27949
 
28435
27950
  const _projScreenMatrix = new Matrix4();
@@ -28449,15 +27964,10 @@ void main() {
28449
27964
 
28450
27965
  let _gl = context;
28451
27966
 
28452
- function getContext( contextNames, contextAttributes ) {
28453
-
28454
- for ( let i = 0; i < contextNames.length; i ++ ) {
27967
+ function getContext( contextName, contextAttributes ) {
28455
27968
 
28456
- const contextName = contextNames[ i ];
28457
- const context = canvas.getContext( contextName, contextAttributes );
28458
- if ( context !== null ) return context;
28459
-
28460
- }
27969
+ const context = canvas.getContext( contextName, contextAttributes );
27970
+ if ( context !== null ) return context;
28461
27971
 
28462
27972
  return null;
28463
27973
 
@@ -28486,19 +27996,13 @@ void main() {
28486
27996
 
28487
27997
  if ( _gl === null ) {
28488
27998
 
28489
- const contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];
28490
-
28491
- if ( _this.isWebGL1Renderer === true ) {
28492
-
28493
- contextNames.shift();
27999
+ const contextName = 'webgl2';
28494
28000
 
28495
- }
28496
-
28497
- _gl = getContext( contextNames, contextAttributes );
28001
+ _gl = getContext( contextName, contextAttributes );
28498
28002
 
28499
28003
  if ( _gl === null ) {
28500
28004
 
28501
- if ( getContext( contextNames ) ) {
28005
+ if ( getContext( contextName ) ) {
28502
28006
 
28503
28007
  throw new Error( 'Error creating WebGL context with your selected attributes.' );
28504
28008
 
@@ -28512,24 +28016,6 @@ void main() {
28512
28016
 
28513
28017
  }
28514
28018
 
28515
- if ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
28516
-
28517
- console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
28518
-
28519
- }
28520
-
28521
- // Some experimental-webgl implementations do not have getShaderPrecisionFormat
28522
-
28523
- if ( _gl.getShaderPrecisionFormat === undefined ) {
28524
-
28525
- _gl.getShaderPrecisionFormat = function () {
28526
-
28527
- return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
28528
-
28529
- };
28530
-
28531
- }
28532
-
28533
28019
  } catch ( error ) {
28534
28020
 
28535
28021
  console.error( 'THREE.WebGLRenderer: ' + error.message );
@@ -28548,22 +28034,21 @@ void main() {
28548
28034
  function initGLContext() {
28549
28035
 
28550
28036
  extensions = new WebGLExtensions( _gl );
28037
+ extensions.init();
28551
28038
 
28552
28039
  capabilities = new WebGLCapabilities( _gl, extensions, parameters );
28553
28040
 
28554
- extensions.init( capabilities );
28555
-
28556
- utils = new WebGLUtils( _gl, extensions, capabilities );
28041
+ utils = new WebGLUtils( _gl, extensions );
28557
28042
 
28558
- state = new WebGLState( _gl, extensions, capabilities );
28043
+ state = new WebGLState( _gl );
28559
28044
 
28560
28045
  info = new WebGLInfo( _gl );
28561
28046
  properties = new WebGLProperties();
28562
28047
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
28563
28048
  cubemaps = new WebGLCubeMaps( _this );
28564
28049
  cubeuvmaps = new WebGLCubeUVMaps( _this );
28565
- attributes = new WebGLAttributes( _gl, capabilities );
28566
- bindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );
28050
+ attributes = new WebGLAttributes( _gl );
28051
+ bindingStates = new WebGLBindingStates( _gl, attributes );
28567
28052
  geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
28568
28053
  objects = new WebGLObjects( _gl, geometries, attributes, info );
28569
28054
  morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
@@ -28571,13 +28056,13 @@ void main() {
28571
28056
  programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
28572
28057
  materials = new WebGLMaterials( _this, properties );
28573
28058
  renderLists = new WebGLRenderLists();
28574
- renderStates = new WebGLRenderStates( extensions, capabilities );
28059
+ renderStates = new WebGLRenderStates( extensions );
28575
28060
  background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
28576
28061
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
28577
28062
  uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
28578
28063
 
28579
- bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
28580
- indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );
28064
+ bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );
28065
+ indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );
28581
28066
 
28582
28067
  info.programs = programCache.programs;
28583
28068
 
@@ -28719,7 +28204,7 @@ void main() {
28719
28204
 
28720
28205
  }
28721
28206
 
28722
- state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
28207
+ state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );
28723
28208
 
28724
28209
  };
28725
28210
 
@@ -28741,7 +28226,7 @@ void main() {
28741
28226
 
28742
28227
  }
28743
28228
 
28744
- state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
28229
+ state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );
28745
28230
 
28746
28231
  };
28747
28232
 
@@ -28909,13 +28394,6 @@ void main() {
28909
28394
  xr.removeEventListener( 'sessionstart', onXRSessionStart );
28910
28395
  xr.removeEventListener( 'sessionend', onXRSessionEnd );
28911
28396
 
28912
- if ( _transmissionRenderTarget ) {
28913
-
28914
- _transmissionRenderTarget.dispose();
28915
- _transmissionRenderTarget = null;
28916
-
28917
- }
28918
-
28919
28397
  animation.stop();
28920
28398
 
28921
28399
  };
@@ -29667,17 +29145,19 @@ void main() {
29667
29145
 
29668
29146
  }
29669
29147
 
29670
- const isWebGL2 = capabilities.isWebGL2;
29671
-
29672
- if ( _transmissionRenderTarget === null ) {
29148
+ if ( currentRenderState.state.transmissionRenderTarget === null ) {
29673
29149
 
29674
- _transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
29150
+ currentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
29675
29151
  generateMipmaps: true,
29676
- type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
29152
+ type: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,
29677
29153
  minFilter: LinearMipmapLinearFilter,
29678
- samples: ( isWebGL2 ) ? 4 : 0
29154
+ samples: 4,
29155
+ stencilBuffer: stencil
29679
29156
  } );
29680
29157
 
29158
+ const renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );
29159
+ renderTargetProperties.__isTransmissionRenderTarget = true;
29160
+
29681
29161
  // debug
29682
29162
 
29683
29163
  /*
@@ -29690,22 +29170,15 @@ void main() {
29690
29170
 
29691
29171
  }
29692
29172
 
29693
- _this.getDrawingBufferSize( _vector2 );
29694
-
29695
- if ( isWebGL2 ) {
29696
-
29697
- _transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
29698
-
29699
- } else {
29173
+ const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;
29700
29174
 
29701
- _transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
29702
-
29703
- }
29175
+ _this.getDrawingBufferSize( _vector2 );
29176
+ transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
29704
29177
 
29705
29178
  //
29706
29179
 
29707
29180
  const currentRenderTarget = _this.getRenderTarget();
29708
- _this.setRenderTarget( _transmissionRenderTarget );
29181
+ _this.setRenderTarget( transmissionRenderTarget );
29709
29182
 
29710
29183
  _this.getClearColor( _currentClearColor );
29711
29184
  _currentClearAlpha = _this.getClearAlpha();
@@ -29720,8 +29193,8 @@ void main() {
29720
29193
 
29721
29194
  renderObjects( opaqueObjects, scene, camera );
29722
29195
 
29723
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
29724
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
29196
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
29197
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
29725
29198
 
29726
29199
  let renderTargetNeedsUpdate = false;
29727
29200
 
@@ -29754,8 +29227,8 @@ void main() {
29754
29227
 
29755
29228
  if ( renderTargetNeedsUpdate === true ) {
29756
29229
 
29757
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
29758
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
29230
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
29231
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
29759
29232
 
29760
29233
  }
29761
29234
 
@@ -29842,6 +29315,7 @@ void main() {
29842
29315
  materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
29843
29316
  materialProperties.fog = scene.fog;
29844
29317
  materialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );
29318
+ materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
29845
29319
 
29846
29320
  if ( programs === undefined ) {
29847
29321
 
@@ -29954,6 +29428,7 @@ void main() {
29954
29428
  materialProperties.batching = parameters.batching;
29955
29429
  materialProperties.instancing = parameters.instancing;
29956
29430
  materialProperties.instancingColor = parameters.instancingColor;
29431
+ materialProperties.instancingMorph = parameters.instancingMorph;
29957
29432
  materialProperties.skinning = parameters.skinning;
29958
29433
  materialProperties.morphTargets = parameters.morphTargets;
29959
29434
  materialProperties.morphNormals = parameters.morphNormals;
@@ -30064,6 +29539,14 @@ void main() {
30064
29539
 
30065
29540
  needsProgramChange = true;
30066
29541
 
29542
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {
29543
+
29544
+ needsProgramChange = true;
29545
+
29546
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {
29547
+
29548
+ needsProgramChange = true;
29549
+
30067
29550
  } else if ( materialProperties.envMap !== envMap ) {
30068
29551
 
30069
29552
  needsProgramChange = true;
@@ -30102,7 +29585,7 @@ void main() {
30102
29585
 
30103
29586
  needsProgramChange = true;
30104
29587
 
30105
- } else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {
29588
+ } else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {
30106
29589
 
30107
29590
  needsProgramChange = true;
30108
29591
 
@@ -30211,17 +29694,9 @@ void main() {
30211
29694
 
30212
29695
  if ( skeleton ) {
30213
29696
 
30214
- if ( capabilities.floatVertexTextures ) {
30215
-
30216
- if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
30217
-
30218
- p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
30219
-
30220
- } else {
29697
+ if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
30221
29698
 
30222
- console.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
30223
-
30224
- }
29699
+ p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
30225
29700
 
30226
29701
  }
30227
29702
 
@@ -30236,7 +29711,7 @@ void main() {
30236
29711
 
30237
29712
  const morphAttributes = geometry.morphAttributes;
30238
29713
 
30239
- if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
29714
+ if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {
30240
29715
 
30241
29716
  morphtargets.update( object, geometry, program );
30242
29717
 
@@ -30259,6 +29734,12 @@ void main() {
30259
29734
 
30260
29735
  }
30261
29736
 
29737
+ if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
29738
+
29739
+ m_uniforms.envMapIntensity.value = scene.environmentIntensity;
29740
+
29741
+ }
29742
+
30262
29743
  if ( refreshMaterial ) {
30263
29744
 
30264
29745
  p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
@@ -30286,7 +29767,7 @@ void main() {
30286
29767
 
30287
29768
  }
30288
29769
 
30289
- materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );
29770
+ materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );
30290
29771
 
30291
29772
  WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
30292
29773
 
@@ -30319,18 +29800,10 @@ void main() {
30319
29800
 
30320
29801
  for ( let i = 0, l = groups.length; i < l; i ++ ) {
30321
29802
 
30322
- if ( capabilities.isWebGL2 ) {
30323
-
30324
- const group = groups[ i ];
30325
-
30326
- uniformsGroups.update( group, program );
30327
- uniformsGroups.bind( group, program );
30328
-
30329
- } else {
29803
+ const group = groups[ i ];
30330
29804
 
30331
- console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
30332
-
30333
- }
29805
+ uniformsGroups.update( group, program );
29806
+ uniformsGroups.bind( group, program );
30334
29807
 
30335
29808
  }
30336
29809
 
@@ -30392,20 +29865,16 @@ void main() {
30392
29865
  const renderTargetProperties = properties.get( renderTarget );
30393
29866
  renderTargetProperties.__hasExternalTextures = true;
30394
29867
 
30395
- if ( renderTargetProperties.__hasExternalTextures ) {
30396
-
30397
- renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
29868
+ renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
30398
29869
 
30399
- if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
29870
+ if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
30400
29871
 
30401
- // The multisample_render_to_texture extension doesn't work properly if there
30402
- // are midframe flushes and an external depth buffer. Disable use of the extension.
30403
- if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
29872
+ // The multisample_render_to_texture extension doesn't work properly if there
29873
+ // are midframe flushes and an external depth buffer. Disable use of the extension.
29874
+ if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
30404
29875
 
30405
- console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
30406
- renderTargetProperties.__useRenderToTexture = false;
30407
-
30408
- }
29876
+ console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
29877
+ renderTargetProperties.__useRenderToTexture = false;
30409
29878
 
30410
29879
  }
30411
29880
 
@@ -30477,7 +29946,7 @@ void main() {
30477
29946
 
30478
29947
  isCube = true;
30479
29948
 
30480
- } else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
29949
+ } else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
30481
29950
 
30482
29951
  framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
30483
29952
 
@@ -30509,7 +29978,7 @@ void main() {
30509
29978
 
30510
29979
  const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
30511
29980
 
30512
- if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
29981
+ if ( framebufferBound && useDefaultFramebuffer ) {
30513
29982
 
30514
29983
  state.drawBuffers( renderTarget, framebuffer );
30515
29984
 
@@ -30570,11 +30039,10 @@ void main() {
30570
30039
 
30571
30040
  }
30572
30041
 
30573
- const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );
30042
+ const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
30574
30043
 
30575
30044
  if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
30576
- ! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
30577
- ! halfFloatSupportedByExt ) {
30045
+ textureType !== FloatType && ! halfFloatSupportedByExt ) {
30578
30046
 
30579
30047
  console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
30580
30048
  return;
@@ -30658,15 +30126,8 @@ void main() {
30658
30126
 
30659
30127
  this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {
30660
30128
 
30661
- if ( _this.isWebGL1Renderer ) {
30662
-
30663
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );
30664
- return;
30665
-
30666
- }
30667
-
30668
- const width = sourceBox.max.x - sourceBox.min.x + 1;
30669
- const height = sourceBox.max.y - sourceBox.min.y + 1;
30129
+ const width = Math.round( sourceBox.max.x - sourceBox.min.x );
30130
+ const height = Math.round( sourceBox.max.y - sourceBox.min.y );
30670
30131
  const depth = sourceBox.max.z - sourceBox.min.z + 1;
30671
30132
  const glFormat = utils.convert( dstTexture.format );
30672
30133
  const glType = utils.convert( dstTexture.type );
@@ -30713,9 +30174,8 @@ void main() {
30713
30174
 
30714
30175
  } else {
30715
30176
 
30716
- if ( srcTexture.isCompressedArrayTexture ) {
30177
+ if ( dstTexture.isCompressedArrayTexture ) {
30717
30178
 
30718
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
30719
30179
  _gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
30720
30180
 
30721
30181
  } else {
@@ -30804,20 +30264,6 @@ void main() {
30804
30264
 
30805
30265
  }
30806
30266
 
30807
- get outputEncoding() { // @deprecated, r152
30808
-
30809
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30810
- return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
30811
-
30812
- }
30813
-
30814
- set outputEncoding( encoding ) { // @deprecated, r152
30815
-
30816
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
30817
- this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
30818
-
30819
- }
30820
-
30821
30267
  get useLegacyLights() { // @deprecated, r155
30822
30268
 
30823
30269
  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.' );
@@ -30834,10 +30280,6 @@ void main() {
30834
30280
 
30835
30281
  }
30836
30282
 
30837
- class WebGL1Renderer extends WebGLRenderer {}
30838
-
30839
- WebGL1Renderer.prototype.isWebGL1Renderer = true;
30840
-
30841
30283
  class Scene extends Object3D {
30842
30284
 
30843
30285
  constructor() {
@@ -30854,6 +30296,10 @@ void main() {
30854
30296
 
30855
30297
  this.backgroundBlurriness = 0;
30856
30298
  this.backgroundIntensity = 1;
30299
+ this.backgroundRotation = new Euler();
30300
+
30301
+ this.environmentIntensity = 1;
30302
+ this.environmentRotation = new Euler();
30857
30303
 
30858
30304
  this.overrideMaterial = null;
30859
30305
 
@@ -30875,6 +30321,10 @@ void main() {
30875
30321
 
30876
30322
  this.backgroundBlurriness = source.backgroundBlurriness;
30877
30323
  this.backgroundIntensity = source.backgroundIntensity;
30324
+ this.backgroundRotation.copy( source.backgroundRotation );
30325
+
30326
+ this.environmentIntensity = source.environmentIntensity;
30327
+ this.environmentRotation.copy( source.environmentRotation );
30878
30328
 
30879
30329
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
30880
30330
 
@@ -30889,8 +30339,13 @@ void main() {
30889
30339
  const data = super.toJSON( meta );
30890
30340
 
30891
30341
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
30342
+
30892
30343
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
30893
30344
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
30345
+ data.object.backgroundRotation = this.backgroundRotation.toArray();
30346
+
30347
+ if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
30348
+ data.object.environmentRotation = this.environmentRotation.toArray();
30894
30349
 
30895
30350
  return data;
30896
30351
 
@@ -32181,9 +31636,9 @@ void main() {
32181
31636
 
32182
31637
  }
32183
31638
 
32184
- getPoint( t, optionalTarget ) {
31639
+ getPoint( t, optionalTarget = new Vector2() ) {
32185
31640
 
32186
- const point = optionalTarget || new Vector2();
31641
+ const point = optionalTarget;
32187
31642
 
32188
31643
  const twoPi = Math.PI * 2;
32189
31644
  let deltaAngle = this.aEndAngle - this.aStartAngle;
@@ -36317,6 +35772,7 @@ void main() {
36317
35772
  this.alphaMap = null;
36318
35773
 
36319
35774
  this.envMap = null;
35775
+ this.envMapRotation = new Euler();
36320
35776
  this.combine = MultiplyOperation;
36321
35777
  this.reflectivity = 1;
36322
35778
  this.refractionRatio = 0.98;
@@ -36370,6 +35826,7 @@ void main() {
36370
35826
  this.alphaMap = source.alphaMap;
36371
35827
 
36372
35828
  this.envMap = source.envMap;
35829
+ this.envMapRotation.copy( source.envMapRotation );
36373
35830
  this.combine = source.combine;
36374
35831
  this.reflectivity = source.reflectivity;
36375
35832
  this.refractionRatio = source.refractionRatio;
@@ -36429,6 +35886,7 @@ void main() {
36429
35886
  this.alphaMap = null;
36430
35887
 
36431
35888
  this.envMap = null;
35889
+ this.envMapRotation = new Euler();
36432
35890
  this.combine = MultiplyOperation;
36433
35891
  this.reflectivity = 1;
36434
35892
  this.refractionRatio = 0.98;
@@ -36480,6 +35938,7 @@ void main() {
36480
35938
  this.alphaMap = source.alphaMap;
36481
35939
 
36482
35940
  this.envMap = source.envMap;
35941
+ this.envMapRotation.copy( source.envMapRotation );
36483
35942
  this.combine = source.combine;
36484
35943
  this.reflectivity = source.reflectivity;
36485
35944
  this.refractionRatio = source.refractionRatio;
@@ -37282,6 +36741,8 @@ void main() {
37282
36741
 
37283
36742
  }
37284
36743
 
36744
+ const _matrix = /*@__PURE__*/ new Matrix4();
36745
+
37285
36746
  class Raycaster {
37286
36747
 
37287
36748
  constructor( origin, direction, near = 0, far = Infinity ) {
@@ -37334,9 +36795,20 @@ void main() {
37334
36795
 
37335
36796
  }
37336
36797
 
36798
+ setFromXRController( controller ) {
36799
+
36800
+ _matrix.identity().extractRotation( controller.matrixWorld );
36801
+
36802
+ this.ray.origin.setFromMatrixPosition( controller.matrixWorld );
36803
+ this.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );
36804
+
36805
+ return this;
36806
+
36807
+ }
36808
+
37337
36809
  intersectObject( object, recursive = true, intersects = [] ) {
37338
36810
 
37339
- intersectObject( object, this, intersects, recursive );
36811
+ intersect( object, this, intersects, recursive );
37340
36812
 
37341
36813
  intersects.sort( ascSort );
37342
36814
 
@@ -37348,7 +36820,7 @@ void main() {
37348
36820
 
37349
36821
  for ( let i = 0, l = objects.length; i < l; i ++ ) {
37350
36822
 
37351
- intersectObject( objects[ i ], this, intersects, recursive );
36823
+ intersect( objects[ i ], this, intersects, recursive );
37352
36824
 
37353
36825
  }
37354
36826
 
@@ -37366,7 +36838,7 @@ void main() {
37366
36838
 
37367
36839
  }
37368
36840
 
37369
- function intersectObject( object, raycaster, intersects, recursive ) {
36841
+ function intersect( object, raycaster, intersects, recursive ) {
37370
36842
 
37371
36843
  if ( object.layers.test( raycaster.layers ) ) {
37372
36844
 
@@ -37380,7 +36852,7 @@ void main() {
37380
36852
 
37381
36853
  for ( let i = 0, l = children.length; i < l; i ++ ) {
37382
36854
 
37383
- intersectObject( children[ i ], raycaster, intersects, true );
36855
+ intersect( children[ i ], raycaster, intersects, true );
37384
36856
 
37385
36857
  }
37386
36858
 
@@ -37391,11 +36863,9 @@ void main() {
37391
36863
  /**
37392
36864
  * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
37393
36865
  *
37394
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
37395
- * The azimuthal angle (theta) is measured from the positive z-axis.
36866
+ * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.
36867
+ * theta (the azimuthal angle) is measured from the positive z-axis.
37396
36868
  */
37397
-
37398
-
37399
36869
  class Spherical {
37400
36870
 
37401
36871
  constructor( radius = 1, phi = 0, theta = 0 ) {
@@ -38588,10 +38058,7 @@ void main() {
38588
38058
  f = !0,
38589
38059
  o = !1;
38590
38060
  try {
38591
- if (i = (t = t.call(r)).next, 0 === l) {
38592
- if (Object(t) !== t) return;
38593
- f = !1;
38594
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
38061
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
38595
38062
  } catch (r) {
38596
38063
  o = !0, n = r;
38597
38064
  } finally {
@@ -38609,18 +38076,7 @@ void main() {
38609
38076
  throw new TypeError("Cannot call a class as a function");
38610
38077
  }
38611
38078
  }
38612
- function _defineProperties$3(target, props) {
38613
- for (var i = 0; i < props.length; i++) {
38614
- var descriptor = props[i];
38615
- descriptor.enumerable = descriptor.enumerable || false;
38616
- descriptor.configurable = true;
38617
- if ("value" in descriptor) descriptor.writable = true;
38618
- Object.defineProperty(target, _toPropertyKey$6(descriptor.key), descriptor);
38619
- }
38620
- }
38621
38079
  function _createClass$3(Constructor, protoProps, staticProps) {
38622
- if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
38623
- if (staticProps) _defineProperties$3(Constructor, staticProps);
38624
38080
  Object.defineProperty(Constructor, "prototype", {
38625
38081
  writable: false
38626
38082
  });
@@ -38641,27 +38097,13 @@ void main() {
38641
38097
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
38642
38098
  }
38643
38099
  function _arrayLikeToArray$6(arr, len) {
38644
- if (len == null || len > arr.length) len = arr.length;
38100
+ if (len > arr.length) len = arr.length;
38645
38101
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
38646
38102
  return arr2;
38647
38103
  }
38648
38104
  function _nonIterableRest$6() {
38649
38105
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
38650
38106
  }
38651
- function _toPrimitive$6(input, hint) {
38652
- if (typeof input !== "object" || input === null) return input;
38653
- var prim = input[Symbol.toPrimitive];
38654
- if (prim !== undefined) {
38655
- var res = prim.call(input, hint || "default");
38656
- if (typeof res !== "object") return res;
38657
- throw new TypeError("@@toPrimitive must return a primitive value.");
38658
- }
38659
- return (hint === "string" ? String : Number)(input);
38660
- }
38661
- function _toPropertyKey$6(arg) {
38662
- var key = _toPrimitive$6(arg, "string");
38663
- return typeof key === "symbol" ? key : String(key);
38664
- }
38665
38107
 
38666
38108
  var Prop = /*#__PURE__*/_createClass$3(function Prop(name, _ref) {
38667
38109
  var _ref$default = _ref["default"],
@@ -40535,21 +39977,13 @@ void main() {
40535
39977
 
40536
39978
  function max$1(values, valueof) {
40537
39979
  let max;
40538
- if (valueof === undefined) {
39980
+ {
40539
39981
  for (const value of values) {
40540
39982
  if (value != null
40541
39983
  && (max < value || (max === undefined && value >= value))) {
40542
39984
  max = value;
40543
39985
  }
40544
39986
  }
40545
- } else {
40546
- let index = -1;
40547
- for (let value of values) {
40548
- if ((value = valueof(value, ++index, values)) != null
40549
- && (max < value || (max === undefined && value >= value))) {
40550
- max = value;
40551
- }
40552
- }
40553
39987
  }
40554
39988
  return max;
40555
39989
  }
@@ -40600,19 +40034,12 @@ void main() {
40600
40034
 
40601
40035
  function sum$1(values, valueof) {
40602
40036
  let sum = 0;
40603
- if (valueof === undefined) {
40037
+ {
40604
40038
  for (let value of values) {
40605
40039
  if (value = +value) {
40606
40040
  sum += value;
40607
40041
  }
40608
40042
  }
40609
- } else {
40610
- let index = -1;
40611
- for (let value of values) {
40612
- if (value = +valueof(value, ++index, values)) {
40613
- sum += value;
40614
- }
40615
- }
40616
40043
  }
40617
40044
  return sum;
40618
40045
  }
@@ -40827,22 +40254,22 @@ void main() {
40827
40254
  ranges,
40828
40255
  range;
40829
40256
 
40830
- var boundsStream$2 = {
40257
+ var boundsStream$1 = {
40831
40258
  point: boundsPoint$1,
40832
40259
  lineStart: boundsLineStart,
40833
40260
  lineEnd: boundsLineEnd,
40834
40261
  polygonStart: function() {
40835
- boundsStream$2.point = boundsRingPoint;
40836
- boundsStream$2.lineStart = boundsRingStart;
40837
- boundsStream$2.lineEnd = boundsRingEnd;
40262
+ boundsStream$1.point = boundsRingPoint;
40263
+ boundsStream$1.lineStart = boundsRingStart;
40264
+ boundsStream$1.lineEnd = boundsRingEnd;
40838
40265
  deltaSum = new Adder();
40839
40266
  areaStream.polygonStart();
40840
40267
  },
40841
40268
  polygonEnd: function() {
40842
40269
  areaStream.polygonEnd();
40843
- boundsStream$2.point = boundsPoint$1;
40844
- boundsStream$2.lineStart = boundsLineStart;
40845
- boundsStream$2.lineEnd = boundsLineEnd;
40270
+ boundsStream$1.point = boundsPoint$1;
40271
+ boundsStream$1.lineStart = boundsLineStart;
40272
+ boundsStream$1.lineEnd = boundsLineEnd;
40846
40273
  if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);
40847
40274
  else if (deltaSum > epsilon$2) phi1 = 90;
40848
40275
  else if (deltaSum < -epsilon$2) phi0 = -90;
@@ -40909,12 +40336,12 @@ void main() {
40909
40336
  }
40910
40337
 
40911
40338
  function boundsLineStart() {
40912
- boundsStream$2.point = linePoint;
40339
+ boundsStream$1.point = linePoint;
40913
40340
  }
40914
40341
 
40915
40342
  function boundsLineEnd() {
40916
40343
  range[0] = lambda0$1, range[1] = lambda1;
40917
- boundsStream$2.point = boundsPoint$1;
40344
+ boundsStream$1.point = boundsPoint$1;
40918
40345
  p0 = null;
40919
40346
  }
40920
40347
 
@@ -40961,7 +40388,7 @@ void main() {
40961
40388
 
40962
40389
  phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
40963
40390
  ranges = [];
40964
- geoStream(feature, boundsStream$2);
40391
+ geoStream(feature, boundsStream$1);
40965
40392
 
40966
40393
  // First, sort ranges by their minimum longitudes.
40967
40394
  if (n = ranges.length) {
@@ -41667,7 +41094,7 @@ void main() {
41667
41094
 
41668
41095
  function clipCircle(radius) {
41669
41096
  var cr = cos$1(radius),
41670
- delta = 6 * radians$1,
41097
+ delta = 2 * radians$1,
41671
41098
  smallRadius = cr > 0,
41672
41099
  notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case
41673
41100
 
@@ -42377,8 +41804,6 @@ void main() {
42377
41804
  if (y > y1) y1 = y;
42378
41805
  }
42379
41806
 
42380
- var boundsStream$1 = boundsStream;
42381
-
42382
41807
  function transformer$1(methods) {
42383
41808
  return function(stream) {
42384
41809
  var s = new TransformStream;
@@ -42404,8 +41829,8 @@ void main() {
42404
41829
  var clip = projection.clipExtent && projection.clipExtent();
42405
41830
  projection.scale(150).translate([0, 0]);
42406
41831
  if (clip != null) projection.clipExtent(null);
42407
- geoStream(object, projection.stream(boundsStream$1));
42408
- fitBounds(boundsStream$1.result());
41832
+ geoStream(object, projection.stream(boundsStream));
41833
+ fitBounds(boundsStream.result());
42409
41834
  if (clip != null) projection.clipExtent(clip);
42410
41835
  return projection;
42411
41836
  }
@@ -42740,7 +42165,7 @@ void main() {
42740
42165
  }
42741
42166
 
42742
42167
  function _callSuper$2(t, o, e) {
42743
- return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf$3(t).constructor) : o.apply(t, e));
42168
+ return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, [], _getPrototypeOf$3(t).constructor) : o.apply(t, e));
42744
42169
  }
42745
42170
  function _isNativeReflectConstruct$3() {
42746
42171
  try {
@@ -42777,37 +42202,12 @@ void main() {
42777
42202
  return a;
42778
42203
  }
42779
42204
  }
42780
- function _toPrimitive$5(t, r) {
42781
- if ("object" != typeof t || !t) return t;
42782
- var e = t[Symbol.toPrimitive];
42783
- if (void 0 !== e) {
42784
- var i = e.call(t, r || "default");
42785
- if ("object" != typeof i) return i;
42786
- throw new TypeError("@@toPrimitive must return a primitive value.");
42787
- }
42788
- return ("string" === r ? String : Number)(t);
42789
- }
42790
- function _toPropertyKey$5(t) {
42791
- var i = _toPrimitive$5(t, "string");
42792
- return "symbol" == typeof i ? i : String(i);
42793
- }
42794
42205
  function _classCallCheck$2(instance, Constructor) {
42795
42206
  if (!(instance instanceof Constructor)) {
42796
42207
  throw new TypeError("Cannot call a class as a function");
42797
42208
  }
42798
42209
  }
42799
- function _defineProperties$2(target, props) {
42800
- for (var i = 0; i < props.length; i++) {
42801
- var descriptor = props[i];
42802
- descriptor.enumerable = descriptor.enumerable || false;
42803
- descriptor.configurable = true;
42804
- if ("value" in descriptor) descriptor.writable = true;
42805
- Object.defineProperty(target, _toPropertyKey$5(descriptor.key), descriptor);
42806
- }
42807
- }
42808
42210
  function _createClass$2(Constructor, protoProps, staticProps) {
42809
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
42810
- if (staticProps) _defineProperties$2(Constructor, staticProps);
42811
42211
  Object.defineProperty(Constructor, "prototype", {
42812
42212
  writable: false
42813
42213
  });
@@ -42881,7 +42281,7 @@ void main() {
42881
42281
  function _createForOfIteratorHelper(o, allowArrayLike) {
42882
42282
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
42883
42283
  if (!it) {
42884
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") {
42284
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike ) {
42885
42285
  if (it) o = it;
42886
42286
  var i = 0;
42887
42287
  var F = function () {};
@@ -46132,10 +45532,7 @@ void main() {
46132
45532
  _n = !0,
46133
45533
  _d = !1;
46134
45534
  try {
46135
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
46136
- if (Object(_i) !== _i) return;
46137
- _n = !1;
46138
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
45535
+ if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
46139
45536
  } catch (err) {
46140
45537
  _d = !0, _e = err;
46141
45538
  } finally {
@@ -46209,18 +45606,18 @@ void main() {
46209
45606
  function _nonIterableRest$4() {
46210
45607
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
46211
45608
  }
46212
- function _toPrimitive$4(input, hint) {
45609
+ function _toPrimitive$3(input, hint) {
46213
45610
  if (typeof input !== "object" || input === null) return input;
46214
45611
  var prim = input[Symbol.toPrimitive];
46215
45612
  if (prim !== undefined) {
46216
- var res = prim.call(input, hint || "default");
45613
+ var res = prim.call(input, hint );
46217
45614
  if (typeof res !== "object") return res;
46218
45615
  throw new TypeError("@@toPrimitive must return a primitive value.");
46219
45616
  }
46220
- return (hint === "string" ? String : Number)(input);
45617
+ return (String )(input);
46221
45618
  }
46222
- function _toPropertyKey$4(arg) {
46223
- var key = _toPrimitive$4(arg, "string");
45619
+ function _toPropertyKey$3(arg) {
45620
+ var key = _toPrimitive$3(arg, "string");
46224
45621
  return typeof key === "symbol" ? key : String(key);
46225
45622
  }
46226
45623
 
@@ -46245,7 +45642,7 @@ void main() {
46245
45642
  if (isProp) {
46246
45643
  var _itemVal = itemVal,
46247
45644
  propVal = _itemVal[keyAccessor],
46248
- rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$4));
45645
+ rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$3));
46249
45646
  key = propVal;
46250
45647
  itemVal = rest;
46251
45648
  } else {
@@ -46326,10 +45723,7 @@ void main() {
46326
45723
  _n = !0,
46327
45724
  _d = !1;
46328
45725
  try {
46329
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
46330
- if (Object(_i) !== _i) return;
46331
- _n = !1;
46332
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
45726
+ if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
46333
45727
  } catch (err) {
46334
45728
  _d = !0, _e = err;
46335
45729
  } finally {
@@ -46364,7 +45758,7 @@ void main() {
46364
45758
  return target;
46365
45759
  }
46366
45760
  function _defineProperty$2(obj, key, value) {
46367
- key = _toPropertyKey$3(key);
45761
+ key = _toPropertyKey$2(key);
46368
45762
  if (key in obj) {
46369
45763
  Object.defineProperty(obj, key, {
46370
45764
  value: value,
@@ -46438,18 +45832,18 @@ void main() {
46438
45832
  function _nonIterableRest$3() {
46439
45833
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
46440
45834
  }
46441
- function _toPrimitive$3(input, hint) {
45835
+ function _toPrimitive$2(input, hint) {
46442
45836
  if (typeof input !== "object" || input === null) return input;
46443
45837
  var prim = input[Symbol.toPrimitive];
46444
45838
  if (prim !== undefined) {
46445
- var res = prim.call(input, hint || "default");
45839
+ var res = prim.call(input, hint );
46446
45840
  if (typeof res !== "object") return res;
46447
45841
  throw new TypeError("@@toPrimitive must return a primitive value.");
46448
45842
  }
46449
- return (hint === "string" ? String : Number)(input);
45843
+ return (String )(input);
46450
45844
  }
46451
- function _toPropertyKey$3(arg) {
46452
- var key = _toPrimitive$3(arg, "string");
45845
+ function _toPropertyKey$2(arg) {
45846
+ var key = _toPrimitive$2(arg, "string");
46453
45847
  return typeof key === "symbol" ? key : String(key);
46454
45848
  }
46455
45849
 
@@ -48189,7 +47583,7 @@ void main() {
48189
47583
  * //= true
48190
47584
  */
48191
47585
  function booleanPointInPolygon(point, polygon, options) {
48192
- if (options === void 0) { options = {}; }
47586
+ { options = {}; }
48193
47587
  // validation
48194
47588
  if (!point) {
48195
47589
  throw new Error("point is required");
@@ -49527,7 +48921,7 @@ void main() {
49527
48921
  }
49528
48922
 
49529
48923
  function _callSuper$1(t, o, e) {
49530
- return o = _getPrototypeOf$2(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, e || [], _getPrototypeOf$2(t).constructor) : o.apply(t, e));
48924
+ return o = _getPrototypeOf$2(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, [], _getPrototypeOf$2(t).constructor) : o.apply(t, e));
49531
48925
  }
49532
48926
  function _isNativeReflectConstruct$2() {
49533
48927
  try {
@@ -49548,10 +48942,7 @@ void main() {
49548
48942
  f = !0,
49549
48943
  o = !1;
49550
48944
  try {
49551
- if (i = (t = t.call(r)).next, 0 === l) {
49552
- if (Object(t) !== t) return;
49553
- f = !1;
49554
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
48945
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
49555
48946
  } catch (r) {
49556
48947
  o = !0, n = r;
49557
48948
  } finally {
@@ -49564,37 +48955,12 @@ void main() {
49564
48955
  return a;
49565
48956
  }
49566
48957
  }
49567
- function _toPrimitive$2(t, r) {
49568
- if ("object" != typeof t || !t) return t;
49569
- var e = t[Symbol.toPrimitive];
49570
- if (void 0 !== e) {
49571
- var i = e.call(t, r || "default");
49572
- if ("object" != typeof i) return i;
49573
- throw new TypeError("@@toPrimitive must return a primitive value.");
49574
- }
49575
- return ("string" === r ? String : Number)(t);
49576
- }
49577
- function _toPropertyKey$2(t) {
49578
- var i = _toPrimitive$2(t, "string");
49579
- return "symbol" == typeof i ? i : String(i);
49580
- }
49581
48958
  function _classCallCheck$1(instance, Constructor) {
49582
48959
  if (!(instance instanceof Constructor)) {
49583
48960
  throw new TypeError("Cannot call a class as a function");
49584
48961
  }
49585
48962
  }
49586
- function _defineProperties$1(target, props) {
49587
- for (var i = 0; i < props.length; i++) {
49588
- var descriptor = props[i];
49589
- descriptor.enumerable = descriptor.enumerable || false;
49590
- descriptor.configurable = true;
49591
- if ("value" in descriptor) descriptor.writable = true;
49592
- Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
49593
- }
49594
- }
49595
48963
  function _createClass$1(Constructor, protoProps, staticProps) {
49596
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
49597
- if (staticProps) _defineProperties$1(Constructor, staticProps);
49598
48964
  Object.defineProperty(Constructor, "prototype", {
49599
48965
  writable: false
49600
48966
  });
@@ -64818,13 +64184,13 @@ void main() {
64818
64184
  var vertsPos = cellBoundary + SZ_DBL;
64819
64185
  var out = []; // Support [lng, lat] pairs if GeoJSON is specified
64820
64186
 
64821
- var readCoord = geoJsonCoords ? readLatLngGeoJson : readLatLng;
64187
+ var readCoord = readLatLngGeoJson ;
64822
64188
 
64823
64189
  for (var i = 0; i < numVerts * 2; i += 2) {
64824
64190
  out.push(readCoord(vertsPos + SZ_DBL * i));
64825
64191
  }
64826
64192
 
64827
- if (closedLoop) {
64193
+ {
64828
64194
  // Close loop if GeoJSON is specified
64829
64195
  out.push(out[0]);
64830
64196
  }
@@ -66372,7 +65738,7 @@ void main() {
66372
65738
  * font: <THREE.Font>, // font
66373
65739
  *
66374
65740
  * size: <float>, // size of the text
66375
- * height: <float>, // thickness to extrude text
65741
+ * depth: <float>, // thickness to extrude text
66376
65742
  * curveSegments: <int>, // number of points on the curves
66377
65743
  *
66378
65744
  * bevelEnabled: <bool>, // turn on bevel
@@ -66399,7 +65765,15 @@ void main() {
66399
65765
 
66400
65766
  // translate parameters to ExtrudeGeometry API
66401
65767
 
66402
- parameters.depth = parameters.height !== undefined ? parameters.height : 50;
65768
+ if ( parameters.depth === undefined && parameters.height !== undefined ) {
65769
+
65770
+ console.warn( 'THREE.TextGeometry: .height is now depreciated. Please use .depth instead' ); // @deprecated, r163
65771
+
65772
+ }
65773
+
65774
+ parameters.depth = parameters.depth !== undefined ?
65775
+ parameters.depth : parameters.height !== undefined ?
65776
+ parameters.height : 50;
66403
65777
 
66404
65778
  // defaults
66405
65779
 
@@ -66567,7 +65941,7 @@ void main() {
66567
65941
  var o = [null];
66568
65942
  o.push.apply(o, e);
66569
65943
  var p = new (t.bind.apply(t, o))();
66570
- return r && _setPrototypeOf$1(p, r.prototype), p;
65944
+ return p;
66571
65945
  }
66572
65946
  function _isNativeReflectConstruct$1() {
66573
65947
  try {
@@ -66629,11 +66003,11 @@ void main() {
66629
66003
  if ("object" != typeof t || !t) return t;
66630
66004
  var e = t[Symbol.toPrimitive];
66631
66005
  if (void 0 !== e) {
66632
- var i = e.call(t, r || "default");
66006
+ var i = e.call(t, r );
66633
66007
  if ("object" != typeof i) return i;
66634
66008
  throw new TypeError("@@toPrimitive must return a primitive value.");
66635
66009
  }
66636
- return ("string" === r ? String : Number)(t);
66010
+ return (String )(t);
66637
66011
  }
66638
66012
  function _toPropertyKey$1(t) {
66639
66013
  var i = _toPrimitive$1(t, "string");
@@ -66655,7 +66029,6 @@ void main() {
66655
66029
  }
66656
66030
  function _createClass(Constructor, protoProps, staticProps) {
66657
66031
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
66658
- if (staticProps) _defineProperties(Constructor, staticProps);
66659
66032
  Object.defineProperty(Constructor, "prototype", {
66660
66033
  writable: false
66661
66034
  });
@@ -67177,7 +66550,7 @@ void main() {
67177
66550
  function setMaterialOpacity(material, opacity, depthWrite) {
67178
66551
  material.opacity = opacity;
67179
66552
  material.transparent = opacity < 1;
67180
- material.depthWrite = depthWrite === undefined ? opacity >= 1 : depthWrite; // depthWrite=false recommended for transparent materials, to prevent transparency issues https://discourse.threejs.org/t/threejs-and-the-transparent-problem/11553/31
66553
+ material.depthWrite = opacity >= 1 ; // depthWrite=false recommended for transparent materials, to prevent transparency issues https://discourse.threejs.org/t/threejs-and-the-transparent-problem/11553/31
67181
66554
 
67182
66555
  return material;
67183
66556
  }
@@ -69797,7 +69170,7 @@ void main() {
69797
69170
  applyUpdate(targetD);
69798
69171
  } else {
69799
69172
  // animate
69800
- new Tween(obj.__currentTargetD).to(targetD, state.pointsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
69173
+ new Tween(obj.__currentTargetD).to(targetD, state.htmlTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start();
69801
69174
  }
69802
69175
  }
69803
69176
  });
@@ -70137,7 +69510,7 @@ void main() {
70137
69510
  emptyObject(threeObj);
70138
69511
 
70139
69512
  // Main three object to manipulate
70140
- threeObj.add(state.scene = new THREE$i.Group());
69513
+ state.scene = threeObj;
70141
69514
  state.scene.visible = false; // hide scene before globe initialization
70142
69515
 
70143
69516
  // Add all layers groups
@@ -71280,6 +70653,7 @@ void main() {
71280
70653
  scope.target.clampLength( scope.minTargetRadius, scope.maxTargetRadius );
71281
70654
  scope.target.add( scope.cursor );
71282
70655
 
70656
+ let zoomChanged = false;
71283
70657
  // adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
71284
70658
  // we adjust zoom later in these cases
71285
70659
  if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
@@ -71288,7 +70662,9 @@ void main() {
71288
70662
 
71289
70663
  } else {
71290
70664
 
70665
+ const prevRadius = spherical.radius;
71291
70666
  spherical.radius = clampDistance( spherical.radius * scale );
70667
+ zoomChanged = prevRadius != spherical.radius;
71292
70668
 
71293
70669
  }
71294
70670
 
@@ -71317,7 +70693,6 @@ void main() {
71317
70693
  }
71318
70694
 
71319
70695
  // adjust camera position
71320
- let zoomChanged = false;
71321
70696
  if ( scope.zoomToCursor && performCursorZoom ) {
71322
70697
 
71323
70698
  let newRadius = null;
@@ -71332,15 +70707,19 @@ void main() {
71332
70707
  scope.object.position.addScaledVector( dollyDirection, radiusDelta );
71333
70708
  scope.object.updateMatrixWorld();
71334
70709
 
70710
+ zoomChanged = !! radiusDelta;
70711
+
71335
70712
  } else if ( scope.object.isOrthographicCamera ) {
71336
70713
 
71337
70714
  // adjust the ortho camera position based on zoom changes
71338
70715
  const mouseBefore = new Vector3( mouse.x, mouse.y, 0 );
71339
70716
  mouseBefore.unproject( scope.object );
71340
70717
 
70718
+ const prevZoom = scope.object.zoom;
71341
70719
  scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
71342
70720
  scope.object.updateProjectionMatrix();
71343
- zoomChanged = true;
70721
+
70722
+ zoomChanged = prevZoom !== scope.object.zoom;
71344
70723
 
71345
70724
  const mouseAfter = new Vector3( mouse.x, mouse.y, 0 );
71346
70725
  mouseAfter.unproject( scope.object );
@@ -71393,12 +70772,13 @@ void main() {
71393
70772
 
71394
70773
  } else if ( scope.object.isOrthographicCamera ) {
71395
70774
 
71396
- zoomChanged = scale !== 1;
70775
+ const prevZoom = scope.object.zoom;
70776
+ scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
71397
70777
 
71398
- if ( zoomChanged ) {
70778
+ if ( prevZoom !== scope.object.zoom ) {
71399
70779
 
71400
- scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );
71401
70780
  scope.object.updateProjectionMatrix();
70781
+ zoomChanged = true;
71402
70782
 
71403
70783
  }
71404
70784
 
@@ -71414,7 +70794,7 @@ void main() {
71414
70794
  if ( zoomChanged ||
71415
70795
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
71416
70796
  8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||
71417
- lastTargetPosition.distanceToSquared( scope.target ) > 0 ) {
70797
+ lastTargetPosition.distanceToSquared( scope.target ) > EPS ) {
71418
70798
 
71419
70799
  scope.dispatchEvent( _changeEvent$1 );
71420
70800
 
@@ -71443,6 +70823,9 @@ void main() {
71443
70823
  scope.domElement.removeEventListener( 'pointermove', onPointerMove );
71444
70824
  scope.domElement.removeEventListener( 'pointerup', onPointerUp );
71445
70825
 
70826
+ const document = scope.domElement.getRootNode(); // offscreen canvas compatibility
70827
+
70828
+ document.removeEventListener( 'keydown', interceptControlDown, { capture: true } );
71446
70829
 
71447
70830
  if ( scope._domElementKeyEvents !== null ) {
71448
70831
 
@@ -72032,6 +71415,10 @@ void main() {
72032
71415
 
72033
71416
  //
72034
71417
 
71418
+ if ( isTrackingPointer( event ) ) return;
71419
+
71420
+ //
71421
+
72035
71422
  addPointer( event );
72036
71423
 
72037
71424
  if ( event.pointerType === 'touch' ) {
@@ -72479,6 +71866,18 @@ void main() {
72479
71866
 
72480
71867
  }
72481
71868
 
71869
+ function isTrackingPointer( event ) {
71870
+
71871
+ for ( let i = 0; i < pointers.length; i ++ ) {
71872
+
71873
+ if ( pointers[ i ] == event.pointerId ) return true;
71874
+
71875
+ }
71876
+
71877
+ return false;
71878
+
71879
+ }
71880
+
72482
71881
  function trackPointer( event ) {
72483
71882
 
72484
71883
  let position = pointerPositions[ event.pointerId ];
@@ -74156,7 +73555,7 @@ void main() {
74156
73555
  */
74157
73556
  function hsla(value, saturation, lightness, alpha) {
74158
73557
  if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
74159
- return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
73558
+ return "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
74160
73559
  } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
74161
73560
  return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
74162
73561
  }
@@ -74234,7 +73633,7 @@ void main() {
74234
73633
  var rgbValue = parseToRgb(firstValue);
74235
73634
  return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
74236
73635
  } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
74237
- return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
73636
+ return "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
74238
73637
  } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
74239
73638
  return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
74240
73639
  }
@@ -74793,21 +74192,15 @@ void main() {
74793
74192
  curry /* ::<number | string, string, string> */(transparentize);
74794
74193
 
74795
74194
  function styleInject(css, ref) {
74796
- if (ref === void 0) ref = {};
74797
- var insertAt = ref.insertAt;
74798
- if (!css || typeof document === 'undefined') {
74195
+ ref = {};
74196
+ ref.insertAt;
74197
+ if (typeof document === 'undefined') {
74799
74198
  return;
74800
74199
  }
74801
74200
  var head = document.head || document.getElementsByTagName('head')[0];
74802
74201
  var style = document.createElement('style');
74803
74202
  style.type = 'text/css';
74804
- if (insertAt === 'top') {
74805
- if (head.firstChild) {
74806
- head.insertBefore(style, head.firstChild);
74807
- } else {
74808
- head.appendChild(style);
74809
- }
74810
- } else {
74203
+ {
74811
74204
  head.appendChild(style);
74812
74205
  }
74813
74206
  if (style.styleSheet) {
@@ -74831,10 +74224,7 @@ void main() {
74831
74224
  f = !0,
74832
74225
  o = !1;
74833
74226
  try {
74834
- if (i = (t = t.call(r)).next, 0 === l) {
74835
- if (Object(t) !== t) return;
74836
- f = !1;
74837
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
74227
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
74838
74228
  } catch (r) {
74839
74229
  o = !0, n = r;
74840
74230
  } finally {
@@ -74851,15 +74241,15 @@ void main() {
74851
74241
  if ("object" != typeof t || !t) return t;
74852
74242
  var e = t[Symbol.toPrimitive];
74853
74243
  if (void 0 !== e) {
74854
- var i = e.call(t, r || "default");
74244
+ var i = e.call(t, r );
74855
74245
  if ("object" != typeof i) return i;
74856
74246
  throw new TypeError("@@toPrimitive must return a primitive value.");
74857
74247
  }
74858
- return ("string" === r ? String : Number)(t);
74248
+ return (String )(t);
74859
74249
  }
74860
74250
  function _toPropertyKey(t) {
74861
74251
  var i = _toPrimitive(t, "string");
74862
- return "symbol" == typeof i ? i : String(i);
74252
+ return "symbol" == typeof i ? i : i + "";
74863
74253
  }
74864
74254
  function _defineProperty(obj, key, value) {
74865
74255
  key = _toPropertyKey(key);
@@ -75016,7 +74406,7 @@ void main() {
75016
74406
  methods: {
75017
74407
  tick: function tick(state) {
75018
74408
  if (state.initialised) {
75019
- state.controls.update && state.controls.update(state.clock.getDelta()); // timedelta is required for fly controls
74409
+ state.controls.update && state.controls.update(Math.min(1, state.clock.getDelta())); // timedelta is required for fly controls
75020
74410
 
75021
74411
  state.postProcessingComposer ? state.postProcessingComposer.render() // if using postprocessing, switch the output to it
75022
74412
  : state.renderer.render(state.scene, state.camera);
@@ -75477,7 +74867,8 @@ void main() {
75477
74867
  : {
75478
74868
  AmbientLight: AmbientLight,
75479
74869
  DirectionalLight: DirectionalLight,
75480
- Vector2: Vector2
74870
+ Vector2: Vector2,
74871
+ REVISION: REVISION
75481
74872
  }), {}, {
75482
74873
  CSS2DRenderer: CSS2DRenderer
75483
74874
  });
@@ -75893,7 +75284,7 @@ void main() {
75893
75284
  return d;
75894
75285
  }
75895
75286
  };
75896
- state.renderObjs.renderer().useLegacyLights = false; // force behavior of three < 155
75287
+ THREE.REVISION < 155 && (state.renderObjs.renderer().useLegacyLights = false); // force behavior of three < 155
75897
75288
  state.renderObjs.hoverOrderComparator(function (a, b) {
75898
75289
  var aObj = getGlobeObj(a);
75899
75290
  var bObj = getGlobeObj(b);