@types/three 0.184.0 → 0.185.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 (208) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +2 -0
  3. three/examples/jsm/controls/FirstPersonControls.d.ts +9 -0
  4. three/examples/jsm/controls/OrbitControls.d.ts +2 -2
  5. three/examples/jsm/controls/TransformControls.d.ts +32 -1
  6. three/examples/jsm/csm/CSMFrustum.d.ts +73 -13
  7. three/examples/jsm/exporters/DRACOExporter.d.ts +1 -1
  8. three/examples/jsm/exporters/GLTFExporter.d.ts +2 -2
  9. three/examples/jsm/exporters/PLYExporter.d.ts +5 -4
  10. three/examples/jsm/exporters/USDZExporter.d.ts +5 -1
  11. three/examples/jsm/generators/CityGenerator.d.ts +75 -0
  12. three/examples/jsm/generators/ForestGenerator.d.ts +79 -0
  13. three/examples/jsm/generators/TerrainGenerator.d.ts +67 -0
  14. three/examples/jsm/generators/TreeGenerator.d.ts +97 -0
  15. three/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  16. three/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  17. three/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  18. three/examples/jsm/inspector/tabs/Parameters.d.ts +5 -2
  19. three/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  20. three/examples/jsm/lighting/LightProbeGrid.d.ts +131 -13
  21. three/examples/jsm/loaders/DRACOLoader.d.ts +20 -6
  22. three/examples/jsm/loaders/EXRLoader.d.ts +2 -12
  23. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -1
  24. three/examples/jsm/loaders/HDRLoader.d.ts +2 -12
  25. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -1
  26. three/examples/jsm/loaders/LWOLoader.d.ts +6 -0
  27. three/examples/jsm/loaders/RGBELoader.d.ts +1 -7
  28. three/examples/jsm/loaders/SVGLoader.d.ts +9 -6
  29. three/examples/jsm/loaders/TGALoader.d.ts +2 -2
  30. three/examples/jsm/loaders/TIFFLoader.d.ts +2 -11
  31. three/examples/jsm/loaders/USDLoader.d.ts +6 -1
  32. three/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  33. three/examples/jsm/objects/MarchingCubes.d.ts +2 -2
  34. three/examples/jsm/objects/Reflector.d.ts +38 -5
  35. three/examples/jsm/objects/SkyMesh.d.ts +1 -1
  36. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  37. three/examples/jsm/tsl/display/BloomNode.d.ts +23 -6
  38. three/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  39. three/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  40. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +0 -2
  41. three/examples/jsm/tsl/display/SSGINode.d.ts +4 -1
  42. three/examples/jsm/tsl/display/SSRNode.d.ts +303 -30
  43. three/examples/jsm/tsl/display/TRAANode.d.ts +1 -1
  44. three/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  45. three/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  46. three/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  47. three/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  48. three/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  49. three/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  50. three/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  51. three/package.json +3 -3
  52. three/src/Three.TSL.d.ts +10 -3
  53. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  54. three/src/Three.WebGPU.d.ts +5 -3
  55. three/src/animation/AnimationClip.d.ts +0 -10
  56. three/src/cameras/Camera.d.ts +1 -1
  57. three/src/core/InterleavedBuffer.d.ts +1 -1
  58. three/src/core/Object3D.d.ts +8 -4
  59. three/src/core/RenderTarget.d.ts +11 -0
  60. three/src/core/Timer.d.ts +1 -1
  61. three/src/core/UniformsGroup.d.ts +1 -1
  62. three/src/extras/Controls.d.ts +6 -5
  63. three/src/extras/core/ShapePath.d.ts +61 -65
  64. three/src/loaders/DataTextureLoader.d.ts +37 -3
  65. three/src/loaders/MaterialLoader.d.ts +8 -0
  66. three/src/materials/LineBasicMaterial.d.ts +5 -0
  67. three/src/materials/Material.d.ts +9 -1
  68. three/src/materials/MeshBasicMaterial.d.ts +30 -0
  69. three/src/materials/MeshDepthMaterial.d.ts +13 -0
  70. three/src/materials/MeshDistanceMaterial.d.ts +13 -0
  71. three/src/materials/MeshLambertMaterial.d.ts +50 -1
  72. three/src/materials/MeshMatcapMaterial.d.ts +31 -1
  73. three/src/materials/MeshNormalMaterial.d.ts +11 -1
  74. three/src/materials/MeshPhongMaterial.d.ts +50 -1
  75. three/src/materials/MeshPhysicalMaterial.d.ts +50 -0
  76. three/src/materials/MeshStandardMaterial.d.ts +53 -1
  77. three/src/materials/MeshToonMaterial.d.ts +43 -1
  78. three/src/materials/PointsMaterial.d.ts +9 -0
  79. three/src/materials/ShaderMaterial.d.ts +2 -0
  80. three/src/materials/SpriteMaterial.d.ts +9 -0
  81. three/src/materials/nodes/Line2NodeMaterial.d.ts +18 -13
  82. three/src/materials/nodes/NodeMaterial.d.ts +33 -13
  83. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +0 -84
  84. three/src/math/Box2.d.ts +3 -3
  85. three/src/math/Box3.d.ts +255 -19
  86. three/src/math/Color.d.ts +10 -10
  87. three/src/math/FrustumArray.d.ts +75 -16
  88. three/src/math/Interpolant.d.ts +111 -8
  89. three/src/math/Matrix2.d.ts +1 -1
  90. three/src/math/Matrix3.d.ts +10 -1
  91. three/src/math/Matrix4.d.ts +329 -105
  92. three/src/math/Vector2.d.ts +1 -2
  93. three/src/math/Vector3.d.ts +3 -4
  94. three/src/math/Vector4.d.ts +1 -2
  95. three/src/math/interpolants/BezierInterpolant.d.ts +19 -3
  96. three/src/math/interpolants/CubicInterpolant.d.ts +18 -3
  97. three/src/math/interpolants/DiscreteInterpolant.d.ts +8 -3
  98. three/src/math/interpolants/LinearInterpolant.d.ts +7 -3
  99. three/src/math/interpolants/QuaternionLinearInterpolant.d.ts +7 -3
  100. three/src/nodes/Nodes.d.ts +4 -13
  101. three/src/nodes/TSL.d.ts +7 -5
  102. three/src/nodes/accessors/Batch.d.ts +19 -0
  103. three/src/nodes/accessors/Instance.d.ts +34 -0
  104. three/src/nodes/accessors/MaterialNode.d.ts +86 -79
  105. three/src/nodes/accessors/Morph.d.ts +11 -0
  106. three/src/nodes/accessors/Skinning.d.ts +23 -0
  107. three/src/nodes/accessors/StorageBufferNode.d.ts +22 -23
  108. three/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  109. three/src/nodes/accessors/StorageTextureNode.d.ts +6 -4
  110. three/src/nodes/accessors/TextureNode.d.ts +15 -10
  111. three/src/nodes/core/ArrayNode.d.ts +16 -8
  112. three/src/nodes/core/ContextNode.d.ts +5 -6
  113. three/src/nodes/core/LightingModel.d.ts +2 -0
  114. three/src/nodes/core/Node.d.ts +50 -51
  115. three/src/nodes/core/NodeBuilder.d.ts +1 -133
  116. three/src/nodes/core/OverrideContextNode.d.ts +92 -0
  117. three/src/nodes/core/PropertyNode.d.ts +13 -2
  118. three/src/nodes/core/StructNode.d.ts +0 -2
  119. three/src/nodes/core/StructTypeNode.d.ts +5 -4
  120. three/src/nodes/core/UniformNode.d.ts +48 -9
  121. three/src/nodes/display/BlendModes.d.ts +72 -11
  122. three/src/nodes/display/FrontFacingNode.d.ts +62 -3
  123. three/src/nodes/display/PassNode.d.ts +0 -2
  124. three/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  125. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +53 -45
  126. three/src/nodes/lighting/LightingContextNode.d.ts +9 -2
  127. three/src/nodes/lighting/LightsNode.d.ts +4 -4
  128. three/src/nodes/math/MathNode.d.ts +358 -304
  129. three/src/nodes/math/OperatorNode.d.ts +253 -82
  130. three/src/nodes/tsl/TSLCore.d.ts +16 -9
  131. three/src/nodes/utils/ArrayElementNode.d.ts +5 -4
  132. three/src/nodes/utils/EquirectUV.d.ts +31 -1
  133. three/src/nodes/utils/Packing.d.ts +50 -3
  134. three/src/nodes/utils/RTTNode.d.ts +7 -12
  135. three/src/nodes/utils/Remap.d.ts +216 -29
  136. three/src/nodes/utils/SampleNode.d.ts +18 -8
  137. three/src/objects/BatchedMesh.d.ts +1 -1
  138. three/src/objects/InstancedMesh.d.ts +0 -8
  139. three/src/objects/Skeleton.d.ts +0 -2
  140. three/src/renderers/common/Backend.d.ts +0 -3
  141. three/src/renderers/common/CanvasTarget.d.ts +0 -49
  142. three/src/renderers/common/ClippingContext.d.ts +6 -1
  143. three/src/renderers/common/CubeRenderTarget.d.ts +2 -1
  144. three/src/renderers/common/Info.d.ts +26 -66
  145. three/src/renderers/common/InspectorBase.d.ts +0 -7
  146. three/src/renderers/common/Lighting.d.ts +49 -5
  147. three/src/renderers/common/Renderer.d.ts +34 -458
  148. three/src/renderers/common/RendererUtils.d.ts +1 -2
  149. three/src/renderers/common/TimestampQueryPool.d.ts +1 -1
  150. three/src/renderers/common/XRManager.d.ts +32 -299
  151. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -117
  152. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -0
  153. three/src/renderers/webgl/WebGLRenderLists.d.ts +5 -1
  154. three/src/renderers/webgl/WebGLState.d.ts +2 -0
  155. three/src/renderers/webgl-fallback/WebGLBackend.d.ts +1 -1
  156. three/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +0 -10
  157. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +0 -1
  158. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +5 -121
  159. three/src/textures/CubeDepthTexture.d.ts +2 -3
  160. three/src/textures/DataTexture.d.ts +2 -1
  161. three/src/textures/DepthTexture.d.ts +5 -5
  162. three/examples/jsm/lighting/TiledLighting.d.ts +0 -9
  163. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +0 -31
  164. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +0 -22
  165. three/src/nodes/accessors/BatchNode.d.ts +0 -12
  166. three/src/nodes/accessors/InstanceNode.d.ts +0 -30
  167. three/src/nodes/accessors/InstancedMeshNode.d.ts +0 -10
  168. three/src/nodes/accessors/MorphNode.d.ts +0 -14
  169. three/src/nodes/accessors/SkinningNode.d.ts +0 -32
  170. three/src/renderers/common/Animation.d.ts +0 -102
  171. three/src/renderers/common/Attributes.d.ts +0 -59
  172. three/src/renderers/common/Background.d.ts +0 -47
  173. three/src/renderers/common/BindGroup.d.ts +0 -39
  174. three/src/renderers/common/Binding.d.ts +0 -50
  175. three/src/renderers/common/Bindings.d.ts +0 -132
  176. three/src/renderers/common/Buffer.d.ts +0 -90
  177. three/src/renderers/common/ChainMap.d.ts +0 -49
  178. three/src/renderers/common/Color4.d.ts +0 -55
  179. three/src/renderers/common/ComputePipeline.d.ts +0 -34
  180. three/src/renderers/common/DataMap.d.ts +0 -42
  181. three/src/renderers/common/Geometries.d.ts +0 -111
  182. three/src/renderers/common/Pipeline.d.ts +0 -29
  183. three/src/renderers/common/Pipelines.d.ts +0 -186
  184. three/src/renderers/common/ProgrammableStage.d.ts +0 -73
  185. three/src/renderers/common/RenderBundle.d.ts +0 -25
  186. three/src/renderers/common/RenderBundles.d.ts +0 -34
  187. three/src/renderers/common/RenderContext.d.ts +0 -235
  188. three/src/renderers/common/RenderContexts.d.ts +0 -47
  189. three/src/renderers/common/RenderList.d.ts +0 -226
  190. three/src/renderers/common/RenderLists.d.ts +0 -46
  191. three/src/renderers/common/RenderObject.d.ts +0 -448
  192. three/src/renderers/common/RenderObjectPipeline.d.ts +0 -33
  193. three/src/renderers/common/RenderObjects.d.ts +0 -151
  194. three/src/renderers/common/SampledTexture.d.ts +0 -28
  195. three/src/renderers/common/Sampler.d.ts +0 -19
  196. three/src/renderers/common/Textures.d.ts +0 -125
  197. three/src/renderers/common/Uniform.d.ts +0 -262
  198. three/src/renderers/common/UniformBuffer.d.ts +0 -20
  199. three/src/renderers/common/UniformsGroup.d.ts +0 -152
  200. three/src/renderers/common/XRRenderTarget.d.ts +0 -67
  201. three/src/renderers/common/nodes/NodeBuilderState.d.ts +0 -121
  202. three/src/renderers/common/nodes/NodeManager.d.ts +0 -309
  203. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +0 -29
  204. three/src/renderers/common/nodes/NodeSampler.d.ts +0 -12
  205. three/src/renderers/common/nodes/NodeUniform.d.ts +0 -250
  206. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -41
  207. three/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +0 -6
  208. three/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts +0 -6
@@ -19,13 +19,6 @@ export interface InspectorBaseEventMap {
19
19
  declare class InspectorBase<TEventMap extends InspectorBaseEventMap = InspectorBaseEventMap>
20
20
  extends EventDispatcher<TEventMap>
21
21
  {
22
- /**
23
- * The renderer associated with this inspector.
24
- *
25
- * @type {WebGLRenderer}
26
- * @private
27
- */
28
- private _renderer;
29
22
  /**
30
23
  * The current frame being processed.
31
24
  *
@@ -1,11 +1,55 @@
1
- import { Object3D } from "../../core/Object3D.js";
2
1
  import { Light } from "../../lights/Light.js";
3
- import LightsNode from "../../nodes/lighting/LightsNode.js";
2
+ import { LightsNode } from "../../nodes/Nodes.js";
3
+ import { Scene } from "../../scenes/Scene.js";
4
4
 
5
+ /**
6
+ * This renderer module manages the lights nodes which are unique
7
+ * per scene and camera combination.
8
+ *
9
+ * The lights node itself is later configured in the render list
10
+ * with the actual lights from the scene.
11
+ *
12
+ * @private
13
+ */
5
14
  declare class Lighting {
6
- createNode(lights?: Light[]): LightsNode;
7
-
8
- getNode(scene: Object3D): LightsNode;
15
+ /**
16
+ * Whether this lighting manager is enabled or not.
17
+ *
18
+ * @type {boolean}
19
+ * @default true
20
+ */
21
+ enabled: boolean;
22
+ /**
23
+ * Creates a new lights node for the given array of lights.
24
+ *
25
+ * @param {Array<Light>} lights - The render object.
26
+ * @return {LightsNode} The lights node.
27
+ */
28
+ createNode(lights?: Array<Light>): LightsNode;
29
+ /**
30
+ * Returns a lights node for the given scene.
31
+ *
32
+ * @param {Scene} scene - The scene.
33
+ * @return {LightsNode} The lights node.
34
+ */
35
+ getNode(scene: Scene): LightsNode;
36
+ /**
37
+ * Saves the current lights of the scene's lights node so they can be restored
38
+ * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call
39
+ * to avoid memory leaks.
40
+ *
41
+ * Nested render calls might mutate the lights array so a save/restore is required
42
+ * for each render call.
43
+ *
44
+ * @param {Scene} scene - The scene.
45
+ */
46
+ beginRender(scene: Scene): void;
47
+ /**
48
+ * Restores the lights saved by the matching {@link Lighting#beginRender} call.
49
+ *
50
+ * @param {Scene} scene - The scene.
51
+ */
52
+ finishRender(scene: Scene): void;
9
53
  }
10
54
 
11
55
  export default Lighting;
@@ -7,12 +7,13 @@ import { RenderTarget } from "../../core/RenderTarget.js";
7
7
  import { Material } from "../../materials/Material.js";
8
8
  import { Box2 } from "../../math/Box2.js";
9
9
  import { Box3 } from "../../math/Box3.js";
10
- import { ColorRepresentation } from "../../math/Color.js";
10
+ import { Color, 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
14
  import ContextNode from "../../nodes/core/ContextNode.js";
15
15
  import MRTNode from "../../nodes/core/MRTNode.js";
16
+ import Node from "../../nodes/core/Node.js";
16
17
  import ComputeNode from "../../nodes/gpgpu/ComputeNode.js";
17
18
  import LightsNode from "../../nodes/lighting/LightsNode.js";
18
19
  import { Scene } from "../../scenes/Scene.js";
@@ -21,16 +22,22 @@ import { Texture } from "../../textures/Texture.js";
21
22
  import Backend from "./Backend.js";
22
23
  import CanvasTarget from "./CanvasTarget.js";
23
24
  import ClippingContext from "./ClippingContext.js";
24
- import Color4 from "./Color4.js";
25
25
  import IndirectStorageBufferAttribute from "./IndirectStorageBufferAttribute.js";
26
26
  import Info from "./Info.js";
27
27
  import InspectorBase from "./InspectorBase.js";
28
28
  import Lighting from "./Lighting.js";
29
29
  import NodeLibrary from "./nodes/NodeLibrary.js";
30
30
  import ReadbackBuffer from "./ReadbackBuffer.js";
31
- import { RenderItem } from "./RenderList.js";
32
31
  import XRManager from "./XRManager.js";
33
32
 
33
+ declare module "../../scenes/Scene.js" {
34
+ interface Scene {
35
+ environmentNode?: Node<"vec3"> | null | undefined;
36
+ backgroundNode?: Node | null | undefined;
37
+ fogNode?: Node | null | undefined;
38
+ }
39
+ }
40
+
34
41
  interface DeviceLostInfo {
35
42
  api: "WebGL" | "WebGPU";
36
43
  message: string;
@@ -51,6 +58,18 @@ export interface RendererParameters {
51
58
  multiview?: boolean | undefined;
52
59
  }
53
60
 
61
+ export interface RenderItem {
62
+ id: number | null;
63
+ object: Object3D | null;
64
+ geometry: BufferGeometry | null;
65
+ material: Material | null;
66
+ groupOrder: number | null;
67
+ renderOrder: number | null;
68
+ z: number | null;
69
+ group: GeometryGroup | null;
70
+ clippingContext: ClippingContext | null;
71
+ }
72
+
54
73
  /**
55
74
  * Base class for renderers.
56
75
  */
@@ -227,287 +246,6 @@ declare class Renderer {
227
246
  * @type {Lighting}
228
247
  */
229
248
  lighting: Lighting;
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
- * Cache for the fullscreen quad.
363
- * This fullscreen quad is used for internal render passes
364
- * like the tone mapping and color space output pass.
365
- *
366
- * @private
367
- * @type {Map<Texture,QuadMesh>}
368
- */
369
- private _quadCache;
370
- /**
371
- * A reference to the current render context.
372
- *
373
- * @private
374
- * @type {?RenderContext}
375
- * @default null
376
- */
377
- private _currentRenderContext;
378
- /**
379
- * A custom sort function for the opaque render list.
380
- *
381
- * @private
382
- * @type {?Function}
383
- * @default null
384
- */
385
- private _opaqueSort;
386
- /**
387
- * A custom sort function for the transparent render list.
388
- *
389
- * @private
390
- * @type {?Function}
391
- * @default null
392
- */
393
- private _transparentSort;
394
- /**
395
- * Cache of framebuffer targets per canvas target.
396
- *
397
- * @private
398
- * @type {Map<CanvasTarget, RenderTarget>}
399
- */
400
- private _frameBufferTargets;
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
249
  /**
512
250
  * A callback function that defines what should happen when a device/context lost occurs.
513
251
  *
@@ -515,55 +253,24 @@ declare class Renderer {
515
253
  */
516
254
  onDeviceLost: (info: DeviceLostInfo) => void;
517
255
  /**
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.
256
+ * A callback function that defines what should happen when an uncaptured
257
+ * backend error is reported (e.g. a WebGPU validation/out-of-memory/internal
258
+ * error raised outside an error scope). Applications can override this to
259
+ * surface errors in their own UI without letting them escalate to a device
260
+ * loss. The default implementation logs to the console.
536
261
  *
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
262
+ * @type {Function}
557
263
  */
558
- private _initPromise;
264
+ onError: (errorMessage: string) => void;
559
265
  /**
560
- * An array of compilation promises which are used in `compileAsync()`.
266
+ * When an override material is in use, this property points to the current
267
+ * source material during the rendering of a render object.
561
268
  *
562
269
  * @private
563
- * @type {?Array<Promise>}
270
+ * @type {?Material}
564
271
  * @default null
565
272
  */
566
- private _compilationPromises;
273
+ private _currentSourceMaterial;
567
274
  /**
568
275
  * Whether the renderer should render transparent render objects or not.
569
276
  *
@@ -760,22 +467,6 @@ declare class Renderer {
760
467
  * @return {number} The output buffer type.
761
468
  */
762
469
  getColorBufferType(): TextureDataType;
763
- /**
764
- * Default implementation of the device lost callback.
765
- *
766
- * @private
767
- * @param {Object} info - Information about the context lost.
768
- */
769
- private _onDeviceLost;
770
- /**
771
- * Renders the given render bundle.
772
- *
773
- * @private
774
- * @param {Object} bundle - Render bundle data.
775
- * @param {Scene} sceneRef - The scene the render bundle belongs to.
776
- * @param {LightsNode} lightsNode - The lights node.
777
- */
778
- private _renderBundle;
779
470
  /**
780
471
  * Renders the scene or 3D object with the given camera. This method can only be called
781
472
  * if the renderer has been initialized. When using `render()` inside an animation loop,
@@ -799,33 +490,6 @@ declare class Renderer {
799
490
  * @return {boolean} Whether the renderer has been initialized or not.
800
491
  */
801
492
  get initialized(): boolean;
802
- /**
803
- * Returns an internal render target which is used when computing the output tone mapping
804
- * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render
805
- * pass and not inline to achieve more correct results.
806
- *
807
- * @private
808
- * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied.
809
- */
810
- private _getFrameBufferTarget;
811
- /**
812
- * Renders the scene or 3D object with the given camera.
813
- *
814
- * @private
815
- * @param {Object3D} scene - The scene or 3D object to render.
816
- * @param {Camera} camera - The camera to render the scene with.
817
- * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not.
818
- * @return {RenderContext} The current render context.
819
- */
820
- private _renderScene;
821
- _setXRLayerSize(width: number, height: number): void;
822
- /**
823
- * The output pass performs tone mapping and color space conversion.
824
- *
825
- * @private
826
- * @param {RenderTarget} renderTarget - The current render target.
827
- */
828
- private _renderOutput;
829
493
  /**
830
494
  * Returns the maximum available anisotropy for texture filtering.
831
495
  *
@@ -1011,7 +675,7 @@ declare class Renderer {
1011
675
  * @param {Color} target - The method writes the result in this target object.
1012
676
  * @return {Color} The clear color.
1013
677
  */
1014
- getClearColor(target: Color4): Color4;
678
+ getClearColor(target: Color): Color;
1015
679
  /**
1016
680
  * Defines the clear color and optionally the clear alpha.
1017
681
  *
@@ -1207,12 +871,6 @@ declare class Renderer {
1207
871
  * @return {CanvasTarget} The current canvas target.
1208
872
  */
1209
873
  getCanvasTarget(): CanvasTarget;
1210
- /**
1211
- * Resets the renderer to the initial state before WebXR started.
1212
- *
1213
- * @private
1214
- */
1215
- private _resetXRState;
1216
874
  /**
1217
875
  * Callback for {@link Renderer#setRenderObjectFunction}.
1218
876
  *
@@ -1397,58 +1055,6 @@ declare class Renderer {
1397
1055
  textureIndex?: number,
1398
1056
  faceIndex?: number,
1399
1057
  ): Promise<TypedArray>;
1400
- /**
1401
- * Analyzes the given 3D object's hierarchy and builds render lists from the
1402
- * processed hierarchy.
1403
- *
1404
- * @private
1405
- * @param {Object3D} object - The 3D object to process (usually a scene).
1406
- * @param {Camera} camera - The camera the object is rendered with.
1407
- * @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups.
1408
- * @param {RenderList} renderList - The current render list.
1409
- * @param {ClippingContext} clippingContext - The current clipping context.
1410
- */
1411
- private _projectObject;
1412
- /**
1413
- * Renders the given render bundles.
1414
- *
1415
- * @private
1416
- * @param {Array<Object>} bundles - Array with render bundle data.
1417
- * @param {Scene} sceneRef - The scene the render bundles belong to.
1418
- * @param {LightsNode} lightsNode - The current lights node.
1419
- */
1420
- private _renderBundles;
1421
- /**
1422
- * Renders the transparent objects from the given render lists.
1423
- *
1424
- * @private
1425
- * @param {Array<Object>} renderList - The transparent render list.
1426
- * @param {Array<Object>} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission).
1427
- * @param {Camera} camera - The camera the render list should be rendered with.
1428
- * @param {Scene} scene - The scene the render list belongs to.
1429
- * @param {LightsNode} lightsNode - The current lights node.
1430
- */
1431
- private _renderTransparents;
1432
- /**
1433
- * Renders the objects from the given render list.
1434
- *
1435
- * @private
1436
- * @param {Array<Object>} renderList - The render list.
1437
- * @param {Camera} camera - The camera the render list should be rendered with.
1438
- * @param {Scene} scene - The scene the render list belongs to.
1439
- * @param {LightsNode} lightsNode - The current lights node.
1440
- * @param {?string} [passId=null] - An optional ID for identifying the pass.
1441
- */
1442
- private _renderObjects;
1443
- /**
1444
- * Retrieves shadow nodes for the given material. This is used to setup shadow passes.
1445
- * The result is cached per material and updated when the material's version changes.
1446
- *
1447
- * @private
1448
- * @param {Material} material
1449
- * @returns {Object} - The shadow nodes for the material.
1450
- */
1451
- private _getShadowNodes;
1452
1058
  /**
1453
1059
  * This method represents the default render object function that manages the render lifecycle
1454
1060
  * of the object.
@@ -1481,36 +1087,6 @@ declare class Renderer {
1481
1087
  * @return {boolean} Whether the compatibility is supported or not.
1482
1088
  */
1483
1089
  hasCompatibility(name: string): boolean;
1484
- /**
1485
- * This method represents the default `_handleObjectFunction` implementation which creates
1486
- * a render object from the given data and performs the draw command with the selected backend.
1487
- *
1488
- * @private
1489
- * @param {Object3D} object - The 3D object.
1490
- * @param {Material} material - The object's material.
1491
- * @param {Scene} scene - The scene the 3D object belongs to.
1492
- * @param {Camera} camera - The camera the object should be rendered with.
1493
- * @param {LightsNode} lightsNode - The current lights node.
1494
- * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
1495
- * @param {ClippingContext} clippingContext - The clipping context.
1496
- * @param {string} [passId] - An optional ID for identifying the pass.
1497
- */
1498
- private _renderObjectDirect;
1499
- /**
1500
- * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering.
1501
- * Used in `compileAsync()`.
1502
- *
1503
- * @private
1504
- * @param {Object3D} object - The 3D object.
1505
- * @param {Material} material - The object's material.
1506
- * @param {Scene} scene - The scene the 3D object belongs to.
1507
- * @param {Camera} camera - The camera the object should be rendered with.
1508
- * @param {LightsNode} lightsNode - The current lights node.
1509
- * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
1510
- * @param {ClippingContext} clippingContext - The clipping context.
1511
- * @param {string} [passId] - An optional ID for identifying the pass.
1512
- */
1513
- private _createObjectPipeline;
1514
1090
  /**
1515
1091
  * Alias for `compileAsync()`.
1516
1092
  *
@@ -11,7 +11,6 @@ import LightsNode from "../../nodes/lighting/LightsNode.js";
11
11
  import { Scene } from "../../scenes/Scene.js";
12
12
  import { CubeTexture } from "../../textures/CubeTexture.js";
13
13
  import { Texture } from "../../textures/Texture.js";
14
- import Color4 from "./Color4.js";
15
14
  import Renderer from "./Renderer.js";
16
15
 
17
16
  // renderer state
@@ -36,7 +35,7 @@ export interface RendererState {
36
35
  | null;
37
36
  pixelRatio: number;
38
37
  mrt: MRTNode | null;
39
- clearColor: Color4;
38
+ clearColor: Color;
40
39
  clearAlpha: number;
41
40
  autoClear: boolean;
42
41
  scissorTest: boolean;
@@ -91,7 +91,7 @@ declare abstract class TimestampQueryPool {
91
91
  * @param {string} uid - A unique identifier for the render context.
92
92
  * @return {boolean} True if a timestamp is available, false otherwise.
93
93
  */
94
- hasTimestamp(uid: string): boolean;
94
+ hasTimestampQuery(uid: string): boolean;
95
95
  /**
96
96
  * Allocate queries for a specific uid.
97
97
  *