react-globe.gl 2.34.0 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // Version 2.34.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
1
+ // Version 2.35.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['react'], factory) :
@@ -274,7 +274,7 @@
274
274
  * Copyright 2010-2025 Three.js Authors
275
275
  * SPDX-License-Identifier: MIT
276
276
  */
277
- const REVISION = '177';
277
+ const REVISION = '178';
278
278
 
279
279
  /**
280
280
  * Represents mouse buttons and interaction types in context of controls.
@@ -3895,7 +3895,7 @@
3895
3895
 
3896
3896
  let r = vFrom.dot( vTo ) + 1;
3897
3897
 
3898
- if ( r < Number.EPSILON ) {
3898
+ if ( r < 1e-8 ) { // the epsilon value has been discussed in #31286
3899
3899
 
3900
3900
  // vFrom and vTo point in opposite directions
3901
3901
 
@@ -13110,7 +13110,7 @@
13110
13110
  const _childaddedEvent = { type: 'childadded', child: null };
13111
13111
 
13112
13112
  /**
13113
- * Fires when a new child object has been added.
13113
+ * Fires when a child object has been removed.
13114
13114
  *
13115
13115
  * @event Object3D#childremoved
13116
13116
  * @type {Object}
@@ -17671,7 +17671,7 @@
17671
17671
  /**
17672
17672
  * Applies to integer data only. Indicates how the underlying data in the buffer maps to
17673
17673
  * the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`,
17674
- * and `normalized` is `true`, the values `0 -+65535` in the array data will be mapped to
17674
+ * and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to
17675
17675
  * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted
17676
17676
  * to floats unmodified, i.e. `65535` becomes `65535.0f`.
17677
17677
  *
@@ -18309,8 +18309,8 @@
18309
18309
  * Convenient class that can be used when creating a `Float16` buffer attribute with
18310
18310
  * a plain `Array` instance.
18311
18311
  *
18312
- * This class automatically converts to and from FP16 since `Float16Array` is not
18313
- * natively supported in JavaScript.
18312
+ * This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array`
18313
+ * browser support is still problematic.
18314
18314
  *
18315
18315
  * @augments BufferAttribute
18316
18316
  */
@@ -24204,6 +24204,7 @@
24204
24204
  }
24205
24205
 
24206
24206
  const _sphere$3 = /*@__PURE__*/ new Sphere();
24207
+ const _defaultSpriteCenter = /*@__PURE__*/ new Vector2( 0.5, 0.5 );
24207
24208
  const _vector$6 = /*@__PURE__*/ new Vector3();
24208
24209
 
24209
24210
  /**
@@ -24361,7 +24362,10 @@
24361
24362
  intersectsSprite( sprite ) {
24362
24363
 
24363
24364
  _sphere$3.center.set( 0, 0, 0 );
24364
- _sphere$3.radius = 0.7071067811865476;
24365
+
24366
+ const offset = _defaultSpriteCenter.distanceTo( sprite.center );
24367
+
24368
+ _sphere$3.radius = 0.7071067811865476 + offset;
24365
24369
  _sphere$3.applyMatrix4( sprite.matrixWorld );
24366
24370
 
24367
24371
  return this.intersectsSphere( _sphere$3 );
@@ -28817,11 +28821,11 @@
28817
28821
  * Adds an arc as an instance of {@link EllipseCurve} to the path, positioned relative
28818
28822
  * to the current point.
28819
28823
  *
28820
- * @param {number} aX - The x coordinate of the center of the arc offsetted from the previous curve.
28821
- * @param {number} aY - The y coordinate of the center of the arc offsetted from the previous curve.
28822
- * @param {number} aRadius - The radius of the arc.
28823
- * @param {number} aStartAngle - The start angle in radians.
28824
- * @param {number} aEndAngle - The end angle in radians.
28824
+ * @param {number} [aX=0] - The x coordinate of the center of the arc offsetted from the previous curve.
28825
+ * @param {number} [aY=0] - The y coordinate of the center of the arc offsetted from the previous curve.
28826
+ * @param {number} [aRadius=1] - The radius of the arc.
28827
+ * @param {number} [aStartAngle=0] - The start angle in radians.
28828
+ * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
28825
28829
  * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.
28826
28830
  * @return {Path} A reference to this path.
28827
28831
  */
@@ -28840,11 +28844,11 @@
28840
28844
  /**
28841
28845
  * Adds an absolutely positioned arc as an instance of {@link EllipseCurve} to the path.
28842
28846
  *
28843
- * @param {number} aX - The x coordinate of the center of the arc.
28844
- * @param {number} aY - The y coordinate of the center of the arc.
28845
- * @param {number} aRadius - The radius of the arc.
28846
- * @param {number} aStartAngle - The start angle in radians.
28847
- * @param {number} aEndAngle - The end angle in radians.
28847
+ * @param {number} [aX=0] - The x coordinate of the center of the arc.
28848
+ * @param {number} [aY=0] - The y coordinate of the center of the arc.
28849
+ * @param {number} [aRadius=1] - The radius of the arc.
28850
+ * @param {number} [aStartAngle=0] - The start angle in radians.
28851
+ * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
28848
28852
  * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not.
28849
28853
  * @return {Path} A reference to this path.
28850
28854
  */
@@ -28860,12 +28864,12 @@
28860
28864
  * Adds an ellipse as an instance of {@link EllipseCurve} to the path, positioned relative
28861
28865
  * to the current point
28862
28866
  *
28863
- * @param {number} aX - The x coordinate of the center of the ellipse offsetted from the previous curve.
28864
- * @param {number} aY - The y coordinate of the center of the ellipse offsetted from the previous curve.
28865
- * @param {number} xRadius - The radius of the ellipse in the x axis.
28866
- * @param {number} yRadius - The radius of the ellipse in the y axis.
28867
- * @param {number} aStartAngle - The start angle in radians.
28868
- * @param {number} aEndAngle - The end angle in radians.
28867
+ * @param {number} [aX=0] - The x coordinate of the center of the ellipse offsetted from the previous curve.
28868
+ * @param {number} [aY=0] - The y coordinate of the center of the ellipse offsetted from the previous curve.
28869
+ * @param {number} [xRadius=1] - The radius of the ellipse in the x axis.
28870
+ * @param {number} [yRadius=1] - The radius of the ellipse in the y axis.
28871
+ * @param {number} [aStartAngle=0] - The start angle in radians.
28872
+ * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
28869
28873
  * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.
28870
28874
  * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.
28871
28875
  * @return {Path} A reference to this path.
@@ -28884,12 +28888,12 @@
28884
28888
  /**
28885
28889
  * Adds an absolutely positioned ellipse as an instance of {@link EllipseCurve} to the path.
28886
28890
  *
28887
- * @param {number} aX - The x coordinate of the absolute center of the ellipse.
28888
- * @param {number} aY - The y coordinate of the absolute center of the ellipse.
28889
- * @param {number} xRadius - The radius of the ellipse in the x axis.
28890
- * @param {number} yRadius - The radius of the ellipse in the y axis.
28891
- * @param {number} aStartAngle - The start angle in radians.
28892
- * @param {number} aEndAngle - The end angle in radians.
28891
+ * @param {number} [aX=0] - The x coordinate of the absolute center of the ellipse.
28892
+ * @param {number} [aY=0] - The y coordinate of the absolute center of the ellipse.
28893
+ * @param {number} [xRadius=1] - The radius of the ellipse in the x axis.
28894
+ * @param {number} [yRadius=1] - The radius of the ellipse in the y axis.
28895
+ * @param {number} [aStartAngle=0] - The start angle in radians.
28896
+ * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians.
28893
28897
  * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not.
28894
28898
  * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis.
28895
28899
  * @return {Path} A reference to this path.
@@ -34906,6 +34910,8 @@
34906
34910
  */
34907
34911
  Loader.DEFAULT_MATERIAL_NAME = '__DEFAULT';
34908
34912
 
34913
+ const _loading = new WeakMap();
34914
+
34909
34915
  /**
34910
34916
  * A loader for loading images. The class loads images with the HTML `Image` API.
34911
34917
  *
@@ -34952,19 +34958,36 @@
34952
34958
 
34953
34959
  const scope = this;
34954
34960
 
34955
- const cached = Cache.get( url );
34961
+ const cached = Cache.get( `image:${url}` );
34956
34962
 
34957
34963
  if ( cached !== undefined ) {
34958
34964
 
34959
- scope.manager.itemStart( url );
34965
+ if ( cached.complete === true ) {
34966
+
34967
+ scope.manager.itemStart( url );
34960
34968
 
34961
- setTimeout( function () {
34969
+ setTimeout( function () {
34962
34970
 
34963
- if ( onLoad ) onLoad( cached );
34971
+ if ( onLoad ) onLoad( cached );
34972
+
34973
+ scope.manager.itemEnd( url );
34974
+
34975
+ }, 0 );
34976
+
34977
+ } else {
34964
34978
 
34965
- scope.manager.itemEnd( url );
34979
+ let arr = _loading.get( cached );
34966
34980
 
34967
- }, 0 );
34981
+ if ( arr === undefined ) {
34982
+
34983
+ arr = [];
34984
+ _loading.set( cached, arr );
34985
+
34986
+ }
34987
+
34988
+ arr.push( { onLoad, onError } );
34989
+
34990
+ }
34968
34991
 
34969
34992
  return cached;
34970
34993
 
@@ -34976,10 +34999,21 @@
34976
34999
 
34977
35000
  removeEventListeners();
34978
35001
 
34979
- Cache.add( url, this );
34980
-
34981
35002
  if ( onLoad ) onLoad( this );
34982
35003
 
35004
+ //
35005
+
35006
+ const callbacks = _loading.get( this ) || [];
35007
+
35008
+ for ( let i = 0; i < callbacks.length; i ++ ) {
35009
+
35010
+ const callback = callbacks[ i ];
35011
+ if ( callback.onLoad ) callback.onLoad( this );
35012
+
35013
+ }
35014
+
35015
+ _loading.delete( this );
35016
+
34983
35017
  scope.manager.itemEnd( url );
34984
35018
 
34985
35019
  }
@@ -34990,6 +35024,22 @@
34990
35024
 
34991
35025
  if ( onError ) onError( event );
34992
35026
 
35027
+ Cache.remove( `image:${url}` );
35028
+
35029
+ //
35030
+
35031
+ const callbacks = _loading.get( this ) || [];
35032
+
35033
+ for ( let i = 0; i < callbacks.length; i ++ ) {
35034
+
35035
+ const callback = callbacks[ i ];
35036
+ if ( callback.onError ) callback.onError( event );
35037
+
35038
+ }
35039
+
35040
+ _loading.delete( this );
35041
+
35042
+
34993
35043
  scope.manager.itemError( url );
34994
35044
  scope.manager.itemEnd( url );
34995
35045
 
@@ -35011,6 +35061,7 @@
35011
35061
 
35012
35062
  }
35013
35063
 
35064
+ Cache.add( `image:${url}`, image );
35014
35065
  scope.manager.itemStart( url );
35015
35066
 
35016
35067
  image.src = url;
@@ -37132,7 +37183,7 @@
37132
37183
  */
37133
37184
  start() {
37134
37185
 
37135
- this.startTime = now$2();
37186
+ this.startTime = performance.now();
37136
37187
 
37137
37188
  this.oldTime = this.startTime;
37138
37189
  this.elapsedTime = 0;
@@ -37181,7 +37232,7 @@
37181
37232
 
37182
37233
  if ( this.running ) {
37183
37234
 
37184
- const newTime = now$2();
37235
+ const newTime = performance.now();
37185
37236
 
37186
37237
  diff = ( newTime - this.oldTime ) / 1000;
37187
37238
  this.oldTime = newTime;
@@ -37196,12 +37247,6 @@
37196
37247
 
37197
37248
  }
37198
37249
 
37199
- function now$2() {
37200
-
37201
- return performance.now();
37202
-
37203
- }
37204
-
37205
37250
  /**
37206
37251
  * An instanced version of an interleaved buffer.
37207
37252
  *
@@ -38717,6 +38762,10 @@
38717
38762
 
38718
38763
  type = gl.FLOAT;
38719
38764
 
38765
+ } else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
38766
+
38767
+ type = gl.HALF_FLOAT;
38768
+
38720
38769
  } else if ( array instanceof Uint16Array ) {
38721
38770
 
38722
38771
  if ( attribute.isFloat16BufferAttribute ) {
@@ -45694,7 +45743,7 @@
45694
45743
  useFog: material.fog === true,
45695
45744
  fogExp2: ( !! fog && fog.isFogExp2 ),
45696
45745
 
45697
- flatShading: material.flatShading === true,
45746
+ flatShading: ( material.flatShading === true && material.wireframe === false ),
45698
45747
 
45699
45748
  sizeAttenuation: material.sizeAttenuation === true,
45700
45749
  logarithmicDepthBuffer: logarithmicDepthBuffer,
@@ -45907,6 +45956,8 @@
45907
45956
  _programLayers.enable( 20 );
45908
45957
  if ( parameters.batchingColor )
45909
45958
  _programLayers.enable( 21 );
45959
+ if ( parameters.gradientMap )
45960
+ _programLayers.enable( 22 );
45910
45961
 
45911
45962
  array.push( _programLayers.mask );
45912
45963
  _programLayers.disableAll();
@@ -48088,7 +48139,7 @@
48088
48139
  break;
48089
48140
 
48090
48141
  case MultiplyBlending:
48091
- gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );
48142
+ gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
48092
48143
  break;
48093
48144
 
48094
48145
  default:
@@ -48106,15 +48157,15 @@
48106
48157
  break;
48107
48158
 
48108
48159
  case AdditiveBlending:
48109
- gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
48160
+ gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
48110
48161
  break;
48111
48162
 
48112
48163
  case SubtractiveBlending:
48113
- gl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );
48164
+ console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
48114
48165
  break;
48115
48166
 
48116
48167
  case MultiplyBlending:
48117
- gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
48168
+ console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
48118
48169
  break;
48119
48170
 
48120
48171
  default:
@@ -55249,6 +55300,9 @@ void main() {
55249
55300
  //
55250
55301
 
55251
55302
  const currentRenderTarget = _this.getRenderTarget();
55303
+ const currentActiveCubeFace = _this.getActiveCubeFace();
55304
+ const currentActiveMipmapLevel = _this.getActiveMipmapLevel();
55305
+
55252
55306
  _this.setRenderTarget( transmissionRenderTarget );
55253
55307
 
55254
55308
  _this.getClearColor( _currentClearColor );
@@ -55318,7 +55372,7 @@ void main() {
55318
55372
 
55319
55373
  }
55320
55374
 
55321
- _this.setRenderTarget( currentRenderTarget );
55375
+ _this.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
55322
55376
 
55323
55377
  _this.setClearColor( _currentClearColor, _currentClearAlpha );
55324
55378
 
@@ -56248,7 +56302,7 @@ void main() {
56248
56302
 
56249
56303
  if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
56250
56304
 
56251
- // when using MRT, select the corect color buffer for the subsequent read command
56305
+ // when using MRT, select the correct color buffer for the subsequent read command
56252
56306
 
56253
56307
  if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
56254
56308
 
@@ -63563,10 +63617,10 @@ void main() {
63563
63617
 
63564
63618
  // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
63565
63619
  if (data.length > 80 * dim) {
63566
- minX = Infinity;
63567
- minY = Infinity;
63568
- let maxX = -Infinity;
63569
- let maxY = -Infinity;
63620
+ minX = data[0];
63621
+ minY = data[1];
63622
+ let maxX = minX;
63623
+ let maxY = minY;
63570
63624
 
63571
63625
  for (let i = dim; i < outerLen; i += dim) {
63572
63626
  const x = data[i];
@@ -63842,7 +63896,7 @@ void main() {
63842
63896
  return result;
63843
63897
  }
63844
63898
 
63845
- // find a bridge between vertices that connects hole with an outer ring and and link it
63899
+ // find a bridge between vertices that connects hole with an outer ring and link it
63846
63900
  function eliminateHole(hole, outerNode) {
63847
63901
  const bridge = findHoleBridge(hole, outerNode);
63848
63902
  if (!bridge) {
@@ -64033,7 +64087,7 @@ void main() {
64033
64087
 
64034
64088
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
64035
64089
  function isValidDiagonal(a, b) {
64036
- return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
64090
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
64037
64091
  (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
64038
64092
  (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
64039
64093
  equals$1(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
@@ -67527,7 +67581,7 @@ void main() {
67527
67581
  const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1;
67528
67582
  const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1;
67529
67583
 
67530
- const B$1 = vec(4);
67584
+ const B$2 = vec(4);
67531
67585
  const C1 = vec(8);
67532
67586
  const C2 = vec(12);
67533
67587
  const D$1 = vec(16);
@@ -67560,19 +67614,19 @@ void main() {
67560
67614
  t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
67561
67615
  _i = s0 - t0;
67562
67616
  bvirt = s0 - _i;
67563
- B$1[0] = s0 - (_i + bvirt) + (bvirt - t0);
67617
+ B$2[0] = s0 - (_i + bvirt) + (bvirt - t0);
67564
67618
  _j = s1 + _i;
67565
67619
  bvirt = _j - s1;
67566
67620
  _0 = s1 - (_j - bvirt) + (_i - bvirt);
67567
67621
  _i = _0 - t1;
67568
67622
  bvirt = _0 - _i;
67569
- B$1[1] = _0 - (_i + bvirt) + (bvirt - t1);
67623
+ B$2[1] = _0 - (_i + bvirt) + (bvirt - t1);
67570
67624
  u3 = _j + _i;
67571
67625
  bvirt = u3 - _j;
67572
- B$1[2] = _j - (u3 - bvirt) + (_i - bvirt);
67573
- B$1[3] = u3;
67626
+ B$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
67627
+ B$2[3] = u3;
67574
67628
 
67575
- let det = estimate(4, B$1);
67629
+ let det = estimate(4, B$2);
67576
67630
  let errbound = ccwerrboundB * detsum;
67577
67631
  if (det >= errbound || -det >= errbound) {
67578
67632
  return det;
@@ -67624,7 +67678,7 @@ void main() {
67624
67678
  bvirt = u3 - _j;
67625
67679
  u$1[2] = _j - (u3 - bvirt) + (_i - bvirt);
67626
67680
  u$1[3] = u3;
67627
- const C1len = sum(4, B$1, 4, u$1, C1);
67681
+ const C1len = sum(4, B$2, 4, u$1, C1);
67628
67682
 
67629
67683
  s1 = acx * bcytail;
67630
67684
  c = splitter * acx;
@@ -86086,7 +86140,7 @@ void main() {
86086
86140
 
86087
86141
  console.warn( 'THREE.Node: Recursion detected.', this );
86088
86142
 
86089
- result = '';
86143
+ result = '/* Recursion detected. */';
86090
86144
 
86091
86145
  }
86092
86146
 
@@ -87461,7 +87515,7 @@ void main() {
87461
87515
 
87462
87516
  } else if ( type === 'shader' ) {
87463
87517
 
87464
- return Fn$1( obj );
87518
+ return obj.isFn ? obj : Fn$1( obj );
87465
87519
 
87466
87520
  }
87467
87521
 
@@ -87611,16 +87665,22 @@ void main() {
87611
87665
  const { shaderNode, inputNodes } = this;
87612
87666
 
87613
87667
  const properties = builder.getNodeProperties( shaderNode );
87614
- const onceNS = shaderNode.namespace && shaderNode.namespace === builder.namespace ? builder.getNamespace( 'once' ) : 'once';
87615
87668
 
87616
- if ( properties[ onceNS ] ) {
87669
+ const subBuild = builder.getClosestSubBuild( shaderNode.subBuilds ) || '';
87670
+ const subBuildProperty = subBuild || 'default';
87617
87671
 
87618
- return properties[ onceNS ];
87672
+ if ( properties[ subBuildProperty ] ) {
87673
+
87674
+ return properties[ subBuildProperty ];
87619
87675
 
87620
87676
  }
87621
87677
 
87622
87678
  //
87623
87679
 
87680
+ const previousSubBuildFn = builder.subBuildFn;
87681
+
87682
+ builder.subBuildFn = subBuild;
87683
+
87624
87684
  let result = null;
87625
87685
 
87626
87686
  if ( shaderNode.layout ) {
@@ -87658,9 +87718,11 @@ void main() {
87658
87718
 
87659
87719
  }
87660
87720
 
87721
+ builder.subBuildFn = previousSubBuildFn;
87722
+
87661
87723
  if ( shaderNode.once ) {
87662
87724
 
87663
- properties[ onceNS ] = result;
87725
+ properties[ subBuildProperty ] = result;
87664
87726
 
87665
87727
  }
87666
87728
 
@@ -87681,11 +87743,12 @@ void main() {
87681
87743
  getOutputNode( builder ) {
87682
87744
 
87683
87745
  const properties = builder.getNodeProperties( this );
87684
- const outputNamespace = builder.getOutputNamespace();
87746
+ const subBuildOutput = builder.getSubBuildOutput( this );
87685
87747
 
87686
- properties[ outputNamespace ] = properties[ outputNamespace ] || this.setupOutput( builder );
87748
+ properties[ subBuildOutput ] = properties[ subBuildOutput ] || this.setupOutput( builder );
87749
+ properties[ subBuildOutput ].subBuild = builder.getClosestSubBuild( this );
87687
87750
 
87688
- return properties[ outputNamespace ];
87751
+ return properties[ subBuildOutput ];
87689
87752
 
87690
87753
  }
87691
87754
 
@@ -87696,23 +87759,45 @@ void main() {
87696
87759
  const buildStage = builder.getBuildStage();
87697
87760
  const properties = builder.getNodeProperties( this );
87698
87761
 
87699
- const outputNamespace = builder.getOutputNamespace();
87762
+ const subBuildOutput = builder.getSubBuildOutput( this );
87700
87763
  const outputNode = this.getOutputNode( builder );
87701
87764
 
87702
87765
  if ( buildStage === 'setup' ) {
87703
87766
 
87704
- const initializedNamespace = builder.getNamespace( 'initialized' );
87767
+ const subBuildInitialized = builder.getSubBuildProperty( 'initialized', this );
87705
87768
 
87706
- if ( properties[ initializedNamespace ] !== true ) {
87769
+ if ( properties[ subBuildInitialized ] !== true ) {
87707
87770
 
87708
- properties[ initializedNamespace ] = true;
87771
+ properties[ subBuildInitialized ] = true;
87709
87772
 
87710
- properties[ outputNamespace ] = this.getOutputNode( builder );
87711
- properties[ outputNamespace ].build( builder );
87773
+ properties[ subBuildOutput ] = this.getOutputNode( builder );
87774
+ properties[ subBuildOutput ].build( builder );
87775
+
87776
+ // If the shaderNode has subBuilds, add them to the chaining nodes
87777
+ // so they can be built later in the build process.
87778
+
87779
+ if ( this.shaderNode.subBuilds ) {
87780
+
87781
+ for ( const node of builder.chaining ) {
87782
+
87783
+ const nodeData = builder.getDataFromNode( node, 'any' );
87784
+ nodeData.subBuilds = nodeData.subBuilds || new Set();
87785
+
87786
+ for ( const subBuild of this.shaderNode.subBuilds ) {
87787
+
87788
+ nodeData.subBuilds.add( subBuild );
87789
+
87790
+ }
87791
+
87792
+ //builder.getDataFromNode( node ).subBuilds = nodeData.subBuilds;
87793
+
87794
+ }
87795
+
87796
+ }
87712
87797
 
87713
87798
  }
87714
87799
 
87715
- result = properties[ outputNamespace ];
87800
+ result = properties[ subBuildOutput ];
87716
87801
 
87717
87802
  } else if ( buildStage === 'analyze' ) {
87718
87803
 
@@ -87742,7 +87827,6 @@ void main() {
87742
87827
  this.global = true;
87743
87828
 
87744
87829
  this.once = false;
87745
- this.namespace = null;
87746
87830
 
87747
87831
  }
87748
87832
 
@@ -87810,20 +87894,6 @@ void main() {
87810
87894
 
87811
87895
  };
87812
87896
 
87813
- const safeGetNodeType = ( node ) => {
87814
-
87815
- try {
87816
-
87817
- return node.getNodeType();
87818
-
87819
- } catch ( _ ) {
87820
-
87821
- return undefined;
87822
-
87823
- }
87824
-
87825
- };
87826
-
87827
87897
  const ConvertType = function ( type, cacheMap = null ) {
87828
87898
 
87829
87899
  return ( ...params ) => {
@@ -87843,7 +87913,7 @@ void main() {
87843
87913
  if ( params.length === 1 ) {
87844
87914
 
87845
87915
  const node = getConstNode( params[ 0 ], type );
87846
- if ( safeGetNodeType( node ) === type ) return nodeObject( node );
87916
+ if ( node.nodeType === type ) return nodeObject( node );
87847
87917
  return nodeObject( new ConvertNode( node, type ) );
87848
87918
 
87849
87919
  }
@@ -87938,6 +88008,8 @@ void main() {
87938
88008
  fn.shaderNode = shaderNode;
87939
88009
  fn.id = shaderNode.id;
87940
88010
 
88011
+ fn.isFn = true;
88012
+
87941
88013
  fn.getNodeType = ( ...params ) => shaderNode.getNodeType( ...params );
87942
88014
  fn.getCacheKey = ( ...params ) => shaderNode.getCacheKey( ...params );
87943
88015
 
@@ -87949,10 +88021,10 @@ void main() {
87949
88021
 
87950
88022
  };
87951
88023
 
87952
- fn.once = ( namespace = null ) => {
88024
+ fn.once = ( subBuilds = null ) => {
87953
88025
 
87954
88026
  shaderNode.once = true;
87955
- shaderNode.namespace = namespace;
88027
+ shaderNode.subBuilds = subBuilds;
87956
88028
 
87957
88029
  return fn;
87958
88030
 
@@ -88133,21 +88205,6 @@ void main() {
88133
88205
 
88134
88206
  } );
88135
88207
 
88136
- /**
88137
- * @tsl
88138
- * @function
88139
- * @deprecated since r168. Use {@link Fn} instead.
88140
- *
88141
- * @param {...any} params
88142
- * @returns {Function}
88143
- */
88144
- const tslFn = ( ...params ) => { // @deprecated, r168
88145
-
88146
- console.warn( 'THREE.TSL: tslFn() has been renamed to Fn().' );
88147
- return Fn$1( ...params );
88148
-
88149
- };
88150
-
88151
88208
  /**
88152
88209
  * This class represents a shader property. It can be used
88153
88210
  * to explicitly define a property and assign a value to it.
@@ -90010,22 +90067,6 @@ void main() {
90010
90067
  addMethodChaining( 'increment', increment );
90011
90068
  addMethodChaining( 'decrement', decrement );
90012
90069
 
90013
- /**
90014
- * @tsl
90015
- * @function
90016
- * @deprecated since r168. Use {@link mod} instead.
90017
- *
90018
- * @param {Node} a - The first input.
90019
- * @param {Node} b - The second input.
90020
- * @returns {OperatorNode}
90021
- */
90022
- const remainder = ( a, b ) => { // @deprecated, r168
90023
-
90024
- console.warn( 'THREE.TSL: "remainder()" is deprecated. Use "mod( int( ... ) )" instead.' );
90025
- return mod( a, b );
90026
-
90027
- };
90028
-
90029
90070
  /**
90030
90071
  * @tsl
90031
90072
  * @function
@@ -90042,7 +90083,6 @@ void main() {
90042
90083
 
90043
90084
  };
90044
90085
 
90045
- addMethodChaining( 'remainder', remainder );
90046
90086
  addMethodChaining( 'modInt', modInt );
90047
90087
 
90048
90088
  /**
@@ -91082,6 +91122,17 @@ void main() {
91082
91122
  */
91083
91123
  const smoothstepElement = ( x, low, high ) => smoothstep( low, high, x );
91084
91124
 
91125
+ /**
91126
+ * Alias for `step()` with a different parameter order.
91127
+ *
91128
+ * @tsl
91129
+ * @function
91130
+ * @param {Node | number} x - The source value for interpolation.
91131
+ * @param {Node | number} edge - The edge value.
91132
+ * @returns {Node}
91133
+ */
91134
+ const stepElement = ( x, edge ) => step( edge, x );
91135
+
91085
91136
  /**
91086
91137
  * Returns the arc-tangent of the quotient of its parameters.
91087
91138
  *
@@ -91144,7 +91195,7 @@ void main() {
91144
91195
  addMethodChaining( 'atan2', atan2 );
91145
91196
  addMethodChaining( 'min', min$1 );
91146
91197
  addMethodChaining( 'max', max$1 );
91147
- addMethodChaining( 'step', step );
91198
+ addMethodChaining( 'step', stepElement );
91148
91199
  addMethodChaining( 'reflect', reflect );
91149
91200
  addMethodChaining( 'distance', distance );
91150
91201
  addMethodChaining( 'dot', dot );
@@ -91388,25 +91439,6 @@ void main() {
91388
91439
 
91389
91440
  addMethodChaining( 'select', select$1 );
91390
91441
 
91391
- // Deprecated
91392
-
91393
- /**
91394
- * @tsl
91395
- * @function
91396
- * @deprecated since r168. Use {@link select} instead.
91397
- *
91398
- * @param {...any} params
91399
- * @returns {ConditionalNode}
91400
- */
91401
- const cond = ( ...params ) => { // @deprecated, r168
91402
-
91403
- console.warn( 'THREE.TSL: cond() has been renamed to select().' );
91404
- return select$1( ...params );
91405
-
91406
- };
91407
-
91408
- addMethodChaining( 'cond', cond );
91409
-
91410
91442
  /**
91411
91443
  * This node can be used as a context management component for another node.
91412
91444
  * {@link NodeBuilder} performs its node building process in a specific context and
@@ -91760,6 +91792,91 @@ void main() {
91760
91792
 
91761
91793
  addMethodChaining( 'temp', temp );
91762
91794
 
91795
+ /**
91796
+ * This node is used to build a sub-build in the node system.
91797
+ *
91798
+ * @augments Node
91799
+ * @param {Node} node - The node to be built in the sub-build.
91800
+ * @param {string} name - The name of the sub-build.
91801
+ * @param {string|null} [nodeType=null] - The type of the node, if known.
91802
+ */
91803
+ class SubBuildNode extends Node {
91804
+
91805
+ static get type() {
91806
+
91807
+ return 'SubBuild';
91808
+
91809
+ }
91810
+
91811
+ constructor( node, name, nodeType = null ) {
91812
+
91813
+ super( nodeType );
91814
+
91815
+ /**
91816
+ * The node to be built in the sub-build.
91817
+ *
91818
+ * @type {Node}
91819
+ */
91820
+ this.node = node;
91821
+
91822
+ /**
91823
+ * The name of the sub-build.
91824
+ *
91825
+ * @type {string}
91826
+ */
91827
+ this.name = name;
91828
+
91829
+ /**
91830
+ * This flag can be used for type testing.
91831
+ *
91832
+ * @type {boolean}
91833
+ * @readonly
91834
+ * @default true
91835
+ */
91836
+ this.isSubBuildNode = true;
91837
+
91838
+ }
91839
+
91840
+ getNodeType( builder ) {
91841
+
91842
+ if ( this.nodeType !== null ) return this.nodeType;
91843
+
91844
+ builder.addSubBuild( this.name );
91845
+
91846
+ const nodeType = this.node.getNodeType( builder );
91847
+
91848
+ builder.removeSubBuild();
91849
+
91850
+ return nodeType;
91851
+
91852
+ }
91853
+
91854
+ build( builder, ...params ) {
91855
+
91856
+ builder.addSubBuild( this.name );
91857
+
91858
+ const data = this.node.build( builder, ...params );
91859
+
91860
+ builder.removeSubBuild();
91861
+
91862
+ return data;
91863
+
91864
+ }
91865
+
91866
+ }
91867
+
91868
+ /**
91869
+ * Creates a new sub-build node.
91870
+ *
91871
+ * @tsl
91872
+ * @function
91873
+ * @param {Node} node - The node to be built in the sub-build.
91874
+ * @param {string} name - The name of the sub-build.
91875
+ * @param {string|null} [type=null] - The type of the node, if known.
91876
+ * @returns {Node} A node object wrapping the SubBuildNode instance.
91877
+ */
91878
+ const subBuild = ( node, name, type = null ) => nodeObject( new SubBuildNode( nodeObject( node ), name, type ) );
91879
+
91763
91880
  /**
91764
91881
  * Class for representing shader varyings as nodes. Varyings are create from
91765
91882
  * existing nodes like the following:
@@ -91889,7 +92006,7 @@ void main() {
91889
92006
  const interpolationSampling = this.interpolationSampling;
91890
92007
 
91891
92008
  properties.varying = varying = builder.getVaryingFromNode( this, name, type, interpolationType, interpolationSampling );
91892
- properties.node = this.node;
92009
+ properties.node = subBuild( this.node, 'VERTEX' );
91893
92010
 
91894
92011
  }
91895
92012
 
@@ -91918,18 +92035,19 @@ void main() {
91918
92035
 
91919
92036
  generate( builder ) {
91920
92037
 
92038
+ const propertyKey = builder.getSubBuildProperty( 'property', builder.currentStack );
91921
92039
  const properties = builder.getNodeProperties( this );
91922
92040
  const varying = this.setupVarying( builder );
91923
92041
 
91924
- if ( properties.propertyName === undefined ) {
92042
+ if ( properties[ propertyKey ] === undefined ) {
91925
92043
 
91926
92044
  const type = this.getNodeType( builder );
91927
92045
  const propertyName = builder.getPropertyName( varying, NodeShaderStage.VERTEX );
91928
92046
 
91929
92047
  // force node run in vertex stage
91930
- builder.flowNodeFromShaderStage( NodeShaderStage.VERTEX, this.node, type, propertyName );
92048
+ builder.flowNodeFromShaderStage( NodeShaderStage.VERTEX, properties.node, type, propertyName );
91931
92049
 
91932
- properties.propertyName = propertyName;
92050
+ properties[ propertyKey ] = propertyName;
91933
92051
 
91934
92052
  }
91935
92053
 
@@ -93356,20 +93474,6 @@ void main() {
93356
93474
  */
93357
93475
  const cache = ( node, parent ) => nodeObject( new CacheNode( nodeObject( node ), parent ) );
93358
93476
 
93359
- /**
93360
- * Assigns a namespace to the given node by updating its context.
93361
- *
93362
- * Important for TSL functions that use `.once( namespace )` to ensure that the namespace will run twice,
93363
- * once when the node is build in the specific namespace and once when the node is built in the others namespace.
93364
- *
93365
- * This is useful for nodes like `positionWorld` that need to be re-updated if used in `material.positionNode` and outside of it in the same material.
93366
- *
93367
- * @param {Object} node - The node to which the namespace will be assigned.
93368
- * @param {string} namespace - The namespace to be assigned to the node.
93369
- * @returns {Object} The updated node with the new namespace in its context.
93370
- */
93371
- const namespace$1 = ( node, namespace ) => node.context( { namespace } );
93372
-
93373
93477
  addMethodChaining( 'cache', cache );
93374
93478
 
93375
93479
  /**
@@ -94043,7 +94147,7 @@ void main() {
94043
94147
  * @param {number} [index=0] - The uv index.
94044
94148
  * @return {AttributeNode<vec2>} The uv attribute node.
94045
94149
  */
94046
- const uv = ( index = 0 ) => attribute( 'uv' + ( index > 0 ? index : '' ), 'vec2' );
94150
+ const uv$1 = ( index = 0 ) => attribute( 'uv' + ( index > 0 ? index : '' ), 'vec2' );
94047
94151
 
94048
94152
  /**
94049
94153
  * A node that represents the dimensions of a texture. The texture size is
@@ -94436,7 +94540,7 @@ void main() {
94436
94540
  */
94437
94541
  getDefaultUV() {
94438
94542
 
94439
- return uv( this.value.channel );
94543
+ return uv$1( this.value.channel );
94440
94544
 
94441
94545
  }
94442
94546
 
@@ -95469,22 +95573,6 @@ void main() {
95469
95573
  */
95470
95574
  const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
95471
95575
 
95472
- /**
95473
- * @tsl
95474
- * @function
95475
- * @deprecated since r168. Use {@link uniformArray} instead.
95476
- *
95477
- * @param {Array<any>} values - Array-like data.
95478
- * @param {string} nodeType - The data type of the array elements.
95479
- * @returns {UniformArrayNode}
95480
- */
95481
- const uniforms = ( values, nodeType ) => { // @deprecated, r168
95482
-
95483
- console.warn( 'THREE.TSL: uniforms() has been renamed to uniformArray().' );
95484
- return nodeObject( new UniformArrayNode( values, nodeType ) );
95485
-
95486
- };
95487
-
95488
95576
  /**
95489
95577
  * The node allows to set values for built-in shader variables. That is
95490
95578
  * required for features like hardware-accelerated vertex clipping.
@@ -95950,7 +96038,7 @@ void main() {
95950
96038
  * @tsl
95951
96039
  * @function
95952
96040
  * @param {?Object3D} [object3d] - The 3D object.
95953
- * @returns {Object3DNode<vec3>}
96041
+ * @returns {Object3DNode<float>}
95954
96042
  */
95955
96043
  const objectRadius = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.RADIUS ).setParameterLength( 1 );
95956
96044
 
@@ -96162,9 +96250,9 @@ void main() {
96162
96250
  */
96163
96251
  const positionWorld = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96164
96252
 
96165
- return modelWorldMatrix.mul( positionLocal ).xyz.toVarying( builder.getNamespace( 'v_positionWorld' ) );
96253
+ return modelWorldMatrix.mul( positionLocal ).xyz.toVarying( builder.getSubBuildProperty( 'v_positionWorld' ) );
96166
96254
 
96167
- }, 'vec3' ).once( 'POSITION' ) )();
96255
+ }, 'vec3' ).once( [ 'POSITION' ] ) )();
96168
96256
 
96169
96257
  /**
96170
96258
  * TSL object that represents the position world direction of the current rendered object.
@@ -96172,13 +96260,13 @@ void main() {
96172
96260
  * @tsl
96173
96261
  * @type {Node<vec3>}
96174
96262
  */
96175
- const positionWorldDirection = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96263
+ const positionWorldDirection = /*@__PURE__*/ ( Fn$1( () => {
96176
96264
 
96177
- const vertexPWD = positionLocal.transformDirection( modelWorldMatrix ).toVarying( builder.getNamespace( 'v_positionWorldDirection' ) );
96265
+ const vertexPWD = positionLocal.transformDirection( modelWorldMatrix ).toVarying( 'v_positionWorldDirection' );
96178
96266
 
96179
96267
  return vertexPWD.normalize().toVar( 'positionWorldDirection' );
96180
96268
 
96181
- }, 'vec3' ).once( 'POSITION' ) )();
96269
+ }, 'vec3' ).once( [ 'POSITION' ] ) )();
96182
96270
 
96183
96271
  /**
96184
96272
  * TSL object that represents the vertex position in view space of the current rendered object.
@@ -96188,9 +96276,9 @@ void main() {
96188
96276
  */
96189
96277
  const positionView = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96190
96278
 
96191
- return builder.context.setupPositionView().toVarying( builder.getNamespace( 'v_positionView' ) );
96279
+ return builder.context.setupPositionView().toVarying( 'v_positionView' );
96192
96280
 
96193
- }, 'vec3' ).once( 'POSITION' ) )();
96281
+ }, 'vec3' ).once( [ 'POSITION' ] ) )();
96194
96282
 
96195
96283
  /**
96196
96284
  * TSL object that represents the position view direction of the current rendered object.
@@ -96233,6 +96321,10 @@ void main() {
96233
96321
 
96234
96322
  generate( builder ) {
96235
96323
 
96324
+ if ( builder.shaderStage !== 'fragment' ) return 'true';
96325
+
96326
+ //
96327
+
96236
96328
  const { renderer, material } = builder;
96237
96329
 
96238
96330
  if ( renderer.coordinateSystem === WebGLCoordinateSystem ) {
@@ -96268,6 +96360,34 @@ void main() {
96268
96360
  */
96269
96361
  const faceDirection = /*@__PURE__*/ float$1( frontFacing ).mul( 2.0 ).sub( 1.0 );
96270
96362
 
96363
+ /**
96364
+ * Converts a direction vector to a face direction vector based on the material's side.
96365
+ *
96366
+ * If the material is set to `BackSide`, the direction is inverted.
96367
+ * If the material is set to `DoubleSide`, the direction is multiplied by `faceDirection`.
96368
+ *
96369
+ * @tsl
96370
+ * @param {Node<vec3>} direction - The direction vector to convert.
96371
+ * @returns {Node<vec3>} The converted direction vector.
96372
+ */
96373
+ const directionToFaceDirection = /*@__PURE__*/ Fn$1( ( [ direction ], { material } ) => {
96374
+
96375
+ const side = material.side;
96376
+
96377
+ if ( side === BackSide ) {
96378
+
96379
+ direction = direction.mul( -1 );
96380
+
96381
+ } else if ( side === DoubleSide ) {
96382
+
96383
+ direction = direction.mul( faceDirection );
96384
+
96385
+ }
96386
+
96387
+ return direction;
96388
+
96389
+ } );
96390
+
96271
96391
  /**
96272
96392
  * TSL object that represents the normal attribute of the current rendered object.
96273
96393
  *
@@ -96310,7 +96430,7 @@ void main() {
96310
96430
  * @tsl
96311
96431
  * @type {Node<vec3>}
96312
96432
  */
96313
- const normalView = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96433
+ const normalViewGeometry = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96314
96434
 
96315
96435
  let node;
96316
96436
 
@@ -96320,13 +96440,13 @@ void main() {
96320
96440
 
96321
96441
  } else {
96322
96442
 
96323
- node = varying( transformNormalToView( normalLocal ), 'v_normalView' ).normalize();
96443
+ node = transformNormalToView( normalLocal ).toVarying( 'v_normalViewGeometry' ).normalize();
96324
96444
 
96325
96445
  }
96326
96446
 
96327
96447
  return node;
96328
96448
 
96329
- }, 'vec3' ).once() )().toVar( 'normalView' );
96449
+ }, 'vec3' ).once() )().toVar( 'normalViewGeometry' );
96330
96450
 
96331
96451
  /**
96332
96452
  * TSL object that represents the vertex normal in world space of the current rendered object.
@@ -96334,19 +96454,19 @@ void main() {
96334
96454
  * @tsl
96335
96455
  * @type {Node<vec3>}
96336
96456
  */
96337
- const normalWorld = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96457
+ const normalWorldGeometry = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96338
96458
 
96339
- let normal = normalView.transformDirection( cameraViewMatrix );
96459
+ let normal = normalViewGeometry.transformDirection( cameraViewMatrix );
96340
96460
 
96341
96461
  if ( builder.material.flatShading !== true ) {
96342
96462
 
96343
- normal = varying( normal, 'v_normalWorld' );
96463
+ normal = normal.toVarying( 'v_normalWorldGeometry' );
96344
96464
 
96345
96465
  }
96346
96466
 
96347
- return normal;
96467
+ return normal.normalize().toVar( 'normalWorldGeometry' );
96348
96468
 
96349
- }, 'vec3' ).once() )().normalize().toVar( 'normalWorld' );
96469
+ }, 'vec3' ).once() )();
96350
96470
 
96351
96471
  /**
96352
96472
  * TSL object that represents the transformed vertex normal in view space of the current rendered object.
@@ -96354,17 +96474,31 @@ void main() {
96354
96474
  * @tsl
96355
96475
  * @type {Node<vec3>}
96356
96476
  */
96357
- const transformedNormalView = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96477
+ const normalView = /*@__PURE__*/ ( Fn$1( ( { subBuildFn, material, context } ) => {
96478
+
96479
+ let node;
96358
96480
 
96359
- // Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
96481
+ if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
96360
96482
 
96361
- let node = builder.context.setupNormal().context( { getUV: null } );
96483
+ node = normalViewGeometry;
96362
96484
 
96363
- if ( builder.material.flatShading !== true ) node = node.mul( faceDirection );
96485
+ if ( material.flatShading !== true ) {
96486
+
96487
+ node = directionToFaceDirection( node );
96488
+
96489
+ }
96490
+
96491
+ } else {
96492
+
96493
+ // Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
96494
+
96495
+ node = context.setupNormal().context( { getUV: null } );
96496
+
96497
+ }
96364
96498
 
96365
96499
  return node;
96366
96500
 
96367
- }, 'vec3' ).once() )().toVar( 'transformedNormalView' );
96501
+ }, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'normalView' );
96368
96502
 
96369
96503
  /**
96370
96504
  * TSL object that represents the transformed vertex normal in world space of the current rendered object.
@@ -96372,7 +96506,7 @@ void main() {
96372
96506
  * @tsl
96373
96507
  * @type {Node<vec3>}
96374
96508
  */
96375
- const transformedNormalWorld = /*@__PURE__*/ transformedNormalView.transformDirection( cameraViewMatrix ).toVar( 'transformedNormalWorld' );
96509
+ const normalWorld = /*@__PURE__*/ normalView.transformDirection( cameraViewMatrix ).toVar( 'normalWorld' );
96376
96510
 
96377
96511
  /**
96378
96512
  * TSL object that represents the transformed clearcoat vertex normal in view space of the current rendered object.
@@ -96380,17 +96514,25 @@ void main() {
96380
96514
  * @tsl
96381
96515
  * @type {Node<vec3>}
96382
96516
  */
96383
- const transformedClearcoatNormalView = /*@__PURE__*/ ( Fn$1( ( builder ) => {
96517
+ const clearcoatNormalView = /*@__PURE__*/ ( Fn$1( ( { subBuildFn, context } ) => {
96518
+
96519
+ let node;
96384
96520
 
96385
- // Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
96521
+ if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
96386
96522
 
96387
- let node = builder.context.setupClearcoatNormal().context( { getUV: null } );
96523
+ node = normalView;
96388
96524
 
96389
- if ( builder.material.flatShading !== true ) node = node.mul( faceDirection );
96525
+ } else {
96526
+
96527
+ // Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)
96528
+
96529
+ node = context.setupClearcoatNormal().context( { getUV: null } );
96530
+
96531
+ }
96390
96532
 
96391
96533
  return node;
96392
96534
 
96393
- }, 'vec3' ).once() )().toVar( 'transformedClearcoatNormalView' );
96535
+ }, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'clearcoatNormalView' );
96394
96536
 
96395
96537
  /**
96396
96538
  * Transforms the normal with the given matrix.
@@ -96438,6 +96580,50 @@ void main() {
96438
96580
 
96439
96581
  } );
96440
96582
 
96583
+ // Deprecated
96584
+
96585
+ /**
96586
+ * TSL object that represents the transformed vertex normal in view space of the current rendered object.
96587
+ *
96588
+ * @tsl
96589
+ * @type {Node<vec3>}
96590
+ * @deprecated since r178. Use `normalView` instead.
96591
+ */
96592
+ const transformedNormalView = ( Fn$1( () => { // @deprecated, r177
96593
+
96594
+ console.warn( 'THREE.TSL: "transformedNormalView" is deprecated. Use "normalView" instead.' );
96595
+ return normalView;
96596
+
96597
+ } ).once( [ 'NORMAL', 'VERTEX' ] ) )();
96598
+
96599
+ /**
96600
+ * TSL object that represents the transformed vertex normal in world space of the current rendered object.
96601
+ *
96602
+ * @tsl
96603
+ * @type {Node<vec3>}
96604
+ * @deprecated since r178. Use `normalWorld` instead.
96605
+ */
96606
+ const transformedNormalWorld = ( Fn$1( () => { // @deprecated, r177
96607
+
96608
+ console.warn( 'THREE.TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.' );
96609
+ return normalWorld;
96610
+
96611
+ } ).once( [ 'NORMAL', 'VERTEX' ] ) )();
96612
+
96613
+ /**
96614
+ * TSL object that represents the transformed clearcoat vertex normal in view space of the current rendered object.
96615
+ *
96616
+ * @tsl
96617
+ * @type {Node<vec3>}
96618
+ * @deprecated since r178. Use `clearcoatNormalView` instead.
96619
+ */
96620
+ const transformedClearcoatNormalView = ( Fn$1( () => { // @deprecated, r177
96621
+
96622
+ console.warn( 'THREE.TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.' );
96623
+ return clearcoatNormalView;
96624
+
96625
+ } ).once( [ 'NORMAL', 'VERTEX' ] ) )();
96626
+
96441
96627
  const _e1$1 = /*@__PURE__*/ new Euler();
96442
96628
  const _m1$1 = /*@__PURE__*/ new Matrix4();
96443
96629
 
@@ -96500,7 +96686,7 @@ void main() {
96500
96686
  * @tsl
96501
96687
  * @type {Node<vec3>}
96502
96688
  */
96503
- const reflectView = /*@__PURE__*/ positionViewDirection.negate().reflect( transformedNormalView );
96689
+ const reflectView = /*@__PURE__*/ positionViewDirection.negate().reflect( normalView );
96504
96690
 
96505
96691
  /**
96506
96692
  * The refract vector in view space.
@@ -96508,7 +96694,7 @@ void main() {
96508
96694
  * @tsl
96509
96695
  * @type {Node<vec3>}
96510
96696
  */
96511
- const refractView = /*@__PURE__*/ positionViewDirection.negate().refract( transformedNormalView, materialRefractionRatio );
96697
+ const refractView = /*@__PURE__*/ positionViewDirection.negate().refract( normalView, materialRefractionRatio );
96512
96698
 
96513
96699
  /**
96514
96700
  * Used for sampling cube maps when using cube reflection mapping.
@@ -97183,6 +97369,49 @@ void main() {
97183
97369
  */
97184
97370
  const materialReference = ( name, type, material = null ) => nodeObject( new MaterialReferenceNode( name, type, material ) );
97185
97371
 
97372
+ // Normal Mapping Without Precomputed Tangents
97373
+ // http://www.thetenthplanet.de/archives/1180
97374
+
97375
+ const uv = uv$1();
97376
+
97377
+ const q0 = positionView.dFdx();
97378
+ const q1 = positionView.dFdy();
97379
+ const st0 = uv.dFdx();
97380
+ const st1 = uv.dFdy();
97381
+
97382
+ const N$1 = normalView;
97383
+
97384
+ const q1perp = q1.cross( N$1 );
97385
+ const q0perp = N$1.cross( q0 );
97386
+
97387
+ const T$1 = q1perp.mul( st0.x ).add( q0perp.mul( st1.x ) );
97388
+ const B$1 = q1perp.mul( st0.y ).add( q0perp.mul( st1.y ) );
97389
+
97390
+ const det = T$1.dot( T$1 ).max( B$1.dot( B$1 ) );
97391
+ const scale = det.equal( 0.0 ).select( 0.0, det.inverseSqrt() );
97392
+
97393
+ /**
97394
+ * Tangent vector in view space, computed dynamically from geometry and UV derivatives.
97395
+ * Useful for normal mapping without precomputed tangents.
97396
+ *
97397
+ * Reference: http://www.thetenthplanet.de/archives/1180
97398
+ *
97399
+ * @tsl
97400
+ * @type {Node<vec3>}
97401
+ */
97402
+ const tangentViewFrame = /*@__PURE__*/ T$1.mul( scale ).toVar( 'tangentViewFrame' );
97403
+
97404
+ /**
97405
+ * Bitangent vector in view space, computed dynamically from geometry and UV derivatives.
97406
+ * Complements the tangentViewFrame for constructing the tangent space basis.
97407
+ *
97408
+ * Reference: http://www.thetenthplanet.de/archives/1180
97409
+ *
97410
+ * @tsl
97411
+ * @type {Node<vec3>}
97412
+ */
97413
+ const bitangentViewFrame = /*@__PURE__*/ B$1.mul( scale ).toVar( 'bitangentViewFrame' );
97414
+
97186
97415
  /**
97187
97416
  * TSL object that represents the tangent attribute of the current rendered object.
97188
97417
  *
@@ -97215,31 +97444,37 @@ void main() {
97215
97444
  * @tsl
97216
97445
  * @type {Node<vec3>}
97217
97446
  */
97218
- const tangentView = /*@__PURE__*/ modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.toVarying( 'v_tangentView' ).normalize().toVar( 'tangentView' );
97447
+ const tangentView = /*@__PURE__*/ ( Fn$1( ( { subBuildFn, geometry, material } ) => {
97219
97448
 
97220
- /**
97221
- * TSL object that represents the vertex tangent in world space of the current rendered object.
97222
- *
97223
- * @tsl
97224
- * @type {Node<vec3>}
97225
- */
97226
- const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMatrix ).toVarying( 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' );
97449
+ let node;
97227
97450
 
97228
- /**
97229
- * TSL object that represents the transformed vertex tangent in view space of the current rendered object.
97230
- *
97231
- * @tsl
97232
- * @type {Node<vec3>}
97233
- */
97234
- const transformedTangentView = /*@__PURE__*/ tangentView.toVar( 'transformedTangentView' );
97451
+ if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
97452
+
97453
+ node = modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.toVarying( 'v_tangentView' ).normalize();
97454
+
97455
+ } else {
97456
+
97457
+ node = tangentViewFrame;
97458
+
97459
+ }
97460
+
97461
+ if ( material.flatShading !== true ) {
97462
+
97463
+ node = directionToFaceDirection( node );
97464
+
97465
+ }
97466
+
97467
+ return node;
97468
+
97469
+ }, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'tangentView' );
97235
97470
 
97236
97471
  /**
97237
- * TSL object that represents the transformed vertex tangent in world space of the current rendered object.
97472
+ * TSL object that represents the vertex tangent in world space of the current rendered object.
97238
97473
  *
97239
97474
  * @tsl
97240
97475
  * @type {Node<vec3>}
97241
97476
  */
97242
- const transformedTangentWorld = /*@__PURE__*/ transformedTangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedTangentWorld' );
97477
+ const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMatrix ).toVarying( 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' );
97243
97478
 
97244
97479
  /**
97245
97480
  * Returns the bitangent node and assigns it to a varying if the material is not flat shaded.
@@ -97250,19 +97485,19 @@ void main() {
97250
97485
  * @param {string} varyingName - The name of the varying to assign the bitangent to.
97251
97486
  * @returns {Node<vec3>} The bitangent node.
97252
97487
  */
97253
- const getBitangent = /*@__PURE__*/ Fn$1( ( [ crossNormalTangent, varyingName ], builder ) => {
97488
+ const getBitangent = /*@__PURE__*/ Fn$1( ( [ crossNormalTangent, varyingName ], { subBuildFn, material } ) => {
97254
97489
 
97255
97490
  let bitangent = crossNormalTangent.mul( tangentGeometry.w ).xyz;
97256
97491
 
97257
- if ( builder.material.flatShading !== true ) {
97492
+ if ( subBuildFn === 'NORMAL' && material.flatShading !== true ) {
97258
97493
 
97259
- bitangent = varying( bitangent, varyingName );
97494
+ bitangent = bitangent.toVarying( varyingName );
97260
97495
 
97261
97496
  }
97262
97497
 
97263
97498
  return bitangent;
97264
97499
 
97265
- } ).once();
97500
+ } ).once( [ 'NORMAL' ] );
97266
97501
 
97267
97502
  /**
97268
97503
  * TSL object that represents the bitangent attribute of the current rendered object.
@@ -97286,7 +97521,29 @@ void main() {
97286
97521
  * @tsl
97287
97522
  * @type {Node<vec3>}
97288
97523
  */
97289
- const bitangentView = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' );
97524
+ const bitangentView = /*@__PURE__*/ ( Fn$1( ( { subBuildFn, geometry, material } ) => {
97525
+
97526
+ let node;
97527
+
97528
+ if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
97529
+
97530
+ node = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize();
97531
+
97532
+ } else {
97533
+
97534
+ node = bitangentViewFrame;
97535
+
97536
+ }
97537
+
97538
+ if ( material.flatShading !== true ) {
97539
+
97540
+ node = directionToFaceDirection( node );
97541
+
97542
+ }
97543
+
97544
+ return node;
97545
+
97546
+ }, 'vec3' ).once( [ 'NORMAL', 'VERTEX' ] ) )().toVar( 'bitangentView' );
97290
97547
 
97291
97548
  /**
97292
97549
  * TSL object that represents the vertex bitangent in world space of the current rendered object.
@@ -97296,29 +97553,13 @@ void main() {
97296
97553
  */
97297
97554
  const bitangentWorld = /*@__PURE__*/ getBitangent( normalWorld.cross( tangentWorld ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' );
97298
97555
 
97299
- /**
97300
- * TSL object that represents the transformed vertex bitangent in view space of the current rendered object.
97301
- *
97302
- * @tsl
97303
- * @type {Node<vec3>}
97304
- */
97305
- const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ), 'v_transformedBitangentView' ).normalize().toVar( 'transformedBitangentView' );
97306
-
97307
- /**
97308
- * TSL object that represents the transformed vertex bitangent in world space of the current rendered object.
97309
- *
97310
- * @tsl
97311
- * @type {Node<vec4>}
97312
- */
97313
- const transformedBitangentWorld = /*@__PURE__*/ transformedBitangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedBitangentWorld' );
97314
-
97315
97556
  /**
97316
97557
  * TSL object that represents the TBN matrix in view space.
97317
97558
  *
97318
97559
  * @tsl
97319
97560
  * @type {Node<mat3>}
97320
97561
  */
97321
- const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView );
97562
+ const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView ).toVar( 'TBNViewMatrix' );
97322
97563
 
97323
97564
  /**
97324
97565
  * TSL object that represents the parallax direction.
@@ -97346,45 +97587,17 @@ void main() {
97346
97587
  * @function
97347
97588
  * @returns {Node<vec3>} Bent normals.
97348
97589
  */
97349
- const transformedBentNormalView = /*@__PURE__*/ ( () => {
97590
+ const bentNormalView = /*@__PURE__*/ ( Fn$1( () => {
97350
97591
 
97351
97592
  // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy
97352
97593
 
97353
97594
  let bentNormal = anisotropyB.cross( positionViewDirection );
97354
97595
  bentNormal = bentNormal.cross( anisotropyB ).normalize();
97355
- bentNormal = mix$2( bentNormal, transformedNormalView, anisotropy.mul( roughness.oneMinus() ).oneMinus().pow2().pow2() ).normalize();
97596
+ bentNormal = mix$2( bentNormal, normalView, anisotropy.mul( roughness.oneMinus() ).oneMinus().pow2().pow2() ).normalize();
97356
97597
 
97357
97598
  return bentNormal;
97358
97599
 
97359
-
97360
- } )();
97361
-
97362
- // Normal Mapping Without Precomputed Tangents
97363
- // http://www.thetenthplanet.de/archives/1180
97364
-
97365
- const perturbNormal2Arb = /*@__PURE__*/ Fn$1( ( inputs ) => {
97366
-
97367
- const { eye_pos, surf_norm, mapN, uv } = inputs;
97368
-
97369
- const q0 = eye_pos.dFdx();
97370
- const q1 = eye_pos.dFdy();
97371
- const st0 = uv.dFdx();
97372
- const st1 = uv.dFdy();
97373
-
97374
- const N = surf_norm; // normalized
97375
-
97376
- const q1perp = q1.cross( N );
97377
- const q0perp = N.cross( q0 );
97378
-
97379
- const T = q1perp.mul( st0.x ).add( q0perp.mul( st1.x ) );
97380
- const B = q1perp.mul( st0.y ).add( q0perp.mul( st1.y ) );
97381
-
97382
- const det = T.dot( T ).max( B.dot( B ) );
97383
- const scale = faceDirection.mul( det.inverseSqrt() );
97384
-
97385
- return add( T.mul( mapN.x, scale ), B.mul( mapN.y, scale ), N.mul( mapN.z ) ).normalize();
97386
-
97387
- } );
97600
+ } ).once() )();
97388
97601
 
97389
97602
  /**
97390
97603
  * This class can be used for applying normals maps to materials.
@@ -97438,7 +97651,7 @@ void main() {
97438
97651
 
97439
97652
  }
97440
97653
 
97441
- setup( builder ) {
97654
+ setup( { material } ) {
97442
97655
 
97443
97656
  const { normalMapType, scaleNode } = this;
97444
97657
 
@@ -97446,38 +97659,37 @@ void main() {
97446
97659
 
97447
97660
  if ( scaleNode !== null ) {
97448
97661
 
97449
- normalMap = vec3( normalMap.xy.mul( scaleNode ), normalMap.z );
97662
+ let scale = scaleNode;
97663
+
97664
+ if ( material.flatShading === true ) {
97665
+
97666
+ scale = directionToFaceDirection( scale );
97667
+
97668
+ }
97669
+
97670
+ normalMap = vec3( normalMap.xy.mul( scale ), normalMap.z );
97450
97671
 
97451
97672
  }
97452
97673
 
97453
- let outputNode = null;
97674
+ let output = null;
97454
97675
 
97455
97676
  if ( normalMapType === ObjectSpaceNormalMap ) {
97456
97677
 
97457
- outputNode = transformNormalToView( normalMap );
97678
+ output = transformNormalToView( normalMap );
97458
97679
 
97459
97680
  } else if ( normalMapType === TangentSpaceNormalMap ) {
97460
97681
 
97461
- const tangent = builder.hasGeometryAttribute( 'tangent' );
97682
+ output = TBNViewMatrix.mul( normalMap ).normalize();
97462
97683
 
97463
- if ( tangent === true ) {
97464
-
97465
- outputNode = TBNViewMatrix.mul( normalMap ).normalize();
97466
-
97467
- } else {
97684
+ } else {
97468
97685
 
97469
- outputNode = perturbNormal2Arb( {
97470
- eye_pos: positionView,
97471
- surf_norm: normalView,
97472
- mapN: normalMap,
97473
- uv: uv()
97474
- } );
97686
+ console.error( `THREE.NodeMaterial: Unsupported normal map type: ${ normalMapType }` );
97475
97687
 
97476
- }
97688
+ output = normalView; // Fallback to default normal view
97477
97689
 
97478
97690
  }
97479
97691
 
97480
- return outputNode;
97692
+ return output;
97481
97693
 
97482
97694
  }
97483
97695
 
@@ -97500,7 +97712,7 @@ void main() {
97500
97712
  const dHdxy_fwd = Fn$1( ( { textureNode, bumpScale } ) => {
97501
97713
 
97502
97714
  // It's used to preserve the same TextureNode instance
97503
- const sampleTexture = ( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } );
97715
+ const sampleTexture = ( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv$1() ), forceUVContext: true } );
97504
97716
 
97505
97717
  const Hll = float$1( sampleTexture( ( uvNode ) => uvNode ) );
97506
97718
 
@@ -100150,23 +100362,6 @@ void main() {
100150
100362
  */
100151
100363
  const Break = () => expression( 'break' ).toStack();
100152
100364
 
100153
- // Deprecated
100154
-
100155
- /**
100156
- * @tsl
100157
- * @function
100158
- * @deprecated since r168. Use {@link Loop} instead.
100159
- *
100160
- * @param {...any} params
100161
- * @returns {LoopNode}
100162
- */
100163
- const loop = ( ...params ) => { // @deprecated, r168
100164
-
100165
- console.warn( 'THREE.TSL: loop() has been renamed to Loop().' );
100166
- return Loop$1( ...params );
100167
-
100168
- };
100169
-
100170
100365
  const _morphTextures = /*@__PURE__*/ new WeakMap();
100171
100366
  const _morphVec4 = /*@__PURE__*/ new Vector4();
100172
100367
 
@@ -100938,32 +101133,6 @@ void main() {
100938
101133
 
100939
101134
  }, 'vec2' ).once() )();
100940
101135
 
100941
- /**
100942
- * @tsl
100943
- * @deprecated since r168. Use {@link screenUV} instead.
100944
- * @type {Node<vec2>}
100945
- */
100946
- const viewportTopLeft = /*@__PURE__*/ ( Fn$1( () => { // @deprecated, r168
100947
-
100948
- console.warn( 'THREE.TSL: "viewportTopLeft" is deprecated. Use "screenUV" instead.' );
100949
-
100950
- return screenUV;
100951
-
100952
- }, 'vec2' ).once() )();
100953
-
100954
- /**
100955
- * @tsl
100956
- * @deprecated since r168. Use `screenUV.flipY()` instead.
100957
- * @type {Node<vec2>}
100958
- */
100959
- const viewportBottomLeft = /*@__PURE__*/ ( Fn$1( () => { // @deprecated, r168
100960
-
100961
- console.warn( 'THREE.TSL: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.' );
100962
-
100963
- return screenUV.flipY();
100964
-
100965
- }, 'vec2' ).once() )();
100966
-
100967
101136
  const _size$4 = /*@__PURE__*/ new Vector2();
100968
101137
 
100969
101138
  /**
@@ -101840,6 +102009,238 @@ void main() {
101840
102009
  */
101841
102010
  const vertexColor = ( index = 0 ) => nodeObject( new VertexColorNode( index ) );
101842
102011
 
102012
+ /**
102013
+ * Represents a "Color Burn" blend mode.
102014
+ *
102015
+ * It's designed to darken the base layer's colors based on the color of the blend layer.
102016
+ * It significantly increases the contrast of the base layer, making the colors more vibrant and saturated.
102017
+ * The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer.
102018
+ *
102019
+ * @tsl
102020
+ * @function
102021
+ * @param {Node<vec3>} base - The base color.
102022
+ * @param {Node<vec3>} blend - The blend color. A white (#ffffff) blend color does not alter the base color.
102023
+ * @return {Node<vec3>} The result.
102024
+ */
102025
+ const blendBurn = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
102026
+
102027
+ return min$1( 1.0, base.oneMinus().div( blend ) ).oneMinus();
102028
+
102029
+ } ).setLayout( {
102030
+ name: 'blendBurn',
102031
+ type: 'vec3',
102032
+ inputs: [
102033
+ { name: 'base', type: 'vec3' },
102034
+ { name: 'blend', type: 'vec3' }
102035
+ ]
102036
+ } );
102037
+
102038
+ /**
102039
+ * Represents a "Color Dodge" blend mode.
102040
+ *
102041
+ * It's designed to lighten the base layer's colors based on the color of the blend layer.
102042
+ * It significantly increases the brightness of the base layer, making the colors lighter and more vibrant.
102043
+ * The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer.
102044
+ *
102045
+ * @tsl
102046
+ * @function
102047
+ * @param {Node<vec3>} base - The base color.
102048
+ * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
102049
+ * @return {Node<vec3>} The result.
102050
+ */
102051
+ const blendDodge = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
102052
+
102053
+ return min$1( base.div( blend.oneMinus() ), 1.0 );
102054
+
102055
+ } ).setLayout( {
102056
+ name: 'blendDodge',
102057
+ type: 'vec3',
102058
+ inputs: [
102059
+ { name: 'base', type: 'vec3' },
102060
+ { name: 'blend', type: 'vec3' }
102061
+ ]
102062
+ } );
102063
+
102064
+ /**
102065
+ * Represents a "Screen" blend mode.
102066
+ *
102067
+ * Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer.
102068
+ * The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced
102069
+ * effects.
102070
+ *
102071
+ * @tsl
102072
+ * @function
102073
+ * @param {Node<vec3>} base - The base color.
102074
+ * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
102075
+ * @return {Node<vec3>} The result.
102076
+ */
102077
+ const blendScreen = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
102078
+
102079
+ return base.oneMinus().mul( blend.oneMinus() ).oneMinus();
102080
+
102081
+ } ).setLayout( {
102082
+ name: 'blendScreen',
102083
+ type: 'vec3',
102084
+ inputs: [
102085
+ { name: 'base', type: 'vec3' },
102086
+ { name: 'blend', type: 'vec3' }
102087
+ ]
102088
+ } );
102089
+
102090
+ /**
102091
+ * Represents a "Overlay" blend mode.
102092
+ *
102093
+ * It's designed to increase the contrast of the base layer based on the color of the blend layer.
102094
+ * It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker.
102095
+ * The color of the blend layer significantly influences the resulting contrast and color shift in the base layer.
102096
+ *
102097
+ * @tsl
102098
+ * @function
102099
+ * @param {Node<vec3>} base - The base color.
102100
+ * @param {Node<vec3>} blend - The blend color
102101
+ * @return {Node<vec3>} The result.
102102
+ */
102103
+ const blendOverlay = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
102104
+
102105
+ return mix$2( base.mul( 2.0 ).mul( blend ), base.oneMinus().mul( 2.0 ).mul( blend.oneMinus() ).oneMinus(), step( 0.5, base ) );
102106
+
102107
+ } ).setLayout( {
102108
+ name: 'blendOverlay',
102109
+ type: 'vec3',
102110
+ inputs: [
102111
+ { name: 'base', type: 'vec3' },
102112
+ { name: 'blend', type: 'vec3' }
102113
+ ]
102114
+ } );
102115
+
102116
+ /**
102117
+ * This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`.
102118
+ * It assumes both input colors have non-premultiplied alpha.
102119
+ *
102120
+ * @tsl
102121
+ * @function
102122
+ * @param {Node<vec4>} base - The base color.
102123
+ * @param {Node<vec4>} blend - The blend color
102124
+ * @return {Node<vec4>} The result.
102125
+ */
102126
+ const blendColor = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
102127
+
102128
+ const outAlpha = blend.a.add( base.a.mul( blend.a.oneMinus() ) );
102129
+
102130
+ return vec4( blend.rgb.mul( blend.a ).add( base.rgb.mul( base.a ).mul( blend.a.oneMinus() ) ).div( outAlpha ), outAlpha );
102131
+
102132
+ } ).setLayout( {
102133
+ name: 'blendColor',
102134
+ type: 'vec4',
102135
+ inputs: [
102136
+ { name: 'base', type: 'vec4' },
102137
+ { name: 'blend', type: 'vec4' }
102138
+ ]
102139
+ } );
102140
+
102141
+ /**
102142
+ * Premultiplies the RGB channels of a color by its alpha channel.
102143
+ *
102144
+ * This function is useful for converting a non-premultiplied alpha color
102145
+ * into a premultiplied alpha format, where the RGB values are scaled
102146
+ * by the alpha value. Premultiplied alpha is often used in graphics
102147
+ * rendering for certain operations, such as compositing and image processing.
102148
+ *
102149
+ * @tsl
102150
+ * @function
102151
+ * @param {Node<vec4>} color - The input color with non-premultiplied alpha.
102152
+ * @return {Node<vec4>} The color with premultiplied alpha.
102153
+ */
102154
+ const premultiplyAlpha = /*@__PURE__*/ Fn$1( ( [ color ] ) => {
102155
+
102156
+ return vec4( color.rgb.mul( color.a ), color.a );
102157
+
102158
+ }, { color: 'vec4', return: 'vec4' } );
102159
+
102160
+ /**
102161
+ * Unpremultiplies the RGB channels of a color by its alpha channel.
102162
+ *
102163
+ * This function is useful for converting a premultiplied alpha color
102164
+ * back into a non-premultiplied alpha format, where the RGB values are
102165
+ * divided by the alpha value. Unpremultiplied alpha is often used in graphics
102166
+ * rendering for certain operations, such as compositing and image processing.
102167
+ *
102168
+ * @tsl
102169
+ * @function
102170
+ * @param {Node<vec4>} color - The input color with premultiplied alpha.
102171
+ * @return {Node<vec4>} The color with non-premultiplied alpha.
102172
+ */
102173
+ const unpremultiplyAlpha = /*@__PURE__*/ Fn$1( ( [ color ] ) => {
102174
+
102175
+ If$1( color.a.equal( 0.0 ), () => vec4( 0.0 ) );
102176
+
102177
+ return vec4( color.rgb.div( color.a ), color.a );
102178
+
102179
+ }, { color: 'vec4', return: 'vec4' } );
102180
+
102181
+
102182
+ // Deprecated
102183
+
102184
+ /**
102185
+ * @tsl
102186
+ * @function
102187
+ * @deprecated since r171. Use {@link blendBurn} instead.
102188
+ *
102189
+ * @param {...any} params
102190
+ * @returns {Function}
102191
+ */
102192
+ const burn = ( ...params ) => { // @deprecated, r171
102193
+
102194
+ console.warn( 'THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.' );
102195
+ return blendBurn( params );
102196
+
102197
+ };
102198
+
102199
+ /**
102200
+ * @tsl
102201
+ * @function
102202
+ * @deprecated since r171. Use {@link blendDodge} instead.
102203
+ *
102204
+ * @param {...any} params
102205
+ * @returns {Function}
102206
+ */
102207
+ const dodge = ( ...params ) => { // @deprecated, r171
102208
+
102209
+ console.warn( 'THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.' );
102210
+ return blendDodge( params );
102211
+
102212
+ };
102213
+
102214
+ /**
102215
+ * @tsl
102216
+ * @function
102217
+ * @deprecated since r171. Use {@link blendScreen} instead.
102218
+ *
102219
+ * @param {...any} params
102220
+ * @returns {Function}
102221
+ */
102222
+ const screen = ( ...params ) => { // @deprecated, r171
102223
+
102224
+ console.warn( 'THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.' );
102225
+ return blendScreen( params );
102226
+
102227
+ };
102228
+
102229
+ /**
102230
+ * @tsl
102231
+ * @function
102232
+ * @deprecated since r171. Use {@link blendOverlay} instead.
102233
+ *
102234
+ * @param {...any} params
102235
+ * @returns {Function}
102236
+ */
102237
+ const overlay = ( ...params ) => { // @deprecated, r171
102238
+
102239
+ console.warn( 'THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.' );
102240
+ return blendOverlay( params );
102241
+
102242
+ };
102243
+
101843
102244
  /**
101844
102245
  * Base class for all node materials.
101845
102246
  *
@@ -102259,7 +102660,7 @@ void main() {
102259
102660
  */
102260
102661
  setup( builder ) {
102261
102662
 
102262
- builder.context.setupNormal = () => this.setupNormal( builder );
102663
+ builder.context.setupNormal = () => subBuild( this.setupNormal( builder ), 'NORMAL', 'vec3' );
102263
102664
  builder.context.setupPositionView = () => this.setupPositionView( builder );
102264
102665
  builder.context.setupModelViewProjection = () => this.setupModelViewProjection( builder );
102265
102666
 
@@ -102270,7 +102671,7 @@ void main() {
102270
102671
 
102271
102672
  builder.addStack();
102272
102673
 
102273
- const mvp = this.setupVertex( builder );
102674
+ const mvp = subBuild( this.setupVertex( builder ), 'VERTEX' );
102274
102675
 
102275
102676
  const vertexNode = this.vertexNode || mvp;
102276
102677
 
@@ -102582,7 +102983,7 @@ void main() {
102582
102983
 
102583
102984
  if ( this.positionNode !== null ) {
102584
102985
 
102585
- positionLocal.assign( namespace$1( this.positionNode, 'POSITION' ) );
102986
+ positionLocal.assign( subBuild( this.positionNode, 'POSITION', 'vec3' ) );
102586
102987
 
102587
102988
  }
102588
102989
 
@@ -102892,6 +103293,19 @@ void main() {
102892
103293
 
102893
103294
  }
102894
103295
 
103296
+ /**
103297
+ * Setups premultiplied alpha.
103298
+ *
103299
+ * @param {NodeBuilder} builder - The current node builder.
103300
+ * @param {Node<vec4>} outputNode - The existing output node.
103301
+ * @return {Node<vec4>} The output node.
103302
+ */
103303
+ setupPremultipliedAlpha( builder, outputNode ) {
103304
+
103305
+ return premultiplyAlpha( outputNode );
103306
+
103307
+ }
103308
+
102895
103309
  /**
102896
103310
  * Setups the output node.
102897
103311
  *
@@ -102909,6 +103323,14 @@ void main() {
102909
103323
 
102910
103324
  }
102911
103325
 
103326
+ // PREMULTIPLIED ALPHA
103327
+
103328
+ if ( this.premultipliedAlpha === true ) {
103329
+
103330
+ outputNode = this.setupPremultipliedAlpha( builder, outputNode );
103331
+
103332
+ }
103333
+
102912
103334
  return outputNode;
102913
103335
 
102914
103336
  }
@@ -103346,13 +103768,15 @@ void main() {
103346
103768
 
103347
103769
  // By convention, a normal packed to RGB is in sRGB color space. Convert it to working color space.
103348
103770
 
103349
- diffuseColor.assign( colorSpaceToWorking( vec4( directionToColor( transformedNormalView ), opacityNode ), SRGBColorSpace ) );
103771
+ diffuseColor.assign( colorSpaceToWorking( vec4( directionToColor( normalView ), opacityNode ), SRGBColorSpace ) );
103350
103772
 
103351
103773
  }
103352
103774
 
103353
103775
  }
103354
103776
 
103355
103777
  /**
103778
+ * TSL function for creating an equirect uv node.
103779
+ *
103356
103780
  * Can be used to compute texture coordinates for projecting an
103357
103781
  * equirectangular texture onto a mesh for using it as the scene's
103358
103782
  * background.
@@ -103361,56 +103785,19 @@ void main() {
103361
103785
  * scene.backgroundNode = texture( equirectTexture, equirectUV() );
103362
103786
  * ```
103363
103787
  *
103364
- * @augments TempNode
103365
- */
103366
- class EquirectUVNode extends TempNode {
103367
-
103368
- static get type() {
103369
-
103370
- return 'EquirectUVNode';
103371
-
103372
- }
103373
-
103374
- /**
103375
- * Constructs a new equirect uv node.
103376
- *
103377
- * @param {Node<vec3>} [dirNode=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`.
103378
- */
103379
- constructor( dirNode = positionWorldDirection ) {
103380
-
103381
- super( 'vec2' );
103382
-
103383
- /**
103384
- * A direction vector for sampling why is by default `positionWorldDirection`.
103385
- *
103386
- * @type {Node<vec3>}
103387
- */
103388
- this.dirNode = dirNode;
103389
-
103390
- }
103391
-
103392
- setup() {
103393
-
103394
- const dir = this.dirNode;
103395
-
103396
- const u = dir.z.atan( dir.x ).mul( 1 / ( Math.PI * 2 ) ).add( 0.5 );
103397
- const v = dir.y.clamp( -1, 1.0 ).asin().mul( 1 / Math.PI ).add( 0.5 );
103398
-
103399
- return vec2( u, v );
103400
-
103401
- }
103402
-
103403
- }
103404
-
103405
- /**
103406
- * TSL function for creating an equirect uv node.
103407
- *
103408
103788
  * @tsl
103409
103789
  * @function
103410
103790
  * @param {?Node<vec3>} [dirNode=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`.
103411
- * @returns {EquirectUVNode}
103791
+ * @returns {Node<vec2>}
103412
103792
  */
103413
- const equirectUV = /*@__PURE__*/ nodeProxy( EquirectUVNode ).setParameterLength( 0, 1 );
103793
+ const equirectUV = /*@__PURE__*/ Fn$1( ( [ dir = positionWorldDirection ] ) => {
103794
+
103795
+ const u = dir.z.atan( dir.x ).mul( 1 / ( Math.PI * 2 ) ).add( 0.5 );
103796
+ const v = dir.y.clamp( -1, 1.0 ).asin().mul( 1 / Math.PI ).add( 0.5 );
103797
+
103798
+ return vec2( u, v );
103799
+
103800
+ } );
103414
103801
 
103415
103802
  // @TODO: Consider rename WebGLCubeRenderTarget to just CubeRenderTarget
103416
103803
 
@@ -104038,13 +104425,13 @@ void main() {
104038
104425
 
104039
104426
  /**
104040
104427
  * Basic materials are not affected by normal and bump maps so we
104041
- * return by default {@link normalView}.
104428
+ * return by default {@link normalViewGeometry}.
104042
104429
  *
104043
104430
  * @return {Node<vec3>} The normal node.
104044
104431
  */
104045
104432
  setupNormal() {
104046
104433
 
104047
- return normalView; // see #28839
104434
+ return directionToFaceDirection( normalViewGeometry ); // see #28839
104048
104435
 
104049
104436
  }
104050
104437
 
@@ -104140,7 +104527,7 @@ void main() {
104140
104527
 
104141
104528
  const halfDir = lightDirection.add( positionViewDirection ).normalize();
104142
104529
 
104143
- const dotNH = transformedNormalView.dot( halfDir ).clamp();
104530
+ const dotNH = normalView.dot( halfDir ).clamp();
104144
104531
  const dotVH = positionViewDirection.dot( halfDir ).clamp();
104145
104532
 
104146
104533
  const F = F_Schlick( { f0: specularColor, f90: 1.0, dotVH } );
@@ -104187,7 +104574,7 @@ void main() {
104187
104574
  */
104188
104575
  direct( { lightDirection, lightColor, reflectedLight } ) {
104189
104576
 
104190
- const dotNL = transformedNormalView.dot( lightDirection ).clamp();
104577
+ const dotNL = normalView.dot( lightDirection ).clamp();
104191
104578
  const irradiance = dotNL.mul( lightColor );
104192
104579
 
104193
104580
  reflectedLight.directDiffuse.addAssign( irradiance.mul( BRDF_Lambert( { diffuseColor: diffuseColor.rgb } ) ) );
@@ -104431,7 +104818,7 @@ void main() {
104431
104818
 
104432
104819
  }
104433
104820
 
104434
- const dxy = normalView.dFdx().abs().max( normalView.dFdy().abs() );
104821
+ const dxy = normalViewGeometry.dFdx().abs().max( normalViewGeometry.dFdy().abs() );
104435
104822
  const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );
104436
104823
 
104437
104824
  return geometryRoughness;
@@ -104544,19 +104931,15 @@ void main() {
104544
104931
  } );
104545
104932
 
104546
104933
  // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
104547
- const BRDF_GGX = /*@__PURE__*/ Fn$1( ( inputs ) => {
104548
-
104549
- const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
104550
-
104551
- const normalView = inputs.normalView || transformedNormalView;
104934
+ const BRDF_GGX = /*@__PURE__*/ Fn$1( ( { lightDirection, f0, f90, roughness, f, normalView: normalView$1 = normalView, USE_IRIDESCENCE, USE_ANISOTROPY } ) => {
104552
104935
 
104553
104936
  const alpha = roughness.pow2(); // UE4's roughness
104554
104937
 
104555
104938
  const halfDir = lightDirection.add( positionViewDirection ).normalize();
104556
104939
 
104557
- const dotNL = normalView.dot( lightDirection ).clamp();
104558
- const dotNV = normalView.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
104559
- const dotNH = normalView.dot( halfDir ).clamp();
104940
+ const dotNL = normalView$1.dot( lightDirection ).clamp();
104941
+ const dotNV = normalView$1.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
104942
+ const dotNH = normalView$1.dot( halfDir ).clamp();
104560
104943
  const dotVH = positionViewDirection.dot( halfDir ).clamp();
104561
104944
 
104562
104945
  let F = F_Schlick( { f0, f90, dotVH } );
@@ -104685,9 +105068,9 @@ void main() {
104685
105068
 
104686
105069
  const halfDir = lightDirection.add( positionViewDirection ).normalize();
104687
105070
 
104688
- const dotNL = transformedNormalView.dot( lightDirection ).clamp();
104689
- const dotNV = transformedNormalView.dot( positionViewDirection ).clamp();
104690
- const dotNH = transformedNormalView.dot( halfDir ).clamp();
105071
+ const dotNL = normalView.dot( lightDirection ).clamp();
105072
+ const dotNV = normalView.dot( positionViewDirection ).clamp();
105073
+ const dotNH = normalView.dot( halfDir ).clamp();
104691
105074
 
104692
105075
  const D = D_Charlie( { roughness: sheenRoughness, dotNH } );
104693
105076
  const V = V_Neubelt( { dotNV, dotNL } );
@@ -104877,10 +105260,10 @@ void main() {
104877
105260
  * @tsl
104878
105261
  * @function
104879
105262
  * @param {TextureNode} textureNode - The texture node that should be filtered.
104880
- * @param {Node<float>} [lodNode=float(3)] - Defines the LOD to sample from.
105263
+ * @param {Node<float>} lodNode - Defines the LOD to sample from.
104881
105264
  * @return {Node} The filtered texture sample.
104882
105265
  */
104883
- const textureBicubic = /*@__PURE__*/ Fn$1( ( [ textureNode, lodNode = float$1( 3 ) ] ) => {
105266
+ const textureBicubicLevel = /*@__PURE__*/ Fn$1( ( [ textureNode, lodNode ] ) => {
104884
105267
 
104885
105268
  const fLodSize = vec2( textureNode.size( int( lodNode ) ) );
104886
105269
  const cLodSize = vec2( textureNode.size( int( lodNode.add( 1.0 ) ) ) );
@@ -104893,6 +105276,23 @@ void main() {
104893
105276
 
104894
105277
  } );
104895
105278
 
105279
+ /**
105280
+ * Applies mipped bicubic texture filtering to the given texture node.
105281
+ *
105282
+ * @tsl
105283
+ * @function
105284
+ * @param {TextureNode} textureNode - The texture node that should be filtered.
105285
+ * @param {Node<float>} [strength] - Defines the strength of the bicubic filtering.
105286
+ * @return {Node} The filtered texture sample.
105287
+ */
105288
+ const textureBicubic = /*@__PURE__*/ Fn$1( ( [ textureNode, strength ] ) => {
105289
+
105290
+ const lod = strength.mul( maxMipLevel( textureNode ) );
105291
+
105292
+ return textureBicubicLevel( textureNode, lod );
105293
+
105294
+ } );
105295
+
104896
105296
  //
104897
105297
  // Transmission
104898
105298
  //
@@ -104951,7 +105351,7 @@ void main() {
104951
105351
 
104952
105352
  const lod = log2( screenSize.x ).mul( applyIorToRoughness( roughness, ior ) );
104953
105353
 
104954
- return textureBicubic( transmissionSample, lod );
105354
+ return textureBicubicLevel( transmissionSample, lod );
104955
105355
 
104956
105356
  } );
104957
105357
 
@@ -105365,7 +105765,7 @@ void main() {
105365
105765
 
105366
105766
  if ( this.iridescence === true ) {
105367
105767
 
105368
- const dotNVi = transformedNormalView.dot( positionViewDirection ).clamp();
105768
+ const dotNVi = normalView.dot( positionViewDirection ).clamp();
105369
105769
 
105370
105770
  this.iridescenceFresnel = evalIridescence( {
105371
105771
  outsideIOR: float$1( 1.0 ),
@@ -105383,7 +105783,7 @@ void main() {
105383
105783
 
105384
105784
  const position = positionWorld;
105385
105785
  const v = cameraPosition.sub( positionWorld ).normalize(); // TODO: Create Node for this, same issue in MaterialX
105386
- const n = transformedNormalWorld;
105786
+ const n = normalWorld;
105387
105787
 
105388
105788
  const context = builder.context;
105389
105789
 
@@ -105421,7 +105821,7 @@ void main() {
105421
105821
 
105422
105822
  computeMultiscattering( singleScatter, multiScatter, specularF90 ) {
105423
105823
 
105424
- const dotNV = transformedNormalView.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
105824
+ const dotNV = normalView.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
105425
105825
 
105426
105826
  const fab = DFGApprox( { roughness, dotNV } );
105427
105827
 
@@ -105448,7 +105848,7 @@ void main() {
105448
105848
  */
105449
105849
  direct( { lightDirection, lightColor, reflectedLight } ) {
105450
105850
 
105451
- const dotNL = transformedNormalView.dot( lightDirection ).clamp();
105851
+ const dotNL = normalView.dot( lightDirection ).clamp();
105452
105852
  const irradiance = dotNL.mul( lightColor );
105453
105853
 
105454
105854
  if ( this.sheen === true ) {
@@ -105459,10 +105859,10 @@ void main() {
105459
105859
 
105460
105860
  if ( this.clearcoat === true ) {
105461
105861
 
105462
- const dotNLcc = transformedClearcoatNormalView.dot( lightDirection ).clamp();
105862
+ const dotNLcc = clearcoatNormalView.dot( lightDirection ).clamp();
105463
105863
  const ccIrradiance = dotNLcc.mul( lightColor );
105464
105864
 
105465
- this.clearcoatSpecularDirect.addAssign( ccIrradiance.mul( BRDF_GGX( { lightDirection, f0: clearcoatF0, f90: clearcoatF90, roughness: clearcoatRoughness, normalView: transformedClearcoatNormalView } ) ) );
105865
+ this.clearcoatSpecularDirect.addAssign( ccIrradiance.mul( BRDF_GGX( { lightDirection, f0: clearcoatF0, f90: clearcoatF90, roughness: clearcoatRoughness, normalView: clearcoatNormalView } ) ) );
105466
105866
 
105467
105867
  }
105468
105868
 
@@ -105486,7 +105886,7 @@ void main() {
105486
105886
  const p2 = lightPosition.sub( halfWidth ).add( halfHeight );
105487
105887
  const p3 = lightPosition.add( halfWidth ).add( halfHeight );
105488
105888
 
105489
- const N = transformedNormalView;
105889
+ const N = normalView;
105490
105890
  const V = positionViewDirection;
105491
105891
  const P = positionView.toVar();
105492
105892
 
@@ -105551,7 +105951,7 @@ void main() {
105551
105951
  this.sheenSpecularIndirect.addAssign( iblIrradiance.mul(
105552
105952
  sheen,
105553
105953
  IBLSheenBRDF( {
105554
- normal: transformedNormalView,
105954
+ normal: normalView,
105555
105955
  viewDir: positionViewDirection,
105556
105956
  roughness: sheenRoughness
105557
105957
  } )
@@ -105561,7 +105961,7 @@ void main() {
105561
105961
 
105562
105962
  if ( this.clearcoat === true ) {
105563
105963
 
105564
- const dotNVcc = transformedClearcoatNormalView.dot( positionViewDirection ).clamp();
105964
+ const dotNVcc = clearcoatNormalView.dot( positionViewDirection ).clamp();
105565
105965
 
105566
105966
  const clearcoatEnv = EnvironmentBRDF( {
105567
105967
  dotNV: dotNVcc,
@@ -105602,7 +106002,7 @@ void main() {
105602
106002
 
105603
106003
  const { ambientOcclusion, reflectedLight } = builder.context;
105604
106004
 
105605
- const dotNV = transformedNormalView.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
106005
+ const dotNV = normalView.dot( positionViewDirection ).clamp(); // @ TODO: Move to core dotNV
105606
106006
 
105607
106007
  const aoNV = dotNV.add( ambientOcclusion );
105608
106008
  const aoExp = roughness.mul( -16 ).oneMinus().negate().exp2();
@@ -105637,7 +106037,7 @@ void main() {
105637
106037
 
105638
106038
  if ( this.clearcoat === true ) {
105639
106039
 
105640
- const dotNVcc = transformedClearcoatNormalView.dot( positionViewDirection ).clamp();
106040
+ const dotNVcc = clearcoatNormalView.dot( positionViewDirection ).clamp();
105641
106041
 
105642
106042
  const Fcc = F_Schlick( {
105643
106043
  dotVH: dotNVcc,
@@ -105997,7 +106397,7 @@ void main() {
105997
106397
  0, 4, 2
105998
106398
  ];
105999
106399
 
106000
- const _direction = /*@__PURE__*/ getDirection( uv(), attribute( 'faceIndex' ) ).normalize();
106400
+ const _direction = /*@__PURE__*/ getDirection( uv$1(), attribute( 'faceIndex' ) ).normalize();
106001
106401
  const _outputDirection = /*@__PURE__*/ vec3( _direction.x, _direction.y, _direction.z );
106002
106402
 
106003
106403
  /**
@@ -107306,10 +107706,10 @@ void main() {
107306
107706
  //
107307
107707
 
107308
107708
  const useAnisotropy = material.useAnisotropy === true || material.anisotropy > 0;
107309
- const radianceNormalView = useAnisotropy ? transformedBentNormalView : transformedNormalView;
107709
+ const radianceNormalView = useAnisotropy ? bentNormalView : normalView;
107310
107710
 
107311
107711
  const radiance = envNode.context( createRadianceContext( roughness, radianceNormalView ) ).mul( materialEnvIntensity );
107312
- const irradiance = envNode.context( createIrradianceContext( transformedNormalWorld ) ).mul( Math.PI ).mul( materialEnvIntensity );
107712
+ const irradiance = envNode.context( createIrradianceContext( normalWorld ) ).mul( Math.PI ).mul( materialEnvIntensity );
107313
107713
 
107314
107714
  const isolateRadiance = cache( radiance );
107315
107715
  const isolateIrradiance = cache( irradiance );
@@ -107326,7 +107726,7 @@ void main() {
107326
107726
 
107327
107727
  if ( clearcoatRadiance ) {
107328
107728
 
107329
- const clearcoatRadianceContext = envNode.context( createRadianceContext( clearcoatRoughness, transformedClearcoatNormalView ) ).mul( materialEnvIntensity );
107729
+ const clearcoatRadianceContext = envNode.context( createRadianceContext( clearcoatRoughness, clearcoatNormalView ) ).mul( materialEnvIntensity );
107330
107730
  const isolateClearcoatRadiance = cache( clearcoatRadianceContext );
107331
107731
 
107332
107732
  clearcoatRadiance.addAssign( isolateClearcoatRadiance );
@@ -108027,7 +108427,7 @@ void main() {
108027
108427
 
108028
108428
  setup( builder ) {
108029
108429
 
108030
- builder.context.setupClearcoatNormal = () => this.setupClearcoatNormal( builder );
108430
+ builder.context.setupClearcoatNormal = () => subBuild( this.setupClearcoatNormal( builder ), 'NORMAL', 'vec3' );
108031
108431
 
108032
108432
  super.setup( builder );
108033
108433
 
@@ -108185,47 +108585,23 @@ void main() {
108185
108585
  }
108186
108586
 
108187
108587
  /**
108588
+ * TSL function for creating a matcap uv node.
108589
+ *
108188
108590
  * Can be used to compute texture coordinates for projecting a
108189
108591
  * matcap onto a mesh. Used by {@link MeshMatcapNodeMaterial}.
108190
108592
  *
108191
- * @augments TempNode
108593
+ * @tsl
108594
+ * @function
108595
+ * @returns {Node<vec2>} The matcap UV coordinates.
108192
108596
  */
108193
- class MatcapUVNode extends TempNode {
108194
-
108195
- static get type() {
108196
-
108197
- return 'MatcapUVNode';
108198
-
108199
- }
108200
-
108201
- /**
108202
- * Constructs a new matcap uv node.
108203
- */
108204
- constructor() {
108597
+ const matcapUV = /*@__PURE__*/ Fn$1( () => {
108205
108598
 
108206
- super( 'vec2' );
108207
-
108208
- }
108209
-
108210
- setup() {
108599
+ const x = vec3( positionViewDirection.z, 0, positionViewDirection.x.negate() ).normalize();
108600
+ const y = positionViewDirection.cross( x );
108211
108601
 
108212
- const x = vec3( positionViewDirection.z, 0, positionViewDirection.x.negate() ).normalize();
108213
- const y = positionViewDirection.cross( x );
108602
+ return vec2( x.dot( normalView ), y.dot( normalView ) ).mul( 0.495 ).add( 0.5 ); // 0.495 to remove artifacts caused by undersized matcap disks
108214
108603
 
108215
- return vec2( x.dot( transformedNormalView ), y.dot( transformedNormalView ) ).mul( 0.495 ).add( 0.5 ); // 0.495 to remove artifacts caused by undersized matcap disks
108216
-
108217
- }
108218
-
108219
- }
108220
-
108221
- /**
108222
- * TSL function for creating a matcap uv node.
108223
- *
108224
- * @tsl
108225
- * @function
108226
- * @returns {MatcapUVNode}
108227
- */
108228
- const matcapUV = /*@__PURE__*/ nodeImmutable( MatcapUVNode );
108604
+ } ).once( [ 'NORMAL', 'VERTEX' ] )().toVar( 'matcapUV' );
108229
108605
 
108230
108606
  const _defaultValues$3 = /*@__PURE__*/ new MeshMatcapMaterial();
108231
108607
 
@@ -109259,6 +109635,16 @@ void main() {
109259
109635
  */
109260
109636
  this.attributes = null;
109261
109637
 
109638
+ /**
109639
+ * An object holding the version of the
109640
+ * attributes. The keys are the attribute names
109641
+ * and the values are the attribute versions.
109642
+ *
109643
+ * @type {?Object<string, number>}
109644
+ * @default null
109645
+ */
109646
+ this.attributesId = null;
109647
+
109262
109648
  /**
109263
109649
  * A reference to a render pipeline the render
109264
109650
  * object is processed with.
@@ -109378,7 +109764,7 @@ void main() {
109378
109764
 
109379
109765
  /**
109380
109766
  * An event listener which is executed when `dispose()` is called on
109381
- * the render object's material.
109767
+ * the material of this render object.
109382
109768
  *
109383
109769
  * @method
109384
109770
  */
@@ -109388,7 +109774,23 @@ void main() {
109388
109774
 
109389
109775
  };
109390
109776
 
109777
+ /**
109778
+ * An event listener which is executed when `dispose()` is called on
109779
+ * the geometry of this render object.
109780
+ *
109781
+ * @method
109782
+ */
109783
+ this.onGeometryDispose = () => {
109784
+
109785
+ // clear geometry cache attributes
109786
+
109787
+ this.attributes = null;
109788
+ this.attributesId = null;
109789
+
109790
+ };
109791
+
109391
109792
  this.material.addEventListener( 'dispose', this.onMaterialDispose );
109793
+ this.geometry.addEventListener( 'dispose', this.onGeometryDispose );
109392
109794
 
109393
109795
  }
109394
109796
 
@@ -109527,6 +109929,7 @@ void main() {
109527
109929
 
109528
109930
  this.geometry = geometry;
109529
109931
  this.attributes = null;
109932
+ this.attributesId = null;
109530
109933
 
109531
109934
  }
109532
109935
 
@@ -109546,9 +109949,25 @@ void main() {
109546
109949
  const attributes = [];
109547
109950
  const vertexBuffers = new Set();
109548
109951
 
109952
+ const attributesId = {};
109953
+
109549
109954
  for ( const nodeAttribute of nodeAttributes ) {
109550
109955
 
109551
- const attribute = nodeAttribute.node && nodeAttribute.node.attribute ? nodeAttribute.node.attribute : geometry.getAttribute( nodeAttribute.name );
109956
+ let attribute;
109957
+
109958
+ if ( nodeAttribute.node && nodeAttribute.node.attribute ) {
109959
+
109960
+ // node attribute
109961
+ attribute = nodeAttribute.node.attribute;
109962
+
109963
+ } else {
109964
+
109965
+ // geometry attribute
109966
+ attribute = geometry.getAttribute( nodeAttribute.name );
109967
+
109968
+ attributesId[ nodeAttribute.name ] = attribute.version;
109969
+
109970
+ }
109552
109971
 
109553
109972
  if ( attribute === undefined ) continue;
109554
109973
 
@@ -109560,6 +109979,7 @@ void main() {
109560
109979
  }
109561
109980
 
109562
109981
  this.attributes = attributes;
109982
+ this.attributesId = attributesId;
109563
109983
  this.vertexBuffers = Array.from( vertexBuffers.values() );
109564
109984
 
109565
109985
  return attributes;
@@ -109824,7 +110244,27 @@ void main() {
109824
110244
  */
109825
110245
  get needsGeometryUpdate() {
109826
110246
 
109827
- return this.geometry.id !== this.object.geometry.id;
110247
+ if ( this.geometry.id !== this.object.geometry.id ) return true;
110248
+
110249
+ if ( this.attributes !== null ) {
110250
+
110251
+ const attributesId = this.attributesId;
110252
+
110253
+ for ( const name in attributesId ) {
110254
+
110255
+ const attribute = this.geometry.getAttribute( name );
110256
+
110257
+ if ( attribute === undefined || attributesId[ name ] !== attribute.id ) {
110258
+
110259
+ return true;
110260
+
110261
+ }
110262
+
110263
+ }
110264
+
110265
+ }
110266
+
110267
+ return false;
109828
110268
 
109829
110269
  }
109830
110270
 
@@ -109902,6 +110342,7 @@ void main() {
109902
110342
  dispose() {
109903
110343
 
109904
110344
  this.material.removeEventListener( 'dispose', this.onMaterialDispose );
110345
+ this.geometry.removeEventListener( 'dispose', this.onGeometryDispose );
109905
110346
 
109906
110347
  this.onDispose();
109907
110348
 
@@ -113456,10 +113897,13 @@ void main() {
113456
113897
 
113457
113898
  build( builder, ...params ) {
113458
113899
 
113900
+ const previousBuildStack = builder.currentStack;
113459
113901
  const previousStack = getCurrentStack();
113460
113902
 
113461
113903
  setCurrentStack( this );
113462
113904
 
113905
+ builder.currentStack = this;
113906
+
113463
113907
  const buildStage = builder.buildStage;
113464
113908
 
113465
113909
  for ( const node of this.nodes ) {
@@ -113489,38 +113933,13 @@ void main() {
113489
113933
 
113490
113934
  }
113491
113935
 
113492
- setCurrentStack( previousStack );
113493
-
113494
- return this.outputNode ? this.outputNode.build( builder, ...params ) : super.build( builder, ...params );
113495
-
113496
- }
113497
-
113498
- // Deprecated
113499
-
113500
- /**
113501
- * @function
113502
- * @deprecated since r168. Use {@link StackNode#Else} instead.
113503
- *
113504
- * @param {...any} params
113505
- * @returns {StackNode}
113506
- */
113507
- else( ...params ) { // @deprecated, r168
113508
-
113509
- console.warn( 'THREE.TSL: .else() has been renamed to .Else().' );
113510
- return this.Else( ...params );
113936
+ const result = this.outputNode ? this.outputNode.build( builder, ...params ) : super.build( builder, ...params );
113511
113937
 
113512
- }
113938
+ setCurrentStack( previousStack );
113513
113939
 
113514
- /**
113515
- * @deprecated since r168. Use {@link StackNode#ElseIf} instead.
113516
- *
113517
- * @param {...any} params
113518
- * @returns {StackNode}
113519
- */
113520
- elseif( ...params ) { // @deprecated, r168
113940
+ builder.currentStack = previousBuildStack;
113521
113941
 
113522
- console.warn( 'THREE.TSL: .elseif() has been renamed to .ElseIf().' );
113523
- return this.ElseIf( ...params );
113942
+ return result;
113524
113943
 
113525
113944
  }
113526
113945
 
@@ -114589,7 +115008,7 @@ void main() {
114589
115008
  * @param {Node<vec2>} [uvNode=uv()] - The uv node.
114590
115009
  * @param {Node<float>} [frameNode=float()] - The node that defines the current frame/sprite.
114591
115010
  */
114592
- constructor( countNode, uvNode = uv(), frameNode = float$1( 0 ) ) {
115011
+ constructor( countNode, uvNode = uv$1(), frameNode = float$1( 0 ) ) {
114593
115012
 
114594
115013
  super( 'vec2' );
114595
115014
 
@@ -114649,118 +115068,14 @@ void main() {
114649
115068
  const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode ).setParameterLength( 3 );
114650
115069
 
114651
115070
  /**
115071
+ * TSL function for creating a triplanar textures node.
115072
+ *
114652
115073
  * Can be used for triplanar texture mapping.
114653
115074
  *
114654
115075
  * ```js
114655
115076
  * material.colorNode = triplanarTexture( texture( diffuseMap ) );
114656
115077
  * ```
114657
115078
  *
114658
- * @augments Node
114659
- */
114660
- class TriplanarTexturesNode extends Node {
114661
-
114662
- static get type() {
114663
-
114664
- return 'TriplanarTexturesNode';
114665
-
114666
- }
114667
-
114668
- /**
114669
- * Constructs a new triplanar textures node.
114670
- *
114671
- * @param {Node} textureXNode - First texture node.
114672
- * @param {?Node} [textureYNode=null] - Second texture node. When not set, the shader will sample from `textureXNode` instead.
114673
- * @param {?Node} [textureZNode=null] - Third texture node. When not set, the shader will sample from `textureXNode` instead.
114674
- * @param {?Node<float>} [scaleNode=float(1)] - The scale node.
114675
- * @param {?Node<vec3>} [positionNode=positionLocal] - Vertex positions in local space.
114676
- * @param {?Node<vec3>} [normalNode=normalLocal] - Normals in local space.
114677
- */
114678
- constructor( textureXNode, textureYNode = null, textureZNode = null, scaleNode = float$1( 1 ), positionNode = positionLocal, normalNode = normalLocal ) {
114679
-
114680
- super( 'vec4' );
114681
-
114682
- /**
114683
- * First texture node.
114684
- *
114685
- * @type {Node}
114686
- */
114687
- this.textureXNode = textureXNode;
114688
-
114689
- /**
114690
- * Second texture node. When not set, the shader will sample from `textureXNode` instead.
114691
- *
114692
- * @type {?Node}
114693
- * @default null
114694
- */
114695
- this.textureYNode = textureYNode;
114696
-
114697
- /**
114698
- * Third texture node. When not set, the shader will sample from `textureXNode` instead.
114699
- *
114700
- * @type {?Node}
114701
- * @default null
114702
- */
114703
- this.textureZNode = textureZNode;
114704
-
114705
- /**
114706
- * The scale node.
114707
- *
114708
- * @type {Node<float>}
114709
- * @default float(1)
114710
- */
114711
- this.scaleNode = scaleNode;
114712
-
114713
- /**
114714
- * Vertex positions in local space.
114715
- *
114716
- * @type {Node<vec3>}
114717
- * @default positionLocal
114718
- */
114719
- this.positionNode = positionNode;
114720
-
114721
- /**
114722
- * Normals in local space.
114723
- *
114724
- * @type {Node<vec3>}
114725
- * @default normalLocal
114726
- */
114727
- this.normalNode = normalNode;
114728
-
114729
- }
114730
-
114731
- setup() {
114732
-
114733
- const { textureXNode, textureYNode, textureZNode, scaleNode, positionNode, normalNode } = this;
114734
-
114735
- // Ref: https://github.com/keijiro/StandardTriplanar
114736
-
114737
- // Blending factor of triplanar mapping
114738
- let bf = normalNode.abs().normalize();
114739
- bf = bf.div( bf.dot( vec3( 1.0 ) ) );
114740
-
114741
- // Triplanar mapping
114742
- const tx = positionNode.yz.mul( scaleNode );
114743
- const ty = positionNode.zx.mul( scaleNode );
114744
- const tz = positionNode.xy.mul( scaleNode );
114745
-
114746
- // Base color
114747
- const textureX = textureXNode.value;
114748
- const textureY = textureYNode !== null ? textureYNode.value : textureX;
114749
- const textureZ = textureZNode !== null ? textureZNode.value : textureX;
114750
-
114751
- const cx = texture( textureX, tx ).mul( bf.x );
114752
- const cy = texture( textureY, ty ).mul( bf.y );
114753
- const cz = texture( textureZ, tz ).mul( bf.z );
114754
-
114755
- return add( cx, cy, cz );
114756
-
114757
- }
114758
-
114759
- }
114760
-
114761
- /**
114762
- * TSL function for creating a triplanar textures node.
114763
- *
114764
115079
  * @tsl
114765
115080
  * @function
114766
115081
  * @param {Node} textureXNode - First texture node.
@@ -114769,9 +115084,33 @@ void main() {
114769
115084
  * @param {?Node<float>} [scaleNode=float(1)] - The scale node.
114770
115085
  * @param {?Node<vec3>} [positionNode=positionLocal] - Vertex positions in local space.
114771
115086
  * @param {?Node<vec3>} [normalNode=normalLocal] - Normals in local space.
114772
- * @returns {TriplanarTexturesNode}
115087
+ * @returns {Node<vec4>}
114773
115088
  */
114774
- const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode ).setParameterLength( 1, 6 );
115089
+ const triplanarTextures = /*@__PURE__*/ Fn$1( ( [ textureXNode, textureYNode = null, textureZNode = null, scaleNode = float$1( 1 ), positionNode = positionLocal, normalNode = normalLocal ] ) => {
115090
+
115091
+ // Reference: https://github.com/keijiro/StandardTriplanar
115092
+
115093
+ // Blending factor of triplanar mapping
115094
+ let bf = normalNode.abs().normalize();
115095
+ bf = bf.div( bf.dot( vec3( 1.0 ) ) );
115096
+
115097
+ // Triplanar mapping
115098
+ const tx = positionNode.yz.mul( scaleNode );
115099
+ const ty = positionNode.zx.mul( scaleNode );
115100
+ const tz = positionNode.xy.mul( scaleNode );
115101
+
115102
+ // Base color
115103
+ const textureX = textureXNode.value;
115104
+ const textureY = textureYNode !== null ? textureYNode.value : textureX;
115105
+ const textureZ = textureZNode !== null ? textureZNode.value : textureX;
115106
+
115107
+ const cx = texture( textureX, tx ).mul( bf.x );
115108
+ const cy = texture( textureY, ty ).mul( bf.y );
115109
+ const cz = texture( textureZ, tz ).mul( bf.z );
115110
+
115111
+ return add( cx, cy, cz );
115112
+
115113
+ } );
114775
115114
 
114776
115115
  /**
114777
115116
  * TSL function for creating a triplanar textures node.
@@ -114784,7 +115123,7 @@ void main() {
114784
115123
  * @param {?Node<float>} [scaleNode=float(1)] - The scale node.
114785
115124
  * @param {?Node<vec3>} [positionNode=positionLocal] - Vertex positions in local space.
114786
115125
  * @param {?Node<vec3>} [normalNode=normalLocal] - Normals in local space.
114787
- * @returns {TriplanarTexturesNode}
115126
+ * @returns {Node<vec4>}
114788
115127
  */
114789
115128
  const triplanarTexture = ( ...params ) => triplanarTextures( ...params );
114790
115129
 
@@ -114928,10 +115267,17 @@ void main() {
114928
115267
 
114929
115268
  clone() {
114930
115269
 
114931
- const texture = new this.constructor( this.reflectorNode );
114932
- texture._reflectorBaseNode = this._reflectorBaseNode;
115270
+ const newNode = new this.constructor( this.reflectorNode );
115271
+ newNode.uvNode = this.uvNode;
115272
+ newNode.levelNode = this.levelNode;
115273
+ newNode.biasNode = this.biasNode;
115274
+ newNode.sampler = this.sampler;
115275
+ newNode.depthNode = this.depthNode;
115276
+ newNode.compareNode = this.compareNode;
115277
+ newNode.gradNode = this.gradNode;
115278
+ newNode._reflectorBaseNode = this._reflectorBaseNode;
114933
115279
 
114934
- return texture;
115280
+ return newNode;
114935
115281
 
114936
115282
  }
114937
115283
 
@@ -115473,7 +115819,7 @@ void main() {
115473
115819
 
115474
115820
  const renderTarget = new RenderTarget( width, height, options );
115475
115821
 
115476
- super( renderTarget.texture, uv() );
115822
+ super( renderTarget.texture, uv$1() );
115477
115823
 
115478
115824
  /**
115479
115825
  * The node to render a texture with.
@@ -115565,7 +115911,7 @@ void main() {
115565
115911
  * @readonly
115566
115912
  * @default true
115567
115913
  */
115568
- get autoSize() {
115914
+ get autoResize() {
115569
115915
 
115570
115916
  return this.width === null;
115571
115917
 
@@ -115622,13 +115968,21 @@ void main() {
115622
115968
 
115623
115969
  //
115624
115970
 
115625
- if ( this.autoSize === true ) {
115626
-
115627
- this.pixelRatio = renderer.getPixelRatio();
115971
+ if ( this.autoResize === true ) {
115628
115972
 
115973
+ const pixelRatio = renderer.getPixelRatio();
115629
115974
  const size = renderer.getSize( _size$1 );
115630
115975
 
115631
- this.setSize( size.width, size.height );
115976
+ const effectiveWidth = size.width * pixelRatio;
115977
+ const effectiveHeight = size.height * pixelRatio;
115978
+
115979
+ if ( effectiveWidth !== this.renderTarget.width || effectiveHeight !== this.renderTarget.height ) {
115980
+
115981
+ this.renderTarget.setSize( effectiveWidth, effectiveHeight );
115982
+
115983
+ this.textureNeedsUpdate = true;
115984
+
115985
+ }
115632
115986
 
115633
115987
  }
115634
115988
 
@@ -115784,6 +116138,82 @@ void main() {
115784
116138
 
115785
116139
  } );
115786
116140
 
116141
+ /**
116142
+ * Class representing a node that samples a value using a provided callback function.
116143
+ *
116144
+ * @extends Node
116145
+ */
116146
+ class SampleNode extends Node {
116147
+
116148
+ /**
116149
+ * Returns the type of the node.
116150
+ *
116151
+ * @type {string}
116152
+ * @readonly
116153
+ * @static
116154
+ */
116155
+ static get type() {
116156
+
116157
+ return 'SampleNode';
116158
+
116159
+ }
116160
+
116161
+ /**
116162
+ * Creates an instance of SampleNode.
116163
+ *
116164
+ * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value.
116165
+ */
116166
+ constructor( callback ) {
116167
+
116168
+ super();
116169
+
116170
+ this.callback = callback;
116171
+
116172
+ /**
116173
+ * This flag can be used for type testing.
116174
+ *
116175
+ * @type {boolean}
116176
+ * @readonly
116177
+ * @default true
116178
+ */
116179
+ this.isSampleNode = true;
116180
+
116181
+ }
116182
+
116183
+ /**
116184
+ * Sets up the node by sampling with the default UV accessor.
116185
+ *
116186
+ * @returns {Node} The result of the callback function when called with the UV node.
116187
+ */
116188
+ setup() {
116189
+
116190
+ return this.sample( uv$1() );
116191
+
116192
+ }
116193
+
116194
+ /**
116195
+ * Calls the callback function with the provided UV node.
116196
+ *
116197
+ * @param {Node<vec2>} uv - The UV node or value to be passed to the callback.
116198
+ * @returns {Node} The result of the callback function.
116199
+ */
116200
+ sample( uv ) {
116201
+
116202
+ return this.callback( uv );
116203
+
116204
+ }
116205
+
116206
+ }
116207
+
116208
+ /**
116209
+ * Helper function to create a SampleNode wrapped as a node object.
116210
+ *
116211
+ * @function
116212
+ * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value.
116213
+ * @returns {SampleNode} The created SampleNode instance wrapped as a node object.
116214
+ */
116215
+ const sample = ( callback ) => nodeObject( new SampleNode( callback ) );
116216
+
115787
116217
  /**
115788
116218
  * This special type of instanced buffer attribute is intended for compute shaders.
115789
116219
  * In earlier three.js versions it was only possible to update attribute data
@@ -116391,9 +116821,9 @@ void main() {
116391
116821
 
116392
116822
  const step = 0.01;
116393
116823
 
116394
- const x = texture.sample( uv.add( vec3( -0.01, 0.0, 0.0 ) ) ).r.sub( texture.sample( uv.add( vec3( step, 0.0, 0.0 ) ) ).r );
116395
- const y = texture.sample( uv.add( vec3( 0.0, -0.01, 0.0 ) ) ).r.sub( texture.sample( uv.add( vec3( 0.0, step, 0.0 ) ) ).r );
116396
- const z = texture.sample( uv.add( vec3( 0.0, 0.0, -0.01 ) ) ).r.sub( texture.sample( uv.add( vec3( 0.0, 0.0, step ) ) ).r );
116824
+ const x = texture.sample( uv.add( vec3( - step, 0.0, 0.0 ) ) ).r.sub( texture.sample( uv.add( vec3( step, 0.0, 0.0 ) ) ).r );
116825
+ const y = texture.sample( uv.add( vec3( 0.0, - step, 0.0 ) ) ).r.sub( texture.sample( uv.add( vec3( 0.0, step, 0.0 ) ) ).r );
116826
+ const z = texture.sample( uv.add( vec3( 0.0, 0.0, - step ) ) ).r.sub( texture.sample( uv.add( vec3( 0.0, 0.0, step ) ) ).r );
116397
116827
 
116398
116828
  ret.assign( vec3( x, y, z ) );
116399
116829
 
@@ -116823,238 +117253,6 @@ void main() {
116823
117253
  */
116824
117254
  const velocity = /*@__PURE__*/ nodeImmutable( VelocityNode );
116825
117255
 
116826
- /**
116827
- * Represents a "Color Burn" blend mode.
116828
- *
116829
- * It's designed to darken the base layer's colors based on the color of the blend layer.
116830
- * It significantly increases the contrast of the base layer, making the colors more vibrant and saturated.
116831
- * The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer.
116832
- *
116833
- * @tsl
116834
- * @function
116835
- * @param {Node<vec3>} base - The base color.
116836
- * @param {Node<vec3>} blend - The blend color. A white (#ffffff) blend color does not alter the base color.
116837
- * @return {Node<vec3>} The result.
116838
- */
116839
- const blendBurn = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
116840
-
116841
- return min$1( 1.0, base.oneMinus().div( blend ) ).oneMinus();
116842
-
116843
- } ).setLayout( {
116844
- name: 'blendBurn',
116845
- type: 'vec3',
116846
- inputs: [
116847
- { name: 'base', type: 'vec3' },
116848
- { name: 'blend', type: 'vec3' }
116849
- ]
116850
- } );
116851
-
116852
- /**
116853
- * Represents a "Color Dodge" blend mode.
116854
- *
116855
- * It's designed to lighten the base layer's colors based on the color of the blend layer.
116856
- * It significantly increases the brightness of the base layer, making the colors lighter and more vibrant.
116857
- * The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer.
116858
- *
116859
- * @tsl
116860
- * @function
116861
- * @param {Node<vec3>} base - The base color.
116862
- * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
116863
- * @return {Node<vec3>} The result.
116864
- */
116865
- const blendDodge = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
116866
-
116867
- return min$1( base.div( blend.oneMinus() ), 1.0 );
116868
-
116869
- } ).setLayout( {
116870
- name: 'blendDodge',
116871
- type: 'vec3',
116872
- inputs: [
116873
- { name: 'base', type: 'vec3' },
116874
- { name: 'blend', type: 'vec3' }
116875
- ]
116876
- } );
116877
-
116878
- /**
116879
- * Represents a "Screen" blend mode.
116880
- *
116881
- * Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer.
116882
- * The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced
116883
- * effects.
116884
- *
116885
- * @tsl
116886
- * @function
116887
- * @param {Node<vec3>} base - The base color.
116888
- * @param {Node<vec3>} blend - The blend color. A black (#000000) blend color does not alter the base color.
116889
- * @return {Node<vec3>} The result.
116890
- */
116891
- const blendScreen = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
116892
-
116893
- return base.oneMinus().mul( blend.oneMinus() ).oneMinus();
116894
-
116895
- } ).setLayout( {
116896
- name: 'blendScreen',
116897
- type: 'vec3',
116898
- inputs: [
116899
- { name: 'base', type: 'vec3' },
116900
- { name: 'blend', type: 'vec3' }
116901
- ]
116902
- } );
116903
-
116904
- /**
116905
- * Represents a "Overlay" blend mode.
116906
- *
116907
- * It's designed to increase the contrast of the base layer based on the color of the blend layer.
116908
- * It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker.
116909
- * The color of the blend layer significantly influences the resulting contrast and color shift in the base layer.
116910
- *
116911
- * @tsl
116912
- * @function
116913
- * @param {Node<vec3>} base - The base color.
116914
- * @param {Node<vec3>} blend - The blend color
116915
- * @return {Node<vec3>} The result.
116916
- */
116917
- const blendOverlay = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
116918
-
116919
- return mix$2( base.mul( 2.0 ).mul( blend ), base.oneMinus().mul( 2.0 ).mul( blend.oneMinus() ).oneMinus(), step( 0.5, base ) );
116920
-
116921
- } ).setLayout( {
116922
- name: 'blendOverlay',
116923
- type: 'vec3',
116924
- inputs: [
116925
- { name: 'base', type: 'vec3' },
116926
- { name: 'blend', type: 'vec3' }
116927
- ]
116928
- } );
116929
-
116930
- /**
116931
- * This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`.
116932
- * It assumes both input colors have non-premultiplied alpha.
116933
- *
116934
- * @tsl
116935
- * @function
116936
- * @param {Node<vec4>} base - The base color.
116937
- * @param {Node<vec4>} blend - The blend color
116938
- * @return {Node<vec4>} The result.
116939
- */
116940
- const blendColor = /*@__PURE__*/ Fn$1( ( [ base, blend ] ) => {
116941
-
116942
- const outAlpha = blend.a.add( base.a.mul( blend.a.oneMinus() ) );
116943
-
116944
- return vec4( blend.rgb.mul( blend.a ).add( base.rgb.mul( base.a ).mul( blend.a.oneMinus() ) ).div( outAlpha ), outAlpha );
116945
-
116946
- } ).setLayout( {
116947
- name: 'blendColor',
116948
- type: 'vec4',
116949
- inputs: [
116950
- { name: 'base', type: 'vec4' },
116951
- { name: 'blend', type: 'vec4' }
116952
- ]
116953
- } );
116954
-
116955
- /**
116956
- * Premultiplies the RGB channels of a color by its alpha channel.
116957
- *
116958
- * This function is useful for converting a non-premultiplied alpha color
116959
- * into a premultiplied alpha format, where the RGB values are scaled
116960
- * by the alpha value. Premultiplied alpha is often used in graphics
116961
- * rendering for certain operations, such as compositing and image processing.
116962
- *
116963
- * @tsl
116964
- * @function
116965
- * @param {Node<vec4>} color - The input color with non-premultiplied alpha.
116966
- * @return {Node<vec4>} The color with premultiplied alpha.
116967
- */
116968
- const premult = /*@__PURE__*/ Fn$1( ( [ color ] ) => {
116969
-
116970
- return vec4( color.rgb.mul( color.a ), color.a );
116971
-
116972
- }, { color: 'vec4', return: 'vec4' } );
116973
-
116974
- /**
116975
- * Unpremultiplies the RGB channels of a color by its alpha channel.
116976
- *
116977
- * This function is useful for converting a premultiplied alpha color
116978
- * back into a non-premultiplied alpha format, where the RGB values are
116979
- * divided by the alpha value. Unpremultiplied alpha is often used in graphics
116980
- * rendering for certain operations, such as compositing and image processing.
116981
- *
116982
- * @tsl
116983
- * @function
116984
- * @param {Node<vec4>} color - The input color with premultiplied alpha.
116985
- * @return {Node<vec4>} The color with non-premultiplied alpha.
116986
- */
116987
- const unpremult = /*@__PURE__*/ Fn$1( ( [ color ] ) => {
116988
-
116989
- If$1( color.a.equal( 0.0 ), () => vec4( 0.0 ) );
116990
-
116991
- return vec4( color.rgb.div( color.a ), color.a );
116992
-
116993
- }, { color: 'vec4', return: 'vec4' } );
116994
-
116995
-
116996
- // Deprecated
116997
-
116998
- /**
116999
- * @tsl
117000
- * @function
117001
- * @deprecated since r171. Use {@link blendBurn} instead.
117002
- *
117003
- * @param {...any} params
117004
- * @returns {Function}
117005
- */
117006
- const burn = ( ...params ) => { // @deprecated, r171
117007
-
117008
- console.warn( 'THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.' );
117009
- return blendBurn( params );
117010
-
117011
- };
117012
-
117013
- /**
117014
- * @tsl
117015
- * @function
117016
- * @deprecated since r171. Use {@link blendDodge} instead.
117017
- *
117018
- * @param {...any} params
117019
- * @returns {Function}
117020
- */
117021
- const dodge = ( ...params ) => { // @deprecated, r171
117022
-
117023
- console.warn( 'THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.' );
117024
- return blendDodge( params );
117025
-
117026
- };
117027
-
117028
- /**
117029
- * @tsl
117030
- * @function
117031
- * @deprecated since r171. Use {@link blendScreen} instead.
117032
- *
117033
- * @param {...any} params
117034
- * @returns {Function}
117035
- */
117036
- const screen = ( ...params ) => { // @deprecated, r171
117037
-
117038
- console.warn( 'THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.' );
117039
- return blendScreen( params );
117040
-
117041
- };
117042
-
117043
- /**
117044
- * @tsl
117045
- * @function
117046
- * @deprecated since r171. Use {@link blendOverlay} instead.
117047
- *
117048
- * @param {...any} params
117049
- * @returns {Function}
117050
- */
117051
- const overlay = ( ...params ) => { // @deprecated, r171
117052
-
117053
- console.warn( 'THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.' );
117054
- return blendOverlay( params );
117055
-
117056
- };
117057
-
117058
117256
  /**
117059
117257
  * Computes a grayscale value for the given RGB color value.
117060
117258
  *
@@ -117367,7 +117565,16 @@ void main() {
117367
117565
 
117368
117566
  clone() {
117369
117567
 
117370
- return new this.constructor( this.passNode, this.textureName, this.previousTexture );
117568
+ const newNode = new this.constructor( this.passNode, this.textureName, this.previousTexture );
117569
+ newNode.uvNode = this.uvNode;
117570
+ newNode.levelNode = this.levelNode;
117571
+ newNode.biasNode = this.biasNode;
117572
+ newNode.sampler = this.sampler;
117573
+ newNode.depthNode = this.depthNode;
117574
+ newNode.compareNode = this.compareNode;
117575
+ newNode.gradNode = this.gradNode;
117576
+
117577
+ return newNode;
117371
117578
 
117372
117579
  }
117373
117580
 
@@ -117827,13 +118034,6 @@ void main() {
117827
118034
 
117828
118035
  this.renderTarget.samples = this.options.samples === undefined ? renderer.samples : this.options.samples;
117829
118036
 
117830
- // TODO: Disable MSAA for WebGL backend for now
117831
- if ( renderer.backend.isWebGLBackend === true ) {
117832
-
117833
- this.renderTarget.samples = 0;
117834
-
117835
- }
117836
-
117837
118037
  this.renderTarget.texture.type = renderer.getColorBufferType();
117838
118038
 
117839
118039
  return this.scope === PassNode.COLOR ? this.getTextureNode() : this.getLinearDepthNode();
@@ -120926,21 +121126,21 @@ void main() {
120926
121126
  *
120927
121127
  * @type {Node<vec3>}
120928
121128
  */
120929
- this.totalDiffuseNode = vec3().toVar();
121129
+ this.totalDiffuseNode = property( 'vec3', 'totalDiffuse' );
120930
121130
 
120931
121131
  /**
120932
121132
  * A node representing the total specular light.
120933
121133
  *
120934
121134
  * @type {Node<vec3>}
120935
121135
  */
120936
- this.totalSpecularNode = vec3().toVar();
121136
+ this.totalSpecularNode = property( 'vec3', 'totalSpecular' );
120937
121137
 
120938
121138
  /**
120939
121139
  * A node representing the outgoing light.
120940
121140
  *
120941
121141
  * @type {Node<vec3>}
120942
121142
  */
120943
- this.outgoingLightNode = vec3().toVar();
121143
+ this.outgoingLightNode = property( 'vec3', 'outgoingLight' );
120944
121144
 
120945
121145
  /**
120946
121146
  * An array representing the lights in the scene.
@@ -122298,7 +122498,7 @@ void main() {
122298
122498
  const shadowIntensity = reference( 'intensity', 'float', shadow ).setGroup( renderGroup );
122299
122499
  const normalBias = reference( 'normalBias', 'float', shadow ).setGroup( renderGroup );
122300
122500
 
122301
- const shadowPosition = lightShadowMatrix( light ).mul( shadowPositionWorld.add( transformedNormalWorld.mul( normalBias ) ) );
122501
+ const shadowPosition = lightShadowMatrix( light ).mul( shadowPositionWorld.add( normalWorld.mul( normalBias ) ) );
122302
122502
  const shadowCoord = this.setupShadowCoord( builder, shadowPosition );
122303
122503
 
122304
122504
  //
@@ -123219,7 +123419,7 @@ void main() {
123219
123419
  * @param {Node<vec2>} coord - The uv coordinates.
123220
123420
  * @return {Node<float>} The result data.
123221
123421
  */
123222
- const checker = /*@__PURE__*/ Fn$1( ( [ coord = uv() ] ) => {
123422
+ const checker = /*@__PURE__*/ Fn$1( ( [ coord = uv$1() ] ) => {
123223
123423
 
123224
123424
  const uv = coord.mul( 2.0 );
123225
123425
 
@@ -123239,7 +123439,7 @@ void main() {
123239
123439
  * @param {Node<vec2>} coord - The uv to generate the circle.
123240
123440
  * @return {Node<float>} The circle shape.
123241
123441
  */
123242
- const shapeCircle = Fn$1( ( [ coord = uv() ], { renderer, material } ) => {
123442
+ const shapeCircle = Fn$1( ( [ coord = uv$1() ], { renderer, material } ) => {
123243
123443
 
123244
123444
  const len2 = lengthSq( coord.mul( 2 ).sub( 1 ) );
123245
123445
 
@@ -124741,14 +124941,14 @@ void main() {
124741
124941
  };
124742
124942
 
124743
124943
  const _ramp = ( a, b, uv, p ) => mix$2( a, b, uv[ p ].clamp() );
124744
- const mx_ramplr = ( valuel, valuer, texcoord = uv() ) => _ramp( valuel, valuer, texcoord, 'x' );
124745
- const mx_ramptb = ( valuet, valueb, texcoord = uv() ) => _ramp( valuet, valueb, texcoord, 'y' );
124944
+ const mx_ramplr = ( valuel, valuer, texcoord = uv$1() ) => _ramp( valuel, valuer, texcoord, 'x' );
124945
+ const mx_ramptb = ( valuet, valueb, texcoord = uv$1() ) => _ramp( valuet, valueb, texcoord, 'y' );
124746
124946
 
124747
124947
  const _split = ( a, b, center, uv, p ) => mix$2( a, b, mx_aastep( center, uv[ p ] ) );
124748
- const mx_splitlr = ( valuel, valuer, center, texcoord = uv() ) => _split( valuel, valuer, center, texcoord, 'x' );
124749
- const mx_splittb = ( valuet, valueb, center, texcoord = uv() ) => _split( valuet, valueb, center, texcoord, 'y' );
124948
+ const mx_splitlr = ( valuel, valuer, center, texcoord = uv$1() ) => _split( valuel, valuer, center, texcoord, 'x' );
124949
+ const mx_splittb = ( valuet, valueb, center, texcoord = uv$1() ) => _split( valuet, valueb, center, texcoord, 'y' );
124750
124950
 
124751
- const mx_transform_uv = ( uv_scale = 1, uv_offset = 0, uv_geo = uv() ) => uv_geo.mul( uv_scale ).add( uv_offset );
124951
+ const mx_transform_uv = ( uv_scale = 1, uv_offset = 0, uv_geo = uv$1() ) => uv_geo.mul( uv_scale ).add( uv_offset );
124752
124952
 
124753
124953
  const mx_safepower = ( in1, in2 = 1 ) => {
124754
124954
 
@@ -124760,10 +124960,10 @@ void main() {
124760
124960
 
124761
124961
  const mx_contrast = ( input, amount = 1, pivot = .5 ) => float$1( input ).sub( pivot ).mul( amount ).add( pivot );
124762
124962
 
124763
- const mx_noise_float = ( texcoord = uv(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_float( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );
124963
+ const mx_noise_float = ( texcoord = uv$1(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_float( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );
124764
124964
  //export const mx_noise_vec2 = ( texcoord = uv(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_vec3( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );
124765
- const mx_noise_vec3 = ( texcoord = uv(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_vec3( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );
124766
- const mx_noise_vec4 = ( texcoord = uv(), amplitude = 1, pivot = 0 ) => {
124965
+ const mx_noise_vec3 = ( texcoord = uv$1(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_vec3( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );
124966
+ const mx_noise_vec4 = ( texcoord = uv$1(), amplitude = 1, pivot = 0 ) => {
124767
124967
 
124768
124968
  texcoord = texcoord.convert( 'vec2|vec3' ); // overloading type
124769
124969
 
@@ -124773,16 +124973,16 @@ void main() {
124773
124973
 
124774
124974
  };
124775
124975
 
124776
- const mx_worley_noise_float = ( texcoord = uv(), jitter = 1 ) => mx_worley_noise_float$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124777
- const mx_worley_noise_vec2 = ( texcoord = uv(), jitter = 1 ) => mx_worley_noise_vec2$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124778
- const mx_worley_noise_vec3 = ( texcoord = uv(), jitter = 1 ) => mx_worley_noise_vec3$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124976
+ const mx_worley_noise_float = ( texcoord = uv$1(), jitter = 1 ) => mx_worley_noise_float$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124977
+ const mx_worley_noise_vec2 = ( texcoord = uv$1(), jitter = 1 ) => mx_worley_noise_vec2$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124978
+ const mx_worley_noise_vec3 = ( texcoord = uv$1(), jitter = 1 ) => mx_worley_noise_vec3$1( texcoord.convert( 'vec2|vec3' ), jitter, int( 1 ) );
124779
124979
 
124780
- const mx_cell_noise_float = ( texcoord = uv() ) => mx_cell_noise_float$1( texcoord.convert( 'vec2|vec3' ) );
124980
+ const mx_cell_noise_float = ( texcoord = uv$1() ) => mx_cell_noise_float$1( texcoord.convert( 'vec2|vec3' ) );
124781
124981
 
124782
- const mx_fractal_noise_float = ( position = uv(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_float$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124783
- const mx_fractal_noise_vec2 = ( position = uv(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec2$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124784
- const mx_fractal_noise_vec3 = ( position = uv(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec3$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124785
- const mx_fractal_noise_vec4 = ( position = uv(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec4$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124982
+ const mx_fractal_noise_float = ( position = uv$1(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_float$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124983
+ const mx_fractal_noise_vec2 = ( position = uv$1(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec2$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124984
+ const mx_fractal_noise_vec3 = ( position = uv$1(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec3$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124985
+ const mx_fractal_noise_vec4 = ( position = uv$1(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => mx_fractal_noise_vec4$1( position, int( octaves ), lacunarity, diminish ).mul( amplitude );
124786
124986
 
124787
124987
  /**
124788
124988
  * This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM).
@@ -124920,6 +125120,7 @@ void main() {
124920
125120
  backgroundIntensity: backgroundIntensity,
124921
125121
  backgroundRotation: backgroundRotation,
124922
125122
  batch: batch,
125123
+ bentNormalView: bentNormalView,
124923
125124
  billboarding: billboarding,
124924
125125
  bitAnd: bitAnd,
124925
125126
  bitNot: bitNot,
@@ -124963,6 +125164,7 @@ void main() {
124963
125164
  cineonToneMapping: cineonToneMapping,
124964
125165
  clamp: clamp,
124965
125166
  clearcoat: clearcoat,
125167
+ clearcoatNormalView: clearcoatNormalView,
124966
125168
  clearcoatRoughness: clearcoatRoughness,
124967
125169
  code: code,
124968
125170
  color: color,
@@ -124970,7 +125172,6 @@ void main() {
124970
125172
  colorToDirection: colorToDirection,
124971
125173
  compute: compute,
124972
125174
  computeSkinning: computeSkinning,
124973
- cond: cond,
124974
125175
  context: context,
124975
125176
  convert: convert,
124976
125177
  convertColorSpace: convertColorSpace,
@@ -124999,6 +125200,7 @@ void main() {
124999
125200
  diffuseColor: diffuseColor,
125000
125201
  directPointLight: directPointLight,
125001
125202
  directionToColor: directionToColor,
125203
+ directionToFaceDirection: directionToFaceDirection,
125002
125204
  dispersion: dispersion,
125003
125205
  distance: distance,
125004
125206
  div: div,
@@ -125091,7 +125293,6 @@ void main() {
125091
125293
  log: log,
125092
125294
  log2: log2,
125093
125295
  logarithmicDepthToViewZ: logarithmicDepthToViewZ,
125094
- loop: loop,
125095
125296
  luminance: luminance,
125096
125297
  mat2: mat2,
125097
125298
  mat3: mat3,
@@ -125183,7 +125384,6 @@ void main() {
125183
125384
  mx_worley_noise_float: mx_worley_noise_float,
125184
125385
  mx_worley_noise_vec2: mx_worley_noise_vec2,
125185
125386
  mx_worley_noise_vec3: mx_worley_noise_vec3,
125186
- namespace: namespace$1,
125187
125387
  negate: negate$1,
125188
125388
  neutralToneMapping: neutralToneMapping,
125189
125389
  nodeArray: nodeArray,
@@ -125196,7 +125396,9 @@ void main() {
125196
125396
  normalLocal: normalLocal,
125197
125397
  normalMap: normalMap,
125198
125398
  normalView: normalView,
125399
+ normalViewGeometry: normalViewGeometry,
125199
125400
  normalWorld: normalWorld,
125401
+ normalWorldGeometry: normalWorldGeometry,
125200
125402
  normalize: normalize,
125201
125403
  not: not,
125202
125404
  notEqual: notEqual,
@@ -125243,7 +125445,7 @@ void main() {
125243
125445
  pow2: pow2,
125244
125446
  pow3: pow3,
125245
125447
  pow4: pow4,
125246
- premult: premult,
125448
+ premultiplyAlpha: premultiplyAlpha,
125247
125449
  property: property,
125248
125450
  radians: radians,
125249
125451
  rand: rand,
@@ -125261,7 +125463,6 @@ void main() {
125261
125463
  refractVector: refractVector,
125262
125464
  refractView: refractView,
125263
125465
  reinhardToneMapping: reinhardToneMapping,
125264
- remainder: remainder,
125265
125466
  remap: remap,
125266
125467
  remapClamp: remapClamp,
125267
125468
  renderGroup: renderGroup,
@@ -125274,6 +125475,7 @@ void main() {
125274
125475
  rtt: rtt,
125275
125476
  sRGBTransferEOTF: sRGBTransferEOTF,
125276
125477
  sRGBTransferOETF: sRGBTransferOETF,
125478
+ sample: sample,
125277
125479
  sampler: sampler,
125278
125480
  samplerComparison: samplerComparison,
125279
125481
  saturate: saturate$1,
@@ -125310,6 +125512,7 @@ void main() {
125310
125512
  sqrt: sqrt$1,
125311
125513
  stack: stack,
125312
125514
  step: step,
125515
+ stepElement: stepElement,
125313
125516
  storage: storage$1,
125314
125517
  storageBarrier: storageBarrier,
125315
125518
  storageObject: storageObject,
@@ -125317,6 +125520,7 @@ void main() {
125317
125520
  string: string,
125318
125521
  struct: struct,
125319
125522
  sub: sub,
125523
+ subBuild: subBuild,
125320
125524
  subgroupIndex: subgroupIndex,
125321
125525
  subgroupSize: subgroupSize,
125322
125526
  tan: tan,
@@ -125329,6 +125533,7 @@ void main() {
125329
125533
  texture3D: texture3D,
125330
125534
  textureBarrier: textureBarrier,
125331
125535
  textureBicubic: textureBicubic,
125536
+ textureBicubicLevel: textureBicubicLevel,
125332
125537
  textureCubeUV: textureCubeUV,
125333
125538
  textureLoad: textureLoad,
125334
125539
  textureSize: textureSize,
@@ -125344,31 +125549,24 @@ void main() {
125344
125549
  transformDirection: transformDirection,
125345
125550
  transformNormal: transformNormal,
125346
125551
  transformNormalToView: transformNormalToView,
125347
- transformedBentNormalView: transformedBentNormalView,
125348
- transformedBitangentView: transformedBitangentView,
125349
- transformedBitangentWorld: transformedBitangentWorld,
125350
125552
  transformedClearcoatNormalView: transformedClearcoatNormalView,
125351
125553
  transformedNormalView: transformedNormalView,
125352
125554
  transformedNormalWorld: transformedNormalWorld,
125353
- transformedTangentView: transformedTangentView,
125354
- transformedTangentWorld: transformedTangentWorld,
125355
125555
  transmission: transmission,
125356
125556
  transpose: transpose,
125357
125557
  triNoise3D: triNoise3D,
125358
125558
  triplanarTexture: triplanarTexture,
125359
125559
  triplanarTextures: triplanarTextures,
125360
125560
  trunc: trunc,
125361
- tslFn: tslFn,
125362
125561
  uint: uint,
125363
125562
  uniform: uniform$1,
125364
125563
  uniformArray: uniformArray,
125365
125564
  uniformCubeTexture: uniformCubeTexture,
125366
125565
  uniformGroup: uniformGroup,
125367
125566
  uniformTexture: uniformTexture,
125368
- uniforms: uniforms,
125369
- unpremult: unpremult,
125567
+ unpremultiplyAlpha: unpremultiplyAlpha,
125370
125568
  userData: userData,
125371
- uv: uv,
125569
+ uv: uv$1,
125372
125570
  uvec2: uvec2,
125373
125571
  uvec3: uvec3,
125374
125572
  uvec4: uvec4,
@@ -125387,7 +125585,6 @@ void main() {
125387
125585
  viewZToOrthographicDepth: viewZToOrthographicDepth,
125388
125586
  viewZToPerspectiveDepth: viewZToPerspectiveDepth,
125389
125587
  viewport: viewport,
125390
- viewportBottomLeft: viewportBottomLeft,
125391
125588
  viewportCoordinate: viewportCoordinate,
125392
125589
  viewportDepthTexture: viewportDepthTexture,
125393
125590
  viewportLinearDepth: viewportLinearDepth,
@@ -125397,7 +125594,6 @@ void main() {
125397
125594
  viewportSharedTexture: viewportSharedTexture,
125398
125595
  viewportSize: viewportSize,
125399
125596
  viewportTexture: viewportTexture,
125400
- viewportTopLeft: viewportTopLeft,
125401
125597
  viewportUV: viewportUV,
125402
125598
  wgsl: wgsl,
125403
125599
  wgslFn: wgslFn,
@@ -125490,7 +125686,7 @@ void main() {
125490
125686
 
125491
125687
  const backgroundMeshNode = context( vec4( backgroundNode ).mul( backgroundIntensity ), {
125492
125688
  // @TODO: Add Texture2D support using node context
125493
- getUV: () => backgroundRotation.mul( normalWorld ),
125689
+ getUV: () => backgroundRotation.mul( normalWorldGeometry ),
125494
125690
  getTextureLevel: () => backgroundBlurriness
125495
125691
  } );
125496
125692
 
@@ -127360,6 +127556,30 @@ void main() {
127360
127556
  */
127361
127557
  this.buildStage = null;
127362
127558
 
127559
+ /**
127560
+ * The sub-build layers.
127561
+ *
127562
+ * @type {Array<SubBuildNode>}
127563
+ * @default []
127564
+ */
127565
+ this.subBuildLayers = [];
127566
+
127567
+ /**
127568
+ * The current stack of nodes.
127569
+ *
127570
+ * @type {?StackNode}
127571
+ * @default null
127572
+ */
127573
+ this.currentStack = null;
127574
+
127575
+ /**
127576
+ * The current sub-build TSL function(Fn).
127577
+ *
127578
+ * @type {?string}
127579
+ * @default null
127580
+ */
127581
+ this.subBuildFn = null;
127582
+
127363
127583
  }
127364
127584
 
127365
127585
  /**
@@ -128516,7 +128736,23 @@ void main() {
128516
128736
 
128517
128737
  if ( nodeData[ shaderStage ] === undefined ) nodeData[ shaderStage ] = {};
128518
128738
 
128519
- return nodeData[ shaderStage ];
128739
+ //
128740
+
128741
+ let data = nodeData[ shaderStage ];
128742
+
128743
+ const subBuilds = nodeData.any ? nodeData.any.subBuilds : null;
128744
+ const subBuild = this.getClosestSubBuild( subBuilds );
128745
+
128746
+ if ( subBuild ) {
128747
+
128748
+ if ( data.subBuildsCache === undefined ) data.subBuildsCache = {};
128749
+
128750
+ data = data.subBuildsCache[ subBuild ] || ( data.subBuildsCache[ subBuild ] = {} );
128751
+ data.subBuilds = subBuilds;
128752
+
128753
+ }
128754
+
128755
+ return data;
128520
128756
 
128521
128757
  }
128522
128758
 
@@ -128677,8 +128913,9 @@ void main() {
128677
128913
  getVarFromNode( node, name = null, type = node.getNodeType( this ), shaderStage = this.shaderStage, readOnly = false ) {
128678
128914
 
128679
128915
  const nodeData = this.getDataFromNode( node, shaderStage );
128916
+ const subBuildVariable = this.getSubBuildProperty( 'variable', nodeData.subBuilds );
128680
128917
 
128681
- let nodeVar = nodeData.variable;
128918
+ let nodeVar = nodeData[ subBuildVariable ];
128682
128919
 
128683
128920
  if ( nodeVar === undefined ) {
128684
128921
 
@@ -128697,6 +128934,14 @@ void main() {
128697
128934
 
128698
128935
  //
128699
128936
 
128937
+ if ( subBuildVariable !== 'variable' ) {
128938
+
128939
+ name = this.getSubBuildProperty( name, nodeData.subBuilds );
128940
+
128941
+ }
128942
+
128943
+ //
128944
+
128700
128945
  const count = this.getArrayCount( node );
128701
128946
 
128702
128947
  nodeVar = new NodeVar( name, type, readOnly, count );
@@ -128709,7 +128954,7 @@ void main() {
128709
128954
 
128710
128955
  this.registerDeclaration( nodeVar );
128711
128956
 
128712
- nodeData.variable = nodeVar;
128957
+ nodeData[ subBuildVariable ] = nodeVar;
128713
128958
 
128714
128959
  }
128715
128960
 
@@ -128777,8 +129022,9 @@ void main() {
128777
129022
  getVaryingFromNode( node, name = null, type = node.getNodeType( this ), interpolationType = null, interpolationSampling = null ) {
128778
129023
 
128779
129024
  const nodeData = this.getDataFromNode( node, 'any' );
129025
+ const subBuildVarying = this.getSubBuildProperty( 'varying', nodeData.subBuilds );
128780
129026
 
128781
- let nodeVarying = nodeData.varying;
129027
+ let nodeVarying = nodeData[ subBuildVarying ];
128782
129028
 
128783
129029
  if ( nodeVarying === undefined ) {
128784
129030
 
@@ -128787,69 +129033,27 @@ void main() {
128787
129033
 
128788
129034
  if ( name === null ) name = 'nodeVarying' + index;
128789
129035
 
128790
- nodeVarying = new NodeVarying( name, type, interpolationType, interpolationSampling );
128791
-
128792
- varyings.push( nodeVarying );
128793
-
128794
- this.registerDeclaration( nodeVarying );
128795
-
128796
- nodeData.varying = nodeVarying;
128797
-
128798
- }
128799
-
128800
- return nodeVarying;
128801
-
128802
- }
128803
-
128804
- /**
128805
- * Returns the current namespace for the node builder.
128806
- *
128807
- * @return {string} The current namespace.
128808
- */
128809
- get namespace() {
128810
-
128811
- return this.context.namespace;
128812
-
128813
- }
128814
-
128815
- /**
128816
- * Returns the output namespace for the node builder, which is used for the current output node.
128817
- *
128818
- * @return {string} The output namespace.
128819
- */
128820
- getOutputNamespace() {
129036
+ //
128821
129037
 
128822
- return this.getNamespace( 'outputNode' );
129038
+ if ( subBuildVarying !== 'varying' ) {
128823
129039
 
128824
- }
129040
+ name = this.getSubBuildProperty( name, nodeData.subBuilds );
128825
129041
 
128826
- /**
128827
- * Returns the namespace for the given property.
128828
- *
128829
- * If the property name is not set, it returns the namespace only.
128830
- * If the namespace is not set, it returns the property name.
128831
- * If the namespace is set, it returns the namespace concatenated with the property name.
128832
- *
128833
- * @param {string} [property=''] - The property name.
128834
- * @return {string} The namespace for the property.
128835
- */
128836
- getNamespace( property = '' ) {
128837
-
128838
- const ns = this.namespace;
129042
+ }
128839
129043
 
128840
- let nsName;
129044
+ //
128841
129045
 
128842
- if ( ns ) {
129046
+ nodeVarying = new NodeVarying( name, type, interpolationType, interpolationSampling );
128843
129047
 
128844
- nsName = property ? ( ns + '_' + property ) : ns;
129048
+ varyings.push( nodeVarying );
128845
129049
 
128846
- } else {
129050
+ this.registerDeclaration( nodeVarying );
128847
129051
 
128848
- nsName = property;
129052
+ nodeData[ subBuildVarying ] = nodeVarying;
128849
129053
 
128850
129054
  }
128851
129055
 
128852
- return nsName;
129056
+ return nodeVarying;
128853
129057
 
128854
129058
  }
128855
129059
 
@@ -129506,6 +129710,145 @@ void main() {
129506
129710
 
129507
129711
  }
129508
129712
 
129713
+ /**
129714
+ * Returns the current sub-build layer.
129715
+ *
129716
+ * @return {SubBuildNode} The current sub-build layers.
129717
+ */
129718
+ get subBuild() {
129719
+
129720
+ return this.subBuildLayers[ this.subBuildLayers.length - 1 ] || null;
129721
+
129722
+ }
129723
+
129724
+ /**
129725
+ * Adds a sub-build layer to the node builder.
129726
+ *
129727
+ * @param {SubBuildNode} subBuild - The sub-build layer to add.
129728
+ */
129729
+ addSubBuild( subBuild ) {
129730
+
129731
+ this.subBuildLayers.push( subBuild );
129732
+
129733
+ }
129734
+
129735
+ /**
129736
+ * Removes the last sub-build layer from the node builder.
129737
+ *
129738
+ * @return {SubBuildNode} The removed sub-build layer.
129739
+ */
129740
+ removeSubBuild() {
129741
+
129742
+ return this.subBuildLayers.pop();
129743
+
129744
+ }
129745
+
129746
+ /**
129747
+ * Returns the closest sub-build layer for the given data.
129748
+ *
129749
+ * @param {Node|Set|Array} data - The data to get the closest sub-build layer from.
129750
+ * @return {?string} The closest sub-build name or null if none found.
129751
+ */
129752
+ getClosestSubBuild( data ) {
129753
+
129754
+ let subBuilds;
129755
+
129756
+ if ( data && data.isNode ) {
129757
+
129758
+ if ( data.isShaderCallNodeInternal ) {
129759
+
129760
+ subBuilds = data.shaderNode.subBuilds;
129761
+
129762
+ } else if ( data.isStackNode ) {
129763
+
129764
+ subBuilds = [ data.subBuild ];
129765
+
129766
+ } else {
129767
+
129768
+ subBuilds = this.getDataFromNode( data, 'any' ).subBuilds;
129769
+
129770
+ }
129771
+
129772
+ } else if ( data instanceof Set ) {
129773
+
129774
+ subBuilds = [ ...data ];
129775
+
129776
+ } else {
129777
+
129778
+ subBuilds = data;
129779
+
129780
+ }
129781
+
129782
+ if ( ! subBuilds ) return null;
129783
+
129784
+ const subBuildLayers = this.subBuildLayers;
129785
+
129786
+ for ( let i = subBuilds.length - 1; i >= 0; i -- ) {
129787
+
129788
+ const subBuild = subBuilds[ i ];
129789
+
129790
+ if ( subBuildLayers.includes( subBuild ) ) {
129791
+
129792
+ return subBuild;
129793
+
129794
+ }
129795
+
129796
+ }
129797
+
129798
+ return null;
129799
+
129800
+ }
129801
+
129802
+
129803
+ /**
129804
+ * Returns the output node of a sub-build layer.
129805
+ *
129806
+ * @param {Node} node - The node to get the output from.
129807
+ * @return {string} The output node name.
129808
+ */
129809
+ getSubBuildOutput( node ) {
129810
+
129811
+ return this.getSubBuildProperty( 'outputNode', node );
129812
+
129813
+ }
129814
+
129815
+ /**
129816
+ * Returns the sub-build property name for the given property and node.
129817
+ *
129818
+ * @param {string} [property=''] - The property name.
129819
+ * @param {?Node} [node=null] - The node to get the sub-build from.
129820
+ * @return {string} The sub-build property name.
129821
+ */
129822
+ getSubBuildProperty( property = '', node = null ) {
129823
+
129824
+ let subBuild;
129825
+
129826
+ if ( node !== null ) {
129827
+
129828
+ subBuild = this.getClosestSubBuild( node );
129829
+
129830
+ } else {
129831
+
129832
+ subBuild = this.subBuildFn;
129833
+
129834
+ }
129835
+
129836
+ let result;
129837
+
129838
+ if ( subBuild ) {
129839
+
129840
+ result = property ? ( subBuild + '_' + property ) : subBuild;
129841
+
129842
+ } else {
129843
+
129844
+ result = property;
129845
+
129846
+ }
129847
+
129848
+ return result;
129849
+
129850
+ }
129851
+
129509
129852
  /**
129510
129853
  * Central build method which controls the build for the given object.
129511
129854
  *
@@ -129715,22 +130058,6 @@ void main() {
129715
130058
  */
129716
130059
  *[ Symbol.iterator ]() { }
129717
130060
 
129718
- // Deprecated
129719
-
129720
- /**
129721
- * @function
129722
- * @deprecated since r168. Use `new NodeMaterial()` instead, with targeted node material name.
129723
- *
129724
- * @param {string} [type='NodeMaterial'] - The node material type.
129725
- * @throws {Error}
129726
- */
129727
- createNodeMaterial( type = 'NodeMaterial' ) { // @deprecated, r168
129728
-
129729
- throw new Error( `THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${ type }() instead.` );
129730
-
129731
- }
129732
-
129733
-
129734
130061
  }
129735
130062
 
129736
130063
  /**
@@ -132420,10 +132747,11 @@ void main() {
132420
132747
  * are defined by external textures. This flag is
132421
132748
  * set to `true` when using the WebXR Layers API.
132422
132749
  *
132750
+ * @private
132423
132751
  * @type {boolean}
132424
132752
  * @default false
132425
132753
  */
132426
- this.hasExternalTextures = false;
132754
+ this._hasExternalTextures = false;
132427
132755
 
132428
132756
  /**
132429
132757
  * Whether a depth buffer should automatically be allocated
@@ -132436,10 +132764,25 @@ void main() {
132436
132764
  *
132437
132765
  * Reference: {@link https://www.w3.org/TR/webxrlayers-1/#dom-xrprojectionlayer-ignoredepthvalues}.
132438
132766
  *
132767
+ * @private
132439
132768
  * @type {boolean}
132440
132769
  * @default true
132441
132770
  */
132442
- this.autoAllocateDepthBuffer = true;
132771
+ this._autoAllocateDepthBuffer = true;
132772
+
132773
+ /**
132774
+ * Whether this render target is associated with a XRWebGLLayer.
132775
+ *
132776
+ * A XRWebGLLayer points to an opaque framebuffer. Basically,
132777
+ * this means that you don't have access to its bound color,
132778
+ * stencil and depth buffers. We need to handle this framebuffer
132779
+ * differently since its textures are always bound.
132780
+ *
132781
+ * @private
132782
+ * @type {boolean}
132783
+ * @default false
132784
+ * */
132785
+ this._isOpaqueFramebuffer = false;
132443
132786
 
132444
132787
  }
132445
132788
 
@@ -132447,8 +132790,9 @@ void main() {
132447
132790
 
132448
132791
  super.copy( source );
132449
132792
 
132450
- this.hasExternalTextures = source.hasExternalTextures;
132451
- this.autoAllocateDepthBuffer = source.autoAllocateDepthBuffer;
132793
+ this._hasExternalTextures = source._hasExternalTextures;
132794
+ this._autoAllocateDepthBuffer = source._autoAllocateDepthBuffer;
132795
+ this._isOpaqueFramebuffer = source._isOpaqueFramebuffer;
132452
132796
 
132453
132797
  return this;
132454
132798
 
@@ -133081,7 +133425,7 @@ void main() {
133081
133425
  resolveStencilBuffer: false
133082
133426
  } );
133083
133427
 
133084
- renderTarget.autoAllocateDepthBuffer = true;
133428
+ renderTarget._autoAllocateDepthBuffer = true;
133085
133429
 
133086
133430
  const material = new MeshBasicMaterial( { color: 0xffffff, side: FrontSide } );
133087
133431
  material.map = renderTarget.texture;
@@ -133172,7 +133516,7 @@ void main() {
133172
133516
  resolveStencilBuffer: false
133173
133517
  } );
133174
133518
 
133175
- renderTarget.autoAllocateDepthBuffer = true;
133519
+ renderTarget._autoAllocateDepthBuffer = true;
133176
133520
 
133177
133521
  const material = new MeshBasicMaterial( { color: 0xffffff, side: BackSide } );
133178
133522
  material.map = renderTarget.texture;
@@ -133246,7 +133590,7 @@ void main() {
133246
133590
  for ( const layer of this._layers ) {
133247
133591
 
133248
133592
  layer.renderTarget.isXRRenderTarget = this._session !== null;
133249
- layer.renderTarget.hasExternalTextures = layer.renderTarget.isXRRenderTarget;
133593
+ layer.renderTarget._hasExternalTextures = layer.renderTarget.isXRRenderTarget;
133250
133594
 
133251
133595
  if ( layer.renderTarget.isXRRenderTarget && this._supportsLayers ) {
133252
133596
 
@@ -133414,7 +133758,7 @@ void main() {
133414
133758
  multiview: this._useMultiview
133415
133759
  } );
133416
133760
 
133417
- this._xrRenderTarget.hasExternalTextures = true;
133761
+ this._xrRenderTarget._hasExternalTextures = true;
133418
133762
  this._xrRenderTarget.depth = this._useMultiview ? 2 : 1;
133419
133763
 
133420
133764
  this._supportsLayers = session.enabledFeatures.includes( 'layers' );
@@ -133476,6 +133820,7 @@ void main() {
133476
133820
  }
133477
133821
  );
133478
133822
 
133823
+ this._xrRenderTarget._isOpaqueFramebuffer = true;
133479
133824
  this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() );
133480
133825
 
133481
133826
  }
@@ -135303,7 +135648,7 @@ void main() {
135303
135648
  frameBufferTarget.scissorTest = this._scissorTest;
135304
135649
  frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
135305
135650
  frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
135306
- frameBufferTarget.autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.autoAllocateDepthBuffer : false;
135651
+ frameBufferTarget._autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget._autoAllocateDepthBuffer : false;
135307
135652
 
135308
135653
  return frameBufferTarget;
135309
135654
 
@@ -138155,9 +138500,7 @@ void main() {
138155
138500
  };
138156
138501
 
138157
138502
  const interpolationModeMap = {
138158
- 'centroid': 'centroid',
138159
- 'flat first': 'flat',
138160
- 'flat either': 'flat'
138503
+ 'centroid': 'centroid'
138161
138504
  };
138162
138505
 
138163
138506
  const defaultPrecisions = `
@@ -140320,6 +140663,10 @@ void main() {
140320
140663
 
140321
140664
  type = gl.FLOAT;
140322
140665
 
140666
+ } else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
140667
+
140668
+ type = gl.HALF_FLOAT;
140669
+
140323
140670
  } else if ( array instanceof Uint16Array ) {
140324
140671
 
140325
140672
  if ( attribute.isFloat16BufferAttribute ) {
@@ -140855,7 +141202,7 @@ void main() {
140855
141202
  break;
140856
141203
 
140857
141204
  case MultiplyBlending:
140858
- gl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );
141205
+ gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
140859
141206
  break;
140860
141207
 
140861
141208
  default:
@@ -140873,15 +141220,15 @@ void main() {
140873
141220
  break;
140874
141221
 
140875
141222
  case AdditiveBlending:
140876
- gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
141223
+ gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
140877
141224
  break;
140878
141225
 
140879
141226
  case SubtractiveBlending:
140880
- gl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );
141227
+ console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
140881
141228
  break;
140882
141229
 
140883
141230
  case MultiplyBlending:
140884
- gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
141231
+ console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
140885
141232
  break;
140886
141233
 
140887
141234
  default:
@@ -142984,6 +143331,8 @@ void main() {
142984
143331
 
142985
143332
  }
142986
143333
 
143334
+ gl.bindRenderbuffer( gl.RENDERBUFFER, null );
143335
+
142987
143336
  }
142988
143337
 
142989
143338
  /**
@@ -144224,13 +144573,13 @@ void main() {
144224
144573
 
144225
144574
  // The multisample_render_to_texture extension doesn't work properly if there
144226
144575
  // are midframe flushes and an external depth texture.
144227
- if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer === true && renderTarget.multiview === false ) {
144576
+ if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget._autoAllocateDepthBuffer === true && renderTarget.multiview === false ) {
144228
144577
 
144229
144578
  console.warn( 'THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided' );
144230
144579
 
144231
144580
  }
144232
144581
 
144233
- renderTarget.autoAllocateDepthBuffer = false;
144582
+ renderTarget._autoAllocateDepthBuffer = false;
144234
144583
 
144235
144584
  }
144236
144585
 
@@ -144403,29 +144752,60 @@ void main() {
144403
144752
  }
144404
144753
 
144405
144754
  this._currentContext = previousContext;
144755
+ const renderTarget = renderContext.renderTarget;
144406
144756
 
144407
- if ( renderContext.textures !== null && renderContext.renderTarget ) {
144408
-
144409
- const renderTargetContextData = this.get( renderContext.renderTarget );
144757
+ if ( renderContext.textures !== null && renderTarget ) {
144410
144758
 
144411
- const { resolveDepthBuffer, samples } = renderContext.renderTarget;
144759
+ const renderTargetContextData = this.get( renderTarget );
144412
144760
 
144413
- if ( samples > 0 && this._useMultisampledExtension( renderContext.renderTarget ) === false ) {
144761
+ if ( renderTarget.samples > 0 && this._useMultisampledExtension( renderTarget ) === false ) {
144414
144762
 
144415
144763
  const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
144416
144764
 
144417
- const mask = gl.COLOR_BUFFER_BIT;
144765
+ let mask = gl.COLOR_BUFFER_BIT;
144766
+
144767
+ if ( renderTarget.resolveDepthBuffer ) {
144768
+
144769
+ if ( renderTarget.depthBuffer ) mask |= gl.DEPTH_BUFFER_BIT;
144770
+ if ( renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer ) mask |= gl.STENCIL_BUFFER_BIT;
144771
+
144772
+ }
144418
144773
 
144419
144774
  const msaaFrameBuffer = renderTargetContextData.msaaFrameBuffer;
144775
+ const msaaRenderbuffers = renderTargetContextData.msaaRenderbuffers;
144420
144776
 
144421
144777
  const textures = renderContext.textures;
144778
+ const isMRT = textures.length > 1;
144422
144779
 
144423
144780
  state.bindFramebuffer( gl.READ_FRAMEBUFFER, msaaFrameBuffer );
144424
144781
  state.bindFramebuffer( gl.DRAW_FRAMEBUFFER, fb );
144425
144782
 
144783
+ if ( isMRT ) {
144784
+
144785
+ // blitFramebuffer() can only copy/resolve the first color attachment of a framebuffer. When using MRT,
144786
+ // the engine temporarily removes all attachments and then configures each attachment for the resolve.
144787
+
144788
+ for ( let i = 0; i < textures.length; i ++ ) {
144789
+
144790
+ gl.framebufferRenderbuffer( gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, null );
144791
+ gl.framebufferTexture2D( gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.TEXTURE_2D, null, 0 );
144792
+
144793
+ }
144794
+
144795
+ }
144796
+
144426
144797
  for ( let i = 0; i < textures.length; i ++ ) {
144427
144798
 
144428
- // TODO Add support for MRT
144799
+ if ( isMRT ) {
144800
+
144801
+ // configure attachment for resolve
144802
+
144803
+ const { textureGPU } = this.get( textures[ i ] );
144804
+
144805
+ gl.framebufferRenderbuffer( gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, msaaRenderbuffers[ i ] );
144806
+ gl.framebufferTexture2D( gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, textureGPU, 0 );
144807
+
144808
+ }
144429
144809
 
144430
144810
  if ( renderContext.scissor ) {
144431
144811
 
@@ -144435,27 +144815,36 @@ void main() {
144435
144815
 
144436
144816
  gl.blitFramebuffer( x, viewY, x + width, viewY + height, x, viewY, x + width, viewY + height, mask, gl.NEAREST );
144437
144817
 
144438
- if ( this._supportsInvalidateFramebuffer === true ) {
144818
+ } else {
144439
144819
 
144440
- gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );
144820
+ gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
144441
144821
 
144442
- }
144822
+ }
144443
144823
 
144444
- } else {
144824
+ }
144445
144825
 
144446
- gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
144826
+ if ( isMRT ) {
144827
+
144828
+ // restore attachments
144447
144829
 
144448
- if ( this._supportsInvalidateFramebuffer === true ) {
144830
+ for ( let i = 0; i < textures.length; i ++ ) {
144449
144831
 
144450
- gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );
144832
+ const { textureGPU } = this.get( textures[ i ] );
144451
144833
 
144452
- }
144834
+ gl.framebufferRenderbuffer( gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, msaaRenderbuffers[ i ] );
144835
+ gl.framebufferTexture2D( gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.TEXTURE_2D, textureGPU, 0 );
144453
144836
 
144454
144837
  }
144455
144838
 
144456
144839
  }
144457
144840
 
144458
- } else if ( resolveDepthBuffer === false && renderTargetContextData.framebuffers ) {
144841
+ if ( this._supportsInvalidateFramebuffer === true ) {
144842
+
144843
+ gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );
144844
+
144845
+ }
144846
+
144847
+ } else if ( renderTarget.resolveDepthBuffer === false && renderTargetContextData.framebuffers ) {
144459
144848
 
144460
144849
  const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
144461
144850
  state.bindFramebuffer( gl.DRAW_FRAMEBUFFER, fb );
@@ -144756,7 +145145,7 @@ void main() {
144756
145145
 
144757
145146
  if ( vaoGPU === undefined ) {
144758
145147
 
144759
- this._createVao( attributes );
145148
+ this.vaoCache[ vaoKey ] = this._createVao( attributes );
144760
145149
 
144761
145150
  } else {
144762
145151
 
@@ -144792,7 +145181,7 @@ void main() {
144792
145181
 
144793
145182
  const dualAttributeData = transformBuffers[ i ];
144794
145183
 
144795
- if ( dualAttributeData.pbo ) {
145184
+ if ( dualAttributeData.pbo && this.has( dualAttributeData.pbo ) ) {
144796
145185
 
144797
145186
  this.textureUtils.copyBufferToTexture( dualAttributeData.transformBuffer, dualAttributeData.pbo );
144798
145187
 
@@ -144874,28 +145263,23 @@ void main() {
144874
145263
 
144875
145264
  // vertex state
144876
145265
 
144877
- const renderObjectData = this.get( renderObject );
145266
+ const attributes = renderObject.getAttributes();
145267
+ const attributesData = this.get( attributes );
144878
145268
 
144879
- let vaoGPU = renderObjectData.staticVao;
145269
+ let vaoGPU = attributesData.vaoGPU;
144880
145270
 
144881
- if ( vaoGPU === undefined || renderObjectData.geometryId !== renderObject.geometry.id ) {
145271
+ if ( vaoGPU === undefined ) {
144882
145272
 
144883
- const vaoKey = this._getVaoKey( renderObject.getAttributes() );
145273
+ const vaoKey = this._getVaoKey( attributes );
144884
145274
 
144885
145275
  vaoGPU = this.vaoCache[ vaoKey ];
144886
145276
 
144887
145277
  if ( vaoGPU === undefined ) {
144888
145278
 
144889
- let staticVao;
144890
-
144891
- ( { vaoGPU, staticVao } = this._createVao( renderObject.getAttributes() ) );
144892
-
144893
- if ( staticVao ) {
145279
+ vaoGPU = this._createVao( attributes );
144894
145280
 
144895
- renderObjectData.staticVao = vaoGPU;
144896
- renderObjectData.geometryId = renderObject.geometry.id;
144897
-
144898
- }
145281
+ this.vaoCache[ vaoKey ] = vaoGPU;
145282
+ attributesData.vaoGPU = vaoGPU;
144899
145283
 
144900
145284
  }
144901
145285
 
@@ -145862,7 +146246,7 @@ void main() {
145862
146246
  const isRenderTarget3D = renderTarget.isRenderTarget3D === true;
145863
146247
  const isRenderTargetArray = renderTarget.depth > 1;
145864
146248
  const isXRRenderTarget = renderTarget.isXRRenderTarget === true;
145865
- const hasExternalTextures = ( isXRRenderTarget === true && renderTarget.hasExternalTextures === true );
146249
+ const _hasExternalTextures = ( isXRRenderTarget === true && renderTarget._hasExternalTextures === true );
145866
146250
 
145867
146251
  let msaaFb = renderTargetContextData.msaaFrameBuffer;
145868
146252
  let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
@@ -145879,7 +146263,7 @@ void main() {
145879
146263
 
145880
146264
  fb = renderTargetContextData.cubeFramebuffers[ cacheKey ];
145881
146265
 
145882
- } else if ( isXRRenderTarget && hasExternalTextures === false ) {
146266
+ } else if ( isXRRenderTarget && _hasExternalTextures === false ) {
145883
146267
 
145884
146268
  fb = this._xrFramebuffer;
145885
146269
 
@@ -145949,13 +146333,11 @@ void main() {
145949
146333
 
145950
146334
  }
145951
146335
 
145952
- state.drawBuffers( descriptor, fb );
145953
-
145954
146336
  }
145955
146337
 
145956
146338
  const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
145957
146339
 
145958
- if ( renderTarget.autoAllocateDepthBuffer === true ) {
146340
+ if ( renderTarget._autoAllocateDepthBuffer === true ) {
145959
146341
 
145960
146342
  const renderbuffer = gl.createRenderbuffer();
145961
146343
  this.textureUtils.setupRenderBufferStorage( renderbuffer, descriptor, 0, useMultisampledRTT );
@@ -145980,7 +146362,7 @@ void main() {
145980
146362
 
145981
146363
  multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 );
145982
146364
 
145983
- } else if ( hasExternalTextures && useMultisampledRTT ) {
146365
+ } else if ( _hasExternalTextures && useMultisampledRTT ) {
145984
146366
 
145985
146367
  multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
145986
146368
 
@@ -146031,7 +146413,7 @@ void main() {
146031
146413
 
146032
146414
  // rebind external XR textures
146033
146415
 
146034
- if ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) {
146416
+ if ( ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) && ( renderTarget._isOpaqueFramebuffer !== true ) ) {
146035
146417
 
146036
146418
  state.bindFramebuffer( gl.FRAMEBUFFER, fb );
146037
146419
 
@@ -146057,7 +146439,7 @@ void main() {
146057
146439
 
146058
146440
  const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
146059
146441
 
146060
- if ( renderTarget.autoAllocateDepthBuffer === true ) {
146442
+ if ( renderTarget._autoAllocateDepthBuffer === true ) {
146061
146443
 
146062
146444
  const renderbuffer = renderTargetContextData.xrDepthRenderbuffer;
146063
146445
  gl.bindRenderbuffer( gl.RENDERBUFFER, renderbuffer );
@@ -146109,13 +146491,6 @@ void main() {
146109
146491
 
146110
146492
  invalidationArray.push( gl.COLOR_ATTACHMENT0 + i );
146111
146493
 
146112
- if ( depthBuffer ) {
146113
-
146114
- const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
146115
- invalidationArray.push( depthStyle );
146116
-
146117
- }
146118
-
146119
146494
  const texture = descriptor.textures[ i ];
146120
146495
  const textureData = this.get( texture );
146121
146496
 
@@ -146125,10 +146500,12 @@ void main() {
146125
146500
 
146126
146501
  }
146127
146502
 
146503
+ gl.bindRenderbuffer( gl.RENDERBUFFER, null );
146504
+
146128
146505
  renderTargetContextData.msaaFrameBuffer = msaaFb;
146129
146506
  renderTargetContextData.msaaRenderbuffers = msaaRenderbuffers;
146130
146507
 
146131
- if ( depthRenderbuffer === undefined ) {
146508
+ if ( depthBuffer && depthRenderbuffer === undefined ) {
146132
146509
 
146133
146510
  depthRenderbuffer = gl.createRenderbuffer();
146134
146511
  this.textureUtils.setupRenderBufferStorage( depthRenderbuffer, descriptor, samples );
@@ -146152,6 +146529,8 @@ void main() {
146152
146529
 
146153
146530
  }
146154
146531
 
146532
+ state.drawBuffers( descriptor, fb );
146533
+
146155
146534
  }
146156
146535
 
146157
146536
  state.bindFramebuffer( gl.FRAMEBUFFER, currentFrameBuffer );
@@ -146193,9 +146572,6 @@ void main() {
146193
146572
  const { gl } = this;
146194
146573
 
146195
146574
  const vaoGPU = gl.createVertexArray();
146196
- let key = '';
146197
-
146198
- let staticVao = true;
146199
146575
 
146200
146576
  gl.bindVertexArray( vaoGPU );
146201
146577
 
@@ -146204,13 +146580,9 @@ void main() {
146204
146580
  const attribute = attributes[ i ];
146205
146581
  const attributeData = this.get( attribute );
146206
146582
 
146207
- key += ':' + attributeData.id;
146208
-
146209
146583
  gl.bindBuffer( gl.ARRAY_BUFFER, attributeData.bufferGPU );
146210
146584
  gl.enableVertexAttribArray( i );
146211
146585
 
146212
- if ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) staticVao = false;
146213
-
146214
146586
  let stride, offset;
146215
146587
 
146216
146588
  if ( attribute.isInterleavedBufferAttribute === true ) {
@@ -146249,9 +146621,7 @@ void main() {
146249
146621
 
146250
146622
  gl.bindBuffer( gl.ARRAY_BUFFER, null );
146251
146623
 
146252
- this.vaoCache[ key ] = vaoGPU;
146253
-
146254
- return { vaoGPU, staticVao };
146624
+ return vaoGPU;
146255
146625
 
146256
146626
  }
146257
146627
 
@@ -146388,7 +146758,7 @@ void main() {
146388
146758
 
146389
146759
  }
146390
146760
 
146391
- return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget.autoAllocateDepthBuffer !== false;
146761
+ return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget._autoAllocateDepthBuffer !== false;
146392
146762
 
146393
146763
  }
146394
146764
 
@@ -146672,20 +147042,26 @@ void main() {
146672
147042
  };
146673
147043
 
146674
147044
  const GPUFeatureName = {
147045
+ CoreFeaturesAndLimits: 'core-features-and-limits',
146675
147046
  DepthClipControl: 'depth-clip-control',
146676
147047
  Depth32FloatStencil8: 'depth32float-stencil8',
146677
147048
  TextureCompressionBC: 'texture-compression-bc',
147049
+ TextureCompressionBCSliced3D: 'texture-compression-bc-sliced-3d',
146678
147050
  TextureCompressionETC2: 'texture-compression-etc2',
146679
147051
  TextureCompressionASTC: 'texture-compression-astc',
147052
+ TextureCompressionASTCSliced3D: 'texture-compression-astc-sliced-3d',
146680
147053
  TimestampQuery: 'timestamp-query',
146681
147054
  IndirectFirstInstance: 'indirect-first-instance',
146682
147055
  ShaderF16: 'shader-f16',
146683
147056
  RG11B10UFloat: 'rg11b10ufloat-renderable',
146684
147057
  BGRA8UNormStorage: 'bgra8unorm-storage',
146685
147058
  Float32Filterable: 'float32-filterable',
147059
+ Float32Blendable: 'float32-blendable',
146686
147060
  ClipDistances: 'clip-distances',
146687
147061
  DualSourceBlending: 'dual-source-blending',
146688
- Subgroups: 'subgroups'
147062
+ Subgroups: 'subgroups',
147063
+ TextureFormatsTier1: 'texture-formats-tier1',
147064
+ TextureFormatsTier2: 'texture-formats-tier2'
146689
147065
  };
146690
147066
 
146691
147067
  /**
@@ -148369,7 +148745,7 @@ fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {
148369
148745
 
148370
148746
  let dimension;
148371
148747
 
148372
- if ( texture.isData3DTexture ) {
148748
+ if ( texture.is3DTexture || texture.isData3DTexture ) {
148373
148749
 
148374
148750
  dimension = GPUTextureDimension.ThreeD;
148375
148751
 
@@ -150643,24 +151019,29 @@ ${ flowData.code }
150643
151019
 
150644
151020
  }
150645
151021
 
150646
- } else if ( texture.isArrayTexture === true || texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) {
151022
+ } else if ( uniform.node.isStorageTextureNode === true ) {
150647
151023
 
150648
- textureType = 'texture_2d_array<f32>';
151024
+ const format = getFormat( texture );
151025
+ const access = this.getStorageAccess( uniform.node, shaderStage );
150649
151026
 
150650
- } else if ( texture.isVideoTexture === true ) {
151027
+ const is3D = uniform.node.value.is3DTexture;
151028
+ const isArrayTexture = uniform.node.value.isArrayTexture;
150651
151029
 
150652
- textureType = 'texture_external';
151030
+ const dimension = is3D ? '3d' : `2d${ isArrayTexture ? '_array' : '' }`;
150653
151031
 
150654
- } else if ( texture.isData3DTexture === true ) {
151032
+ textureType = `texture_storage_${ dimension }<${ format }, ${ access }>`;
150655
151033
 
150656
- textureType = 'texture_3d<f32>';
151034
+ } else if ( texture.isArrayTexture === true || texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) {
150657
151035
 
150658
- } else if ( uniform.node.isStorageTextureNode === true ) {
151036
+ textureType = 'texture_2d_array<f32>';
150659
151037
 
150660
- const format = getFormat( texture );
150661
- const access = this.getStorageAccess( uniform.node, shaderStage );
151038
+ } else if ( texture.is3DTexture === true || texture.isData3DTexture === true ) {
150662
151039
 
150663
- textureType = `texture_storage_2d<${ format }, ${ access }>`;
151040
+ textureType = 'texture_3d<f32>';
151041
+
151042
+ } else if ( texture.isVideoTexture === true ) {
151043
+
151044
+ textureType = 'texture_external';
150664
151045
 
150665
151046
  } else {
150666
151047
 
@@ -151357,6 +151738,12 @@ var<${access}> ${ name } : ${ structName };`;
151357
151738
  [ Float32Array, [ 'float32', ]],
151358
151739
  ] );
151359
151740
 
151741
+ if ( typeof Float16Array !== 'undefined' ) {
151742
+
151743
+ typedArraysToVertexFormatPrefix.set( Float16Array, [ 'float16' ] );
151744
+
151745
+ }
151746
+
151360
151747
  const typedAttributeToVertexFormatPrefix = new Map( [
151361
151748
  [ Float16BufferAttribute, [ 'float16', ]],
151362
151749
  ] );
@@ -151916,6 +152303,16 @@ var<${access}> ${ name } : ${ structName };`;
151916
152303
 
151917
152304
  }
151918
152305
 
152306
+ if ( binding.texture.isArrayTexture ) {
152307
+
152308
+ storageTexture.viewDimension = GPUTextureViewDimension.TwoDArray;
152309
+
152310
+ } else if ( binding.texture.is3DTexture ) {
152311
+
152312
+ storageTexture.viewDimension = GPUTextureViewDimension.ThreeD;
152313
+
152314
+ }
152315
+
151919
152316
  bindingGPU.storageTexture = storageTexture;
151920
152317
 
151921
152318
  } else if ( binding.isSampledTexture ) {
@@ -152618,7 +153015,7 @@ var<${access}> ${ name } : ${ structName };`;
152618
153015
  break;
152619
153016
 
152620
153017
  case MultiplyBlending:
152621
- setBlend( GPUBlendFactor.Zero, GPUBlendFactor.Src, GPUBlendFactor.Zero, GPUBlendFactor.SrcAlpha );
153018
+ setBlend( GPUBlendFactor.Dst, GPUBlendFactor.OneMinusSrcAlpha, GPUBlendFactor.Zero, GPUBlendFactor.One );
152622
153019
  break;
152623
153020
 
152624
153021
  }
@@ -152632,15 +153029,15 @@ var<${access}> ${ name } : ${ structName };`;
152632
153029
  break;
152633
153030
 
152634
153031
  case AdditiveBlending:
152635
- setBlend( GPUBlendFactor.SrcAlpha, GPUBlendFactor.One, GPUBlendFactor.SrcAlpha, GPUBlendFactor.One );
153032
+ setBlend( GPUBlendFactor.SrcAlpha, GPUBlendFactor.One, GPUBlendFactor.One, GPUBlendFactor.One );
152636
153033
  break;
152637
153034
 
152638
153035
  case SubtractiveBlending:
152639
- setBlend( GPUBlendFactor.Zero, GPUBlendFactor.OneMinusSrc, GPUBlendFactor.Zero, GPUBlendFactor.One );
153036
+ console.error( 'THREE.WebGPURenderer: SubtractiveBlending requires material.premultipliedAlpha = true' );
152640
153037
  break;
152641
153038
 
152642
153039
  case MultiplyBlending:
152643
- setBlend( GPUBlendFactor.Zero, GPUBlendFactor.Src, GPUBlendFactor.Zero, GPUBlendFactor.Src );
153040
+ console.error( 'THREE.WebGPURenderer: MultiplyBlending requires material.premultipliedAlpha = true' );
152644
153041
  break;
152645
153042
 
152646
153043
  }
@@ -155378,7 +155775,15 @@ var<${access}> ${ name } : ${ structName };`;
155378
155775
  */
155379
155776
  createIndexAttribute( attribute ) {
155380
155777
 
155381
- this.attributeUtils.createAttribute( attribute, GPUBufferUsage.INDEX | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST );
155778
+ let usage = GPUBufferUsage.INDEX | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST;
155779
+
155780
+ if ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) {
155781
+
155782
+ usage |= GPUBufferUsage.STORAGE;
155783
+
155784
+ }
155785
+
155786
+ this.attributeUtils.createAttribute( attribute, usage );
155382
155787
 
155383
155788
  }
155384
155789
 
@@ -156000,6 +156405,7 @@ var<${access}> ${ name } : ${ structName };`;
156000
156405
  TSL.backgroundIntensity;
156001
156406
  TSL.backgroundRotation;
156002
156407
  TSL.batch;
156408
+ TSL.bentNormalView;
156003
156409
  TSL.billboarding;
156004
156410
  TSL.bitAnd;
156005
156411
  TSL.bitNot;
@@ -156259,7 +156665,6 @@ var<${access}> ${ name } : ${ structName };`;
156259
156665
  TSL.mx_worley_noise_float;
156260
156666
  TSL.mx_worley_noise_vec2;
156261
156667
  TSL.mx_worley_noise_vec3;
156262
- TSL.namespace;
156263
156668
  const negate = TSL.negate;
156264
156669
  TSL.neutralToneMapping;
156265
156670
  TSL.nodeArray;
@@ -156272,7 +156677,9 @@ var<${access}> ${ name } : ${ structName };`;
156272
156677
  TSL.normalLocal;
156273
156678
  TSL.normalMap;
156274
156679
  TSL.normalView;
156680
+ TSL.normalViewGeometry;
156275
156681
  TSL.normalWorld;
156682
+ TSL.normalWorldGeometry;
156276
156683
  TSL.normalize;
156277
156684
  TSL.not;
156278
156685
  TSL.notEqual;
@@ -156318,7 +156725,7 @@ var<${access}> ${ name } : ${ structName };`;
156318
156725
  TSL.pow2;
156319
156726
  TSL.pow3;
156320
156727
  TSL.pow4;
156321
- TSL.premult;
156728
+ TSL.premultiplyAlpha;
156322
156729
  TSL.property;
156323
156730
  TSL.radians;
156324
156731
  TSL.rand;
@@ -156350,6 +156757,7 @@ var<${access}> ${ name } : ${ structName };`;
156350
156757
  TSL.rtt;
156351
156758
  TSL.sRGBTransferEOTF;
156352
156759
  TSL.sRGBTransferOETF;
156760
+ TSL.sample;
156353
156761
  TSL.sampler;
156354
156762
  TSL.samplerComparison;
156355
156763
  TSL.saturate;
@@ -156394,6 +156802,7 @@ var<${access}> ${ name } : ${ structName };`;
156394
156802
  TSL.string;
156395
156803
  TSL.struct;
156396
156804
  TSL.sub;
156805
+ TSL.subBuild;
156397
156806
  TSL.subgroupIndex;
156398
156807
  TSL.subgroupSize;
156399
156808
  TSL.tan;
@@ -156406,6 +156815,7 @@ var<${access}> ${ name } : ${ structName };`;
156406
156815
  TSL.texture3D;
156407
156816
  TSL.textureBarrier;
156408
156817
  TSL.textureBicubic;
156818
+ TSL.textureBicubicLevel;
156409
156819
  TSL.textureCubeUV;
156410
156820
  TSL.textureLoad;
156411
156821
  TSL.textureSize;
@@ -156421,14 +156831,9 @@ var<${access}> ${ name } : ${ structName };`;
156421
156831
  TSL.transformDirection;
156422
156832
  TSL.transformNormal;
156423
156833
  TSL.transformNormalToView;
156424
- TSL.transformedBentNormalView;
156425
- TSL.transformedBitangentView;
156426
- TSL.transformedBitangentWorld;
156427
156834
  TSL.transformedClearcoatNormalView;
156428
156835
  TSL.transformedNormalView;
156429
156836
  TSL.transformedNormalWorld;
156430
- TSL.transformedTangentView;
156431
- TSL.transformedTangentWorld;
156432
156837
  TSL.transmission;
156433
156838
  TSL.transpose;
156434
156839
  TSL.triNoise3D;
@@ -156443,7 +156848,7 @@ var<${access}> ${ name } : ${ structName };`;
156443
156848
  TSL.uniformGroup;
156444
156849
  TSL.uniformTexture;
156445
156850
  TSL.uniforms;
156446
- TSL.unpremult;
156851
+ TSL.unpremultiplyAlpha;
156447
156852
  TSL.userData;
156448
156853
  TSL.uv;
156449
156854
  TSL.uvec2;
@@ -158600,19 +159005,17 @@ var<${access}> ${ name } : ${ structName };`;
158600
159005
  i = 0;
158601
159006
  }
158602
159007
  _regeneratorDefine = function (e, r, n, t) {
158603
- if (r) i ? i(e, r, {
159008
+ function o(r, n) {
159009
+ _regeneratorDefine(e, r, function (e) {
159010
+ return this._invoke(r, n, e);
159011
+ });
159012
+ }
159013
+ r ? i ? i(e, r, {
158604
159014
  value: n,
158605
159015
  enumerable: !t,
158606
159016
  configurable: !t,
158607
159017
  writable: !t
158608
- }) : e[r] = n;else {
158609
- function o(r, n) {
158610
- _regeneratorDefine(e, r, function (e) {
158611
- return this._invoke(r, n, e);
158612
- });
158613
- }
158614
- o("next", 0), o("throw", 1), o("return", 2);
158615
- }
159018
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
158616
159019
  }, _regeneratorDefine(e, r, n, t);
158617
159020
  }
158618
159021
  function _setPrototypeOf$1(t, e) {
@@ -159414,12 +159817,18 @@ var<${access}> ${ name } : ${ structName };`;
159414
159817
  arcStartLng: {
159415
159818
  "default": 'startLng'
159416
159819
  },
159820
+ arcStartAltitude: {
159821
+ "default": 0
159822
+ },
159417
159823
  arcEndLat: {
159418
159824
  "default": 'endLat'
159419
159825
  },
159420
159826
  arcEndLng: {
159421
159827
  "default": 'endLng'
159422
159828
  },
159829
+ arcEndAltitude: {
159830
+ "default": 0
159831
+ },
159423
159832
  arcColor: {
159424
159833
  "default": function _default() {
159425
159834
  return '#ffffaa';
@@ -159524,8 +159933,10 @@ var<${access}> ${ name } : ${ structName };`;
159524
159933
  // Data accessors
159525
159934
  var startLatAccessor = index$2(state.arcStartLat);
159526
159935
  var startLngAccessor = index$2(state.arcStartLng);
159936
+ var startAltAccessor = index$2(state.arcStartAltitude);
159527
159937
  var endLatAccessor = index$2(state.arcEndLat);
159528
159938
  var endLngAccessor = index$2(state.arcEndLng);
159939
+ var endAltAccessor = index$2(state.arcEndAltitude);
159529
159940
  var altitudeAccessor = index$2(state.arcAltitude);
159530
159941
  var altitudeAutoScaleAccessor = index$2(state.arcAltitudeAutoScale);
159531
159942
  var strokeAccessor = index$2(state.arcStroke);
@@ -159601,8 +160012,10 @@ var<${access}> ${ name } : ${ structName };`;
159601
160012
  altAutoScale: +altitudeAutoScaleAccessor(arc),
159602
160013
  startLat: +startLatAccessor(arc),
159603
160014
  startLng: +startLngAccessor(arc),
160015
+ startAlt: +startAltAccessor(arc),
159604
160016
  endLat: +endLatAccessor(arc),
159605
- endLng: +endLngAccessor(arc)
160017
+ endLng: +endLngAccessor(arc),
160018
+ endAlt: +endAltAccessor(arc)
159606
160019
  };
159607
160020
  var currentTargetD = group.__currentTargetD || Object.assign({}, targetD, {
159608
160021
  altAutoScale: -1e-3
@@ -159627,8 +160040,10 @@ var<${access}> ${ name } : ${ structName };`;
159627
160040
  altAutoScale = _ref4.altAutoScale,
159628
160041
  startLat = _ref4.startLat,
159629
160042
  startLng = _ref4.startLng,
160043
+ startAlt = _ref4.startAlt,
159630
160044
  endLat = _ref4.endLat,
159631
- endLng = _ref4.endLng;
160045
+ endLng = _ref4.endLng,
160046
+ endAlt = _ref4.endAlt;
159632
160047
  var getVec = function getVec(_ref5) {
159633
160048
  var _ref6 = _slicedToArray$2(_ref5, 3),
159634
160049
  lng = _ref6[0],
@@ -159647,20 +160062,19 @@ var<${access}> ${ name } : ${ structName };`;
159647
160062
  var altitude = alt;
159648
160063
  (altitude === null || altitude === undefined) && (
159649
160064
  // by default set altitude proportional to the great-arc distance
159650
- altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale);
159651
- if (altitude) {
160065
+ altitude = geoDistance$1(startPnt, endPnt) / 2 * altAutoScale + Math.max(startAlt, endAlt));
160066
+ if (altitude || startAlt || endAlt) {
159652
160067
  var interpolate = geoInterpolate(startPnt, endPnt);
160068
+ var calcAltCp = function calcAltCp(a0, a1) {
160069
+ return a1 + (a1 - a0) * (a0 < a1 ? 0.5 : 0.25);
160070
+ };
159653
160071
  var _map = [0.25, 0.75].map(function (t) {
159654
- return [].concat(_toConsumableArray$2(interpolate(t)), [altitude * 1.5]);
160072
+ return [].concat(_toConsumableArray$2(interpolate(t)), [calcAltCp(t < 0.5 ? startAlt : endAlt, altitude)]);
159655
160073
  }),
159656
160074
  _map2 = _slicedToArray$2(_map, 2),
159657
160075
  m1Pnt = _map2[0],
159658
160076
  m2Pnt = _map2[1];
159659
- var curve = _construct$1(THREE$e.CubicBezierCurve3, _toConsumableArray$2([startPnt, m1Pnt, m2Pnt, endPnt].map(getVec)));
159660
-
159661
- //const mPnt = [...interpolate(0.5), altitude * 2];
159662
- //curve = new THREE.QuadraticBezierCurve3(...[startPnt, mPnt, endPnt].map(getVec));
159663
-
160077
+ var curve = _construct$1(THREE$e.CubicBezierCurve3, _toConsumableArray$2([[].concat(startPnt, [startAlt]), m1Pnt, m2Pnt, [].concat(endPnt, [endAlt])].map(getVec)));
159664
160078
  return curve;
159665
160079
  } else {
159666
160080
  // ground line
@@ -162201,7 +162615,7 @@ var<${access}> ${ name } : ${ structName };`;
162201
162615
  return _defineProperty$3({}, p, bindPointsLayer.linkProp(p));
162202
162616
  })));
162203
162617
  var bindArcsLayer = linkKapsule$1('arcsLayer', ArcsLayerKapsule);
162204
- var linkedArcsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration'].map(function (p) {
162618
+ var linkedArcsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['arcsData', 'arcStartLat', 'arcStartLng', 'arcStartAltitude', 'arcEndLat', 'arcEndLng', 'arcEndAltitude', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration'].map(function (p) {
162205
162619
  return _defineProperty$3({}, p, bindArcsLayer.linkProp(p));
162206
162620
  })));
162207
162621
  var bindHexBinLayer = linkKapsule$1('hexBinLayer', HexBinLayerKapsule);
@@ -169019,7 +169433,7 @@ var<${access}> ${ name } : ${ structName };`;
169019
169433
  return [event.pageX, event.pageY];
169020
169434
  }
169021
169435
 
169022
- var n,l,u,t,i,r,o,e,f,c,s,a,p={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w=Array.isArray;function d(n,l){for(var u in l)n[u]=l[u];return n}function g(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function _(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return m(l,e,i,r,null)}function m(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function k(n){return n.children}function x(n,l){this.props=n,this.context=l;}function S(n,l){if(null==l)return n.__?S(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?S(n):null}function C(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C(n)}}function M(n){(!n.__d&&(n.__d=true)&&i.push(n)&&!$.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)($);}function $(){for(var n,u,t,r,o,f,c,s=1;i.length;)i.length>s&&i.sort(e),n=i.shift(),s=i.length,n.__d&&(t=void 0,o=(r=(u=n).__v).__e,f=[],c=[],u.__P&&((t=d({},r)).__v=r.__v+1,l.vnode&&l.vnode(t),O(u.__P,t,r,u.__n,u.__P.namespaceURI,32&r.__u?[o]:null,f,null==o?S(r):o,!!(32&r.__u),c),t.__v=r.__v,t.__.__k[t.__i]=t,z(f,t,c),t.__e!=o&&C(t)));$.__r=0;}function I(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,w,d,g,_=t&&t.__k||v,m=l.length;for(f=P(u,l,_,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1==y.__i?p:_[y.__i]||p,y.__i=a,g=O(n,y,h,i,r,o,e,f,c,s),w=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&q(h.ref,null,y),s.push(y.ref,y.__c||w,y)),null==d&&null!=w&&(d=w),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&void 0!==g?f=g:w&&(f=w.nextSibling),y.__u&=-7);return u.__e=d,f}function P(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m(null,o,null,null,null):w(o)?m(k,{children:o},null,null,null):null==o.constructor&&o.__b>0?m(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=S(e)),B(e,e));return t}function A(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=S(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o=n.key,e=n.type,f=l[u];if(null===f&&null==n.key||f&&o==f.key&&e==f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e==f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e==f.type)return r;r++;}}return -1}function T(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y.test(l)?u:u+"px";}function j(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||T(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c,n.addEventListener(l,r?a:s,r)):n.removeEventListener(l,r?a:s,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function F(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function O(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,_,m,b,S,C,M,$,P,A,H,L,T,j=u.type;if(null!=u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof j)try{if(b=u.props,S="prototype"in j&&j.prototype.render,C=(a=j.contextType)&&i[a.__c],M=a?C?C.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(S?u.__c=h=new j(b,M):(u.__c=h=new x(b,M),h.constructor=j,h.render=D),C&&C.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=j.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d({},h.__s)),d(h.__s,j.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)S&&null==j.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(S&&null==j.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,_);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,P=l.__r,A=0,S){for(h.state=h.__s,h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=d(d({},i),h.getChildContext())),S&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,y)),L=a,null!=a&&a.type===k&&null==a.key&&(L=N(a.props.children)),f=I(n,w(L)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else for(T=o.length;T--;)g(o[T]);else u.__e=t.__e,u.__k=t.__k;l.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=V(t.__e,u,t,i,r,o,e,c,s);return (a=l.diffed)&&a(u),128&u.__u?void 0:f}function z(n,u,t){for(var i=0;i<t.length;i++)q(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function N(n){return "object"!=typeof n||null==n||n.__b&&n.__b>0?n:w(n)?n.map(N):d({},n)}function V(u,t,i,r,o,e,f,c,s){var a,h,v,y,d,_,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((d=e[a])&&"setAttribute"in d==!!x&&(x?d.localName==x:3==d.nodeType)){u=d,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=false),e=null;}if(null==x)b===k||c&&u.data==k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(d=u.attributes[a]).name]=d.value;for(a in b)if(d=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=d;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;j(u,a,null,d,o);}for(a in k)d=k[a],"children"==a?y=d:"dangerouslySetInnerHTML"==a?h=d:"value"==a?_=d:"checked"==a?m=d:c&&"function"!=typeof d||b[a]===d||j(u,a,d,b[a],o);if(h)c||v&&(h.__html==v.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),I("template"==t.type?u.content:u,w(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&S(i,0),c,s),null!=e)for(a=e.length;a--;)g(e[a]);c||(a="value","progress"==x&&null==_?u.removeAttribute("value"):null!=_&&(_!==u[a]||"progress"==x&&!_||"option"==x&&_!=b[a])&&j(u,a,_,b[a],o),a="checked",null!=m&&m!=u[a]&&j(u,a,m,b[a],o));}return u}function q(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l.__e(n,t);}}function B(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||q(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&B(i[r],u,t||"function"!=typeof n.type);t||g(n.__e),n.__c=n.__=n.__e=void 0;}function D(n,l,u){return this.constructor(n,u)}function E(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],O(t,u=(t).__k=_(k,null,[u]),o||p,p,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),z(e,u,f);}function J(l,u,t){var i,r,o,e,f=d({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m(l.type,f,i||l.key,r||l.ref,null)}n=v.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},x.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=d({},this.state),"function"==typeof n&&(n=n(d({},u),this.props)),n&&d(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x.prototype.render=k,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},$.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=F(false),a=F(true);
169436
+ var n,l,u,t,i,r,o,e,f,c,s,a,p={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w=Array.isArray;function d(n,l){for(var u in l)n[u]=l[u];return n}function g(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function _(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return m(l,e,i,r,null)}function m(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function k(n){return n.children}function x(n,l){this.props=n,this.context=l;}function S(n,l){if(null==l)return n.__?S(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?S(n):null}function C(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C(n)}}function M(n){(!n.__d&&(n.__d=true)&&i.push(n)&&!$.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)($);}function $(){for(var n,u,t,r,o,f,c,s=1;i.length;)i.length>s&&i.sort(e),n=i.shift(),s=i.length,n.__d&&(t=void 0,o=(r=(u=n).__v).__e,f=[],c=[],u.__P&&((t=d({},r)).__v=r.__v+1,l.vnode&&l.vnode(t),O(u.__P,t,r,u.__n,u.__P.namespaceURI,32&r.__u?[o]:null,f,null==o?S(r):o,!!(32&r.__u),c),t.__v=r.__v,t.__.__k[t.__i]=t,N(f,t,c),t.__e!=o&&C(t)));$.__r=0;}function I(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,w,d,g,_=t&&t.__k||v,m=l.length;for(f=P(u,l,_,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1==y.__i?p:_[y.__i]||p,y.__i=a,g=O(n,y,h,i,r,o,e,f,c,s),w=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&B(h.ref,null,y),s.push(y.ref,y.__c||w,y)),null==d&&null!=w&&(d=w),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&void 0!==g?f=g:w&&(f=w.nextSibling),y.__u&=-7);return u.__e=d,f}function P(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m(null,o,null,null,null):w(o)?m(k,{children:o},null,null,null):null==o.constructor&&o.__b>0?m(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=S(e)),D(e,e));return t}function A(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=S(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],s=null!=c&&0==(2&c.__u);if(null===c&&null==n.key||s&&e==c.key&&f==c.type)return u;if(t>(s?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function T(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y.test(l)?u:u+"px";}function j(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||T(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c,n.addEventListener(l,r?a:s,r)):n.removeEventListener(l,r?a:s,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function F(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function O(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,_,m,b,S,C,M,$,P,A,H,L,T,j=u.type;if(null!=u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof j)try{if(b=u.props,S="prototype"in j&&j.prototype.render,C=(a=j.contextType)&&i[a.__c],M=a?C?C.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(S?u.__c=h=new j(b,M):(u.__c=h=new x(b,M),h.constructor=j,h.render=E),C&&C.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=j.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d({},h.__s)),d(h.__s,j.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)S&&null==j.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(S&&null==j.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,_);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,P=l.__r,A=0,S){for(h.state=h.__s,h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=d(d({},i),h.getChildContext())),S&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,y)),L=a,null!=a&&a.type===k&&null==a.key&&(L=V(a.props.children)),f=I(n,w(L)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else {for(T=o.length;T--;)g(o[T]);z(u);}else u.__e=t.__e,u.__k=t.__k,n.then||z(u);l.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=q(t.__e,u,t,i,r,o,e,c,s);return (a=l.diffed)&&a(u),128&u.__u?void 0:f}function z(n){n&&n.__c&&(n.__c.__e=true),n&&n.__k&&n.__k.forEach(z);}function N(n,u,t){for(var i=0;i<t.length;i++)B(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function V(n){return "object"!=typeof n||null==n||n.__b&&n.__b>0?n:w(n)?n.map(V):d({},n)}function q(u,t,i,r,o,e,f,c,s){var a,h,v,y,d,_,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((d=e[a])&&"setAttribute"in d==!!x&&(x?d.localName==x:3==d.nodeType)){u=d,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=false),e=null;}if(null==x)b===k||c&&u.data==k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(d=u.attributes[a]).name]=d.value;for(a in b)if(d=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=d;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;j(u,a,null,d,o);}for(a in k)d=k[a],"children"==a?y=d:"dangerouslySetInnerHTML"==a?h=d:"value"==a?_=d:"checked"==a?m=d:c&&"function"!=typeof d||b[a]===d||j(u,a,d,b[a],o);if(h)c||v&&(h.__html==v.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),I("template"==t.type?u.content:u,w(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&S(i,0),c,s),null!=e)for(a=e.length;a--;)g(e[a]);c||(a="value","progress"==x&&null==_?u.removeAttribute("value"):null!=_&&(_!==u[a]||"progress"==x&&!_||"option"==x&&_!=b[a])&&j(u,a,_,b[a],o),a="checked",null!=m&&m!=u[a]&&j(u,a,m,b[a],o));}return u}function B(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l.__e(n,t);}}function D(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||B(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&D(i[r],u,t||"function"!=typeof n.type);t||g(n.__e),n.__c=n.__=n.__e=void 0;}function E(n,l,u){return this.constructor(n,u)}function G(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],O(t,u=(t).__k=_(k,null,[u]),o||p,p,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),N(e,u,f);}function K(l,u,t){var i,r,o,e,f=d({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m(l.type,f,i||l.key,r||l.ref,null)}n=v.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},x.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=d({},this.state),"function"==typeof n&&(n=n(d({},u),this.props)),n&&d(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x.prototype.render=k,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},$.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=F(false),a=F(true);
169023
169437
 
169024
169438
  function _arrayLikeToArray$2(r, a) {
169025
169439
  (null == a || a > r.length) && (a = r.length);
@@ -169122,7 +169536,7 @@ var<${access}> ${ name } : ${ structName };`;
169122
169536
  var _reactElement2VNode = function reactElement2VNode(el) {
169123
169537
  // Among other things, react VNodes (and all its children) need to have constructor: undefined attributes in order to be recognised, cloneElement (applied recursively) does the necessary conversion
169124
169538
  if (!(_typeof(el) === 'object')) return el;
169125
- var res = J(el);
169539
+ var res = K(el);
169126
169540
  if (res.props) {
169127
169541
  var _res$props;
169128
169542
  res.props = _objectSpread2$1({}, res.props);
@@ -169133,11 +169547,11 @@ var<${access}> ${ name } : ${ structName };`;
169133
169547
  return res;
169134
169548
  };
169135
169549
  var isReactRenderable = function isReactRenderable(o) {
169136
- return t(J(o));
169550
+ return t(K(o));
169137
169551
  };
169138
169552
  var render = function render(jsx, domEl) {
169139
169553
  delete domEl.__k; // Wipe traces of previous preact renders
169140
- E(_reactElement2VNode(jsx), domEl);
169554
+ G(_reactElement2VNode(jsx), domEl);
169141
169555
  };
169142
169556
 
169143
169557
  function styleInject$2(css, ref) {
@@ -169548,7 +169962,7 @@ var<${access}> ${ name } : ${ structName };`;
169548
169962
  }
169549
169963
  function setLookAt(lookAt) {
169550
169964
  var lookAtVect = new three.Vector3(lookAt.x, lookAt.y, lookAt.z);
169551
- if (state.controls.target) {
169965
+ if (state.controls.enabled && state.controls.target) {
169552
169966
  state.controls.target = lookAtVect;
169553
169967
  } else {
169554
169968
  // Fly controls doesn't have target attribute
@@ -169707,9 +170121,9 @@ var<${access}> ${ name } : ${ structName };`;
169707
170121
 
169708
170122
  // detect point drag
169709
170123
  !state.isPointerDragging && ev.type === 'pointermove' && (ev.pressure > 0 || state.isPointerPressed) // ev.pressure always 0 on Safari, so we used the isPointerPressed tracker
169710
- && (ev.pointerType !== 'touch' || ev.movementX === undefined || [ev.movementX, ev.movementY].some(function (m) {
170124
+ && (ev.pointerType === 'mouse' || ev.movementX === undefined || [ev.movementX, ev.movementY].some(function (m) {
169711
170125
  return Math.abs(m) > 1;
169712
- })) // relax drag trigger sensitivity on touch events
170126
+ })) // relax drag trigger sensitivity on non-mouse (touch/pen) events
169713
170127
  && (state.isPointerDragging = true);
169714
170128
  if (state.enablePointerInteraction) {
169715
170129
  // update the pointer pos
@@ -170066,7 +170480,7 @@ var<${access}> ${ name } : ${ structName };`;
170066
170480
 
170067
170481
  // Expose config from ThreeGlobe
170068
170482
  var bindGlobe = linkKapsule('globe', threeGlobe);
170069
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'globeTileEngineUrl', 'globeTileEngineMaxLevel', 'globeCurvatureResolution', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'particlesData', 'particlesList', 'particleLat', 'particleLng', 'particleAltitude', 'particlesSize', 'particlesSizeAttenuation', 'particlesColor', 'particlesTexture', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlElementVisibilityModifier', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
170483
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'globeTileEngineUrl', 'globeTileEngineMaxLevel', 'globeCurvatureResolution', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcStartAltitude', 'arcEndLat', 'arcEndLng', 'arcEndAltitude', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'particlesData', 'particlesList', 'particleLat', 'particleLng', 'particleAltitude', 'particlesSize', 'particlesSizeAttenuation', 'particlesColor', 'particlesTexture', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlElementVisibilityModifier', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
170070
170484
  return _defineProperty({}, p, bindGlobe.linkProp(p));
170071
170485
  })));
170072
170486
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {