@types/three 0.171.0 → 0.172.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 (121) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -5
  3. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  5. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
  6. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +13 -0
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  9. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  10. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  11. three/examples/jsm/objects/InstancedPoints.d.ts +10 -0
  12. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  13. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  14. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  15. three/package.json +2 -2
  16. three/src/Three.Core.d.ts +2 -1
  17. three/src/Three.TSL.d.ts +9 -4
  18. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  19. three/src/Three.WebGPU.d.ts +2 -2
  20. three/src/cameras/CubeCamera.d.ts +19 -2
  21. three/src/core/RenderTarget.d.ts +3 -5
  22. three/src/core/RenderTarget3D.d.ts +9 -0
  23. three/src/core/RenderTargetArray.d.ts +9 -0
  24. three/src/materials/Material.d.ts +3 -1
  25. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  26. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  27. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  28. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  29. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  30. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +56 -0
  31. three/src/nodes/Nodes.d.ts +1 -6
  32. three/src/nodes/TSL.d.ts +2 -3
  33. three/src/nodes/accessors/Arrays.d.ts +3 -2
  34. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  35. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  36. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  37. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  38. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  39. three/src/nodes/accessors/StorageBufferNode.d.ts +5 -1
  40. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  41. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  42. three/src/nodes/core/Node.d.ts +237 -0
  43. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  44. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  45. three/src/nodes/core/NodeCache.d.ts +21 -0
  46. three/src/nodes/core/NodeParser.d.ts +11 -0
  47. three/src/nodes/core/NodeUniform.d.ts +28 -0
  48. three/src/nodes/core/NodeVar.d.ts +12 -0
  49. three/src/nodes/core/NodeVarying.d.ts +14 -0
  50. three/src/nodes/core/StructTypeNode.d.ts +19 -1
  51. three/src/nodes/core/UniformNode.d.ts +44 -0
  52. three/src/nodes/core/VaryingNode.d.ts +3 -0
  53. three/src/nodes/core/constants.d.ts +35 -0
  54. three/src/nodes/display/PassNode.d.ts +1 -1
  55. three/src/nodes/fog/Fog.d.ts +26 -0
  56. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  57. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  58. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  59. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  60. three/src/nodes/math/MathNode.d.ts +13 -4
  61. three/src/nodes/tsl/TSLCore.d.ts +48 -16
  62. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  63. three/src/nodes/utils/LoopNode.d.ts +23 -2
  64. three/src/objects/ClippingGroup.d.ts +1 -1
  65. three/src/renderers/WebGLRenderer.d.ts +8 -8
  66. three/src/renderers/common/Animation.d.ts +30 -0
  67. three/src/renderers/common/Attributes.d.ts +31 -0
  68. three/src/renderers/common/Backend.d.ts +11 -0
  69. three/src/renderers/common/Background.d.ts +22 -0
  70. three/src/renderers/common/BindGroup.d.ts +15 -0
  71. three/src/renderers/common/Binding.d.ts +24 -0
  72. three/src/renderers/common/Bindings.d.ts +54 -0
  73. three/src/renderers/common/Buffer.d.ts +31 -0
  74. three/src/renderers/common/BufferUtils.d.ts +26 -0
  75. three/src/renderers/common/BundleGroup.d.ts +22 -0
  76. three/src/renderers/common/ChainMap.d.ts +31 -1
  77. three/src/renderers/common/ClippingContext.d.ts +45 -0
  78. three/src/renderers/common/Color4.d.ts +36 -0
  79. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  80. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  81. three/src/renderers/common/DataMap.d.ts +30 -0
  82. three/src/renderers/common/Geometries.d.ts +52 -0
  83. three/src/renderers/common/Info.d.ts +27 -0
  84. three/src/renderers/common/Pipeline.d.ts +11 -0
  85. three/src/renderers/common/Pipelines.d.ts +104 -0
  86. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  87. three/src/renderers/common/RenderBundle.d.ts +15 -4
  88. three/src/renderers/common/RenderBundles.d.ts +20 -2
  89. three/src/renderers/common/RenderContext.d.ts +22 -0
  90. three/src/renderers/common/RenderContexts.d.ts +42 -3
  91. three/src/renderers/common/RenderList.d.ts +85 -0
  92. three/src/renderers/common/RenderLists.d.ts +21 -0
  93. three/src/renderers/common/RenderObject.d.ts +152 -1
  94. three/src/renderers/common/RenderObjects.d.ts +53 -0
  95. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  96. three/src/renderers/common/Renderer.d.ts +583 -6
  97. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  98. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  99. three/src/renderers/common/Textures.d.ts +66 -0
  100. three/src/renderers/common/Uniform.d.ts +106 -0
  101. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  102. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  103. three/src/renderers/common/nodes/NodeBuilderState.d.ts +30 -0
  104. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  105. three/src/renderers/common/nodes/NodeUniform.d.ts +154 -0
  106. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  107. three/src/renderers/common/nodes/Nodes.d.ts +185 -11
  108. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  109. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  110. three/src/textures/DataTexture.d.ts +2 -2
  111. three/src/textures/Texture.d.ts +3 -0
  112. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  113. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  114. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  115. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  116. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  117. three/src/Three.Legacy.d.ts +0 -20
  118. three/src/nodes/core/UniformGroup.d.ts +0 -7
  119. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  120. three/src/nodes/fog/FogNode.d.ts +0 -20
  121. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -6,13 +6,13 @@ import { Object3D } from "../../core/Object3D.js";
6
6
  import { RenderTarget } from "../../core/RenderTarget.js";
7
7
  import { Material } from "../../materials/Material.js";
8
8
  import { Box2 } from "../../math/Box2.js";
9
- import { Color } from "../../math/Color.js";
10
- import { Plane } from "../../math/Plane.js";
9
+ import { ColorRepresentation } from "../../math/Color.js";
11
10
  import { Vector2 } from "../../math/Vector2.js";
12
11
  import { Vector4 } from "../../math/Vector4.js";
13
12
  import MRTNode from "../../nodes/core/MRTNode.js";
14
13
  import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
15
14
  import LightsNode from "../../nodes/lighting/LightsNode.js";
15
+ import { Group } from "../../objects/Group.js";
16
16
  import { Scene } from "../../scenes/Scene.js";
17
17
  import { FramebufferTexture } from "../../textures/FramebufferTexture.js";
18
18
  import { Texture } from "../../textures/Texture.js";
@@ -59,6 +59,9 @@ export interface RendererParameters {
59
59
  samples?: number | undefined;
60
60
  getFallback?: ((error: unknown) => Backend) | null | undefined;
61
61
  }
62
+ /**
63
+ * Base class for renderers.
64
+ */
62
65
  declare class Renderer {
63
66
  readonly isRenderer: true;
64
67
  domElement: HTMLCanvasElement;
@@ -76,7 +79,6 @@ declare class Renderer {
76
79
  sortObjects: boolean;
77
80
  depth: boolean;
78
81
  stencil: boolean;
79
- clippingPlanes: readonly Plane[];
80
82
  info: Info;
81
83
  library: NodeLibrary;
82
84
  lighting: Lighting;
@@ -173,63 +175,466 @@ declare class Renderer {
173
175
  }>;
174
176
  };
175
177
  localClippingEnabled?: boolean | undefined;
178
+ /**
179
+ * Constructs a new renderer.
180
+ *
181
+ * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2).
182
+ * @param {Object} parameters - The configuration parameter.
183
+ * @param {Boolean} [parameters.logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
184
+ * @param {Boolean} [parameters.alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
185
+ * @param {Boolean} [parameters.depth=true] - Whether the default framebuffer should have a depth buffer or not.
186
+ * @param {Boolean} [parameters.stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
187
+ * @param {Boolean} [parameters.antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
188
+ * @param {Number} [parameters.samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0
189
+ * to overwrite the default.
190
+ * @param {Function?} [parameters.getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
191
+ */
176
192
  constructor(backend: Backend, parameters?: RendererParameters);
193
+ /**
194
+ * Initializes the renderer so it is ready for usage.
195
+ *
196
+ * @async
197
+ * @return {Promise} A Promise that resolves when the renderer has been initialized.
198
+ */
177
199
  init(): Promise<void>;
200
+ /**
201
+ * The coordinate system of the renderer. The value of this property
202
+ * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or
203
+ * `THREE.WebGPUCoordinateSystem`.
204
+ *
205
+ * @readonly
206
+ * @type {Number}
207
+ */
178
208
  get coordinateSystem(): import("../../constants.js").CoordinateSystem;
209
+ /**
210
+ * Compiles all materials in the given scene. This can be useful to avoid a
211
+ * phenomenon which is called "shader compilation stutter", which occurs when
212
+ * rendering an object with a new shader for the first time.
213
+ *
214
+ * If you want to add a 3D object to an existing scene, use the third optional
215
+ * parameter for applying the target scene. Note that the (target) scene's lighting
216
+ * and environment must be configured before calling this method.
217
+ *
218
+ * @async
219
+ * @param {Object3D} scene - The scene or 3D object to precompile.
220
+ * @param {Camera} camera - The camera that is used to render the scene.
221
+ * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.
222
+ * @return {Promise} A Promise that resolves when the compile has been finished.
223
+ */
179
224
  compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
225
+ /**
226
+ * Renders the scene in an async fashion.
227
+ *
228
+ * @async
229
+ * @param {Object3D} scene - The scene or 3D object to render.
230
+ * @param {Camera} camera - The camera.
231
+ * @return {Promise} A Promise that resolves when the render has been finished.
232
+ */
180
233
  renderAsync(scene: Scene, camera: Camera): Promise<void>;
234
+ /**
235
+ * Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
236
+ * the CPU waits for the GPU to complete its operation (e.g. a compute task).
237
+ *
238
+ * @async
239
+ * @return {Promise} A Promise that resolves when synchronization has been finished.
240
+ */
181
241
  waitForGPU(): Promise<void>;
242
+ /**
243
+ * Sets the given MRT configuration.
244
+ *
245
+ * @param {MRTNode} mrt - The MRT node to set.
246
+ * @return {Renderer} A reference to this renderer.
247
+ */
182
248
  setMRT(mrt: MRTNode | null): this;
249
+ /**
250
+ * Returns the MRT configuration.
251
+ *
252
+ * @return {MRTNode} The MRT configuration.
253
+ */
183
254
  getMRT(): MRTNode | null;
255
+ /**
256
+ * Default implementation of the device lost callback.
257
+ *
258
+ * @private
259
+ * @param {Object} info - Information about the context lost.
260
+ */
184
261
  _onDeviceLost(info: DeviceLostInfo): void;
262
+ /**
263
+ * Renders the given render bundle.
264
+ *
265
+ * @private
266
+ * @param {Object} bundle - Render bundle data.
267
+ * @param {Scene} sceneRef - The scene the render bundle belongs to.
268
+ * @param {LightsNode} lightsNode - The current lights node.
269
+ */
185
270
  _renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void;
271
+ /**
272
+ * Renders the scene or 3D object with the given camera. This method can only be called
273
+ * if the renderer has been initialized.
274
+ *
275
+ * The target of the method is the default framebuffer (meaning the canvas)
276
+ * or alternatively a render target when specified via `setRenderTarget()`.
277
+ *
278
+ * @param {Object3D} scene - The scene or 3D object to render.
279
+ * @param {Camera} camera - The camera to render the scene with.
280
+ * @return {Promise?} A Promise that resolve when the scene has been rendered.
281
+ * Only returned when the renderer has not been initialized.
282
+ */
186
283
  render(scene: Scene, camera: Camera): Promise<void> | undefined;
284
+ /**
285
+ * Returns an internal render target which is used when computing the output tone mapping
286
+ * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render
287
+ * pass and not inline to achieve more correct results.
288
+ *
289
+ * @private
290
+ * @return {RenderTarget?} The render target. The method returns `null` if no output conversion should be applied.
291
+ */
187
292
  _getFrameBufferTarget(): RenderTarget<Texture> | null;
293
+ /**
294
+ * Renders the scene or 3D object with the given camera.
295
+ *
296
+ * @private
297
+ * @param {Object3D} scene - The scene or 3D object to render.
298
+ * @param {Camera} camera - The camera to render the scene with.
299
+ * @param {Boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
300
+ * @return {RenderContext} The current render context.
301
+ */
188
302
  _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
303
+ /**
304
+ * Returns the maximum available anisotropy for texture filtering.
305
+ *
306
+ * @return {Number} The maximum available anisotropy.
307
+ */
189
308
  getMaxAnisotropy(): number;
309
+ /**
310
+ * Returns the active cube face.
311
+ *
312
+ * @return {Number} The active cube face.
313
+ */
190
314
  getActiveCubeFace(): number;
315
+ /**
316
+ * Returns the active mipmap level.
317
+ *
318
+ * @return {Number} The active mipmap level.
319
+ */
191
320
  getActiveMipmapLevel(): number;
321
+ /**
322
+ * Applications are advised to always define the animation loop
323
+ * with this method and not manually with `requestAnimationFrame()`
324
+ * for best compatibility.
325
+ *
326
+ * @async
327
+ * @param {Function} callback - The application's animation loop.
328
+ * @return {Promise} A Promise that resolves when the set has been exeucted.
329
+ */
192
330
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise<void>;
331
+ /**
332
+ * Can be used to transfer buffer data from a storage buffer attribute
333
+ * from the GPU to the CPU in context of compute shaders.
334
+ *
335
+ * @async
336
+ * @param {StorageBufferAttribute} attribute - The storage buffer attribute.
337
+ * @return {Promise<ArrayBuffer>} A promise that resolves with the buffer data when the data are ready.
338
+ */
193
339
  getArrayBufferAsync(attribute: BufferAttribute): Promise<ArrayBuffer>;
340
+ /**
341
+ * Returns the rendering context.
342
+ *
343
+ * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context.
344
+ */
194
345
  getContext(): void;
346
+ /**
347
+ * Returns the pixel ratio.
348
+ *
349
+ * @return {Number} The pixel ratio.
350
+ */
195
351
  getPixelRatio(): number;
352
+ /**
353
+ * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.
354
+ *
355
+ * @param {Vector2} target - The method writes the result in this target object.
356
+ * @return {Vector2} The drawing buffer size.
357
+ */
196
358
  getDrawingBufferSize(target: Vector2): Vector2;
359
+ /**
360
+ * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
361
+ *
362
+ * @param {Vector2} target - The method writes the result in this target object.
363
+ * @return {Vector2} The drawing buffer size.
364
+ */
197
365
  getSize(target: Vector2): Vector2;
366
+ /**
367
+ * Sets the given pixel ration and resizes the canvas if necessary.
368
+ *
369
+ * @param {Number} [value=1] - The pixel ratio.
370
+ */
198
371
  setPixelRatio(value?: number): void;
372
+ /**
373
+ * This method allows to define the drawing buffer size by specifying
374
+ * width, height and pixel ratio all at once. The size of the drawing
375
+ * buffer is computed with this formula:
376
+ * ````
377
+ * size.x = width * pixelRatio;
378
+ * size.y = height * pixelRatio;
379
+ * ```
380
+ *
381
+ * @param {Number} width - The width in logical pixels.
382
+ * @param {Number} height - The height in logical pixels.
383
+ * @param {Number} pixelRatio - The pixel ratio.
384
+ */
199
385
  setDrawingBufferSize(width: number, height: number, pixelRatio: number): void;
386
+ /**
387
+ * Sets the size of the renderer.
388
+ *
389
+ * @param {Number} width - The width in logical pixels.
390
+ * @param {Number} height - The height in logical pixels.
391
+ * @param {Boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
392
+ */
200
393
  setSize(width: number, height: number, updateStyle?: boolean): void;
394
+ /**
395
+ * Defines a manual sort function for the opaque render list.
396
+ * Pass `null` to use the default sort.
397
+ *
398
+ * @param {Function} method - The sort function.
399
+ */
201
400
  setOpaqueSort(method: ((a: RenderItem, b: RenderItem) => number) | null): void;
401
+ /**
402
+ * Defines a manual sort function for the transparent render list.
403
+ * Pass `null` to use the default sort.
404
+ *
405
+ * @param {Function} method - The sort function.
406
+ */
202
407
  setTransparentSort(method: ((a: RenderItem, b: RenderItem) => number) | null): void;
408
+ /**
409
+ * Returns the scissor rectangle.
410
+ *
411
+ * @param {Vector4} target - The method writes the result in this target object.
412
+ * @return {Vector4} The scissor rectangle.
413
+ */
203
414
  getScissor(target: Vector4): Vector4;
415
+ /**
416
+ * Defines the scissor rectangle.
417
+ *
418
+ * @param {Number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit.
419
+ * Instead of passing four arguments, the method also works with a single four-dimensional vector.
420
+ * @param {Number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit.
421
+ * @param {Number} width - The width of the scissor box in logical pixel unit.
422
+ * @param {Number} height - The height of the scissor box in logical pixel unit.
423
+ */
204
424
  setScissor(x: Vector4): void;
205
425
  setScissor(x: number, y: number, width: number, height: number): void;
426
+ /**
427
+ * Returns the scissor test value.
428
+ *
429
+ * @return {Boolean} Whether the scissor test should be enabled or not.
430
+ */
206
431
  getScissorTest(): boolean;
432
+ /**
433
+ * Defines the scissor test.
434
+ *
435
+ * @param {Boolean} boolean - Whether the scissor test should be enabled or not.
436
+ */
207
437
  setScissorTest(boolean: boolean): void;
438
+ /**
439
+ * Returns the viewport definition.
440
+ *
441
+ * @param {Vector4} target - The method writes the result in this target object.
442
+ * @return {Vector4} The viewport definition.
443
+ */
208
444
  getViewport(target: Vector4): Vector4;
445
+ /**
446
+ * Defines the viewport.
447
+ *
448
+ * @param {Number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
449
+ * @param {Number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
450
+ * @param {Number} width - The width of the viewport in logical pixel unit.
451
+ * @param {Number} height - The height of the viewport in logical pixel unit.
452
+ * @param {Number} minDepth - The minimum depth value of the viewport. WebGPU only.
453
+ * @param {Number} maxDepth - The maximum depth value of the viewport. WebGPU only.
454
+ */
209
455
  setViewport(x: Vector4): void;
210
456
  setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void;
457
+ /**
458
+ * Returns the clear color.
459
+ *
460
+ * @param {Color} target - The method writes the result in this target object.
461
+ * @return {Color} The clear color.
462
+ */
211
463
  getClearColor(target: Color4): Color4;
212
- setClearColor(color: Color, alpha?: number): void;
464
+ /**
465
+ * Defines the clear color and optionally the clear alpha.
466
+ *
467
+ * @param {Color} color - The clear color.
468
+ * @param {Number} [alpha=1] - The clear alpha.
469
+ */
470
+ setClearColor(color: ColorRepresentation, alpha?: number): void;
471
+ /**
472
+ * Returns the clear alpha.
473
+ *
474
+ * @return {Number} The clear alpha.
475
+ */
213
476
  getClearAlpha(): number;
477
+ /**
478
+ * Defines the clear alpha.
479
+ *
480
+ * @param {Number} alpha - The clear alpha.
481
+ */
214
482
  setClearAlpha(alpha: number): void;
483
+ /**
484
+ * Returns the clear depth.
485
+ *
486
+ * @return {Number} The clear depth.
487
+ */
215
488
  getClearDepth(): number;
489
+ /**
490
+ * Defines the clear depth.
491
+ *
492
+ * @param {Number} depth - The clear depth.
493
+ */
216
494
  setClearDepth(depth: number): void;
495
+ /**
496
+ * Returns the clear stencil.
497
+ *
498
+ * @return {Number} The clear stencil.
499
+ */
217
500
  getClearStencil(): number;
501
+ /**
502
+ * Defines the clear stencil.
503
+ *
504
+ * @param {Number} stencil - The clear stencil.
505
+ */
218
506
  setClearStencil(stencil: number): void;
507
+ /**
508
+ * This method performs an occlusion query for the given 3D object.
509
+ * It returns `true` if the given 3D object is fully occluded by other
510
+ * 3D objects in the scene.
511
+ *
512
+ * @param {Object3D} object - The 3D object to test.
513
+ * @return {Boolean} Whether the 3D object is fully occluded or not.
514
+ */
219
515
  isOccluded(object: Object3D): boolean | null;
516
+ /**
517
+ * Performs a manual clear operation. This method ignores `autoClear` properties.
518
+ *
519
+ * @param {Boolean} [color=true] - Whether the color buffer should be cleared or not.
520
+ * @param {Boolean} [depth=true] - Whether the depth buffer should be cleared or not.
521
+ * @param {Boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
522
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
523
+ * Only returned when the renderer has not been initialized.
524
+ */
220
525
  clear(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void> | undefined;
526
+ /**
527
+ * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties.
528
+ *
529
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
530
+ * Only returned when the renderer has not been initialized.
531
+ */
221
532
  clearColor(): Promise<void> | undefined;
533
+ /**
534
+ * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties.
535
+ *
536
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
537
+ * Only returned when the renderer has not been initialized.
538
+ */
222
539
  clearDepth(): Promise<void> | undefined;
540
+ /**
541
+ * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties.
542
+ *
543
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
544
+ * Only returned when the renderer has not been initialized.
545
+ */
223
546
  clearStencil(): Promise<void> | undefined;
547
+ /**
548
+ * Async version of {@link module:Renderer~Renderer#clear}.
549
+ *
550
+ * @async
551
+ * @param {Boolean} [color=true] - Whether the color buffer should be cleared or not.
552
+ * @param {Boolean} [depth=true] - Whether the depth buffer should be cleared or not.
553
+ * @param {Boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
554
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
555
+ */
224
556
  clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise<void>;
557
+ /**
558
+ * Async version of {@link module:Renderer~Renderer#clearColor}.
559
+ *
560
+ * @async
561
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
562
+ */
225
563
  clearColorAsync(): Promise<void>;
564
+ /**
565
+ * Async version of {@link module:Renderer~Renderer#clearDepth}.
566
+ *
567
+ * @async
568
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
569
+ */
226
570
  clearDepthAsync(): Promise<void>;
571
+ /**
572
+ * Async version of {@link module:Renderer~Renderer#clearStencil}.
573
+ *
574
+ * @async
575
+ * @return {Promise} A Promise that resolves when the clear operation has been executed.
576
+ */
227
577
  clearStencilAsync(): Promise<void>;
578
+ /**
579
+ * The current output tone mapping of the renderer. When a render target is set,
580
+ * the output tone mapping is always `NoToneMapping`.
581
+ *
582
+ * @type {Number}
583
+ */
228
584
  get currentToneMapping(): ToneMapping;
585
+ /**
586
+ * The current output color space of the renderer. When a render target is set,
587
+ * the output color space is always `LinearSRGBColorSpace`.
588
+ *
589
+ * @type {String}
590
+ */
229
591
  get currentColorSpace(): string;
592
+ /**
593
+ * Frees all internal resources of the renderer. Call this method if the renderer
594
+ * is no longer in use by your app.
595
+ */
230
596
  dispose(): void;
597
+ /**
598
+ * Sets the given render target. Calling this method means the renderer does not
599
+ * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.
600
+ * Use `null` as the first argument to reset the state.
601
+ *
602
+ * @param {RenderTarget?} renderTarget - The render target to set.
603
+ * @param {Number} [activeCubeFace=0] - The active cube face.
604
+ * @param {Number} [activeMipmapLevel=0] - The active mipmap level.
605
+ */
231
606
  setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void;
607
+ /**
608
+ * Returns the current render target.
609
+ *
610
+ * @return {RenderTarget?} The render target. Returns `null` if no render target is set.
611
+ */
232
612
  getRenderTarget(): RenderTarget<Texture> | null;
613
+ /**
614
+ * Callback for {@link module:Renderer~Renderer#setRenderObjectFunction}.
615
+ *
616
+ * @callback renderObjectFunction
617
+ * @param {Object3D} object - The 3D object.
618
+ * @param {Scene} scene - The scene the 3D object belongs to.
619
+ * @param {Camera} camera - The camera the object should be rendered with.
620
+ * @param {BufferGeometry} geometry - The object's geometry.
621
+ * @param {Material} material - The object's material.
622
+ * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
623
+ * @param {LightsNode} lightsNode - The current lights node.
624
+ * @param {ClippingContext} clippingContext - The clipping context.
625
+ * @param {String?} [passId=null] - An optional ID for identifying the pass.
626
+ */
627
+ /**
628
+ * Sets the given render object function. Calling this method overwrites the default implementation
629
+ * which is {@link module:Renderer~Renderer#renderObject}. Defining a custom function can be useful
630
+ * if you want to modify the way objects are rendered. For example you can define things like "every
631
+ * object that has material of a certain type should perform a pre-pass with a special overwrite material".
632
+ * The custom function must always call `renderObject()` in its implementation.
633
+ *
634
+ * Use `null` as the first argument to reset the state.
635
+ *
636
+ * @param {module:Renderer~renderObjectFunction?} renderObjectFunction - The render object function.
637
+ */
233
638
  setRenderObjectFunction(
234
639
  renderObjectFunction:
235
640
  | ((
@@ -243,6 +648,11 @@ declare class Renderer {
243
648
  ) => void)
244
649
  | null,
245
650
  ): void;
651
+ /**
652
+ * Returns the current render object function.
653
+ *
654
+ * @return {Function?} The current render object function. Returns `null` if no function is set.
655
+ */
246
656
  getRenderObjectFunction():
247
657
  | ((
248
658
  object: Object3D,
@@ -254,14 +664,78 @@ declare class Renderer {
254
664
  lightsNode: LightsNode,
255
665
  ) => void)
256
666
  | null;
667
+ /**
668
+ * Execute a single or an array of compute nodes. This method can only be called
669
+ * if the renderer has been initialized.
670
+ *
671
+ * @param {Node|Array<Node>} computeNodes - The compute node(s).
672
+ * @return {Promise?} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
673
+ */
257
674
  compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
675
+ /**
676
+ * Execute a single or an array of compute nodes.
677
+ *
678
+ * @async
679
+ * @param {Node|Array<Node>} computeNodes - The compute node(s).
680
+ * @return {Promise?} A Promise that resolve when the compute has finished.
681
+ */
258
682
  computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
683
+ /**
684
+ * Checks if the given feature is supported by the selected backend.
685
+ *
686
+ * @async
687
+ * @param {String} name - The feature's name.
688
+ * @return {Promise<Boolean>} A Promise that resolves with a bool that indicates whether the feature is supported or not.
689
+ */
259
690
  hasFeatureAsync(name: string): Promise<void>;
691
+ /**
692
+ * Checks if the given feature is supported by the selected backend. If the
693
+ * renderer has not been initialized, this method always returns `false`.
694
+ *
695
+ * @param {String} name - The feature's name.
696
+ * @return {Boolean} Whether the feature is supported or not.
697
+ */
260
698
  hasFeature(name: string): false | void;
699
+ /**
700
+ * Returns `true` when the renderer has been initialized.
701
+ *
702
+ * @return {Boolean} Whether the renderer has been initialized or not.
703
+ */
261
704
  hasInitialized(): boolean;
705
+ /**
706
+ * Initializes the given textures. Useful for preloading a texture rather than waiting until first render
707
+ * (which can cause noticeable lags due to decode and GPU upload overhead).
708
+ *
709
+ * @async
710
+ * @param {Texture} texture - The texture.
711
+ * @return {Promise} A Promise that resolves when the texture has been initialized.
712
+ */
262
713
  initTextureAsync(texture: Texture): Promise<void>;
263
- initTexture(texture: Texture): false | undefined;
714
+ /**
715
+ * Initializes the given textures. Useful for preloading a texture rather than waiting until first render
716
+ * (which can cause noticeable lags due to decode and GPU upload overhead).
717
+ *
718
+ * This method can only be used if the renderer has been initialized.
719
+ *
720
+ * @param {Texture} texture - The texture.
721
+ */
722
+ initTexture(texture: Texture): void;
723
+ /**
724
+ * Copies the current bound framebuffer into the given texture.
725
+ *
726
+ * @param {FramebufferTexture} framebufferTexture - The texture.
727
+ * @param {Vector2|Vector4} rectangle - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.
728
+ */
264
729
  copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
730
+ /**
731
+ * Copies data of source texture into a destination texture.
732
+ *
733
+ * @param {Texture} srcTexture - The source texture.
734
+ * @param {Texture} dstTexture - The destination texture.
735
+ * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
736
+ * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
737
+ * @param {Number} level - The mipmap level to copy.
738
+ */
265
739
  copyTextureToTexture(
266
740
  srcTexture: Texture,
267
741
  dstTexture: Texture,
@@ -269,15 +743,38 @@ declare class Renderer {
269
743
  dstPosition?: Vector2 | null,
270
744
  level?: number,
271
745
  ): void;
746
+ /**
747
+ * Reads pixel data from the given render target.
748
+ *
749
+ * @async
750
+ * @param {RenderTarget} renderTarget - The render target to read from.
751
+ * @param {Number} x - The `x` coordinate of the copy region's origin.
752
+ * @param {Number} y - The `y` coordinate of the copy region's origin.
753
+ * @param {Number} width - The width of the copy region.
754
+ * @param {Number} height - The height of the copy region.
755
+ * @param {Number} [textureIndex=0] - The texture index of a MRT render target.
756
+ * @param {Number} [faceIndex=0] - The active cube face index.
757
+ * @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
758
+ */
272
759
  readRenderTargetPixelsAsync(
273
760
  renderTarget: RenderTarget,
274
761
  x: number,
275
762
  y: number,
276
763
  width: number,
277
764
  height: number,
278
- index?: number,
765
+ textureIndex?: number,
279
766
  faceIndex?: number,
280
767
  ): Promise<import("../../core/BufferAttribute.js").TypedArray>;
768
+ /**
769
+ * Analyzes the given 3D object's hierarchy and builds render lists from the
770
+ * processed hierarchy.
771
+ *
772
+ * @param {Object3D} object - The 3D object to process (usually a scene).
773
+ * @param {Camera} camera - The camera the object is rendered with.
774
+ * @param {Number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups.
775
+ * @param {RenderList} renderList - The current render list.
776
+ * @param {ClippingContext} clippingContext - The current clipping context.
777
+ */
281
778
  _projectObject(
282
779
  object: Object3D,
283
780
  camera: Camera,
@@ -285,7 +782,25 @@ declare class Renderer {
285
782
  renderList: RenderList,
286
783
  clippingContext: ClippingContext | null,
287
784
  ): void;
785
+ /**
786
+ * Renders the given render bundles.
787
+ *
788
+ * @private
789
+ * @param {Array<Object>} bundles - Array with render bundle data.
790
+ * @param {Scene} sceneRef - The scene the render bundles belong to.
791
+ * @param {LightsNode} lightsNode - The current lights node.
792
+ */
288
793
  _renderBundles(bundles: Bundle[], sceneRef: Scene, lightsNode: LightsNode): void;
794
+ /**
795
+ * Renders the transparent objects from the given render lists.
796
+ *
797
+ * @private
798
+ * @param {Array<Object>} renderList - The transparent render list.
799
+ * @param {Array<Object>} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission).
800
+ * @param {Camera} camera - The camera the render list should be rendered with.
801
+ * @param {Scene} scene - The scene the render list belongs to.
802
+ * @param {LightsNode} lightsNode - The current lights node.
803
+ */
289
804
  _renderTransparents(
290
805
  renderList: RenderItem[],
291
806
  doublePassList: RenderItem[],
@@ -293,6 +808,16 @@ declare class Renderer {
293
808
  scene: Scene,
294
809
  lightsNode: LightsNode,
295
810
  ): void;
811
+ /**
812
+ * Renders the objects from the given render list.
813
+ *
814
+ * @private
815
+ * @param {Array<Object>} renderList - The render list.
816
+ * @param {Camera} camera - The camera the render list should be rendered with.
817
+ * @param {Scene} scene - The scene the render list belongs to.
818
+ * @param {LightsNode} lightsNode - The current lights node.
819
+ * @param {String?} [passId=null] - An optional ID for identifying the pass.
820
+ */
296
821
  _renderObjects(
297
822
  renderList: RenderItem[],
298
823
  camera: Camera,
@@ -300,6 +825,20 @@ declare class Renderer {
300
825
  lightsNode: LightsNode,
301
826
  passId?: string | null,
302
827
  ): void;
828
+ /**
829
+ * This method represents the default render object function that manages the render lifecycle
830
+ * of the object.
831
+ *
832
+ * @param {Object3D} object - The 3D object.
833
+ * @param {Scene} scene - The scene the 3D object belongs to.
834
+ * @param {Camera} camera - The camera the object should be rendered with.
835
+ * @param {BufferGeometry} geometry - The object's geometry.
836
+ * @param {Material} material - The object's material.
837
+ * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
838
+ * @param {LightsNode} lightsNode - The current lights node.
839
+ * @param {ClippingContext} clippingContext - The clipping context.
840
+ * @param {String?} [passId=null] - An optional ID for identifying the pass.
841
+ */
303
842
  renderObject(
304
843
  object: Object3D,
305
844
  scene: Scene,
@@ -311,6 +850,20 @@ declare class Renderer {
311
850
  clippingContext?: ClippingContext | null,
312
851
  passId?: string | null,
313
852
  ): void;
853
+ /**
854
+ * This method represents the default `_handleObjectFunction` implementation which creates
855
+ * a render object from the given data and performs the draw command with the selected backend.
856
+ *
857
+ * @private
858
+ * @param {Object3D} object - The 3D object.
859
+ * @param {Material} material - The object's material.
860
+ * @param {Scene} scene - The scene the 3D object belongs to.
861
+ * @param {Camera} camera - The camera the object should be rendered with.
862
+ * @param {LightsNode} lightsNode - The current lights node.
863
+ * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
864
+ * @param {ClippingContext} clippingContext - The clipping context.
865
+ * @param {String?} [passId=null] - An optional ID for identifying the pass.
866
+ */
314
867
  _renderObjectDirect(
315
868
  object: Object3D,
316
869
  material: Material,
@@ -321,15 +874,39 @@ declare class Renderer {
321
874
  clippingContext: ClippingContext | null,
322
875
  passId?: string,
323
876
  ): void;
877
+ /**
878
+ * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering.
879
+ * Used in `compileAsync()`.
880
+ *
881
+ * @private
882
+ * @param {Object3D} object - The 3D object.
883
+ * @param {Material} material - The object's material.
884
+ * @param {Scene} scene - The scene the 3D object belongs to.
885
+ * @param {Camera} camera - The camera the object should be rendered with.
886
+ * @param {LightsNode} lightsNode - The current lights node.
887
+ * @param {Object?} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
888
+ * @param {ClippingContext} clippingContext - The clipping context.
889
+ * @param {String?} [passId=null] - An optional ID for identifying the pass.
890
+ */
324
891
  _createObjectPipeline(
325
892
  object: Object3D,
326
893
  material: Material,
327
894
  scene: Scene,
328
895
  camera: Camera,
329
896
  lightsNode: LightsNode,
897
+ group: Group,
330
898
  clippingContext: ClippingContext | null,
331
899
  passId?: string,
332
900
  ): void;
901
+ /**
902
+ * Alias for `compileAsync()`.
903
+ *
904
+ * @method
905
+ * @param {Object3D} scene - The scene or 3D object to precompile.
906
+ * @param {Camera} camera - The camera that is used to render the scene.
907
+ * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.
908
+ * @return {Promise} A Promise that resolves when the compile has been finished.
909
+ */
333
910
  get compile(): (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<void>;
334
911
  }
335
912
  export default Renderer;