@types/three 0.182.0 → 0.183.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 (312) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -3
  3. three/examples/jsm/controls/OrbitControls.d.ts +39 -0
  4. three/examples/jsm/effects/AnaglyphEffect.d.ts +4 -0
  5. three/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
  6. three/examples/jsm/gpgpu/BitonicSort.d.ts +5 -5
  7. three/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
  8. three/examples/jsm/helpers/ViewHelper.d.ts +4 -1
  9. three/examples/jsm/inspector/tabs/Parameters.d.ts +3 -0
  10. three/examples/jsm/inspector/ui/Item.d.ts +5 -0
  11. three/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -1
  12. three/examples/jsm/lights/LightProbeGenerator.d.ts +11 -5
  13. three/examples/jsm/loaders/ColladaLoader.d.ts +27 -4
  14. three/examples/jsm/objects/SkyMesh.d.ts +11 -6
  15. three/examples/jsm/objects/Water2Mesh.d.ts +7 -7
  16. three/examples/jsm/objects/WaterMesh.d.ts +6 -6
  17. three/examples/jsm/postprocessing/EffectComposer.d.ts +9 -10
  18. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +4 -9
  19. three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +30 -0
  20. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +1 -1
  21. three/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
  22. three/examples/jsm/tsl/display/BloomNode.d.ts +5 -5
  23. three/examples/jsm/tsl/display/CRT.d.ts +22 -0
  24. three/examples/jsm/tsl/display/DenoiseNode.d.ts +5 -5
  25. three/examples/jsm/tsl/display/DotScreenNode.d.ts +4 -6
  26. three/examples/jsm/tsl/display/GTAONode.d.ts +8 -8
  27. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +4 -2
  28. three/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
  29. three/examples/jsm/tsl/display/LensflareNode.d.ts +6 -6
  30. three/examples/jsm/tsl/display/Lut3DNode.d.ts +5 -5
  31. three/examples/jsm/tsl/display/MotionBlur.d.ts +1 -1
  32. three/examples/jsm/tsl/display/OutlineNode.d.ts +6 -6
  33. three/examples/jsm/tsl/display/PixelationPassNode.d.ts +10 -10
  34. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +2 -2
  35. three/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
  36. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +1 -1
  37. three/examples/jsm/tsl/display/SSGINode.d.ts +11 -11
  38. three/examples/jsm/tsl/display/SSRNode.d.ts +6 -6
  39. three/examples/jsm/tsl/display/SSSNode.d.ts +5 -5
  40. three/examples/jsm/tsl/display/Shape.d.ts +3 -0
  41. three/examples/jsm/tsl/display/TransitionNode.d.ts +3 -3
  42. three/examples/jsm/tsl/display/boxBlur.d.ts +1 -1
  43. three/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
  44. three/examples/jsm/tsl/display/hashBlur.d.ts +1 -1
  45. three/examples/jsm/tsl/math/Bayer.d.ts +2 -0
  46. three/examples/jsm/tsl/utils/Raymarching.d.ts +2 -2
  47. three/package.json +3 -3
  48. three/src/Three.Core.d.ts +1 -1
  49. three/src/Three.TSL.d.ts +6 -11
  50. three/src/Three.WebGPU.Nodes.d.ts +2 -0
  51. three/src/Three.WebGPU.d.ts +3 -0
  52. three/src/Three.d.ts +2 -2
  53. three/src/animation/AnimationClip.d.ts +1 -1
  54. three/src/animation/KeyframeTrack.d.ts +19 -5
  55. three/src/animation/PropertyMixer.d.ts +5 -4
  56. three/src/audio/Audio.d.ts +224 -157
  57. three/src/audio/AudioAnalyser.d.ts +32 -27
  58. three/src/audio/AudioContext.d.ts +12 -12
  59. three/src/audio/AudioListener.d.ts +44 -65
  60. three/src/audio/PositionalAudio.d.ts +69 -62
  61. three/src/cameras/ArrayCamera.d.ts +21 -24
  62. three/src/cameras/Camera.d.ts +14 -53
  63. three/src/cameras/CubeCamera.d.ts +32 -28
  64. three/src/cameras/OrthographicCamera.d.ts +70 -100
  65. three/src/cameras/PerspectiveCamera.d.ts +133 -146
  66. three/src/cameras/StereoCamera.d.ts +24 -30
  67. three/src/constants.d.ts +14 -2
  68. three/src/core/Clock.d.ts +3 -0
  69. three/src/core/Object3D.d.ts +31 -7
  70. three/src/geometries/TorusGeometry.d.ts +22 -3
  71. three/src/helpers/ArrowHelper.d.ts +34 -50
  72. three/src/helpers/AxesHelper.d.ts +22 -36
  73. three/src/helpers/Box3Helper.d.ts +14 -25
  74. three/src/helpers/BoxHelper.d.ts +28 -39
  75. three/src/helpers/CameraHelper.d.ts +31 -52
  76. three/src/helpers/DirectionalLightHelper.d.ts +32 -53
  77. three/src/helpers/GridHelper.d.ts +15 -29
  78. three/src/helpers/HemisphereLightHelper.d.ts +26 -49
  79. three/src/helpers/PlaneHelper.d.ts +21 -33
  80. three/src/helpers/PointLightHelper.d.ts +25 -50
  81. three/src/helpers/PolarGridHelper.d.ts +19 -32
  82. three/src/helpers/SkeletonHelper.d.ts +26 -50
  83. three/src/helpers/SpotLightHelper.d.ts +28 -55
  84. three/src/lights/AmbientLight.d.ts +15 -23
  85. three/src/lights/DirectionalLight.d.ts +40 -82
  86. three/src/lights/DirectionalLightShadow.d.ts +6 -61
  87. three/src/lights/HemisphereLight.d.ts +20 -47
  88. three/src/lights/Light.d.ts +18 -48
  89. three/src/lights/LightProbe.d.ts +24 -29
  90. three/src/lights/LightShadow.d.ts +107 -91
  91. three/src/lights/PointLight.d.ts +36 -77
  92. three/src/lights/PointLightShadow.d.ts +9 -6
  93. three/src/lights/RectAreaLight.d.ts +39 -59
  94. three/src/lights/SpotLight.d.ts +62 -116
  95. three/src/lights/SpotLightShadow.d.ts +17 -59
  96. three/src/lights/webgpu/IESSpotLight.d.ts +13 -1
  97. three/src/lights/webgpu/ProjectorLight.d.ts +9 -10
  98. three/src/materials/MeshLambertMaterial.d.ts +6 -0
  99. three/src/materials/MeshPhongMaterial.d.ts +6 -0
  100. three/src/materials/nodes/Line2NodeMaterial.d.ts +0 -6
  101. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +0 -4
  102. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +1 -2
  103. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +0 -2
  104. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +0 -2
  105. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +5 -8
  106. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +0 -4
  107. three/src/materials/nodes/NodeMaterial.d.ts +9 -3
  108. three/src/materials/nodes/SpriteNodeMaterial.d.ts +0 -3
  109. three/src/materials/nodes/VolumeNodeMaterial.d.ts +0 -2
  110. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +39 -93
  111. three/src/math/Color.d.ts +1 -0
  112. three/src/math/Vector3.d.ts +2 -2
  113. three/src/math/interpolants/BezierInterpolant.d.ts +7 -0
  114. three/src/nodes/Nodes.d.ts +55 -35
  115. three/src/nodes/TSL.d.ts +2 -5
  116. three/src/nodes/accessors/Arrays.d.ts +19 -10
  117. three/src/nodes/accessors/BufferAttributeNode.d.ts +99 -33
  118. three/src/nodes/accessors/BufferNode.d.ts +21 -7
  119. three/src/nodes/accessors/Camera.d.ts +10 -10
  120. three/src/nodes/accessors/CubeTextureNode.d.ts +1 -1
  121. three/src/nodes/accessors/InstanceNode.d.ts +6 -0
  122. three/src/nodes/accessors/Lights.d.ts +9 -6
  123. three/src/nodes/accessors/MaterialNode.d.ts +1 -3
  124. three/src/nodes/accessors/MaterialProperties.d.ts +4 -4
  125. three/src/nodes/accessors/MaterialReferenceNode.d.ts +1 -1
  126. three/src/nodes/accessors/ModelNode.d.ts +34 -17
  127. three/src/nodes/accessors/MorphNode.d.ts +1 -1
  128. three/src/nodes/accessors/Normal.d.ts +13 -15
  129. three/src/nodes/accessors/Object3DNode.d.ts +35 -16
  130. three/src/nodes/accessors/Position.d.ts +9 -7
  131. three/src/nodes/accessors/ReferenceNode.d.ts +16 -7
  132. three/src/nodes/accessors/ReflectVector.d.ts +4 -5
  133. three/src/nodes/accessors/RendererReferenceNode.d.ts +1 -1
  134. three/src/nodes/accessors/SceneProperties.d.ts +5 -0
  135. three/src/nodes/accessors/SkinningNode.d.ts +5 -3
  136. three/src/nodes/accessors/StorageBufferNode.d.ts +49 -22
  137. three/src/nodes/accessors/StorageTextureNode.d.ts +1 -1
  138. three/src/nodes/accessors/Tangent.d.ts +5 -7
  139. three/src/nodes/accessors/Texture3DNode.d.ts +1 -1
  140. three/src/nodes/accessors/TextureBicubic.d.ts +3 -2
  141. three/src/nodes/accessors/TextureNode.d.ts +19 -18
  142. three/src/nodes/accessors/UV.d.ts +1 -1
  143. three/src/nodes/accessors/UniformArrayNode.d.ts +10 -8
  144. three/src/nodes/accessors/UserDataNode.d.ts +1 -1
  145. three/src/nodes/accessors/VelocityNode.d.ts +3 -3
  146. three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
  147. three/src/nodes/code/FunctionCallNode.d.ts +0 -1
  148. three/src/nodes/code/FunctionNode.d.ts +7 -3
  149. three/src/nodes/core/ArrayNode.d.ts +2 -3
  150. three/src/nodes/core/AttributeNode.d.ts +12 -6
  151. three/src/nodes/core/BypassNode.d.ts +2 -3
  152. three/src/nodes/core/ConstNode.d.ts +10 -3
  153. three/src/nodes/core/ContextNode.d.ts +23 -28
  154. three/src/nodes/core/IndexNode.d.ts +1 -1
  155. three/src/nodes/core/InputNode.d.ts +12 -4
  156. three/src/nodes/core/InspectorNode.d.ts +2 -3
  157. three/src/nodes/core/IsolateNode.d.ts +2 -7
  158. three/src/nodes/core/MRTNode.d.ts +7 -0
  159. three/src/nodes/core/Node.d.ts +258 -39
  160. three/src/nodes/core/NodeAttribute.d.ts +30 -5
  161. three/src/nodes/core/NodeBuilder.d.ts +5 -3
  162. three/src/nodes/core/NodeCache.d.ts +24 -48
  163. three/src/nodes/core/NodeError.d.ts +9 -0
  164. three/src/nodes/core/NodeParser.d.ts +2 -0
  165. three/src/nodes/core/NodeUniform.d.ts +33 -9
  166. three/src/nodes/core/NodeVar.d.ts +33 -5
  167. three/src/nodes/core/NodeVarying.d.ts +32 -4
  168. three/src/nodes/core/ParameterNode.d.ts +11 -4
  169. three/src/nodes/core/PropertyNode.d.ts +45 -35
  170. three/src/nodes/core/StackTrace.d.ts +9 -0
  171. three/src/nodes/core/StructType.d.ts +3 -1
  172. three/src/nodes/core/StructTypeNode.d.ts +19 -5
  173. three/src/nodes/core/TempNode.d.ts +9 -3
  174. three/src/nodes/core/UniformNode.d.ts +53 -15
  175. three/src/nodes/core/VarNode.d.ts +15 -14
  176. three/src/nodes/core/VaryingNode.d.ts +14 -19
  177. three/src/nodes/core/constants.d.ts +9 -4
  178. three/src/nodes/display/BlendModes.d.ts +7 -27
  179. three/src/nodes/display/ColorAdjustment.d.ts +8 -9
  180. three/src/nodes/display/ColorSpaceNode.d.ts +2 -8
  181. three/src/nodes/display/FrontFacingNode.d.ts +1 -1
  182. three/src/nodes/display/PassNode.d.ts +9 -5
  183. three/src/nodes/display/RenderOutputNode.d.ts +3 -7
  184. three/src/nodes/display/ScreenNode.d.ts +25 -17
  185. three/src/nodes/display/ToneMappingNode.d.ts +3 -7
  186. three/src/nodes/display/ViewportDepthNode.d.ts +11 -7
  187. three/src/nodes/display/ViewportTextureNode.d.ts +2 -0
  188. three/src/nodes/fog/Fog.d.ts +5 -3
  189. three/src/nodes/geometry/RangeNode.d.ts +51 -9
  190. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -0
  191. three/src/nodes/gpgpu/BarrierNode.d.ts +2 -0
  192. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -7
  193. three/src/nodes/lighting/AnalyticLightNode.d.ts +1 -1
  194. three/src/nodes/lighting/HemisphereLightNode.d.ts +3 -2
  195. three/src/nodes/lighting/LightProbeNode.d.ts +1 -1
  196. three/src/nodes/lighting/LightUtils.d.ts +1 -1
  197. three/src/nodes/lighting/LightingContextNode.d.ts +1 -1
  198. three/src/nodes/lighting/SpotLightNode.d.ts +0 -6
  199. three/src/nodes/materialx/MaterialXNodes.d.ts +11 -11
  200. three/src/nodes/math/BitcountNode.d.ts +2 -0
  201. three/src/nodes/math/ConditionalNode.d.ts +43 -22
  202. three/src/nodes/math/Hash.d.ts +1 -1
  203. three/src/nodes/math/MathNode.d.ts +603 -267
  204. three/src/nodes/math/MathUtils.d.ts +9 -5
  205. three/src/nodes/math/OperatorNode.d.ts +490 -227
  206. three/src/nodes/math/TriNoise3D.d.ts +3 -3
  207. three/src/nodes/pmrem/PMREMNode.d.ts +1 -1
  208. three/src/nodes/procedural/Checker.d.ts +1 -1
  209. three/src/nodes/tsl/TSLCore.d.ts +1683 -224
  210. three/src/nodes/utils/ArrayElementNode.d.ts +9 -4
  211. three/src/nodes/utils/DebugNode.d.ts +2 -5
  212. three/src/nodes/utils/Discard.d.ts +2 -3
  213. three/src/nodes/utils/FlipNode.d.ts +11 -0
  214. three/src/nodes/utils/LoopNode.d.ts +17 -13
  215. three/src/nodes/utils/MaxMipLevelNode.d.ts +1 -1
  216. three/src/nodes/utils/Oscillators.d.ts +4 -4
  217. three/src/nodes/utils/Packing.d.ts +3 -3
  218. three/src/nodes/utils/PostProcessingUtils.d.ts +5 -5
  219. three/src/nodes/utils/RemapNode.d.ts +33 -39
  220. three/src/nodes/utils/RotateNode.d.ts +17 -8
  221. three/src/nodes/utils/SplitNode.d.ts +1 -2
  222. three/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
  223. three/src/nodes/utils/StorageArrayElementNode.d.ts +18 -9
  224. three/src/nodes/utils/Timer.d.ts +4 -4
  225. three/src/nodes/utils/TriplanarTextures.d.ts +2 -2
  226. three/src/nodes/utils/UVUtils.d.ts +6 -4
  227. three/src/objects/BatchedMesh.d.ts +6 -4
  228. three/src/objects/InstancedMesh.d.ts +32 -24
  229. three/src/renderers/WebGLRenderer.d.ts +4 -93
  230. three/src/renderers/common/Animation.d.ts +46 -9
  231. three/src/renderers/common/Attributes.d.ts +11 -13
  232. three/src/renderers/common/Backend.d.ts +0 -2
  233. three/src/renderers/common/Background.d.ts +17 -15
  234. three/src/renderers/common/BindGroup.d.ts +27 -13
  235. three/src/renderers/common/Binding.d.ts +15 -3
  236. three/src/renderers/common/Bindings.d.ts +41 -17
  237. three/src/renderers/common/BlendMode.d.ts +22 -0
  238. three/src/renderers/common/Buffer.d.ts +35 -11
  239. three/src/renderers/common/BufferUtils.d.ts +3 -4
  240. three/src/renderers/common/BundleGroup.d.ts +16 -6
  241. three/src/renderers/common/CanvasTarget.d.ts +76 -13
  242. three/src/renderers/common/ChainMap.d.ts +12 -9
  243. three/src/renderers/common/ClippingContext.d.ts +61 -10
  244. three/src/renderers/common/Color4.d.ts +10 -5
  245. three/src/renderers/common/ComputePipeline.d.ts +16 -2
  246. three/src/renderers/common/Constants.d.ts +5 -3
  247. three/src/renderers/common/CubeRenderTarget.d.ts +24 -7
  248. three/src/renderers/common/DataMap.d.ts +10 -18
  249. three/src/renderers/common/Geometries.d.ts +39 -20
  250. three/src/renderers/common/Info.d.ts +62 -9
  251. three/src/renderers/common/InspectorBase.d.ts +19 -7
  252. three/src/renderers/common/Lighting.d.ts +2 -6
  253. three/src/renderers/common/Pipeline.d.ts +14 -2
  254. three/src/renderers/common/Pipelines.d.ts +58 -60
  255. three/src/renderers/common/PostProcessing.d.ts +14 -17
  256. three/src/renderers/common/ProgrammableStage.d.ts +48 -8
  257. three/src/renderers/common/RenderBundle.d.ts +4 -2
  258. three/src/renderers/common/RenderBundles.d.ts +6 -3
  259. three/src/renderers/common/RenderContext.d.ts +175 -7
  260. three/src/renderers/common/RenderContexts.d.ts +20 -25
  261. three/src/renderers/common/RenderList.d.ts +77 -11
  262. three/src/renderers/common/RenderLists.d.ts +16 -4
  263. three/src/renderers/common/RenderObject.d.ts +223 -47
  264. three/src/renderers/common/{RenderPipeline.d.ts → RenderObjectPipeline.d.ts} +17 -5
  265. three/src/renderers/common/RenderObjects.d.ts +55 -22
  266. three/src/renderers/common/Renderer.d.ts +625 -207
  267. three/src/renderers/common/Textures.d.ts +24 -46
  268. three/src/renderers/common/TimestampQueryPool.d.ts +62 -8
  269. three/src/renderers/common/Uniform.d.ts +143 -58
  270. three/src/renderers/common/UniformBuffer.d.ts +7 -5
  271. three/src/renderers/common/UniformsGroup.d.ts +50 -35
  272. three/src/renderers/common/XRManager.d.ts +321 -83
  273. three/src/renderers/common/XRRenderTarget.d.ts +49 -6
  274. three/src/renderers/common/nodes/NodeBuilderState.d.ts +75 -15
  275. three/src/renderers/common/nodes/NodeLibrary.d.ts +25 -5
  276. three/src/renderers/common/nodes/{Nodes.d.ts → NodeManager.d.ts} +54 -73
  277. three/src/renderers/common/nodes/NodeUniform.d.ts +60 -70
  278. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +23 -4
  279. three/src/renderers/shaders/UniformsLib.d.ts +0 -3
  280. three/src/renderers/webgl/WebGLAttributes.d.ts +9 -7
  281. three/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
  282. three/src/renderers/webgl/WebGLExtensions.d.ts +1 -1
  283. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +9 -5
  284. three/src/renderers/webgl/WebGLLights.d.ts +19 -18
  285. three/src/renderers/webgl/WebGLObjects.d.ts +15 -2
  286. three/src/renderers/webgl/WebGLProgram.d.ts +2 -10
  287. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -2
  288. three/src/renderers/webgl/WebGLRenderLists.d.ts +1 -3
  289. three/src/renderers/webgl/WebGLShadowMap.d.ts +0 -5
  290. three/src/renderers/webgl/WebGLState.d.ts +305 -28
  291. three/src/renderers/webgl/WebGLTextures.d.ts +10 -9
  292. three/src/renderers/webgl/WebGLUniforms.d.ts +0 -7
  293. three/src/renderers/webgpu/WebGPUBackend.d.ts +0 -1
  294. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +2 -4
  295. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +15 -4
  296. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -1
  297. three/src/scenes/Fog.d.ts +31 -37
  298. three/src/scenes/FogExp2.d.ts +26 -31
  299. three/src/scenes/Scene.d.ts +51 -65
  300. three/src/textures/CompressedArrayTexture.d.ts +1 -1
  301. three/src/textures/DataArrayTexture.d.ts +1 -1
  302. three/src/utils.d.ts +5 -0
  303. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +0 -18
  304. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +0 -13
  305. three/examples/jsm/shaders/GodRaysShader.d.ts +0 -44
  306. three/src/nodes/accessors/SceneNode.d.ts +0 -21
  307. three/src/nodes/code/ScriptableNode.d.ts +0 -21
  308. three/src/nodes/code/ScriptableValueNode.d.ts +0 -9
  309. three/src/nodes/display/PosterizeNode.d.ts +0 -13
  310. three/src/nodes/utils/SpriteSheetUVNode.d.ts +0 -15
  311. three/src/renderers/webgl/WebGLCubeMaps.d.ts +0 -8
  312. three/src/renderers/webgl/WebGLCubeUVMaps.d.ts +0 -9
@@ -1,6 +1,6 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { ShadowMapType, TextureDataType, TimestampQuery, ToneMapping } from "../../constants.js";
3
- import { BufferAttribute } from "../../core/BufferAttribute.js";
2
+ import { CoordinateSystem, ShadowMapType, TextureDataType, TimestampQuery, ToneMapping } from "../../constants.js";
3
+ import { BufferAttribute, TypedArray } from "../../core/BufferAttribute.js";
4
4
  import { BufferGeometry, GeometryGroup } from "../../core/BufferGeometry.js";
5
5
  import { Object3D } from "../../core/Object3D.js";
6
6
  import { RenderTarget } from "../../core/RenderTarget.js";
@@ -11,53 +11,36 @@ import { ColorRepresentation } from "../../math/Color.js";
11
11
  import { Vector2 } from "../../math/Vector2.js";
12
12
  import { Vector3 } from "../../math/Vector3.js";
13
13
  import { Vector4 } from "../../math/Vector4.js";
14
+ import ContextNode from "../../nodes/core/ContextNode.js";
14
15
  import MRTNode from "../../nodes/core/MRTNode.js";
15
16
  import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
16
17
  import LightsNode from "../../nodes/lighting/LightsNode.js";
17
- import { Group } from "../../objects/Group.js";
18
18
  import { Scene } from "../../scenes/Scene.js";
19
19
  import { FramebufferTexture } from "../../textures/FramebufferTexture.js";
20
20
  import { Texture } from "../../textures/Texture.js";
21
- import Animation from "./Animation.js";
22
- import Attributes from "./Attributes.js";
23
21
  import Backend from "./Backend.js";
24
- import Background from "./Background.js";
25
- import Bindings from "./Bindings.js";
26
22
  import CanvasTarget from "./CanvasTarget.js";
27
23
  import ClippingContext from "./ClippingContext.js";
28
24
  import Color4 from "./Color4.js";
29
- import Geometries from "./Geometries.js";
30
25
  import IndirectStorageBufferAttribute from "./IndirectStorageBufferAttribute.js";
31
26
  import Info from "./Info.js";
32
27
  import InspectorBase from "./InspectorBase.js";
33
28
  import Lighting from "./Lighting.js";
34
29
  import NodeLibrary from "./nodes/NodeLibrary.js";
35
- import Nodes from "./nodes/Nodes.js";
36
- import Pipelines from "./Pipelines.js";
37
- import QuadMesh from "./QuadMesh.js";
38
- import RenderBundle from "./RenderBundle.js";
39
- import RenderBundles from "./RenderBundles.js";
40
- import RenderContext from "./RenderContext.js";
41
- import RenderContexts from "./RenderContexts.js";
42
- import RenderList, { Bundle, RenderItem } from "./RenderList.js";
43
- import RenderLists from "./RenderLists.js";
44
- import RenderObjects from "./RenderObjects.js";
45
- import Textures from "./Textures.js";
30
+ import { RenderItem } from "./RenderList.js";
31
+ import StorageBufferAttribute from "./StorageBufferAttribute.js";
46
32
  import XRManager from "./XRManager.js";
47
- interface Rectangle {
48
- x: number;
49
- y: number;
50
- z: number;
51
- w: number;
52
- }
33
+
53
34
  interface DeviceLostInfo {
54
35
  api: "WebGL" | "WebGPU";
55
36
  message: string;
56
37
  reason: string | null;
57
38
  originalEvent: unknown;
58
39
  }
40
+
59
41
  export interface RendererParameters {
60
42
  logarithmicDepthBuffer?: boolean | undefined;
43
+ reversedDepthBuffer?: boolean | undefined;
61
44
  alpha?: boolean | undefined;
62
45
  depth?: boolean | undefined;
63
46
  stencil?: boolean | undefined;
@@ -67,108 +50,591 @@ export interface RendererParameters {
67
50
  outputBufferType?: TextureDataType | undefined;
68
51
  multiview?: boolean | undefined;
69
52
  }
53
+
70
54
  /**
71
55
  * Base class for renderers.
72
56
  */
73
57
  declare class Renderer {
74
- readonly isRenderer: true;
58
+ /**
59
+ * Renderer options.
60
+ *
61
+ * @typedef {Object} Renderer~Options
62
+ * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
63
+ * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not.
64
+ * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
65
+ * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not.
66
+ * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
67
+ * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
68
+ * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
69
+ * to overwrite the default.
70
+ * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
71
+ * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best
72
+ * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
73
+ * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
74
+ */
75
+ /**
76
+ * Constructs a new renderer.
77
+ *
78
+ * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
79
+ * @param {Renderer~Options} [parameters] - The configuration parameter.
80
+ */
81
+ constructor(backend: Backend, parameters?: RendererParameters);
82
+ /**
83
+ * This flag can be used for type testing.
84
+ *
85
+ * @type {boolean}
86
+ * @readonly
87
+ * @default true
88
+ */
89
+ readonly isRenderer: boolean;
90
+ /**
91
+ * A reference to the current backend.
92
+ *
93
+ * @type {Backend}
94
+ */
75
95
  backend: Backend;
96
+ /**
97
+ * Whether the renderer should automatically clear the current rendering target
98
+ * before execute a `render()` call. The target can be the canvas (default framebuffer)
99
+ * or the current bound render target (custom framebuffer).
100
+ *
101
+ * @type {boolean}
102
+ * @default true
103
+ */
76
104
  autoClear: boolean;
105
+ /**
106
+ * When `autoClear` is set to `true`, this property defines whether the renderer
107
+ * should clear the color buffer.
108
+ *
109
+ * @type {boolean}
110
+ * @default true
111
+ */
77
112
  autoClearColor: boolean;
113
+ /**
114
+ * When `autoClear` is set to `true`, this property defines whether the renderer
115
+ * should clear the depth buffer.
116
+ *
117
+ * @type {boolean}
118
+ * @default true
119
+ */
78
120
  autoClearDepth: boolean;
121
+ /**
122
+ * When `autoClear` is set to `true`, this property defines whether the renderer
123
+ * should clear the stencil buffer.
124
+ *
125
+ * @type {boolean}
126
+ * @default true
127
+ */
79
128
  autoClearStencil: boolean;
129
+ /**
130
+ * Whether the default framebuffer should be transparent or opaque.
131
+ *
132
+ * @type {boolean}
133
+ * @default true
134
+ */
80
135
  alpha: boolean;
81
- logarithmicDepthBuffer: boolean;
136
+ /**
137
+ * Whether logarithmic depth buffer is enabled or not.
138
+ *
139
+ * @type {boolean}
140
+ * @default false
141
+ * @readonly
142
+ */
143
+ readonly logarithmicDepthBuffer: boolean;
144
+ /**
145
+ * Whether reversed depth buffer is enabled or not.
146
+ *
147
+ * @type {boolean}
148
+ * @default false
149
+ * @readonly
150
+ */
151
+ readonly reversedDepthBuffer: boolean;
152
+ /**
153
+ * Defines the output color space of the renderer.
154
+ *
155
+ * @type {string}
156
+ * @default SRGBColorSpace
157
+ */
82
158
  outputColorSpace: string;
159
+ /**
160
+ * Defines the tone mapping of the renderer.
161
+ *
162
+ * @type {number}
163
+ * @default NoToneMapping
164
+ */
83
165
  toneMapping: ToneMapping;
166
+ /**
167
+ * Defines the tone mapping exposure.
168
+ *
169
+ * @type {number}
170
+ * @default 1
171
+ */
84
172
  toneMappingExposure: number;
173
+ /**
174
+ * Whether the renderer should sort its render lists or not.
175
+ *
176
+ * Note: Sorting is used to attempt to properly render objects that have some degree of transparency.
177
+ * By definition, sorting objects may not work in all cases. Depending on the needs of application,
178
+ * it may be necessary to turn off sorting and use other methods to deal with transparency rendering
179
+ * e.g. manually determining each object's rendering order.
180
+ *
181
+ * @type {boolean}
182
+ * @default true
183
+ */
85
184
  sortObjects: boolean;
185
+ /**
186
+ * Whether the default framebuffer should have a depth buffer or not.
187
+ *
188
+ * @type {boolean}
189
+ * @default true
190
+ */
86
191
  depth: boolean;
192
+ /**
193
+ * Whether the default framebuffer should have a stencil buffer or not.
194
+ *
195
+ * @type {boolean}
196
+ * @default false
197
+ */
87
198
  stencil: boolean;
199
+ /**
200
+ * Holds a series of statistical information about the GPU memory
201
+ * and the rendering process. Useful for debugging and monitoring.
202
+ *
203
+ * @type {Info}
204
+ */
88
205
  info: Info;
206
+ /**
207
+ * A global context node that stores override nodes for specific transformations or calculations.
208
+ * These nodes can be used to replace default behavior in the rendering pipeline.
209
+ *
210
+ * @type {ContextNode}
211
+ * @property {Object} value - The context value object.
212
+ */
213
+ contextNode: ContextNode<unknown>;
214
+ /**
215
+ * The node library defines how certain library objects like materials, lights
216
+ * or tone mapping functions are mapped to node types. This is required since
217
+ * although instances of classes like `MeshBasicMaterial` or `PointLight` can
218
+ * be part of the scene graph, they are internally represented as nodes for
219
+ * further processing.
220
+ *
221
+ * @type {NodeLibrary}
222
+ */
89
223
  library: NodeLibrary;
224
+ /**
225
+ * A map-like data structure for managing lights.
226
+ *
227
+ * @type {Lighting}
228
+ */
90
229
  lighting: Lighting;
91
- _samples: number;
92
- _canvasTarget: CanvasTarget;
93
- _inspector: InspectorBase;
94
- _getFallback: ((error: unknown) => Backend) | null;
95
- _attributes: Attributes | null;
96
- _geometries: Geometries | null;
97
- _nodes: Nodes | null;
98
- _animation: Animation | null;
99
- _bindings: Bindings | null;
100
- _objects: RenderObjects | null;
101
- _pipelines: Pipelines | null;
102
- _bundles: RenderBundles | null;
103
- _renderLists: RenderLists | null;
104
- _renderContexts: RenderContexts | null;
105
- _textures: Textures | null;
106
- _background: Background | null;
107
- _quad: QuadMesh;
108
- _currentRenderContext: RenderContext | null;
109
- _opaqueSort: ((a: RenderItem, b: RenderItem) => number) | null;
110
- _transparentSort: ((a: RenderItem, b: RenderItem) => number) | null;
111
- _frameBufferTarget: RenderTarget | null;
112
- _clearColor: Color4;
113
- _clearDepth: number;
114
- _clearStencil: number;
115
- _renderTarget: RenderTarget | null;
116
- _activeCubeFace: number;
117
- _activeMipmapLevel: number;
118
- _outputRenderTarget: RenderTarget | null;
119
- _mrt: MRTNode | null;
120
- _renderObjectFunction:
121
- | ((
122
- object: Object3D,
123
- scene: Scene,
124
- camera: Camera,
125
- geometry: BufferGeometry,
126
- material: Material,
127
- group: GeometryGroup,
128
- lightsNode: LightsNode,
129
- clippingContext: ClippingContext | null,
130
- passId: string | null,
131
- ) => void)
132
- | null;
133
- _currentRenderObjectFunction:
134
- | ((
135
- object: Object3D,
136
- scene: Scene,
137
- camera: Camera,
138
- geometry: BufferGeometry,
139
- material: Material,
140
- group: GeometryGroup,
141
- lightsNode: LightsNode,
142
- clippingContext: ClippingContext | null,
143
- passId: string | null,
144
- ) => void)
145
- | null;
146
- _currentRenderBundle: RenderBundle | null;
147
- _handleObjectFunction: (
148
- object: Object3D,
149
- material: Material,
150
- scene: Scene,
151
- camera: Camera,
152
- lightsNode: LightsNode,
153
- group: GeometryGroup,
154
- clippingContext: ClippingContext | null,
155
- passId?: string,
156
- ) => void;
157
- _isDeviceLost: boolean;
230
+ /**
231
+ * The number of MSAA samples.
232
+ *
233
+ * @private
234
+ * @type {number}
235
+ * @default 0
236
+ */
237
+ private _samples;
238
+ /**
239
+ * Callback when the canvas has been resized.
240
+ *
241
+ * @private
242
+ */
243
+ private _onCanvasTargetResize;
244
+ /**
245
+ * The canvas target for rendering.
246
+ *
247
+ * @private
248
+ * @type {CanvasTarget}
249
+ */
250
+ private _canvasTarget;
251
+ /**
252
+ * The inspector provides information about the internal renderer state.
253
+ *
254
+ * @private
255
+ * @type {InspectorBase}
256
+ */
257
+ private _inspector;
258
+ /**
259
+ * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
260
+ *
261
+ * @private
262
+ * @type {?Function}
263
+ */
264
+ private _getFallback;
265
+ /**
266
+ * A reference to a renderer module for managing shader attributes.
267
+ *
268
+ * @private
269
+ * @type {?Attributes}
270
+ * @default null
271
+ */
272
+ private _attributes;
273
+ /**
274
+ * A reference to a renderer module for managing geometries.
275
+ *
276
+ * @private
277
+ * @type {?Geometries}
278
+ * @default null
279
+ */
280
+ private _geometries;
281
+ /**
282
+ * A reference to a renderer module for managing node related logic.
283
+ *
284
+ * @private
285
+ * @type {?NodeManager}
286
+ * @default null
287
+ */
288
+ private _nodes;
289
+ /**
290
+ * A reference to a renderer module for managing the internal animation loop.
291
+ *
292
+ * @private
293
+ * @type {?Animation}
294
+ * @default null
295
+ */
296
+ private _animation;
297
+ /**
298
+ * A reference to a renderer module for managing shader program bindings.
299
+ *
300
+ * @private
301
+ * @type {?Bindings}
302
+ * @default null
303
+ */
304
+ private _bindings;
305
+ /**
306
+ * A reference to a renderer module for managing render objects.
307
+ *
308
+ * @private
309
+ * @type {?RenderObjects}
310
+ * @default null
311
+ */
312
+ private _objects;
313
+ /**
314
+ * A reference to a renderer module for managing render and compute pipelines.
315
+ *
316
+ * @private
317
+ * @type {?Pipelines}
318
+ * @default null
319
+ */
320
+ private _pipelines;
321
+ /**
322
+ * A reference to a renderer module for managing render bundles.
323
+ *
324
+ * @private
325
+ * @type {?RenderBundles}
326
+ * @default null
327
+ */
328
+ private _bundles;
329
+ /**
330
+ * A reference to a renderer module for managing render lists.
331
+ *
332
+ * @private
333
+ * @type {?RenderLists}
334
+ * @default null
335
+ */
336
+ private _renderLists;
337
+ /**
338
+ * A reference to a renderer module for managing render contexts.
339
+ *
340
+ * @private
341
+ * @type {?RenderContexts}
342
+ * @default null
343
+ */
344
+ private _renderContexts;
345
+ /**
346
+ * A reference to a renderer module for managing textures.
347
+ *
348
+ * @private
349
+ * @type {?Textures}
350
+ * @default null
351
+ */
352
+ private _textures;
353
+ /**
354
+ * A reference to a renderer module for backgrounds.
355
+ *
356
+ * @private
357
+ * @type {?Background}
358
+ * @default null
359
+ */
360
+ private _background;
361
+ /**
362
+ * This fullscreen quad is used for internal render passes
363
+ * like the tone mapping and color space output pass.
364
+ *
365
+ * @private
366
+ * @type {QuadMesh}
367
+ */
368
+ private _quad;
369
+ /**
370
+ * A reference to the current render context.
371
+ *
372
+ * @private
373
+ * @type {?RenderContext}
374
+ * @default null
375
+ */
376
+ private _currentRenderContext;
377
+ /**
378
+ * A custom sort function for the opaque render list.
379
+ *
380
+ * @private
381
+ * @type {?Function}
382
+ * @default null
383
+ */
384
+ private _opaqueSort;
385
+ /**
386
+ * A custom sort function for the transparent render list.
387
+ *
388
+ * @private
389
+ * @type {?Function}
390
+ * @default null
391
+ */
392
+ private _transparentSort;
393
+ /**
394
+ * The framebuffer target.
395
+ *
396
+ * @private
397
+ * @type {?RenderTarget}
398
+ * @default null
399
+ */
400
+ private _frameBufferTarget;
401
+ /**
402
+ * The clear color value.
403
+ *
404
+ * @private
405
+ * @type {Color4}
406
+ */
407
+ private _clearColor;
408
+ /**
409
+ * The clear depth value.
410
+ *
411
+ * @private
412
+ * @type {number}
413
+ * @default 1
414
+ */
415
+ private _clearDepth;
416
+ /**
417
+ * The clear stencil value.
418
+ *
419
+ * @private
420
+ * @type {number}
421
+ * @default 0
422
+ */
423
+ private _clearStencil;
424
+ /**
425
+ * The current render target.
426
+ *
427
+ * @private
428
+ * @type {?RenderTarget}
429
+ * @default null
430
+ */
431
+ private _renderTarget;
432
+ /**
433
+ * The active cube face.
434
+ *
435
+ * @private
436
+ * @type {number}
437
+ * @default 0
438
+ */
439
+ private _activeCubeFace;
440
+ /**
441
+ * The active mipmap level.
442
+ *
443
+ * @private
444
+ * @type {number}
445
+ * @default 0
446
+ */
447
+ private _activeMipmapLevel;
448
+ /**
449
+ * The current output render target.
450
+ *
451
+ * @private
452
+ * @type {?RenderTarget}
453
+ * @default null
454
+ */
455
+ private _outputRenderTarget;
456
+ /**
457
+ * The MRT setting.
458
+ *
459
+ * @private
460
+ * @type {?MRTNode}
461
+ * @default null
462
+ */
463
+ private _mrt;
464
+ /**
465
+ * This function defines how a render object is going
466
+ * to be rendered.
467
+ *
468
+ * @private
469
+ * @type {?Function}
470
+ * @default null
471
+ */
472
+ private _renderObjectFunction;
473
+ /**
474
+ * Used to keep track of the current render object function.
475
+ *
476
+ * @private
477
+ * @type {?Function}
478
+ * @default null
479
+ */
480
+ private _currentRenderObjectFunction;
481
+ /**
482
+ * Used to keep track of the current render bundle.
483
+ *
484
+ * @private
485
+ * @type {?RenderBundle}
486
+ * @default null
487
+ */
488
+ private _currentRenderBundle;
489
+ /**
490
+ * Next to `_renderObjectFunction()`, this function provides another hook
491
+ * for influencing the render process of a render object. It is meant for internal
492
+ * use and only relevant for `compileAsync()` right now. Instead of using
493
+ * the default logic of `_renderObjectDirect()` which actually draws the render object,
494
+ * a different function might be used which performs no draw but just the node
495
+ * and pipeline updates.
496
+ *
497
+ * @private
498
+ * @type {Function}
499
+ */
500
+ private _handleObjectFunction;
501
+ /**
502
+ * Indicates whether the device has been lost or not. In WebGL terms, the device
503
+ * lost is considered as a context lost. When this is set to `true`, rendering
504
+ * isn't possible anymore.
505
+ *
506
+ * @private
507
+ * @type {boolean}
508
+ * @default false
509
+ */
510
+ private _isDeviceLost;
511
+ /**
512
+ * A callback function that defines what should happen when a device/context lost occurs.
513
+ *
514
+ * @type {Function}
515
+ */
158
516
  onDeviceLost: (info: DeviceLostInfo) => void;
159
- _outputBufferType: TextureDataType;
160
- _initialized: boolean;
161
- _initPromise: Promise<this> | null;
162
- _compilationPromises: Promise<void>[] | null;
517
+ /**
518
+ * Defines the type of output buffers. The default `HalfFloatType` is recommend for
519
+ * best quality. To save memory and bandwidth, `UnsignedByteType` might be used.
520
+ * This will reduce rendering quality though.
521
+ *
522
+ * @private
523
+ * @type {number}
524
+ * @default HalfFloatType
525
+ */
526
+ private _outputBufferType;
527
+ /**
528
+ * A cache for shadow nodes per material
529
+ *
530
+ * @private
531
+ * @type {WeakMap<Material, Object>}
532
+ */
533
+ private _cacheShadowNodes;
534
+ /**
535
+ * Whether the renderer has been initialized or not.
536
+ *
537
+ * @private
538
+ * @type {boolean}
539
+ * @default false
540
+ */
541
+ private _initialized;
542
+ /**
543
+ * The call depth of the renderer. Counts the number of
544
+ * nested render calls.
545
+ *
546
+ * @private
547
+ * @type {number}
548
+ * @default - 1
549
+ */
550
+ private _callDepth;
551
+ /**
552
+ * A reference to the promise which initializes the renderer.
553
+ *
554
+ * @private
555
+ * @type {?Promise<this>}
556
+ * @default null
557
+ */
558
+ private _initPromise;
559
+ /**
560
+ * An array of compilation promises which are used in `compileAsync()`.
561
+ *
562
+ * @private
563
+ * @type {?Array<Promise>}
564
+ * @default null
565
+ */
566
+ private _compilationPromises;
567
+ /**
568
+ * Whether the renderer should render transparent render objects or not.
569
+ *
570
+ * @type {boolean}
571
+ * @default true
572
+ */
163
573
  transparent: boolean;
574
+ /**
575
+ * Whether the renderer should render opaque render objects or not.
576
+ *
577
+ * @type {boolean}
578
+ * @default true
579
+ */
164
580
  opaque: boolean;
581
+ /**
582
+ * Shadow map configuration
583
+ * @typedef {Object} ShadowMapConfig
584
+ * @property {boolean} enabled - Whether to globally enable shadows or not.
585
+ * @property {boolean} transmitted - Whether to enable light transmission through non-opaque materials.
586
+ * @property {number} type - The shadow map type.
587
+ */
588
+ /**
589
+ * The renderer's shadow configuration.
590
+ *
591
+ * @type {ShadowMapConfig}
592
+ */
165
593
  shadowMap: {
594
+ /**
595
+ * - Whether to globally enable shadows or not.
596
+ */
166
597
  enabled: boolean;
167
- type: ShadowMapType | null;
598
+ /**
599
+ * - Whether to enable light transmission through non-opaque materials.
600
+ */
601
+ transmitted: boolean;
602
+ /**
603
+ * - The shadow map type.
604
+ */
605
+ type: ShadowMapType;
168
606
  };
607
+ /**
608
+ * XR configuration.
609
+ * @typedef {Object} XRConfig
610
+ * @property {boolean} enabled - Whether to globally enable XR or not.
611
+ */
612
+ /**
613
+ * The renderer's XR manager.
614
+ *
615
+ * @type {XRManager}
616
+ */
169
617
  xr: XRManager;
618
+ /**
619
+ * Debug configuration.
620
+ * @typedef {Object} DebugConfig
621
+ * @property {boolean} checkShaderErrors - Whether shader errors should be checked or not.
622
+ * @property {?Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now.
623
+ * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object.
624
+ */
625
+ /**
626
+ * The renderer's debug configuration.
627
+ *
628
+ * @type {DebugConfig}
629
+ */
170
630
  debug: {
631
+ /**
632
+ * - Whether shader errors should be checked or not.
633
+ */
171
634
  checkShaderErrors: boolean;
635
+ /**
636
+ * - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now.
637
+ */
172
638
  onShaderError:
173
639
  | ((
174
640
  gl: WebGL2RenderingContext,
@@ -177,35 +643,14 @@ declare class Renderer {
177
643
  glFragmentShader: WebGLShader,
178
644
  ) => void)
179
645
  | null;
646
+ /**
647
+ * - Allows the get the raw shader code for the given scene, camera and 3D object.
648
+ */
180
649
  getShaderAsync: (scene: Scene, camera: Camera, object: Object3D) => Promise<{
181
650
  fragmentShader: string | null;
182
651
  vertexShader: string | null;
183
652
  }>;
184
653
  };
185
- localClippingEnabled?: boolean | undefined;
186
- /**
187
- * Renderer options.
188
- *
189
- * @typedef {Object} Renderer~Options
190
- * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
191
- * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
192
- * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not.
193
- * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
194
- * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
195
- * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
196
- * to overwrite the default.
197
- * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
198
- * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best
199
- * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
200
- * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
201
- */
202
- /**
203
- * Constructs a new renderer.
204
- *
205
- * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
206
- * @param {Renderer~Options} [parameters] - The configuration parameter.
207
- */
208
- constructor(backend: Backend, parameters?: RendererParameters);
209
654
  /**
210
655
  * Initializes the renderer so it is ready for usage.
211
656
  *
@@ -229,7 +674,7 @@ declare class Renderer {
229
674
  * @readonly
230
675
  * @type {number}
231
676
  */
232
- get coordinateSystem(): import("../../constants.js").CoordinateSystem;
677
+ get coordinateSystem(): CoordinateSystem;
233
678
  /**
234
679
  * Compiles all materials in the given scene. This can be useful to avoid a
235
680
  * phenomenon which is called "shader compilation stutter", which occurs when
@@ -295,13 +740,13 @@ declare class Renderer {
295
740
  * @param {MRTNode} mrt - The MRT node to set.
296
741
  * @return {Renderer} A reference to this renderer.
297
742
  */
298
- setMRT(mrt: MRTNode | null): this;
743
+ setMRT(mrt: MRTNode | null): Renderer;
299
744
  /**
300
745
  * Returns the MRT configuration.
301
746
  *
302
747
  * @return {MRTNode} The MRT configuration.
303
748
  */
304
- getMRT(): MRTNode | null;
749
+ getMRT(): MRTNode;
305
750
  /**
306
751
  * Returns the output buffer type.
307
752
  *
@@ -321,7 +766,7 @@ declare class Renderer {
321
766
  * @private
322
767
  * @param {Object} info - Information about the context lost.
323
768
  */
324
- _onDeviceLost(info: DeviceLostInfo): void;
769
+ private _onDeviceLost;
325
770
  /**
326
771
  * Renders the given render bundle.
327
772
  *
@@ -330,7 +775,7 @@ declare class Renderer {
330
775
  * @param {Scene} sceneRef - The scene the render bundle belongs to.
331
776
  * @param {LightsNode} lightsNode - The lights node.
332
777
  */
333
- _renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void;
778
+ private _renderBundle;
334
779
  /**
335
780
  * Renders the scene or 3D object with the given camera. This method can only be called
336
781
  * if the renderer has been initialized. When using `render()` inside an animation loop,
@@ -362,7 +807,7 @@ declare class Renderer {
362
807
  * @private
363
808
  * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied.
364
809
  */
365
- _getFrameBufferTarget(): RenderTarget<Texture<unknown>> | null;
810
+ private _getFrameBufferTarget;
366
811
  /**
367
812
  * Renders the scene or 3D object with the given camera.
368
813
  *
@@ -372,7 +817,7 @@ declare class Renderer {
372
817
  * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
373
818
  * @return {RenderContext} The current render context.
374
819
  */
375
- _renderScene(scene: Object3D, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
820
+ private _renderScene;
376
821
  _setXRLayerSize(width: number, height: number): void;
377
822
  /**
378
823
  * The output pass performs tone mapping and color space conversion.
@@ -380,7 +825,7 @@ declare class Renderer {
380
825
  * @private
381
826
  * @param {RenderTarget} renderTarget - The current render target.
382
827
  */
383
- _renderOutput(renderTarget: RenderTarget): void;
828
+ private _renderOutput;
384
829
  /**
385
830
  * Returns the maximum available anisotropy for texture filtering.
386
831
  *
@@ -429,7 +874,7 @@ declare class Renderer {
429
874
  *
430
875
  * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context.
431
876
  */
432
- getContext(): void;
877
+ getContext(): unknown;
433
878
  /**
434
879
  * Returns the pixel ratio.
435
880
  *
@@ -499,16 +944,18 @@ declare class Renderer {
499
944
  * @return {Vector4} The scissor rectangle.
500
945
  */
501
946
  getScissor(target: Vector4): Vector4;
947
+ /**
948
+ * Defines the scissor rectangle.
949
+ */
950
+ setScissor(x: Vector4): void;
502
951
  /**
503
952
  * Defines the scissor rectangle.
504
953
  *
505
- * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit.
506
- * Instead of passing four arguments, the method also works with a single four-dimensional vector.
954
+ * @param {number} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit.
507
955
  * @param {number} y - The vertical coordinate for the upper left corner of the box in logical pixel unit.
508
956
  * @param {number} width - The width of the scissor box in logical pixel unit.
509
957
  * @param {number} height - The height of the scissor box in logical pixel unit.
510
958
  */
511
- setScissor(x: Vector4): void;
512
959
  setScissor(x: number, y: number, width: number, height: number): void;
513
960
  /**
514
961
  * Returns the scissor test value.
@@ -529,17 +976,20 @@ declare class Renderer {
529
976
  * @return {Vector4} The viewport definition.
530
977
  */
531
978
  getViewport(target: Vector4): Vector4;
979
+ /**
980
+ * Defines the viewport.
981
+ */
982
+ setViewport(x: Vector4): void;
532
983
  /**
533
984
  * Defines the viewport.
534
985
  *
535
- * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit.
986
+ * @param {number} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit.
536
987
  * @param {number} y - The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit.
537
988
  * @param {number} width - The width of the viewport in logical pixel unit.
538
989
  * @param {number} height - The height of the viewport in logical pixel unit.
539
990
  * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only.
540
991
  * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only.
541
992
  */
542
- setViewport(x: Vector4): void;
543
993
  setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void;
544
994
  /**
545
995
  * Returns the clear color.
@@ -599,7 +1049,7 @@ declare class Renderer {
599
1049
  * @param {Object3D} object - The 3D object to test.
600
1050
  * @return {boolean} Whether the 3D object is fully occluded or not.
601
1051
  */
602
- isOccluded(object: Object3D): boolean | null;
1052
+ isOccluded(object: Object3D): boolean;
603
1053
  /**
604
1054
  * Performs a manual clear operation. This method ignores `autoClear` properties.
605
1055
  *
@@ -723,7 +1173,7 @@ declare class Renderer {
723
1173
  *
724
1174
  * @param {Object} renderTarget - The render target to set as the output target.
725
1175
  */
726
- setOutputRenderTarget(renderTarget: RenderTarget | null): void;
1176
+ setOutputRenderTarget(renderTarget: RenderTarget): void;
727
1177
  /**
728
1178
  * Returns the current output target.
729
1179
  *
@@ -748,7 +1198,7 @@ declare class Renderer {
748
1198
  *
749
1199
  * @private
750
1200
  */
751
- _resetXRState(): void;
1201
+ private _resetXRState;
752
1202
  /**
753
1203
  * Callback for {@link Renderer#setRenderObjectFunction}.
754
1204
  *
@@ -782,8 +1232,10 @@ declare class Renderer {
782
1232
  camera: Camera,
783
1233
  geometry: BufferGeometry,
784
1234
  material: Material,
785
- group: GeometryGroup,
1235
+ group: GeometryGroup | null,
786
1236
  lightsNode: LightsNode,
1237
+ clippingContext: ClippingContext,
1238
+ passId?: string | null | undefined,
787
1239
  ) => void)
788
1240
  | null,
789
1241
  ): void;
@@ -799,10 +1251,10 @@ declare class Renderer {
799
1251
  camera: Camera,
800
1252
  geometry: BufferGeometry,
801
1253
  material: Material,
802
- group: GeometryGroup,
1254
+ group: GeometryGroup | null,
803
1255
  lightsNode: LightsNode,
804
- clippingContext: ClippingContext | null,
805
- passId: string | null,
1256
+ clippingContext: ClippingContext,
1257
+ passId?: string | null | undefined,
806
1258
  ) => void)
807
1259
  | null;
808
1260
  /**
@@ -818,7 +1270,7 @@ declare class Renderer {
818
1270
  */
819
1271
  compute(
820
1272
  computeNodes: ComputeNode | ComputeNode[],
821
- dispatchSize?: number[] | number | IndirectStorageBufferAttribute | null,
1273
+ dispatchSize?: number | number[] | IndirectStorageBufferAttribute,
822
1274
  ): Promise<void> | undefined;
823
1275
  /**
824
1276
  * Execute a single or an array of compute nodes.
@@ -833,7 +1285,7 @@ declare class Renderer {
833
1285
  */
834
1286
  computeAsync(
835
1287
  computeNodes: ComputeNode | ComputeNode[],
836
- dispatchSize?: number[] | number | IndirectStorageBufferAttribute | null,
1288
+ dispatchSize?: number | number[] | IndirectStorageBufferAttribute,
837
1289
  ): Promise<void>;
838
1290
  /**
839
1291
  * Checks if the given feature is supported by the selected backend.
@@ -843,7 +1295,7 @@ declare class Renderer {
843
1295
  * @param {string} name - The feature's name.
844
1296
  * @return {Promise<boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
845
1297
  */
846
- hasFeatureAsync(name: string): Promise<void>;
1298
+ hasFeatureAsync(name: string): Promise<boolean>;
847
1299
  resolveTimestampsAsync(type?: TimestampQuery): Promise<number | undefined>;
848
1300
  /**
849
1301
  * Checks if the given feature is supported by the selected backend. If the
@@ -852,7 +1304,7 @@ declare class Renderer {
852
1304
  * @param {string} name - The feature's name.
853
1305
  * @return {boolean} Whether the feature is supported or not.
854
1306
  */
855
- hasFeature(name: string): void;
1307
+ hasFeature(name: string): boolean;
856
1308
  /**
857
1309
  * Returns `true` when the renderer has been initialized.
858
1310
  *
@@ -878,13 +1330,19 @@ declare class Renderer {
878
1330
  * @param {Texture} texture - The texture.
879
1331
  */
880
1332
  initTexture(texture: Texture): void;
1333
+ /**
1334
+ * Initializes the given render target.
1335
+ *
1336
+ * @param {RenderTarget} renderTarget - The render target to intialize.
1337
+ */
1338
+ initRenderTarget(renderTarget: RenderTarget): void;
881
1339
  /**
882
1340
  * Copies the current bound framebuffer into the given texture.
883
1341
  *
884
1342
  * @param {FramebufferTexture} framebufferTexture - The texture.
885
1343
  * @param {?(Vector2|Vector4)} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.
886
1344
  */
887
- copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
1345
+ copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: (Vector2 | Vector4) | null): void;
888
1346
  /**
889
1347
  * Copies data of the given source texture into a destination texture.
890
1348
  *
@@ -924,7 +1382,7 @@ declare class Renderer {
924
1382
  height: number,
925
1383
  textureIndex?: number,
926
1384
  faceIndex?: number,
927
- ): Promise<import("../../core/BufferAttribute.js").TypedArray>;
1385
+ ): Promise<TypedArray>;
928
1386
  /**
929
1387
  * Analyzes the given 3D object's hierarchy and builds render lists from the
930
1388
  * processed hierarchy.
@@ -936,13 +1394,7 @@ declare class Renderer {
936
1394
  * @param {RenderList} renderList - The current render list.
937
1395
  * @param {ClippingContext} clippingContext - The current clipping context.
938
1396
  */
939
- _projectObject(
940
- object: Object3D,
941
- camera: Camera,
942
- groupOrder: number,
943
- renderList: RenderList,
944
- clippingContext: ClippingContext | null,
945
- ): void;
1397
+ private _projectObject;
946
1398
  /**
947
1399
  * Renders the given render bundles.
948
1400
  *
@@ -951,7 +1403,7 @@ declare class Renderer {
951
1403
  * @param {Scene} sceneRef - The scene the render bundles belong to.
952
1404
  * @param {LightsNode} lightsNode - The current lights node.
953
1405
  */
954
- _renderBundles(bundles: Bundle[], sceneRef: Scene, lightsNode: LightsNode): void;
1406
+ private _renderBundles;
955
1407
  /**
956
1408
  * Renders the transparent objects from the given render lists.
957
1409
  *
@@ -962,13 +1414,7 @@ declare class Renderer {
962
1414
  * @param {Scene} scene - The scene the render list belongs to.
963
1415
  * @param {LightsNode} lightsNode - The current lights node.
964
1416
  */
965
- _renderTransparents(
966
- renderList: RenderItem[],
967
- doublePassList: RenderItem[],
968
- camera: Camera,
969
- scene: Scene,
970
- lightsNode: LightsNode,
971
- ): void;
1417
+ private _renderTransparents;
972
1418
  /**
973
1419
  * Renders the objects from the given render list.
974
1420
  *
@@ -979,13 +1425,7 @@ declare class Renderer {
979
1425
  * @param {LightsNode} lightsNode - The current lights node.
980
1426
  * @param {?string} [passId=null] - An optional ID for identifying the pass.
981
1427
  */
982
- _renderObjects(
983
- renderList: RenderItem[],
984
- camera: Camera,
985
- scene: Scene,
986
- lightsNode: LightsNode,
987
- passId?: string | null,
988
- ): void;
1428
+ private _renderObjects;
989
1429
  /**
990
1430
  * Retrieves shadow nodes for the given material. This is used to setup shadow passes.
991
1431
  * The result is cached per material and updated when the material's version changes.
@@ -994,7 +1434,7 @@ declare class Renderer {
994
1434
  * @param {Material} material
995
1435
  * @returns {Object} - The shadow nodes for the material.
996
1436
  */
997
- _getShadowNodes(material: Material): any;
1437
+ private _getShadowNodes;
998
1438
  /**
999
1439
  * This method represents the default render object function that manages the render lifecycle
1000
1440
  * of the object.
@@ -1015,11 +1455,19 @@ declare class Renderer {
1015
1455
  camera: Camera,
1016
1456
  geometry: BufferGeometry,
1017
1457
  material: Material,
1018
- group: GeometryGroup,
1458
+ group: GeometryGroup | null,
1019
1459
  lightsNode: LightsNode,
1020
1460
  clippingContext?: ClippingContext | null,
1021
1461
  passId?: string | null,
1022
1462
  ): void;
1463
+ /**
1464
+ * Checks if the given compatibility is supported by the selected backend. If the
1465
+ * renderer has not been initialized, this method always returns `false`.
1466
+ *
1467
+ * @param {string} name - The compatibility's name.
1468
+ * @return {boolean} Whether the compatibility is supported or not.
1469
+ */
1470
+ hasCompatibility(name: string): boolean;
1023
1471
  /**
1024
1472
  * This method represents the default `_handleObjectFunction` implementation which creates
1025
1473
  * a render object from the given data and performs the draw command with the selected backend.
@@ -1034,16 +1482,7 @@ declare class Renderer {
1034
1482
  * @param {ClippingContext} clippingContext - The clipping context.
1035
1483
  * @param {string} [passId] - An optional ID for identifying the pass.
1036
1484
  */
1037
- _renderObjectDirect(
1038
- object: Object3D,
1039
- material: Material,
1040
- scene: Scene,
1041
- camera: Camera,
1042
- lightsNode: LightsNode,
1043
- group: GeometryGroup,
1044
- clippingContext: ClippingContext | null,
1045
- passId?: string,
1046
- ): void;
1485
+ private _renderObjectDirect;
1047
1486
  /**
1048
1487
  * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering.
1049
1488
  * Used in `compileAsync()`.
@@ -1058,22 +1497,7 @@ declare class Renderer {
1058
1497
  * @param {ClippingContext} clippingContext - The clipping context.
1059
1498
  * @param {string} [passId] - An optional ID for identifying the pass.
1060
1499
  */
1061
- _createObjectPipeline(
1062
- object: Object3D,
1063
- material: Material,
1064
- scene: Scene,
1065
- camera: Camera,
1066
- lightsNode: LightsNode,
1067
- group: Group,
1068
- clippingContext: ClippingContext | null,
1069
- passId?: string,
1070
- ): void;
1071
- /**
1072
- * Callback when the canvas has been resized.
1073
- *
1074
- * @private
1075
- */
1076
- _onCanvasTargetResize(): void;
1500
+ private _createObjectPipeline;
1077
1501
  /**
1078
1502
  * Alias for `compileAsync()`.
1079
1503
  *
@@ -1085,11 +1509,5 @@ declare class Renderer {
1085
1509
  */
1086
1510
  get compile(): (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise<void>;
1087
1511
  }
1088
- /**
1089
- * Animation loop parameter of `renderer.setAnimationLoop()`.
1090
- *
1091
- * @callback onAnimationCallback
1092
- * @param {DOMHighResTimeStamp} time - A timestamp indicating the end time of the previous frame's rendering.
1093
- * @param {XRFrame} [frame] - A reference to the current XR frame. Only relevant when using XR rendering.
1094
- */
1512
+
1095
1513
  export default Renderer;