super-three 0.173.4 → 0.175.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 (832) hide show
  1. package/build/three.cjs +22198 -1564
  2. package/build/three.core.js +21287 -1346
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +882 -189
  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 +19358 -17482
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +19342 -17482
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +1 -1
  13. package/examples/jsm/animation/AnimationClipCreator.js +57 -6
  14. package/examples/jsm/animation/CCDIKSolver.js +144 -42
  15. package/examples/jsm/capabilities/WebGL.js +28 -3
  16. package/examples/jsm/capabilities/WebGPU.js +16 -6
  17. package/examples/jsm/controls/ArcballControls.js +424 -154
  18. package/examples/jsm/controls/DragControls.js +93 -2
  19. package/examples/jsm/controls/FirstPersonControls.js +113 -4
  20. package/examples/jsm/controls/FlyControls.js +49 -2
  21. package/examples/jsm/controls/MapControls.js +42 -9
  22. package/examples/jsm/controls/OrbitControls.js +345 -42
  23. package/examples/jsm/controls/PointerLockControls.js +111 -9
  24. package/examples/jsm/controls/TrackballControls.js +159 -8
  25. package/examples/jsm/controls/TransformControls.js +252 -6
  26. package/examples/jsm/csm/CSM.js +226 -15
  27. package/examples/jsm/csm/CSMFrustum.js +52 -0
  28. package/examples/jsm/csm/CSMHelper.js +47 -0
  29. package/examples/jsm/csm/CSMShader.js +10 -1
  30. package/examples/jsm/csm/CSMShadowNode.js +156 -13
  31. package/examples/jsm/curves/CurveExtras.js +289 -31
  32. package/examples/jsm/curves/NURBSCurve.js +57 -14
  33. package/examples/jsm/curves/NURBSSurface.js +50 -6
  34. package/examples/jsm/curves/NURBSUtils.js +96 -112
  35. package/examples/jsm/curves/NURBSVolume.js +22 -4
  36. package/examples/jsm/effects/AnaglyphEffect.js +30 -0
  37. package/examples/jsm/effects/AsciiEffect.js +60 -15
  38. package/examples/jsm/effects/OutlineEffect.js +59 -111
  39. package/examples/jsm/effects/ParallaxBarrierEffect.js +28 -0
  40. package/examples/jsm/effects/PeppersGhostEffect.js +21 -2
  41. package/examples/jsm/effects/StereoEffect.js +29 -0
  42. package/examples/jsm/environments/DebugEnvironment.js +49 -0
  43. package/examples/jsm/environments/RoomEnvironment.js +23 -4
  44. package/examples/jsm/exporters/DRACOExporter.js +53 -13
  45. package/examples/jsm/exporters/EXRExporter.js +37 -8
  46. package/examples/jsm/exporters/GLTFExporter.js +194 -71
  47. package/examples/jsm/exporters/KTX2Exporter.js +20 -0
  48. package/examples/jsm/exporters/OBJExporter.js +18 -0
  49. package/examples/jsm/exporters/PLYExporter.js +39 -9
  50. package/examples/jsm/exporters/STLExporter.js +25 -5
  51. package/examples/jsm/exporters/USDZExporter.js +70 -3
  52. package/examples/jsm/geometries/BoxLineGeometry.js +22 -0
  53. package/examples/jsm/geometries/ConvexGeometry.js +18 -0
  54. package/examples/jsm/geometries/DecalGeometry.js +20 -9
  55. package/examples/jsm/geometries/ParametricFunctions.js +97 -0
  56. package/examples/jsm/geometries/ParametricGeometry.js +37 -5
  57. package/examples/jsm/geometries/RoundedBoxGeometry.js +21 -0
  58. package/examples/jsm/geometries/TeapotGeometry.js +22 -38
  59. package/examples/jsm/geometries/TextGeometry.js +44 -16
  60. package/examples/jsm/helpers/LightProbeHelper.js +35 -0
  61. package/examples/jsm/helpers/LightProbeHelperGPU.js +36 -0
  62. package/examples/jsm/helpers/OctreeHelper.js +35 -0
  63. package/examples/jsm/helpers/PositionalAudioHelper.js +59 -0
  64. package/examples/jsm/helpers/RectAreaLightHelper.js +35 -3
  65. package/examples/jsm/helpers/TextureHelper.js +27 -0
  66. package/examples/jsm/helpers/TextureHelperGPU.js +28 -0
  67. package/examples/jsm/helpers/VertexNormalsHelper.js +58 -2
  68. package/examples/jsm/helpers/VertexTangentsHelper.js +46 -2
  69. package/examples/jsm/helpers/ViewHelper.js +75 -1
  70. package/examples/jsm/interactive/HTMLMesh.js +25 -0
  71. package/examples/jsm/interactive/InteractiveGroup.js +65 -5
  72. package/examples/jsm/interactive/SelectionBox.js +74 -9
  73. package/examples/jsm/interactive/SelectionHelper.js +74 -30
  74. package/examples/jsm/libs/motion-controllers.module.js +1 -1
  75. package/examples/jsm/lighting/TiledLighting.js +23 -0
  76. package/examples/jsm/lights/LightProbeGenerator.js +26 -1
  77. package/examples/jsm/lights/RectAreaLightTexturesLib.js +48 -13
  78. package/examples/jsm/lights/RectAreaLightUniformsLib.js +15 -0
  79. package/examples/jsm/lines/Line2.js +36 -0
  80. package/examples/jsm/lines/LineGeometry.js +52 -0
  81. package/examples/jsm/lines/LineMaterial.js +95 -0
  82. package/examples/jsm/lines/LineSegments2.js +51 -2
  83. package/examples/jsm/lines/LineSegmentsGeometry.js +62 -8
  84. package/examples/jsm/lines/Wireframe.js +38 -2
  85. package/examples/jsm/lines/WireframeGeometry2.js +24 -0
  86. package/examples/jsm/lines/webgpu/Line2.js +25 -1
  87. package/examples/jsm/lines/webgpu/LineSegments2.js +44 -6
  88. package/examples/jsm/lines/webgpu/Wireframe.js +30 -2
  89. package/examples/jsm/loaders/3DMLoader.js +71 -2
  90. package/examples/jsm/loaders/3MFLoader.js +51 -5
  91. package/examples/jsm/loaders/AMFLoader.js +31 -12
  92. package/examples/jsm/loaders/BVHLoader.js +57 -11
  93. package/examples/jsm/loaders/ColladaLoader.js +36 -1
  94. package/examples/jsm/loaders/DDSLoader.js +25 -1
  95. package/examples/jsm/loaders/DRACOLoader.js +73 -1
  96. package/examples/jsm/loaders/EXRLoader.js +40 -8
  97. package/examples/jsm/loaders/FBXLoader.js +71 -14
  98. package/examples/jsm/loaders/FontLoader.js +60 -2
  99. package/examples/jsm/loaders/GCodeLoader.js +33 -5
  100. package/examples/jsm/loaders/GLTFLoader.js +222 -9
  101. package/examples/jsm/loaders/HDRCubeTextureLoader.js +48 -0
  102. package/examples/jsm/loaders/IESLoader.js +41 -0
  103. package/examples/jsm/loaders/KMZLoader.js +32 -0
  104. package/examples/jsm/loaders/KTX2Loader.js +87 -19
  105. package/examples/jsm/loaders/KTXLoader.js +26 -6
  106. package/examples/jsm/loaders/LDrawLoader.js +115 -5
  107. package/examples/jsm/loaders/LUT3dlLoader.js +46 -10
  108. package/examples/jsm/loaders/LUTCubeLoader.js +45 -9
  109. package/examples/jsm/loaders/LUTImageLoader.js +78 -38
  110. package/examples/jsm/loaders/LWOLoader.js +46 -7
  111. package/examples/jsm/loaders/LottieLoader.js +37 -0
  112. package/examples/jsm/loaders/MD2Loader.js +36 -1
  113. package/examples/jsm/loaders/MDDLoader.js +56 -12
  114. package/examples/jsm/loaders/MTLLoader.js +56 -33
  115. package/examples/jsm/loaders/MaterialXLoader.js +33 -0
  116. package/examples/jsm/loaders/NRRDLoader.js +36 -5
  117. package/examples/jsm/loaders/OBJLoader.js +48 -1
  118. package/examples/jsm/loaders/PCDLoader.js +47 -0
  119. package/examples/jsm/loaders/PDBLoader.js +40 -2
  120. package/examples/jsm/loaders/PLYLoader.js +62 -32
  121. package/examples/jsm/loaders/PVRLoader.js +23 -5
  122. package/examples/jsm/loaders/RGBELoader.js +38 -5
  123. package/examples/jsm/loaders/RGBMLoader.js +67 -1
  124. package/examples/jsm/loaders/STLLoader.js +47 -38
  125. package/examples/jsm/loaders/SVGLoader.js +113 -20
  126. package/examples/jsm/loaders/TDSLoader.js +90 -70
  127. package/examples/jsm/loaders/TGALoader.js +22 -0
  128. package/examples/jsm/loaders/TIFFLoader.js +22 -0
  129. package/examples/jsm/loaders/TTFLoader.js +36 -2
  130. package/examples/jsm/loaders/USDZLoader.js +34 -1
  131. package/examples/jsm/loaders/UltraHDRLoader.js +58 -12
  132. package/examples/jsm/loaders/VOXLoader.js +57 -0
  133. package/examples/jsm/loaders/VRMLLoader.js +32 -1
  134. package/examples/jsm/loaders/VTKLoader.js +38 -0
  135. package/examples/jsm/loaders/XYZLoader.js +35 -0
  136. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +39 -0
  137. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +39 -0
  138. package/examples/jsm/materials/MeshPostProcessingMaterial.js +24 -2
  139. package/examples/jsm/math/Capsule.js +89 -14
  140. package/examples/jsm/math/ColorConverter.js +21 -0
  141. package/examples/jsm/math/ColorSpaces.js +53 -0
  142. package/examples/jsm/math/ConvexHull.js +514 -92
  143. package/examples/jsm/math/ImprovedNoise.js +14 -2
  144. package/examples/jsm/math/Lut.js +111 -0
  145. package/examples/jsm/math/MeshSurfaceSampler.js +76 -13
  146. package/examples/jsm/math/OBB.js +139 -46
  147. package/examples/jsm/math/Octree.js +132 -5
  148. package/examples/jsm/math/SimplexNoise.js +66 -42
  149. package/examples/jsm/misc/ConvexObjectBreaker.js +43 -25
  150. package/examples/jsm/misc/GPUComputationRenderer.js +92 -17
  151. package/examples/jsm/misc/Gyroscope.js +11 -0
  152. package/examples/jsm/misc/MD2Character.js +115 -2
  153. package/examples/jsm/misc/MD2CharacterComplex.js +170 -8
  154. package/examples/jsm/misc/MorphAnimMesh.js +43 -0
  155. package/examples/jsm/misc/MorphBlendMesh.js +102 -0
  156. package/examples/jsm/misc/ProgressiveLightMap.js +40 -15
  157. package/examples/jsm/misc/ProgressiveLightMapGPU.js +33 -13
  158. package/examples/jsm/misc/RollerCoaster.js +52 -0
  159. package/examples/jsm/misc/Timer.js +105 -13
  160. package/examples/jsm/misc/TubePainter.js +53 -0
  161. package/examples/jsm/misc/Volume.js +109 -73
  162. package/examples/jsm/misc/VolumeSlice.js +91 -48
  163. package/examples/jsm/modifiers/CurveModifier.js +57 -34
  164. package/examples/jsm/modifiers/CurveModifierGPU.js +36 -17
  165. package/examples/jsm/modifiers/EdgeSplitModifier.js +18 -0
  166. package/examples/jsm/modifiers/SimplifyModifier.js +20 -8
  167. package/examples/jsm/modifiers/TessellateModifier.js +33 -2
  168. package/examples/jsm/objects/GroundedSkybox.js +23 -5
  169. package/examples/jsm/objects/Lensflare.js +91 -2
  170. package/examples/jsm/objects/LensflareMesh.js +53 -2
  171. package/examples/jsm/objects/MarchingCubes.js +88 -5
  172. package/examples/jsm/objects/Reflector.js +75 -2
  173. package/examples/jsm/objects/ReflectorForSSRPass.js +39 -0
  174. package/examples/jsm/objects/Refractor.js +61 -0
  175. package/examples/jsm/objects/ShadowMesh.js +53 -4
  176. package/examples/jsm/objects/Sky.js +26 -9
  177. package/examples/jsm/objects/SkyMesh.js +60 -9
  178. package/examples/jsm/objects/Water.js +44 -5
  179. package/examples/jsm/objects/Water2.js +42 -3
  180. package/examples/jsm/objects/Water2Mesh.js +38 -3
  181. package/examples/jsm/objects/WaterMesh.js +94 -7
  182. package/examples/jsm/physics/AmmoPhysics.js +47 -0
  183. package/examples/jsm/physics/JoltPhysics.js +48 -0
  184. package/examples/jsm/physics/RapierPhysics.js +56 -0
  185. package/examples/jsm/postprocessing/AfterimagePass.js +90 -38
  186. package/examples/jsm/postprocessing/BloomPass.js +125 -24
  187. package/examples/jsm/postprocessing/BokehPass.js +98 -22
  188. package/examples/jsm/postprocessing/ClearPass.js +53 -3
  189. package/examples/jsm/postprocessing/CubeTexturePass.js +81 -21
  190. package/examples/jsm/postprocessing/DotScreenPass.js +58 -10
  191. package/examples/jsm/postprocessing/EffectComposer.js +134 -0
  192. package/examples/jsm/postprocessing/FilmPass.js +53 -5
  193. package/examples/jsm/postprocessing/GTAOPass.js +191 -48
  194. package/examples/jsm/postprocessing/GlitchPass.js +84 -33
  195. package/examples/jsm/postprocessing/HalftonePass.js +64 -10
  196. package/examples/jsm/postprocessing/LUTPass.js +37 -8
  197. package/examples/jsm/postprocessing/MaskPass.js +90 -0
  198. package/examples/jsm/postprocessing/OutlinePass.js +268 -134
  199. package/examples/jsm/postprocessing/OutputPass.js +53 -14
  200. package/examples/jsm/postprocessing/Pass.js +98 -4
  201. package/examples/jsm/postprocessing/RenderPass.js +83 -0
  202. package/examples/jsm/postprocessing/RenderPixelatedPass.js +123 -45
  203. package/examples/jsm/postprocessing/RenderTransitionPass.js +119 -21
  204. package/examples/jsm/postprocessing/SAOPass.js +126 -53
  205. package/examples/jsm/postprocessing/SMAAPass.js +103 -71
  206. package/examples/jsm/postprocessing/SSAARenderPass.js +117 -35
  207. package/examples/jsm/postprocessing/SSAOPass.js +160 -47
  208. package/examples/jsm/postprocessing/SSRPass.js +230 -49
  209. package/examples/jsm/postprocessing/SavePass.js +68 -16
  210. package/examples/jsm/postprocessing/ShaderPass.js +64 -7
  211. package/examples/jsm/postprocessing/TAARenderPass.js +78 -24
  212. package/examples/jsm/postprocessing/TexturePass.js +71 -8
  213. package/examples/jsm/postprocessing/UnrealBloomPass.js +113 -37
  214. package/examples/jsm/renderers/CSS2DRenderer.js +77 -1
  215. package/examples/jsm/renderers/CSS3DRenderer.js +99 -3
  216. package/examples/jsm/renderers/Projector.js +18 -2
  217. package/examples/jsm/renderers/SVGRenderer.js +124 -0
  218. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +9 -5
  219. package/examples/jsm/shaders/AfterimageShader.js +6 -4
  220. package/examples/jsm/shaders/BasicShader.js +6 -2
  221. package/examples/jsm/shaders/BleachBypassShader.js +8 -4
  222. package/examples/jsm/shaders/BlendShader.js +6 -2
  223. package/examples/jsm/shaders/BokehShader.js +7 -4
  224. package/examples/jsm/shaders/BokehShader2.js +7 -3
  225. package/examples/jsm/shaders/BrightnessContrastShader.js +8 -5
  226. package/examples/jsm/shaders/ColorCorrectionShader.js +6 -2
  227. package/examples/jsm/shaders/ColorifyShader.js +6 -2
  228. package/examples/jsm/shaders/ConvolutionShader.js +7 -39
  229. package/examples/jsm/shaders/CopyShader.js +6 -2
  230. package/examples/jsm/shaders/DOFMipMapShader.js +8 -4
  231. package/examples/jsm/shaders/DepthLimitedBlurShader.js +7 -1
  232. package/examples/jsm/shaders/DigitalGlitch.js +7 -7
  233. package/examples/jsm/shaders/DotScreenShader.js +6 -4
  234. package/examples/jsm/shaders/ExposureShader.js +6 -2
  235. package/examples/jsm/shaders/FXAAShader.js +15 -7
  236. package/examples/jsm/shaders/FilmShader.js +10 -0
  237. package/examples/jsm/shaders/FocusShader.js +6 -4
  238. package/examples/jsm/shaders/FreiChenShader.js +7 -3
  239. package/examples/jsm/shaders/GTAOShader.js +33 -39
  240. package/examples/jsm/shaders/GammaCorrectionShader.js +8 -2
  241. package/examples/jsm/shaders/GodRaysShader.js +14 -5
  242. package/examples/jsm/shaders/HalftoneShader.js +11 -5
  243. package/examples/jsm/shaders/HorizontalBlurShader.js +9 -3
  244. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +6 -2
  245. package/examples/jsm/shaders/HueSaturationShader.js +7 -3
  246. package/examples/jsm/shaders/KaleidoShader.js +8 -4
  247. package/examples/jsm/shaders/LuminosityHighPassShader.js +6 -5
  248. package/examples/jsm/shaders/LuminosityShader.js +6 -3
  249. package/examples/jsm/shaders/MirrorShader.js +7 -4
  250. package/examples/jsm/shaders/NormalMapShader.js +5 -3
  251. package/examples/jsm/shaders/OutputShader.js +11 -0
  252. package/examples/jsm/shaders/PoissonDenoiseShader.js +21 -15
  253. package/examples/jsm/shaders/RGBShiftShader.js +5 -1
  254. package/examples/jsm/shaders/SAOShader.js +8 -2
  255. package/examples/jsm/shaders/SMAAShader.js +23 -1
  256. package/examples/jsm/shaders/SSAOShader.js +23 -5
  257. package/examples/jsm/shaders/SSRShader.js +25 -1
  258. package/examples/jsm/shaders/SepiaShader.js +6 -4
  259. package/examples/jsm/shaders/SobelOperatorShader.js +5 -2
  260. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +10 -8
  261. package/examples/jsm/shaders/TechnicolorShader.js +7 -4
  262. package/examples/jsm/shaders/ToonShader.js +29 -7
  263. package/examples/jsm/shaders/TriangleBlurShader.js +6 -4
  264. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +6 -3
  265. package/examples/jsm/shaders/VelocityShader.js +6 -2
  266. package/examples/jsm/shaders/VerticalBlurShader.js +6 -2
  267. package/examples/jsm/shaders/VerticalTiltShiftShader.js +5 -1
  268. package/examples/jsm/shaders/VignetteShader.js +6 -4
  269. package/examples/jsm/shaders/VolumeShader.js +7 -1
  270. package/examples/jsm/shaders/WaterRefractionShader.js +8 -0
  271. package/examples/jsm/textures/FlakesTexture.js +12 -0
  272. package/examples/jsm/transpiler/AST.js +10 -0
  273. package/examples/jsm/transpiler/GLSLDecoder.js +17 -3
  274. package/examples/jsm/transpiler/TSLEncoder.js +83 -15
  275. package/examples/jsm/transpiler/Transpiler.js +31 -0
  276. package/examples/jsm/tsl/display/AfterImageNode.js +24 -25
  277. package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -3
  278. package/examples/jsm/tsl/display/AnamorphicNode.js +8 -9
  279. package/examples/jsm/tsl/display/BleachBypass.js +1 -2
  280. package/examples/jsm/tsl/display/BloomNode.js +15 -16
  281. package/examples/jsm/tsl/display/DenoiseNode.js +9 -10
  282. package/examples/jsm/tsl/display/DepthOfFieldNode.js +5 -6
  283. package/examples/jsm/tsl/display/DotScreenNode.js +5 -6
  284. package/examples/jsm/tsl/display/FXAANode.js +2 -3
  285. package/examples/jsm/tsl/display/FilmNode.js +9 -8
  286. package/examples/jsm/tsl/display/GTAONode.js +11 -12
  287. package/examples/jsm/tsl/display/GaussianBlurNode.js +14 -14
  288. package/examples/jsm/tsl/display/LensflareNode.js +15 -16
  289. package/examples/jsm/tsl/display/Lut3DNode.js +4 -5
  290. package/examples/jsm/tsl/display/MotionBlur.js +1 -2
  291. package/examples/jsm/tsl/display/OutlineNode.js +7 -8
  292. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -3
  293. package/examples/jsm/tsl/display/PixelationPassNode.js +14 -15
  294. package/examples/jsm/tsl/display/RGBShiftNode.js +5 -6
  295. package/examples/jsm/tsl/display/SMAANode.js +13 -7
  296. package/examples/jsm/tsl/display/SSAAPassNode.js +7 -7
  297. package/examples/jsm/tsl/display/SSRNode.js +6 -7
  298. package/examples/jsm/tsl/display/Sepia.js +1 -2
  299. package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -3
  300. package/examples/jsm/tsl/display/StereoCompositePassNode.js +4 -4
  301. package/examples/jsm/tsl/display/StereoPassNode.js +2 -3
  302. package/examples/jsm/tsl/display/TRAAPassNode.js +11 -10
  303. package/examples/jsm/tsl/display/TransitionNode.js +4 -5
  304. package/examples/jsm/tsl/display/hashBlur.js +1 -2
  305. package/examples/jsm/tsl/lighting/TiledLightsNode.js +33 -7
  306. package/examples/jsm/tsl/math/Bayer.js +31 -0
  307. package/examples/jsm/tsl/utils/Raymarching.js +67 -0
  308. package/examples/jsm/utils/BufferGeometryUtils.js +88 -29
  309. package/examples/jsm/utils/CameraUtils.js +10 -7
  310. package/examples/jsm/utils/GeometryCompressionUtils.js +20 -30
  311. package/examples/jsm/utils/GeometryUtils.js +12 -13
  312. package/examples/jsm/utils/LDrawUtils.js +11 -4
  313. package/examples/jsm/utils/SceneOptimizer.js +66 -20
  314. package/examples/jsm/utils/SceneUtils.js +50 -3
  315. package/examples/jsm/utils/ShadowMapViewer.js +47 -24
  316. package/examples/jsm/utils/ShadowMapViewerGPU.js +47 -24
  317. package/examples/jsm/utils/SkeletonUtils.js +45 -0
  318. package/examples/jsm/utils/SortUtils.js +14 -5
  319. package/examples/jsm/utils/UVsDebug.js +9 -4
  320. package/examples/jsm/utils/WebGLTextureUtils.js +13 -0
  321. package/examples/jsm/utils/WebGPUTextureUtils.js +14 -0
  322. package/examples/jsm/utils/WorkerPool.js +65 -2
  323. package/examples/jsm/webxr/ARButton.js +18 -0
  324. package/examples/jsm/webxr/OculusHandModel.js +83 -0
  325. package/examples/jsm/webxr/OculusHandPointerModel.js +125 -0
  326. package/examples/jsm/webxr/Text2D.js +11 -0
  327. package/examples/jsm/webxr/VRButton.js +30 -0
  328. package/examples/jsm/webxr/XRButton.js +22 -0
  329. package/examples/jsm/webxr/XRControllerModelFactory.js +87 -3
  330. package/examples/jsm/webxr/XREstimatedLight.js +33 -3
  331. package/examples/jsm/webxr/XRHandMeshModel.js +35 -0
  332. package/examples/jsm/webxr/XRHandModelFactory.js +92 -0
  333. package/examples/jsm/webxr/XRHandPrimitiveModel.js +42 -0
  334. package/examples/jsm/webxr/XRPlanes.js +17 -0
  335. package/package.json +3 -4
  336. package/src/Three.TSL.js +7 -1
  337. package/src/animation/AnimationAction.js +262 -30
  338. package/src/animation/AnimationClip.js +141 -2
  339. package/src/animation/AnimationMixer.js +99 -15
  340. package/src/animation/AnimationObjectGroup.js +41 -18
  341. package/src/animation/AnimationUtils.js +169 -19
  342. package/src/animation/KeyframeTrack.js +144 -10
  343. package/src/animation/PropertyBinding.js +77 -3
  344. package/src/animation/PropertyMixer.js +72 -5
  345. package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
  346. package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
  347. package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
  348. package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
  349. package/src/animation/tracks/StringKeyframeTrack.js +33 -2
  350. package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
  351. package/src/audio/Audio.js +339 -0
  352. package/src/audio/AudioAnalyser.js +58 -1
  353. package/src/audio/AudioContext.js +15 -0
  354. package/src/audio/AudioListener.js +76 -0
  355. package/src/audio/PositionalAudio.js +107 -0
  356. package/src/cameras/ArrayCamera.js +28 -0
  357. package/src/cameras/Camera.js +47 -0
  358. package/src/cameras/CubeCamera.js +66 -0
  359. package/src/cameras/OrthographicCamera.js +109 -0
  360. package/src/cameras/PerspectiveCamera.js +163 -40
  361. package/src/cameras/StereoCamera.js +46 -0
  362. package/src/constants.js +1429 -5
  363. package/src/core/BufferAttribute.js +413 -3
  364. package/src/core/BufferGeometry.js +337 -1
  365. package/src/core/Clock.js +60 -0
  366. package/src/core/EventDispatcher.js +44 -2
  367. package/src/core/GLBufferAttribute.js +99 -0
  368. package/src/core/InstancedBufferAttribute.js +29 -0
  369. package/src/core/InstancedBufferGeometry.js +20 -0
  370. package/src/core/InstancedInterleavedBuffer.js +26 -0
  371. package/src/core/InterleavedBuffer.js +137 -3
  372. package/src/core/InterleavedBufferAttribute.js +197 -0
  373. package/src/core/Layers.js +71 -10
  374. package/src/core/Object3D.js +593 -0
  375. package/src/core/Raycaster.js +134 -1
  376. package/src/core/RenderTarget.js +170 -11
  377. package/src/core/RenderTarget3D.js +25 -0
  378. package/src/core/RenderTargetArray.js +18 -0
  379. package/src/core/Uniform.js +29 -0
  380. package/src/core/UniformsGroup.js +84 -2
  381. package/src/extras/Controls.js +88 -1
  382. package/src/extras/DataUtils.js +48 -8
  383. package/src/extras/Earcut.js +13 -780
  384. package/src/extras/ImageUtils.js +20 -2
  385. package/src/extras/PMREMGenerator.js +41 -25
  386. package/src/extras/ShapeUtils.js +24 -2
  387. package/src/extras/TextureUtils.js +95 -15
  388. package/src/extras/core/Curve.js +150 -50
  389. package/src/extras/core/CurvePath.js +63 -22
  390. package/src/extras/core/Interpolations.js +29 -3
  391. package/src/extras/core/Path.js +134 -1
  392. package/src/extras/core/Shape.js +63 -0
  393. package/src/extras/core/ShapePath.js +76 -0
  394. package/src/extras/curves/ArcCurve.js +22 -0
  395. package/src/extras/curves/CatmullRomCurve3.js +89 -18
  396. package/src/extras/curves/CubicBezierCurve.js +67 -0
  397. package/src/extras/curves/CubicBezierCurve3.js +50 -0
  398. package/src/extras/curves/EllipseCurve.js +102 -0
  399. package/src/extras/curves/LineCurve.js +36 -0
  400. package/src/extras/curves/LineCurve3.js +36 -0
  401. package/src/extras/curves/QuadraticBezierCurve.js +59 -0
  402. package/src/extras/curves/QuadraticBezierCurve3.js +43 -0
  403. package/src/extras/curves/SplineCurve.js +48 -0
  404. package/src/extras/lib/earcut.js +685 -0
  405. package/src/geometries/BoxGeometry.js +38 -0
  406. package/src/geometries/CapsuleGeometry.js +34 -0
  407. package/src/geometries/CircleGeometry.js +40 -0
  408. package/src/geometries/ConeGeometry.js +38 -0
  409. package/src/geometries/CylinderGeometry.js +39 -0
  410. package/src/geometries/DodecahedronGeometry.js +32 -0
  411. package/src/geometries/EdgesGeometry.js +28 -0
  412. package/src/geometries/ExtrudeGeometry.js +112 -28
  413. package/src/geometries/IcosahedronGeometry.js +32 -0
  414. package/src/geometries/LatheGeometry.js +40 -0
  415. package/src/geometries/OctahedronGeometry.js +32 -0
  416. package/src/geometries/PlaneGeometry.js +34 -0
  417. package/src/geometries/PolyhedronGeometry.js +29 -0
  418. package/src/geometries/RingGeometry.js +36 -0
  419. package/src/geometries/ShapeGeometry.js +37 -0
  420. package/src/geometries/SphereGeometry.js +37 -0
  421. package/src/geometries/TetrahedronGeometry.js +32 -0
  422. package/src/geometries/TorusGeometry.js +35 -0
  423. package/src/geometries/TorusKnotGeometry.js +38 -0
  424. package/src/geometries/TubeGeometry.js +49 -0
  425. package/src/geometries/WireframeGeometry.js +32 -0
  426. package/src/helpers/ArrowHelper.js +60 -3
  427. package/src/helpers/AxesHelper.js +28 -0
  428. package/src/helpers/Box3Helper.js +28 -0
  429. package/src/helpers/BoxHelper.js +43 -7
  430. package/src/helpers/CameraHelper.js +45 -5
  431. package/src/helpers/DirectionalLightHelper.js +52 -0
  432. package/src/helpers/GridHelper.js +26 -0
  433. package/src/helpers/HemisphereLightHelper.js +39 -0
  434. package/src/helpers/PlaneHelper.js +33 -0
  435. package/src/helpers/PointLightHelper.js +43 -0
  436. package/src/helpers/PolarGridHelper.js +30 -0
  437. package/src/helpers/SkeletonHelper.js +39 -2
  438. package/src/helpers/SpotLightHelper.js +40 -0
  439. package/src/lights/AmbientLight.js +25 -0
  440. package/src/lights/DirectionalLight.js +57 -0
  441. package/src/lights/DirectionalLightShadow.js +15 -0
  442. package/src/lights/HemisphereLight.js +32 -0
  443. package/src/lights/Light.js +36 -0
  444. package/src/lights/LightProbe.js +43 -0
  445. package/src/lights/LightShadow.js +159 -0
  446. package/src/lights/PointLight.js +59 -0
  447. package/src/lights/PointLightShadow.js +21 -0
  448. package/src/lights/RectAreaLight.js +59 -0
  449. package/src/lights/SpotLight.js +102 -0
  450. package/src/lights/SpotLightShadow.js +22 -0
  451. package/src/lights/webgpu/IESSpotLight.js +21 -0
  452. package/src/loaders/AnimationLoader.js +31 -0
  453. package/src/loaders/AudioLoader.js +31 -0
  454. package/src/loaders/BufferGeometryLoader.js +34 -0
  455. package/src/loaders/Cache.js +45 -0
  456. package/src/loaders/CompressedTextureLoader.js +36 -3
  457. package/src/loaders/CubeTextureLoader.js +45 -0
  458. package/src/loaders/DataTextureLoader.js +44 -3
  459. package/src/loaders/FileLoader.js +57 -1
  460. package/src/loaders/ImageBitmapLoader.js +57 -0
  461. package/src/loaders/ImageLoader.js +30 -0
  462. package/src/loaders/Loader.js +130 -0
  463. package/src/loaders/LoaderUtils.js +18 -36
  464. package/src/loaders/LoadingManager.js +142 -0
  465. package/src/loaders/MaterialLoader.js +57 -0
  466. package/src/loaders/ObjectLoader.js +53 -0
  467. package/src/loaders/TextureLoader.js +33 -0
  468. package/src/loaders/nodes/NodeLoader.js +13 -9
  469. package/src/loaders/nodes/NodeMaterialLoader.js +6 -6
  470. package/src/loaders/nodes/NodeObjectLoader.js +12 -12
  471. package/src/materials/LineBasicMaterial.js +74 -1
  472. package/src/materials/LineDashedMaterial.js +52 -0
  473. package/src/materials/Material.js +481 -4
  474. package/src/materials/MeshBasicMaterial.js +165 -0
  475. package/src/materials/MeshDepthMaterial.js +93 -0
  476. package/src/materials/MeshDistanceMaterial.js +76 -0
  477. package/src/materials/MeshLambertMaterial.js +273 -0
  478. package/src/materials/MeshMatcapMaterial.js +142 -0
  479. package/src/materials/MeshNormalMaterial.js +113 -0
  480. package/src/materials/MeshPhongMaterial.js +288 -0
  481. package/src/materials/MeshPhysicalMaterial.js +292 -1
  482. package/src/materials/MeshStandardMaterial.js +297 -0
  483. package/src/materials/MeshToonMaterial.js +218 -0
  484. package/src/materials/PointsMaterial.js +89 -0
  485. package/src/materials/RawShaderMaterial.js +25 -0
  486. package/src/materials/ShaderMaterial.js +215 -6
  487. package/src/materials/ShadowMaterial.js +54 -0
  488. package/src/materials/SpriteMaterial.js +82 -0
  489. package/src/materials/nodes/Line2NodeMaterial.js +14 -14
  490. package/src/materials/nodes/LineBasicNodeMaterial.js +3 -3
  491. package/src/materials/nodes/LineDashedNodeMaterial.js +12 -12
  492. package/src/materials/nodes/MeshBasicNodeMaterial.js +7 -7
  493. package/src/materials/nodes/MeshLambertNodeMaterial.js +5 -5
  494. package/src/materials/nodes/MeshMatcapNodeMaterial.js +3 -3
  495. package/src/materials/nodes/MeshNormalNodeMaterial.js +8 -4
  496. package/src/materials/nodes/MeshPhongNodeMaterial.js +9 -9
  497. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +43 -43
  498. package/src/materials/nodes/MeshSSSNodeMaterial.js +18 -21
  499. package/src/materials/nodes/MeshStandardNodeMaterial.js +11 -11
  500. package/src/materials/nodes/MeshToonNodeMaterial.js +4 -4
  501. package/src/materials/nodes/NodeMaterial.js +66 -47
  502. package/src/materials/nodes/PointsNodeMaterial.js +6 -6
  503. package/src/materials/nodes/ShadowNodeMaterial.js +13 -4
  504. package/src/materials/nodes/SpriteNodeMaterial.js +17 -9
  505. package/src/materials/nodes/VolumeNodeMaterial.js +25 -128
  506. package/src/materials/nodes/manager/NodeMaterialObserver.js +8 -8
  507. package/src/math/Box2.js +177 -0
  508. package/src/math/Box3.js +243 -0
  509. package/src/math/Color.js +343 -0
  510. package/src/math/Cylindrical.js +65 -6
  511. package/src/math/Euler.js +137 -4
  512. package/src/math/Frustum.js +83 -0
  513. package/src/math/Interpolant.js +87 -8
  514. package/src/math/Line3.js +94 -0
  515. package/src/math/MathUtils.js +405 -19
  516. package/src/math/Matrix2.js +70 -0
  517. package/src/math/Matrix3.js +229 -4
  518. package/src/math/Matrix4.js +368 -3
  519. package/src/math/Plane.js +164 -2
  520. package/src/math/Quaternion.js +262 -6
  521. package/src/math/Ray.js +160 -0
  522. package/src/math/Sphere.js +147 -0
  523. package/src/math/Spherical.js +70 -8
  524. package/src/math/SphericalHarmonics3.js +112 -14
  525. package/src/math/Triangle.js +206 -2
  526. package/src/math/Vector2.js +388 -2
  527. package/src/math/Vector3.js +541 -4
  528. package/src/math/Vector4.js +393 -0
  529. package/src/math/interpolants/CubicInterpolant.js +10 -1
  530. package/src/math/interpolants/DiscreteInterpolant.js +10 -2
  531. package/src/math/interpolants/LinearInterpolant.js +13 -0
  532. package/src/math/interpolants/QuaternionLinearInterpolant.js +10 -1
  533. package/src/nodes/Nodes.js +1 -0
  534. package/src/nodes/TSL.js +1 -0
  535. package/src/nodes/accessors/AccessorsUtils.js +4 -2
  536. package/src/nodes/accessors/Arrays.js +6 -6
  537. package/src/nodes/accessors/BatchNode.js +10 -11
  538. package/src/nodes/accessors/Bitangent.js +6 -2
  539. package/src/nodes/accessors/BufferAttributeNode.js +33 -31
  540. package/src/nodes/accessors/BufferNode.js +12 -13
  541. package/src/nodes/accessors/BuiltinNode.js +7 -8
  542. package/src/nodes/accessors/Camera.js +9 -2
  543. package/src/nodes/accessors/ClippingNode.js +4 -4
  544. package/src/nodes/accessors/CubeTextureNode.js +17 -19
  545. package/src/nodes/accessors/InstanceNode.js +10 -11
  546. package/src/nodes/accessors/InstancedMeshNode.js +3 -4
  547. package/src/nodes/accessors/Lights.js +12 -15
  548. package/src/nodes/accessors/MaterialNode.js +45 -9
  549. package/src/nodes/accessors/MaterialProperties.js +51 -2
  550. package/src/nodes/accessors/MaterialReferenceNode.js +11 -12
  551. package/src/nodes/accessors/ModelNode.js +20 -3
  552. package/src/nodes/accessors/ModelViewProjectionNode.js +1 -2
  553. package/src/nodes/accessors/MorphNode.js +29 -26
  554. package/src/nodes/accessors/Normal.js +11 -3
  555. package/src/nodes/accessors/Object3DNode.js +51 -16
  556. package/src/nodes/accessors/PointUVNode.js +2 -3
  557. package/src/nodes/accessors/Position.js +8 -3
  558. package/src/nodes/accessors/ReferenceBaseNode.js +29 -29
  559. package/src/nodes/accessors/ReferenceNode.js +31 -31
  560. package/src/nodes/accessors/ReflectVector.js +4 -2
  561. package/src/nodes/accessors/RendererReferenceNode.js +9 -10
  562. package/src/nodes/accessors/SceneNode.js +5 -4
  563. package/src/nodes/accessors/SkinningNode.js +53 -44
  564. package/src/nodes/accessors/StorageBufferNode.js +24 -24
  565. package/src/nodes/accessors/StorageTextureNode.js +17 -17
  566. package/src/nodes/accessors/Tangent.js +6 -2
  567. package/src/nodes/accessors/Texture3DNode.js +11 -12
  568. package/src/nodes/accessors/TextureBicubic.js +2 -3
  569. package/src/nodes/accessors/TextureNode.js +68 -47
  570. package/src/nodes/accessors/TextureSizeNode.js +5 -6
  571. package/src/nodes/accessors/UV.js +2 -3
  572. package/src/nodes/accessors/UniformArrayNode.js +24 -24
  573. package/src/nodes/accessors/UserDataNode.js +11 -12
  574. package/src/nodes/accessors/VelocityNode.js +4 -5
  575. package/src/nodes/accessors/VertexColorNode.js +7 -8
  576. package/src/nodes/code/CodeNode.js +15 -13
  577. package/src/nodes/code/ExpressionNode.js +8 -9
  578. package/src/nodes/code/FunctionCallNode.js +29 -9
  579. package/src/nodes/code/FunctionNode.js +1 -1
  580. package/src/nodes/code/ScriptableNode.js +27 -28
  581. package/src/nodes/code/ScriptableValueNode.js +11 -12
  582. package/src/nodes/core/ArrayNode.js +29 -12
  583. package/src/nodes/core/AssignNode.js +4 -5
  584. package/src/nodes/core/AttributeNode.js +8 -9
  585. package/src/nodes/core/BypassNode.js +3 -4
  586. package/src/nodes/core/CacheNode.js +5 -6
  587. package/src/nodes/core/ConstNode.js +4 -4
  588. package/src/nodes/core/ContextNode.js +9 -9
  589. package/src/nodes/core/IndexNode.js +8 -4
  590. package/src/nodes/core/InputNode.js +7 -7
  591. package/src/nodes/core/LightingModel.js +17 -17
  592. package/src/nodes/core/MRTNode.js +9 -10
  593. package/src/nodes/core/Node.js +49 -37
  594. package/src/nodes/core/NodeAttribute.js +7 -7
  595. package/src/nodes/core/NodeBuilder.js +248 -175
  596. package/src/nodes/core/NodeCache.js +4 -4
  597. package/src/nodes/core/NodeCode.js +6 -6
  598. package/src/nodes/core/NodeFrame.js +10 -10
  599. package/src/nodes/core/NodeFunction.js +8 -8
  600. package/src/nodes/core/NodeFunctionInput.js +8 -8
  601. package/src/nodes/core/NodeParser.js +1 -1
  602. package/src/nodes/core/NodeUniform.js +7 -7
  603. package/src/nodes/core/NodeUtils.js +22 -24
  604. package/src/nodes/core/NodeVar.js +9 -9
  605. package/src/nodes/core/NodeVarying.js +4 -4
  606. package/src/nodes/core/OutputStructNode.js +2 -3
  607. package/src/nodes/core/ParameterNode.js +6 -7
  608. package/src/nodes/core/PropertyNode.js +41 -13
  609. package/src/nodes/core/StackNode.js +11 -12
  610. package/src/nodes/core/StructNode.js +2 -3
  611. package/src/nodes/core/StructTypeNode.js +10 -6
  612. package/src/nodes/core/TempNode.js +3 -3
  613. package/src/nodes/core/UniformGroupNode.js +15 -12
  614. package/src/nodes/core/UniformNode.js +9 -10
  615. package/src/nodes/core/VarNode.js +14 -18
  616. package/src/nodes/core/VaryingNode.js +10 -10
  617. package/src/nodes/core/constants.js +0 -2
  618. package/src/nodes/display/BlendModes.js +21 -14
  619. package/src/nodes/display/BumpMapNode.js +5 -6
  620. package/src/nodes/display/ColorAdjustment.js +13 -9
  621. package/src/nodes/display/ColorSpaceFunctions.js +4 -4
  622. package/src/nodes/display/ColorSpaceNode.js +15 -12
  623. package/src/nodes/display/FrontFacingNode.js +3 -3
  624. package/src/nodes/display/NormalMapNode.js +5 -6
  625. package/src/nodes/display/PassNode.js +122 -35
  626. package/src/nodes/display/PosterizeNode.js +2 -3
  627. package/src/nodes/display/RenderOutputNode.js +8 -9
  628. package/src/nodes/display/ScreenNode.js +16 -7
  629. package/src/nodes/display/ToneMappingFunctions.js +12 -8
  630. package/src/nodes/display/ToneMappingNode.js +8 -8
  631. package/src/nodes/display/ToonOutlinePassNode.js +3 -4
  632. package/src/nodes/display/ViewportDepthNode.js +15 -7
  633. package/src/nodes/display/ViewportDepthTextureNode.js +6 -7
  634. package/src/nodes/display/ViewportSharedTextureNode.js +6 -7
  635. package/src/nodes/display/ViewportTextureNode.js +16 -16
  636. package/src/nodes/fog/Fog.js +5 -2
  637. package/src/nodes/functions/BSDF/LTC.js +45 -1
  638. package/src/nodes/functions/BasicLightingModel.js +5 -8
  639. package/src/nodes/functions/PhongLightingModel.js +6 -8
  640. package/src/nodes/functions/PhysicalLightingModel.js +40 -42
  641. package/src/nodes/functions/ShadowMaskModel.js +4 -4
  642. package/src/nodes/functions/ToonLightingModel.js +5 -6
  643. package/src/nodes/functions/VolumetricLightingModel.js +183 -0
  644. package/src/nodes/functions/material/getParallaxCorrectNormal.js +8 -8
  645. package/src/nodes/geometry/RangeNode.js +4 -5
  646. package/src/nodes/gpgpu/AtomicFunctionNode.js +33 -48
  647. package/src/nodes/gpgpu/BarrierNode.js +6 -4
  648. package/src/nodes/gpgpu/ComputeBuiltinNode.js +26 -31
  649. package/src/nodes/gpgpu/ComputeNode.js +43 -16
  650. package/src/nodes/gpgpu/WorkgroupInfoNode.js +16 -17
  651. package/src/nodes/lighting/AONode.js +2 -2
  652. package/src/nodes/lighting/AmbientLightNode.js +1 -1
  653. package/src/nodes/lighting/AnalyticLightNode.js +50 -9
  654. package/src/nodes/lighting/BasicLightMapNode.js +2 -2
  655. package/src/nodes/lighting/DirectionalLightNode.js +3 -12
  656. package/src/nodes/lighting/EnvironmentNode.js +5 -8
  657. package/src/nodes/lighting/HemisphereLightNode.js +1 -1
  658. package/src/nodes/lighting/LightProbeNode.js +1 -1
  659. package/src/nodes/lighting/LightUtils.js +1 -5
  660. package/src/nodes/lighting/LightingContextNode.js +10 -10
  661. package/src/nodes/lighting/LightingNode.js +1 -1
  662. package/src/nodes/lighting/LightsNode.js +68 -25
  663. package/src/nodes/lighting/PointLightNode.js +12 -27
  664. package/src/nodes/lighting/PointShadowNode.js +5 -6
  665. package/src/nodes/lighting/RectAreaLightNode.js +5 -10
  666. package/src/nodes/lighting/ShadowBaseNode.js +8 -9
  667. package/src/nodes/lighting/ShadowNode.js +28 -15
  668. package/src/nodes/lighting/SpotLightNode.js +8 -19
  669. package/src/nodes/math/ConditionalNode.js +26 -9
  670. package/src/nodes/math/Hash.js +2 -3
  671. package/src/nodes/math/MathNode.js +217 -150
  672. package/src/nodes/math/MathUtils.js +8 -6
  673. package/src/nodes/math/OperatorNode.js +198 -89
  674. package/src/nodes/math/TriNoise3D.js +2 -3
  675. package/src/nodes/parsers/GLSLNodeFunction.js +3 -3
  676. package/src/nodes/parsers/GLSLNodeParser.js +1 -1
  677. package/src/nodes/pmrem/PMREMNode.js +61 -37
  678. package/src/nodes/pmrem/PMREMUtils.js +2 -2
  679. package/src/nodes/procedural/Checker.js +2 -3
  680. package/src/nodes/shapes/Shapes.js +2 -3
  681. package/src/nodes/tsl/TSLBase.js +2 -1
  682. package/src/nodes/tsl/TSLCore.js +117 -19
  683. package/src/nodes/utils/ArrayElementNode.js +5 -3
  684. package/src/nodes/utils/ConvertNode.js +3 -3
  685. package/src/nodes/utils/CubeMapNode.js +7 -8
  686. package/src/nodes/utils/DebugNode.js +70 -0
  687. package/src/nodes/utils/Discard.js +5 -5
  688. package/src/nodes/utils/EquirectUVNode.js +3 -4
  689. package/src/nodes/utils/FlipNode.js +3 -3
  690. package/src/nodes/utils/FunctionOverloadingNode.js +3 -4
  691. package/src/nodes/utils/JoinNode.js +29 -4
  692. package/src/nodes/utils/LoopNode.js +67 -35
  693. package/src/nodes/utils/MatcapUVNode.js +1 -2
  694. package/src/nodes/utils/MaxMipLevelNode.js +4 -5
  695. package/src/nodes/utils/MemberNode.js +2 -2
  696. package/src/nodes/utils/Oscillators.js +8 -6
  697. package/src/nodes/utils/Packing.js +4 -4
  698. package/src/nodes/utils/PostProcessingUtils.js +6 -5
  699. package/src/nodes/utils/RTTNode.js +19 -19
  700. package/src/nodes/utils/ReflectorNode.js +35 -25
  701. package/src/nodes/utils/RemapNode.js +9 -9
  702. package/src/nodes/utils/RotateNode.js +3 -4
  703. package/src/nodes/utils/SetNode.js +3 -3
  704. package/src/nodes/utils/SplitNode.js +5 -5
  705. package/src/nodes/utils/SpriteSheetUVNode.js +4 -5
  706. package/src/nodes/utils/SpriteUtils.js +5 -6
  707. package/src/nodes/utils/StorageArrayElementNode.js +3 -4
  708. package/src/nodes/utils/Timer.js +9 -5
  709. package/src/nodes/utils/TriplanarTexturesNode.js +20 -20
  710. package/src/nodes/utils/UVUtils.js +4 -4
  711. package/src/nodes/utils/ViewportUtils.js +3 -4
  712. package/src/objects/BatchedMesh.js +319 -32
  713. package/src/objects/Bone.js +24 -0
  714. package/src/objects/ClippingGroup.js +4 -4
  715. package/src/objects/Group.js +24 -0
  716. package/src/objects/InstancedMesh.js +120 -2
  717. package/src/objects/LOD.js +99 -5
  718. package/src/objects/Line.js +82 -0
  719. package/src/objects/LineLoop.js +20 -0
  720. package/src/objects/LineSegments.js +18 -0
  721. package/src/objects/Mesh.js +75 -0
  722. package/src/objects/Points.js +60 -0
  723. package/src/objects/Skeleton.js +105 -0
  724. package/src/objects/SkinnedMesh.js +99 -5
  725. package/src/objects/Sprite.js +54 -0
  726. package/src/renderers/WebGL3DRenderTarget.js +25 -0
  727. package/src/renderers/WebGLArrayRenderTarget.js +25 -0
  728. package/src/renderers/WebGLCubeRenderTarget.js +39 -1
  729. package/src/renderers/WebGLRenderTarget.js +19 -0
  730. package/src/renderers/WebGLRenderer.js +622 -83
  731. package/src/renderers/common/Animation.js +6 -6
  732. package/src/renderers/common/Attributes.js +3 -3
  733. package/src/renderers/common/Backend.js +40 -31
  734. package/src/renderers/common/Background.js +4 -3
  735. package/src/renderers/common/BindGroup.js +5 -5
  736. package/src/renderers/common/Binding.js +4 -4
  737. package/src/renderers/common/Bindings.js +10 -0
  738. package/src/renderers/common/Buffer.js +5 -5
  739. package/src/renderers/common/BufferUtils.js +7 -9
  740. package/src/renderers/common/BundleGroup.js +6 -6
  741. package/src/renderers/common/ChainMap.js +3 -3
  742. package/src/renderers/common/ClippingContext.js +8 -8
  743. package/src/renderers/common/Color4.js +8 -8
  744. package/src/renderers/common/ComputePipeline.js +2 -2
  745. package/src/renderers/common/CubeRenderTarget.js +13 -0
  746. package/src/renderers/common/DataMap.js +2 -2
  747. package/src/renderers/common/Geometries.js +6 -6
  748. package/src/renderers/common/IndirectStorageBufferAttribute.js +3 -3
  749. package/src/renderers/common/Info.js +17 -17
  750. package/src/renderers/common/Pipeline.js +3 -3
  751. package/src/renderers/common/Pipelines.js +12 -12
  752. package/src/renderers/common/PostProcessing.js +13 -1
  753. package/src/renderers/common/ProgrammableStage.js +11 -11
  754. package/src/renderers/common/QuadMesh.js +5 -3
  755. package/src/renderers/common/RenderContext.js +24 -24
  756. package/src/renderers/common/RenderContexts.js +4 -4
  757. package/src/renderers/common/RenderList.js +16 -16
  758. package/src/renderers/common/RenderObject.js +27 -27
  759. package/src/renderers/common/RenderObjects.js +4 -4
  760. package/src/renderers/common/RenderPipeline.js +1 -1
  761. package/src/renderers/common/Renderer.js +272 -200
  762. package/src/renderers/common/RendererUtils.js +0 -2
  763. package/src/renderers/common/SampledTexture.js +20 -20
  764. package/src/renderers/common/Sampler.js +5 -5
  765. package/src/renderers/common/StorageBuffer.js +2 -2
  766. package/src/renderers/common/StorageBufferAttribute.js +4 -4
  767. package/src/renderers/common/StorageInstancedBufferAttribute.js +4 -4
  768. package/src/renderers/common/StorageTexture.js +6 -6
  769. package/src/renderers/common/Textures.js +6 -6
  770. package/src/renderers/common/TimestampQueryPool.js +66 -7
  771. package/src/renderers/common/Uniform.js +26 -26
  772. package/src/renderers/common/UniformBuffer.js +2 -2
  773. package/src/renderers/common/UniformsGroup.js +18 -18
  774. package/src/renderers/common/XRManager.js +369 -54
  775. package/src/renderers/common/XRRenderTarget.js +5 -5
  776. package/src/renderers/common/extras/PMREMGenerator.js +62 -37
  777. package/src/renderers/common/nodes/NodeBuilderState.js +7 -7
  778. package/src/renderers/common/nodes/NodeLibrary.js +13 -13
  779. package/src/renderers/common/nodes/NodeSampledTexture.js +12 -12
  780. package/src/renderers/common/nodes/NodeSampler.js +1 -1
  781. package/src/renderers/common/nodes/NodeStorageBuffer.js +1 -1
  782. package/src/renderers/common/nodes/NodeUniform.js +9 -9
  783. package/src/renderers/common/nodes/NodeUniformsGroup.js +3 -3
  784. package/src/renderers/common/nodes/Nodes.js +13 -13
  785. package/src/renderers/shaders/UniformsLib.js +1 -4
  786. package/src/renderers/shaders/UniformsUtils.js +1 -3
  787. package/src/renderers/webgl/WebGLBackground.js +4 -2
  788. package/src/renderers/webgl/WebGLState.js +19 -19
  789. package/src/renderers/webgl-fallback/WebGLBackend.js +163 -146
  790. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +4 -4
  791. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +89 -99
  792. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +2 -2
  793. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +5 -5
  794. package/src/renderers/webgl-fallback/utils/WebGLState.js +97 -47
  795. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +79 -31
  796. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +37 -29
  797. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -3
  798. package/src/renderers/webgpu/WebGPUBackend.js +200 -119
  799. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +3 -13
  800. package/src/renderers/webgpu/WebGPURenderer.js +19 -13
  801. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +171 -178
  802. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -3
  803. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +1 -1
  804. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +43 -9
  805. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +2 -2
  806. package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
  807. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +18 -10
  808. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +9 -9
  809. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +37 -37
  810. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +31 -18
  811. package/src/renderers/webgpu/utils/WebGPUUtils.js +9 -9
  812. package/src/renderers/webxr/WebXRController.js +87 -2
  813. package/src/renderers/webxr/WebXRDepthSensing.js +49 -0
  814. package/src/renderers/webxr/WebXRManager.js +187 -11
  815. package/src/scenes/Fog.js +60 -0
  816. package/src/scenes/FogExp2.js +51 -0
  817. package/src/scenes/Scene.js +88 -0
  818. package/src/textures/CanvasTexture.js +28 -0
  819. package/src/textures/CompressedArrayTexture.js +57 -0
  820. package/src/textures/CompressedCubeTexture.js +29 -0
  821. package/src/textures/CompressedTexture.js +64 -6
  822. package/src/textures/CubeTexture.js +52 -4
  823. package/src/textures/Data3DTexture.js +77 -0
  824. package/src/textures/DataArrayTexture.js +93 -0
  825. package/src/textures/DataTexture.js +65 -0
  826. package/src/textures/DepthTexture.js +61 -9
  827. package/src/textures/FramebufferTexture.js +62 -0
  828. package/src/textures/Source.js +69 -0
  829. package/src/textures/Texture.js +362 -3
  830. package/src/textures/VideoFrameTexture.js +43 -6
  831. package/src/textures/VideoTexture.js +49 -4
  832. package/examples/jsm/geometries/ParametricGeometries.js +0 -254
@@ -716,10 +716,7 @@ const ShaderChunk = {
716
716
  sprite_frag: fragment$1
717
717
  };
718
718
 
719
- /**
720
- * Uniforms library for shared webgl shaders
721
- */
722
-
719
+ // Uniforms library for shared webgl shaders
723
720
  const UniformsLib = {
724
721
 
725
722
  common: {
@@ -748,7 +745,7 @@ const UniformsLib = {
748
745
 
749
746
  envMap: { value: null },
750
747
  envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
751
- flipEnvMap: { value: - 1 },
748
+ flipEnvMap: { value: -1 },
752
749
  reflectivity: { value: 1.0 }, // basic, lambert, phong
753
750
  ior: { value: 1.5 }, // physical
754
751
  refractionRatio: { value: 0.98 }, // basic, lambert, phong
@@ -1169,7 +1166,7 @@ const ShaderLib = {
1169
1166
 
1170
1167
  uniforms: {
1171
1168
  envMap: { value: null },
1172
- flipEnvMap: { value: - 1 },
1169
+ flipEnvMap: { value: -1 },
1173
1170
  backgroundBlurriness: { value: 0 },
1174
1171
  backgroundIntensity: { value: 1 },
1175
1172
  backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
@@ -1184,7 +1181,7 @@ const ShaderLib = {
1184
1181
 
1185
1182
  uniforms: {
1186
1183
  tCube: { value: null },
1187
- tFlip: { value: - 1 },
1184
+ tFlip: { value: -1 },
1188
1185
  opacity: { value: 1.0 }
1189
1186
  },
1190
1187
 
@@ -1387,7 +1384,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1387
1384
  side: BackSide,
1388
1385
  depthTest: false,
1389
1386
  depthWrite: false,
1390
- fog: false
1387
+ fog: false,
1388
+ allowOverride: false
1391
1389
  } )
1392
1390
  );
1393
1391
 
@@ -1418,18 +1416,18 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1418
1416
  _e1$1.copy( scene.backgroundRotation );
1419
1417
 
1420
1418
  // accommodate left-handed frame
1421
- _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
1419
+ _e1$1.x *= -1; _e1$1.y *= -1; _e1$1.z *= -1;
1422
1420
 
1423
1421
  if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
1424
1422
 
1425
1423
  // environment maps which are not cube render targets or PMREMs follow a different convention
1426
- _e1$1.y *= - 1;
1427
- _e1$1.z *= - 1;
1424
+ _e1$1.y *= -1;
1425
+ _e1$1.z *= -1;
1428
1426
 
1429
1427
  }
1430
1428
 
1431
1429
  boxMesh.material.uniforms.envMap.value = background;
1432
- boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
1430
+ boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? -1 : 1;
1433
1431
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
1434
1432
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
1435
1433
  boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
@@ -1466,7 +1464,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1466
1464
  side: FrontSide,
1467
1465
  depthTest: false,
1468
1466
  depthWrite: false,
1469
- fog: false
1467
+ fog: false,
1468
+ allowOverride: false
1470
1469
  } )
1471
1470
  );
1472
1471
 
@@ -2693,11 +2692,13 @@ const _axisDirections = [
2693
2692
  /*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
2694
2693
  /*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
2695
2694
  /*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
2696
- /*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
2697
- /*@__PURE__*/ new Vector3( 1, 1, - 1 ),
2698
- /*@__PURE__*/ new Vector3( - 1, 1, 1 ),
2695
+ /*@__PURE__*/ new Vector3( -1, 1, -1 ),
2696
+ /*@__PURE__*/ new Vector3( 1, 1, -1 ),
2697
+ /*@__PURE__*/ new Vector3( -1, 1, 1 ),
2699
2698
  /*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
2700
2699
 
2700
+ const _origin = /*@__PURE__*/ new Vector3();
2701
+
2701
2702
  /**
2702
2703
  * This class generates a Prefiltered, Mipmapped Radiance Environment Map
2703
2704
  * (PMREM) from a cubeMap environment texture. This allows different levels of
@@ -2709,12 +2710,16 @@ const _axisDirections = [
2709
2710
  * higher roughness levels. In this way we maintain resolution to smoothly
2710
2711
  * interpolate diffuse lighting while limiting sampling computation.
2711
2712
  *
2712
- * Paper: Fast, Accurate Image-Based Lighting
2713
- * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view
2713
+ * Paper: Fast, Accurate Image-Based Lighting:
2714
+ * {@link https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view}
2714
2715
  */
2715
-
2716
2716
  class PMREMGenerator {
2717
2717
 
2718
+ /**
2719
+ * Constructs a new PMREM generator.
2720
+ *
2721
+ * @param {WebGLRenderer} renderer - The renderer.
2722
+ */
2718
2723
  constructor( renderer ) {
2719
2724
 
2720
2725
  this._renderer = renderer;
@@ -2738,16 +2743,23 @@ class PMREMGenerator {
2738
2743
  * Generates a PMREM from a supplied Scene, which can be faster than using an
2739
2744
  * image if networking bandwidth is low. Optional sigma specifies a blur radius
2740
2745
  * in radians to be applied to the scene before PMREM generation. Optional near
2741
- * and far planes ensure the scene is rendered in its entirety (the cubeCamera
2742
- * is placed at the origin).
2746
+ * and far planes ensure the scene is rendered in its entirety.
2743
2747
  *
2744
- * @param {Scene} scene
2745
- * @param {number} sigma
2746
- * @param {number} near
2747
- * @param {number} far
2748
- * @return {WebGLRenderTarget}
2748
+ * @param {Scene} scene - The scene to be captured.
2749
+ * @param {number} [sigma=0] - The blur radius in radians.
2750
+ * @param {number} [near=0.1] - The near plane distance.
2751
+ * @param {number} [far=100] - The far plane distance.
2752
+ * @param {Object} [options={}] - The configuration options.
2753
+ * @param {number} [options.size=256] - The texture size of the PMREM.
2754
+ * @param {Vector3} [options.renderTarget=origin] - The position of the internal cube camera that renders the scene.
2755
+ * @return {WebGLRenderTarget} The resulting PMREM.
2749
2756
  */
2750
- fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
2757
+ fromScene( scene, sigma = 0, near = 0.1, far = 100, options = {} ) {
2758
+
2759
+ const {
2760
+ size = 256,
2761
+ position = _origin,
2762
+ } = options;
2751
2763
 
2752
2764
  _oldTarget = this._renderer.getRenderTarget();
2753
2765
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
@@ -2756,12 +2768,12 @@ class PMREMGenerator {
2756
2768
 
2757
2769
  this._renderer.xr.enabled = false;
2758
2770
 
2759
- this._setSize( 256 );
2771
+ this._setSize( size );
2760
2772
 
2761
2773
  const cubeUVRenderTarget = this._allocateTargets();
2762
2774
  cubeUVRenderTarget.depthBuffer = true;
2763
2775
 
2764
- this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );
2776
+ this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget, position );
2765
2777
 
2766
2778
  if ( sigma > 0 ) {
2767
2779
 
@@ -2780,11 +2792,10 @@ class PMREMGenerator {
2780
2792
  * Generates a PMREM from an equirectangular texture, which can be either LDR
2781
2793
  * or HDR. The ideal input image size is 1k (1024 x 512),
2782
2794
  * as this matches best with the 256 x 256 cubemap output.
2783
- * The smallest supported equirectangular image size is 64 x 32.
2784
2795
  *
2785
- * @param {Texture} equirectangular
2786
- * @param {WebGLRenderTarget} [renderTarget=null] - Optional render target.
2787
- * @return {WebGLRenderTarget}
2796
+ * @param {Texture} equirectangular - The equirectangular texture to be converted.
2797
+ * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
2798
+ * @return {WebGLRenderTarget} The resulting PMREM.
2788
2799
  */
2789
2800
  fromEquirectangular( equirectangular, renderTarget = null ) {
2790
2801
 
@@ -2796,11 +2807,10 @@ class PMREMGenerator {
2796
2807
  * Generates a PMREM from an cubemap texture, which can be either LDR
2797
2808
  * or HDR. The ideal input cube size is 256 x 256,
2798
2809
  * as this matches best with the 256 x 256 cubemap output.
2799
- * The smallest supported cube size is 16 x 16.
2800
2810
  *
2801
- * @param {Texture} cubemap
2802
- * @param {null} [renderTarget=null] - Optional render target.
2803
- * @return {WebGLRenderTarget}
2811
+ * @param {Texture} cubemap - The cubemap texture to be converted.
2812
+ * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
2813
+ * @return {WebGLRenderTarget} The resulting PMREM.
2804
2814
  */
2805
2815
  fromCubemap( cubemap, renderTarget = null ) {
2806
2816
 
@@ -2958,13 +2968,13 @@ class PMREMGenerator {
2958
2968
 
2959
2969
  }
2960
2970
 
2961
- _sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {
2971
+ _sceneToCubeUV( scene, near, far, cubeUVRenderTarget, position ) {
2962
2972
 
2963
2973
  const fov = 90;
2964
2974
  const aspect = 1;
2965
2975
  const cubeCamera = new PerspectiveCamera( fov, aspect, near, far );
2966
- const upSign = [ 1, - 1, 1, 1, 1, 1 ];
2967
- const forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];
2976
+ const upSign = [ 1, -1, 1, 1, 1, 1 ];
2977
+ const forwardSign = [ 1, 1, 1, -1, -1, -1 ];
2968
2978
  const renderer = this._renderer;
2969
2979
 
2970
2980
  const originalAutoClear = renderer.autoClear;
@@ -3010,17 +3020,21 @@ class PMREMGenerator {
3010
3020
  if ( col === 0 ) {
3011
3021
 
3012
3022
  cubeCamera.up.set( 0, upSign[ i ], 0 );
3013
- cubeCamera.lookAt( forwardSign[ i ], 0, 0 );
3023
+ cubeCamera.position.set( position.x, position.y, position.z );
3024
+ cubeCamera.lookAt( position.x + forwardSign[ i ], position.y, position.z );
3014
3025
 
3015
3026
  } else if ( col === 1 ) {
3016
3027
 
3017
3028
  cubeCamera.up.set( 0, 0, upSign[ i ] );
3018
- cubeCamera.lookAt( 0, forwardSign[ i ], 0 );
3029
+ cubeCamera.position.set( position.x, position.y, position.z );
3030
+ cubeCamera.lookAt( position.x, position.y + forwardSign[ i ], position.z );
3031
+
3019
3032
 
3020
3033
  } else {
3021
3034
 
3022
3035
  cubeCamera.up.set( 0, upSign[ i ], 0 );
3023
- cubeCamera.lookAt( 0, 0, forwardSign[ i ] );
3036
+ cubeCamera.position.set( position.x, position.y, position.z );
3037
+ cubeCamera.lookAt( position.x, position.y, position.z + forwardSign[ i ] );
3024
3038
 
3025
3039
  }
3026
3040
 
@@ -3063,7 +3077,7 @@ class PMREMGenerator {
3063
3077
 
3064
3078
  }
3065
3079
 
3066
- this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
3080
+ this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? -1 : 1;
3067
3081
 
3068
3082
  } else {
3069
3083
 
@@ -3119,6 +3133,7 @@ class PMREMGenerator {
3119
3133
  * the poles) to approximate the orthogonally-separable blur. It is least
3120
3134
  * accurate at the poles, but still does a decent job.
3121
3135
  *
3136
+ * @private
3122
3137
  * @param {WebGLRenderTarget} cubeUVRenderTarget
3123
3138
  * @param {number} lodIn
3124
3139
  * @param {number} lodOut
@@ -3282,7 +3297,7 @@ function _createPlanes( lodMax ) {
3282
3297
  for ( let face = 0; face < cubeFaces; face ++ ) {
3283
3298
 
3284
3299
  const x = ( face % 3 ) * 2 / 3 - 1;
3285
- const y = face > 2 ? 0 : - 1;
3300
+ const y = face > 2 ? 0 : -1;
3286
3301
  const coordinates = [
3287
3302
  x, y, 0,
3288
3303
  x + 2 / 3, y, 0,
@@ -3481,7 +3496,7 @@ function _getCubemapMaterial() {
3481
3496
 
3482
3497
  uniforms: {
3483
3498
  'envMap': { value: null },
3484
- 'flipEnvMap': { value: - 1 }
3499
+ 'flipEnvMap': { value: -1 }
3485
3500
  },
3486
3501
 
3487
3502
  vertexShader: _getCommonVertexShader(),
@@ -8003,18 +8018,18 @@ function WebGLLights( extensions ) {
8003
8018
  version: 0,
8004
8019
 
8005
8020
  hash: {
8006
- directionalLength: - 1,
8007
- pointLength: - 1,
8008
- spotLength: - 1,
8009
- rectAreaLength: - 1,
8010
- hemiLength: - 1,
8011
-
8012
- numDirectionalShadows: - 1,
8013
- numPointShadows: - 1,
8014
- numSpotShadows: - 1,
8015
- numSpotMaps: - 1,
8016
-
8017
- numLightProbes: - 1
8021
+ directionalLength: -1,
8022
+ pointLength: -1,
8023
+ spotLength: -1,
8024
+ rectAreaLength: -1,
8025
+ hemiLength: -1,
8026
+
8027
+ numDirectionalShadows: -1,
8028
+ numPointShadows: -1,
8029
+ numSpotShadows: -1,
8030
+ numSpotMaps: -1,
8031
+
8032
+ numLightProbes: -1
8018
8033
  },
8019
8034
 
8020
8035
  ambient: [ 0, 0, 0 ],
@@ -8555,7 +8570,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
8555
8570
  fullScreenTri.setAttribute(
8556
8571
  'position',
8557
8572
  new BufferAttribute(
8558
- new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),
8573
+ new Float32Array( [ -1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5 ] ),
8559
8574
  3
8560
8575
  )
8561
8576
  );
@@ -8988,7 +9003,7 @@ function WebGLState( gl, extensions ) {
8988
9003
  locked = false;
8989
9004
 
8990
9005
  currentColorMask = null;
8991
- currentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state
9006
+ currentColorClear.set( -1, 0, 0, 0 ); // set to invalid state
8992
9007
 
8993
9008
  }
8994
9009
 
@@ -8999,17 +9014,17 @@ function WebGLState( gl, extensions ) {
8999
9014
  function DepthBuffer() {
9000
9015
 
9001
9016
  let locked = false;
9002
- let reversed = false;
9003
9017
 
9018
+ let currentReversed = false;
9004
9019
  let currentDepthMask = null;
9005
9020
  let currentDepthFunc = null;
9006
9021
  let currentDepthClear = null;
9007
9022
 
9008
9023
  return {
9009
9024
 
9010
- setReversed: function ( value ) {
9025
+ setReversed: function ( reversed ) {
9011
9026
 
9012
- if ( reversed !== value ) {
9027
+ if ( currentReversed !== reversed ) {
9013
9028
 
9014
9029
  const ext = extensions.get( 'EXT_clip_control' );
9015
9030
 
@@ -9023,19 +9038,19 @@ function WebGLState( gl, extensions ) {
9023
9038
 
9024
9039
  }
9025
9040
 
9041
+ currentReversed = reversed;
9042
+
9026
9043
  const oldDepth = currentDepthClear;
9027
9044
  currentDepthClear = null;
9028
9045
  this.setClear( oldDepth );
9029
9046
 
9030
9047
  }
9031
9048
 
9032
- reversed = value;
9033
-
9034
9049
  },
9035
9050
 
9036
9051
  getReversed: function () {
9037
9052
 
9038
- return reversed;
9053
+ return currentReversed;
9039
9054
 
9040
9055
  },
9041
9056
 
@@ -9066,7 +9081,7 @@ function WebGLState( gl, extensions ) {
9066
9081
 
9067
9082
  setFunc: function ( depthFunc ) {
9068
9083
 
9069
- if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
9084
+ if ( currentReversed ) depthFunc = reversedFuncs[ depthFunc ];
9070
9085
 
9071
9086
  if ( currentDepthFunc !== depthFunc ) {
9072
9087
 
@@ -9134,7 +9149,7 @@ function WebGLState( gl, extensions ) {
9134
9149
 
9135
9150
  if ( currentDepthClear !== depth ) {
9136
9151
 
9137
- if ( reversed ) {
9152
+ if ( currentReversed ) {
9138
9153
 
9139
9154
  depth = 1 - depth;
9140
9155
 
@@ -9154,7 +9169,7 @@ function WebGLState( gl, extensions ) {
9154
9169
  currentDepthMask = null;
9155
9170
  currentDepthFunc = null;
9156
9171
  currentDepthClear = null;
9157
- reversed = false;
9172
+ currentReversed = false;
9158
9173
 
9159
9174
  }
9160
9175
 
@@ -9317,12 +9332,12 @@ function WebGLState( gl, extensions ) {
9317
9332
  let version = 0;
9318
9333
  const glVersion = gl.getParameter( gl.VERSION );
9319
9334
 
9320
- if ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {
9335
+ if ( glVersion.indexOf( 'WebGL' ) !== -1 ) {
9321
9336
 
9322
9337
  version = parseFloat( /^WebGL (\d)/.exec( glVersion )[ 1 ] );
9323
9338
  lineWidthAvailable = ( version >= 1.0 );
9324
9339
 
9325
- } else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {
9340
+ } else if ( glVersion.indexOf( 'OpenGL ES' ) !== -1 ) {
9326
9341
 
9327
9342
  version = parseFloat( /^OpenGL ES (\d)/.exec( glVersion )[ 1 ] );
9328
9343
  lineWidthAvailable = ( version >= 2.0 );
@@ -9901,7 +9916,7 @@ function WebGLState( gl, extensions ) {
9901
9916
 
9902
9917
  try {
9903
9918
 
9904
- gl.compressedTexImage2D.apply( gl, arguments );
9919
+ gl.compressedTexImage2D( ...arguments );
9905
9920
 
9906
9921
  } catch ( error ) {
9907
9922
 
@@ -9915,7 +9930,7 @@ function WebGLState( gl, extensions ) {
9915
9930
 
9916
9931
  try {
9917
9932
 
9918
- gl.compressedTexImage3D.apply( gl, arguments );
9933
+ gl.compressedTexImage3D( ...arguments );
9919
9934
 
9920
9935
  } catch ( error ) {
9921
9936
 
@@ -9929,7 +9944,7 @@ function WebGLState( gl, extensions ) {
9929
9944
 
9930
9945
  try {
9931
9946
 
9932
- gl.texSubImage2D.apply( gl, arguments );
9947
+ gl.texSubImage2D( ...arguments );
9933
9948
 
9934
9949
  } catch ( error ) {
9935
9950
 
@@ -9943,7 +9958,7 @@ function WebGLState( gl, extensions ) {
9943
9958
 
9944
9959
  try {
9945
9960
 
9946
- gl.texSubImage3D.apply( gl, arguments );
9961
+ gl.texSubImage3D( ...arguments );
9947
9962
 
9948
9963
  } catch ( error ) {
9949
9964
 
@@ -9957,7 +9972,7 @@ function WebGLState( gl, extensions ) {
9957
9972
 
9958
9973
  try {
9959
9974
 
9960
- gl.compressedTexSubImage2D.apply( gl, arguments );
9975
+ gl.compressedTexSubImage2D( ...arguments );
9961
9976
 
9962
9977
  } catch ( error ) {
9963
9978
 
@@ -9971,7 +9986,7 @@ function WebGLState( gl, extensions ) {
9971
9986
 
9972
9987
  try {
9973
9988
 
9974
- gl.compressedTexSubImage3D.apply( gl, arguments );
9989
+ gl.compressedTexSubImage3D( ...arguments );
9975
9990
 
9976
9991
  } catch ( error ) {
9977
9992
 
@@ -9985,7 +10000,7 @@ function WebGLState( gl, extensions ) {
9985
10000
 
9986
10001
  try {
9987
10002
 
9988
- gl.texStorage2D.apply( gl, arguments );
10003
+ gl.texStorage2D( ...arguments );
9989
10004
 
9990
10005
  } catch ( error ) {
9991
10006
 
@@ -9999,7 +10014,7 @@ function WebGLState( gl, extensions ) {
9999
10014
 
10000
10015
  try {
10001
10016
 
10002
- gl.texStorage3D.apply( gl, arguments );
10017
+ gl.texStorage3D( ...arguments );
10003
10018
 
10004
10019
  } catch ( error ) {
10005
10020
 
@@ -10013,7 +10028,7 @@ function WebGLState( gl, extensions ) {
10013
10028
 
10014
10029
  try {
10015
10030
 
10016
- gl.texImage2D.apply( gl, arguments );
10031
+ gl.texImage2D( ...arguments );
10017
10032
 
10018
10033
  } catch ( error ) {
10019
10034
 
@@ -10027,7 +10042,7 @@ function WebGLState( gl, extensions ) {
10027
10042
 
10028
10043
  try {
10029
10044
 
10030
- gl.texImage3D.apply( gl, arguments );
10045
+ gl.texImage3D( ...arguments );
10031
10046
 
10032
10047
  } catch ( error ) {
10033
10048
 
@@ -12873,18 +12888,53 @@ void main() {
12873
12888
 
12874
12889
  }`;
12875
12890
 
12891
+ /**
12892
+ * A XR module that manages the access to the Depth Sensing API.
12893
+ */
12876
12894
  class WebXRDepthSensing {
12877
12895
 
12896
+ /**
12897
+ * Constructs a new depth sensing module.
12898
+ */
12878
12899
  constructor() {
12879
12900
 
12901
+ /**
12902
+ * A texture representing the depth of the user's environment.
12903
+ *
12904
+ * @type {?Texture}
12905
+ */
12880
12906
  this.texture = null;
12907
+
12908
+ /**
12909
+ * A plane mesh for visualizing the depth texture.
12910
+ *
12911
+ * @type {?Mesh}
12912
+ */
12881
12913
  this.mesh = null;
12882
12914
 
12915
+ /**
12916
+ * The depth near value.
12917
+ *
12918
+ * @type {number}
12919
+ */
12883
12920
  this.depthNear = 0;
12921
+
12922
+ /**
12923
+ * The depth near far.
12924
+ *
12925
+ * @type {number}
12926
+ */
12884
12927
  this.depthFar = 0;
12885
12928
 
12886
12929
  }
12887
12930
 
12931
+ /**
12932
+ * Inits the depth sensing module
12933
+ *
12934
+ * @param {WebGLRenderer} renderer - The renderer.
12935
+ * @param {XRWebGLDepthInformation} depthData - The XR depth data.
12936
+ * @param {XRRenderState} renderState - The XR render state.
12937
+ */
12888
12938
  init( renderer, depthData, renderState ) {
12889
12939
 
12890
12940
  if ( this.texture === null ) {
@@ -12907,6 +12957,12 @@ class WebXRDepthSensing {
12907
12957
 
12908
12958
  }
12909
12959
 
12960
+ /**
12961
+ * Returns a plane mesh that visualizes the depth texture.
12962
+ *
12963
+ * @param {ArrayCamera} cameraXR - The XR camera.
12964
+ * @return {?Mesh} The plane mesh.
12965
+ */
12910
12966
  getMesh( cameraXR ) {
12911
12967
 
12912
12968
  if ( this.texture !== null ) {
@@ -12934,6 +12990,9 @@ class WebXRDepthSensing {
12934
12990
 
12935
12991
  }
12936
12992
 
12993
+ /**
12994
+ * Resets the module
12995
+ */
12937
12996
  reset() {
12938
12997
 
12939
12998
  this.texture = null;
@@ -12941,6 +13000,11 @@ class WebXRDepthSensing {
12941
13000
 
12942
13001
  }
12943
13002
 
13003
+ /**
13004
+ * Returns a texture representing the depth of the user's environment.
13005
+ *
13006
+ * @return {?Texture} The depth texture.
13007
+ */
12944
13008
  getDepthTexture() {
12945
13009
 
12946
13010
  return this.texture;
@@ -12949,8 +13013,23 @@ class WebXRDepthSensing {
12949
13013
 
12950
13014
  }
12951
13015
 
13016
+ /**
13017
+ * This class represents an abstraction of the WebXR Device API and is
13018
+ * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public
13019
+ * interface that allows users to enable/disable XR and perform XR related
13020
+ * tasks like for instance retrieving controllers.
13021
+ *
13022
+ * @augments EventDispatcher
13023
+ * @hideconstructor
13024
+ */
12952
13025
  class WebXRManager extends EventDispatcher {
12953
13026
 
13027
+ /**
13028
+ * Constructs a new WebGL renderer.
13029
+ *
13030
+ * @param {WebGLRenderer} renderer - The renderer.
13031
+ * @param {WebGL2RenderingContext} gl - The rendering context.
13032
+ */
12954
13033
  constructor( renderer, gl, extensions, useMultiview ) {
12955
13034
 
12956
13035
  super();
@@ -13003,11 +13082,32 @@ class WebXRManager extends EventDispatcher {
13003
13082
  let _currentDepthNear = null;
13004
13083
  let _currentDepthFar = null;
13005
13084
 
13006
- //
13085
+ /**
13086
+ * Whether the manager's XR camera should be automatically updated or not.
13087
+ *
13088
+ * @type {boolean}
13089
+ * @default true
13090
+ */
13007
13091
  this.cameraAutoUpdate = true;
13008
- this.layersEnabled = false;
13092
+
13093
+ /**
13094
+ * This flag notifies the renderer to be ready for XR rendering. Set it to `true`
13095
+ * if you are going to use XR in your app.
13096
+ *
13097
+ * @type {boolean}
13098
+ * @default false
13099
+ */
13009
13100
  this.enabled = false;
13010
13101
 
13102
+ this.layersEnabled = false;
13103
+
13104
+ /**
13105
+ * Whether XR presentation is active or not.
13106
+ *
13107
+ * @type {boolean}
13108
+ * @readonly
13109
+ * @default false
13110
+ */
13011
13111
  this.isPresenting = false;
13012
13112
  this.isMultiview = false;
13013
13113
 
@@ -13017,6 +13117,14 @@ class WebXRManager extends EventDispatcher {
13017
13117
 
13018
13118
  };
13019
13119
 
13120
+ /**
13121
+ * Returns a group representing the `target ray` space of the XR controller.
13122
+ * Use this space for visualizing 3D objects that support the user in pointing
13123
+ * tasks like UI interaction.
13124
+ *
13125
+ * @param {number} index - The index of the controller.
13126
+ * @return {Group} A group representing the `target ray` space.
13127
+ */
13020
13128
  this.getController = function ( index ) {
13021
13129
 
13022
13130
  let controller = controllers[ index ];
@@ -13032,6 +13140,21 @@ class WebXRManager extends EventDispatcher {
13032
13140
 
13033
13141
  };
13034
13142
 
13143
+ /**
13144
+ * Returns a group representing the `grip` space of the XR controller.
13145
+ * Use this space for visualizing 3D objects that support the user in pointing
13146
+ * tasks like UI interaction.
13147
+ *
13148
+ * Note: If you want to show something in the user's hand AND offer a
13149
+ * pointing ray at the same time, you'll want to attached the handheld object
13150
+ * to the group returned by `getControllerGrip()` and the ray to the
13151
+ * group returned by `getController()`. The idea is to have two
13152
+ * different groups in two different coordinate spaces for the same WebXR
13153
+ * controller.
13154
+ *
13155
+ * @param {number} index - The index of the controller.
13156
+ * @return {Group} A group representing the `grip` space.
13157
+ */
13035
13158
  this.getControllerGrip = function ( index ) {
13036
13159
 
13037
13160
  let controller = controllers[ index ];
@@ -13047,6 +13170,14 @@ class WebXRManager extends EventDispatcher {
13047
13170
 
13048
13171
  };
13049
13172
 
13173
+ /**
13174
+ * Returns a group representing the `hand` space of the XR controller.
13175
+ * Use this space for visualizing 3D objects that support the user in pointing
13176
+ * tasks like UI interaction.
13177
+ *
13178
+ * @param {number} index - The index of the controller.
13179
+ * @return {Group} A group representing the `hand` space.
13180
+ */
13050
13181
  this.getHand = function ( index ) {
13051
13182
 
13052
13183
  let controller = controllers[ index ];
@@ -13068,7 +13199,7 @@ class WebXRManager extends EventDispatcher {
13068
13199
 
13069
13200
  const controllerIndex = controllerInputSources.indexOf( event.inputSource );
13070
13201
 
13071
- if ( controllerIndex === - 1 ) {
13202
+ if ( controllerIndex === -1 ) {
13072
13203
 
13073
13204
  return;
13074
13205
 
@@ -13115,6 +13246,8 @@ class WebXRManager extends EventDispatcher {
13115
13246
 
13116
13247
  // restore framebuffer/rendering state
13117
13248
 
13249
+ scope.isPresenting = false;
13250
+
13118
13251
  renderer.setRenderTarget( initialRenderTarget );
13119
13252
 
13120
13253
  glBaseLayer = null;
@@ -13127,8 +13260,6 @@ class WebXRManager extends EventDispatcher {
13127
13260
 
13128
13261
  animation.stop();
13129
13262
 
13130
- scope.isPresenting = false;
13131
-
13132
13263
  renderer.setPixelRatio( currentPixelRatio );
13133
13264
  renderer.setSize( currentSize.width, currentSize.height, false );
13134
13265
 
@@ -13136,6 +13267,13 @@ class WebXRManager extends EventDispatcher {
13136
13267
 
13137
13268
  }
13138
13269
 
13270
+ /**
13271
+ * Sets the framebuffer scale factor.
13272
+ *
13273
+ * This method can not be used during a XR session.
13274
+ *
13275
+ * @param {number} value - The framebuffer scale factor.
13276
+ */
13139
13277
  this.setFramebufferScaleFactor = function ( value ) {
13140
13278
 
13141
13279
  framebufferScaleFactor = value;
@@ -13148,6 +13286,15 @@ class WebXRManager extends EventDispatcher {
13148
13286
 
13149
13287
  };
13150
13288
 
13289
+ /**
13290
+ * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical
13291
+ * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can
13292
+ * improve tracking. Default is `local-floor`.
13293
+ *
13294
+ * This method can not be used during a XR session.
13295
+ *
13296
+ * @param {string} value - The reference space type.
13297
+ */
13151
13298
  this.setReferenceSpaceType = function ( value ) {
13152
13299
 
13153
13300
  referenceSpaceType = value;
@@ -13160,48 +13307,87 @@ class WebXRManager extends EventDispatcher {
13160
13307
 
13161
13308
  };
13162
13309
 
13310
+ /**
13311
+ * Returns the XR reference space.
13312
+ *
13313
+ * @return {XRReferenceSpace} The XR reference space.
13314
+ */
13163
13315
  this.getReferenceSpace = function () {
13164
13316
 
13165
13317
  return customReferenceSpace || referenceSpace;
13166
13318
 
13167
13319
  };
13168
13320
 
13321
+ /**
13322
+ * Sets a custom XR reference space.
13323
+ *
13324
+ * @param {XRReferenceSpace} space - The XR reference space.
13325
+ */
13169
13326
  this.setReferenceSpace = function ( space ) {
13170
13327
 
13171
13328
  customReferenceSpace = space;
13172
13329
 
13173
13330
  };
13174
13331
 
13332
+ /**
13333
+ * Returns the current base layer.
13334
+ *
13335
+ * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
13336
+ */
13175
13337
  this.getBaseLayer = function () {
13176
13338
 
13177
13339
  return glProjLayer !== null ? glProjLayer : glBaseLayer;
13178
13340
 
13179
13341
  };
13180
13342
 
13343
+ /**
13344
+ * Returns the current XR binding.
13345
+ *
13346
+ * @return {?XRWebGLBinding} The XR binding.
13347
+ */
13181
13348
  this.getBinding = function () {
13182
13349
 
13183
13350
  return glBinding;
13184
13351
 
13185
13352
  };
13186
13353
 
13187
- this.getRenderTarget = function () {
13354
+ /**
13355
+ * Returns the current XR frame.
13356
+ *
13357
+ * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
13358
+ */
13359
+ this.getFrame = function () {
13188
13360
 
13189
- return newRenderTarget;
13361
+ return xrFrame;
13190
13362
 
13191
13363
  };
13192
13364
 
13193
- this.getFrame = function () {
13365
+ this.getRenderTarget = function () {
13194
13366
 
13195
- return xrFrame;
13367
+ return newRenderTarget;
13196
13368
 
13197
13369
  };
13198
13370
 
13371
+ /**
13372
+ * Returns the current XR session.
13373
+ *
13374
+ * @return {?XRSession} The XR session. Returns `null` when used outside a XR session.
13375
+ */
13199
13376
  this.getSession = function () {
13200
13377
 
13201
13378
  return session;
13202
13379
 
13203
13380
  };
13204
13381
 
13382
+ /**
13383
+ * After a XR session has been requested usually with one of the `*Button` modules, it
13384
+ * is injected into the renderer with this method. This method triggers the start of
13385
+ * the actual XR rendering.
13386
+ *
13387
+ * @async
13388
+ * @param {XRSession} value - The XR session to set.
13389
+ * @return {Promise} A Promise that resolves when the session has been set.
13390
+ */
13205
13391
  this.setSession = async function ( value ) {
13206
13392
 
13207
13393
  session = value;
@@ -13256,7 +13442,10 @@ class WebXRManager extends EventDispatcher {
13256
13442
  format: RGBAFormat,
13257
13443
  type: UnsignedByteType,
13258
13444
  colorSpace: renderer.outputColorSpace,
13259
- stencilBuffer: attributes.stencil
13445
+ stencilBuffer: attributes.stencil,
13446
+ resolveDepthBuffer: ( glBaseLayer.ignoreDepthValues === false ),
13447
+ resolveStencilBuffer: ( glBaseLayer.ignoreDepthValues === false )
13448
+
13260
13449
  }
13261
13450
  );
13262
13451
 
@@ -13304,7 +13493,8 @@ class WebXRManager extends EventDispatcher {
13304
13493
  stencilBuffer: attributes.stencil,
13305
13494
  colorSpace: renderer.outputColorSpace,
13306
13495
  samples: attributes.antialias ? 4 : 0,
13307
- resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
13496
+ resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false ),
13497
+ resolveStencilBuffer: ( glProjLayer.ignoreDepthValues === false )
13308
13498
  };
13309
13499
 
13310
13500
  if ( scope.isMultiview ) {
@@ -13344,6 +13534,11 @@ class WebXRManager extends EventDispatcher {
13344
13534
 
13345
13535
  };
13346
13536
 
13537
+ /**
13538
+ * Returns the environment blend mode from the current XR session.
13539
+ *
13540
+ * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session.
13541
+ */
13347
13542
  this.getEnvironmentBlendMode = function () {
13348
13543
 
13349
13544
  if ( session !== null ) {
@@ -13375,6 +13570,11 @@ class WebXRManager extends EventDispatcher {
13375
13570
  session.updateRenderState( { layers: layersCopy } );
13376
13571
  };
13377
13572
 
13573
+ /**
13574
+ * Returns the current depth texture computed via depth sensing.
13575
+ *
13576
+ * @return {?Texture} The depth texture.
13577
+ */
13378
13578
  this.getDepthTexture = function () {
13379
13579
 
13380
13580
  return depthSensing.getDepthTexture();
@@ -13407,7 +13607,7 @@ class WebXRManager extends EventDispatcher {
13407
13607
 
13408
13608
  let controllerIndex = controllerInputSources.indexOf( inputSource );
13409
13609
 
13410
- if ( controllerIndex === - 1 ) {
13610
+ if ( controllerIndex === -1 ) {
13411
13611
 
13412
13612
  // Assign input source a controller that currently has no input source
13413
13613
 
@@ -13431,7 +13631,7 @@ class WebXRManager extends EventDispatcher {
13431
13631
 
13432
13632
  // If all controllers do currently receive input we ignore new ones
13433
13633
 
13434
- if ( controllerIndex === - 1 ) break;
13634
+ if ( controllerIndex === -1 ) break;
13435
13635
 
13436
13636
  }
13437
13637
 
@@ -13498,7 +13698,7 @@ class WebXRManager extends EventDispatcher {
13498
13698
  camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
13499
13699
 
13500
13700
  // Check if the projection uses an infinite far plane.
13501
- if ( projL[ 10 ] === - 1.0 ) {
13701
+ if ( projL[ 10 ] === -1 ) {
13502
13702
 
13503
13703
  // Use the projection matrix from the left eye.
13504
13704
  // The camera offset is sufficient to include the view volumes
@@ -13547,6 +13747,15 @@ class WebXRManager extends EventDispatcher {
13547
13747
 
13548
13748
  };
13549
13749
 
13750
+ /**
13751
+ * Updates the state of the XR camera. Use this method on app level if you
13752
+ * set cameraAutoUpdate` to `false`. The method requires the non-XR
13753
+ * camera of the scene as a parameter. The passed in camera's transformation
13754
+ * is automatically adjusted to the position of the XR camera when calling
13755
+ * this method.
13756
+ *
13757
+ * @param {Camera} camera - The camera.
13758
+ */
13550
13759
  this.updateCamera = function ( camera ) {
13551
13760
 
13552
13761
  if ( session === null ) return;
@@ -13643,12 +13852,27 @@ class WebXRManager extends EventDispatcher {
13643
13852
 
13644
13853
  }
13645
13854
 
13855
+ /**
13856
+ * Returns an instance of {@link ArrayCamera} which represents the XR camera
13857
+ * of the active XR session. For each view it holds a separate camera object.
13858
+ *
13859
+ * The camera's `fov` is currently not used and does not reflect the fov of
13860
+ * the XR camera. If you need the fov on app level, you have to compute in
13861
+ * manually from the XR camera's projection matrices.
13862
+ *
13863
+ * @return {ArrayCamera} The XR camera.
13864
+ */
13646
13865
  this.getCamera = function () {
13647
13866
 
13648
13867
  return cameraXR;
13649
13868
 
13650
13869
  };
13651
13870
 
13871
+ /**
13872
+ * Returns the amount of foveation used by the XR compositor for the projection layer.
13873
+ *
13874
+ * @return {number} The amount of foveation.
13875
+ */
13652
13876
  this.getFoveation = function () {
13653
13877
 
13654
13878
  if ( glProjLayer === null && glBaseLayer === null ) {
@@ -13661,6 +13885,12 @@ class WebXRManager extends EventDispatcher {
13661
13885
 
13662
13886
  };
13663
13887
 
13888
+ /**
13889
+ * Sets the foveation value.
13890
+ *
13891
+ * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution)
13892
+ * and `1` means maximum foveation (the edges render at lower resolution).
13893
+ */
13664
13894
  this.setFoveation = function ( value ) {
13665
13895
 
13666
13896
  // 0 = no foveation = full resolution
@@ -13682,12 +13912,22 @@ class WebXRManager extends EventDispatcher {
13682
13912
 
13683
13913
  };
13684
13914
 
13915
+ /**
13916
+ * Returns `true` if depth sensing is supported.
13917
+ *
13918
+ * @return {boolean} Whether depth sensing is supported or not.
13919
+ */
13685
13920
  this.hasDepthSensing = function () {
13686
13921
 
13687
13922
  return depthSensing.texture !== null;
13688
13923
 
13689
13924
  };
13690
13925
 
13926
+ /**
13927
+ * Returns the depth sensing mesh.
13928
+ *
13929
+ * @return {Mesh} The depth sensing mesh.
13930
+ */
13691
13931
  this.getDepthSensingMesh = function () {
13692
13932
 
13693
13933
  return depthSensing.getMesh( cameraXR );
@@ -13746,7 +13986,7 @@ class WebXRManager extends EventDispatcher {
13746
13986
  renderer.setRenderTargetTextures(
13747
13987
  newRenderTarget,
13748
13988
  glSubImage.colorTexture,
13749
- glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );
13989
+ glSubImage.depthStencilTexture );
13750
13990
 
13751
13991
  renderer.setRenderTarget( newRenderTarget );
13752
13992
 
@@ -14006,7 +14246,7 @@ function WebGLMaterials( renderer, properties ) {
14006
14246
 
14007
14247
  if ( material.side === BackSide ) {
14008
14248
 
14009
- uniforms.bumpScale.value *= - 1;
14249
+ uniforms.bumpScale.value *= -1;
14010
14250
 
14011
14251
  }
14012
14252
 
@@ -14073,19 +14313,19 @@ function WebGLMaterials( renderer, properties ) {
14073
14313
  _e1.copy( envMapRotation );
14074
14314
 
14075
14315
  // accommodate left-handed frame
14076
- _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
14316
+ _e1.x *= -1; _e1.y *= -1; _e1.z *= -1;
14077
14317
 
14078
14318
  if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
14079
14319
 
14080
14320
  // environment maps which are not cube render targets or PMREMs follow a different convention
14081
- _e1.y *= - 1;
14082
- _e1.z *= - 1;
14321
+ _e1.y *= -1;
14322
+ _e1.z *= -1;
14083
14323
 
14084
14324
  }
14085
14325
 
14086
14326
  uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
14087
14327
 
14088
- uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
14328
+ uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
14089
14329
 
14090
14330
  uniforms.reflectivity.value = material.reflectivity;
14091
14331
  uniforms.ior.value = material.ior;
@@ -14508,7 +14748,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
14508
14748
 
14509
14749
  for ( let i = 0; i < maxBindingPoints; i ++ ) {
14510
14750
 
14511
- if ( allocatedBindingPoints.indexOf( i ) === - 1 ) {
14751
+ if ( allocatedBindingPoints.indexOf( i ) === -1 ) {
14512
14752
 
14513
14753
  allocatedBindingPoints.push( i );
14514
14754
  return i;
@@ -14825,8 +15065,18 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
14825
15065
 
14826
15066
  }
14827
15067
 
15068
+ /**
15069
+ * This renderer uses WebGL 2 to display scenes.
15070
+ *
15071
+ * WebGL 1 is not supported since `r163`.
15072
+ */
14828
15073
  class WebGLRenderer {
14829
15074
 
15075
+ /**
15076
+ * Constructs a new WebGL renderer.
15077
+ *
15078
+ * @param {WebGLRenderer~Options} [parameters] - The configuration parameter.
15079
+ */
14830
15080
  constructor( parameters = {} ) {
14831
15081
 
14832
15082
  const {
@@ -14844,6 +15094,13 @@ class WebGLRenderer {
14844
15094
  multiviewStereo = false,
14845
15095
  } = parameters;
14846
15096
 
15097
+ /**
15098
+ * This flag can be used for type testing.
15099
+ *
15100
+ * @type {boolean}
15101
+ * @readonly
15102
+ * @default true
15103
+ */
14847
15104
  this.isWebGLRenderer = true;
14848
15105
 
14849
15106
  let _alpha;
@@ -14878,13 +15135,36 @@ class WebGLRenderer {
14878
15135
 
14879
15136
  // public properties
14880
15137
 
15138
+ /**
15139
+ * A canvas where the renderer draws its output.This is automatically created by the renderer
15140
+ * in the constructor (if not provided already); you just need to add it to your page like so:
15141
+ * ```js
15142
+ * document.body.appendChild( renderer.domElement );
15143
+ * ```
15144
+ *
15145
+ * @type {DOMElement}
15146
+ */
14881
15147
  this.domElement = canvas;
14882
15148
 
14883
- // Debug configuration container
15149
+ /**
15150
+ * A object with debug configuration settings.
15151
+ *
15152
+ * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are
15153
+ * checked for errors during compilation and linkage process. It may be useful to disable
15154
+ * this check in production for performance gain. It is strongly recommended to keep these
15155
+ * checks enabled during development. If the shader does not compile and link - it will not
15156
+ * work and associated material will not render.
15157
+ * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that
15158
+ * can be used for custom error reporting. The callback receives the WebGL context, an instance
15159
+ * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.
15160
+ * Assigning a custom function disables the default error reporting.
15161
+ *
15162
+ * @type {Object}
15163
+ */
14884
15164
  this.debug = {
14885
15165
 
14886
15166
  /**
14887
- * Enables error checking and reporting when shader programs are being compiled
15167
+ * Enables error checking and reporting when shader programs are being compiled.
14888
15168
  * @type {boolean}
14889
15169
  */
14890
15170
  checkShaderErrors: true,
@@ -14897,29 +15177,105 @@ class WebGLRenderer {
14897
15177
 
14898
15178
  // clearing
14899
15179
 
15180
+ /**
15181
+ * Whether the renderer should automatically clear its output before rendering a frame or not.
15182
+ *
15183
+ * @type {boolean}
15184
+ * @default true
15185
+ */
14900
15186
  this.autoClear = true;
15187
+
15188
+ /**
15189
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
15190
+ * the color buffer or not.
15191
+ *
15192
+ * @type {boolean}
15193
+ * @default true
15194
+ */
14901
15195
  this.autoClearColor = true;
15196
+
15197
+ /**
15198
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
15199
+ * the depth buffer or not.
15200
+ *
15201
+ * @type {boolean}
15202
+ * @default true
15203
+ */
14902
15204
  this.autoClearDepth = true;
15205
+
15206
+ /**
15207
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
15208
+ * the stencil buffer or not.
15209
+ *
15210
+ * @type {boolean}
15211
+ * @default true
15212
+ */
14903
15213
  this.autoClearStencil = true;
14904
15214
 
14905
15215
  // scene graph
14906
15216
 
15217
+ /**
15218
+ * Whether the renderer should sort objects or not.
15219
+ *
15220
+ * Note: Sorting is used to attempt to properly render objects that have some
15221
+ * degree of transparency. By definition, sorting objects may not work in all
15222
+ * cases. Depending on the needs of application, it may be necessary to turn
15223
+ * off sorting and use other methods to deal with transparency rendering e.g.
15224
+ * manually determining each object's rendering order.
15225
+ *
15226
+ * @type {boolean}
15227
+ * @default true
15228
+ */
14907
15229
  this.sortObjects = true;
14908
15230
 
14909
15231
  // user-defined clipping
14910
15232
 
15233
+ /**
15234
+ * User-defined clipping planes specified in world space. These planes apply globally.
15235
+ * Points in space whose dot product with the plane is negative are cut away.
15236
+ *
15237
+ * @type {Array<Plane>}
15238
+ */
14911
15239
  this.clippingPlanes = [];
14912
- this.localClippingEnabled = false;
14913
-
14914
- // physically based shading
14915
15240
 
14916
- this._outputColorSpace = SRGBColorSpace;
15241
+ /**
15242
+ * Whether the renderer respects object-level clipping planes or not.
15243
+ *
15244
+ * @type {boolean}
15245
+ * @default false
15246
+ */
15247
+ this.localClippingEnabled = false;
14917
15248
 
14918
15249
  // tone mapping
14919
15250
 
15251
+ /**
15252
+ * The tone mapping technique of the renderer.
15253
+ *
15254
+ * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)}
15255
+ * @default NoToneMapping
15256
+ */
14920
15257
  this.toneMapping = NoToneMapping;
15258
+
15259
+ /**
15260
+ * Exposure level of tone mapping.
15261
+ *
15262
+ * @type {number}
15263
+ * @default 1
15264
+ */
14921
15265
  this.toneMappingExposure = 1.0;
14922
15266
 
15267
+ // transmission
15268
+
15269
+ /**
15270
+ * The normalized resolution scale for the transmission render target, measured in percentage
15271
+ * of viewport dimensions. Lowering this value can result in significant performance improvements
15272
+ * when using {@link MeshPhysicalMaterial#transmission}.
15273
+ *
15274
+ * @type {number}
15275
+ * @default 1
15276
+ */
15277
+ this.transmissionResolutionScale = 1.0;
15278
+
14923
15279
  // internal properties
14924
15280
 
14925
15281
  const _this = this;
@@ -14928,10 +15284,12 @@ class WebGLRenderer {
14928
15284
 
14929
15285
  // internal state cache
14930
15286
 
15287
+ this._outputColorSpace = SRGBColorSpace;
15288
+
14931
15289
  let _currentActiveCubeFace = 0;
14932
15290
  let _currentActiveMipmapLevel = 0;
14933
15291
  let _currentRenderTarget = null;
14934
- let _currentMaterialId = - 1;
15292
+ let _currentMaterialId = -1;
14935
15293
 
14936
15294
  let _currentCamera = null;
14937
15295
 
@@ -14964,9 +15322,6 @@ class WebGLRenderer {
14964
15322
  let _clippingEnabled = false;
14965
15323
  let _localClippingEnabled = false;
14966
15324
 
14967
- // transmission render target scale
14968
- this.transmissionResolutionScale = 1.0;
14969
-
14970
15325
  // camera matrices cache
14971
15326
 
14972
15327
  const _currentProjectionMatrix = new Matrix4();
@@ -15097,12 +15452,79 @@ class WebGLRenderer {
15097
15452
 
15098
15453
  info.programs = programCache.programs;
15099
15454
 
15455
+ /**
15456
+ * Holds details about the capabilities of the current rendering context.
15457
+ *
15458
+ * @name WebGLRenderer#capabilities
15459
+ * @type {WebGLRenderer~Capabilities}
15460
+ */
15100
15461
  _this.capabilities = capabilities;
15462
+
15463
+ /**
15464
+ * Provides methods for retrieving and testing WebGL extensions.
15465
+ *
15466
+ * - `get(extensionName:string)`: Used to check whether a WebGL extension is supported
15467
+ * and return the extension object if available.
15468
+ * - `has(extensionName:string)`: returns `true` if the extension is supported.
15469
+ *
15470
+ * @name WebGLRenderer#extensions
15471
+ * @type {Object}
15472
+ */
15101
15473
  _this.extensions = extensions;
15474
+
15475
+ /**
15476
+ * Used to track properties of other objects like native WebGL objects.
15477
+ *
15478
+ * @name WebGLRenderer#properties
15479
+ * @type {Object}
15480
+ */
15102
15481
  _this.properties = properties;
15482
+
15483
+ /**
15484
+ * Manages the render lists of the renderer.
15485
+ *
15486
+ * @name WebGLRenderer#renderLists
15487
+ * @type {Object}
15488
+ */
15103
15489
  _this.renderLists = renderLists;
15490
+
15491
+
15492
+
15493
+ /**
15494
+ * Interface for managing shadows.
15495
+ *
15496
+ * @name WebGLRenderer#shadowMap
15497
+ * @type {WebGLRenderer~ShadowMap}
15498
+ */
15104
15499
  _this.shadowMap = shadowMap;
15500
+
15501
+ /**
15502
+ * Interface for managing the WebGL state.
15503
+ *
15504
+ * @name WebGLRenderer#state
15505
+ * @type {Object}
15506
+ */
15105
15507
  _this.state = state;
15508
+
15509
+ /**
15510
+ * Holds a series of statistical information about the GPU memory
15511
+ * and the rendering process. Useful for debugging and monitoring.
15512
+ *
15513
+ * By default these data are reset at each render call but when having
15514
+ * multiple render passes per frame (e.g. when using post processing) it can
15515
+ * be preferred to reset with a custom pattern. First, set `autoReset` to
15516
+ * `false`.
15517
+ * ```js
15518
+ * renderer.info.autoReset = false;
15519
+ * ```
15520
+ * Call `reset()` whenever you have finished to render a single frame.
15521
+ * ```js
15522
+ * renderer.info.reset();
15523
+ * ```
15524
+ *
15525
+ * @name WebGLRenderer#info
15526
+ * @type {WebGLRenderer~Info}
15527
+ */
15106
15528
  _this.info = info;
15107
15529
 
15108
15530
  }
@@ -15113,22 +15535,38 @@ class WebGLRenderer {
15113
15535
 
15114
15536
  const xr = new WebXRManager( _this, _gl );
15115
15537
 
15538
+ /**
15539
+ * A reference to the XR manager.
15540
+ *
15541
+ * @type {WebXRManager}
15542
+ */
15116
15543
  this.xr = xr;
15117
15544
 
15118
- // API
15119
-
15545
+ /**
15546
+ * Returns the rendering context.
15547
+ *
15548
+ * @return {WebGL2RenderingContext} The rendering context.
15549
+ */
15120
15550
  this.getContext = function () {
15121
15551
 
15122
15552
  return _gl;
15123
15553
 
15124
15554
  };
15125
15555
 
15556
+ /**
15557
+ * Returns the rendering context attributes.
15558
+ *
15559
+ * @return {WebGLContextAttributes} The rendering context attributes.
15560
+ */
15126
15561
  this.getContextAttributes = function () {
15127
15562
 
15128
15563
  return _gl.getContextAttributes();
15129
15564
 
15130
15565
  };
15131
15566
 
15567
+ /**
15568
+ * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension.
15569
+ */
15132
15570
  this.forceContextLoss = function () {
15133
15571
 
15134
15572
  const extension = extensions.get( 'WEBGL_lose_context' );
@@ -15136,6 +15574,9 @@ class WebGLRenderer {
15136
15574
 
15137
15575
  };
15138
15576
 
15577
+ /**
15578
+ * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension.
15579
+ */
15139
15580
  this.forceContextRestore = function () {
15140
15581
 
15141
15582
  const extension = extensions.get( 'WEBGL_lose_context' );
@@ -15143,12 +15584,22 @@ class WebGLRenderer {
15143
15584
 
15144
15585
  };
15145
15586
 
15587
+ /**
15588
+ * Returns the pixel ratio.
15589
+ *
15590
+ * @return {number} The pixel ratio.
15591
+ */
15146
15592
  this.getPixelRatio = function () {
15147
15593
 
15148
15594
  return _pixelRatio;
15149
15595
 
15150
15596
  };
15151
15597
 
15598
+ /**
15599
+ * Sets the given pixel ratio and resizes the canvas if necessary.
15600
+ *
15601
+ * @param {number} value - The pixel ratio.
15602
+ */
15152
15603
  this.setPixelRatio = function ( value ) {
15153
15604
 
15154
15605
  if ( value === undefined ) return;
@@ -15159,12 +15610,27 @@ class WebGLRenderer {
15159
15610
 
15160
15611
  };
15161
15612
 
15613
+ /**
15614
+ * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
15615
+ *
15616
+ * @param {Vector2} target - The method writes the result in this target object.
15617
+ * @return {Vector2} The renderer's size in logical pixels.
15618
+ */
15162
15619
  this.getSize = function ( target ) {
15163
15620
 
15164
15621
  return target.set( _width, _height );
15165
15622
 
15166
15623
  };
15167
15624
 
15625
+ /**
15626
+ * Resizes the output canvas to (width, height) with device pixel ratio taken
15627
+ * into account, and also sets the viewport to fit that size, starting in (0,
15628
+ * 0). Setting `updateStyle` to false prevents any style changes to the output canvas.
15629
+ *
15630
+ * @param {number} width - The width in logical pixels.
15631
+ * @param {number} height - The height in logical pixels.
15632
+ * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
15633
+ */
15168
15634
  this.setSize = function ( width, height, updateStyle = true ) {
15169
15635
 
15170
15636
  if ( xr.isPresenting ) {
@@ -15191,12 +15657,31 @@ class WebGLRenderer {
15191
15657
 
15192
15658
  };
15193
15659
 
15660
+ /**
15661
+ * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.
15662
+ *
15663
+ * @param {Vector2} target - The method writes the result in this target object.
15664
+ * @return {Vector2} The drawing buffer size.
15665
+ */
15194
15666
  this.getDrawingBufferSize = function ( target ) {
15195
15667
 
15196
15668
  return target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();
15197
15669
 
15198
15670
  };
15199
15671
 
15672
+ /**
15673
+ * This method allows to define the drawing buffer size by specifying
15674
+ * width, height and pixel ratio all at once. The size of the drawing
15675
+ * buffer is computed with this formula:
15676
+ * ```js
15677
+ * size.x = width * pixelRatio;
15678
+ * size.y = height * pixelRatio;
15679
+ * ```
15680
+ *
15681
+ * @param {number} width - The width in logical pixels.
15682
+ * @param {number} height - The height in logical pixels.
15683
+ * @param {number} pixelRatio - The pixel ratio.
15684
+ */
15200
15685
  this.setDrawingBufferSize = function ( width, height, pixelRatio ) {
15201
15686
 
15202
15687
  _width = width;
@@ -15211,18 +15696,39 @@ class WebGLRenderer {
15211
15696
 
15212
15697
  };
15213
15698
 
15699
+ /**
15700
+ * Returns the current viewport definition.
15701
+ *
15702
+ * @param {Vector2} target - The method writes the result in this target object.
15703
+ * @return {Vector2} The current viewport definition.
15704
+ */
15214
15705
  this.getCurrentViewport = function ( target ) {
15215
15706
 
15216
15707
  return target.copy( _currentViewport );
15217
15708
 
15218
15709
  };
15219
15710
 
15711
+ /**
15712
+ * Returns the viewport definition.
15713
+ *
15714
+ * @param {Vector4} target - The method writes the result in this target object.
15715
+ * @return {Vector4} The viewport definition.
15716
+ */
15220
15717
  this.getViewport = function ( target ) {
15221
15718
 
15222
15719
  return target.copy( _viewport );
15223
15720
 
15224
15721
  };
15225
15722
 
15723
+ /**
15724
+ * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`.
15725
+ *
15726
+ * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
15727
+ * Or alternatively a four-component vector specifying all the parameters of the viewport.
15728
+ * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
15729
+ * @param {number} width - The width of the viewport in logical pixel unit.
15730
+ * @param {number} height - The height of the viewport in logical pixel unit.
15731
+ */
15226
15732
  this.setViewport = function ( x, y, width, height ) {
15227
15733
 
15228
15734
  if ( x.isVector4 ) {
@@ -15239,12 +15745,27 @@ class WebGLRenderer {
15239
15745
 
15240
15746
  };
15241
15747
 
15748
+ /**
15749
+ * Returns the scissor region.
15750
+ *
15751
+ * @param {Vector4} target - The method writes the result in this target object.
15752
+ * @return {Vector4} The scissor region.
15753
+ */
15242
15754
  this.getScissor = function ( target ) {
15243
15755
 
15244
15756
  return target.copy( _scissor );
15245
15757
 
15246
15758
  };
15247
15759
 
15760
+ /**
15761
+ * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`.
15762
+ *
15763
+ * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit.
15764
+ * Or alternatively a four-component vector specifying all the parameters of the scissor region.
15765
+ * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit.
15766
+ * @param {number} width - The width of the scissor region in logical pixel unit.
15767
+ * @param {number} height - The height of the scissor region in logical pixel unit.
15768
+ */
15248
15769
  this.setScissor = function ( x, y, width, height ) {
15249
15770
 
15250
15771
  if ( x.isVector4 ) {
@@ -15261,24 +15782,48 @@ class WebGLRenderer {
15261
15782
 
15262
15783
  };
15263
15784
 
15785
+ /**
15786
+ * Returns `true` if the scissor test is enabled.
15787
+ *
15788
+ * @return {boolean} Whether the scissor test is enabled or not.
15789
+ */
15264
15790
  this.getScissorTest = function () {
15265
15791
 
15266
15792
  return _scissorTest;
15267
15793
 
15268
15794
  };
15269
15795
 
15796
+ /**
15797
+ * Enable or disable the scissor test. When this is enabled, only the pixels
15798
+ * within the defined scissor area will be affected by further renderer
15799
+ * actions.
15800
+ *
15801
+ * @param {boolean} boolean - Whether the scissor test is enabled or not.
15802
+ */
15270
15803
  this.setScissorTest = function ( boolean ) {
15271
15804
 
15272
15805
  state.setScissorTest( _scissorTest = boolean );
15273
15806
 
15274
15807
  };
15275
15808
 
15809
+ /**
15810
+ * Sets a custom opaque sort function for the render lists. Pass `null`
15811
+ * to use the default `painterSortStable` function.
15812
+ *
15813
+ * @param {?Function} method - The opaque sort function.
15814
+ */
15276
15815
  this.setOpaqueSort = function ( method ) {
15277
15816
 
15278
15817
  _opaqueSort = method;
15279
15818
 
15280
15819
  };
15281
15820
 
15821
+ /**
15822
+ * Sets a custom transparent sort function for the render lists. Pass `null`
15823
+ * to use the default `reversePainterSortStable` function.
15824
+ *
15825
+ * @param {?Function} method - The opaque sort function.
15826
+ */
15282
15827
  this.setTransparentSort = function ( method ) {
15283
15828
 
15284
15829
  _transparentSort = method;
@@ -15287,30 +15832,60 @@ class WebGLRenderer {
15287
15832
 
15288
15833
  // Clearing
15289
15834
 
15835
+ /**
15836
+ * Returns the clear color.
15837
+ *
15838
+ * @param {Color} target - The method writes the result in this target object.
15839
+ * @return {Color} The clear color.
15840
+ */
15290
15841
  this.getClearColor = function ( target ) {
15291
15842
 
15292
15843
  return target.copy( background.getClearColor() );
15293
15844
 
15294
15845
  };
15295
15846
 
15847
+ /**
15848
+ * Sets the clear color and alpha.
15849
+ *
15850
+ * @param {Color} color - The clear color.
15851
+ * @param {number} [alpha=1] - The clear alpha.
15852
+ */
15296
15853
  this.setClearColor = function () {
15297
15854
 
15298
- background.setClearColor.apply( background, arguments );
15855
+ background.setClearColor( ...arguments );
15299
15856
 
15300
15857
  };
15301
15858
 
15859
+ /**
15860
+ * Returns the clear alpha. Ranges within `[0,1]`.
15861
+ *
15862
+ * @return {number} The clear alpha.
15863
+ */
15302
15864
  this.getClearAlpha = function () {
15303
15865
 
15304
15866
  return background.getClearAlpha();
15305
15867
 
15306
15868
  };
15307
15869
 
15870
+ /**
15871
+ * Sets the clear alpha.
15872
+ *
15873
+ * @param {number} alpha - The clear alpha.
15874
+ */
15308
15875
  this.setClearAlpha = function () {
15309
15876
 
15310
- background.setClearAlpha.apply( background, arguments );
15877
+ background.setClearAlpha( ...arguments );
15311
15878
 
15312
15879
  };
15313
15880
 
15881
+ /**
15882
+ * Tells the renderer to clear its color, depth or stencil drawing buffer(s).
15883
+ * This method initializes the buffers to the current clear color values.
15884
+ *
15885
+ * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
15886
+ * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
15887
+ * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
15888
+ */
15314
15889
  this.clear = function ( color = true, depth = true, stencil = true ) {
15315
15890
 
15316
15891
  let bits = 0;
@@ -15389,26 +15964,37 @@ class WebGLRenderer {
15389
15964
 
15390
15965
  };
15391
15966
 
15967
+ /**
15968
+ * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`.
15969
+ */
15392
15970
  this.clearColor = function () {
15393
15971
 
15394
15972
  this.clear( true, false, false );
15395
15973
 
15396
15974
  };
15397
15975
 
15976
+ /**
15977
+ * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`.
15978
+ */
15398
15979
  this.clearDepth = function () {
15399
15980
 
15400
15981
  this.clear( false, true, false );
15401
15982
 
15402
15983
  };
15403
15984
 
15985
+ /**
15986
+ * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`.
15987
+ */
15404
15988
  this.clearStencil = function () {
15405
15989
 
15406
15990
  this.clear( false, false, true );
15407
15991
 
15408
15992
  };
15409
15993
 
15410
- //
15411
-
15994
+ /**
15995
+ * Frees the GPU-related resources allocated by this instance. Call this
15996
+ * method whenever this instance is no longer used in your app.
15997
+ */
15412
15998
  this.dispose = function () {
15413
15999
 
15414
16000
  canvas.removeEventListener( 'webglcontextlost', onContextLost, false );
@@ -15643,6 +16229,8 @@ class WebGLRenderer {
15643
16229
 
15644
16230
  if ( object._multiDrawInstances !== null ) {
15645
16231
 
16232
+ // @deprecated, r174
16233
+ warnOnce( 'THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
15646
16234
  renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
15647
16235
 
15648
16236
  } else {
@@ -15712,6 +16300,18 @@ class WebGLRenderer {
15712
16300
 
15713
16301
  }
15714
16302
 
16303
+ /**
16304
+ * Compiles all materials in the scene with the camera. This is useful to precompile shaders
16305
+ * before the first rendering. If you want to add a 3D object to an existing scene, use the third
16306
+ * optional parameter for applying the target scene.
16307
+ *
16308
+ * Note that the (target) scene's lighting and environment must be configured before calling this method.
16309
+ *
16310
+ * @param {Object3D} scene - The scene or another type of 3D object to precompile.
16311
+ * @param {Camera} camera - The camera.
16312
+ * @param {?Scene} [targetScene=null] - The target scene.
16313
+ * @return {?Set} The precompiled materials.
16314
+ */
15715
16315
  this.compile = function ( scene, camera, targetScene = null ) {
15716
16316
 
15717
16317
  if ( targetScene === null ) targetScene = scene;
@@ -15799,8 +16399,7 @@ class WebGLRenderer {
15799
16399
 
15800
16400
  } );
15801
16401
 
15802
- renderStateStack.pop();
15803
- currentRenderState = null;
16402
+ currentRenderState = renderStateStack.pop();
15804
16403
 
15805
16404
  return materials;
15806
16405
 
@@ -15808,6 +16407,18 @@ class WebGLRenderer {
15808
16407
 
15809
16408
  // compileAsync
15810
16409
 
16410
+ /**
16411
+ * Asynchronous version of {@link WebGLRenderer#compile}.
16412
+ *
16413
+ * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence,
16414
+ * it is recommended to use this version of `compile()` whenever possible.
16415
+ *
16416
+ * @async
16417
+ * @param {Object3D} scene - The scene or another type of 3D object to precompile.
16418
+ * @param {Camera} camera - The camera.
16419
+ * @param {?Scene} [targetScene=null] - The target scene.
16420
+ * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation.
16421
+ */
15811
16422
  this.compileAsync = function ( scene, camera, targetScene = null ) {
15812
16423
 
15813
16424
  const materials = this.compile( scene, camera, targetScene );
@@ -15909,6 +16520,20 @@ class WebGLRenderer {
15909
16520
 
15910
16521
  // Rendering
15911
16522
 
16523
+ /**
16524
+ * Renders the given scene (or other type of 3D object) using the given camera.
16525
+ *
16526
+ * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget}
16527
+ * or to the canvas as usual.
16528
+ *
16529
+ * By default render buffers are cleared before rendering but you can prevent
16530
+ * this by setting the property `autoClear` to `false`. If you want to prevent
16531
+ * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth`
16532
+ * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}.
16533
+ *
16534
+ * @param {Object3D} scene - The scene to render.
16535
+ * @param {Camera} camera - The camera.
16536
+ */
15912
16537
  this.render = function ( scene, camera ) {
15913
16538
 
15914
16539
  if ( camera !== undefined && camera.isCamera !== true ) {
@@ -16074,7 +16699,7 @@ class WebGLRenderer {
16074
16699
  // _gl.finish();
16075
16700
 
16076
16701
  bindingStates.resetDefaultState();
16077
- _currentMaterialId = - 1;
16702
+ _currentMaterialId = -1;
16078
16703
  _currentCamera = null;
16079
16704
 
16080
16705
  renderStateStack.pop();
@@ -16377,8 +17002,14 @@ class WebGLRenderer {
16377
17002
 
16378
17003
  const object = renderItem.object;
16379
17004
  const geometry = renderItem.geometry;
16380
- const material = overrideMaterial === null ? renderItem.material : overrideMaterial;
16381
17005
  const group = renderItem.group;
17006
+ let material = renderItem.material;
17007
+
17008
+ if ( material.allowOverride === true && overrideMaterial !== null ) {
17009
+
17010
+ material = overrideMaterial;
17011
+
17012
+ }
16382
17013
 
16383
17014
  if ( object.layers.test( camera.layers ) ) {
16384
17015
 
@@ -16906,7 +17537,7 @@ class WebGLRenderer {
16906
17537
 
16907
17538
  m_uniforms.envMap.value = envMap;
16908
17539
 
16909
- m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
17540
+ m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
16910
17541
 
16911
17542
  }
16912
17543
 
@@ -17050,18 +17681,34 @@ class WebGLRenderer {
17050
17681
 
17051
17682
  }() );
17052
17683
 
17684
+ /**
17685
+ * Returns the active cube face.
17686
+ *
17687
+ * @return {number} The active cube face.
17688
+ */
17053
17689
  this.getActiveCubeFace = function () {
17054
17690
 
17055
17691
  return _currentActiveCubeFace;
17056
17692
 
17057
17693
  };
17058
17694
 
17695
+ /**
17696
+ * Returns the active mipmap level.
17697
+ *
17698
+ * @return {number} The active mipmap level.
17699
+ */
17059
17700
  this.getActiveMipmapLevel = function () {
17060
17701
 
17061
17702
  return _currentActiveMipmapLevel;
17062
17703
 
17063
17704
  };
17064
17705
 
17706
+ /**
17707
+ * Returns the active render target.
17708
+ *
17709
+ * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target
17710
+ * is currently set.
17711
+ */
17065
17712
  this.getRenderTarget = function () {
17066
17713
 
17067
17714
  return _currentRenderTarget;
@@ -17070,26 +17717,21 @@ class WebGLRenderer {
17070
17717
 
17071
17718
  this.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {
17072
17719
 
17073
- properties.get( renderTarget.texture ).__webglTexture = colorTexture;
17074
- properties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;
17075
-
17076
17720
  const renderTargetProperties = properties.get( renderTarget );
17077
- renderTargetProperties.__hasExternalTextures = true;
17078
17721
 
17079
- renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
17080
-
17081
- if ( ! renderTargetProperties.__autoAllocateDepthBuffer && ( ! _currentRenderTarget || ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) ) {
17722
+ renderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;
17723
+ if ( ! renderTargetProperties.__autoAllocateDepthBuffer === false && ( ! _currentRenderTarget || ! _currentRenderTarget.isWebGLMultiviewRenderTarget ) ) {
17082
17724
 
17083
17725
  // The multisample_render_to_texture extension doesn't work properly if there
17084
17726
  // are midframe flushes and an external depth buffer. Disable use of the extension.
17085
- if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
17727
+ renderTargetProperties.__useRenderToTexture = false;
17086
17728
 
17087
- console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
17088
- renderTargetProperties.__useRenderToTexture = false;
17729
+ }
17089
17730
 
17090
- }
17731
+ properties.get( renderTarget.texture ).__webglTexture = colorTexture;
17732
+ properties.get( renderTarget.depthTexture ).__webglTexture = renderTargetProperties.__autoAllocateDepthBuffer ? undefined : depthTexture;
17091
17733
 
17092
- }
17734
+ renderTargetProperties.__hasExternalTextures = true;
17093
17735
 
17094
17736
  };
17095
17737
 
@@ -17102,6 +17744,16 @@ class WebGLRenderer {
17102
17744
  };
17103
17745
 
17104
17746
  const _scratchFrameBuffer = _gl.createFramebuffer();
17747
+
17748
+ /**
17749
+ * Sets the active rendertarget.
17750
+ *
17751
+ * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given,
17752
+ * the canvas is set as the active render target instead.
17753
+ * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target.
17754
+ * Indicates the z layer to render in to when using 3D or array render targets.
17755
+ * @param {number} [activeMipmapLevel=0] - The active mipmap level.
17756
+ */
17105
17757
  this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
17106
17758
 
17107
17759
  // Render to base layer instead of canvas in WebXR
@@ -17257,10 +17909,21 @@ class WebGLRenderer {
17257
17909
 
17258
17910
  }
17259
17911
 
17260
- _currentMaterialId = - 1; // reset current material to ensure correct uniform bindings
17912
+ _currentMaterialId = -1; // reset current material to ensure correct uniform bindings
17261
17913
 
17262
17914
  };
17263
17915
 
17916
+ /**
17917
+ * Reads the pixel data from the given render target into the given buffer.
17918
+ *
17919
+ * @param {WebGLRenderTarget} renderTarget - The render target to read from.
17920
+ * @param {number} x - The `x` coordinate of the copy region's origin.
17921
+ * @param {number} y - The `y` coordinate of the copy region's origin.
17922
+ * @param {number} width - The width of the copy region.
17923
+ * @param {number} height - The height of the copy region.
17924
+ * @param {TypedArray} buffer - The result buffer.
17925
+ * @param {number} [activeCubeFaceIndex] - The active cube face index.
17926
+ */
17264
17927
  this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
17265
17928
 
17266
17929
  if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
@@ -17323,6 +17986,21 @@ class WebGLRenderer {
17323
17986
 
17324
17987
  };
17325
17988
 
17989
+ /**
17990
+ * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}.
17991
+ *
17992
+ * It is recommended to use this version of `readRenderTargetPixels()` whenever possible.
17993
+ *
17994
+ * @async
17995
+ * @param {WebGLRenderTarget} renderTarget - The render target to read from.
17996
+ * @param {number} x - The `x` coordinate of the copy region's origin.
17997
+ * @param {number} y - The `y` coordinate of the copy region's origin.
17998
+ * @param {number} width - The width of the copy region.
17999
+ * @param {number} height - The height of the copy region.
18000
+ * @param {TypedArray} buffer - The result buffer.
18001
+ * @param {number} [activeCubeFaceIndex] - The active cube face index.
18002
+ * @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
18003
+ */
17326
18004
  this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
17327
18005
 
17328
18006
  if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
@@ -17340,27 +18018,27 @@ class WebGLRenderer {
17340
18018
 
17341
18019
  if ( framebuffer ) {
17342
18020
 
17343
- const texture = renderTarget.texture;
17344
- const textureFormat = texture.format;
17345
- const textureType = texture.type;
18021
+ // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
18022
+ if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
17346
18023
 
17347
- if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
18024
+ // set the active frame buffer to the one we want to read
18025
+ state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
17348
18026
 
17349
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
18027
+ const texture = renderTarget.texture;
18028
+ const textureFormat = texture.format;
18029
+ const textureType = texture.type;
17350
18030
 
17351
- }
18031
+ if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
17352
18032
 
17353
- if ( ! capabilities.textureTypeReadable( textureType ) ) {
18033
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
17354
18034
 
17355
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
18035
+ }
17356
18036
 
17357
- }
18037
+ if ( ! capabilities.textureTypeReadable( textureType ) ) {
17358
18038
 
17359
- // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
17360
- if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
18039
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
17361
18040
 
17362
- // set the active frame buffer to the one we want to read
17363
- state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
18041
+ }
17364
18042
 
17365
18043
  const glBuffer = _gl.createBuffer();
17366
18044
  _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
@@ -17396,19 +18074,15 @@ class WebGLRenderer {
17396
18074
 
17397
18075
  };
17398
18076
 
18077
+ /**
18078
+ * Copies pixels from the current bound framebuffer into the given texture.
18079
+ *
18080
+ * @param {FramebufferTexture} texture - The texture.
18081
+ * @param {Vector2} position - The start position of the copy operation.
18082
+ * @param {number} [level=0] - The mip level. The default represents the base mip.
18083
+ */
17399
18084
  this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
17400
18085
 
17401
- // support previous signature with position first
17402
- if ( texture.isTexture !== true ) {
17403
-
17404
- // @deprecated, r165
17405
- warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
17406
-
17407
- position = arguments[ 0 ] || null;
17408
- texture = arguments[ 1 ];
17409
-
17410
- }
17411
-
17412
18086
  const levelScale = Math.pow( 2, - level );
17413
18087
  const width = Math.floor( texture.image.width * levelScale );
17414
18088
  const height = Math.floor( texture.image.height * levelScale );
@@ -17426,21 +18100,21 @@ class WebGLRenderer {
17426
18100
 
17427
18101
  const _srcFramebuffer = _gl.createFramebuffer();
17428
18102
  const _dstFramebuffer = _gl.createFramebuffer();
17429
- this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
17430
-
17431
- // support previous signature with dstPosition first
17432
- if ( srcTexture.isTexture !== true ) {
17433
18103
 
17434
- // @deprecated, r165
17435
- warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
17436
-
17437
- dstPosition = arguments[ 0 ] || null;
17438
- srcTexture = arguments[ 1 ];
17439
- dstTexture = arguments[ 2 ];
17440
- dstLevel = arguments[ 3 ] || 0;
17441
- srcRegion = null;
17442
-
17443
- }
18104
+ /**
18105
+ * Copies data of the given source texture into a destination texture.
18106
+ *
18107
+ * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized
18108
+ * {@link WebGLRenderer#initRenderTarget}.
18109
+ *
18110
+ * @param {Texture} srcTexture - The source texture.
18111
+ * @param {Texture} dstTexture - The destination texture.
18112
+ * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
18113
+ * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
18114
+ * @param {number} srcLevel - The source mipmap level to copy.
18115
+ * @param {number} dstLevel - The destination mipmap level.
18116
+ */
18117
+ this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
17444
18118
 
17445
18119
  // support the previous signature with just a single dst mipmap level
17446
18120
  if ( dstLevel === null ) {
@@ -17694,20 +18368,6 @@ class WebGLRenderer {
17694
18368
 
17695
18369
  this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
17696
18370
 
17697
- // support previous signature with source box first
17698
- if ( srcTexture.isTexture !== true ) {
17699
-
17700
- // @deprecated, r165
17701
- warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
17702
-
17703
- srcRegion = arguments[ 0 ] || null;
17704
- dstPosition = arguments[ 1 ] || null;
17705
- srcTexture = arguments[ 2 ];
17706
- dstTexture = arguments[ 3 ];
17707
- level = arguments[ 4 ] || 0;
17708
-
17709
- }
17710
-
17711
18371
  // @deprecated, r170
17712
18372
  warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
17713
18373
 
@@ -17715,6 +18375,13 @@ class WebGLRenderer {
17715
18375
 
17716
18376
  };
17717
18377
 
18378
+ /**
18379
+ * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
18380
+ * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
18381
+ * rendered to.
18382
+ *
18383
+ * @param {WebGLRenderTarget} target - The render target.
18384
+ */
17718
18385
  this.initRenderTarget = function ( target ) {
17719
18386
 
17720
18387
  if ( properties.get( target ).__webglFramebuffer === undefined ) {
@@ -17725,6 +18392,12 @@ class WebGLRenderer {
17725
18392
 
17726
18393
  };
17727
18394
 
18395
+ /**
18396
+ * Initializes the given texture. Useful for preloading a texture rather than waiting until first
18397
+ * render (which can cause noticeable lags due to decode and GPU upload overhead).
18398
+ *
18399
+ * @param {Texture} texture - The texture.
18400
+ */
17728
18401
  this.initTexture = function ( texture ) {
17729
18402
 
17730
18403
  if ( texture.isCubeTexture ) {
@@ -17749,6 +18422,11 @@ class WebGLRenderer {
17749
18422
 
17750
18423
  };
17751
18424
 
18425
+ /**
18426
+ * Can be used to reset the internal WebGL state. This method is mostly
18427
+ * relevant for applications which share a single WebGL context across
18428
+ * multiple WebGL libraries.
18429
+ */
17752
18430
  this.resetState = function () {
17753
18431
 
17754
18432
  _currentActiveCubeFace = 0;
@@ -17768,12 +18446,27 @@ class WebGLRenderer {
17768
18446
 
17769
18447
  }
17770
18448
 
18449
+ /**
18450
+ * Defines the coordinate system of the renderer.
18451
+ *
18452
+ * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`.
18453
+ *
18454
+ * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem}
18455
+ * @default WebGLCoordinateSystem
18456
+ * @readonly
18457
+ */
17771
18458
  get coordinateSystem() {
17772
18459
 
17773
18460
  return WebGLCoordinateSystem;
17774
18461
 
17775
18462
  }
17776
18463
 
18464
+ /**
18465
+ * Defines the output color space of the renderer.
18466
+ *
18467
+ * @type {SRGBColorSpace|LinearSRGBColorSpace}
18468
+ * @default SRGBColorSpace
18469
+ */
17777
18470
  get outputColorSpace() {
17778
18471
 
17779
18472
  return this._outputColorSpace;
@@ -17785,7 +18478,7 @@ class WebGLRenderer {
17785
18478
  this._outputColorSpace = colorSpace;
17786
18479
 
17787
18480
  const gl = this.getContext();
17788
- gl.drawingBufferColorspace = ColorManagement._getDrawingBufferColorSpace( colorSpace );
18481
+ gl.drawingBufferColorSpace = ColorManagement._getDrawingBufferColorSpace( colorSpace );
17789
18482
  gl.unpackColorSpace = ColorManagement._getUnpackColorSpace();
17790
18483
 
17791
18484
  }