@plastic-software/three 0.179.0 → 0.180.1

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.
Files changed (173) hide show
  1. package/build/three.cjs +167 -107
  2. package/build/three.core.js +112 -20
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +56 -90
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +30 -5
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +2896 -1048
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +2896 -1048
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +1 -1
  13. package/examples/jsm/controls/ArcballControls.js +7 -7
  14. package/examples/jsm/controls/DragControls.js +6 -56
  15. package/examples/jsm/controls/FirstPersonControls.js +2 -2
  16. package/examples/jsm/controls/PointerLockControls.js +0 -8
  17. package/examples/jsm/exporters/GLTFExporter.js +30 -22
  18. package/examples/jsm/exporters/KTX2Exporter.js +4 -2
  19. package/examples/jsm/exporters/PLYExporter.js +1 -1
  20. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  21. package/examples/jsm/lines/Line2.js +3 -3
  22. package/examples/jsm/lines/LineGeometry.js +1 -1
  23. package/examples/jsm/lines/LineSegments2.js +2 -2
  24. package/examples/jsm/lines/Wireframe.js +2 -2
  25. package/examples/jsm/lines/WireframeGeometry2.js +1 -1
  26. package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
  27. package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
  28. package/examples/jsm/loaders/ColladaLoader.js +1 -1
  29. package/examples/jsm/loaders/EXRLoader.js +5 -5
  30. package/examples/jsm/loaders/GLTFLoader.js +9 -5
  31. package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
  32. package/examples/jsm/loaders/HDRLoader.js +486 -0
  33. package/examples/jsm/loaders/KTX2Loader.js +112 -32
  34. package/examples/jsm/loaders/RGBELoader.js +7 -473
  35. package/examples/jsm/loaders/TTFLoader.js +4 -4
  36. package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
  37. package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
  38. package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
  39. package/examples/jsm/math/ColorSpaces.js +19 -1
  40. package/examples/jsm/math/ConvexHull.js +2 -2
  41. package/examples/jsm/math/Lut.js +2 -2
  42. package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
  43. package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
  44. package/examples/jsm/misc/Volume.js +1 -1
  45. package/examples/jsm/postprocessing/OutlinePass.js +1 -1
  46. package/examples/jsm/postprocessing/SSRPass.js +37 -8
  47. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +1 -1
  48. package/examples/jsm/transpiler/GLSLDecoder.js +22 -19
  49. package/examples/jsm/transpiler/TSLEncoder.js +2 -10
  50. package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
  51. package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
  52. package/examples/jsm/tsl/display/BloomNode.js +3 -3
  53. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
  54. package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
  55. package/examples/jsm/tsl/display/GTAONode.js +8 -0
  56. package/examples/jsm/tsl/display/GaussianBlurNode.js +47 -35
  57. package/examples/jsm/tsl/display/OutlineNode.js +2 -2
  58. package/examples/jsm/tsl/display/SSRNode.js +180 -65
  59. package/examples/jsm/tsl/display/TRAANode.js +1 -1
  60. package/examples/jsm/tsl/display/boxBlur.js +64 -0
  61. package/examples/jsm/tsl/display/hashBlur.js +15 -18
  62. package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
  63. package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
  64. package/examples/jsm/webxr/OculusHandModel.js +1 -1
  65. package/package.json +1 -1
  66. package/src/Three.Core.js +1 -0
  67. package/src/Three.TSL.js +29 -4
  68. package/src/animation/AnimationClip.js +17 -2
  69. package/src/constants.js +11 -3
  70. package/src/core/BufferGeometry.js +2 -2
  71. package/src/extras/TextureUtils.js +2 -1
  72. package/src/extras/lib/earcut.js +1 -1
  73. package/src/lights/webgpu/ProjectorLight.js +1 -1
  74. package/src/materials/Material.js +12 -0
  75. package/src/materials/MeshDistanceMaterial.js +1 -1
  76. package/src/materials/nodes/PointsNodeMaterial.js +81 -28
  77. package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
  78. package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
  79. package/src/math/ColorManagement.js +7 -1
  80. package/src/nodes/Nodes.js +3 -0
  81. package/src/nodes/TSL.js +3 -0
  82. package/src/nodes/accessors/BufferNode.js +1 -1
  83. package/src/nodes/accessors/Camera.js +133 -7
  84. package/src/nodes/accessors/ClippingNode.js +6 -5
  85. package/src/nodes/accessors/CubeTextureNode.js +2 -2
  86. package/src/nodes/accessors/InstanceNode.js +3 -1
  87. package/src/nodes/accessors/Object3DNode.js +1 -1
  88. package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
  89. package/src/nodes/accessors/ReferenceNode.js +1 -1
  90. package/src/nodes/accessors/Texture3DNode.js +13 -0
  91. package/src/nodes/accessors/TextureNode.js +71 -19
  92. package/src/nodes/code/FunctionCallNode.js +19 -0
  93. package/src/nodes/code/FunctionNode.js +23 -0
  94. package/src/nodes/core/AssignNode.js +4 -3
  95. package/src/nodes/core/ContextNode.js +24 -0
  96. package/src/nodes/core/Node.js +16 -20
  97. package/src/nodes/core/NodeBuilder.js +48 -14
  98. package/src/nodes/core/NodeFrame.js +1 -1
  99. package/src/nodes/core/NodeUniform.js +1 -1
  100. package/src/nodes/core/NodeUtils.js +1 -2
  101. package/src/nodes/core/StackNode.js +29 -4
  102. package/src/nodes/core/StructNode.js +5 -5
  103. package/src/nodes/core/StructTypeNode.js +1 -0
  104. package/src/nodes/core/SubBuildNode.js +2 -2
  105. package/src/nodes/core/UniformNode.js +16 -9
  106. package/src/nodes/core/VarNode.js +0 -21
  107. package/src/nodes/display/FrontFacingNode.js +4 -8
  108. package/src/nodes/display/PassNode.js +1 -1
  109. package/src/nodes/display/ScreenNode.js +42 -13
  110. package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
  111. package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
  112. package/src/nodes/display/ViewportTextureNode.js +42 -12
  113. package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
  114. package/src/nodes/lighting/LightsNode.js +1 -1
  115. package/src/nodes/math/BitcastNode.js +156 -0
  116. package/src/nodes/math/ConditionalNode.js +18 -2
  117. package/src/nodes/math/MathNode.js +3 -15
  118. package/src/nodes/math/OperatorNode.js +4 -3
  119. package/src/nodes/tsl/TSLCore.js +432 -152
  120. package/src/nodes/utils/JoinNode.js +3 -1
  121. package/src/nodes/utils/MemberNode.js +58 -7
  122. package/src/nodes/utils/RTTNode.js +1 -1
  123. package/src/nodes/utils/ReflectorNode.js +51 -7
  124. package/src/nodes/utils/SampleNode.js +12 -2
  125. package/src/nodes/utils/SplitNode.js +11 -0
  126. package/src/nodes/utils/Timer.js +0 -47
  127. package/src/objects/BatchedMesh.js +2 -2
  128. package/src/objects/LOD.js +1 -1
  129. package/src/objects/Sprite.js +2 -2
  130. package/src/renderers/WebGLRenderer.js +1 -10
  131. package/src/renderers/common/Attributes.js +1 -1
  132. package/src/renderers/common/Backend.js +19 -1
  133. package/src/renderers/common/Bindings.js +2 -0
  134. package/src/renderers/common/ChainMap.js +1 -1
  135. package/src/renderers/common/DataMap.js +1 -1
  136. package/src/renderers/common/Pipelines.js +1 -1
  137. package/src/renderers/common/RenderContext.js +2 -2
  138. package/src/renderers/common/RenderObject.js +14 -2
  139. package/src/renderers/common/Renderer.js +39 -19
  140. package/src/renderers/common/SampledTexture.js +1 -1
  141. package/src/renderers/common/Sampler.js +25 -13
  142. package/src/renderers/common/Textures.js +34 -12
  143. package/src/renderers/common/TimestampQueryPool.js +3 -3
  144. package/src/renderers/common/XRManager.js +35 -19
  145. package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
  146. package/src/renderers/common/nodes/NodeLibrary.js +5 -5
  147. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
  148. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  149. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
  150. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
  151. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -15
  152. package/src/renderers/shaders/ShaderLib/depth.glsl.js +1 -1
  153. package/src/renderers/webgl/WebGLProgram.js +4 -4
  154. package/src/renderers/webgl/WebGLShadowMap.js +1 -1
  155. package/src/renderers/webgl/WebGLTextures.js +1 -0
  156. package/src/renderers/webgl/WebGLUtils.js +3 -2
  157. package/src/renderers/webgl-fallback/WebGLBackend.js +186 -135
  158. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +110 -17
  159. package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
  160. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
  161. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
  162. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
  163. package/src/renderers/webgpu/WebGPUBackend.js +35 -31
  164. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +124 -34
  165. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
  166. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +9 -18
  167. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +114 -25
  168. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
  169. package/src/renderers/webxr/WebXRManager.js +39 -24
  170. package/src/textures/ExternalTexture.js +15 -4
  171. package/src/textures/Source.js +1 -1
  172. package/src/textures/VideoTexture.js +0 -3
  173. package/examples/jsm/loaders/RGBMLoader.js +0 -1148
@@ -18,17 +18,6 @@ class Sampler extends Binding {
18
18
 
19
19
  super( name );
20
20
 
21
- /**
22
- * This function is called when the texture is disposed.
23
- * @type {function}
24
- * @private
25
- */
26
- this._onDisposeTexture = () => {
27
-
28
- this.texture = null;
29
-
30
- };
31
-
32
21
  /**
33
22
  * The texture the sampler is referring to.
34
23
  *
@@ -71,9 +60,17 @@ class Sampler extends Binding {
71
60
 
72
61
  if ( this._texture === value ) return;
73
62
 
63
+ const onDispose = () => {
64
+
65
+ this._texture = null;
66
+ this.generation = null;
67
+ this.version = 0;
68
+
69
+ };
70
+
74
71
  if ( this._texture ) {
75
72
 
76
- this._texture.removeEventListener( 'dispose', this._onDisposeTexture );
73
+ this._texture.removeEventListener( 'dispose', onDispose );
77
74
 
78
75
  }
79
76
 
@@ -84,7 +81,7 @@ class Sampler extends Binding {
84
81
 
85
82
  if ( this._texture ) {
86
83
 
87
- this._texture.addEventListener( 'dispose', this._onDisposeTexture );
84
+ this._texture.addEventListener( 'dispose', onDispose );
88
85
 
89
86
  }
90
87
 
@@ -122,6 +119,21 @@ class Sampler extends Binding {
122
119
 
123
120
  }
124
121
 
122
+
123
+ clone() {
124
+
125
+ const clonedSampler = super.clone();
126
+
127
+ // fix dispose handler for cloned instances
128
+ // TODO: Find better solution, see #31747
129
+
130
+ clonedSampler._texture = null;
131
+ clonedSampler.texture = this.texture;
132
+
133
+ return clonedSampler;
134
+
135
+ }
136
+
125
137
  }
126
138
 
127
139
  export default Sampler;
@@ -2,7 +2,8 @@ import DataMap from './DataMap.js';
2
2
 
3
3
  import { Vector3 } from '../../math/Vector3.js';
4
4
  import { DepthTexture } from '../../textures/DepthTexture.js';
5
- import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType } from '../../constants.js';
5
+ import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType, SRGBTransfer } from '../../constants.js';
6
+ import { ColorManagement } from '../../math/ColorManagement.js';
6
7
 
7
8
  const _size = /*@__PURE__*/ new Vector3();
8
9
 
@@ -178,6 +179,7 @@ class Textures extends DataMap {
178
179
  }
179
180
 
180
181
  this.delete( renderTarget );
182
+ this.backend.delete( renderTarget );
181
183
 
182
184
  };
183
185
 
@@ -240,9 +242,15 @@ class Textures extends DataMap {
240
242
  options.needsMipmaps = this.needsMipmaps( texture );
241
243
  options.levels = options.needsMipmaps ? this.getMipLevels( texture, width, height ) : 1;
242
244
 
245
+ // TODO: Uniformly handle mipmap definitions
246
+ // Normal textures and compressed cube textures define base level + mips with their mipmap array
247
+ // Uncompressed cube textures use their mipmap array only for mips (no base level)
248
+
249
+ if ( texture.isCubeTexture && texture.mipmaps.length > 0 ) options.levels ++;
250
+
243
251
  //
244
252
 
245
- if ( isRenderTarget || texture.isStorageTexture === true ) {
253
+ if ( isRenderTarget || texture.isStorageTexture === true || texture.isExternalTexture === true ) {
246
254
 
247
255
  backend.createSampler( texture );
248
256
  backend.createTexture( texture, options );
@@ -300,6 +308,8 @@ class Textures extends DataMap {
300
308
 
301
309
  if ( options.needsMipmaps && texture.mipmaps.length === 0 ) backend.generateMipmaps( texture );
302
310
 
311
+ if ( texture.onUpdate ) texture.onUpdate( texture );
312
+
303
313
  }
304
314
 
305
315
  } else {
@@ -326,6 +336,14 @@ class Textures extends DataMap {
326
336
 
327
337
  this.info.memory.textures ++;
328
338
 
339
+ //
340
+
341
+ if ( texture.isVideoTexture && ColorManagement.getTransfer( texture.colorSpace ) !== SRGBTransfer ) {
342
+
343
+ console.warn( 'WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace.' );
344
+
345
+ }
346
+
329
347
  // dispose
330
348
 
331
349
  const onDispose = () => {
@@ -366,7 +384,7 @@ class Textures extends DataMap {
366
384
 
367
385
  if ( image.image !== undefined ) image = image.image;
368
386
 
369
- if ( image instanceof HTMLVideoElement ) {
387
+ if ( ( typeof HTMLVideoElement !== 'undefined' ) && ( image instanceof HTMLVideoElement ) ) {
370
388
 
371
389
  target.width = image.videoWidth || 1;
372
390
  target.height = image.videoHeight || 1;
@@ -408,21 +426,25 @@ class Textures extends DataMap {
408
426
 
409
427
  let mipLevelCount;
410
428
 
411
- if ( texture.isCompressedTexture ) {
429
+ if ( texture.mipmaps.length > 0 ) {
430
+
431
+ mipLevelCount = texture.mipmaps.length;
412
432
 
413
- if ( texture.mipmaps ) {
433
+ } else {
414
434
 
415
- mipLevelCount = texture.mipmaps.length;
435
+ if ( texture.isCompressedTexture === true ) {
416
436
 
417
- } else {
437
+ // it is not possible to compute mipmaps for compressed textures. So
438
+ // when no mipmaps are defined in "texture.mipmaps", force a texture
439
+ // level of 1
418
440
 
419
441
  mipLevelCount = 1;
420
442
 
421
- }
443
+ } else {
422
444
 
423
- } else {
445
+ mipLevelCount = Math.floor( Math.log2( Math.max( width, height ) ) ) + 1;
424
446
 
425
- mipLevelCount = Math.floor( Math.log2( Math.max( width, height ) ) ) + 1;
447
+ }
426
448
 
427
449
  }
428
450
 
@@ -431,14 +453,14 @@ class Textures extends DataMap {
431
453
  }
432
454
 
433
455
  /**
434
- * Returns `true` if the given texture requires mipmaps.
456
+ * Returns `true` if the given texture makes use of mipmapping.
435
457
  *
436
458
  * @param {Texture} texture - The texture.
437
459
  * @return {boolean} Whether mipmaps are required or not.
438
460
  */
439
461
  needsMipmaps( texture ) {
440
462
 
441
- return texture.isCompressedTexture === true || texture.generateMipmaps;
463
+ return texture.generateMipmaps === true || texture.mipmaps.length > 0;
442
464
 
443
465
  }
444
466
 
@@ -70,13 +70,13 @@ class TimestampQueryPool {
70
70
  }
71
71
 
72
72
  /**
73
- * Allocate queries for a specific renderContext.
73
+ * Allocate queries for a specific uid.
74
74
  *
75
75
  * @abstract
76
- * @param {Object} renderContext - The render context to allocate queries for.
76
+ * @param {string} uid - A unique identifier for the render context.
77
77
  * @returns {?number}
78
78
  */
79
- allocateQueriesForContext( /* renderContext */ ) {}
79
+ allocateQueriesForContext( /* uid */ ) {}
80
80
 
81
81
  /**
82
82
  * Resolve all timestamps and return data (or process them).
@@ -164,12 +164,12 @@ class XRManager extends EventDispatcher {
164
164
  this._layers = [];
165
165
 
166
166
  /**
167
- * Whether the device has support for all layer types.
167
+ * Whether the XR session uses layers.
168
168
  *
169
169
  * @type {boolean}
170
170
  * @default false
171
171
  */
172
- this._supportsLayers = false;
172
+ this._sessionUsesLayers = false;
173
173
 
174
174
  /**
175
175
  * Whether the device supports binding gl objects.
@@ -360,13 +360,16 @@ class XRManager extends EventDispatcher {
360
360
  this._xrFrame = null;
361
361
 
362
362
  /**
363
- * Whether to use the WebXR Layers API or not.
363
+ * Whether the browser supports the APIs necessary to use XRProjectionLayers.
364
+ *
365
+ * Note: this does not represent XRSession explicitly requesting
366
+ * `'layers'` as a feature - see `_sessionUsesLayers` and #30112
364
367
  *
365
368
  * @private
366
369
  * @type {boolean}
367
370
  * @readonly
368
371
  */
369
- this._useLayers = ( this._supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype ); // eslint-disable-line compat/compat
372
+ this._supportsLayers = ( this._supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype ); // eslint-disable-line compat/compat
370
373
 
371
374
  /**
372
375
  * Whether the usage of multiview has been requested by the application or not.
@@ -587,6 +590,27 @@ class XRManager extends EventDispatcher {
587
590
 
588
591
  }
589
592
 
593
+
594
+ /**
595
+ * Returns the current XR binding.
596
+ *
597
+ * Creates a new binding if needed and the browser is
598
+ * capable of doing so.
599
+ *
600
+ * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.
601
+ */
602
+ getBinding() {
603
+
604
+ if ( this._glBinding === null && this._supportsGlBinding ) {
605
+
606
+ this._glBinding = new XRWebGLBinding( this._session, this._gl );
607
+
608
+ }
609
+
610
+ return this._glBinding;
611
+
612
+ }
613
+
590
614
  /**
591
615
  * Returns the current XR frame.
592
616
  *
@@ -817,7 +841,7 @@ class XRManager extends EventDispatcher {
817
841
  layer.renderTarget.isXRRenderTarget = this._session !== null;
818
842
  layer.renderTarget._hasExternalTextures = layer.renderTarget.isXRRenderTarget;
819
843
 
820
- if ( layer.renderTarget.isXRRenderTarget && this._supportsLayers ) {
844
+ if ( layer.renderTarget.isXRRenderTarget && this._sessionUsesLayers ) {
821
845
 
822
846
  layer.xrlayer.transform = new XRRigidTransform( layer.plane.getWorldPosition( translationObject ), layer.plane.getWorldQuaternion( quaternionObject ) );
823
847
 
@@ -924,16 +948,7 @@ class XRManager extends EventDispatcher {
924
948
 
925
949
  //
926
950
 
927
- if ( this._supportsGlBinding ) {
928
-
929
- const glBinding = new XRWebGLBinding( session, gl );
930
- this._glBinding = glBinding;
931
-
932
- }
933
-
934
- //
935
-
936
- if ( this._useLayers === true ) {
951
+ if ( this._supportsLayers === true ) {
937
952
 
938
953
  // default path using XRProjectionLayer
939
954
 
@@ -963,6 +978,7 @@ class XRManager extends EventDispatcher {
963
978
 
964
979
  }
965
980
 
981
+ this._glBinding = this.getBinding();
966
982
  const glProjLayer = this._glBinding.createProjectionLayer( projectionlayerInit );
967
983
  const layersArray = [ glProjLayer ];
968
984
 
@@ -993,11 +1009,11 @@ class XRManager extends EventDispatcher {
993
1009
  this._xrRenderTarget._hasExternalTextures = true;
994
1010
  this._xrRenderTarget.depth = this._useMultiview ? 2 : 1;
995
1011
 
996
- this._supportsLayers = session.enabledFeatures.includes( 'layers' );
1012
+ this._sessionUsesLayers = session.enabledFeatures.includes( 'layers' );
997
1013
 
998
1014
  this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() );
999
1015
 
1000
- if ( this._supportsLayers ) {
1016
+ if ( this._sessionUsesLayers ) {
1001
1017
 
1002
1018
  // switch layers to native
1003
1019
  for ( const layer of this._layers ) {
@@ -1366,7 +1382,7 @@ function onSessionEnd() {
1366
1382
  this._xrRenderTarget = null;
1367
1383
 
1368
1384
  // switch layers back to emulated
1369
- if ( this._supportsLayers === true ) {
1385
+ if ( this._sessionUsesLayers === true ) {
1370
1386
 
1371
1387
  for ( const layer of this._layers ) {
1372
1388
 
@@ -1568,7 +1584,7 @@ function onAnimationFrame( time, frame ) {
1568
1584
 
1569
1585
  let viewport;
1570
1586
 
1571
- if ( this._useLayers === true ) {
1587
+ if ( this._supportsLayers === true ) {
1572
1588
 
1573
1589
  const glSubImage = this._glBinding.getViewSubImage( this._glProjLayer, view );
1574
1590
  viewport = glSubImage.viewport;
@@ -126,7 +126,7 @@ class NodeBuilderState {
126
126
 
127
127
  if ( shared !== true ) {
128
128
 
129
- const bindingsGroup = new BindGroup( instanceGroup.name, [], instanceGroup.index, instanceGroup );
129
+ const bindingsGroup = new BindGroup( instanceGroup.name, [], instanceGroup.index, instanceGroup.bindingsReference );
130
130
  bindings.push( bindingsGroup );
131
131
 
132
132
  for ( const instanceBinding of instanceGroup.bindings ) {
@@ -146,9 +146,9 @@ class NodeLibrary {
146
146
  /**
147
147
  * Adds a node class definition for the given type to the provided type library.
148
148
  *
149
- * @param {any} nodeClass - The node class definition.
149
+ * @param {Node.constructor} nodeClass - The node class definition.
150
150
  * @param {number|string} type - The object type.
151
- * @param {Map} library - The type library.
151
+ * @param {Map<number|string,Node.constructor>} library - The type library.
152
152
  */
153
153
  addType( nodeClass, type, library ) {
154
154
 
@@ -169,9 +169,9 @@ class NodeLibrary {
169
169
  /**
170
170
  * Adds a node class definition for the given class definition to the provided type library.
171
171
  *
172
- * @param {any} nodeClass - The node class definition.
173
- * @param {any} baseClass - The class definition.
174
- * @param {WeakMap} library - The type library.
172
+ * @param {Node.constructor} nodeClass - The node class definition.
173
+ * @param {Node.constructor} baseClass - The class definition.
174
+ * @param {WeakMap<Node.constructor, Node.constructor>} library - The type library.
175
175
  */
176
176
  addClass( nodeClass, baseClass, library ) {
177
177
 
@@ -1,5 +1,5 @@
1
1
  export default /* glsl */`
2
- #if defined( USE_LOGDEPTHBUF )
2
+ #if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
3
3
 
4
4
  // Doing a strict comparison with == 1.0 can cause noise artifacts
5
5
  // on some platforms. See issue #17623.
@@ -1,5 +1,5 @@
1
1
  export default /* glsl */`
2
- #if defined( USE_LOGDEPTHBUF )
2
+ #if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
3
3
 
4
4
  uniform float logDepthBufFC;
5
5
  varying float vFragDepth;
@@ -1,5 +1,5 @@
1
1
  export default /* glsl */`
2
- #ifdef USE_LOGDEPTHBUF
2
+ #ifdef USE_LOGARITHMIC_DEPTH_BUFFER
3
3
 
4
4
  varying float vFragDepth;
5
5
  varying float vIsPerspective;
@@ -1,5 +1,5 @@
1
1
  export default /* glsl */`
2
- #ifdef USE_LOGDEPTHBUF
2
+ #ifdef USE_LOGARITHMIC_DEPTH_BUFFER
3
3
 
4
4
  vFragDepth = 1.0 + gl_Position.w;
5
5
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
@@ -65,19 +65,11 @@ export default /* glsl */`
65
65
 
66
66
  #endif
67
67
 
68
- /*
69
- #if NUM_RECT_AREA_LIGHTS > 0
70
-
71
- // TODO (abelnation): create uniforms for area light shadows
72
-
73
- #endif
74
- */
75
-
76
68
  float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
77
69
 
78
70
  float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
79
71
 
80
- #ifdef USE_REVERSEDEPTHBUF
72
+ #ifdef USE_REVERSED_DEPTH_BUFFER
81
73
 
82
74
  return step( depth, compare );
83
75
 
@@ -95,25 +87,25 @@ export default /* glsl */`
95
87
 
96
88
  }
97
89
 
98
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
90
+ float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
99
91
 
100
92
  float occlusion = 1.0;
101
93
 
102
94
  vec2 distribution = texture2DDistribution( shadow, uv );
103
95
 
104
- #ifdef USE_REVERSEDEPTHBUF
96
+ #ifdef USE_REVERSED_DEPTH_BUFFER
105
97
 
106
- float hard_shadow = step( distribution.x, compare ); // Hard Shadow
98
+ float hard_shadow = step( distribution.x, compare );
107
99
 
108
100
  #else
109
101
 
110
- float hard_shadow = step( compare , distribution.x ); // Hard Shadow
102
+ float hard_shadow = step( compare, distribution.x );
111
103
 
112
104
  #endif
113
105
 
114
- if (hard_shadow != 1.0 ) {
106
+ if ( hard_shadow != 1.0 ) {
115
107
 
116
- float distance = compare - distribution.x ;
108
+ float distance = compare - distribution.x;
117
109
  float variance = max( 0.00000, distribution.y * distribution.y );
118
110
  float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality
119
111
  softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed
@@ -83,7 +83,7 @@ void main() {
83
83
 
84
84
  // Higher precision equivalent of gl_FragCoord.z
85
85
 
86
- #ifdef USE_REVERSEDEPTHBUF
86
+ #ifdef USE_REVERSED_DEPTH_BUFFER
87
87
 
88
88
  float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
89
89
 
@@ -663,8 +663,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
663
663
 
664
664
  parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
665
665
 
666
- parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
667
- parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
666
+ parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
667
+ parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
668
668
 
669
669
  'uniform mat4 modelMatrix;',
670
670
  'uniform mat4 modelViewMatrix;',
@@ -839,8 +839,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
839
839
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
840
840
  parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
841
841
 
842
- parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
843
- parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
842
+ parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
843
+ parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
844
844
 
845
845
  'uniform mat4 modelViewMatrix;',
846
846
  'uniform mat4 viewMatrix;',
@@ -85,7 +85,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
85
85
  // Set GL state for depth map.
86
86
  _state.setBlending( NoBlending );
87
87
 
88
- if ( _state.buffers.depth.getReversed() ) {
88
+ if ( _state.buffers.depth.getReversed() === true ) {
89
89
 
90
90
  _state.buffers.color.setClear( 0, 0, 0, 0 );
91
91
 
@@ -201,6 +201,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
201
201
  if ( glFormat === _gl.RGB ) {
202
202
 
203
203
  if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
204
+ if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
204
205
 
205
206
  }
206
207
 
@@ -1,4 +1,4 @@
1
- import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
1
+ import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat, UnsignedInt101111Type } from '../../constants.js';
2
2
  import { ColorManagement } from '../../math/ColorManagement.js';
3
3
 
4
4
  function WebGLUtils( gl, extensions ) {
@@ -13,6 +13,7 @@ function WebGLUtils( gl, extensions ) {
13
13
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
14
14
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
15
15
  if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
16
+ if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
16
17
 
17
18
  if ( p === ByteType ) return gl.BYTE;
18
19
  if ( p === ShortType ) return gl.SHORT;
@@ -181,7 +182,7 @@ function WebGLUtils( gl, extensions ) {
181
182
 
182
183
  if ( extension !== null ) {
183
184
 
184
- if ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
185
+ if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
185
186
  if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
186
187
  if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
187
188
  if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;