super-three 0.173.3 → 0.173.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/three.cjs CHANGED
@@ -240,7 +240,7 @@ class EventDispatcher {
240
240
 
241
241
  }
242
242
 
243
- if ( listeners[ type ].indexOf( listener ) === - 1 ) {
243
+ if ( listeners[ type ].indexOf( listener ) === -1 ) {
244
244
 
245
245
  listeners[ type ].push( listener );
246
246
 
@@ -254,7 +254,7 @@ class EventDispatcher {
254
254
 
255
255
  if ( listeners === undefined ) return false;
256
256
 
257
- return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
257
+ return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== -1;
258
258
 
259
259
  }
260
260
 
@@ -270,7 +270,7 @@ class EventDispatcher {
270
270
 
271
271
  const index = listenerArray.indexOf( listener );
272
272
 
273
- if ( index !== - 1 ) {
273
+ if ( index !== -1 ) {
274
274
 
275
275
  listenerArray.splice( index, 1 );
276
276
 
@@ -560,15 +560,15 @@ function denormalize( value, array ) {
560
560
 
561
561
  case Int32Array:
562
562
 
563
- return Math.max( value / 2147483647.0, - 1.0 );
563
+ return Math.max( value / 2147483647.0, -1 );
564
564
 
565
565
  case Int16Array:
566
566
 
567
- return Math.max( value / 32767.0, - 1.0 );
567
+ return Math.max( value / 32767.0, -1 );
568
568
 
569
569
  case Int8Array:
570
570
 
571
- return Math.max( value / 127.0, - 1.0 );
571
+ return Math.max( value / 127.0, -1 );
572
572
 
573
573
  default:
574
574
 
@@ -1010,7 +1010,7 @@ class Vector2 {
1010
1010
 
1011
1011
  // clamp, to handle numerical problems
1012
1012
 
1013
- return Math.acos( clamp( theta, - 1, 1 ) );
1013
+ return Math.acos( clamp( theta, -1, 1 ) );
1014
1014
 
1015
1015
  }
1016
1016
 
@@ -1611,7 +1611,7 @@ function toNormalizedProjectionMatrix( projectionMatrix ) {
1611
1611
  function toReversedProjectionMatrix( projectionMatrix ) {
1612
1612
 
1613
1613
  const m = projectionMatrix.elements;
1614
- const isPerspectiveMatrix = m[ 11 ] === - 1;
1614
+ const isPerspectiveMatrix = m[ 11 ] === -1;
1615
1615
 
1616
1616
  // Reverse [0, 1] projection matrix
1617
1617
  if ( isPerspectiveMatrix ) {
@@ -1635,9 +1635,9 @@ const LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(
1635
1635
  );
1636
1636
 
1637
1637
  const XYZ_TO_LINEAR_REC709 = /*@__PURE__*/ new Matrix3().set(
1638
- 3.2409699, - 1.5373832, - 0.4986108,
1639
- - 0.9692436, 1.8759675, 0.0415551,
1640
- 0.0556301, - 0.2039770, 1.0569715
1638
+ 3.2409699, -1.5373832, -0.4986108,
1639
+ -0.9692436, 1.8759675, 0.0415551,
1640
+ 0.0556301, -0.203977, 1.0569715
1641
1641
  );
1642
1642
 
1643
1643
  function createColorManagement() {
@@ -3368,7 +3368,7 @@ class Quaternion {
3368
3368
 
3369
3369
  let s = 1 - t;
3370
3370
  const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
3371
- dir = ( cos >= 0 ? 1 : - 1 ),
3371
+ dir = ( cos >= 0 ? 1 : -1 ),
3372
3372
  sqrSin = 1 - cos * cos;
3373
3373
 
3374
3374
  // Skip the Slerp for tiny steps to avoid numeric problems:
@@ -3711,7 +3711,7 @@ class Quaternion {
3711
3711
 
3712
3712
  angleTo( q ) {
3713
3713
 
3714
- return 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );
3714
+ return 2 * Math.acos( Math.abs( clamp( this.dot( q ), -1, 1 ) ) );
3715
3715
 
3716
3716
  }
3717
3717
 
@@ -3745,9 +3745,9 @@ class Quaternion {
3745
3745
 
3746
3746
  conjugate() {
3747
3747
 
3748
- this._x *= - 1;
3749
- this._y *= - 1;
3750
- this._z *= - 1;
3748
+ this._x *= -1;
3749
+ this._y *= -1;
3750
+ this._z *= -1;
3751
3751
 
3752
3752
  this._onChangeCallback();
3753
3753
 
@@ -4529,7 +4529,7 @@ class Vector3 {
4529
4529
 
4530
4530
  // clamp, to handle numerical problems
4531
4531
 
4532
- return Math.acos( clamp( theta, - 1, 1 ) );
4532
+ return Math.acos( clamp( theta, -1, 1 ) );
4533
4533
 
4534
4534
  }
4535
4535
 
@@ -5257,7 +5257,7 @@ const _v2$3 = /*@__PURE__*/ new Vector3();
5257
5257
 
5258
5258
  class Sphere {
5259
5259
 
5260
- constructor( center = new Vector3(), radius = - 1 ) {
5260
+ constructor( center = new Vector3(), radius = -1 ) {
5261
5261
 
5262
5262
  this.isSphere = true;
5263
5263
 
@@ -5321,7 +5321,7 @@ class Sphere {
5321
5321
  makeEmpty() {
5322
5322
 
5323
5323
  this.center.set( 0, 0, 0 );
5324
- this.radius = - 1;
5324
+ this.radius = -1;
5325
5325
 
5326
5326
  return this;
5327
5327
 
@@ -5503,7 +5503,7 @@ const _normal$1 = /*@__PURE__*/ new Vector3();
5503
5503
 
5504
5504
  class Ray {
5505
5505
 
5506
- constructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {
5506
+ constructor( origin = new Vector3(), direction = new Vector3( 0, 0, -1 ) ) {
5507
5507
 
5508
5508
  this.origin = origin;
5509
5509
  this.direction = direction;
@@ -5909,7 +5909,7 @@ class Ray {
5909
5909
 
5910
5910
  } else if ( DdN < 0 ) {
5911
5911
 
5912
- sign = - 1;
5912
+ sign = -1;
5913
5913
  DdN = - DdN;
5914
5914
 
5915
5915
  } else {
@@ -6769,7 +6769,7 @@ class Matrix4 {
6769
6769
  if ( coordinateSystem === WebGLCoordinateSystem ) {
6770
6770
 
6771
6771
  c = - ( far + near ) / ( far - near );
6772
- d = ( - 2 * far * near ) / ( far - near );
6772
+ d = ( -2 * far * near ) / ( far - near );
6773
6773
 
6774
6774
  } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
6775
6775
 
@@ -6785,7 +6785,7 @@ class Matrix4 {
6785
6785
  te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
6786
6786
  te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
6787
6787
  te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
6788
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
6788
+ te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = -1; te[ 15 ] = 0;
6789
6789
 
6790
6790
  return this;
6791
6791
 
@@ -6806,12 +6806,12 @@ class Matrix4 {
6806
6806
  if ( coordinateSystem === WebGLCoordinateSystem ) {
6807
6807
 
6808
6808
  z = ( far + near ) * p;
6809
- zInv = - 2 * p;
6809
+ zInv = -2 * p;
6810
6810
 
6811
6811
  } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
6812
6812
 
6813
6813
  z = near * p;
6814
- zInv = - 1 * p;
6814
+ zInv = -1 * p;
6815
6815
 
6816
6816
  } else {
6817
6817
 
@@ -7006,7 +7006,7 @@ class Euler {
7006
7006
 
7007
7007
  case 'XYZ':
7008
7008
 
7009
- this._y = Math.asin( clamp( m13, - 1, 1 ) );
7009
+ this._y = Math.asin( clamp( m13, -1, 1 ) );
7010
7010
 
7011
7011
  if ( Math.abs( m13 ) < 0.9999999 ) {
7012
7012
 
@@ -7024,7 +7024,7 @@ class Euler {
7024
7024
 
7025
7025
  case 'YXZ':
7026
7026
 
7027
- this._x = Math.asin( - clamp( m23, - 1, 1 ) );
7027
+ this._x = Math.asin( - clamp( m23, -1, 1 ) );
7028
7028
 
7029
7029
  if ( Math.abs( m23 ) < 0.9999999 ) {
7030
7030
 
@@ -7042,7 +7042,7 @@ class Euler {
7042
7042
 
7043
7043
  case 'ZXY':
7044
7044
 
7045
- this._x = Math.asin( clamp( m32, - 1, 1 ) );
7045
+ this._x = Math.asin( clamp( m32, -1, 1 ) );
7046
7046
 
7047
7047
  if ( Math.abs( m32 ) < 0.9999999 ) {
7048
7048
 
@@ -7060,7 +7060,7 @@ class Euler {
7060
7060
 
7061
7061
  case 'ZYX':
7062
7062
 
7063
- this._y = Math.asin( - clamp( m31, - 1, 1 ) );
7063
+ this._y = Math.asin( - clamp( m31, -1, 1 ) );
7064
7064
 
7065
7065
  if ( Math.abs( m31 ) < 0.9999999 ) {
7066
7066
 
@@ -7078,7 +7078,7 @@ class Euler {
7078
7078
 
7079
7079
  case 'YZX':
7080
7080
 
7081
- this._z = Math.asin( clamp( m21, - 1, 1 ) );
7081
+ this._z = Math.asin( clamp( m21, -1, 1 ) );
7082
7082
 
7083
7083
  if ( Math.abs( m21 ) < 0.9999999 ) {
7084
7084
 
@@ -7096,7 +7096,7 @@ class Euler {
7096
7096
 
7097
7097
  case 'XZY':
7098
7098
 
7099
- this._z = Math.asin( - clamp( m12, - 1, 1 ) );
7099
+ this._z = Math.asin( - clamp( m12, -1, 1 ) );
7100
7100
 
7101
7101
  if ( Math.abs( m12 ) < 0.9999999 ) {
7102
7102
 
@@ -7623,7 +7623,7 @@ class Object3D extends EventDispatcher {
7623
7623
 
7624
7624
  const index = this.children.indexOf( object );
7625
7625
 
7626
- if ( index !== - 1 ) {
7626
+ if ( index !== -1 ) {
7627
7627
 
7628
7628
  object.parent = null;
7629
7629
  this.children.splice( index, 1 );
@@ -8964,7 +8964,7 @@ class Color {
8964
8964
 
8965
8965
  getHexString( colorSpace = SRGBColorSpace ) {
8966
8966
 
8967
- return ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );
8967
+ return ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( -6 );
8968
8968
 
8969
8969
  }
8970
8970
 
@@ -9848,7 +9848,7 @@ function _generateTables() {
9848
9848
 
9849
9849
  // very small number (0, -0)
9850
9850
 
9851
- if ( e < - 27 ) {
9851
+ if ( e < -27 ) {
9852
9852
 
9853
9853
  baseTable[ i ] = 0x0000;
9854
9854
  baseTable[ i | 0x100 ] = 0x8000;
@@ -9857,7 +9857,7 @@ function _generateTables() {
9857
9857
 
9858
9858
  // small number (denorm)
9859
9859
 
9860
- } else if ( e < - 14 ) {
9860
+ } else if ( e < -14 ) {
9861
9861
 
9862
9862
  baseTable[ i ] = 0x0400 >> ( - e - 14 );
9863
9863
  baseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;
@@ -9914,7 +9914,7 @@ function _generateTables() {
9914
9914
 
9915
9915
  }
9916
9916
 
9917
- m &= ~ 0x00800000; // clear leading 1 bit
9917
+ m &= -8388609; // clear leading 1 bit
9918
9918
  e += 0x38800000; // adjust bias
9919
9919
 
9920
9920
  mantissaTable[ i ] = m | e;
@@ -9972,7 +9972,7 @@ function toHalfFloat( val ) {
9972
9972
 
9973
9973
  if ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );
9974
9974
 
9975
- val = clamp( val, - 65504, 65504 );
9975
+ val = clamp( val, -65504, 65504 );
9976
9976
 
9977
9977
  _tables.floatView[ 0 ] = val;
9978
9978
  const f = _tables.uint32View[ 0 ];
@@ -11243,7 +11243,7 @@ class BufferGeometry extends EventDispatcher {
11243
11243
 
11244
11244
  tmp2.crossVectors( n2, t );
11245
11245
  const test = tmp2.dot( tan2[ v ] );
11246
- const w = ( test < 0.0 ) ? - 1.0 : 1.0;
11246
+ const w = ( test < 0.0 ) ? -1 : 1.0;
11247
11247
 
11248
11248
  tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
11249
11249
 
@@ -12085,7 +12085,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
12085
12085
 
12086
12086
  if ( intersection.normal.dot( ray.direction ) > 0 ) {
12087
12087
 
12088
- intersection.normal.multiplyScalar( - 1 );
12088
+ intersection.normal.multiplyScalar( -1 );
12089
12089
 
12090
12090
  }
12091
12091
 
@@ -12149,12 +12149,12 @@ class BoxGeometry extends BufferGeometry {
12149
12149
 
12150
12150
  // build each side of the box geometry
12151
12151
 
12152
- buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px
12153
- buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx
12152
+ buildPlane( 'z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0 ); // px
12153
+ buildPlane( 'z', 'y', 'x', 1, -1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx
12154
12154
  buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py
12155
- buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny
12156
- buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz
12157
- buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz
12155
+ buildPlane( 'x', 'z', 'y', 1, -1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny
12156
+ buildPlane( 'x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4 ); // pz
12157
+ buildPlane( 'x', 'y', 'z', -1, -1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz
12158
12158
 
12159
12159
  // build geometry
12160
12160
 
@@ -12204,7 +12204,7 @@ class BoxGeometry extends BufferGeometry {
12204
12204
 
12205
12205
  vector[ u ] = 0;
12206
12206
  vector[ v ] = 0;
12207
- vector[ w ] = depth > 0 ? 1 : - 1;
12207
+ vector[ w ] = depth > 0 ? 1 : -1;
12208
12208
 
12209
12209
  // now apply vector to normal buffer
12210
12210
 
@@ -12756,7 +12756,7 @@ class PerspectiveCamera extends Camera {
12756
12756
  */
12757
12757
  getViewBounds( distance, minTarget, maxTarget ) {
12758
12758
 
12759
- _v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12759
+ _v3$1.set( -1, -1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12760
12760
 
12761
12761
  minTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );
12762
12762
 
@@ -12871,7 +12871,7 @@ class PerspectiveCamera extends Camera {
12871
12871
  let top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;
12872
12872
  let height = 2 * top;
12873
12873
  let width = this.aspect * height;
12874
- let left = - 0.5 * width;
12874
+ let left = -0.5 * width;
12875
12875
  const view = this.view;
12876
12876
 
12877
12877
  if ( this.view !== null && this.view.enabled ) {
@@ -12919,7 +12919,7 @@ class PerspectiveCamera extends Camera {
12919
12919
 
12920
12920
  }
12921
12921
 
12922
- const fov = - 90; // negative fov is not an error
12922
+ const fov = -90; // negative fov is not an error
12923
12923
  const aspect = 1;
12924
12924
 
12925
12925
  class CubeCamera extends Object3D {
@@ -12976,39 +12976,39 @@ class CubeCamera extends Object3D {
12976
12976
  cameraPX.lookAt( 1, 0, 0 );
12977
12977
 
12978
12978
  cameraNX.up.set( 0, 1, 0 );
12979
- cameraNX.lookAt( - 1, 0, 0 );
12979
+ cameraNX.lookAt( -1, 0, 0 );
12980
12980
 
12981
- cameraPY.up.set( 0, 0, - 1 );
12981
+ cameraPY.up.set( 0, 0, -1 );
12982
12982
  cameraPY.lookAt( 0, 1, 0 );
12983
12983
 
12984
12984
  cameraNY.up.set( 0, 0, 1 );
12985
- cameraNY.lookAt( 0, - 1, 0 );
12985
+ cameraNY.lookAt( 0, -1, 0 );
12986
12986
 
12987
12987
  cameraPZ.up.set( 0, 1, 0 );
12988
12988
  cameraPZ.lookAt( 0, 0, 1 );
12989
12989
 
12990
12990
  cameraNZ.up.set( 0, 1, 0 );
12991
- cameraNZ.lookAt( 0, 0, - 1 );
12991
+ cameraNZ.lookAt( 0, 0, -1 );
12992
12992
 
12993
12993
  } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
12994
12994
 
12995
- cameraPX.up.set( 0, - 1, 0 );
12996
- cameraPX.lookAt( - 1, 0, 0 );
12995
+ cameraPX.up.set( 0, -1, 0 );
12996
+ cameraPX.lookAt( -1, 0, 0 );
12997
12997
 
12998
- cameraNX.up.set( 0, - 1, 0 );
12998
+ cameraNX.up.set( 0, -1, 0 );
12999
12999
  cameraNX.lookAt( 1, 0, 0 );
13000
13000
 
13001
13001
  cameraPY.up.set( 0, 0, 1 );
13002
13002
  cameraPY.lookAt( 0, 1, 0 );
13003
13003
 
13004
- cameraNY.up.set( 0, 0, - 1 );
13005
- cameraNY.lookAt( 0, - 1, 0 );
13004
+ cameraNY.up.set( 0, 0, -1 );
13005
+ cameraNY.lookAt( 0, -1, 0 );
13006
13006
 
13007
- cameraPZ.up.set( 0, - 1, 0 );
13007
+ cameraPZ.up.set( 0, -1, 0 );
13008
13008
  cameraPZ.lookAt( 0, 0, 1 );
13009
13009
 
13010
- cameraNZ.up.set( 0, - 1, 0 );
13011
- cameraNZ.lookAt( 0, 0, - 1 );
13010
+ cameraNZ.up.set( 0, -1, 0 );
13011
+ cameraNZ.lookAt( 0, 0, -1 );
13012
13012
 
13013
13013
  } else {
13014
13014
 
@@ -14325,10 +14325,10 @@ class Sprite extends Object3D {
14325
14325
  _geometry = new BufferGeometry();
14326
14326
 
14327
14327
  const float32Array = new Float32Array( [
14328
- - 0.5, - 0.5, 0, 0, 0,
14329
- 0.5, - 0.5, 0, 1, 0,
14328
+ -0.5, -0.5, 0, 0, 0,
14329
+ 0.5, -0.5, 0, 1, 0,
14330
14330
  0.5, 0.5, 0, 1, 1,
14331
- - 0.5, 0.5, 0, 0, 1
14331
+ -0.5, 0.5, 0, 0, 1
14332
14332
  ] );
14333
14333
 
14334
14334
  const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
@@ -14379,8 +14379,8 @@ class Sprite extends Object3D {
14379
14379
 
14380
14380
  const center = this.center;
14381
14381
 
14382
- transformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14383
- transformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14382
+ transformVertex( _vA.set( -0.5, -0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14383
+ transformVertex( _vB.set( 0.5, -0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14384
14384
  transformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14385
14385
 
14386
14386
  _uvA.set( 0, 0 );
@@ -14393,7 +14393,7 @@ class Sprite extends Object3D {
14393
14393
  if ( intersect === null ) {
14394
14394
 
14395
14395
  // check second triangle
14396
- transformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14396
+ transformVertex( _vB.set( -0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );
14397
14397
  _uvB.set( 0, 1 );
14398
14398
 
14399
14399
  intersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );
@@ -15621,7 +15621,7 @@ class Plane {
15621
15621
 
15622
15622
  negate() {
15623
15623
 
15624
- this.constant *= - 1;
15624
+ this.constant *= -1;
15625
15625
  this.normal.negate();
15626
15626
 
15627
15627
  return this;
@@ -15958,10 +15958,10 @@ class MultiDrawRenderList {
15958
15958
 
15959
15959
  pool.push( {
15960
15960
 
15961
- start: - 1,
15962
- count: - 1,
15963
- z: - 1,
15964
- index: - 1,
15961
+ start: -1,
15962
+ count: -1,
15963
+ z: -1,
15964
+ index: -1,
15965
15965
 
15966
15966
  } );
15967
15967
 
@@ -16371,7 +16371,7 @@ class BatchedMesh extends Mesh {
16371
16371
 
16372
16372
  }
16373
16373
 
16374
- addGeometry( geometry, reservedVertexCount = - 1, reservedIndexCount = - 1 ) {
16374
+ addGeometry( geometry, reservedVertexCount = -1, reservedIndexCount = -1 ) {
16375
16375
 
16376
16376
  this._initializeGeometry( geometry );
16377
16377
 
@@ -16379,17 +16379,17 @@ class BatchedMesh extends Mesh {
16379
16379
 
16380
16380
  const geometryInfo = {
16381
16381
  // geometry information
16382
- vertexStart: - 1,
16383
- vertexCount: - 1,
16384
- reservedVertexCount: - 1,
16382
+ vertexStart: -1,
16383
+ vertexCount: -1,
16384
+ reservedVertexCount: -1,
16385
16385
 
16386
- indexStart: - 1,
16387
- indexCount: - 1,
16388
- reservedIndexCount: - 1,
16386
+ indexStart: -1,
16387
+ indexCount: -1,
16388
+ reservedIndexCount: -1,
16389
16389
 
16390
16390
  // draw range information
16391
- start: - 1,
16392
- count: - 1,
16391
+ start: -1,
16392
+ count: -1,
16393
16393
 
16394
16394
  // state
16395
16395
  boundingBox: null,
@@ -16399,19 +16399,19 @@ class BatchedMesh extends Mesh {
16399
16399
 
16400
16400
  const geometryInfoList = this._geometryInfo;
16401
16401
  geometryInfo.vertexStart = this._nextVertexStart;
16402
- geometryInfo.reservedVertexCount = reservedVertexCount === - 1 ? geometry.getAttribute( 'position' ).count : reservedVertexCount;
16402
+ geometryInfo.reservedVertexCount = reservedVertexCount === -1 ? geometry.getAttribute( 'position' ).count : reservedVertexCount;
16403
16403
 
16404
16404
  const index = geometry.getIndex();
16405
16405
  const hasIndex = index !== null;
16406
16406
  if ( hasIndex ) {
16407
16407
 
16408
16408
  geometryInfo.indexStart = this._nextIndexStart;
16409
- geometryInfo.reservedIndexCount = reservedIndexCount === - 1 ? index.count : reservedIndexCount;
16409
+ geometryInfo.reservedIndexCount = reservedIndexCount === -1 ? index.count : reservedIndexCount;
16410
16410
 
16411
16411
  }
16412
16412
 
16413
16413
  if (
16414
- geometryInfo.indexStart !== - 1 &&
16414
+ geometryInfo.indexStart !== -1 &&
16415
16415
  geometryInfo.indexStart + geometryInfo.reservedIndexCount > this._maxIndexCount ||
16416
16416
  geometryInfo.vertexStart + geometryInfo.reservedVertexCount > this._maxVertexCount
16417
16417
  ) {
@@ -17154,7 +17154,7 @@ class BatchedMesh extends Mesh {
17154
17154
  // get the camera position in the local frame
17155
17155
  _matrix$1.copy( this.matrixWorld ).invert();
17156
17156
  _vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _matrix$1 );
17157
- _forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _matrix$1 );
17157
+ _forward.set( 0, 0, -1 ).transformDirection( camera.matrixWorld ).transformDirection( _matrix$1 );
17158
17158
 
17159
17159
  for ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {
17160
17160
 
@@ -18374,7 +18374,7 @@ class Curve {
18374
18374
 
18375
18375
  vec.normalize();
18376
18376
 
18377
- const theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
18377
+ const theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), -1, 1 ) ); // clamp for floating pt errors
18378
18378
 
18379
18379
  normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );
18380
18380
 
@@ -18388,7 +18388,7 @@ class Curve {
18388
18388
 
18389
18389
  if ( closed === true ) {
18390
18390
 
18391
- let theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );
18391
+ let theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), -1, 1 ) );
18392
18392
  theta /= segments;
18393
18393
 
18394
18394
  if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {
@@ -18658,7 +18658,7 @@ function CubicPoly() {
18658
18658
 
18659
18659
  c0 = x0;
18660
18660
  c1 = t0;
18661
- c2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;
18661
+ c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;
18662
18662
  c3 = 2 * x0 - 2 * x1 + t0 + t1;
18663
18663
 
18664
18664
  }
@@ -18884,7 +18884,7 @@ function CatmullRom( t, p0, p1, p2, p3 ) {
18884
18884
  const v1 = ( p3 - p1 ) * 0.5;
18885
18885
  const t2 = t * t;
18886
18886
  const t3 = t * t2;
18887
- return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
18887
+ return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( -3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
18888
18888
 
18889
18889
  }
18890
18890
 
@@ -19957,7 +19957,7 @@ class Path extends CurvePath {
19957
19957
 
19958
19958
  class LatheGeometry extends BufferGeometry {
19959
19959
 
19960
- constructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {
19960
+ constructor( points = [ new Vector2( 0, -0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {
19961
19961
 
19962
19962
  super();
19963
19963
 
@@ -20428,7 +20428,7 @@ class CylinderGeometry extends BufferGeometry {
20428
20428
  let groupCount = 0;
20429
20429
 
20430
20430
  const radius = ( top === true ) ? radiusTop : radiusBottom;
20431
- const sign = ( top === true ) ? 1 : - 1;
20431
+ const sign = ( top === true ) ? 1 : -1;
20432
20432
 
20433
20433
  // first we generate the center vertex data of the cap.
20434
20434
  // because the geometry needs one set of uvs per face,
@@ -20896,10 +20896,10 @@ class DodecahedronGeometry extends PolyhedronGeometry {
20896
20896
  const vertices = [
20897
20897
 
20898
20898
  // (±1, ±1, ±1)
20899
- - 1, - 1, - 1, - 1, - 1, 1,
20900
- - 1, 1, - 1, - 1, 1, 1,
20901
- 1, - 1, - 1, 1, - 1, 1,
20902
- 1, 1, - 1, 1, 1, 1,
20899
+ -1, -1, -1, -1, -1, 1,
20900
+ -1, 1, -1, -1, 1, 1,
20901
+ 1, -1, -1, 1, -1, 1,
20902
+ 1, 1, -1, 1, 1, 1,
20903
20903
 
20904
20904
  // (0, ±1/φ, ±φ)
20905
20905
  0, - r, - t, 0, - r, t,
@@ -21832,7 +21832,7 @@ function onSegment( p, q, r ) {
21832
21832
 
21833
21833
  function sign( num ) {
21834
21834
 
21835
- return num > 0 ? 1 : num < 0 ? - 1 : 0;
21835
+ return num > 0 ? 1 : num < 0 ? -1 : 0;
21836
21836
 
21837
21837
  }
21838
21838
 
@@ -22092,7 +22092,7 @@ function addContour( vertices, contour ) {
22092
22092
 
22093
22093
  class ExtrudeGeometry extends BufferGeometry {
22094
22094
 
22095
- constructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {
22095
+ constructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( -0.5, 0.5 ), new Vector2( -0.5, -0.5 ), new Vector2( 0.5, -0.5 ) ] ), options = {} ) {
22096
22096
 
22097
22097
  super();
22098
22098
 
@@ -22879,9 +22879,9 @@ class IcosahedronGeometry extends PolyhedronGeometry {
22879
22879
  const t = ( 1 + Math.sqrt( 5 ) ) / 2;
22880
22880
 
22881
22881
  const vertices = [
22882
- - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0,
22883
- 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t,
22884
- t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1
22882
+ -1, t, 0, 1, t, 0, -1, - t, 0, 1, - t, 0,
22883
+ 0, -1, t, 0, 1, t, 0, -1, - t, 0, 1, - t,
22884
+ t, 0, -1, t, 0, 1, - t, 0, -1, - t, 0, 1
22885
22885
  ];
22886
22886
 
22887
22887
  const indices = [
@@ -22915,8 +22915,8 @@ class OctahedronGeometry extends PolyhedronGeometry {
22915
22915
  constructor( radius = 1, detail = 0 ) {
22916
22916
 
22917
22917
  const vertices = [
22918
- 1, 0, 0, - 1, 0, 0, 0, 1, 0,
22919
- 0, - 1, 0, 0, 0, 1, 0, 0, - 1
22918
+ 1, 0, 0, -1, 0, 0, 0, 1, 0,
22919
+ 0, -1, 0, 0, 0, 1, 0, 0, -1
22920
22920
  ];
22921
22921
 
22922
22922
  const indices = [
@@ -23161,7 +23161,7 @@ class RingGeometry extends BufferGeometry {
23161
23161
 
23162
23162
  class ShapeGeometry extends BufferGeometry {
23163
23163
 
23164
- constructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {
23164
+ constructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( -0.5, -0.5 ), new Vector2( 0.5, -0.5 ) ] ), curveSegments = 12 ) {
23165
23165
 
23166
23166
  super();
23167
23167
 
@@ -23401,7 +23401,7 @@ class SphereGeometry extends BufferGeometry {
23401
23401
 
23402
23402
  } else if ( iy === heightSegments && thetaEnd === Math.PI ) {
23403
23403
 
23404
- uOffset = - 0.5 / widthSegments;
23404
+ uOffset = -0.5 / widthSegments;
23405
23405
 
23406
23406
  }
23407
23407
 
@@ -23484,7 +23484,7 @@ class TetrahedronGeometry extends PolyhedronGeometry {
23484
23484
  constructor( radius = 1, detail = 0 ) {
23485
23485
 
23486
23486
  const vertices = [
23487
- 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1
23487
+ 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1
23488
23488
  ];
23489
23489
 
23490
23490
  const indices = [
@@ -23789,7 +23789,7 @@ class TorusKnotGeometry extends BufferGeometry {
23789
23789
 
23790
23790
  class TubeGeometry extends BufferGeometry {
23791
23791
 
23792
- constructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {
23792
+ constructor( path = new QuadraticBezierCurve3( new Vector3( -1, -1, 0 ), new Vector3( -1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {
23793
23793
 
23794
23794
  super();
23795
23795
 
@@ -25330,7 +25330,7 @@ function subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {
25330
25330
 
25331
25331
  for ( let i = 0; i < clip.tracks.length; ++ i ) {
25332
25332
 
25333
- clip.tracks[ i ].shift( - 1 * minStartTime );
25333
+ clip.tracks[ i ].shift( -1 * minStartTime );
25334
25334
 
25335
25335
  }
25336
25336
 
@@ -25727,10 +25727,10 @@ class CubicInterpolant extends Interpolant {
25727
25727
 
25728
25728
  super( parameterPositions, sampleValues, sampleSize, resultBuffer );
25729
25729
 
25730
- this._weightPrev = - 0;
25731
- this._offsetPrev = - 0;
25732
- this._weightNext = - 0;
25733
- this._offsetNext = - 0;
25730
+ this._weightPrev = -0;
25731
+ this._offsetPrev = -0;
25732
+ this._weightNext = -0;
25733
+ this._offsetNext = -0;
25734
25734
 
25735
25735
  this.DefaultSettings_ = {
25736
25736
 
@@ -25837,8 +25837,8 @@ class CubicInterpolant extends Interpolant {
25837
25837
  // evaluate polynomials
25838
25838
 
25839
25839
  const sP = - wP * ppp + 2 * wP * pp - wP * p;
25840
- const s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;
25841
- const s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;
25840
+ const s0 = ( 1 + wP ) * ppp + ( -1.5 - 2 * wP ) * pp + ( -0.5 + wP ) * p + 1;
25841
+ const s1 = ( -1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;
25842
25842
  const sN = wN * ppp - wN * pp;
25843
25843
 
25844
25844
  // combine data linearly
@@ -26127,7 +26127,7 @@ class KeyframeTrack {
26127
26127
 
26128
26128
  }
26129
26129
 
26130
- while ( to !== - 1 && times[ to ] > endTime ) {
26130
+ while ( to !== -1 && times[ to ] > endTime ) {
26131
26131
 
26132
26132
  -- to;
26133
26133
 
@@ -26481,7 +26481,7 @@ VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
26481
26481
 
26482
26482
  class AnimationClip {
26483
26483
 
26484
- constructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {
26484
+ constructor( name = '', duration = -1, tracks = [], blendMode = NormalAnimationBlendMode ) {
26485
26485
 
26486
26486
  this.name = name;
26487
26487
  this.tracks = tracks;
@@ -26582,7 +26582,7 @@ class AnimationClip {
26582
26582
 
26583
26583
  }
26584
26584
 
26585
- return new this( name, - 1, tracks );
26585
+ return new this( name, -1, tracks );
26586
26586
 
26587
26587
  }
26588
26588
 
@@ -26694,7 +26694,7 @@ class AnimationClip {
26694
26694
  const blendMode = animation.blendMode;
26695
26695
 
26696
26696
  // automatic length determination in AnimationClip.
26697
- let duration = animation.length || - 1;
26697
+ let duration = animation.length || -1;
26698
26698
 
26699
26699
  const hierarchyTracks = animation.hierarchy || [];
26700
26700
 
@@ -26719,7 +26719,7 @@ class AnimationClip {
26719
26719
 
26720
26720
  for ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {
26721
26721
 
26722
- morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;
26722
+ morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = -1;
26723
26723
 
26724
26724
  }
26725
26725
 
@@ -27084,7 +27084,7 @@ class LoadingManager {
27084
27084
 
27085
27085
  const index = handlers.indexOf( regex );
27086
27086
 
27087
- if ( index !== - 1 ) {
27087
+ if ( index !== -1 ) {
27088
27088
 
27089
27089
  handlers.splice( index, 2 );
27090
27090
 
@@ -28340,13 +28340,13 @@ class PointLightShadow extends LightShadow {
28340
28340
  ];
28341
28341
 
28342
28342
  this._cubeDirections = [
28343
- new Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),
28344
- new Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )
28343
+ new Vector3( 1, 0, 0 ), new Vector3( -1, 0, 0 ), new Vector3( 0, 0, 1 ),
28344
+ new Vector3( 0, 0, -1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, -1, 0 )
28345
28345
  ];
28346
28346
 
28347
28347
  this._cubeUps = [
28348
28348
  new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),
28349
- new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, - 1 )
28349
+ new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ), new Vector3( 0, 0, -1 )
28350
28350
  ];
28351
28351
 
28352
28352
  }
@@ -28438,7 +28438,7 @@ class PointLight extends Light {
28438
28438
 
28439
28439
  class OrthographicCamera extends Camera {
28440
28440
 
28441
- constructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {
28441
+ constructor( left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000 ) {
28442
28442
 
28443
28443
  super();
28444
28444
 
@@ -28573,7 +28573,7 @@ class DirectionalLightShadow extends LightShadow {
28573
28573
 
28574
28574
  constructor() {
28575
28575
 
28576
- super( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );
28576
+ super( new OrthographicCamera( -5, 5, 5, -5, 0.5, 500 ) );
28577
28577
 
28578
28578
  this.isDirectionalLightShadow = true;
28579
28579
 
@@ -29361,7 +29361,7 @@ class LoaderUtils {
29361
29361
 
29362
29362
  const index = url.lastIndexOf( '/' );
29363
29363
 
29364
- if ( index === - 1 ) return './';
29364
+ if ( index === -1 ) return './';
29365
29365
 
29366
29366
  return url.slice( 0, index + 1 );
29367
29367
 
@@ -29857,6 +29857,21 @@ class ObjectLoader extends Loader {
29857
29857
  geometry = bufferGeometryLoader.parse( data );
29858
29858
  break;
29859
29859
 
29860
+ case 'Geometry':
29861
+
29862
+ if ( 'THREE' in window && 'LegacyJSONLoader' in THREE ) {
29863
+
29864
+ var geometryLoader = new THREE.LegacyJSONLoader();
29865
+ geometry = geometryLoader.parse( data, this.resourcePath ).geometry;
29866
+
29867
+
29868
+ } else {
29869
+
29870
+ console.error( 'THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".' );
29871
+
29872
+ }
29873
+ break;
29874
+
29860
29875
  default:
29861
29876
 
29862
29877
  if ( data.type in Geometries ) {
@@ -31240,7 +31255,7 @@ class AudioListener extends Object3D {
31240
31255
 
31241
31256
  this.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );
31242
31257
 
31243
- _orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );
31258
+ _orientation$1.set( 0, 0, -1 ).applyQuaternion( _quaternion$1 );
31244
31259
 
31245
31260
  if ( listener.positionX ) {
31246
31261
 
@@ -32366,7 +32381,7 @@ class PropertyBinding {
32366
32381
 
32367
32382
  const lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );
32368
32383
 
32369
- if ( lastDot !== undefined && lastDot !== - 1 ) {
32384
+ if ( lastDot !== undefined && lastDot !== -1 ) {
32370
32385
 
32371
32386
  const objectName = results.nodeName.substring( lastDot + 1 );
32372
32387
 
@@ -32374,7 +32389,7 @@ class PropertyBinding {
32374
32389
  // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
32375
32390
  // 'bar' could be the objectName, or part of a nodeName (which can
32376
32391
  // include '.' characters).
32377
- if ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {
32392
+ if ( _supportedObjectNames.indexOf( objectName ) !== -1 ) {
32378
32393
 
32379
32394
  results.nodeName = results.nodeName.substring( 0, lastDot );
32380
32395
  results.objectName = objectName;
@@ -32395,7 +32410,7 @@ class PropertyBinding {
32395
32410
 
32396
32411
  static findNode( root, nodeName ) {
32397
32412
 
32398
- if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
32413
+ if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid ) {
32399
32414
 
32400
32415
  return root;
32401
32416
 
@@ -33338,7 +33353,7 @@ class AnimationAction {
33338
33353
  this._weightInterpolant = null;
33339
33354
 
33340
33355
  this.loop = LoopRepeat;
33341
- this._loopCount = - 1;
33356
+ this._loopCount = -1;
33342
33357
 
33343
33358
  // global mixer time when the action is to be started
33344
33359
  // it's set back to 'null' upon start of the action
@@ -33390,7 +33405,7 @@ class AnimationAction {
33390
33405
  this.enabled = true;
33391
33406
 
33392
33407
  this.time = 0; // restart clip
33393
- this._loopCount = - 1;// forget previous loops
33408
+ this._loopCount = -1;// forget previous loops
33394
33409
  this._startTime = null;// forget scheduling
33395
33410
 
33396
33411
  return this.stopFading().stopWarping();
@@ -33785,7 +33800,7 @@ class AnimationAction {
33785
33800
 
33786
33801
  if ( deltaTime === 0 ) {
33787
33802
 
33788
- if ( loopCount === - 1 ) return time;
33803
+ if ( loopCount === -1 ) return time;
33789
33804
 
33790
33805
  return ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;
33791
33806
 
@@ -33793,7 +33808,7 @@ class AnimationAction {
33793
33808
 
33794
33809
  if ( loop === LoopOnce ) {
33795
33810
 
33796
- if ( loopCount === - 1 ) {
33811
+ if ( loopCount === -1 ) {
33797
33812
 
33798
33813
  // just started
33799
33814
 
@@ -33827,14 +33842,14 @@ class AnimationAction {
33827
33842
 
33828
33843
  this._mixer.dispatchEvent( {
33829
33844
  type: 'finished', action: this,
33830
- direction: deltaTime < 0 ? - 1 : 1
33845
+ direction: deltaTime < 0 ? -1 : 1
33831
33846
  } );
33832
33847
 
33833
33848
  }
33834
33849
 
33835
33850
  } else { // repetitive Repeat or PingPong
33836
33851
 
33837
- if ( loopCount === - 1 ) {
33852
+ if ( loopCount === -1 ) {
33838
33853
 
33839
33854
  // just started
33840
33855
 
@@ -33880,7 +33895,7 @@ class AnimationAction {
33880
33895
 
33881
33896
  this._mixer.dispatchEvent( {
33882
33897
  type: 'finished', action: this,
33883
- direction: deltaTime > 0 ? 1 : - 1
33898
+ direction: deltaTime > 0 ? 1 : -1
33884
33899
  } );
33885
33900
 
33886
33901
  } else {
@@ -34836,7 +34851,7 @@ class UniformsGroup extends EventDispatcher {
34836
34851
 
34837
34852
  const index = this.uniforms.indexOf( uniform );
34838
34853
 
34839
- if ( index !== - 1 ) this.uniforms.splice( index, 1 );
34854
+ if ( index !== -1 ) this.uniforms.splice( index, 1 );
34840
34855
 
34841
34856
  return this;
34842
34857
 
@@ -35046,7 +35061,7 @@ class Raycaster {
35046
35061
  } else if ( camera.isOrthographicCamera ) {
35047
35062
 
35048
35063
  this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
35049
- this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
35064
+ this.ray.direction.set( 0, 0, -1 ).transformDirection( camera.matrixWorld );
35050
35065
  this.camera = camera;
35051
35066
 
35052
35067
  } else {
@@ -35062,7 +35077,7 @@ class Raycaster {
35062
35077
  _matrix.identity().extractRotation( controller.matrixWorld );
35063
35078
 
35064
35079
  this.ray.origin.setFromMatrixPosition( controller.matrixWorld );
35065
- this.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );
35080
+ this.ray.direction.set( 0, 0, -1 ).applyMatrix4( _matrix );
35066
35081
 
35067
35082
  return this;
35068
35083
 
@@ -35192,7 +35207,7 @@ class Spherical {
35192
35207
  } else {
35193
35208
 
35194
35209
  this.theta = Math.atan2( x, z );
35195
- this.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );
35210
+ this.phi = Math.acos( clamp( y / this.radius, -1, 1 ) );
35196
35211
 
35197
35212
  }
35198
35213
 
@@ -35656,9 +35671,9 @@ class SpotLightHelper extends Object3D {
35656
35671
  const positions = [
35657
35672
  0, 0, 0, 0, 0, 1,
35658
35673
  0, 0, 0, 1, 0, 1,
35659
- 0, 0, 0, - 1, 0, 1,
35674
+ 0, 0, 0, -1, 0, 1,
35660
35675
  0, 0, 0, 0, 1, 1,
35661
- 0, 0, 0, 0, - 1, 1
35676
+ 0, 0, 0, 0, -1, 1
35662
35677
  ];
35663
35678
 
35664
35679
  for ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {
@@ -36429,7 +36444,7 @@ class CameraHelper extends LineSegments {
36429
36444
  _camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
36430
36445
 
36431
36446
  // Adjust z values based on coordinate system
36432
- const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? - 1 : 0;
36447
+ const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? -1 : 0;
36433
36448
 
36434
36449
  // center / target
36435
36450
  setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
@@ -36437,34 +36452,34 @@ class CameraHelper extends LineSegments {
36437
36452
 
36438
36453
  // near
36439
36454
 
36440
- setPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ );
36441
- setPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ );
36442
- setPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ );
36455
+ setPoint( 'n1', pointMap, geometry, _camera, -1, -1, nearZ );
36456
+ setPoint( 'n2', pointMap, geometry, _camera, w, -1, nearZ );
36457
+ setPoint( 'n3', pointMap, geometry, _camera, -1, h, nearZ );
36443
36458
  setPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );
36444
36459
 
36445
36460
  // far
36446
36461
 
36447
- setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );
36448
- setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );
36449
- setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );
36462
+ setPoint( 'f1', pointMap, geometry, _camera, -1, -1, 1 );
36463
+ setPoint( 'f2', pointMap, geometry, _camera, w, -1, 1 );
36464
+ setPoint( 'f3', pointMap, geometry, _camera, -1, h, 1 );
36450
36465
  setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
36451
36466
 
36452
36467
  // up
36453
36468
 
36454
36469
  setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, nearZ );
36455
- setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, nearZ );
36470
+ setPoint( 'u2', pointMap, geometry, _camera, -1 * 0.7, h * 1.1, nearZ );
36456
36471
  setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, nearZ );
36457
36472
 
36458
36473
  // cross
36459
36474
 
36460
- setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );
36475
+ setPoint( 'cf1', pointMap, geometry, _camera, -1, 0, 1 );
36461
36476
  setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
36462
- setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
36477
+ setPoint( 'cf3', pointMap, geometry, _camera, 0, -1, 1 );
36463
36478
  setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
36464
36479
 
36465
- setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
36480
+ setPoint( 'cn1', pointMap, geometry, _camera, -1, 0, nearZ );
36466
36481
  setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
36467
- setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, nearZ );
36482
+ setPoint( 'cn3', pointMap, geometry, _camera, 0, -1, nearZ );
36468
36483
  setPoint( 'cn4', pointMap, geometry, _camera, 0, h, nearZ );
36469
36484
 
36470
36485
  geometry.getAttribute( 'position' ).needsUpdate = true;
@@ -36612,7 +36627,7 @@ class Box3Helper extends LineSegments {
36612
36627
 
36613
36628
  const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
36614
36629
 
36615
- const positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];
36630
+ const positions = [ 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1 ];
36616
36631
 
36617
36632
  const geometry = new BufferGeometry();
36618
36633
 
@@ -36661,7 +36676,7 @@ class PlaneHelper extends Line {
36661
36676
 
36662
36677
  const color = hex;
36663
36678
 
36664
- const positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];
36679
+ const positions = [ 1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0 ];
36665
36680
 
36666
36681
  const geometry = new BufferGeometry();
36667
36682
  geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
@@ -36675,7 +36690,7 @@ class PlaneHelper extends Line {
36675
36690
 
36676
36691
  this.size = size;
36677
36692
 
36678
- const positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];
36693
+ const positions2 = [ 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0 ];
36679
36694
 
36680
36695
  const geometry2 = new BufferGeometry();
36681
36696
  geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
@@ -36729,7 +36744,7 @@ class ArrowHelper extends Object3D {
36729
36744
  _lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
36730
36745
 
36731
36746
  _coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );
36732
- _coneGeometry.translate( 0, - 0.5, 0 );
36747
+ _coneGeometry.translate( 0, -0.5, 0 );
36733
36748
 
36734
36749
  }
36735
36750
 
@@ -36756,7 +36771,7 @@ class ArrowHelper extends Object3D {
36756
36771
 
36757
36772
  this.quaternion.set( 0, 0, 0, 1 );
36758
36773
 
36759
- } else if ( dir.y < - 0.99999 ) {
36774
+ } else if ( dir.y < -0.99999 ) {
36760
36775
 
36761
36776
  this.quaternion.set( 1, 0, 0, 0 );
36762
36777
 
@@ -37167,7 +37182,7 @@ class Controls extends EventDispatcher {
37167
37182
 
37168
37183
  this.enabled = true;
37169
37184
 
37170
- this.state = - 1;
37185
+ this.state = -1;
37171
37186
 
37172
37187
  this.keys = {};
37173
37188
  this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };
@@ -38162,7 +38177,7 @@ const UniformsLib = {
38162
38177
 
38163
38178
  envMap: { value: null },
38164
38179
  envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
38165
- flipEnvMap: { value: - 1 },
38180
+ flipEnvMap: { value: -1 },
38166
38181
  reflectivity: { value: 1.0 }, // basic, lambert, phong
38167
38182
  ior: { value: 1.5 }, // physical
38168
38183
  refractionRatio: { value: 0.98 }, // basic, lambert, phong
@@ -38583,7 +38598,7 @@ const ShaderLib = {
38583
38598
 
38584
38599
  uniforms: {
38585
38600
  envMap: { value: null },
38586
- flipEnvMap: { value: - 1 },
38601
+ flipEnvMap: { value: -1 },
38587
38602
  backgroundBlurriness: { value: 0 },
38588
38603
  backgroundIntensity: { value: 1 },
38589
38604
  backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
@@ -38598,7 +38613,7 @@ const ShaderLib = {
38598
38613
 
38599
38614
  uniforms: {
38600
38615
  tCube: { value: null },
38601
- tFlip: { value: - 1 },
38616
+ tFlip: { value: -1 },
38602
38617
  opacity: { value: 1.0 }
38603
38618
  },
38604
38619
 
@@ -38792,7 +38807,7 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
38792
38807
  if ( boxMesh === undefined ) {
38793
38808
 
38794
38809
  boxMesh = new Mesh(
38795
- new BoxGeometry( 1, 1, 1 ),
38810
+ new BoxGeometry( 10000, 10000, 10000 ),
38796
38811
  new ShaderMaterial( {
38797
38812
  name: 'BackgroundCubeMaterial',
38798
38813
  uniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),
@@ -38832,18 +38847,18 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
38832
38847
  _e1$1.copy( scene.backgroundRotation );
38833
38848
 
38834
38849
  // accommodate left-handed frame
38835
- _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
38850
+ _e1$1.x *= -1; _e1$1.y *= -1; _e1$1.z *= -1;
38836
38851
 
38837
38852
  if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
38838
38853
 
38839
38854
  // environment maps which are not cube render targets or PMREMs follow a different convention
38840
- _e1$1.y *= - 1;
38841
- _e1$1.z *= - 1;
38855
+ _e1$1.y *= -1;
38856
+ _e1$1.z *= -1;
38842
38857
 
38843
38858
  }
38844
38859
 
38845
38860
  boxMesh.material.uniforms.envMap.value = background;
38846
- boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
38861
+ boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? -1 : 1;
38847
38862
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
38848
38863
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
38849
38864
  boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
@@ -40107,9 +40122,9 @@ const _axisDirections = [
40107
40122
  /*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
40108
40123
  /*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
40109
40124
  /*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
40110
- /*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
40111
- /*@__PURE__*/ new Vector3( 1, 1, - 1 ),
40112
- /*@__PURE__*/ new Vector3( - 1, 1, 1 ),
40125
+ /*@__PURE__*/ new Vector3( -1, 1, -1 ),
40126
+ /*@__PURE__*/ new Vector3( 1, 1, -1 ),
40127
+ /*@__PURE__*/ new Vector3( -1, 1, 1 ),
40113
40128
  /*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
40114
40129
 
40115
40130
  /**
@@ -40377,8 +40392,8 @@ class PMREMGenerator {
40377
40392
  const fov = 90;
40378
40393
  const aspect = 1;
40379
40394
  const cubeCamera = new PerspectiveCamera( fov, aspect, near, far );
40380
- const upSign = [ 1, - 1, 1, 1, 1, 1 ];
40381
- const forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];
40395
+ const upSign = [ 1, -1, 1, 1, 1, 1 ];
40396
+ const forwardSign = [ 1, 1, 1, -1, -1, -1 ];
40382
40397
  const renderer = this._renderer;
40383
40398
 
40384
40399
  const originalAutoClear = renderer.autoClear;
@@ -40477,7 +40492,7 @@ class PMREMGenerator {
40477
40492
 
40478
40493
  }
40479
40494
 
40480
- this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
40495
+ this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? -1 : 1;
40481
40496
 
40482
40497
  } else {
40483
40498
 
@@ -40696,7 +40711,7 @@ function _createPlanes( lodMax ) {
40696
40711
  for ( let face = 0; face < cubeFaces; face ++ ) {
40697
40712
 
40698
40713
  const x = ( face % 3 ) * 2 / 3 - 1;
40699
- const y = face > 2 ? 0 : - 1;
40714
+ const y = face > 2 ? 0 : -1;
40700
40715
  const coordinates = [
40701
40716
  x, y, 0,
40702
40717
  x + 2 / 3, y, 0,
@@ -40895,7 +40910,7 @@ function _getCubemapMaterial() {
40895
40910
 
40896
40911
  uniforms: {
40897
40912
  'envMap': { value: null },
40898
- 'flipEnvMap': { value: - 1 }
40913
+ 'flipEnvMap': { value: -1 }
40899
40914
  },
40900
40915
 
40901
40916
  vertexShader: _getCommonVertexShader(),
@@ -41703,6 +41718,103 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
41703
41718
 
41704
41719
  }
41705
41720
 
41721
+ /**
41722
+ * @author fernandojsg / http://fernandojsg.com
41723
+ * @author Takahiro https://github.com/takahirox
41724
+ */
41725
+
41726
+ class WebGLMultiview {
41727
+
41728
+ constructor( renderer, extensions, gl ) {
41729
+
41730
+ this.renderer = renderer;
41731
+
41732
+ this.DEFAULT_NUMVIEWS = 2;
41733
+ this.maxNumViews = 0;
41734
+ this.gl = gl;
41735
+
41736
+ this.extensions = extensions;
41737
+
41738
+ this.available = this.extensions.has( 'OCULUS_multiview' );
41739
+
41740
+ if ( this.available ) {
41741
+
41742
+ const extension = this.extensions.get( 'OCULUS_multiview' );
41743
+
41744
+ this.maxNumViews = this.gl.getParameter( extension.MAX_VIEWS_OVR );
41745
+
41746
+ this.mat4 = [];
41747
+ this.mat3 = [];
41748
+ this.cameraArray = [];
41749
+
41750
+ for ( var i = 0; i < this.maxNumViews; i ++ ) {
41751
+
41752
+ this.mat4[ i ] = new Matrix4();
41753
+ this.mat3[ i ] = new Matrix3();
41754
+
41755
+ }
41756
+
41757
+ }
41758
+
41759
+ }
41760
+
41761
+ //
41762
+ getCameraArray( camera ) {
41763
+
41764
+ if ( camera.isArrayCamera ) return camera.cameras;
41765
+
41766
+ this.cameraArray[ 0 ] = camera;
41767
+
41768
+ return this.cameraArray;
41769
+
41770
+ }
41771
+
41772
+ updateCameraProjectionMatricesUniform( camera, uniforms ) {
41773
+
41774
+ var cameras = this.getCameraArray( camera );
41775
+
41776
+ for ( var i = 0; i < cameras.length; i ++ ) {
41777
+
41778
+ this.mat4[ i ].copy( cameras[ i ].projectionMatrix );
41779
+
41780
+ }
41781
+
41782
+ uniforms.setValue( this.gl, 'projectionMatrices', this.mat4 );
41783
+
41784
+ }
41785
+
41786
+ updateCameraViewMatricesUniform( camera, uniforms ) {
41787
+
41788
+ var cameras = this.getCameraArray( camera );
41789
+
41790
+ for ( var i = 0; i < cameras.length; i ++ ) {
41791
+
41792
+ this.mat4[ i ].copy( cameras[ i ].matrixWorldInverse );
41793
+
41794
+ }
41795
+
41796
+ uniforms.setValue( this.gl, 'viewMatrices', this.mat4 );
41797
+
41798
+ }
41799
+
41800
+ updateObjectMatricesUniforms( object, camera, uniforms ) {
41801
+
41802
+ var cameras = this.getCameraArray( camera );
41803
+
41804
+ for ( var i = 0; i < cameras.length; i ++ ) {
41805
+
41806
+ this.mat4[ i ].multiplyMatrices( cameras[ i ].matrixWorldInverse, object.matrixWorld );
41807
+ this.mat3[ i ].getNormalMatrix( this.mat4[ i ] );
41808
+
41809
+ }
41810
+
41811
+ uniforms.setValue( this.gl, 'modelViewMatrices', this.mat4 );
41812
+ uniforms.setValue( this.gl, 'normalMatrices', this.mat3 );
41813
+
41814
+ }
41815
+
41816
+ }
41817
+
41706
41818
  function WebGLObjects( gl, geometries, attributes, info ) {
41707
41819
 
41708
41820
  let updateMap = new WeakMap();
@@ -43454,6 +43566,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
43454
43566
  let prefixVertex, prefixFragment;
43455
43567
  let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
43456
43568
 
43569
+ const numMultiviewViews = parameters.numMultiviewViews;
43570
+
43457
43571
  if ( parameters.isRawShaderMaterial ) {
43458
43572
 
43459
43573
  prefixVertex = [
@@ -43841,6 +43955,53 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
43841
43955
  '#define textureCubeGradEXT textureGrad'
43842
43956
  ].join( '\n' ) + '\n' + prefixFragment;
43843
43957
 
43958
+ // Multiview
43959
+
43960
+ if ( numMultiviewViews > 0 ) {
43961
+
43962
+ // TODO: fix light transforms here?
43963
+
43964
+ prefixVertex = [
43965
+ '#extension GL_OVR_multiview : require',
43966
+ 'layout(num_views = ' + numMultiviewViews + ') in;',
43967
+ '#define VIEW_ID gl_ViewID_OVR'
43968
+ ].join( '\n' ) + '\n' + prefixVertex;
43969
+
43970
+ prefixVertex = prefixVertex.replace(
43971
+ [
43972
+ 'uniform mat4 modelViewMatrix;',
43973
+ 'uniform mat4 projectionMatrix;',
43974
+ 'uniform mat4 viewMatrix;',
43975
+ 'uniform mat3 normalMatrix;'
43976
+ ].join( '\n' ),
43977
+ [
43978
+ 'uniform mat4 modelViewMatrices[' + numMultiviewViews + '];',
43979
+ 'uniform mat4 projectionMatrices[' + numMultiviewViews + '];',
43980
+ 'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
43981
+ 'uniform mat3 normalMatrices[' + numMultiviewViews + '];',
43982
+
43983
+ '#define modelViewMatrix modelViewMatrices[VIEW_ID]',
43984
+ '#define projectionMatrix projectionMatrices[VIEW_ID]',
43985
+ '#define viewMatrix viewMatrices[VIEW_ID]',
43986
+ '#define normalMatrix normalMatrices[VIEW_ID]'
43987
+ ].join( '\n' )
43988
+ );
43989
+
43990
+ prefixFragment = [
43991
+ '#extension GL_OVR_multiview : require',
43992
+ '#define VIEW_ID gl_ViewID_OVR'
43993
+ ].join( '\n' ) + '\n' + prefixFragment;
43994
+
43995
+ prefixFragment = prefixFragment.replace(
43996
+ 'uniform mat4 viewMatrix;',
43997
+ [
43998
+ 'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
43999
+ '#define viewMatrix viewMatrices[VIEW_ID]'
44000
+ ].join( '\n' )
44001
+ );
44002
+
44003
+ }
44004
+
43844
44005
  }
43845
44006
 
43846
44007
  const vertexGlsl = versionString + prefixVertex + vertexShader;
@@ -44033,6 +44194,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
44033
44194
  this.program = program;
44034
44195
  this.vertexShader = glVertexShader;
44035
44196
  this.fragmentShader = glFragmentShader;
44197
+ this.numMultiviewViews = numMultiviewViews;
44036
44198
 
44037
44199
  return this;
44038
44200
 
@@ -44265,6 +44427,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
44265
44427
  const currentRenderTarget = renderer.getRenderTarget();
44266
44428
  const reverseDepthBuffer = renderer.state.buffers.depth.getReversed();
44267
44429
 
44430
+ const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
44431
+
44268
44432
  const IS_INSTANCEDMESH = object.isInstancedMesh === true;
44269
44433
  const IS_BATCHEDMESH = object.isBatchedMesh === true;
44270
44434
 
@@ -44354,6 +44518,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
44354
44518
  instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
44355
44519
 
44356
44520
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
44521
+ numMultiviewViews: numMultiviewViews,
44357
44522
  outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
44358
44523
  alphaToCoverage: !! material.alphaToCoverage,
44359
44524
 
@@ -44718,6 +44883,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
44718
44883
  _programLayers.enable( 20 );
44719
44884
  if ( parameters.alphaToCoverage )
44720
44885
  _programLayers.enable( 21 );
44886
+ if ( parameters.numMultiviewViews )
44887
+ _programLayers.enable( 21 );
44721
44888
 
44722
44889
  array.push( _programLayers.mask );
44723
44890
 
@@ -45265,18 +45432,18 @@ function WebGLLights( extensions ) {
45265
45432
  version: 0,
45266
45433
 
45267
45434
  hash: {
45268
- directionalLength: - 1,
45269
- pointLength: - 1,
45270
- spotLength: - 1,
45271
- rectAreaLength: - 1,
45272
- hemiLength: - 1,
45273
-
45274
- numDirectionalShadows: - 1,
45275
- numPointShadows: - 1,
45276
- numSpotShadows: - 1,
45277
- numSpotMaps: - 1,
45278
-
45279
- numLightProbes: - 1
45435
+ directionalLength: -1,
45436
+ pointLength: -1,
45437
+ spotLength: -1,
45438
+ rectAreaLength: -1,
45439
+ hemiLength: -1,
45440
+
45441
+ numDirectionalShadows: -1,
45442
+ numPointShadows: -1,
45443
+ numSpotShadows: -1,
45444
+ numSpotMaps: -1,
45445
+
45446
+ numLightProbes: -1
45280
45447
  },
45281
45448
 
45282
45449
  ambient: [ 0, 0, 0 ],
@@ -45817,7 +45984,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
45817
45984
  fullScreenTri.setAttribute(
45818
45985
  'position',
45819
45986
  new BufferAttribute(
45820
- new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),
45987
+ new Float32Array( [ -1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5 ] ),
45821
45988
  3
45822
45989
  )
45823
45990
  );
@@ -46250,7 +46417,7 @@ function WebGLState( gl, extensions ) {
46250
46417
  locked = false;
46251
46418
 
46252
46419
  currentColorMask = null;
46253
- currentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state
46420
+ currentColorClear.set( -1, 0, 0, 0 ); // set to invalid state
46254
46421
 
46255
46422
  }
46256
46423
 
@@ -46579,12 +46746,12 @@ function WebGLState( gl, extensions ) {
46579
46746
  let version = 0;
46580
46747
  const glVersion = gl.getParameter( gl.VERSION );
46581
46748
 
46582
- if ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {
46749
+ if ( glVersion.indexOf( 'WebGL' ) !== -1 ) {
46583
46750
 
46584
46751
  version = parseFloat( /^WebGL (\d)/.exec( glVersion )[ 1 ] );
46585
46752
  lineWidthAvailable = ( version >= 1.0 );
46586
46753
 
46587
- } else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {
46754
+ } else if ( glVersion.indexOf( 'OpenGL ES' ) !== -1 ) {
46588
46755
 
46589
46756
  version = parseFloat( /^OpenGL ES (\d)/.exec( glVersion )[ 1 ] );
46590
46757
  lineWidthAvailable = ( version >= 2.0 );
@@ -47515,6 +47682,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
47515
47682
 
47516
47683
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
47517
47684
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
47685
+ const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
47518
47686
 
47519
47687
  const _imageDimensions = new Vector2();
47520
47688
  const _videoTextures = new WeakMap();
@@ -47522,6 +47690,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
47522
47690
 
47523
47691
  const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
47524
47692
 
47693
+ let _deferredUploads = [];
47694
+ let _deferTextureUploads = false;
47695
+
47525
47696
  // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
47526
47697
  // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
47527
47698
  // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
@@ -48036,8 +48207,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48036
48207
 
48037
48208
  } else {
48038
48209
 
48039
- uploadTexture( textureProperties, texture, slot );
48040
- return;
48210
+ if ( uploadTexture( textureProperties, texture, slot ) ) {
48211
+
48212
+ return;
48213
+
48214
+ }
48041
48215
 
48042
48216
  }
48043
48217
 
@@ -48246,8 +48420,45 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48246
48420
 
48247
48421
  }
48248
48422
 
48423
+ function setDeferTextureUploads( deferFlag ) {
48424
+
48425
+ _deferTextureUploads = deferFlag;
48426
+
48427
+ }
48428
+
48429
+ function runDeferredUploads() {
48430
+
48431
+ const previousDeferSetting = _deferTextureUploads;
48432
+ _deferTextureUploads = false;
48433
+
48434
+ for ( const upload of _deferredUploads ) {
48435
+
48436
+ uploadTexture( upload.textureProperties, upload.texture, upload.slot );
48437
+ upload.texture.isPendingDeferredUpload = false;
48438
+
48439
+ }
48440
+
48441
+ _deferredUploads = [];
48442
+
48443
+ _deferTextureUploads = previousDeferSetting;
48444
+
48445
+ }
48446
+
48249
48447
  function uploadTexture( textureProperties, texture, slot ) {
48250
48448
 
48449
+ if ( _deferTextureUploads ) {
48450
+
48451
+ if ( ! texture.isPendingDeferredUpload ) {
48452
+
48453
+ texture.isPendingDeferredUpload = true;
48454
+ _deferredUploads.push( { textureProperties: textureProperties, texture: texture, slot: slot } );
48455
+
48456
+ }
48457
+
48458
+ return false;
48459
+
48460
+ }
48461
+
48251
48462
  let textureType = _gl.TEXTURE_2D;
48252
48463
 
48253
48464
  if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
@@ -48677,6 +48888,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48677
48888
  }
48678
48889
 
48679
48890
  textureProperties.__version = texture.version;
48891
+ return true;
48680
48892
 
48681
48893
  }
48682
48894
 
@@ -48935,7 +49147,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48935
49147
  const width = Math.max( 1, renderTarget.width >> level );
48936
49148
  const height = Math.max( 1, renderTarget.height >> level );
48937
49149
 
48938
- if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
49150
+ if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
49151
+
49152
+ state.texStorage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.numViews );
49153
+
49154
+ } else if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
48939
49155
 
48940
49156
  state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
48941
49157
 
@@ -48949,13 +49165,31 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48949
49165
 
48950
49166
  state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
48951
49167
 
48952
- if ( useMultisampledRTT( renderTarget ) ) {
49168
+ const multisampled = useMultisampledRTT( renderTarget );
49169
+
49170
+ if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
49171
+
49172
+ if ( multisampled ) {
49173
+
49174
+ multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ), 0, renderTarget.numViews );
48953
49175
 
48954
- multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
49176
+ } else {
49177
+
49178
+ multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, 0, renderTarget.numViews );
49179
+
49180
+ }
48955
49181
 
48956
49182
  } else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
48957
49183
 
48958
- _gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
49184
+ if ( multisampled ) {
49185
+
49186
+ multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
49187
+
49188
+ } else {
49189
+
49190
+ _gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
49191
+
49192
+ }
48959
49193
 
48960
49194
  }
48961
49195
 
@@ -48968,7 +49202,59 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
48968
49202
 
48969
49203
  _gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
48970
49204
 
48971
- if ( renderTarget.depthBuffer ) {
49205
+ if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
49206
+
49207
+ const useMultisample = useMultisampledRTT( renderTarget );
49208
+ const numViews = renderTarget.numViews;
49209
+
49210
+ const depthTexture = renderTarget.depthTexture;
49211
+ let glInternalFormat = _gl.DEPTH_COMPONENT24;
49212
+ let glDepthAttachment = _gl.DEPTH_ATTACHMENT;
49213
+
49214
+ if ( depthTexture && depthTexture.isDepthTexture ) {
49215
+
49216
+ if ( depthTexture.type === FloatType ) {
49217
+
49218
+ glInternalFormat = _gl.DEPTH_COMPONENT32F;
49219
+
49220
+ } else if ( depthTexture.type === UnsignedInt248Type ) {
49221
+
49222
+ glInternalFormat = _gl.DEPTH24_STENCIL8;
49223
+ glDepthAttachment = _gl.DEPTH_STENCIL_ATTACHMENT;
49224
+
49225
+ }
49226
+
49227
+ // we're defaulting to _gl.DEPTH_COMPONENT24 so don't assign here
49228
+ // or else DeepScan will complain
49229
+
49230
+ // else if ( depthTexture.type === UnsignedIntType ) {
49231
+
49232
+ // glInternalFormat = _gl.DEPTH_COMPONENT24;
49233
+
49234
+ // }
49235
+
49236
+ }
49237
+
49238
+ let depthStencilTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
49239
+ if ( depthStencilTexture === undefined ) {
49240
+
49241
+ depthStencilTexture = _gl.createTexture();
49242
+ _gl.bindTexture( _gl.TEXTURE_2D_ARRAY, depthStencilTexture );
49243
+ _gl.texStorage3D( _gl.TEXTURE_2D_ARRAY, 1, glInternalFormat, renderTarget.width, renderTarget.height, numViews );
49244
+
49245
+ }
49246
+
49247
+ if ( useMultisample ) {
49248
+
49249
+ multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, getRenderTargetSamples( renderTarget ), 0, numViews );
49250
+
49251
+ } else {
49252
+
49253
+ multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, 0, numViews );
49254
+
49255
+ }
49256
+
49257
+ } else if ( renderTarget.depthBuffer ) {
48972
49258
 
48973
49259
  // retrieve the depth attachment types
48974
49260
  const depthTexture = renderTarget.depthTexture;
@@ -49058,38 +49344,85 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
49058
49344
 
49059
49345
  }
49060
49346
 
49061
- setTexture2D( renderTarget.depthTexture, 0 );
49347
+ if ( renderTarget.depthTexture.image.depth != 1 ) {
49348
+
49349
+ setTexture2DArray( renderTarget.depthTexture, 0 );
49350
+
49351
+ } else {
49352
+
49353
+ setTexture2D( renderTarget.depthTexture, 0 );
49354
+
49355
+ }
49062
49356
 
49063
49357
  const webglDepthTexture = textureProperties.__webglTexture;
49064
49358
  const samples = getRenderTargetSamples( renderTarget );
49065
49359
 
49066
- if ( renderTarget.depthTexture.format === DepthFormat ) {
49360
+ if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
49067
49361
 
49068
- if ( useMultisampledRTT( renderTarget ) ) {
49362
+ const useMultisample = useMultisampledRTT( renderTarget );
49363
+ const numViews = renderTarget.numViews;
49069
49364
 
49070
- multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
49365
+ if ( renderTarget.depthTexture.format === DepthFormat ) {
49071
49366
 
49072
- } else {
49367
+ if ( useMultisample ) {
49073
49368
 
49074
- _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
49369
+ multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, webglDepthTexture, 0, samples, 0, numViews );
49075
49370
 
49076
- }
49371
+ } else {
49372
+
49373
+ multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, webglDepthTexture, 0, 0, numViews );
49374
+
49375
+ }
49376
+
49377
+ } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
49378
+
49379
+ if ( useMultisample ) {
49077
49380
 
49078
- } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
49381
+ multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, webglDepthTexture, 0, samples, 0, numViews );
49079
49382
 
49080
- if ( useMultisampledRTT( renderTarget ) ) {
49383
+ } else {
49384
+
49385
+ multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, webglDepthTexture, 0, 0, numViews );
49081
49386
 
49082
- multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
49387
+ }
49083
49388
 
49084
49389
  } else {
49085
49390
 
49086
- _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
49391
+ throw new Error( 'Unknown depthTexture format' );
49087
49392
 
49088
49393
  }
49089
49394
 
49090
49395
  } else {
49091
49396
 
49092
- throw new Error( 'Unknown depthTexture format' );
49397
+ if ( renderTarget.depthTexture.format === DepthFormat ) {
49398
+
49399
+ if ( useMultisampledRTT( renderTarget ) ) {
49400
+
49401
+ multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
49402
+
49403
+ } else {
49404
+
49405
+ _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
49406
+
49407
+ }
49408
+
49409
+ } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
49410
+
49411
+ if ( useMultisampledRTT( renderTarget ) ) {
49412
+
49413
+ multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
49414
+
49415
+ } else {
49416
+
49417
+ _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
49418
+
49419
+ }
49420
+
49421
+ } else {
49422
+
49423
+ throw new Error( 'Unknown depthTexture format' );
49424
+
49425
+ }
49093
49426
 
49094
49427
  }
49095
49428
 
@@ -49404,6 +49737,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
49404
49737
 
49405
49738
  }
49406
49739
 
49740
+ if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
49741
+
49742
+ glTextureType = _gl.TEXTURE_2D_ARRAY;
49743
+
49744
+ }
49745
+
49407
49746
  state.bindTexture( glTextureType, textureProperties.__webglTexture );
49408
49747
  setTextureParameters( glTextureType, texture );
49409
49748
 
@@ -49433,9 +49772,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
49433
49772
 
49434
49773
  // Setup depth and stencil buffers
49435
49774
 
49436
- if ( renderTarget.depthBuffer ) {
49775
+ if ( renderTarget.depthBuffer || renderTarget.isWebGLMultiviewRenderTarget === true ) {
49437
49776
 
49438
- setupDepthRenderbuffer( renderTarget );
49777
+ this.setupDepthRenderbuffer( renderTarget );
49439
49778
 
49440
49779
  }
49441
49780
 
@@ -49680,12 +50019,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
49680
50019
  this.setTexture3D = setTexture3D;
49681
50020
  this.setTextureCube = setTextureCube;
49682
50021
  this.rebindTextures = rebindTextures;
50022
+ this.uploadTexture = uploadTexture;
49683
50023
  this.setupRenderTarget = setupRenderTarget;
49684
50024
  this.updateRenderTargetMipmap = updateRenderTargetMipmap;
49685
50025
  this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
50026
+ this.setupDepthTexture = setupDepthTexture;
49686
50027
  this.setupDepthRenderbuffer = setupDepthRenderbuffer;
49687
50028
  this.setupFrameBufferTexture = setupFrameBufferTexture;
49688
50029
  this.useMultisampledRTT = useMultisampledRTT;
50030
+ this.runDeferredUploads = runDeferredUploads;
50031
+ this.setDeferTextureUploads = setDeferTextureUploads;
49689
50032
 
49690
50033
  }
49691
50034
 
@@ -49898,6 +50241,39 @@ function WebGLUtils( gl, extensions ) {
49898
50241
 
49899
50242
  }
49900
50243
 
50244
+ /**
50245
+ * @author fernandojsg / http://fernandojsg.com
50246
+ * @author Takahiro https://github.com/takahirox
50247
+ */
50248
+
50249
+
50250
+ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
50251
+
50252
+ constructor( width, height, numViews, options = {} ) {
50253
+
50254
+ super( width, height, options );
50255
+
50256
+ this.depthBuffer = false;
50257
+ this.stencilBuffer = false;
50258
+
50259
+ this.numViews = numViews;
50260
+
50261
+ }
50262
+
50263
+ copy( source ) {
50264
+
50265
+ super.copy( source );
50266
+
50267
+ this.numViews = source.numViews;
50268
+
50269
+ return this;
50270
+
50271
+ }
50272
+
50273
+ }
50274
+
50275
+ WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
50276
+
49901
50277
  const _occlusion_vertex = `
49902
50278
  void main() {
49903
50279
 
@@ -50004,7 +50380,7 @@ class WebXRDepthSensing {
50004
50380
 
50005
50381
  class WebXRManager extends EventDispatcher {
50006
50382
 
50007
- constructor( renderer, gl ) {
50383
+ constructor( renderer, gl, extensions, useMultiview ) {
50008
50384
 
50009
50385
  super();
50010
50386
 
@@ -50013,6 +50389,7 @@ class WebXRManager extends EventDispatcher {
50013
50389
  let session = null;
50014
50390
 
50015
50391
  let framebufferScaleFactor = 1.0;
50392
+ var poseTarget = null;
50016
50393
 
50017
50394
  let referenceSpace = null;
50018
50395
  let referenceSpaceType = 'local-floor';
@@ -50021,6 +50398,8 @@ class WebXRManager extends EventDispatcher {
50021
50398
  let customReferenceSpace = null;
50022
50399
 
50023
50400
  let pose = null;
50401
+ var layers = [];
50402
+
50024
50403
  let glBinding = null;
50025
50404
  let glProjLayer = null;
50026
50405
  let glBaseLayer = null;
@@ -50054,11 +50433,18 @@ class WebXRManager extends EventDispatcher {
50054
50433
  let _currentDepthFar = null;
50055
50434
 
50056
50435
  //
50057
-
50058
50436
  this.cameraAutoUpdate = true;
50437
+ this.layersEnabled = false;
50059
50438
  this.enabled = false;
50060
50439
 
50061
50440
  this.isPresenting = false;
50441
+ this.isMultiview = false;
50442
+
50443
+ this.getCameraPose = function ( ) {
50444
+
50445
+ return pose;
50446
+
50447
+ };
50062
50448
 
50063
50449
  this.getController = function ( index ) {
50064
50450
 
@@ -50111,7 +50497,7 @@ class WebXRManager extends EventDispatcher {
50111
50497
 
50112
50498
  const controllerIndex = controllerInputSources.indexOf( event.inputSource );
50113
50499
 
50114
- if ( controllerIndex === - 1 ) {
50500
+ if ( controllerIndex === -1 ) {
50115
50501
 
50116
50502
  return;
50117
50503
 
@@ -50158,6 +50544,8 @@ class WebXRManager extends EventDispatcher {
50158
50544
 
50159
50545
  // restore framebuffer/rendering state
50160
50546
 
50547
+ scope.isPresenting = false;
50548
+
50161
50549
  renderer.setRenderTarget( initialRenderTarget );
50162
50550
 
50163
50551
  glBaseLayer = null;
@@ -50170,8 +50558,6 @@ class WebXRManager extends EventDispatcher {
50170
50558
 
50171
50559
  animation.stop();
50172
50560
 
50173
- scope.isPresenting = false;
50174
-
50175
50561
  renderer.setPixelRatio( currentPixelRatio );
50176
50562
  renderer.setSize( currentSize.width, currentSize.height, false );
50177
50563
 
@@ -50227,6 +50613,12 @@ class WebXRManager extends EventDispatcher {
50227
50613
 
50228
50614
  };
50229
50615
 
50616
+ this.getRenderTarget = function () {
50617
+
50618
+ return newRenderTarget;
50619
+
50620
+ };
50621
+
50230
50622
  this.getFrame = function () {
50231
50623
 
50232
50624
  return xrFrame;
@@ -50311,12 +50703,20 @@ class WebXRManager extends EventDispatcher {
50311
50703
 
50312
50704
  }
50313
50705
 
50706
+ scope.isMultiview = useMultiview && extensions.has( 'OCULUS_multiview' );
50707
+
50314
50708
  const projectionlayerInit = {
50315
50709
  colorFormat: gl.RGBA8,
50316
50710
  depthFormat: glDepthFormat,
50317
50711
  scaleFactor: framebufferScaleFactor
50318
50712
  };
50319
50713
 
50714
+ if ( scope.isMultiview ) {
50715
+
50716
+ projectionlayerInit.textureType = 'texture-array';
50717
+
50718
+ }
50719
+
50320
50720
  glBinding = new XRWebGLBinding( session, gl );
50321
50721
 
50322
50722
  glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
@@ -50326,18 +50726,32 @@ class WebXRManager extends EventDispatcher {
50326
50726
  renderer.setPixelRatio( 1 );
50327
50727
  renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );
50328
50728
 
50329
- newRenderTarget = new WebGLRenderTarget(
50330
- glProjLayer.textureWidth,
50331
- glProjLayer.textureHeight,
50332
- {
50333
- format: RGBAFormat,
50334
- type: UnsignedByteType,
50335
- depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
50336
- stencilBuffer: attributes.stencil,
50337
- colorSpace: renderer.outputColorSpace,
50338
- samples: attributes.antialias ? 4 : 0,
50339
- resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
50340
- } );
50729
+ const renderTargetOptions = {
50730
+ format: RGBAFormat,
50731
+ type: UnsignedByteType,
50732
+ depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
50733
+ stencilBuffer: attributes.stencil,
50734
+ colorSpace: renderer.outputColorSpace,
50735
+ samples: attributes.antialias ? 4 : 0,
50736
+ resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
50737
+ };
50738
+
50739
+ if ( scope.isMultiview ) {
50740
+
50741
+ const extension = extensions.get( 'OCULUS_multiview' );
50742
+
50743
+ this.maxNumViews = gl.getParameter( extension.MAX_VIEWS_OVR );
50744
+
50745
+ newRenderTarget = new WebGLMultiviewRenderTarget( glProjLayer.textureWidth, glProjLayer.textureHeight, 2, renderTargetOptions );
50746
+
50747
+ } else {
50748
+
50749
+ newRenderTarget = new WebGLRenderTarget(
50750
+ glProjLayer.textureWidth,
50751
+ glProjLayer.textureHeight,
50752
+ renderTargetOptions );
50753
+
50754
+ }
50341
50755
 
50342
50756
  }
50343
50757
 
@@ -50366,7 +50780,28 @@ class WebXRManager extends EventDispatcher {
50366
50780
  return session.environmentBlendMode;
50367
50781
 
50368
50782
  }
50783
+ };
50784
+
50785
+ this.addLayer = function(layer) {
50786
+ if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
50787
+
50788
+ layers.push( layer );
50789
+ this.updateLayers();
50790
+ };
50791
+
50792
+ this.removeLayer = function(layer) {
50793
+
50794
+ layers.splice( layers.indexOf(layer), 1 );
50795
+ if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
50796
+
50797
+ this.updateLayers();
50798
+ };
50369
50799
 
50800
+ this.updateLayers = function() {
50801
+ var layersCopy = layers.map(function (x) { return x; });
50802
+
50803
+ layersCopy.unshift( session.renderState.layers[0] );
50804
+ session.updateRenderState( { layers: layersCopy } );
50370
50805
  };
50371
50806
 
50372
50807
  this.getDepthTexture = function () {
@@ -50401,7 +50836,7 @@ class WebXRManager extends EventDispatcher {
50401
50836
 
50402
50837
  let controllerIndex = controllerInputSources.indexOf( inputSource );
50403
50838
 
50404
- if ( controllerIndex === - 1 ) {
50839
+ if ( controllerIndex === -1 ) {
50405
50840
 
50406
50841
  // Assign input source a controller that currently has no input source
50407
50842
 
@@ -50425,7 +50860,7 @@ class WebXRManager extends EventDispatcher {
50425
50860
 
50426
50861
  // If all controllers do currently receive input we ignore new ones
50427
50862
 
50428
- if ( controllerIndex === - 1 ) break;
50863
+ if ( controllerIndex === -1 ) break;
50429
50864
 
50430
50865
  }
50431
50866
 
@@ -50492,7 +50927,7 @@ class WebXRManager extends EventDispatcher {
50492
50927
  camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
50493
50928
 
50494
50929
  // Check if the projection uses an infinite far plane.
50495
- if ( projL[ 10 ] === - 1.0 ) {
50930
+ if ( projL[ 10 ] === -1 ) {
50496
50931
 
50497
50932
  // Use the projection matrix from the left eye.
50498
50933
  // The camera offset is sufficient to include the view volumes
@@ -50535,6 +50970,12 @@ class WebXRManager extends EventDispatcher {
50535
50970
 
50536
50971
  }
50537
50972
 
50973
+ this.setPoseTarget = function ( object ) {
50974
+
50975
+ if ( object !== undefined ) poseTarget = object;
50976
+
50977
+ };
50978
+
50538
50979
  this.updateCamera = function ( camera ) {
50539
50980
 
50540
50981
  if ( session === null ) return;
@@ -50570,8 +51011,9 @@ class WebXRManager extends EventDispatcher {
50570
51011
  cameraR.layers.mask = camera.layers.mask | 0b100;
50571
51012
  cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask;
50572
51013
 
50573
- const parent = camera.parent;
50574
51014
  const cameras = cameraXR.cameras;
51015
+ var object = poseTarget || camera;
51016
+ const parent = object.parent;
50575
51017
 
50576
51018
  updateCamera( cameraXR, parent );
50577
51019
 
@@ -50595,28 +51037,28 @@ class WebXRManager extends EventDispatcher {
50595
51037
 
50596
51038
  }
50597
51039
 
50598
- // update user camera and its children
50599
-
50600
- updateUserCamera( camera, cameraXR, parent );
51040
+ updateUserCamera( camera, cameraXR, object );
50601
51041
 
50602
51042
  };
50603
51043
 
50604
- function updateUserCamera( camera, cameraXR, parent ) {
51044
+ function updateUserCamera( camera, cameraXR, object ) {
50605
51045
 
50606
- if ( parent === null ) {
51046
+ cameraXR.matrixWorld.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );
51047
+
51048
+ if ( object.parent === null ) {
50607
51049
 
50608
- camera.matrix.copy( cameraXR.matrixWorld );
51050
+ object.matrix.copy( cameraXR.matrixWorld );
50609
51051
 
50610
51052
  } else {
50611
51053
 
50612
- camera.matrix.copy( parent.matrixWorld );
50613
- camera.matrix.invert();
50614
- camera.matrix.multiply( cameraXR.matrixWorld );
51054
+ object.matrix.copy( object.parent.matrixWorld );
51055
+ object.matrix.invert();
51056
+ object.matrix.multiply( cameraXR.matrixWorld );
50615
51057
 
50616
51058
  }
50617
51059
 
50618
- camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
50619
- camera.updateMatrixWorld( true );
51060
+ object.matrix.decompose( object.position, object.quaternion, object.scale );
51061
+ object.updateMatrixWorld( true );
50620
51062
 
50621
51063
  camera.projectionMatrix.copy( cameraXR.projectionMatrix );
50622
51064
  camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
@@ -50993,7 +51435,7 @@ function WebGLMaterials( renderer, properties ) {
50993
51435
 
50994
51436
  if ( material.side === BackSide ) {
50995
51437
 
50996
- uniforms.bumpScale.value *= - 1;
51438
+ uniforms.bumpScale.value *= -1;
50997
51439
 
50998
51440
  }
50999
51441
 
@@ -51060,19 +51502,19 @@ function WebGLMaterials( renderer, properties ) {
51060
51502
  _e1.copy( envMapRotation );
51061
51503
 
51062
51504
  // accommodate left-handed frame
51063
- _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
51505
+ _e1.x *= -1; _e1.y *= -1; _e1.z *= -1;
51064
51506
 
51065
51507
  if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
51066
51508
 
51067
51509
  // environment maps which are not cube render targets or PMREMs follow a different convention
51068
- _e1.y *= - 1;
51069
- _e1.z *= - 1;
51510
+ _e1.y *= -1;
51511
+ _e1.z *= -1;
51070
51512
 
51071
51513
  }
51072
51514
 
51073
51515
  uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
51074
51516
 
51075
- uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
51517
+ uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
51076
51518
 
51077
51519
  uniforms.reflectivity.value = material.reflectivity;
51078
51520
  uniforms.ior.value = material.ior;
@@ -51495,7 +51937,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
51495
51937
 
51496
51938
  for ( let i = 0; i < maxBindingPoints; i ++ ) {
51497
51939
 
51498
- if ( allocatedBindingPoints.indexOf( i ) === - 1 ) {
51940
+ if ( allocatedBindingPoints.indexOf( i ) === -1 ) {
51499
51941
 
51500
51942
  allocatedBindingPoints.push( i );
51501
51943
  return i;
@@ -51828,6 +52270,7 @@ class WebGLRenderer {
51828
52270
  powerPreference = 'default',
51829
52271
  failIfMajorPerformanceCaveat = false,
51830
52272
  reverseDepthBuffer = false,
52273
+ multiviewStereo = false,
51831
52274
  } = parameters;
51832
52275
 
51833
52276
  this.isWebGLRenderer = true;
@@ -51917,7 +52360,7 @@ class WebGLRenderer {
51917
52360
  let _currentActiveCubeFace = 0;
51918
52361
  let _currentActiveMipmapLevel = 0;
51919
52362
  let _currentRenderTarget = null;
51920
- let _currentMaterialId = - 1;
52363
+ let _currentMaterialId = -1;
51921
52364
 
51922
52365
  let _currentCamera = null;
51923
52366
 
@@ -52035,6 +52478,7 @@ class WebGLRenderer {
52035
52478
  let extensions, capabilities, state, info;
52036
52479
  let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
52037
52480
  let programCache, materials, renderLists, renderStates, clipping, shadowMap;
52481
+ let multiview;
52038
52482
 
52039
52483
  let background, morphtargets, bufferRenderer, indexedBufferRenderer;
52040
52484
 
@@ -52073,6 +52517,7 @@ class WebGLRenderer {
52073
52517
  renderLists = new WebGLRenderLists();
52074
52518
  renderStates = new WebGLRenderStates( extensions );
52075
52519
  background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
52520
+ multiview = new WebGLMultiview( _this, extensions, _gl );
52076
52521
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
52077
52522
  uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
52078
52523
 
@@ -53009,11 +53454,21 @@ class WebGLRenderer {
53009
53454
 
53010
53455
  if ( _renderBackground ) background.render( scene );
53011
53456
 
53012
- for ( let i = 0, l = cameras.length; i < l; i ++ ) {
53457
+ if ( xr.enabled && xr.isMultiview ) {
53013
53458
 
53014
- const camera2 = cameras[ i ];
53459
+ textures.setDeferTextureUploads( true );
53015
53460
 
53016
- renderScene( currentRenderList, scene, camera2, camera2.viewport );
53461
+ renderScene( currentRenderList, scene, camera, camera.cameras[ 0 ].viewport );
53462
+
53463
+ } else {
53464
+
53465
+ for ( let i = 0, l = cameras.length; i < l; i ++ ) {
53466
+
53467
+ const camera2 = cameras[ i ];
53468
+
53469
+ renderScene( currentRenderList, scene, camera2, camera2.viewport );
53470
+
53471
+ }
53017
53472
 
53018
53473
  }
53019
53474
 
@@ -53048,7 +53503,7 @@ class WebGLRenderer {
53048
53503
  // _gl.finish();
53049
53504
 
53050
53505
  bindingStates.resetDefaultState();
53051
- _currentMaterialId = - 1;
53506
+ _currentMaterialId = -1;
53052
53507
  _currentCamera = null;
53053
53508
 
53054
53509
  renderStateStack.pop();
@@ -53539,6 +53994,7 @@ class WebGLRenderer {
53539
53994
  materialProperties.vertexAlphas = parameters.vertexAlphas;
53540
53995
  materialProperties.vertexTangents = parameters.vertexTangents;
53541
53996
  materialProperties.toneMapping = parameters.toneMapping;
53997
+ materialProperties.numMultiviewViews = parameters.numMultiviewViews;
53542
53998
 
53543
53999
  }
53544
54000
 
@@ -53570,6 +54026,8 @@ class WebGLRenderer {
53570
54026
 
53571
54027
  }
53572
54028
 
54029
+ const numMultiviewViews = _currentRenderTarget && _currentRenderTarget.isWebGLMultiviewRenderTarget ? _currentRenderTarget.numViews : 0;
54030
+
53573
54031
  const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
53574
54032
  const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
53575
54033
 
@@ -53697,6 +54155,10 @@ class WebGLRenderer {
53697
54155
 
53698
54156
  needsProgramChange = true;
53699
54157
 
54158
+ } else if ( materialProperties.numMultiviewViews !== numMultiviewViews ) {
54159
+
54160
+ needsProgramChange = true;
54161
+
53700
54162
  }
53701
54163
 
53702
54164
  } else {
@@ -53743,24 +54205,33 @@ class WebGLRenderer {
53743
54205
 
53744
54206
  // common camera uniforms
53745
54207
 
53746
- const reverseDepthBuffer = state.buffers.depth.getReversed();
54208
+ if ( program.numMultiviewViews > 0 ) {
53747
54209
 
53748
- if ( reverseDepthBuffer ) {
54210
+ multiview.updateCameraProjectionMatricesUniform( camera, p_uniforms );
54211
+ multiview.updateCameraViewMatricesUniform( camera, p_uniforms );
53749
54212
 
53750
- _currentProjectionMatrix.copy( camera.projectionMatrix );
54213
+ } else {
53751
54214
 
53752
- toNormalizedProjectionMatrix( _currentProjectionMatrix );
53753
- toReversedProjectionMatrix( _currentProjectionMatrix );
54215
+ const reverseDepthBuffer = state.buffers.depth.getReversed();
53754
54216
 
53755
- p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
54217
+ if ( reverseDepthBuffer ) {
53756
54218
 
53757
- } else {
54219
+ _currentProjectionMatrix.copy( camera.projectionMatrix );
53758
54220
 
53759
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
54221
+ toNormalizedProjectionMatrix( _currentProjectionMatrix );
54222
+ toReversedProjectionMatrix( _currentProjectionMatrix );
53760
54223
 
53761
- }
54224
+ p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
54225
+
54226
+ } else {
54227
+
54228
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
54229
+
54230
+ }
53762
54231
 
53763
- p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
54232
+ p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
54233
+
54234
+ }
53764
54235
 
53765
54236
  const uCamPos = p_uniforms.map.cameraPosition;
53766
54237
 
@@ -53864,7 +54335,7 @@ class WebGLRenderer {
53864
54335
 
53865
54336
  m_uniforms.envMap.value = envMap;
53866
54337
 
53867
- m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
54338
+ m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
53868
54339
 
53869
54340
  }
53870
54341
 
@@ -53922,8 +54393,17 @@ class WebGLRenderer {
53922
54393
 
53923
54394
  // common matrices
53924
54395
 
53925
- p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
53926
- p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
54396
+ if ( program.numMultiviewViews > 0 ) {
54397
+
54398
+ multiview.updateObjectMatricesUniforms( object, camera, p_uniforms );
54399
+
54400
+ } else {
54401
+
54402
+ p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
54403
+ p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
54404
+
54405
+ }
54406
+
53927
54407
  p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
53928
54408
 
53929
54409
  // UBOs
@@ -53973,6 +54453,32 @@ class WebGLRenderer {
53973
54453
 
53974
54454
  }
53975
54455
 
54456
+ this.setTexture2D = ( function () {
54457
+
54458
+ var warned = false;
54459
+
54460
+ // backwards compatibility: peel texture.texture
54461
+ return function setTexture2D( texture, slot ) {
54462
+
54463
+ if ( texture && texture.isWebGLRenderTarget ) {
54464
+
54465
+ if ( ! warned ) {
54466
+
54467
+ console.warn( "THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead." );
54468
+ warned = true;
54469
+
54470
+ }
54471
+
54472
+ texture = texture.texture;
54473
+
54474
+ }
54475
+
54476
+ textures.setTexture2D( texture, slot );
54477
+
54478
+ };
54479
+
54480
+ }() );
54481
+
53976
54482
  this.getActiveCubeFace = function () {
53977
54483
 
53978
54484
  return _currentActiveCubeFace;
@@ -54001,7 +54507,7 @@ class WebGLRenderer {
54001
54507
 
54002
54508
  renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
54003
54509
 
54004
- if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
54510
+ if ( ! renderTargetProperties.__autoAllocateDepthBuffer && ( ! _currentRenderTarget || ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) ) {
54005
54511
 
54006
54512
  // The multisample_render_to_texture extension doesn't work properly if there
54007
54513
  // are midframe flushes and an external depth buffer. Disable use of the extension.
@@ -54027,6 +54533,13 @@ class WebGLRenderer {
54027
54533
  const _scratchFrameBuffer = _gl.createFramebuffer();
54028
54534
  this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
54029
54535
 
54536
+ // Render to base layer instead of canvas in WebXR
54537
+ if ( renderTarget === null && this.xr.isPresenting ) {
54538
+
54539
+ renderTarget = this.xr.getRenderTarget();
54540
+
54541
+ }
54542
+
54030
54543
  _currentRenderTarget = renderTarget;
54031
54544
  _currentActiveCubeFace = activeCubeFace;
54032
54545
  _currentActiveMipmapLevel = activeMipmapLevel;
@@ -54173,7 +54686,7 @@ class WebGLRenderer {
54173
54686
 
54174
54687
  }
54175
54688
 
54176
- _currentMaterialId = - 1; // reset current material to ensure correct uniform bindings
54689
+ _currentMaterialId = -1; // reset current material to ensure correct uniform bindings
54177
54690
 
54178
54691
  };
54179
54692