super-three 0.172.0 → 0.173.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.
Files changed (178) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.cjs +439 -380
  3. package/build/three.core.js +413 -41
  4. package/build/three.core.min.js +2 -2
  5. package/build/three.module.js +28 -344
  6. package/build/three.module.min.js +2 -2
  7. package/build/three.tsl.js +11 -3
  8. package/build/three.tsl.min.js +2 -2
  9. package/build/three.webgpu.js +7550 -1798
  10. package/build/three.webgpu.min.js +2 -2
  11. package/build/three.webgpu.nodes.js +7551 -1798
  12. package/build/three.webgpu.nodes.min.js +2 -2
  13. package/examples/jsm/animation/CCDIKSolver.js +6 -5
  14. package/examples/jsm/capabilities/WebGPU.js +1 -1
  15. package/examples/jsm/controls/ArcballControls.js +23 -21
  16. package/examples/jsm/exporters/GLTFExporter.js +26 -25
  17. package/examples/jsm/geometries/TextGeometry.js +1 -12
  18. package/examples/jsm/interactive/InteractiveGroup.js +108 -51
  19. package/examples/jsm/libs/demuxer_mp4.js +109 -0
  20. package/examples/jsm/loaders/GCodeLoader.js +3 -1
  21. package/examples/jsm/loaders/GLTFLoader.js +0 -2
  22. package/examples/jsm/loaders/TDSLoader.js +0 -1
  23. package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
  24. package/examples/jsm/misc/GPUComputationRenderer.js +6 -7
  25. package/examples/jsm/misc/ProgressiveLightMap.js +4 -3
  26. package/examples/jsm/misc/ProgressiveLightMapGPU.js +4 -3
  27. package/examples/jsm/misc/Volume.js +7 -5
  28. package/examples/jsm/misc/VolumeSlice.js +5 -3
  29. package/examples/jsm/objects/WaterMesh.js +25 -20
  30. package/examples/jsm/physics/JoltPhysics.js +7 -7
  31. package/examples/jsm/physics/RapierPhysics.js +4 -4
  32. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  33. package/examples/jsm/shaders/OutputShader.js +5 -1
  34. package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
  35. package/examples/jsm/transpiler/TSLEncoder.js +2 -0
  36. package/package.json +1 -1
  37. package/src/Three.Core.js +2 -0
  38. package/src/Three.TSL.js +9 -1
  39. package/src/cameras/ArrayCamera.js +1 -0
  40. package/src/constants.js +6 -1
  41. package/src/core/BufferAttribute.js +4 -0
  42. package/src/core/EventDispatcher.js +8 -6
  43. package/src/extras/ImageUtils.js +1 -11
  44. package/src/loaders/nodes/NodeObjectLoader.js +1 -1
  45. package/src/materials/nodes/MeshBasicNodeMaterial.js +1 -1
  46. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +1 -1
  47. package/src/materials/nodes/NodeMaterial.js +5 -5
  48. package/src/materials/nodes/NodeMaterials.js +0 -1
  49. package/src/materials/nodes/PointsNodeMaterial.js +109 -7
  50. package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
  51. package/src/materials/nodes/VolumeNodeMaterial.js +3 -3
  52. package/src/materials/nodes/manager/NodeMaterialObserver.js +8 -0
  53. package/src/nodes/Nodes.js +4 -0
  54. package/src/nodes/TSL.js +4 -0
  55. package/src/nodes/accessors/Arrays.js +30 -8
  56. package/src/nodes/accessors/BatchNode.js +3 -3
  57. package/src/nodes/accessors/BufferAttributeNode.js +1 -1
  58. package/src/nodes/accessors/Camera.js +64 -3
  59. package/src/nodes/accessors/InstanceNode.js +1 -1
  60. package/src/nodes/accessors/MaterialNode.js +9 -9
  61. package/src/nodes/accessors/ModelViewProjectionNode.js +1 -1
  62. package/src/nodes/accessors/Normal.js +6 -2
  63. package/src/nodes/accessors/Object3DNode.js +0 -1
  64. package/src/nodes/accessors/Position.js +6 -6
  65. package/src/nodes/accessors/ReferenceBaseNode.js +2 -4
  66. package/src/nodes/accessors/ReferenceNode.js +2 -3
  67. package/src/nodes/accessors/StorageBufferNode.js +42 -5
  68. package/src/nodes/accessors/Tangent.js +2 -2
  69. package/src/nodes/accessors/Texture3DNode.js +1 -1
  70. package/src/nodes/accessors/TextureNode.js +12 -5
  71. package/src/nodes/accessors/UniformArrayNode.js +9 -3
  72. package/src/nodes/accessors/VelocityNode.js +0 -2
  73. package/src/nodes/code/ScriptableNode.js +3 -3
  74. package/src/nodes/core/ArrayNode.js +125 -0
  75. package/src/nodes/core/ConstNode.js +8 -0
  76. package/src/nodes/core/Node.js +14 -1
  77. package/src/nodes/core/NodeBuilder.js +229 -19
  78. package/src/nodes/core/NodeUtils.js +11 -1
  79. package/src/nodes/core/NodeVar.js +17 -1
  80. package/src/nodes/core/OutputStructNode.js +19 -9
  81. package/src/nodes/core/StackNode.js +20 -1
  82. package/src/nodes/core/StructNode.js +121 -0
  83. package/src/nodes/core/StructType.js +13 -0
  84. package/src/nodes/core/StructTypeNode.js +82 -21
  85. package/src/nodes/core/TempNode.js +1 -1
  86. package/src/nodes/core/VarNode.js +94 -7
  87. package/src/nodes/core/VaryingNode.js +19 -3
  88. package/src/nodes/display/BlendModes.js +88 -1
  89. package/src/nodes/display/BumpMapNode.js +6 -6
  90. package/src/nodes/display/NormalMapNode.js +6 -6
  91. package/src/nodes/display/PassNode.js +3 -1
  92. package/src/nodes/display/ScreenNode.js +9 -0
  93. package/src/nodes/fog/Fog.js +17 -0
  94. package/src/nodes/gpgpu/AtomicFunctionNode.js +20 -4
  95. package/src/nodes/gpgpu/ComputeBuiltinNode.js +8 -0
  96. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  97. package/src/nodes/lighting/ShadowNode.js +1 -1
  98. package/src/nodes/math/ConditionalNode.js +8 -1
  99. package/src/nodes/math/MathNode.js +14 -1
  100. package/src/nodes/math/OperatorNode.js +96 -18
  101. package/src/nodes/pmrem/PMREMUtils.js +1 -1
  102. package/src/nodes/shapes/Shapes.js +33 -0
  103. package/src/nodes/tsl/TSLBase.js +1 -0
  104. package/src/nodes/tsl/TSLCore.js +22 -2
  105. package/src/nodes/utils/ArrayElementNode.js +1 -1
  106. package/src/nodes/utils/LoopNode.js +8 -1
  107. package/src/nodes/utils/MemberNode.js +68 -0
  108. package/src/nodes/utils/StorageArrayElementNode.js +14 -0
  109. package/src/nodes/utils/Timer.js +21 -0
  110. package/src/objects/BatchedMesh.js +1 -1
  111. package/src/objects/Line.js +6 -6
  112. package/src/renderers/WebGLRenderer.js +7 -0
  113. package/src/renderers/common/Animation.js +23 -1
  114. package/src/renderers/common/Backend.js +58 -15
  115. package/src/renderers/common/Background.js +14 -0
  116. package/src/renderers/common/Binding.js +1 -1
  117. package/src/renderers/common/BufferUtils.js +1 -1
  118. package/src/renderers/common/BundleGroup.js +1 -1
  119. package/src/renderers/common/ChainMap.js +9 -7
  120. package/src/renderers/common/ClippingContext.js +1 -1
  121. package/src/renderers/common/Color4.js +7 -3
  122. package/src/renderers/common/Geometries.js +2 -23
  123. package/src/renderers/common/Info.js +1 -45
  124. package/src/renderers/common/Lighting.js +8 -6
  125. package/src/renderers/common/Pipelines.js +3 -3
  126. package/src/renderers/common/PostProcessing.js +24 -8
  127. package/src/renderers/common/QuadMesh.js +1 -1
  128. package/src/renderers/common/RenderBundles.js +9 -3
  129. package/src/renderers/common/RenderContext.js +37 -3
  130. package/src/renderers/common/RenderContexts.js +30 -17
  131. package/src/renderers/common/RenderList.js +2 -2
  132. package/src/renderers/common/RenderLists.js +9 -3
  133. package/src/renderers/common/RenderObject.js +76 -17
  134. package/src/renderers/common/RenderObjects.js +9 -7
  135. package/src/renderers/common/Renderer.js +86 -67
  136. package/src/renderers/common/SampledTexture.js +0 -1
  137. package/src/renderers/common/StorageBufferAttribute.js +1 -1
  138. package/src/renderers/common/StorageInstancedBufferAttribute.js +1 -1
  139. package/src/renderers/common/StorageTexture.js +1 -1
  140. package/src/renderers/common/Textures.js +14 -7
  141. package/src/renderers/common/TimestampQueryPool.js +39 -0
  142. package/src/renderers/common/Uniform.js +37 -1
  143. package/src/renderers/common/UniformsGroup.js +2 -0
  144. package/src/renderers/common/XRManager.js +1193 -0
  145. package/src/renderers/common/XRRenderTarget.js +74 -0
  146. package/src/renderers/common/extras/PMREMGenerator.js +53 -8
  147. package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
  148. package/src/renderers/common/nodes/NodeLibrary.js +5 -5
  149. package/src/renderers/common/nodes/NodeSampledTexture.js +0 -1
  150. package/src/renderers/common/nodes/NodeUniform.js +54 -2
  151. package/src/renderers/common/nodes/Nodes.js +25 -18
  152. package/src/renderers/webgl/WebGLBackground.js +4 -0
  153. package/src/renderers/webgl-fallback/WebGLBackend.js +295 -110
  154. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +347 -17
  155. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +57 -0
  156. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
  157. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
  158. package/src/renderers/webgl-fallback/utils/WebGLState.js +323 -11
  159. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +167 -21
  160. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +359 -0
  161. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +43 -0
  162. package/src/renderers/webgpu/WebGPUBackend.js +132 -149
  163. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +6 -4
  164. package/src/renderers/webgpu/WebGPURenderer.js +5 -4
  165. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +615 -41
  166. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +85 -6
  167. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +85 -0
  168. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +102 -3
  169. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +98 -1
  170. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +257 -9
  171. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +274 -0
  172. package/src/renderers/webgpu/utils/WebGPUUtils.js +86 -4
  173. package/src/renderers/webxr/WebXRManager.js +13 -2
  174. package/src/textures/VideoFrameTexture.js +35 -0
  175. package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -176
  176. package/examples/jsm/objects/InstancedPoints.js +0 -19
  177. package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -209
  178. package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -37
@@ -16,6 +16,7 @@ import QuadMesh from './QuadMesh.js';
16
16
  import RenderBundles from './RenderBundles.js';
17
17
  import NodeLibrary from './nodes/NodeLibrary.js';
18
18
  import Lighting from './Lighting.js';
19
+ import XRManager from './XRManager.js';
19
20
 
20
21
  import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
21
22
 
@@ -54,6 +55,8 @@ class Renderer {
54
55
  * @param {Number} [parameters.samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
55
56
  * to overwrite the default.
56
57
  * @param {Function?} [parameters.getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
58
+ * @param {Number} [parameters.colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
59
+ * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
57
60
  */
58
61
  constructor( backend, parameters = {} ) {
59
62
 
@@ -75,7 +78,8 @@ class Renderer {
75
78
  stencil = false,
76
79
  antialias = false,
77
80
  samples = 0,
78
- getFallback = null
81
+ getFallback = null,
82
+ colorBufferType = HalfFloatType
79
83
  } = parameters;
80
84
 
81
85
  /**
@@ -212,7 +216,7 @@ class Renderer {
212
216
  * Holds a series of statistical information about the GPU memory
213
217
  * and the rendering process. Useful for debugging and monitoring.
214
218
  *
215
- * @type {Boolean}
219
+ * @type {Info}
216
220
  */
217
221
  this.info = new Info();
218
222
 
@@ -294,7 +298,7 @@ class Renderer {
294
298
  * Whether the scissor test should be enabled or not.
295
299
  *
296
300
  * @private
297
- * @type {Vector4}
301
+ * @type {Boolean}
298
302
  */
299
303
  this._scissorTest = false;
300
304
 
@@ -353,7 +357,7 @@ class Renderer {
353
357
  this._objects = null;
354
358
 
355
359
  /**
356
- * A reference to a renderer module for managing render and cmopute pipelines.
360
+ * A reference to a renderer module for managing render and compute pipelines.
357
361
  *
358
362
  * @private
359
363
  * @type {Pipelines?}
@@ -546,7 +550,7 @@ class Renderer {
546
550
 
547
551
  /**
548
552
  * Next to `_renderObjectFunction()`, this function provides another hook
549
- * for influening the render process of a render object. It is meant for internal
553
+ * for influencing the render process of a render object. It is meant for internal
550
554
  * use and only relevant for `compileAsync()` right now. Instead of using
551
555
  * the default logic of `_renderObjectDirect()` which actually draws the render object,
552
556
  * a different function might be used which performs no draw but just the node
@@ -576,6 +580,17 @@ class Renderer {
576
580
  */
577
581
  this.onDeviceLost = this._onDeviceLost;
578
582
 
583
+ /**
584
+ * Defines the type of color buffers. The default `HalfFloatType` is recommend for
585
+ * best quality. To save memory and bandwidth, `UnsignedByteType` might be used.
586
+ * This will reduce rendering quality though.
587
+ *
588
+ * @private
589
+ * @type {Number}
590
+ * @default HalfFloatType
591
+ */
592
+ this._colorBufferType = colorBufferType;
593
+
579
594
  /**
580
595
  * Whether the renderer has been initialized or not.
581
596
  *
@@ -643,20 +658,18 @@ class Renderer {
643
658
  */
644
659
 
645
660
  /**
646
- * The renderer's XR configuration.
661
+ * The renderer's XR manager.
647
662
  *
648
- * @type {module:Renderer~XRConfig}
663
+ * @type {XRManager}
649
664
  */
650
- this.xr = {
651
- enabled: false
652
- };
665
+ this.xr = new XRManager( this );
653
666
 
654
667
  /**
655
668
  * Debug configuration.
656
669
  * @typedef {Object} DebugConfig
657
670
  * @property {Boolean} checkShaderErrors - Whether shader errors should be checked or not.
658
671
  * @property {Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now.
659
- * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camerea and 3D object.
672
+ * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object.
660
673
  */
661
674
 
662
675
  /**
@@ -795,7 +808,7 @@ class Renderer {
795
808
  * @param {Object3D} scene - The scene or 3D object to precompile.
796
809
  * @param {Camera} camera - The camera that is used to render the scene.
797
810
  * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.
798
- * @return {Promise} A Promise that resolves when the compile has been finished.
811
+ * @return {Promise<Array>} A Promise that resolves when the compile has been finished.
799
812
  */
800
813
  async compileAsync( scene, camera, targetScene = null ) {
801
814
 
@@ -933,9 +946,7 @@ class Renderer {
933
946
 
934
947
  if ( this._initialized === false ) await this.init();
935
948
 
936
- const renderContext = this._renderScene( scene, camera );
937
-
938
- await this.backend.resolveTimestampAsync( renderContext, 'render' );
949
+ this._renderScene( scene, camera );
939
950
 
940
951
  }
941
952
 
@@ -977,6 +988,17 @@ class Renderer {
977
988
 
978
989
  }
979
990
 
991
+ /**
992
+ * Returns the color buffer type.
993
+ *
994
+ * @return {Number} The color buffer type.
995
+ */
996
+ getColorBufferType() {
997
+
998
+ return this._colorBufferType;
999
+
1000
+ }
1001
+
980
1002
  /**
981
1003
  * Default implementation of the device lost callback.
982
1004
  *
@@ -1131,7 +1153,7 @@ class Renderer {
1131
1153
  frameBufferTarget = new RenderTarget( width, height, {
1132
1154
  depthBuffer: depth,
1133
1155
  stencilBuffer: stencil,
1134
- type: HalfFloatType, // FloatType
1156
+ type: this._colorBufferType,
1135
1157
  format: RGBAFormat,
1136
1158
  colorSpace: LinearSRGBColorSpace,
1137
1159
  generateMipmaps: false,
@@ -1225,13 +1247,24 @@ class Renderer {
1225
1247
  //
1226
1248
 
1227
1249
  const coordinateSystem = this.coordinateSystem;
1250
+ const xr = this.xr;
1228
1251
 
1229
- if ( camera.coordinateSystem !== coordinateSystem ) {
1252
+ if ( camera.coordinateSystem !== coordinateSystem && xr.isPresenting === false ) {
1230
1253
 
1231
1254
  camera.coordinateSystem = coordinateSystem;
1232
-
1233
1255
  camera.updateProjectionMatrix();
1234
1256
 
1257
+ if ( camera.isArrayCamera ) {
1258
+
1259
+ for ( const subCamera of camera.cameras ) {
1260
+
1261
+ subCamera.coordinateSystem = coordinateSystem;
1262
+ subCamera.updateProjectionMatrix();
1263
+
1264
+ }
1265
+
1266
+ }
1267
+
1235
1268
  }
1236
1269
 
1237
1270
  //
@@ -1240,6 +1273,13 @@ class Renderer {
1240
1273
 
1241
1274
  if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
1242
1275
 
1276
+ if ( xr.enabled === true && xr.isPresenting === true ) {
1277
+
1278
+ if ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );
1279
+ camera = xr.getCamera(); // use XR camera for rendering
1280
+
1281
+ }
1282
+
1243
1283
  //
1244
1284
 
1245
1285
  let viewport = this._viewport;
@@ -1433,7 +1473,7 @@ class Renderer {
1433
1473
  *
1434
1474
  * @async
1435
1475
  * @param {Function} callback - The application's animation loop.
1436
- * @return {Promise} A Promise that resolves when the set has been exeucted.
1476
+ * @return {Promise} A Promise that resolves when the set has been executed.
1437
1477
  */
1438
1478
  async setAnimationLoop( callback ) {
1439
1479
 
@@ -1844,7 +1884,7 @@ class Renderer {
1844
1884
 
1845
1885
  const renderTargetData = this._textures.get( renderTarget );
1846
1886
 
1847
- renderContext = this._renderContexts.get( null, null, renderTarget );
1887
+ renderContext = this._renderContexts.getForClear( renderTarget );
1848
1888
  renderContext.textures = renderTargetData.textures;
1849
1889
  renderContext.depthTexture = renderTargetData.depthTexture;
1850
1890
  renderContext.width = renderTargetData.width;
@@ -1855,6 +1895,9 @@ class Renderer {
1855
1895
 
1856
1896
  }
1857
1897
 
1898
+ // #30329
1899
+ renderContext.clearColorValue = this._clearColor;
1900
+
1858
1901
  this.backend.clear( color, depth, stencil, renderContext );
1859
1902
 
1860
1903
  if ( renderTarget !== null && this._renderTarget === null ) {
@@ -2008,6 +2051,14 @@ class Renderer {
2008
2051
  this._renderContexts.dispose();
2009
2052
  this._textures.dispose();
2010
2053
 
2054
+ if ( this._frameBufferTarget !== null ) this._frameBufferTarget.dispose();
2055
+
2056
+ Object.values( this.backend.timestampQueryPool ).forEach( queryPool => {
2057
+
2058
+ if ( queryPool !== null ) queryPool.dispose();
2059
+
2060
+ } );
2061
+
2011
2062
  this.setRenderTarget( null );
2012
2063
  this.setAnimationLoop( null );
2013
2064
 
@@ -2093,7 +2144,7 @@ class Renderer {
2093
2144
  */
2094
2145
  compute( computeNodes ) {
2095
2146
 
2096
- if ( this.isDeviceLost === true ) return;
2147
+ if ( this._isDeviceLost === true ) return;
2097
2148
 
2098
2149
  if ( this._initialized === false ) {
2099
2150
 
@@ -2187,7 +2238,7 @@ class Renderer {
2187
2238
  *
2188
2239
  * @async
2189
2240
  * @param {Node|Array<Node>} computeNodes - The compute node(s).
2190
- * @return {Promise?} A Promise that resolve when the compute has finished.
2241
+ * @return {Promise} A Promise that resolve when the compute has finished.
2191
2242
  */
2192
2243
  async computeAsync( computeNodes ) {
2193
2244
 
@@ -2195,8 +2246,6 @@ class Renderer {
2195
2246
 
2196
2247
  this.compute( computeNodes );
2197
2248
 
2198
- await this.backend.resolveTimestampAsync( computeNodes, 'compute' );
2199
-
2200
2249
  }
2201
2250
 
2202
2251
  /**
@@ -2214,6 +2263,14 @@ class Renderer {
2214
2263
 
2215
2264
  }
2216
2265
 
2266
+ async resolveTimestampsAsync( type = 'render' ) {
2267
+
2268
+ if ( this._initialized === false ) await this.init();
2269
+
2270
+ return this.backend.resolveTimestampsAsync( type );
2271
+
2272
+ }
2273
+
2217
2274
  /**
2218
2275
  * Checks if the given feature is supported by the selected backend. If the
2219
2276
  * renderer has not been initialized, this method always returns `false`.
@@ -2593,49 +2650,11 @@ class Renderer {
2593
2650
  */
2594
2651
  _renderObjects( renderList, camera, scene, lightsNode, passId = null ) {
2595
2652
 
2596
- // process renderable objects
2597
-
2598
2653
  for ( let i = 0, il = renderList.length; i < il; i ++ ) {
2599
2654
 
2600
- const renderItem = renderList[ i ];
2601
-
2602
- // @TODO: Add support for multiple materials per object. This will require to extract
2603
- // the material from the renderItem object and pass it with its group data to renderObject().
2604
-
2605
- const { object, geometry, material, group, clippingContext } = renderItem;
2606
-
2607
- if ( camera.isArrayCamera ) {
2608
-
2609
- const cameras = camera.cameras;
2655
+ const { object, geometry, material, group, clippingContext } = renderList[ i ];
2610
2656
 
2611
- for ( let j = 0, jl = cameras.length; j < jl; j ++ ) {
2612
-
2613
- const camera2 = cameras[ j ];
2614
-
2615
- if ( object.layers.test( camera2.layers ) ) {
2616
-
2617
- const vp = camera2.viewport;
2618
- const minDepth = ( vp.minDepth === undefined ) ? 0 : vp.minDepth;
2619
- const maxDepth = ( vp.maxDepth === undefined ) ? 1 : vp.maxDepth;
2620
-
2621
- const viewportValue = this._currentRenderContext.viewportValue;
2622
- viewportValue.copy( vp ).multiplyScalar( this._pixelRatio ).floor();
2623
- viewportValue.minDepth = minDepth;
2624
- viewportValue.maxDepth = maxDepth;
2625
-
2626
- this.backend.updateViewport( this._currentRenderContext );
2627
-
2628
- this._currentRenderObjectFunction( object, scene, camera2, geometry, material, group, lightsNode, clippingContext, passId );
2629
-
2630
- }
2631
-
2632
- }
2633
-
2634
- } else {
2635
-
2636
- this._currentRenderObjectFunction( object, scene, camera, geometry, material, group, lightsNode, clippingContext, passId );
2637
-
2638
- }
2657
+ this._currentRenderObjectFunction( object, scene, camera, geometry, material, group, lightsNode, clippingContext, passId );
2639
2658
 
2640
2659
  }
2641
2660
 
@@ -2682,7 +2701,7 @@ class Renderer {
2682
2701
  overrideMaterial.alphaMap = material.alphaMap;
2683
2702
  overrideMaterial.transparent = material.transparent || material.transmission > 0;
2684
2703
 
2685
- if ( overrideMaterial.isShadowNodeMaterial ) {
2704
+ if ( overrideMaterial.isShadowPassMaterial ) {
2686
2705
 
2687
2706
  overrideMaterial.side = material.shadowSide === null ? material.side : material.shadowSide;
2688
2707
 
@@ -2760,7 +2779,7 @@ class Renderer {
2760
2779
  * @param {Scene} scene - The scene the 3D object belongs to.
2761
2780
  * @param {Camera} camera - The camera the object should be rendered with.
2762
2781
  * @param {LightsNode} lightsNode - The current lights node.
2763
- * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
2782
+ * @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
2764
2783
  * @param {ClippingContext} clippingContext - The clipping context.
2765
2784
  * @param {String?} [passId=null] - An optional ID for identifying the pass.
2766
2785
  */
@@ -2815,7 +2834,7 @@ class Renderer {
2815
2834
  * @param {Scene} scene - The scene the 3D object belongs to.
2816
2835
  * @param {Camera} camera - The camera the object should be rendered with.
2817
2836
  * @param {LightsNode} lightsNode - The current lights node.
2818
- * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
2837
+ * @param {{start: Number, count: Number}?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
2819
2838
  * @param {ClippingContext} clippingContext - The clipping context.
2820
2839
  * @param {String?} [passId=null] - An optional ID for identifying the pass.
2821
2840
  */
@@ -95,7 +95,6 @@ class SampledTexture extends Binding {
95
95
  /**
96
96
  * Updates the binding.
97
97
  *
98
- * @param {Number} generation - The generation.
99
98
  * @return {Boolean} Whether the texture has been updated and must be
100
99
  * uploaded to the GPU.
101
100
  */
@@ -22,7 +22,7 @@ class StorageBufferAttribute extends BufferAttribute {
22
22
  * @param {Number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument.
23
23
  * The subsequent parameters are then obsolete.
24
24
  * @param {Number} itemSize - The item size.
25
- * @param {TypedArray.contructor} [typeClass=Float32Array] - A typed array constructor.
25
+ * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor.
26
26
  */
27
27
  constructor( count, itemSize, typeClass = Float32Array ) {
28
28
 
@@ -22,7 +22,7 @@ class StorageInstancedBufferAttribute extends InstancedBufferAttribute {
22
22
  * @param {Number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument.
23
23
  * The subsequent parameters are then obsolete.
24
24
  * @param {Number} itemSize - The item size.
25
- * @param {TypedArray.contructor} [typeClass=Float32Array] - A typed array constructor.
25
+ * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor.
26
26
  */
27
27
  constructor( count, itemSize, typeClass = Float32Array ) {
28
28
 
@@ -25,7 +25,7 @@ class StorageTexture extends Texture {
25
25
  /**
26
26
  * The image object which just represents the texture's dimension.
27
27
  *
28
- * @type {{width: Number, height:Number}}
28
+ * @type {{width: Number, height: Number}}
29
29
  */
30
30
  this.image = { width, height };
31
31
 
@@ -124,21 +124,28 @@ class Textures extends DataMap {
124
124
 
125
125
  //
126
126
 
127
+
127
128
  const options = { sampleCount };
128
129
 
129
- for ( let i = 0; i < textures.length; i ++ ) {
130
+ // XR render targets require no texture updates
130
131
 
131
- const texture = textures[ i ];
132
+ if ( renderTarget.isXRRenderTarget !== true ) {
132
133
 
133
- if ( textureNeedsUpdate ) texture.needsUpdate = true;
134
+ for ( let i = 0; i < textures.length; i ++ ) {
134
135
 
135
- this.updateTexture( texture, options );
136
+ const texture = textures[ i ];
136
137
 
137
- }
138
+ if ( textureNeedsUpdate ) texture.needsUpdate = true;
139
+
140
+ this.updateTexture( texture, options );
141
+
142
+ }
143
+
144
+ if ( depthTexture ) {
138
145
 
139
- if ( depthTexture ) {
146
+ this.updateTexture( depthTexture, options );
140
147
 
141
- this.updateTexture( depthTexture, options );
148
+ }
142
149
 
143
150
  }
144
151
 
@@ -0,0 +1,39 @@
1
+ class TimestampQueryPool {
2
+
3
+ constructor( maxQueries = 256 ) {
4
+
5
+ this.trackTimestamp = true;
6
+ this.maxQueries = maxQueries;
7
+ this.currentQueryIndex = 0; // how many queries allocated so far
8
+ this.queryOffsets = new Map(); // track offsets for different contexts
9
+ this.isDisposed = false;
10
+ this.lastValue = 0;
11
+ this.pendingResolve = false;
12
+
13
+ }
14
+
15
+ /**
16
+ * Allocate queries for a specific renderContext.
17
+ *
18
+ * @abstract
19
+ */
20
+ allocateQueriesForContext( /* renderContext */ ) {}
21
+
22
+ /**
23
+ * Resolve all timestamps and return data (or process them).
24
+ *
25
+ * @abstract
26
+ * @returns {Promise<Number>|Number} The resolved timestamp value.
27
+ */
28
+ async resolveQueriesAsync() {}
29
+
30
+ /**
31
+ * Dispose of the query pool.
32
+ *
33
+ * @abstract
34
+ */
35
+ dispose() {}
36
+
37
+ }
38
+
39
+ export default TimestampQueryPool;
@@ -1,4 +1,5 @@
1
1
  import { Color } from '../../math/Color.js';
2
+ import { Matrix2 } from '../../math/Matrix2.js';
2
3
  import { Matrix3 } from '../../math/Matrix3.js';
3
4
  import { Matrix4 } from '../../math/Matrix4.js';
4
5
  import { Vector2 } from '../../math/Vector2.js';
@@ -256,6 +257,41 @@ class ColorUniform extends Uniform {
256
257
 
257
258
  }
258
259
 
260
+ /**
261
+ * Represents a Matrix2 uniform.
262
+ *
263
+ * @private
264
+ * @augments Uniform
265
+ */
266
+ class Matrix2Uniform extends Uniform {
267
+
268
+ /**
269
+ * Constructs a new Number uniform.
270
+ *
271
+ * @param {String} name - The uniform's name.
272
+ * @param {Matrix2} value - The uniform's value.
273
+ */
274
+ constructor( name, value = new Matrix2() ) {
275
+
276
+ super( name, value );
277
+
278
+ /**
279
+ * This flag can be used for type testing.
280
+ *
281
+ * @type {Boolean}
282
+ * @readonly
283
+ * @default true
284
+ */
285
+ this.isMatrix2Uniform = true;
286
+
287
+ this.boundary = 16;
288
+ this.itemSize = 4;
289
+
290
+ }
291
+
292
+ }
293
+
294
+
259
295
  /**
260
296
  * Represents a Matrix3 uniform.
261
297
  *
@@ -327,5 +363,5 @@ class Matrix4Uniform extends Uniform {
327
363
  export {
328
364
  NumberUniform,
329
365
  Vector2Uniform, Vector3Uniform, Vector4Uniform, ColorUniform,
330
- Matrix3Uniform, Matrix4Uniform
366
+ Matrix2Uniform, Matrix3Uniform, Matrix4Uniform
331
367
  };
@@ -451,6 +451,7 @@ class UniformsGroup extends UniformBuffer {
451
451
  /**
452
452
  * Sets the values of the second array to the first array.
453
453
  *
454
+ * @private
454
455
  * @param {TypedArray} a - The first array.
455
456
  * @param {TypedArray} b - The second array.
456
457
  * @param {Number} offset - An index offset for the first array.
@@ -468,6 +469,7 @@ function setArray( a, b, offset ) {
468
469
  /**
469
470
  * Returns `true` if the given arrays are equal.
470
471
  *
472
+ * @private
471
473
  * @param {TypedArray} a - The first array.
472
474
  * @param {TypedArray} b - The second array.
473
475
  * @param {Number} offset - An index offset for the first array.