@types/three 0.168.0 → 0.170.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 (213) hide show
  1. three/README.md +1 -1
  2. three/build/three.webgpu.nodes.d.ts +1 -0
  3. three/build/three.webgpu.nodes.min.d.ts +1 -0
  4. three/examples/jsm/Addons.d.ts +3 -10
  5. three/examples/jsm/animation/MMDAnimationHelper.d.ts +4 -0
  6. three/examples/jsm/animation/MMDPhysics.d.ts +4 -0
  7. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  8. three/examples/jsm/controls/DragControls.d.ts +0 -15
  9. three/examples/jsm/controls/TransformControls.d.ts +195 -24
  10. three/examples/jsm/csm/CSMFrustum.d.ts +8 -2
  11. three/examples/jsm/csm/CSMHelper.d.ts +2 -1
  12. three/examples/jsm/csm/CSMShadowNode.d.ts +46 -0
  13. three/examples/jsm/curves/NURBSCurve.d.ts +12 -1
  14. three/examples/jsm/exporters/EXRExporter.d.ts +7 -2
  15. three/examples/jsm/exporters/GLTFExporter.d.ts +20 -3
  16. three/examples/jsm/exporters/KTX2Exporter.d.ts +3 -1
  17. three/examples/jsm/exporters/MMDExporter.d.ts +4 -0
  18. three/examples/jsm/exporters/USDZExporter.d.ts +4 -0
  19. three/examples/jsm/geometries/DecalGeometry.d.ts +9 -3
  20. three/examples/jsm/geometries/TeapotGeometry.d.ts +2 -2
  21. three/examples/jsm/helpers/LightProbeHelper.d.ts +5 -3
  22. three/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
  23. three/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
  24. three/examples/jsm/lighting/TiledLighting.d.ts +10 -0
  25. three/examples/jsm/lights/LightProbeGenerator.d.ts +5 -1
  26. three/examples/jsm/lines/Line2.d.ts +15 -1
  27. three/examples/jsm/lines/LineGeometry.d.ts +18 -1
  28. three/examples/jsm/lines/LineMaterial.d.ts +65 -12
  29. three/examples/jsm/lines/LineSegments2.d.ts +25 -2
  30. three/examples/jsm/lines/LineSegmentsGeometry.d.ts +46 -9
  31. three/examples/jsm/lines/Wireframe.d.ts +5 -2
  32. three/examples/jsm/lines/WireframeGeometry2.d.ts +1 -1
  33. three/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
  34. three/examples/jsm/loaders/DRACOLoader.d.ts +6 -0
  35. three/examples/jsm/loaders/EXRLoader.d.ts +2 -2
  36. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -2
  37. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -0
  38. three/examples/jsm/loaders/LDrawLoader.d.ts +10 -0
  39. three/examples/jsm/loaders/MMDLoader.d.ts +4 -0
  40. three/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
  41. three/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
  42. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +0 -1
  43. three/examples/jsm/math/ColorSpaces.d.ts +11 -0
  44. three/examples/jsm/misc/ProgressiveLightMap.d.ts +8 -10
  45. three/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
  46. three/examples/jsm/modifiers/CurveModifier.d.ts +7 -3
  47. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
  48. three/examples/jsm/objects/Lensflare.d.ts +13 -9
  49. three/examples/jsm/objects/LensflareMesh.d.ts +21 -0
  50. three/examples/jsm/renderers/SVGRenderer.d.ts +2 -2
  51. three/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.d.ts +1 -5
  52. three/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.d.ts +2 -3
  53. three/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.d.ts +2 -4
  54. three/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
  55. three/{src/nodes → examples/jsm/tsl}/display/BloomNode.d.ts +1 -5
  56. three/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.d.ts +2 -6
  57. three/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.d.ts +1 -5
  58. three/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.d.ts +2 -5
  59. three/{src/nodes → examples/jsm/tsl}/display/FXAANode.d.ts +1 -3
  60. three/{src/nodes → examples/jsm/tsl}/display/FilmNode.d.ts +1 -3
  61. three/{src/nodes → examples/jsm/tsl}/display/GTAONode.d.ts +2 -8
  62. three/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.d.ts +13 -5
  63. three/examples/jsm/tsl/display/LensflareNode.d.ts +35 -0
  64. three/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.d.ts +2 -6
  65. three/{src/nodes → examples/jsm/tsl}/display/MotionBlur.d.ts +1 -2
  66. three/examples/jsm/tsl/display/OutlineNode.d.ts +32 -0
  67. three/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.d.ts +2 -3
  68. three/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.d.ts +2 -5
  69. three/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.d.ts +1 -4
  70. three/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
  71. three/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.d.ts +2 -7
  72. three/examples/jsm/tsl/display/SSRNode.d.ts +38 -0
  73. three/examples/jsm/tsl/display/Sepia.d.ts +3 -0
  74. three/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.d.ts +1 -3
  75. three/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.d.ts +2 -5
  76. three/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.d.ts +2 -5
  77. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +15 -0
  78. three/{src/nodes → examples/jsm/tsl}/display/TransitionNode.d.ts +1 -5
  79. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -0
  80. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +22 -0
  81. three/examples/jsm/utils/GeometryCompressionUtils.d.ts +20 -4
  82. three/examples/jsm/utils/ShadowMapViewer.d.ts +8 -6
  83. three/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
  84. three/examples/jsm/utils/SkeletonUtils.d.ts +25 -5
  85. three/examples/jsm/utils/WebGPUTextureUtils.d.ts +3 -0
  86. three/package.json +4 -3
  87. three/src/Three.WebGPU.Nodes.d.ts +205 -0
  88. three/src/Three.WebGPU.d.ts +7 -2
  89. three/src/Three.d.ts +2 -7
  90. three/src/audio/Audio.d.ts +4 -1
  91. three/src/constants.d.ts +1 -9
  92. three/src/core/BufferAttribute.d.ts +0 -15
  93. three/src/core/BufferGeometry.d.ts +13 -2
  94. three/src/core/InterleavedBuffer.d.ts +0 -12
  95. three/src/core/Object3D.d.ts +1 -1
  96. three/src/core/Raycaster.d.ts +2 -1
  97. three/src/core/RenderTarget.d.ts +1 -2
  98. three/src/extras/Controls.d.ts +3 -3
  99. three/src/loaders/FileLoader.d.ts +3 -3
  100. three/src/loaders/MaterialLoader.d.ts +2 -0
  101. three/src/loaders/nodes/NodeLoader.d.ts +5 -0
  102. three/src/loaders/nodes/NodeMaterialLoader.d.ts +3 -0
  103. three/src/loaders/nodes/NodeObjectLoader.d.ts +12 -0
  104. three/src/materials/LineBasicMaterial.d.ts +0 -5
  105. three/src/materials/LineDashedMaterial.d.ts +0 -5
  106. three/src/materials/Material.d.ts +4 -6
  107. three/src/materials/MeshBasicMaterial.d.ts +0 -5
  108. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  109. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  110. three/src/materials/MeshLambertMaterial.d.ts +0 -5
  111. three/src/materials/MeshMatcapMaterial.d.ts +0 -5
  112. three/src/materials/MeshNormalMaterial.d.ts +0 -5
  113. three/src/materials/MeshPhongMaterial.d.ts +0 -5
  114. three/src/materials/MeshPhysicalMaterial.d.ts +0 -5
  115. three/src/materials/MeshStandardMaterial.d.ts +0 -5
  116. three/src/materials/MeshToonMaterial.d.ts +0 -5
  117. three/src/materials/PointsMaterial.d.ts +0 -5
  118. three/src/materials/RawShaderMaterial.d.ts +0 -2
  119. three/src/materials/ShaderMaterial.d.ts +0 -5
  120. three/src/materials/ShadowMaterial.d.ts +0 -5
  121. three/src/materials/SpriteMaterial.d.ts +0 -5
  122. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +2 -2
  123. three/src/materials/nodes/NodeMaterial.d.ts +4 -4
  124. three/src/materials/nodes/NodeMaterials.d.ts +19 -16
  125. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +96 -0
  126. three/src/math/Color.d.ts +39 -22
  127. three/src/math/ColorManagement.d.ts +24 -24
  128. three/src/math/Quaternion.d.ts +4 -3
  129. three/src/math/Triangle.d.ts +24 -0
  130. three/src/math/Vector4.d.ts +2 -0
  131. three/src/nodes/Nodes.d.ts +3 -23
  132. three/src/nodes/TSL.d.ts +75 -187
  133. three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -0
  134. three/src/nodes/accessors/Camera.d.ts +0 -1
  135. three/src/nodes/accessors/MaterialNode.d.ts +0 -1
  136. three/src/nodes/accessors/ModelNode.d.ts +7 -3
  137. three/src/nodes/accessors/Normal.d.ts +6 -0
  138. three/src/nodes/accessors/Object3DNode.d.ts +1 -5
  139. three/src/nodes/accessors/SceneNode.d.ts +2 -0
  140. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -2
  141. three/src/nodes/accessors/VelocityNode.d.ts +6 -1
  142. three/src/nodes/code/ScriptableNode.d.ts +1 -1
  143. three/src/nodes/core/Node.d.ts +3 -12
  144. three/src/nodes/core/NodeUtils.d.ts +5 -1
  145. three/src/nodes/core/StackNode.d.ts +4 -4
  146. three/src/nodes/core/StructTypeNode.d.ts +1 -0
  147. three/src/nodes/core/UniformNode.d.ts +1 -0
  148. three/src/nodes/core/VarNode.d.ts +12 -1
  149. three/src/nodes/display/ColorAdjustment.d.ts +29 -0
  150. three/src/nodes/display/ColorSpaceFunctions.d.ts +2 -2
  151. three/src/nodes/display/ColorSpaceNode.d.ts +33 -8
  152. three/src/nodes/display/RenderOutputNode.d.ts +4 -4
  153. three/src/nodes/display/ScreenNode.d.ts +48 -0
  154. three/src/nodes/display/ToneMappingFunctions.d.ts +6 -6
  155. three/src/nodes/display/ToonOutlinePassNode.d.ts +24 -0
  156. three/src/nodes/display/ViewportDepthNode.d.ts +2 -0
  157. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +6 -0
  158. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +10 -0
  159. three/src/nodes/functions/material/getShIrradianceAt.d.ts +6 -0
  160. three/src/nodes/gpgpu/ComputeNode.d.ts +5 -0
  161. three/src/nodes/lighting/LightsNode.d.ts +7 -2
  162. three/src/nodes/lighting/PointLightNode.d.ts +11 -1
  163. three/src/nodes/lighting/ShadowNode.d.ts +12 -0
  164. three/src/nodes/utils/Discard.d.ts +1 -1
  165. three/src/nodes/utils/Oscillators.d.ts +7 -0
  166. three/src/nodes/utils/PostProcessingUtils.d.ts +45 -0
  167. three/src/nodes/utils/ReflectorNode.d.ts +17 -4
  168. three/src/nodes/utils/Timer.d.ts +21 -0
  169. three/src/objects/BatchedMesh.d.ts +78 -0
  170. three/src/objects/Group.d.ts +0 -6
  171. three/src/objects/LOD.d.ts +7 -0
  172. three/src/renderers/WebGLRenderer.d.ts +24 -23
  173. three/src/renderers/common/BundleGroup.d.ts +10 -0
  174. three/src/renderers/common/ClippingContext.d.ts +1 -1
  175. three/src/renderers/common/Constants.d.ts +2 -1
  176. three/src/renderers/common/Geometries.d.ts +1 -0
  177. three/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
  178. three/src/renderers/common/Lighting.d.ts +15 -0
  179. three/src/renderers/common/PostProcessingUtils.d.ts +66 -0
  180. three/src/renderers/common/RenderBundles.d.ts +3 -3
  181. three/src/renderers/common/RenderContext.d.ts +2 -2
  182. three/src/renderers/common/RenderList.d.ts +7 -3
  183. three/src/renderers/common/RenderLists.d.ts +3 -1
  184. three/src/renderers/common/RenderObject.d.ts +20 -1
  185. three/src/renderers/common/Renderer.d.ts +43 -10
  186. three/src/renderers/common/extras/PMREMGenerator.d.ts +5 -1
  187. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -2
  188. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -7
  189. three/src/renderers/common/nodes/Nodes.d.ts +8 -0
  190. three/src/renderers/webgl/WebGLCapabilities.d.ts +13 -0
  191. three/src/renderers/webgl/WebGLPrograms.d.ts +4 -10
  192. three/src/renderers/webgl/WebGLState.d.ts +13 -10
  193. three/src/renderers/webgl/WebGLUtils.d.ts +2 -2
  194. three/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
  195. three/src/renderers/webgpu/WebGPURenderer.d.ts +7 -3
  196. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +5 -0
  197. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +5 -0
  198. three/src/textures/CompressedTexture.d.ts +1 -2
  199. three/src/textures/CubeTexture.d.ts +1 -2
  200. three/src/textures/DataTexture.d.ts +1 -2
  201. three/src/textures/Texture.d.ts +3 -4
  202. three/examples/jsm/cameras/CinematicCamera.d.ts +0 -34
  203. three/examples/jsm/geometries/SDFGeometryGenerator.d.ts +0 -16
  204. three/examples/jsm/loaders/TiltLoader.d.ts +0 -7
  205. three/examples/jsm/utils/GPUStatsPanel.d.ts +0 -12
  206. three/examples/jsm/utils/PackedPhongMaterial.d.ts +0 -10
  207. three/src/nodes/display/BleachBypass.d.ts +0 -4
  208. three/src/nodes/display/Sepia.d.ts +0 -4
  209. three/src/nodes/display/ViewportNode.d.ts +0 -38
  210. three/src/nodes/utils/OscNode.d.ts +0 -25
  211. three/src/nodes/utils/TimerNode.d.ts +0 -25
  212. three/src/renderers/common/StandardRenderer.d.ts +0 -12
  213. /three/examples/jsm/utils/{TextureUtils.d.ts → WebGLTextureUtils.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { Camera } from "../cameras/Camera.js";
2
- import { ColorSpace, CullFace, ShadowMapType, ToneMapping, WebGLCoordinateSystem } from "../constants.js";
2
+ import { CullFace, ShadowMapType, ToneMapping, WebGLCoordinateSystem } from "../constants.js";
3
3
  import { TypedArray } from "../core/BufferAttribute.js";
4
4
  import { BufferGeometry } from "../core/BufferGeometry.js";
5
5
  import { Object3D } from "../core/Object3D.js";
@@ -15,7 +15,7 @@ import { Scene } from "../scenes/Scene.js";
15
15
  import { Data3DTexture } from "../textures/Data3DTexture.js";
16
16
  import { DataArrayTexture } from "../textures/DataArrayTexture.js";
17
17
  import { OffscreenCanvas, Texture } from "../textures/Texture.js";
18
- import { WebGLCapabilities } from "./webgl/WebGLCapabilities.js";
18
+ import { WebGLCapabilities, WebGLCapabilitiesParameters } from "./webgl/WebGLCapabilities.js";
19
19
  import { WebGLExtensions } from "./webgl/WebGLExtensions.js";
20
20
  import { WebGLInfo } from "./webgl/WebGLInfo.js";
21
21
  import { WebGLProgram } from "./webgl/WebGLProgram.js";
@@ -33,7 +33,7 @@ export interface Renderer {
33
33
  setSize(width: number, height: number, updateStyle?: boolean): void;
34
34
  }
35
35
 
36
- export interface WebGLRendererParameters {
36
+ export interface WebGLRendererParameters extends WebGLCapabilitiesParameters {
37
37
  /**
38
38
  * A Canvas where the renderer draws its output.
39
39
  */
@@ -46,11 +46,6 @@ export interface WebGLRendererParameters {
46
46
  */
47
47
  context?: WebGLRenderingContext | undefined;
48
48
 
49
- /**
50
- * shader precision. Can be "highp", "mediump" or "lowp".
51
- */
52
- precision?: string | undefined;
53
-
54
49
  /**
55
50
  * default is false.
56
51
  */
@@ -79,18 +74,13 @@ export interface WebGLRendererParameters {
79
74
  /**
80
75
  * Can be "high-performance", "low-power" or "default"
81
76
  */
82
- powerPreference?: string | undefined;
77
+ powerPreference?: WebGLPowerPreference | undefined;
83
78
 
84
79
  /**
85
80
  * default is true.
86
81
  */
87
82
  depth?: boolean | undefined;
88
83
 
89
- /**
90
- * default is false.
91
- */
92
- logarithmicDepthBuffer?: boolean | undefined;
93
-
94
84
  /**
95
85
  * default is false.
96
86
  */
@@ -193,8 +183,8 @@ export class WebGLRenderer implements Renderer {
193
183
  * {@link SRGBColorSpace} and {@link LinearSRGBColorSpace}.
194
184
  * @default THREE.SRGBColorSpace.
195
185
  */
196
- get outputColorSpace(): ColorSpace;
197
- set outputColorSpace(colorSpace: ColorSpace);
186
+ get outputColorSpace(): string;
187
+ set outputColorSpace(colorSpace: string);
198
188
 
199
189
  get coordinateSystem(): typeof WebGLCoordinateSystem;
200
190
 
@@ -441,26 +431,37 @@ export class WebGLRenderer implements Renderer {
441
431
  copyFramebufferToTexture(texture: Texture, position?: Vector2 | null, level?: number): void;
442
432
 
443
433
  /**
444
- * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
445
- * position.
434
+ * Copies the pixels of a texture in the bounds [srcRegion]{@link Box3} in the destination texture starting from the
435
+ * given position. 2D Texture, 3D Textures, or a mix of the two can be used as source and destination texture
436
+ * arguments for copying between layers of 3d textures
437
+ *
438
+ * The `depthTexture` and `texture` property of render targets are supported as well.
439
+ *
440
+ * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are
441
+ * initialized e.g. via {@link .initRenderTarget}().
446
442
  *
447
443
  * @param srcTexture Specifies the source texture.
448
444
  * @param dstTexture Specifies the destination texture.
449
445
  * @param srcRegion Specifies the bounds
450
446
  * @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
451
- * @param level Specifies the destination mipmap level of the texture.
447
+ * @param dstLevel Specifies the destination mipmap level of the texture.
452
448
  */
453
449
  copyTextureToTexture(
454
450
  srcTexture: Texture,
455
451
  dstTexture: Texture,
456
- srcRegion?: Box2 | null,
457
- dstPosition?: Vector2 | null,
458
- level?: number,
452
+ srcRegion?: Box2 | Box3 | null,
453
+ dstPosition?: Vector2 | Vector3 | null,
454
+ dstLevel?: number,
459
455
  ): void;
460
456
 
461
457
  /**
458
+ * @deprecated Use "copyTextureToTexture" instead.
459
+ *
462
460
  * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
463
- * position.
461
+ * position. The `depthTexture` and `texture` property of 3D render targets are supported as well.
462
+ *
463
+ * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are
464
+ * intitialized e.g. via {@link .initRenderTarget}().
464
465
  *
465
466
  * @param srcTexture Specifies the source texture.
466
467
  * @param dstTexture Specifies the destination texture.
@@ -0,0 +1,10 @@
1
+ import { Group } from "../../objects/Group.js";
2
+ declare class BundleGroup extends Group {
3
+ readonly isBundleGroup: true;
4
+ readonly type: string;
5
+ static: boolean;
6
+ version: number;
7
+ constructor();
8
+ set needsUpdate(value: boolean);
9
+ }
10
+ export default BundleGroup;
@@ -14,7 +14,7 @@ declare class ClippingContext {
14
14
  planes: Vector4[];
15
15
  parentVersion: number;
16
16
  viewNormalMatrix: Matrix3;
17
- cacheKey: string;
17
+ cacheKey: number;
18
18
  viewMatrix?: Matrix4 | undefined;
19
19
  constructor();
20
20
  projectPlanes(source: readonly Plane[], offset: number): void;
@@ -1,7 +1,8 @@
1
1
  export declare const AttributeType: {
2
2
  readonly VERTEX: 1;
3
3
  readonly INDEX: 2;
4
- readonly STORAGE: 4;
4
+ readonly STORAGE: 3;
5
+ readonly INDIRECT: 4;
5
6
  };
6
7
  export type AttributeType = (typeof AttributeType)[keyof typeof AttributeType];
7
8
  export declare const GPU_CHUNK_BYTES = 16;
@@ -26,6 +26,7 @@ declare class Geometries extends DataMap<{
26
26
  initGeometry(renderObject: RenderObject): void;
27
27
  updateAttributes(renderObject: RenderObject): void;
28
28
  updateAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, type: AttributeType): void;
29
+ getIndirect(renderObject: RenderObject): import("./IndirectStorageBufferAttribute.js").default | null;
29
30
  getIndex(renderObject: RenderObject): BufferAttribute | null;
30
31
  }
31
32
  export default Geometries;
@@ -0,0 +1,10 @@
1
+ import { TypedArray } from "../../core/BufferAttribute.js";
2
+ import StorageBufferAttribute from "./StorageBufferAttribute.js";
3
+
4
+ declare class IndirectStorageBufferAttribute extends StorageBufferAttribute {
5
+ readonly isIndirectStorageBufferAttribute: true;
6
+
7
+ constructor(array: TypedArray, itemSize: number);
8
+ }
9
+
10
+ export default IndirectStorageBufferAttribute;
@@ -0,0 +1,15 @@
1
+ import { Camera } from "../../cameras/Camera.js";
2
+ import { Object3D } from "../../core/Object3D.js";
3
+ import { Light } from "../../lights/Light.js";
4
+ import LightsNode from "../../nodes/lighting/LightsNode.js";
5
+ import ChainMap from "./ChainMap.js";
6
+
7
+ declare class Lighting extends ChainMap<[Object3D, Camera], LightsNode> {
8
+ constructor();
9
+
10
+ createNode(lights?: Light[]): LightsNode;
11
+
12
+ getNode(scene: Object3D, camera: Camera): LightsNode;
13
+ }
14
+
15
+ export default Lighting;
@@ -0,0 +1,66 @@
1
+ import { Camera } from "../../cameras/Camera.js";
2
+ import { ToneMapping } from "../../constants.js";
3
+ import { BufferGeometry, GeometryGroup } from "../../core/BufferGeometry.js";
4
+ import { Object3D } from "../../core/Object3D.js";
5
+ import { RenderTarget } from "../../core/RenderTarget.js";
6
+ import { Material } from "../../materials/Material.js";
7
+ import { Color } from "../../math/Color.js";
8
+ import MRTNode from "../../nodes/core/MRTNode.js";
9
+ import LightsNode from "../../nodes/lighting/LightsNode.js";
10
+ import { Scene } from "../../scenes/Scene.js";
11
+ import { CubeTexture } from "../../textures/CubeTexture.js";
12
+ import { Texture } from "../../textures/Texture.js";
13
+ import Color4 from "./Color4.js";
14
+ import Renderer from "./Renderer.js";
15
+
16
+ // renderer state
17
+
18
+ export interface RendererState {
19
+ toneMapping: ToneMapping;
20
+ toneMappingExposure: number;
21
+ outputColorSpace: string;
22
+ renderTarget: RenderTarget | null;
23
+ activeCubeFace: number;
24
+ activeMipmapLevel: number;
25
+ renderObjectFunction:
26
+ | ((
27
+ object: Object3D,
28
+ scene: Scene,
29
+ camera: Camera,
30
+ geometry: BufferGeometry,
31
+ material: Material,
32
+ group: GeometryGroup,
33
+ lightsNode: LightsNode,
34
+ ) => void)
35
+ | null;
36
+ pixelRatio: number;
37
+ mrt: MRTNode | null;
38
+ clearColor: Color4;
39
+ clearAlpha: number;
40
+ autoClear: boolean;
41
+ scissorTest: boolean;
42
+ }
43
+
44
+ export function saveRendererState(renderer: Renderer, state?: RendererState): RendererState;
45
+
46
+ export function resetRendererState(renderer: Renderer, state?: RendererState): RendererState;
47
+
48
+ export function restoreRendererState(renderer: Renderer, state: RendererState): void;
49
+
50
+ // renderer and scene state
51
+
52
+ export interface RendererAndSceneState extends RendererState {
53
+ background: Color | Texture | CubeTexture | null;
54
+ backgroundNode: Node | null | undefined;
55
+ overrideMaterial: Material | null;
56
+ }
57
+
58
+ export function saveRendererAndSceneState(
59
+ renderer: RendererState,
60
+ scene: Scene,
61
+ state?: RendererAndSceneState,
62
+ ): RendererAndSceneState;
63
+
64
+ export function resetRendererAndSceneState(renderer: Renderer, state?: RendererAndSceneState): RendererAndSceneState;
65
+
66
+ export function restoreRendererAndSceneState(renderer: Renderer, state: RendererAndSceneState): void;
@@ -1,11 +1,11 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { Object3D } from "../../core/Object3D.js";
2
+ import BundleGroup from "./BundleGroup.js";
3
3
  import ChainMap from "./ChainMap.js";
4
4
  import RenderBundle from "./RenderBundle.js";
5
5
  declare class RenderBundles {
6
- lists: ChainMap<readonly [Object3D, Camera], RenderBundle>;
6
+ lists: ChainMap<readonly [BundleGroup, Camera], RenderBundle>;
7
7
  constructor();
8
- get(scene: Object3D, camera: Camera): RenderBundle;
8
+ get(scene: BundleGroup, camera: Camera): RenderBundle;
9
9
  dispose(): void;
10
10
  }
11
11
  export default RenderBundles;
@@ -37,7 +37,7 @@ declare class RenderContext {
37
37
  activeMipmapLevel?: number | undefined;
38
38
  occlusionQueryCount?: number | undefined;
39
39
  constructor();
40
- getCacheKey(): string;
40
+ getCacheKey(): number;
41
41
  }
42
- export declare function getCacheKey(renderContext: RenderContext): string;
42
+ export declare function getCacheKey(renderContext: RenderContext): number;
43
43
  export default RenderContext;
@@ -4,8 +4,10 @@ import { Object3D } from "../../core/Object3D.js";
4
4
  import { Light } from "../../lights/Light.js";
5
5
  import { Material } from "../../materials/Material.js";
6
6
  import { LightsNode } from "../../nodes/Nodes.js";
7
+ import BundleGroup from "./BundleGroup.js";
8
+ import Lighting from "./Lighting.js";
7
9
  export interface Bundle {
8
- object: Object3D;
10
+ bundleGroup: BundleGroup;
9
11
  camera: Camera;
10
12
  renderList: RenderList;
11
13
  }
@@ -23,12 +25,15 @@ declare class RenderList {
23
25
  renderItems: RenderItem[];
24
26
  renderItemsIndex: number;
25
27
  opaque: RenderItem[];
28
+ transparentDoublePass: RenderItem[];
26
29
  transparent: RenderItem[];
27
30
  bundles: Bundle[];
28
31
  lightsNode: LightsNode;
29
32
  lightsArray: Light[];
33
+ scene: Object3D;
34
+ camera: Camera;
30
35
  occlusionQueryCount: number;
31
- constructor();
36
+ constructor(lighting: Lighting, scene: Object3D, camera: Camera);
32
37
  begin(): this;
33
38
  getNextRenderItem(
34
39
  object: Object3D,
@@ -56,7 +61,6 @@ declare class RenderList {
56
61
  ): void;
57
62
  pushBundle(group: Bundle): void;
58
63
  pushLight(light: Light): void;
59
- getLightsNode(): LightsNode;
60
64
  sort(
61
65
  customOpaqueSort: ((a: RenderItem, b: RenderItem) => number) | null,
62
66
  customTransparentSort: ((a: RenderItem, b: RenderItem) => number) | null,
@@ -1,10 +1,12 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
2
  import { Object3D } from "../../core/Object3D.js";
3
3
  import ChainMap from "./ChainMap.js";
4
+ import Lighting from "./Lighting.js";
4
5
  import RenderList from "./RenderList.js";
5
6
  declare class RenderLists {
7
+ lighting: Lighting;
6
8
  lists: ChainMap<readonly [Object3D, Camera], RenderList>;
7
- constructor();
9
+ constructor(lighting: Lighting);
8
10
  get(scene: Object3D, camera: Camera): RenderList;
9
11
  dispose(): void;
10
12
  }
@@ -5,9 +5,11 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js";
5
5
  import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js";
6
6
  import { Object3D } from "../../core/Object3D.js";
7
7
  import { Material } from "../../materials/Material.js";
8
+ import NodeMaterialObserver from "../../materials/nodes/manager/NodeMaterialObserver.js";
8
9
  import { LightsNode } from "../../nodes/Nodes.js";
9
10
  import { Scene } from "../../scenes/Scene.js";
10
11
  import BindGroup from "./BindGroup.js";
12
+ import BundleGroup from "./BundleGroup.js";
11
13
  import ClippingContext from "./ClippingContext.js";
12
14
  import Geometries from "./Geometries.js";
13
15
  import NodeBuilderState from "./nodes/NodeBuilderState.js";
@@ -35,12 +37,20 @@ export default class RenderObject {
35
37
  attributes: Array<BufferAttribute | InterleavedBufferAttribute> | null;
36
38
  pipeline: RenderPipeline | null;
37
39
  vertexBuffers: Array<BufferAttribute | InterleavedBuffer> | null;
40
+ drawParams: {
41
+ vertexCount: number;
42
+ firstVertex: number;
43
+ instanceCount: number;
44
+ firstInstance: number;
45
+ } | null;
46
+ bundle: BundleGroup | null;
38
47
  clippingContext: ClippingContext;
39
48
  clippingContextVersion: number;
40
49
  initialNodesCacheKey: string;
41
50
  initialCacheKey: string;
42
51
  _nodeBuilderState: NodeBuilderState | null;
43
52
  _bindings: BindGroup[] | null;
53
+ _monitor: NodeMaterialObserver | null;
44
54
  onDispose: (() => void) | null;
45
55
  readonly isRenderObject: true;
46
56
  onMaterialDispose: () => void;
@@ -58,8 +68,10 @@ export default class RenderObject {
58
68
  updateClipping(parent: ClippingContext): void;
59
69
  get clippingNeedsUpdate(): boolean;
60
70
  getNodeBuilderState(): NodeBuilderState;
71
+ getMonitor(): NodeMaterialObserver;
61
72
  getBindings(): BindGroup[];
62
73
  getIndex(): BufferAttribute | null;
74
+ getIndirect(): import("./IndirectStorageBufferAttribute.js").default | null;
63
75
  getChainArray(): readonly [
64
76
  Object3D<import("../../core/Object3D.js").Object3DEventMap>,
65
77
  Material,
@@ -68,7 +80,14 @@ export default class RenderObject {
68
80
  ];
69
81
  getAttributes(): (InterleavedBufferAttribute | BufferAttribute)[];
70
82
  getVertexBuffers(): (InterleavedBuffer | BufferAttribute)[] | null;
71
- getMaterialCacheKey(): string;
83
+ getDrawParameters(): {
84
+ vertexCount: number;
85
+ firstVertex: number;
86
+ instanceCount: number;
87
+ firstInstance: number;
88
+ } | null;
89
+ getGeometryCacheKey(): string;
90
+ getMaterialCacheKey(): number;
72
91
  get needsUpdate(): boolean;
73
92
  getDynamicCacheKey(): string;
74
93
  getCacheKey(): string;
@@ -1,5 +1,5 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { ColorSpace, ShadowMapType, ToneMapping } from "../../constants.js";
2
+ import { ShadowMapType, ToneMapping } from "../../constants.js";
3
3
  import { BufferAttribute } from "../../core/BufferAttribute.js";
4
4
  import { BufferGeometry, GeometryGroup } from "../../core/BufferGeometry.js";
5
5
  import { Object3D } from "../../core/Object3D.js";
@@ -24,6 +24,7 @@ import Bindings from "./Bindings.js";
24
24
  import Color4 from "./Color4.js";
25
25
  import Geometries from "./Geometries.js";
26
26
  import Info from "./Info.js";
27
+ import Lighting from "./Lighting.js";
27
28
  import NodeLibrary from "./nodes/NodeLibrary.js";
28
29
  import Nodes from "./nodes/Nodes.js";
29
30
  import Pipelines from "./Pipelines.js";
@@ -36,9 +37,23 @@ import RenderList, { Bundle, RenderItem } from "./RenderList.js";
36
37
  import RenderLists from "./RenderLists.js";
37
38
  import RenderObjects from "./RenderObjects.js";
38
39
  import Textures from "./Textures.js";
40
+ interface Rectangle {
41
+ x: number;
42
+ y: number;
43
+ z: number;
44
+ w: number;
45
+ }
46
+ interface DeviceLostInfo {
47
+ api: "WebGL" | "WebGPU";
48
+ message: string;
49
+ reason: string | null;
50
+ originalEvent: unknown;
51
+ }
39
52
  export interface RendererParameters {
40
53
  logarithmicDepthBuffer?: boolean | undefined;
41
54
  alpha?: boolean | undefined;
55
+ depth?: boolean | undefined;
56
+ stencil?: boolean | undefined;
42
57
  antialias?: boolean | undefined;
43
58
  samples?: number | undefined;
44
59
  getFallback?: ((error: unknown) => Backend) | null | undefined;
@@ -54,7 +69,7 @@ declare class Renderer {
54
69
  autoClearStencil: boolean;
55
70
  alpha: boolean;
56
71
  logarithmicDepthBuffer: boolean;
57
- outputColorSpace: ColorSpace;
72
+ outputColorSpace: string;
58
73
  toneMapping: ToneMapping;
59
74
  toneMappingExposure: number;
60
75
  sortObjects: boolean;
@@ -62,9 +77,8 @@ declare class Renderer {
62
77
  stencil: boolean;
63
78
  clippingPlanes: readonly Plane[];
64
79
  info: Info;
65
- nodes: {
66
- library: NodeLibrary;
67
- };
80
+ library: NodeLibrary;
81
+ lighting: Lighting;
68
82
  _getFallback: ((error: unknown) => Backend) | null;
69
83
  _pixelRatio: number;
70
84
  _width: number;
@@ -128,6 +142,8 @@ declare class Renderer {
128
142
  group: GeometryGroup,
129
143
  passId?: string,
130
144
  ) => void;
145
+ _isDeviceLost: boolean;
146
+ onDeviceLost: (info: DeviceLostInfo) => void;
131
147
  _initialized: boolean;
132
148
  _initPromise: Promise<void> | null;
133
149
  _compilationPromises: Promise<void>[] | null;
@@ -161,12 +177,14 @@ declare class Renderer {
161
177
  get coordinateSystem(): import("../../constants.js").CoordinateSystem;
162
178
  compileAsync(scene: Object3D, camera: Camera, targetScene?: Object3D | null): Promise<void>;
163
179
  renderAsync(scene: Scene, camera: Camera): Promise<void>;
180
+ waitForGPU(): Promise<void>;
164
181
  setMRT(mrt: MRTNode | null): this;
165
182
  getMRT(): MRTNode | null;
183
+ _onDeviceLost(info: DeviceLostInfo): void;
166
184
  _renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void;
167
185
  render(scene: Scene, camera: Camera): Promise<void> | undefined;
168
186
  _getFrameBufferTarget(): RenderTarget<Texture> | null;
169
- _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext;
187
+ _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
170
188
  getMaxAnisotropy(): number;
171
189
  getActiveCubeFace(): number;
172
190
  getActiveMipmapLevel(): number;
@@ -207,7 +225,7 @@ declare class Renderer {
207
225
  clearDepthAsync(): Promise<void>;
208
226
  clearStencilAsync(): Promise<void>;
209
227
  get currentToneMapping(): ToneMapping;
210
- get currentColorSpace(): ColorSpace;
228
+ get currentColorSpace(): string;
211
229
  dispose(): void;
212
230
  setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void;
213
231
  getRenderTarget(): RenderTarget<Texture> | null;
@@ -235,10 +253,11 @@ declare class Renderer {
235
253
  lightsNode: LightsNode,
236
254
  ) => void)
237
255
  | null;
256
+ compute(computeNodes: ComputeNode | ComputeNode[]): Promise<void> | undefined;
238
257
  computeAsync(computeNodes: ComputeNode | ComputeNode[]): Promise<void>;
239
258
  hasFeatureAsync(name: string): Promise<void>;
240
259
  hasFeature(name: string): false | void;
241
- copyFramebufferToTexture(framebufferTexture: FramebufferTexture): void;
260
+ copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: Rectangle | null): void;
242
261
  copyTextureToTexture(
243
262
  srcTexture: Texture,
244
263
  dstTexture: Texture,
@@ -253,10 +272,24 @@ declare class Renderer {
253
272
  width: number,
254
273
  height: number,
255
274
  index?: number,
275
+ faceIndex?: number,
256
276
  ): Promise<import("../../core/BufferAttribute.js").TypedArray>;
257
277
  _projectObject(object: Object3D, camera: Camera, groupOrder: number, renderList: RenderList): void;
258
278
  _renderBundles(bundles: Bundle[], sceneRef: Scene, lightsNode: LightsNode): void;
259
- _renderObjects(renderList: RenderItem[], camera: Camera, scene: Scene, lightsNode: LightsNode): void;
279
+ _renderTransparents(
280
+ renderList: RenderItem[],
281
+ doublePassList: RenderItem[],
282
+ camera: Camera,
283
+ scene: Scene,
284
+ lightsNode: LightsNode,
285
+ ): void;
286
+ _renderObjects(
287
+ renderList: RenderItem[],
288
+ camera: Camera,
289
+ scene: Scene,
290
+ lightsNode: LightsNode,
291
+ passId?: string | null,
292
+ ): void;
260
293
  renderObject(
261
294
  object: Object3D,
262
295
  scene: Scene,
@@ -265,6 +298,7 @@ declare class Renderer {
265
298
  material: Material,
266
299
  group: GeometryGroup,
267
300
  lightsNode: LightsNode,
301
+ passId?: string | null,
268
302
  ): void;
269
303
  _renderObjectDirect(
270
304
  object: Object3D,
@@ -283,7 +317,6 @@ declare class Renderer {
283
317
  lightsNode: LightsNode,
284
318
  passId?: string,
285
319
  ): void;
286
- get compute(): (computeNodes: ComputeNode | ComputeNode[]) => Promise<void>;
287
320
  get compile(): (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<void>;
288
321
  }
289
322
  export default Renderer;
@@ -2,8 +2,12 @@ import { RenderTarget } from "../../../core/RenderTarget.js";
2
2
  import { Scene } from "../../../scenes/Scene.js";
3
3
  import Renderer from "../Renderer.js";
4
4
 
5
- export default class PMREMGenerator {
5
+ declare class PMREMGenerator {
6
6
  constructor(renderer: Renderer);
7
7
 
8
8
  fromScene(scene: Scene, sigma?: number, near?: number, far?: number): RenderTarget;
9
+
10
+ dispose(): void;
9
11
  }
12
+
13
+ export default PMREMGenerator;
@@ -1,3 +1,4 @@
1
+ import NodeMaterialObserver from "../../../materials/nodes/manager/NodeMaterialObserver.js";
1
2
  import Node from "../../../nodes/core/Node.js";
2
3
  import NodeAttribute from "../../../nodes/core/NodeAttribute.js";
3
4
  import BindGroup from "../BindGroup.js";
@@ -11,7 +12,7 @@ declare class NodeBuilderState {
11
12
  updateNodes: Node[];
12
13
  updateBeforeNodes: Node[];
13
14
  updateAfterNodes: Node[];
14
- instanceBindGroups: boolean;
15
+ monitor: NodeMaterialObserver;
15
16
  usedTimes: number;
16
17
  constructor(
17
18
  vertexShader: string | null,
@@ -22,7 +23,7 @@ declare class NodeBuilderState {
22
23
  updateNodes: Node[],
23
24
  updateBeforeNodes: Node[],
24
25
  updateAfterNodes: Node[],
25
- instanceBindGroups?: boolean,
26
+ monitor: NodeMaterialObserver,
26
27
  transforms?: never[],
27
28
  );
28
29
  createBindings(): BindGroup[];
@@ -3,7 +3,6 @@ import { Light } from "../../../lights/Light.js";
3
3
  import { Material } from "../../../materials/Material.js";
4
4
  import NodeMaterial from "../../../materials/nodes/NodeMaterial.js";
5
5
  import Node from "../../../nodes/core/Node.js";
6
- import { ColorSpaceMethod } from "../../../nodes/display/ColorSpaceNode.js";
7
6
  import AnalyticLightNode from "../../../nodes/lighting/AnalyticLightNode.js";
8
7
  import { NodeRepresentation, ShaderNodeObject } from "../../../nodes/tsl/TSLCore.js";
9
8
  declare class NodeLibrary {
@@ -19,14 +18,8 @@ declare class NodeLibrary {
19
18
  ToneMapping,
20
19
  (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>
21
20
  >;
22
- colorSpaceNodes: Map<ColorSpaceMethod, (color: NodeRepresentation) => ShaderNodeObject<Node>>;
23
21
  constructor();
24
22
  fromMaterial(material: Material): Material | null;
25
- addColorSpace(
26
- colorSpaceNode: (color: NodeRepresentation) => ShaderNodeObject<Node>,
27
- colorSpace: ColorSpaceMethod,
28
- ): void;
29
- getColorSpaceFunction(colorSpace: ColorSpaceMethod): ((color: NodeRepresentation) => ShaderNodeObject<Node>) | null;
30
23
  addToneMapping(
31
24
  toneMappingNode: (color: NodeRepresentation, exposure: NodeRepresentation) => ShaderNodeObject<Node>,
32
25
  toneMapping: ToneMapping,
@@ -39,6 +39,13 @@ interface SceneData {
39
39
  environment?: Texture | undefined;
40
40
  environmentNode?: Node | undefined;
41
41
  }
42
+ declare module "../../../scenes/Scene.js" {
43
+ interface Scene {
44
+ environmentNode?: Node | null | undefined;
45
+ backgroundNode?: Node | null | undefined;
46
+ fogNode?: Node | null | undefined;
47
+ }
48
+ }
42
49
  declare class Nodes extends DataMap<{
43
50
  nodeUniformsGroup: {
44
51
  key: NodeUniformsGroup;
@@ -101,6 +108,7 @@ declare class Nodes extends DataMap<{
101
108
  updateAfter(renderObject: RenderObject): void;
102
109
  updateForCompute(computeNode: ComputeNode): void;
103
110
  updateForRender(renderObject: RenderObject): void;
111
+ needsRefresh(renderObject: RenderObject): boolean;
104
112
  dispose(): void;
105
113
  }
106
114
  export default Nodes;
@@ -1,8 +1,20 @@
1
1
  import { PixelFormat, TextureDataType } from "../../constants.js";
2
2
 
3
3
  export interface WebGLCapabilitiesParameters {
4
+ /**
5
+ * shader precision. Can be "highp", "mediump" or "lowp".
6
+ */
4
7
  precision?: string | undefined;
8
+
9
+ /**
10
+ * default is false.
11
+ */
5
12
  logarithmicDepthBuffer?: boolean | undefined;
13
+
14
+ /**
15
+ * default is false.
16
+ */
17
+ reverseDepthBuffer?: boolean | undefined;
6
18
  }
7
19
 
8
20
  export class WebGLCapabilities {
@@ -18,6 +30,7 @@ export class WebGLCapabilities {
18
30
 
19
31
  precision: string;
20
32
  logarithmicDepthBuffer: boolean;
33
+ reverseDepthBuffer: boolean;
21
34
 
22
35
  maxTextures: number;
23
36
  maxVertexTextures: number;