@plastic-software/three 0.180.0 → 0.181.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 (357) hide show
  1. package/build/three.cjs +943 -486
  2. package/build/three.core.js +506 -327
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +435 -163
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +8 -2
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +3753 -1177
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +3752 -1176
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  13. package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
  14. package/examples/jsm/animation/CCDIKSolver.js +1 -1
  15. package/examples/jsm/controls/ArcballControls.js +1 -1
  16. package/examples/jsm/controls/DragControls.js +1 -1
  17. package/examples/jsm/controls/FirstPersonControls.js +1 -1
  18. package/examples/jsm/controls/FlyControls.js +1 -1
  19. package/examples/jsm/controls/OrbitControls.js +2 -2
  20. package/examples/jsm/controls/PointerLockControls.js +2 -2
  21. package/examples/jsm/controls/TrackballControls.js +1 -1
  22. package/examples/jsm/controls/TransformControls.js +1 -1
  23. package/examples/jsm/effects/AsciiEffect.js +8 -8
  24. package/examples/jsm/exporters/DRACOExporter.js +2 -2
  25. package/examples/jsm/exporters/EXRExporter.js +1 -1
  26. package/examples/jsm/exporters/GLTFExporter.js +3 -3
  27. package/examples/jsm/exporters/USDZExporter.js +9 -2
  28. package/examples/jsm/geometries/DecalGeometry.js +2 -2
  29. package/examples/jsm/geometries/ParametricGeometry.js +1 -1
  30. package/examples/jsm/geometries/TeapotGeometry.js +2 -2
  31. package/examples/jsm/geometries/TextGeometry.js +3 -2
  32. package/examples/jsm/gpgpu/BitonicSort.js +715 -0
  33. package/examples/jsm/helpers/ViewHelper.js +43 -5
  34. package/examples/jsm/inspector/Inspector.js +427 -0
  35. package/examples/jsm/inspector/RendererInspector.js +415 -0
  36. package/examples/jsm/inspector/tabs/Console.js +204 -0
  37. package/examples/jsm/inspector/tabs/Parameters.js +332 -0
  38. package/examples/jsm/inspector/tabs/Performance.js +268 -0
  39. package/examples/jsm/inspector/tabs/Viewer.js +166 -0
  40. package/examples/jsm/inspector/ui/Graph.js +95 -0
  41. package/examples/jsm/inspector/ui/Item.js +170 -0
  42. package/examples/jsm/inspector/ui/List.js +75 -0
  43. package/examples/jsm/inspector/ui/Profiler.js +170 -0
  44. package/examples/jsm/inspector/ui/Style.js +654 -0
  45. package/examples/jsm/inspector/ui/Tab.js +46 -0
  46. package/examples/jsm/inspector/ui/Values.js +423 -0
  47. package/examples/jsm/inspector/ui/utils.js +56 -0
  48. package/examples/jsm/interactive/HTMLMesh.js +6 -10
  49. package/examples/jsm/interactive/InteractiveGroup.js +1 -1
  50. package/examples/jsm/interactive/SelectionBox.js +30 -0
  51. package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
  52. package/examples/jsm/loaders/3MFLoader.js +1 -1
  53. package/examples/jsm/loaders/ColladaLoader.js +2 -2
  54. package/examples/jsm/loaders/DDSLoader.js +1 -1
  55. package/examples/jsm/loaders/DRACOLoader.js +73 -22
  56. package/examples/jsm/loaders/FBXLoader.js +2 -2
  57. package/examples/jsm/loaders/FontLoader.js +23 -5
  58. package/examples/jsm/loaders/GLTFLoader.js +5 -3
  59. package/examples/jsm/loaders/KTX2Loader.js +28 -21
  60. package/examples/jsm/loaders/KTXLoader.js +2 -2
  61. package/examples/jsm/loaders/LDrawLoader.js +1 -1
  62. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  63. package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
  64. package/examples/jsm/loaders/LWOLoader.js +2 -2
  65. package/examples/jsm/loaders/MaterialXLoader.js +22 -5
  66. package/examples/jsm/loaders/OBJLoader.js +1 -1
  67. package/examples/jsm/loaders/PDBLoader.js +1 -1
  68. package/examples/jsm/loaders/SVGLoader.js +2 -2
  69. package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
  70. package/examples/jsm/math/ConvexHull.js +1 -1
  71. package/examples/jsm/math/ImprovedNoise.js +1 -1
  72. package/examples/jsm/math/SimplexNoise.js +1 -1
  73. package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
  74. package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
  75. package/examples/jsm/misc/TubePainter.js +383 -40
  76. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  77. package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
  78. package/examples/jsm/objects/Sky.js +1 -1
  79. package/examples/jsm/objects/SkyMesh.js +1 -1
  80. package/examples/jsm/objects/Water.js +3 -3
  81. package/examples/jsm/objects/WaterMesh.js +6 -6
  82. package/examples/jsm/postprocessing/GlitchPass.js +2 -2
  83. package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
  84. package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
  85. package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
  86. package/examples/jsm/renderers/SVGRenderer.js +1 -1
  87. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
  88. package/examples/jsm/shaders/AfterimageShader.js +1 -1
  89. package/examples/jsm/shaders/BleachBypassShader.js +1 -1
  90. package/examples/jsm/shaders/BokehShader.js +1 -1
  91. package/examples/jsm/shaders/BokehShader2.js +1 -1
  92. package/examples/jsm/shaders/DotScreenShader.js +1 -1
  93. package/examples/jsm/shaders/FocusShader.js +1 -1
  94. package/examples/jsm/shaders/GTAOShader.js +2 -2
  95. package/examples/jsm/shaders/GodRaysShader.js +1 -1
  96. package/examples/jsm/shaders/KaleidoShader.js +1 -1
  97. package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
  98. package/examples/jsm/shaders/SSRShader.js +1 -1
  99. package/examples/jsm/shaders/SepiaShader.js +1 -1
  100. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
  101. package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
  102. package/examples/jsm/shaders/VignetteShader.js +1 -1
  103. package/examples/jsm/transpiler/TSLEncoder.js +7 -0
  104. package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
  105. package/examples/jsm/tsl/display/AnamorphicNode.js +2 -1
  106. package/examples/jsm/tsl/display/BloomNode.js +4 -0
  107. package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
  108. package/examples/jsm/tsl/display/DepthOfFieldNode.js +7 -0
  109. package/examples/jsm/tsl/display/GTAONode.js +45 -5
  110. package/examples/jsm/tsl/display/GaussianBlurNode.js +5 -3
  111. package/examples/jsm/tsl/display/OutlineNode.js +11 -0
  112. package/examples/jsm/tsl/display/SSGINode.js +654 -0
  113. package/examples/jsm/tsl/display/SSRNode.js +2 -0
  114. package/examples/jsm/tsl/display/SSSNode.js +488 -0
  115. package/examples/jsm/tsl/display/TRAANode.js +123 -6
  116. package/examples/jsm/tsl/display/boxBlur.js +1 -0
  117. package/examples/jsm/tsl/display/hashBlur.js +1 -0
  118. package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
  119. package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
  120. package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
  121. package/package.json +5 -10
  122. package/src/Three.Core.js +3 -2
  123. package/src/Three.TSL.js +7 -1
  124. package/src/Three.WebGPU.Nodes.js +2 -0
  125. package/src/Three.WebGPU.js +2 -0
  126. package/src/animation/AnimationClip.js +3 -2
  127. package/src/animation/AnimationMixer.js +3 -3
  128. package/src/animation/AnimationObjectGroup.js +2 -1
  129. package/src/animation/KeyframeTrack.js +7 -6
  130. package/src/animation/PropertyBinding.js +12 -11
  131. package/src/audio/Audio.js +10 -9
  132. package/src/audio/PositionalAudio.js +1 -1
  133. package/src/cameras/OrthographicCamera.js +1 -1
  134. package/src/cameras/PerspectiveCamera.js +1 -1
  135. package/src/cameras/StereoCamera.js +2 -2
  136. package/src/constants.js +1 -1
  137. package/src/core/BufferGeometry.js +8 -8
  138. package/src/core/EventDispatcher.js +1 -1
  139. package/src/core/InterleavedBuffer.js +1 -1
  140. package/src/core/InterleavedBufferAttribute.js +3 -2
  141. package/src/core/Object3D.js +3 -2
  142. package/src/core/Raycaster.js +2 -1
  143. package/src/core/RenderTarget.js +10 -1
  144. package/src/extras/Controls.js +5 -4
  145. package/src/extras/DataUtils.js +2 -1
  146. package/src/extras/Earcut.js +6 -0
  147. package/src/extras/ImageUtils.js +2 -2
  148. package/src/extras/PMREMGenerator.js +268 -55
  149. package/src/extras/core/Curve.js +2 -1
  150. package/src/extras/core/Interpolations.js +7 -1
  151. package/src/extras/core/ShapePath.js +4 -4
  152. package/src/extras/lib/earcut.js +7 -7
  153. package/src/geometries/BoxGeometry.js +1 -0
  154. package/src/geometries/CapsuleGeometry.js +1 -0
  155. package/src/geometries/CircleGeometry.js +1 -0
  156. package/src/geometries/ConeGeometry.js +1 -0
  157. package/src/geometries/CylinderGeometry.js +1 -0
  158. package/src/geometries/DodecahedronGeometry.js +1 -0
  159. package/src/geometries/ExtrudeGeometry.js +8 -6
  160. package/src/geometries/IcosahedronGeometry.js +1 -0
  161. package/src/geometries/LatheGeometry.js +1 -0
  162. package/src/geometries/OctahedronGeometry.js +1 -0
  163. package/src/geometries/PlaneGeometry.js +1 -0
  164. package/src/geometries/RingGeometry.js +1 -0
  165. package/src/geometries/ShapeGeometry.js +1 -0
  166. package/src/geometries/SphereGeometry.js +1 -0
  167. package/src/geometries/TetrahedronGeometry.js +1 -0
  168. package/src/geometries/TorusGeometry.js +1 -0
  169. package/src/geometries/TorusKnotGeometry.js +1 -0
  170. package/src/geometries/TubeGeometry.js +1 -0
  171. package/src/helpers/CameraHelper.js +1 -1
  172. package/src/loaders/AnimationLoader.js +2 -1
  173. package/src/loaders/AudioLoader.js +2 -1
  174. package/src/loaders/BufferGeometryLoader.js +2 -2
  175. package/src/loaders/Cache.js +2 -2
  176. package/src/loaders/DataTextureLoader.js +1 -1
  177. package/src/loaders/FileLoader.js +3 -2
  178. package/src/loaders/ImageBitmapLoader.js +5 -4
  179. package/src/loaders/ImageLoader.js +1 -1
  180. package/src/loaders/Loader.js +3 -3
  181. package/src/loaders/LoadingManager.js +25 -3
  182. package/src/loaders/MaterialLoader.js +3 -2
  183. package/src/loaders/ObjectLoader.js +13 -13
  184. package/src/loaders/TextureLoader.js +1 -1
  185. package/src/loaders/nodes/NodeLoader.js +3 -2
  186. package/src/materials/Material.js +4 -3
  187. package/src/materials/MeshBasicMaterial.js +1 -0
  188. package/src/materials/MeshDepthMaterial.js +1 -0
  189. package/src/materials/MeshLambertMaterial.js +2 -1
  190. package/src/materials/MeshMatcapMaterial.js +22 -0
  191. package/src/materials/MeshNormalMaterial.js +1 -0
  192. package/src/materials/MeshPhongMaterial.js +2 -1
  193. package/src/materials/MeshPhysicalMaterial.js +2 -1
  194. package/src/materials/MeshStandardMaterial.js +8 -7
  195. package/src/materials/MeshToonMaterial.js +1 -0
  196. package/src/materials/PointsMaterial.js +1 -1
  197. package/src/materials/ShaderMaterial.js +2 -2
  198. package/src/materials/nodes/Line2NodeMaterial.js +2 -2
  199. package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
  200. package/src/materials/nodes/NodeMaterial.js +62 -22
  201. package/src/materials/nodes/manager/NodeMaterialObserver.js +2 -1
  202. package/src/math/Color.js +6 -5
  203. package/src/math/ColorManagement.js +2 -2
  204. package/src/math/Cylindrical.js +1 -1
  205. package/src/math/Euler.js +2 -1
  206. package/src/math/MathUtils.js +13 -11
  207. package/src/math/Matrix2.js +1 -1
  208. package/src/math/Matrix3.js +2 -2
  209. package/src/math/Matrix4.js +7 -7
  210. package/src/math/Plane.js +1 -1
  211. package/src/math/Quaternion.js +68 -66
  212. package/src/math/Spherical.js +1 -1
  213. package/src/nodes/Nodes.js +1 -1
  214. package/src/nodes/TSL.js +1 -1
  215. package/src/nodes/accessors/CubeTextureNode.js +3 -2
  216. package/src/nodes/accessors/InstanceNode.js +22 -4
  217. package/src/nodes/accessors/Lights.js +10 -0
  218. package/src/nodes/accessors/Normal.js +5 -4
  219. package/src/nodes/accessors/Position.js +18 -2
  220. package/src/nodes/accessors/ReferenceNode.js +2 -1
  221. package/src/nodes/accessors/SceneNode.js +2 -1
  222. package/src/nodes/accessors/StorageBufferNode.js +2 -1
  223. package/src/nodes/accessors/StorageTextureNode.js +22 -0
  224. package/src/nodes/accessors/Texture3DNode.js +1 -1
  225. package/src/nodes/accessors/TextureNode.js +61 -27
  226. package/src/nodes/code/FunctionCallNode.js +5 -4
  227. package/src/nodes/core/ArrayNode.js +1 -0
  228. package/src/nodes/core/AttributeNode.js +2 -1
  229. package/src/nodes/core/ContextNode.js +5 -10
  230. package/src/nodes/core/IndexNode.js +2 -2
  231. package/src/nodes/core/InputNode.js +2 -1
  232. package/src/nodes/core/InspectorNode.js +128 -0
  233. package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
  234. package/src/nodes/core/Node.js +137 -12
  235. package/src/nodes/core/NodeBuilder.js +135 -21
  236. package/src/nodes/core/NodeFrame.js +20 -20
  237. package/src/nodes/core/NodeFunction.js +2 -1
  238. package/src/nodes/core/NodeParser.js +2 -1
  239. package/src/nodes/core/NodeUtils.js +17 -90
  240. package/src/nodes/core/ParameterNode.js +31 -0
  241. package/src/nodes/core/PropertyNode.js +7 -0
  242. package/src/nodes/core/StackNode.js +16 -14
  243. package/src/nodes/core/UniformNode.js +2 -1
  244. package/src/nodes/core/VarNode.js +70 -12
  245. package/src/nodes/core/VaryingNode.js +3 -2
  246. package/src/nodes/display/BlendModes.js +5 -4
  247. package/src/nodes/display/BumpMapNode.js +1 -1
  248. package/src/nodes/display/ColorAdjustment.js +1 -1
  249. package/src/nodes/display/NormalMapNode.js +2 -1
  250. package/src/nodes/display/PassNode.js +51 -10
  251. package/src/nodes/display/RenderOutputNode.js +28 -2
  252. package/src/nodes/display/ScreenNode.js +2 -1
  253. package/src/nodes/display/ToneMappingNode.js +31 -4
  254. package/src/nodes/display/ToonOutlinePassNode.js +8 -0
  255. package/src/nodes/fog/Fog.js +3 -2
  256. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
  257. package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
  258. package/src/nodes/functions/BasicLightingModel.js +2 -1
  259. package/src/nodes/functions/PhysicalLightingModel.js +3 -2
  260. package/src/nodes/functions/VolumetricLightingModel.js +5 -5
  261. package/src/nodes/geometry/RangeNode.js +40 -4
  262. package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
  263. package/src/nodes/gpgpu/ComputeNode.js +17 -5
  264. package/src/nodes/gpgpu/SubgroupFunctionNode.js +25 -0
  265. package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
  266. package/src/nodes/lighting/EnvironmentNode.js +6 -6
  267. package/src/nodes/lighting/LightsNode.js +2 -3
  268. package/src/nodes/lighting/PointShadowNode.js +6 -0
  269. package/src/nodes/lighting/ShadowFilterNode.js +2 -0
  270. package/src/nodes/lighting/ShadowNode.js +75 -8
  271. package/src/nodes/math/ConditionalNode.js +6 -5
  272. package/src/nodes/math/MathNode.js +22 -4
  273. package/src/nodes/math/OperatorNode.js +3 -2
  274. package/src/nodes/pmrem/PMREMUtils.js +117 -2
  275. package/src/nodes/shapes/Shapes.js +1 -1
  276. package/src/nodes/tsl/TSLBase.js +5 -2
  277. package/src/nodes/tsl/TSLCore.js +36 -15
  278. package/src/nodes/utils/DebugNode.js +2 -1
  279. package/src/nodes/utils/EventNode.js +36 -0
  280. package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
  281. package/src/nodes/utils/JoinNode.js +3 -2
  282. package/src/nodes/utils/LoopNode.js +20 -24
  283. package/src/nodes/utils/MemberNode.js +2 -1
  284. package/src/nodes/utils/PostProcessingUtils.js +28 -1
  285. package/src/nodes/utils/RTTNode.js +12 -2
  286. package/src/nodes/utils/ReflectorNode.js +10 -3
  287. package/src/objects/Line.js +2 -1
  288. package/src/objects/LineSegments.js +2 -1
  289. package/src/objects/Skeleton.js +3 -2
  290. package/src/objects/SkinnedMesh.js +3 -1
  291. package/src/objects/Sprite.js +2 -1
  292. package/src/renderers/WebGLRenderer.js +48 -32
  293. package/src/renderers/common/Animation.js +13 -1
  294. package/src/renderers/common/Backend.js +93 -30
  295. package/src/renderers/common/Background.js +2 -1
  296. package/src/renderers/common/Bindings.js +56 -2
  297. package/src/renderers/common/CanvasTarget.js +341 -0
  298. package/src/renderers/common/Geometries.js +26 -0
  299. package/src/renderers/common/Info.js +4 -2
  300. package/src/renderers/common/InspectorBase.js +146 -0
  301. package/src/renderers/common/PostProcessing.js +6 -25
  302. package/src/renderers/common/QuadMesh.js +7 -1
  303. package/src/renderers/common/RenderList.js +7 -3
  304. package/src/renderers/common/RenderObject.js +3 -1
  305. package/src/renderers/common/RenderObjects.js +1 -1
  306. package/src/renderers/common/Renderer.js +436 -228
  307. package/src/renderers/common/RendererUtils.js +9 -0
  308. package/src/renderers/common/SampledTexture.js +8 -0
  309. package/src/renderers/common/Sampler.js +37 -11
  310. package/src/renderers/common/StorageTexture.js +9 -1
  311. package/src/renderers/common/Textures.js +89 -35
  312. package/src/renderers/common/TimestampQueryPool.js +63 -1
  313. package/src/renderers/common/UniformsGroup.js +2 -1
  314. package/src/renderers/common/XRManager.js +7 -3
  315. package/src/renderers/common/extras/PMREMGenerator.js +160 -65
  316. package/src/renderers/common/nodes/NodeLibrary.js +4 -2
  317. package/src/renderers/common/nodes/NodeSampler.js +13 -1
  318. package/src/renderers/common/nodes/Nodes.js +38 -16
  319. package/src/renderers/shaders/DFGLUTData.js +64 -0
  320. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
  321. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
  322. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
  323. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
  324. package/src/renderers/shaders/UniformsLib.js +1 -0
  325. package/src/renderers/shaders/UniformsUtils.js +25 -4
  326. package/src/renderers/webgl/WebGLCapabilities.js +2 -1
  327. package/src/renderers/webgl/WebGLExtensions.js +2 -25
  328. package/src/renderers/webgl/WebGLInfo.js +3 -1
  329. package/src/renderers/webgl/WebGLProgram.js +11 -10
  330. package/src/renderers/webgl/WebGLPrograms.js +2 -1
  331. package/src/renderers/webgl/WebGLShadowMap.js +2 -1
  332. package/src/renderers/webgl/WebGLState.js +15 -14
  333. package/src/renderers/webgl/WebGLTextures.js +18 -14
  334. package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
  335. package/src/renderers/webgl-fallback/WebGLBackend.js +22 -41
  336. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +74 -11
  337. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
  338. package/src/renderers/webgl-fallback/utils/WebGLState.js +6 -5
  339. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +117 -16
  340. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +42 -12
  341. package/src/renderers/webgpu/WebGPUBackend.js +134 -108
  342. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
  343. package/src/renderers/webgpu/WebGPURenderer.js +3 -2
  344. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -19
  345. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
  346. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
  347. package/src/renderers/webgpu/utils/WebGPUConstants.js +5 -0
  348. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +44 -16
  349. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
  350. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +146 -74
  351. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +29 -6
  352. package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
  353. package/src/renderers/webxr/WebXRManager.js +3 -2
  354. package/src/textures/Source.js +2 -1
  355. package/src/textures/Texture.js +3 -2
  356. package/src/textures/VideoTexture.js +2 -0
  357. package/src/utils.js +67 -3
@@ -17,6 +17,8 @@ import RenderBundles from './RenderBundles.js';
17
17
  import NodeLibrary from './nodes/NodeLibrary.js';
18
18
  import Lighting from './Lighting.js';
19
19
  import XRManager from './XRManager.js';
20
+ import InspectorBase from './InspectorBase.js';
21
+ import CanvasTarget from './CanvasTarget.js';
20
22
 
21
23
  import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
22
24
 
@@ -30,7 +32,10 @@ import { Vector4 } from '../../math/Vector4.js';
30
32
  import { RenderTarget } from '../../core/RenderTarget.js';
31
33
  import { DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping, LinearFilter, HalfFloatType, RGBAFormat, PCFShadowMap } from '../../constants.js';
32
34
 
35
+ import { float, vec3, vec4 } from '../../nodes/tsl/TSLCore.js';
36
+ import { reference } from '../../nodes/accessors/ReferenceNode.js';
33
37
  import { highpModelNormalViewMatrix, highpModelViewMatrix } from '../../nodes/accessors/ModelNode.js';
38
+ import { error, warn, warnOnce } from '../../utils.js';
34
39
 
35
40
  const _scene = /*@__PURE__*/ new Scene();
36
41
  const _drawingBufferSize = /*@__PURE__*/ new Vector2();
@@ -95,15 +100,6 @@ class Renderer {
95
100
  multiview = false
96
101
  } = parameters;
97
102
 
98
- /**
99
- * A reference to the canvas element the renderer is drawing to.
100
- * This value of this property will automatically be created by
101
- * the renderer.
102
- *
103
- * @type {HTMLCanvasElement|OffscreenCanvas}
104
- */
105
- this.domElement = backend.getDomElement();
106
-
107
103
  /**
108
104
  * A reference to the current backend.
109
105
  *
@@ -111,14 +107,6 @@ class Renderer {
111
107
  */
112
108
  this.backend = backend;
113
109
 
114
- /**
115
- * The number of MSAA samples.
116
- *
117
- * @type {number}
118
- * @default 0
119
- */
120
- this.samples = samples || ( antialias === true ) ? 4 : 0;
121
-
122
110
  /**
123
111
  * Whether the renderer should automatically clear the current rendering target
124
112
  * before execute a `render()` call. The target can be the canvas (default framebuffer)
@@ -267,61 +255,48 @@ class Renderer {
267
255
  // internals
268
256
 
269
257
  /**
270
- * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
271
- *
272
- * @private
273
- * @type {?Function}
274
- */
275
- this._getFallback = getFallback;
276
-
277
- /**
278
- * The renderer's pixel ratio.
279
- *
280
- * @private
281
- * @type {number}
282
- * @default 1
283
- */
284
- this._pixelRatio = 1;
285
-
286
- /**
287
- * The width of the renderer's default framebuffer in logical pixel unit.
258
+ * The number of MSAA samples.
288
259
  *
289
260
  * @private
290
261
  * @type {number}
262
+ * @default 0
291
263
  */
292
- this._width = this.domElement.width;
264
+ this._samples = samples || ( antialias === true ) ? 4 : 0;
293
265
 
294
266
  /**
295
- * The height of the renderer's default framebuffer in logical pixel unit.
267
+ * OnCanvasTargetResize callback function.
296
268
  *
297
269
  * @private
298
- * @type {number}
270
+ * @type {Function}
299
271
  */
300
- this._height = this.domElement.height;
272
+ this._onCanvasTargetResize = this._onCanvasTargetResize.bind( this );
301
273
 
302
274
  /**
303
- * The viewport of the renderer in logical pixel unit.
275
+ * The canvas target for rendering.
304
276
  *
305
277
  * @private
306
- * @type {Vector4}
278
+ * @type {CanvasTarget}
307
279
  */
308
- this._viewport = new Vector4( 0, 0, this._width, this._height );
280
+ this._canvasTarget = new CanvasTarget( backend.getDomElement() );
281
+ this._canvasTarget.addEventListener( 'resize', this._onCanvasTargetResize );
282
+ this._canvasTarget.isDefaultCanvasTarget = true;
309
283
 
310
284
  /**
311
- * The scissor rectangle of the renderer in logical pixel unit.
285
+ * The inspector provides information about the internal renderer state.
312
286
  *
313
287
  * @private
314
- * @type {Vector4}
288
+ * @type {InspectorBase}
315
289
  */
316
- this._scissor = new Vector4( 0, 0, this._width, this._height );
290
+ this._inspector = new InspectorBase();
291
+ this._inspector.setRenderer( this );
317
292
 
318
293
  /**
319
- * Whether the scissor test should be enabled or not.
294
+ * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
320
295
  *
321
296
  * @private
322
- * @type {boolean}
297
+ * @type {?Function}
323
298
  */
324
- this._scissorTest = false;
299
+ this._getFallback = getFallback;
325
300
 
326
301
  /**
327
302
  * A reference to a renderer module for managing shader attributes.
@@ -439,7 +414,8 @@ class Renderer {
439
414
  * @type {QuadMesh}
440
415
  */
441
416
  this._quad = new QuadMesh( new NodeMaterial() );
442
- this._quad.material.name = 'Renderer_output';
417
+ this._quad.name = 'Output Color Transform';
418
+ this._quad.material.name = 'outputColorTransform';
443
419
 
444
420
  /**
445
421
  * A reference to the current render context.
@@ -621,6 +597,14 @@ class Renderer {
621
597
  */
622
598
  this._colorBufferType = colorBufferType;
623
599
 
600
+ /**
601
+ * A cache for shadow nodes per material
602
+ *
603
+ * @private
604
+ * @type {WeakMap<Material, Object>}
605
+ */
606
+ this._cacheShadowNodes = new WeakMap();
607
+
624
608
  /**
625
609
  * Whether the renderer has been initialized or not.
626
610
  *
@@ -738,12 +722,6 @@ class Renderer {
738
722
  */
739
723
  async init() {
740
724
 
741
- if ( this._initialized ) {
742
-
743
- throw new Error( 'Renderer: Backend has already been initialized.' );
744
-
745
- }
746
-
747
725
  if ( this._initPromise !== null ) {
748
726
 
749
727
  return this._initPromise;
@@ -786,7 +764,7 @@ class Renderer {
786
764
  }
787
765
 
788
766
  this._nodes = new Nodes( this, backend );
789
- this._animation = new Animation( this._nodes, this.info );
767
+ this._animation = new Animation( this, this._nodes, this.info );
790
768
  this._attributes = new Attributes( backend );
791
769
  this._background = new Background( this, this._nodes );
792
770
  this._geometries = new Geometries( this._attributes, this.info );
@@ -803,6 +781,12 @@ class Renderer {
803
781
  this._animation.start();
804
782
  this._initialized = true;
805
783
 
784
+ //
785
+
786
+ this._inspector.init();
787
+
788
+ //
789
+
806
790
  resolve( this );
807
791
 
808
792
  } );
@@ -811,6 +795,19 @@ class Renderer {
811
795
 
812
796
  }
813
797
 
798
+ /**
799
+ * A reference to the canvas element the renderer is drawing to.
800
+ * This value of this property will automatically be created by
801
+ * the renderer.
802
+ *
803
+ * @type {HTMLCanvasElement|OffscreenCanvas}
804
+ */
805
+ get domElement() {
806
+
807
+ return this._canvasTarget.domElement;
808
+
809
+ }
810
+
814
811
  /**
815
812
  * The coordinate system of the renderer. The value of this property
816
813
  * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or
@@ -968,15 +965,18 @@ class Renderer {
968
965
  * Renders the scene in an async fashion.
969
966
  *
970
967
  * @async
968
+ * @deprecated
971
969
  * @param {Object3D} scene - The scene or 3D object to render.
972
970
  * @param {Camera} camera - The camera.
973
971
  * @return {Promise} A Promise that resolves when the render has been finished.
974
972
  */
975
973
  async renderAsync( scene, camera ) {
976
974
 
977
- if ( this._initialized === false ) await this.init();
975
+ warnOnce( 'Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
978
976
 
979
- this._renderScene( scene, camera );
977
+ await this.init();
978
+
979
+ this.render( scene, camera );
980
980
 
981
981
  }
982
982
 
@@ -985,11 +985,38 @@ class Renderer {
985
985
  * the CPU waits for the GPU to complete its operation (e.g. a compute task).
986
986
  *
987
987
  * @async
988
+ * @deprecated
988
989
  * @return {Promise} A Promise that resolves when synchronization has been finished.
989
990
  */
990
991
  async waitForGPU() {
991
992
 
992
- await this.backend.waitForGPU();
993
+ error( 'Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.' );
994
+
995
+ }
996
+
997
+ //
998
+
999
+ /**
1000
+ * Sets the inspector instance. The inspector can be any class that extends from `InspectorBase`.
1001
+ *
1002
+ * @param {InspectorBase} value - The new inspector.
1003
+ */
1004
+ set inspector( value ) {
1005
+
1006
+ if ( this._inspector !== null ) {
1007
+
1008
+ this._inspector.setRenderer( null );
1009
+
1010
+ }
1011
+
1012
+ this._inspector = value;
1013
+ this._inspector.setRenderer( this );
1014
+
1015
+ }
1016
+
1017
+ get inspector() {
1018
+
1019
+ return this._inspector;
993
1020
 
994
1021
  }
995
1022
 
@@ -1082,7 +1109,7 @@ class Renderer {
1082
1109
 
1083
1110
  }
1084
1111
 
1085
- console.error( errorMessage );
1112
+ error( errorMessage );
1086
1113
 
1087
1114
  this._isDeviceLost = true;
1088
1115
 
@@ -1174,23 +1201,24 @@ class Renderer {
1174
1201
 
1175
1202
  /**
1176
1203
  * Renders the scene or 3D object with the given camera. This method can only be called
1177
- * if the renderer has been initialized.
1204
+ * if the renderer has been initialized. When using `render()` inside an animation loop,
1205
+ * it's guaranteed the renderer will be initialized. The animation loop must be defined
1206
+ * with {@link Renderer#setAnimationLoop} though.
1207
+ *
1208
+ * For all other use cases (like when using on-demand rendering), you must call
1209
+ * {@link Renderer#init} before rendering.
1178
1210
  *
1179
1211
  * The target of the method is the default framebuffer (meaning the canvas)
1180
1212
  * or alternatively a render target when specified via `setRenderTarget()`.
1181
1213
  *
1182
1214
  * @param {Object3D} scene - The scene or 3D object to render.
1183
1215
  * @param {Camera} camera - The camera to render the scene with.
1184
- * @return {?Promise} A Promise that resolve when the scene has been rendered.
1185
- * Only returned when the renderer has not been initialized.
1186
1216
  */
1187
1217
  render( scene, camera ) {
1188
1218
 
1189
1219
  if ( this._initialized === false ) {
1190
1220
 
1191
- console.warn( 'THREE.Renderer: .render() called before the backend is initialized. Try using .renderAsync() instead.' );
1192
-
1193
- return this.renderAsync( scene, camera );
1221
+ throw new Error( 'Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.' );
1194
1222
 
1195
1223
  }
1196
1224
 
@@ -1198,6 +1226,18 @@ class Renderer {
1198
1226
 
1199
1227
  }
1200
1228
 
1229
+ /**
1230
+ * Returns whether the renderer has been initialized or not.
1231
+ *
1232
+ * @readonly
1233
+ * @return {boolean} Whether the renderer has been initialized or not.
1234
+ */
1235
+ get initialized() {
1236
+
1237
+ return this._initialized;
1238
+
1239
+ }
1240
+
1201
1241
  /**
1202
1242
  * Returns an internal render target which is used when computing the output tone mapping
1203
1243
  * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render
@@ -1254,11 +1294,13 @@ class Renderer {
1254
1294
 
1255
1295
  }
1256
1296
 
1257
- frameBufferTarget.viewport.copy( this._viewport );
1258
- frameBufferTarget.scissor.copy( this._scissor );
1259
- frameBufferTarget.viewport.multiplyScalar( this._pixelRatio );
1260
- frameBufferTarget.scissor.multiplyScalar( this._pixelRatio );
1261
- frameBufferTarget.scissorTest = this._scissorTest;
1297
+ const canvasTarget = this._canvasTarget;
1298
+
1299
+ frameBufferTarget.viewport.copy( canvasTarget._viewport );
1300
+ frameBufferTarget.scissor.copy( canvasTarget._scissor );
1301
+ frameBufferTarget.viewport.multiplyScalar( canvasTarget._pixelRatio );
1302
+ frameBufferTarget.scissor.multiplyScalar( canvasTarget._pixelRatio );
1303
+ frameBufferTarget.scissorTest = canvasTarget._scissorTest;
1262
1304
  frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
1263
1305
  frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
1264
1306
  frameBufferTarget._autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget._autoAllocateDepthBuffer : false;
@@ -1280,6 +1322,8 @@ class Renderer {
1280
1322
 
1281
1323
  if ( this._isDeviceLost === true ) return;
1282
1324
 
1325
+ //
1326
+
1283
1327
  const frameBufferTarget = useFrameBufferTarget ? this._getFrameBufferTarget() : null;
1284
1328
 
1285
1329
  // preserve render tree
@@ -1332,6 +1376,12 @@ class Renderer {
1332
1376
 
1333
1377
  //
1334
1378
 
1379
+ this.backend.updateTimeStampUID( renderContext );
1380
+
1381
+ this.inspector.beginRender( this.backend.getTimestampUID( renderContext ), scene, camera, renderTarget );
1382
+
1383
+ //
1384
+
1335
1385
  const coordinateSystem = this.coordinateSystem;
1336
1386
  const xr = this.xr;
1337
1387
 
@@ -1368,9 +1418,11 @@ class Renderer {
1368
1418
 
1369
1419
  //
1370
1420
 
1371
- let viewport = this._viewport;
1372
- let scissor = this._scissor;
1373
- let pixelRatio = this._pixelRatio;
1421
+ const canvasTarget = this._canvasTarget;
1422
+
1423
+ let viewport = canvasTarget._viewport;
1424
+ let scissor = canvasTarget._scissor;
1425
+ let pixelRatio = canvasTarget._pixelRatio;
1374
1426
 
1375
1427
  if ( renderTarget !== null ) {
1376
1428
 
@@ -1395,7 +1447,7 @@ class Renderer {
1395
1447
  renderContext.viewport = renderContext.viewportValue.equals( _screen ) === false;
1396
1448
 
1397
1449
  renderContext.scissorValue.copy( scissor ).multiplyScalar( pixelRatio ).floor();
1398
- renderContext.scissor = this._scissorTest && renderContext.scissorValue.equals( _screen ) === false;
1450
+ renderContext.scissor = canvasTarget._scissorTest && renderContext.scissorValue.equals( _screen ) === false;
1399
1451
  renderContext.scissorValue.width >>= activeMipmapLevel;
1400
1452
  renderContext.scissorValue.height >>= activeMipmapLevel;
1401
1453
 
@@ -1529,14 +1581,20 @@ class Renderer {
1529
1581
 
1530
1582
  //
1531
1583
 
1584
+ this.inspector.finishRender( this.backend.getTimestampUID( renderContext ) );
1585
+
1586
+ //
1587
+
1532
1588
  return renderContext;
1533
1589
 
1534
1590
  }
1535
1591
 
1536
1592
  _setXRLayerSize( width, height ) {
1537
1593
 
1538
- this._width = width;
1539
- this._height = height;
1594
+ // TODO: Find a better solution to resize the canvas when in XR.
1595
+
1596
+ this._canvasTarget._width = width;
1597
+ this._canvasTarget._height = height;
1540
1598
 
1541
1599
  this.setViewport( 0, 0, width, height );
1542
1600
 
@@ -1614,7 +1672,7 @@ class Renderer {
1614
1672
  * for best compatibility.
1615
1673
  *
1616
1674
  * @async
1617
- * @param {?Function} callback - The application's animation loop.
1675
+ * @param {?onAnimationCallback} callback - The application's animation loop.
1618
1676
  * @return {Promise} A Promise that resolves when the set has been executed.
1619
1677
  */
1620
1678
  async setAnimationLoop( callback ) {
@@ -1625,6 +1683,17 @@ class Renderer {
1625
1683
 
1626
1684
  }
1627
1685
 
1686
+ /**
1687
+ * Returns the current animation loop callback.
1688
+ *
1689
+ * @return {?Function} The current animation loop callback.
1690
+ */
1691
+ getAnimationLoop() {
1692
+
1693
+ return this._animation.getAnimationLoop();
1694
+
1695
+ }
1696
+
1628
1697
  /**
1629
1698
  * Can be used to transfer buffer data from a storage buffer attribute
1630
1699
  * from the GPU to the CPU in context of compute shaders.
@@ -1657,7 +1726,7 @@ class Renderer {
1657
1726
  */
1658
1727
  getPixelRatio() {
1659
1728
 
1660
- return this._pixelRatio;
1729
+ return this._canvasTarget.getPixelRatio();
1661
1730
 
1662
1731
  }
1663
1732
 
@@ -1669,7 +1738,7 @@ class Renderer {
1669
1738
  */
1670
1739
  getDrawingBufferSize( target ) {
1671
1740
 
1672
- return target.set( this._width * this._pixelRatio, this._height * this._pixelRatio ).floor();
1741
+ return this._canvasTarget.getDrawingBufferSize( target );
1673
1742
 
1674
1743
  }
1675
1744
 
@@ -1681,7 +1750,7 @@ class Renderer {
1681
1750
  */
1682
1751
  getSize( target ) {
1683
1752
 
1684
- return target.set( this._width, this._height );
1753
+ return this._canvasTarget.getSize( target );
1685
1754
 
1686
1755
  }
1687
1756
 
@@ -1692,11 +1761,7 @@ class Renderer {
1692
1761
  */
1693
1762
  setPixelRatio( value = 1 ) {
1694
1763
 
1695
- if ( this._pixelRatio === value ) return;
1696
-
1697
- this._pixelRatio = value;
1698
-
1699
- this.setSize( this._width, this._height, false );
1764
+ this._canvasTarget.setPixelRatio( value );
1700
1765
 
1701
1766
  }
1702
1767
 
@@ -1718,17 +1783,7 @@ class Renderer {
1718
1783
  // Renderer can't be resized while presenting in XR.
1719
1784
  if ( this.xr && this.xr.isPresenting ) return;
1720
1785
 
1721
- this._width = width;
1722
- this._height = height;
1723
-
1724
- this._pixelRatio = pixelRatio;
1725
-
1726
- this.domElement.width = Math.floor( width * pixelRatio );
1727
- this.domElement.height = Math.floor( height * pixelRatio );
1728
-
1729
- this.setViewport( 0, 0, width, height );
1730
-
1731
- if ( this._initialized ) this.backend.updateSize();
1786
+ this._canvasTarget.setDrawingBufferSize( width, height, pixelRatio );
1732
1787
 
1733
1788
  }
1734
1789
 
@@ -1744,22 +1799,7 @@ class Renderer {
1744
1799
  // Renderer can't be resized while presenting in XR.
1745
1800
  if ( this.xr && this.xr.isPresenting ) return;
1746
1801
 
1747
- this._width = width;
1748
- this._height = height;
1749
-
1750
- this.domElement.width = Math.floor( width * this._pixelRatio );
1751
- this.domElement.height = Math.floor( height * this._pixelRatio );
1752
-
1753
- if ( updateStyle === true ) {
1754
-
1755
- this.domElement.style.width = width + 'px';
1756
- this.domElement.style.height = height + 'px';
1757
-
1758
- }
1759
-
1760
- this.setViewport( 0, 0, width, height );
1761
-
1762
- if ( this._initialized ) this.backend.updateSize();
1802
+ this._canvasTarget.setSize( width, height, updateStyle );
1763
1803
 
1764
1804
  }
1765
1805
 
@@ -1795,14 +1835,7 @@ class Renderer {
1795
1835
  */
1796
1836
  getScissor( target ) {
1797
1837
 
1798
- const scissor = this._scissor;
1799
-
1800
- target.x = scissor.x;
1801
- target.y = scissor.y;
1802
- target.width = scissor.width;
1803
- target.height = scissor.height;
1804
-
1805
- return target;
1838
+ return this._canvasTarget.getScissor( target );
1806
1839
 
1807
1840
  }
1808
1841
 
@@ -1817,17 +1850,7 @@ class Renderer {
1817
1850
  */
1818
1851
  setScissor( x, y, width, height ) {
1819
1852
 
1820
- const scissor = this._scissor;
1821
-
1822
- if ( x.isVector4 ) {
1823
-
1824
- scissor.copy( x );
1825
-
1826
- } else {
1827
-
1828
- scissor.set( x, y, width, height );
1829
-
1830
- }
1853
+ this._canvasTarget.setScissor( x, y, width, height );
1831
1854
 
1832
1855
  }
1833
1856
 
@@ -1838,7 +1861,7 @@ class Renderer {
1838
1861
  */
1839
1862
  getScissorTest() {
1840
1863
 
1841
- return this._scissorTest;
1864
+ return this._canvasTarget.getScissorTest();
1842
1865
 
1843
1866
  }
1844
1867
 
@@ -1849,7 +1872,9 @@ class Renderer {
1849
1872
  */
1850
1873
  setScissorTest( boolean ) {
1851
1874
 
1852
- this._scissorTest = boolean;
1875
+ this._canvasTarget.setScissorTest( boolean );
1876
+
1877
+ // TODO: Move it to CanvasTarget event listener.
1853
1878
 
1854
1879
  this.backend.setScissorTest( boolean );
1855
1880
 
@@ -1863,7 +1888,7 @@ class Renderer {
1863
1888
  */
1864
1889
  getViewport( target ) {
1865
1890
 
1866
- return target.copy( this._viewport );
1891
+ return this._canvasTarget.getViewport( target );
1867
1892
 
1868
1893
  }
1869
1894
 
@@ -1879,20 +1904,7 @@ class Renderer {
1879
1904
  */
1880
1905
  setViewport( x, y, width, height, minDepth = 0, maxDepth = 1 ) {
1881
1906
 
1882
- const viewport = this._viewport;
1883
-
1884
- if ( x.isVector4 ) {
1885
-
1886
- viewport.copy( x );
1887
-
1888
- } else {
1889
-
1890
- viewport.set( x, y, width, height );
1891
-
1892
- }
1893
-
1894
- viewport.minDepth = minDepth;
1895
- viewport.maxDepth = maxDepth;
1907
+ this._canvasTarget.setViewport( x, y, width, height, minDepth, maxDepth );
1896
1908
 
1897
1909
  }
1898
1910
 
@@ -2009,16 +2021,12 @@ class Renderer {
2009
2021
  * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
2010
2022
  * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
2011
2023
  * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
2012
- * @return {Promise} A Promise that resolves when the clear operation has been executed.
2013
- * Only returned when the renderer has not been initialized.
2014
2024
  */
2015
2025
  clear( color = true, depth = true, stencil = true ) {
2016
2026
 
2017
2027
  if ( this._initialized === false ) {
2018
2028
 
2019
- console.warn( 'THREE.Renderer: .clear() called before the backend is initialized. Try using .clearAsync() instead.' );
2020
-
2021
- return this.clearAsync( color, depth, stencil );
2029
+ throw new Error( 'Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.' );
2022
2030
 
2023
2031
  }
2024
2032
 
@@ -2059,37 +2067,28 @@ class Renderer {
2059
2067
 
2060
2068
  /**
2061
2069
  * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties.
2062
- *
2063
- * @return {Promise} A Promise that resolves when the clear operation has been executed.
2064
- * Only returned when the renderer has not been initialized.
2065
2070
  */
2066
2071
  clearColor() {
2067
2072
 
2068
- return this.clear( true, false, false );
2073
+ this.clear( true, false, false );
2069
2074
 
2070
2075
  }
2071
2076
 
2072
2077
  /**
2073
2078
  * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties.
2074
- *
2075
- * @return {Promise} A Promise that resolves when the clear operation has been executed.
2076
- * Only returned when the renderer has not been initialized.
2077
2079
  */
2078
2080
  clearDepth() {
2079
2081
 
2080
- return this.clear( false, true, false );
2082
+ this.clear( false, true, false );
2081
2083
 
2082
2084
  }
2083
2085
 
2084
2086
  /**
2085
2087
  * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties.
2086
- *
2087
- * @return {Promise} A Promise that resolves when the clear operation has been executed.
2088
- * Only returned when the renderer has not been initialized.
2089
2088
  */
2090
2089
  clearStencil() {
2091
2090
 
2092
- return this.clear( false, false, true );
2091
+ this.clear( false, false, true );
2093
2092
 
2094
2093
  }
2095
2094
 
@@ -2097,6 +2096,7 @@ class Renderer {
2097
2096
  * Async version of {@link Renderer#clear}.
2098
2097
  *
2099
2098
  * @async
2099
+ * @deprecated
2100
2100
  * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
2101
2101
  * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
2102
2102
  * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
@@ -2104,7 +2104,9 @@ class Renderer {
2104
2104
  */
2105
2105
  async clearAsync( color = true, depth = true, stencil = true ) {
2106
2106
 
2107
- if ( this._initialized === false ) await this.init();
2107
+ warnOnce( 'Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2108
+
2109
+ await this.init();
2108
2110
 
2109
2111
  this.clear( color, depth, stencil );
2110
2112
 
@@ -2114,11 +2116,14 @@ class Renderer {
2114
2116
  * Async version of {@link Renderer#clearColor}.
2115
2117
  *
2116
2118
  * @async
2119
+ * @deprecated
2117
2120
  * @return {Promise} A Promise that resolves when the clear operation has been executed.
2118
2121
  */
2119
2122
  async clearColorAsync() {
2120
2123
 
2121
- this.clearAsync( true, false, false );
2124
+ warnOnce( 'Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2125
+
2126
+ this.clear( true, false, false );
2122
2127
 
2123
2128
  }
2124
2129
 
@@ -2126,11 +2131,14 @@ class Renderer {
2126
2131
  * Async version of {@link Renderer#clearDepth}.
2127
2132
  *
2128
2133
  * @async
2134
+ * @deprecated
2129
2135
  * @return {Promise} A Promise that resolves when the clear operation has been executed.
2130
2136
  */
2131
2137
  async clearDepthAsync() {
2132
2138
 
2133
- this.clearAsync( false, true, false );
2139
+ warnOnce( 'Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2140
+
2141
+ this.clear( false, true, false );
2134
2142
 
2135
2143
  }
2136
2144
 
@@ -2138,11 +2146,67 @@ class Renderer {
2138
2146
  * Async version of {@link Renderer#clearStencil}.
2139
2147
  *
2140
2148
  * @async
2149
+ * @deprecated
2141
2150
  * @return {Promise} A Promise that resolves when the clear operation has been executed.
2142
2151
  */
2143
2152
  async clearStencilAsync() {
2144
2153
 
2145
- this.clearAsync( false, false, true );
2154
+ warnOnce( 'Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2155
+
2156
+ this.clear( false, false, true );
2157
+
2158
+ }
2159
+
2160
+ /**
2161
+ * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion.
2162
+ * If this is the case, the renderer allocates an internal render target for that purpose.
2163
+ *
2164
+ */
2165
+ get needsFrameBufferTarget() {
2166
+
2167
+ const useToneMapping = this.currentToneMapping !== NoToneMapping;
2168
+ const useColorSpace = this.currentColorSpace !== ColorManagement.workingColorSpace;
2169
+
2170
+ return useToneMapping || useColorSpace;
2171
+
2172
+ }
2173
+
2174
+ /**
2175
+ * The number of samples used for multi-sample anti-aliasing (MSAA).
2176
+ *
2177
+ * @type {number}
2178
+ * @default 0
2179
+ */
2180
+ get samples() {
2181
+
2182
+ return this._samples;
2183
+
2184
+ }
2185
+
2186
+ /**
2187
+ * The current number of samples used for multi-sample anti-aliasing (MSAA).
2188
+ *
2189
+ * When rendering to a custom render target, the number of samples of that render target is used.
2190
+ * If the renderer needs an internal framebuffer target for tone mapping or color space conversion,
2191
+ * the number of samples is set to 0.
2192
+ *
2193
+ * @type {number}
2194
+ */
2195
+ get currentSamples() {
2196
+
2197
+ let samples = this._samples;
2198
+
2199
+ if ( this._renderTarget !== null ) {
2200
+
2201
+ samples = this._renderTarget.samples;
2202
+
2203
+ } else if ( this.needsFrameBufferTarget ) {
2204
+
2205
+ samples = 0;
2206
+
2207
+ }
2208
+
2209
+ return samples;
2146
2210
 
2147
2211
  }
2148
2212
 
@@ -2194,6 +2258,7 @@ class Renderer {
2194
2258
 
2195
2259
  this._animation.dispose();
2196
2260
  this._objects.dispose();
2261
+ this._geometries.dispose();
2197
2262
  this._pipelines.dispose();
2198
2263
  this._nodes.dispose();
2199
2264
  this._bindings.dispose();
@@ -2266,6 +2331,32 @@ class Renderer {
2266
2331
 
2267
2332
  }
2268
2333
 
2334
+ /**
2335
+ * Sets the canvas target. The canvas target manages the HTML canvas
2336
+ * or the offscreen canvas the renderer draws into.
2337
+ *
2338
+ * @param {CanvasTarget} canvasTarget - The canvas target.
2339
+ */
2340
+ setCanvasTarget( canvasTarget ) {
2341
+
2342
+ this._canvasTarget.removeEventListener( 'resize', this._onCanvasTargetResize );
2343
+
2344
+ this._canvasTarget = canvasTarget;
2345
+ this._canvasTarget.addEventListener( 'resize', this._onCanvasTargetResize );
2346
+
2347
+ }
2348
+
2349
+ /**
2350
+ * Returns the current canvas target.
2351
+ *
2352
+ * @return {CanvasTarget} The current canvas target.
2353
+ */
2354
+ getCanvasTarget() {
2355
+
2356
+ return this._canvasTarget;
2357
+
2358
+ }
2359
+
2269
2360
  /**
2270
2361
  * Resets the renderer to the initial state before WebXR started.
2271
2362
  *
@@ -2329,18 +2420,21 @@ class Renderer {
2329
2420
  * if the renderer has been initialized.
2330
2421
  *
2331
2422
  * @param {Node|Array<Node>} computeNodes - The compute node(s).
2332
- * @param {?(Array<number>|number)} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
2423
+ * @param {number|Array<number>|IndirectStorageBufferAttribute} [dispatchSize=null]
2424
+ * - A single number representing count, or
2425
+ * - An array [x, y, z] representing dispatch size, or
2426
+ * - A IndirectStorageBufferAttribute for indirect dispatch size.
2333
2427
  * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
2334
2428
  */
2335
- compute( computeNodes, dispatchSizeOrCount = null ) {
2429
+ compute( computeNodes, dispatchSize = null ) {
2336
2430
 
2337
2431
  if ( this._isDeviceLost === true ) return;
2338
2432
 
2339
2433
  if ( this._initialized === false ) {
2340
2434
 
2341
- console.warn( 'THREE.Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead.' );
2435
+ warn( 'Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead.' );
2342
2436
 
2343
- return this.computeAsync( computeNodes );
2437
+ return this.computeAsync( computeNodes, dispatchSize );
2344
2438
 
2345
2439
  }
2346
2440
 
@@ -2360,6 +2454,12 @@ class Renderer {
2360
2454
 
2361
2455
  //
2362
2456
 
2457
+ this.backend.updateTimeStampUID( computeNodes );
2458
+
2459
+ this.inspector.beginCompute( this.backend.getTimestampUID( computeNodes ), computeNodes );
2460
+
2461
+ //
2462
+
2363
2463
  const backend = this.backend;
2364
2464
  const pipelines = this._pipelines;
2365
2465
  const bindings = this._bindings;
@@ -2386,7 +2486,7 @@ class Renderer {
2386
2486
  computeNode.removeEventListener( 'dispose', dispose );
2387
2487
 
2388
2488
  pipelines.delete( computeNode );
2389
- bindings.delete( computeNode );
2489
+ bindings.deleteForCompute( computeNode );
2390
2490
  nodes.delete( computeNode );
2391
2491
 
2392
2492
  };
@@ -2411,7 +2511,7 @@ class Renderer {
2411
2511
  const computeBindings = bindings.getForCompute( computeNode );
2412
2512
  const computePipeline = pipelines.getForCompute( computeNode, computeBindings );
2413
2513
 
2414
- backend.compute( computeNodes, computeNode, computeBindings, computePipeline, dispatchSizeOrCount );
2514
+ backend.compute( computeNodes, computeNode, computeBindings, computePipeline, dispatchSize );
2415
2515
 
2416
2516
  }
2417
2517
 
@@ -2421,6 +2521,10 @@ class Renderer {
2421
2521
 
2422
2522
  nodeFrame.renderId = previousRenderId;
2423
2523
 
2524
+ //
2525
+
2526
+ this.inspector.finishCompute( this.backend.getTimestampUID( computeNodes ) );
2527
+
2424
2528
  }
2425
2529
 
2426
2530
  /**
@@ -2428,14 +2532,17 @@ class Renderer {
2428
2532
  *
2429
2533
  * @async
2430
2534
  * @param {Node|Array<Node>} computeNodes - The compute node(s).
2431
- * @param {?(Array<number>|number)} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
2535
+ * @param {number|Array<number>|IndirectStorageBufferAttribute} [dispatchSize=null]
2536
+ * - A single number representing count, or
2537
+ * - An array [x, y, z] representing dispatch size, or
2538
+ * - A IndirectStorageBufferAttribute for indirect dispatch size.
2432
2539
  * @return {Promise} A Promise that resolve when the compute has finished.
2433
2540
  */
2434
- async computeAsync( computeNodes, dispatchSizeOrCount = null ) {
2541
+ async computeAsync( computeNodes, dispatchSize = null ) {
2435
2542
 
2436
2543
  if ( this._initialized === false ) await this.init();
2437
2544
 
2438
- this.compute( computeNodes, dispatchSizeOrCount );
2545
+ this.compute( computeNodes, dispatchSize );
2439
2546
 
2440
2547
  }
2441
2548
 
@@ -2443,14 +2550,17 @@ class Renderer {
2443
2550
  * Checks if the given feature is supported by the selected backend.
2444
2551
  *
2445
2552
  * @async
2553
+ * @deprecated
2446
2554
  * @param {string} name - The feature's name.
2447
2555
  * @return {Promise<boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
2448
2556
  */
2449
2557
  async hasFeatureAsync( name ) {
2450
2558
 
2451
- if ( this._initialized === false ) await this.init();
2559
+ warnOnce( 'Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2452
2560
 
2453
- return this.backend.hasFeature( name );
2561
+ await this.init();
2562
+
2563
+ return this.hasFeature( name );
2454
2564
 
2455
2565
  }
2456
2566
 
@@ -2473,9 +2583,7 @@ class Renderer {
2473
2583
 
2474
2584
  if ( this._initialized === false ) {
2475
2585
 
2476
- console.warn( 'THREE.Renderer: .hasFeature() called before the backend is initialized. Try using .hasFeatureAsync() instead.' );
2477
-
2478
- return false;
2586
+ throw new Error( 'Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.' );
2479
2587
 
2480
2588
  }
2481
2589
 
@@ -2499,14 +2607,17 @@ class Renderer {
2499
2607
  * (which can cause noticeable lags due to decode and GPU upload overhead).
2500
2608
  *
2501
2609
  * @async
2610
+ * @deprecated
2502
2611
  * @param {Texture} texture - The texture.
2503
2612
  * @return {Promise} A Promise that resolves when the texture has been initialized.
2504
2613
  */
2505
2614
  async initTextureAsync( texture ) {
2506
2615
 
2507
- if ( this._initialized === false ) await this.init();
2616
+ warnOnce( 'Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
2508
2617
 
2509
- this._textures.updateTexture( texture );
2618
+ await this.init();
2619
+
2620
+ this.initTexture( texture );
2510
2621
 
2511
2622
  }
2512
2623
 
@@ -2522,7 +2633,7 @@ class Renderer {
2522
2633
 
2523
2634
  if ( this._initialized === false ) {
2524
2635
 
2525
- console.warn( 'THREE.Renderer: .initTexture() called before the backend is initialized. Try using .initTextureAsync() instead.' );
2636
+ throw new Error( 'Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.' );
2526
2637
 
2527
2638
  }
2528
2639
 
@@ -2550,7 +2661,7 @@ class Renderer {
2550
2661
 
2551
2662
  } else {
2552
2663
 
2553
- console.error( 'THREE.Renderer.copyFramebufferToTexture: Invalid rectangle.' );
2664
+ error( 'Renderer.copyFramebufferToTexture: Invalid rectangle.' );
2554
2665
 
2555
2666
  return;
2556
2667
 
@@ -2591,6 +2702,8 @@ class Renderer {
2591
2702
 
2592
2703
  this.backend.copyFramebufferToTexture( framebufferTexture, renderContext, rectangle );
2593
2704
 
2705
+ this._inspector.copyFramebufferToTexture( framebufferTexture );
2706
+
2594
2707
  }
2595
2708
 
2596
2709
  /**
@@ -2610,6 +2723,8 @@ class Renderer {
2610
2723
 
2611
2724
  this.backend.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, srcLevel, dstLevel );
2612
2725
 
2726
+ this._inspector.copyTextureToTexture( srcTexture, dstTexture );
2727
+
2613
2728
  }
2614
2729
 
2615
2730
  /**
@@ -2687,7 +2802,7 @@ class Renderer {
2687
2802
 
2688
2803
  } else if ( object.isLineLoop ) {
2689
2804
 
2690
- console.error( 'THREE.Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.' );
2805
+ error( 'Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.' );
2691
2806
 
2692
2807
  } else if ( object.isMesh || object.isLine || object.isPoints ) {
2693
2808
 
@@ -2856,6 +2971,93 @@ class Renderer {
2856
2971
 
2857
2972
  }
2858
2973
 
2974
+ /**
2975
+ * Retrieves shadow nodes for the given material. This is used to setup shadow passes.
2976
+ * The result is cached per material and updated when the material's version changes.
2977
+ *
2978
+ * @param {Material} material
2979
+ * @returns {Object} - The shadow nodes for the material.
2980
+ */
2981
+ _getShadowNodes( material ) {
2982
+
2983
+ const version = material.version;
2984
+
2985
+ let cache = this._cacheShadowNodes.get( material );
2986
+
2987
+ if ( cache === undefined || cache.version !== version ) {
2988
+
2989
+ const hasMap = material.map !== null;
2990
+ const hasColorNode = material.colorNode && material.colorNode.isNode;
2991
+ const hasCastShadowNode = material.castShadowNode && material.castShadowNode.isNode;
2992
+
2993
+ let positionNode = null;
2994
+ let colorNode = null;
2995
+ let depthNode = null;
2996
+
2997
+ if ( hasMap || hasColorNode || hasCastShadowNode ) {
2998
+
2999
+ let shadowRGB;
3000
+ let shadowAlpha;
3001
+
3002
+ if ( hasCastShadowNode ) {
3003
+
3004
+ shadowRGB = material.castShadowNode.rgb;
3005
+ shadowAlpha = material.castShadowNode.a;
3006
+
3007
+ } else {
3008
+
3009
+ shadowRGB = vec3( 0 );
3010
+ shadowAlpha = float( 1 );
3011
+
3012
+ }
3013
+
3014
+ if ( hasMap ) {
3015
+
3016
+ shadowAlpha = shadowAlpha.mul( reference( 'map', 'texture', material ).a );
3017
+
3018
+ }
3019
+
3020
+ if ( hasColorNode ) {
3021
+
3022
+ shadowAlpha = shadowAlpha.mul( material.colorNode.a );
3023
+
3024
+ }
3025
+
3026
+ colorNode = vec4( shadowRGB, shadowAlpha );
3027
+
3028
+ }
3029
+
3030
+ if ( material.depthNode && material.depthNode.isNode ) {
3031
+
3032
+ depthNode = material.depthNode;
3033
+
3034
+ }
3035
+
3036
+ if ( material.castShadowPositionNode && material.castShadowPositionNode.isNode ) {
3037
+
3038
+ positionNode = material.castShadowPositionNode;
3039
+
3040
+ } else if ( material.positionNode && material.positionNode.isNode ) {
3041
+
3042
+ positionNode = material.positionNode;
3043
+
3044
+ }
3045
+
3046
+ cache = {
3047
+ version,
3048
+ colorNode,
3049
+ depthNode,
3050
+ positionNode
3051
+ };
3052
+
3053
+ this._cacheShadowNodes.set( material, cache );
3054
+
3055
+ }
3056
+
3057
+ return cache;
3058
+
3059
+ }
3060
+
2859
3061
  /**
2860
3062
  * This method represents the default render object function that manages the render lifecycle
2861
3063
  * of the object.
@@ -2872,9 +3074,11 @@ class Renderer {
2872
3074
  */
2873
3075
  renderObject( object, scene, camera, geometry, material, group, lightsNode, clippingContext = null, passId = null ) {
2874
3076
 
2875
- let overridePositionNode;
2876
- let overrideColorNode;
2877
- let overrideDepthNode;
3077
+ let materialOverride = false;
3078
+ let materialColorNode;
3079
+ let materialDepthNode;
3080
+ let materialPositionNode;
3081
+ let materialSide;
2878
3082
 
2879
3083
  //
2880
3084
 
@@ -2886,41 +3090,35 @@ class Renderer {
2886
3090
 
2887
3091
  const overrideMaterial = scene.overrideMaterial;
2888
3092
 
3093
+ materialOverride = true;
3094
+
3095
+ // store original nodes
3096
+ materialColorNode = scene.overrideMaterial.colorNode;
3097
+ materialDepthNode = scene.overrideMaterial.depthNode;
3098
+ materialPositionNode = scene.overrideMaterial.positionNode;
3099
+ materialSide = scene.overrideMaterial.side;
3100
+
2889
3101
  if ( material.positionNode && material.positionNode.isNode ) {
2890
3102
 
2891
- overridePositionNode = overrideMaterial.positionNode;
2892
3103
  overrideMaterial.positionNode = material.positionNode;
2893
3104
 
2894
3105
  }
2895
3106
 
2896
3107
  overrideMaterial.alphaTest = material.alphaTest;
2897
3108
  overrideMaterial.alphaMap = material.alphaMap;
2898
- overrideMaterial.transparent = material.transparent || material.transmission > 0;
3109
+ overrideMaterial.transparent = material.transparent || material.transmission > 0 ||
3110
+ ( material.transmissionNode && material.transmissionNode.isNode ) ||
3111
+ ( material.backdropNode && material.backdropNode.isNode );
2899
3112
 
2900
3113
  if ( overrideMaterial.isShadowPassMaterial ) {
2901
3114
 
2902
- overrideMaterial.side = material.shadowSide === null ? material.side : material.shadowSide;
2903
-
2904
- if ( material.depthNode && material.depthNode.isNode ) {
2905
-
2906
- overrideDepthNode = overrideMaterial.depthNode;
2907
- overrideMaterial.depthNode = material.depthNode;
2908
-
2909
- }
3115
+ const { colorNode, depthNode, positionNode } = this._getShadowNodes( material );
2910
3116
 
2911
- if ( material.castShadowNode && material.castShadowNode.isNode ) {
2912
-
2913
- overrideColorNode = overrideMaterial.colorNode;
2914
- overrideMaterial.colorNode = material.castShadowNode;
2915
-
2916
- }
2917
-
2918
- if ( material.castShadowPositionNode && material.castShadowPositionNode.isNode ) {
2919
-
2920
- overridePositionNode = overrideMaterial.positionNode;
2921
- overrideMaterial.positionNode = material.castShadowPositionNode;
3117
+ overrideMaterial.side = material.shadowSide === null ? material.side : material.shadowSide;
2922
3118
 
2923
- }
3119
+ if ( colorNode !== null ) overrideMaterial.colorNode = colorNode;
3120
+ if ( depthNode !== null ) overrideMaterial.depthNode = depthNode;
3121
+ if ( positionNode !== null ) overrideMaterial.positionNode = positionNode;
2924
3122
 
2925
3123
  }
2926
3124
 
@@ -2948,21 +3146,12 @@ class Renderer {
2948
3146
 
2949
3147
  //
2950
3148
 
2951
- if ( overridePositionNode !== undefined ) {
3149
+ if ( materialOverride ) {
2952
3150
 
2953
- scene.overrideMaterial.positionNode = overridePositionNode;
2954
-
2955
- }
2956
-
2957
- if ( overrideDepthNode !== undefined ) {
2958
-
2959
- scene.overrideMaterial.depthNode = overrideDepthNode;
2960
-
2961
- }
2962
-
2963
- if ( overrideColorNode !== undefined ) {
2964
-
2965
- scene.overrideMaterial.colorNode = overrideColorNode;
3151
+ scene.overrideMaterial.colorNode = materialColorNode;
3152
+ scene.overrideMaterial.depthNode = materialDepthNode;
3153
+ scene.overrideMaterial.positionNode = materialPositionNode;
3154
+ scene.overrideMaterial.side = materialSide;
2966
3155
 
2967
3156
  }
2968
3157
 
@@ -3062,6 +3251,17 @@ class Renderer {
3062
3251
 
3063
3252
  }
3064
3253
 
3254
+ /**
3255
+ * Callback when the canvas has been resized.
3256
+ *
3257
+ * @private
3258
+ */
3259
+ _onCanvasTargetResize() {
3260
+
3261
+ if ( this._initialized ) this.backend.updateSize();
3262
+
3263
+ }
3264
+
3065
3265
  /**
3066
3266
  * Alias for `compileAsync()`.
3067
3267
  *
@@ -3079,4 +3279,12 @@ class Renderer {
3079
3279
 
3080
3280
  }
3081
3281
 
3282
+ /**
3283
+ * Animation loop parameter of `renderer.setAnimationLoop()`.
3284
+ *
3285
+ * @callback onAnimationCallback
3286
+ * @param {DOMHighResTimeStamp} time - A timestamp indicating the end time of the previous frame's rendering.
3287
+ * @param {XRFrame} [frame] - A reference to the current XR frame. Only relevant when using XR rendering.
3288
+ */
3289
+
3082
3290
  export default Renderer;