@types/three 0.169.0 → 0.171.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 (194) hide show
  1. three/README.md +1 -1
  2. three/build/three.core.d.ts +1 -0
  3. three/build/three.core.min.d.ts +1 -0
  4. three/build/three.tsl.d.ts +1 -0
  5. three/build/three.tsl.min.d.ts +1 -0
  6. three/examples/jsm/Addons.d.ts +3 -3
  7. three/examples/jsm/animation/MMDAnimationHelper.d.ts +4 -0
  8. three/examples/jsm/animation/MMDPhysics.d.ts +4 -0
  9. three/examples/jsm/controls/ArcballControls.d.ts +6 -1
  10. three/examples/jsm/controls/TransformControls.d.ts +45 -1
  11. three/examples/jsm/csm/CSMFrustum.d.ts +8 -2
  12. three/examples/jsm/csm/CSMHelper.d.ts +2 -1
  13. three/examples/jsm/csm/CSMShadowNode.d.ts +45 -0
  14. three/examples/jsm/curves/NURBSCurve.d.ts +12 -1
  15. three/examples/jsm/exporters/GLTFExporter.d.ts +43 -10
  16. three/examples/jsm/exporters/MMDExporter.d.ts +4 -0
  17. three/examples/jsm/exporters/USDZExporter.d.ts +4 -0
  18. three/examples/jsm/geometries/DecalGeometry.d.ts +10 -4
  19. three/examples/jsm/geometries/TeapotGeometry.d.ts +2 -2
  20. three/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
  21. three/examples/jsm/lighting/TiledLighting.d.ts +10 -0
  22. three/examples/jsm/lines/Wireframe.d.ts +5 -2
  23. three/examples/jsm/lines/WireframeGeometry2.d.ts +1 -1
  24. three/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
  25. three/examples/jsm/loaders/EXRLoader.d.ts +2 -2
  26. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -2
  27. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -0
  28. three/examples/jsm/loaders/LDrawLoader.d.ts +10 -0
  29. three/examples/jsm/loaders/MMDLoader.d.ts +4 -0
  30. three/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
  31. three/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
  32. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +0 -1
  33. three/examples/jsm/math/ColorSpaces.d.ts +11 -0
  34. three/examples/jsm/misc/ProgressiveLightMap.d.ts +8 -10
  35. three/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
  36. three/examples/jsm/objects/SkyMesh.d.ts +2 -2
  37. three/examples/jsm/objects/Water2Mesh.d.ts +13 -2
  38. three/examples/jsm/objects/WaterMesh.d.ts +11 -2
  39. three/examples/jsm/renderers/SVGRenderer.d.ts +2 -2
  40. three/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.d.ts +2 -5
  41. three/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.d.ts +2 -3
  42. three/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.d.ts +2 -4
  43. three/examples/jsm/tsl/display/BleachBypass.d.ts +4 -0
  44. three/{src/nodes → examples/jsm/tsl}/display/BloomNode.d.ts +2 -5
  45. three/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.d.ts +3 -8
  46. three/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.d.ts +2 -5
  47. three/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.d.ts +2 -5
  48. three/{src/nodes → examples/jsm/tsl}/display/FXAANode.d.ts +2 -3
  49. three/{src/nodes → examples/jsm/tsl}/display/FilmNode.d.ts +2 -3
  50. three/{src/nodes → examples/jsm/tsl}/display/GTAONode.d.ts +5 -14
  51. three/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.d.ts +13 -5
  52. three/examples/jsm/tsl/display/LensflareNode.d.ts +35 -0
  53. three/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.d.ts +2 -6
  54. three/{src/nodes → examples/jsm/tsl}/display/MotionBlur.d.ts +2 -2
  55. three/examples/jsm/tsl/display/OutlineNode.d.ts +32 -0
  56. three/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.d.ts +2 -3
  57. three/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.d.ts +2 -5
  58. three/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.d.ts +2 -4
  59. three/examples/jsm/tsl/display/SMAANode.d.ts +18 -0
  60. three/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.d.ts +2 -7
  61. three/examples/jsm/tsl/display/SSRNode.d.ts +38 -0
  62. three/examples/jsm/tsl/display/Sepia.d.ts +4 -0
  63. three/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.d.ts +2 -3
  64. three/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.d.ts +1 -5
  65. three/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.d.ts +2 -5
  66. three/examples/jsm/tsl/display/TRAAPassNode.d.ts +15 -0
  67. three/{src/nodes → examples/jsm/tsl}/display/TransitionNode.d.ts +2 -5
  68. three/examples/jsm/tsl/display/hashBlur.d.ts +8 -0
  69. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +23 -0
  70. three/package.json +5 -4
  71. three/src/Three.Core.d.ts +158 -0
  72. three/src/Three.TSL.d.ts +528 -0
  73. three/src/Three.WebGPU.Nodes.d.ts +15 -192
  74. three/src/Three.WebGPU.d.ts +14 -192
  75. three/src/Three.d.ts +3 -164
  76. three/src/animation/AnimationClip.d.ts +3 -1
  77. three/src/constants.d.ts +1 -9
  78. three/src/core/BufferGeometry.d.ts +13 -2
  79. three/src/core/Clock.d.ts +4 -6
  80. three/src/core/InterleavedBuffer.d.ts +12 -0
  81. three/src/core/RenderTarget.d.ts +1 -2
  82. three/src/loaders/FileLoader.d.ts +3 -3
  83. three/src/materials/LineBasicMaterial.d.ts +0 -5
  84. three/src/materials/LineDashedMaterial.d.ts +0 -5
  85. three/src/materials/Material.d.ts +6 -6
  86. three/src/materials/MeshBasicMaterial.d.ts +0 -5
  87. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  88. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  89. three/src/materials/MeshLambertMaterial.d.ts +0 -5
  90. three/src/materials/MeshMatcapMaterial.d.ts +0 -5
  91. three/src/materials/MeshNormalMaterial.d.ts +0 -5
  92. three/src/materials/MeshPhongMaterial.d.ts +0 -5
  93. three/src/materials/MeshPhysicalMaterial.d.ts +0 -5
  94. three/src/materials/MeshStandardMaterial.d.ts +0 -5
  95. three/src/materials/MeshToonMaterial.d.ts +0 -5
  96. three/src/materials/PointsMaterial.d.ts +0 -5
  97. three/src/materials/RawShaderMaterial.d.ts +0 -2
  98. three/src/materials/ShaderMaterial.d.ts +0 -5
  99. three/src/materials/ShadowMaterial.d.ts +0 -5
  100. three/src/materials/SpriteMaterial.d.ts +0 -5
  101. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +3 -0
  102. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +2 -2
  103. three/src/materials/nodes/NodeMaterial.d.ts +6 -1
  104. three/src/materials/nodes/NodeMaterials.d.ts +19 -16
  105. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +15 -0
  106. three/src/math/Color.d.ts +39 -22
  107. three/src/math/ColorManagement.d.ts +24 -24
  108. three/src/math/Vector4.d.ts +2 -0
  109. three/src/nodes/Nodes.d.ts +2 -22
  110. three/src/nodes/TSL.d.ts +14 -26
  111. three/src/nodes/accessors/Arrays.d.ts +6 -0
  112. three/src/nodes/accessors/BuiltinNode.d.ts +14 -0
  113. three/src/nodes/accessors/Camera.d.ts +0 -1
  114. three/src/nodes/accessors/ClippingNode.d.ts +6 -0
  115. three/src/nodes/accessors/InstanceNode.d.ts +15 -3
  116. three/src/nodes/accessors/InstancedMeshNode.d.ts +11 -0
  117. three/src/nodes/accessors/Lights.d.ts +15 -0
  118. three/src/nodes/accessors/SceneNode.d.ts +2 -0
  119. three/src/nodes/accessors/StorageBufferNode.d.ts +20 -11
  120. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -3
  121. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -2
  122. three/src/nodes/accessors/VelocityNode.d.ts +4 -0
  123. three/src/nodes/code/ScriptableNode.d.ts +1 -1
  124. three/src/nodes/core/IndexNode.d.ts +2 -0
  125. three/src/nodes/core/NodeUtils.d.ts +7 -0
  126. three/src/nodes/core/StackNode.d.ts +10 -5
  127. three/src/nodes/core/VarNode.d.ts +12 -1
  128. three/src/nodes/core/constants.d.ts +6 -0
  129. three/src/nodes/display/BlendModes.d.ts +32 -0
  130. three/src/nodes/display/ColorAdjustment.d.ts +29 -0
  131. three/src/nodes/display/ColorSpaceFunctions.d.ts +2 -2
  132. three/src/nodes/display/ColorSpaceNode.d.ts +14 -8
  133. three/src/nodes/display/RenderOutputNode.d.ts +4 -4
  134. three/src/nodes/display/ScreenNode.d.ts +5 -0
  135. three/src/nodes/display/ViewportDepthNode.d.ts +4 -0
  136. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +6 -0
  137. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +10 -0
  138. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +88 -0
  139. three/src/nodes/gpgpu/BarrierNode.d.ts +12 -0
  140. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +13 -0
  141. three/src/nodes/gpgpu/ComputeNode.d.ts +5 -0
  142. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +17 -0
  143. three/src/nodes/lighting/AnalyticLightNode.d.ts +11 -0
  144. three/src/nodes/lighting/LightsNode.d.ts +7 -2
  145. three/src/nodes/lighting/PointLightNode.d.ts +14 -1
  146. three/src/nodes/lighting/PointShadowNode.d.ts +30 -0
  147. three/src/nodes/lighting/ShadowNode.d.ts +35 -0
  148. three/src/nodes/math/OperatorNode.d.ts +3 -0
  149. three/src/nodes/tsl/TSLBase.d.ts +5 -0
  150. three/src/nodes/tsl/TSLCore.d.ts +3 -0
  151. three/src/nodes/utils/Discard.d.ts +1 -1
  152. three/src/nodes/utils/Oscillators.d.ts +7 -0
  153. three/src/nodes/utils/PostProcessingUtils.d.ts +45 -0
  154. three/src/nodes/utils/ReflectorNode.d.ts +17 -4
  155. three/src/nodes/utils/SplitNode.d.ts +1 -1
  156. three/src/nodes/utils/Timer.d.ts +21 -0
  157. three/src/objects/BatchedMesh.d.ts +51 -6
  158. three/src/objects/ClippingGroup.d.ts +41 -0
  159. three/src/renderers/WebGLRenderer.d.ts +24 -11
  160. three/src/renderers/common/Animation.d.ts +11 -4
  161. three/src/renderers/common/ClippingContext.d.ts +16 -14
  162. three/src/renderers/common/Constants.d.ts +2 -1
  163. three/src/renderers/common/Geometries.d.ts +1 -0
  164. three/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
  165. three/src/renderers/common/Lighting.d.ts +15 -0
  166. three/src/renderers/common/PostProcessingUtils.d.ts +66 -0
  167. three/src/renderers/common/RenderList.d.ts +10 -2
  168. three/src/renderers/common/RenderLists.d.ts +3 -1
  169. three/src/renderers/common/RenderObject.d.ts +9 -4
  170. three/src/renderers/common/RenderObjects.d.ts +3 -0
  171. three/src/renderers/common/Renderer.d.ts +49 -10
  172. three/src/renderers/common/UniformsGroup.d.ts +1 -0
  173. three/src/renderers/common/extras/PMREMGenerator.d.ts +20 -2
  174. three/src/renderers/common/nodes/NodeLibrary.d.ts +2 -11
  175. three/src/renderers/common/nodes/NodeUniform.d.ts +7 -0
  176. three/src/renderers/webgl/WebGLPrograms.d.ts +3 -10
  177. three/src/renderers/webgl/WebGLState.d.ts +14 -11
  178. three/src/renderers/webgl/WebGLUtils.d.ts +2 -2
  179. three/src/textures/CompressedTexture.d.ts +1 -2
  180. three/src/textures/CubeTexture.d.ts +1 -2
  181. three/src/textures/Data3DTexture.d.ts +4 -2
  182. three/src/textures/DataArrayTexture.d.ts +1 -1
  183. three/src/textures/DataTexture.d.ts +7 -3
  184. three/src/textures/Texture.d.ts +3 -4
  185. three/examples/jsm/cameras/CinematicCamera.d.ts +0 -34
  186. three/src/nodes/display/BleachBypass.d.ts +0 -4
  187. three/src/nodes/display/BlendMode.d.ts +0 -10
  188. three/src/nodes/display/Sepia.d.ts +0 -4
  189. three/src/nodes/lighting/LightNode.d.ts +0 -18
  190. three/src/nodes/utils/OscNode.d.ts +0 -25
  191. three/src/nodes/utils/TimerNode.d.ts +0 -25
  192. three/src/textures/types.d.ts +0 -9
  193. /three/examples/jsm/utils/{TextureUtils.d.ts → WebGLTextureUtils.d.ts} +0 -0
  194. /three/examples/jsm/utils/{TextureUtilsGPU.d.ts → WebGPUTextureUtils.d.ts} +0 -0
@@ -172,6 +172,8 @@ type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends
172
172
 
173
173
  export type NodeOrType = Node | string;
174
174
 
175
+ export const defined: (v: unknown) => unknown;
176
+
175
177
  export const getConstNodeType: (value: NodeOrType) => string | null;
176
178
 
177
179
  export class ShaderNode<T = {}, R extends Node = Node> {
@@ -271,3 +273,4 @@ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<Arr
271
273
 
272
274
  export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
273
275
  export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
276
+ export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
@@ -1,7 +1,7 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export const Discard: (conditional: NodeRepresentation) => ShaderNodeObject<Node>;
4
+ export const Discard: (conditional?: NodeRepresentation) => ShaderNodeObject<Node>;
5
5
  export const Return: () => ShaderNodeObject<Node>;
6
6
 
7
7
  declare module "../tsl/TSLCore.js" {
@@ -0,0 +1,7 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const oscSine: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
5
+ export const oscSquare: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
6
+ export const oscTriangle: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
7
+ export const oscSawtooth: (timeNode?: NodeRepresentation) => ShaderNodeObject<Node>;
@@ -0,0 +1,45 @@
1
+ import Node from "../core/Node.js";
2
+ import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ /**
5
+ * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments
6
+ * depth value and the camera's inverse projection matrix.
7
+ *
8
+ * @param {vec2} screenPosition - The fragment's screen position expressed as uv coordinates.
9
+ * @param {float} depth - The fragment's depth value.
10
+ * @param {mat4} projectionMatrixInverse - The camera's inverse projection matrix.
11
+ * @return {vec3} The fragments position in view space.
12
+ */
13
+ export const getViewPosition: (
14
+ screenPosition: NodeRepresentation,
15
+ depth: NodeRepresentation,
16
+ projectionMatrixInverse: NodeRepresentation,
17
+ ) => ShaderNodeObject<Node>;
18
+
19
+ /**
20
+ * Computes a screen position expressed as uv coordinates based on a fragment's position in view space and the camera's
21
+ * projection matrix
22
+ *
23
+ * @param {vec3} viewPosition - The fragments position in view space.
24
+ * @param {mat4} projectionMatrix - The camera's projection matrix.
25
+ * @return {vec2} The fragment's screen position expressed as uv coordinates.
26
+ */
27
+ export const getScreenPosition: (
28
+ viewPosition: NodeRepresentation,
29
+ projectionMatrix: NodeRepresentation,
30
+ ) => ShaderNodeObject<Node>;
31
+
32
+ /**
33
+ * Computes a normal vector based on depth data. Can be used as a fallback when no normal render target is available or
34
+ * if flat surface normals are required.
35
+ *
36
+ * @param {vec2} uv - The texture coordinate.
37
+ * @param {DepthTexture} depthTexture - The depth texture.
38
+ * @param {mat4} projectionMatrixInverse - The camera's inverse projection matrix.
39
+ * @return {vec3} The computed normal vector.
40
+ */
41
+ export const getNormalFromDepth: (
42
+ uv: NodeRepresentation,
43
+ depthTexture: NodeRepresentation,
44
+ projectionMatrixInverse: NodeRepresentation,
45
+ ) => ShaderNodeObject<Node>;
@@ -2,6 +2,7 @@ import { Camera } from "../../cameras/Camera.js";
2
2
  import { Object3D } from "../../core/Object3D.js";
3
3
  import { RenderTarget } from "../../core/RenderTarget.js";
4
4
  import TextureNode from "../accessors/TextureNode.js";
5
+ import Node from "../core/Node.js";
5
6
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
7
 
7
8
  export interface ReflectorNodeParameters {
@@ -11,7 +12,19 @@ export interface ReflectorNodeParameters {
11
12
  bounces?: boolean | undefined;
12
13
  }
13
14
 
14
- export default class ReflectorNode extends TextureNode {
15
+ declare class ReflectorNode extends TextureNode {
16
+ constructor(parameters?: ReflectorNodeParameters);
17
+
18
+ get reflector(): ReflectorBaseNode;
19
+
20
+ get target(): Object3D;
21
+
22
+ getDepthNode(): ShaderNodeObject<ReflectorNode>;
23
+ }
24
+
25
+ declare class ReflectorBaseNode extends Node {
26
+ textureNode: TextureNode;
27
+
15
28
  target: Object3D;
16
29
  resolution: number;
17
30
  generateMipmaps: boolean;
@@ -20,9 +33,7 @@ export default class ReflectorNode extends TextureNode {
20
33
  virtualCameras: WeakMap<Camera, Camera>;
21
34
  renderTargets: WeakMap<Camera, RenderTarget>;
22
35
 
23
- constructor(parameters?: ReflectorNodeParameters);
24
-
25
- getTextureNode(): TextureNode;
36
+ constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
26
37
 
27
38
  getVirtualCamera(camera: Camera): Camera;
28
39
 
@@ -30,3 +41,5 @@ export default class ReflectorNode extends TextureNode {
30
41
  }
31
42
 
32
43
  export const reflector: (parameters?: ReflectorNodeParameters) => ShaderNodeObject<ReflectorNode>;
44
+
45
+ export default ReflectorNode;
@@ -1,7 +1,6 @@
1
1
  import Node from "../core/Node.js";
2
2
  import { SwizzleOption } from "../tsl/TSLCore.js";
3
3
 
4
- /** swizzle node */
5
4
  export default class SplitNode extends Node {
6
5
  node: Node;
7
6
  components: string;
@@ -11,5 +10,6 @@ export default class SplitNode extends Node {
11
10
  * @param components swizzle like string, default = "x"
12
11
  */
13
12
  constructor(node: Node, components?: SwizzleOption);
13
+
14
14
  getVectorLength(): number;
15
15
  }
@@ -0,0 +1,21 @@
1
+ import Node from "../core/Node.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
+
4
+ export const time: ShaderNodeObject<Node>;
5
+ export const deltaTime: ShaderNodeObject<Node>;
6
+ export const frameId: ShaderNodeObject<Node>;
7
+
8
+ /**
9
+ * @deprecated Use "time" instead.
10
+ */
11
+ export const timerLocal: (timeScale?: number) => ShaderNodeObject<Node>;
12
+
13
+ /**
14
+ * @deprecated Use "time" instead.
15
+ */
16
+ export const timerGlobal: (timeScale?: number) => ShaderNodeObject<Node>;
17
+
18
+ /**
19
+ * @deprecated Use "deltaTime" instead.
20
+ */
21
+ export const timerDelta: (timeScale?: number) => ShaderNodeObject<Node>;
@@ -7,11 +7,22 @@ import { Matrix4 } from "../math/Matrix4.js";
7
7
  import { Sphere } from "../math/Sphere.js";
8
8
  import { Mesh } from "./Mesh.js";
9
9
 
10
+ export interface BatchedMeshGeometryRange {
11
+ vertexStart: number;
12
+ vertexCount: number;
13
+ reservedVertexCount: number;
14
+ indexStart: number;
15
+ indexCount: number;
16
+ reservedIndexCount: number;
17
+ start: number;
18
+ count: number;
19
+ }
20
+
10
21
  /**
11
- * A special version of {@link Mesh} with multi draw batch rendering support. Use {@link BatchedMesh} if you have to
12
- * render a large number of objects with the same material but with different world transformations. The usage of
13
- * {@link BatchedMesh} will help you to reduce the number of draw calls and thus improve the overall rendering
14
- * performance in your application.
22
+ * A special version of {@link Mesh} with multi draw batch rendering support. Use BatchedMesh if you have to render a
23
+ * large number of objects with the same material but with different geometries or world transformations. The usage of
24
+ * BatchedMesh will help you to reduce the number of draw calls and thus improve the overall rendering performance in
25
+ * your application.
15
26
  *
16
27
  * If the {@link https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw WEBGL_multi_draw extension} is not
17
28
  * supported then a less performant fallback is used.
@@ -80,6 +91,12 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
80
91
  */
81
92
  get maxInstanceCount(): number;
82
93
 
94
+ get instanceCount(): number;
95
+
96
+ get unusedVertexCount(): number;
97
+
98
+ get unusedIndexCount(): number;
99
+
83
100
  /**
84
101
  * Read-only flag to check if a given object is of type {@link BatchedMesh}.
85
102
  */
@@ -151,8 +168,8 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
151
168
  */
152
169
  getGeometryRangeAt(
153
170
  geometryId: number,
154
- target?: { start: number; count: number },
155
- ): { start: number; count: number } | null;
171
+ target?: BatchedMeshGeometryRange,
172
+ ): BatchedMeshGeometryRange | null;
156
173
 
157
174
  /**
158
175
  * Get the geometryIndex of the defined instance.
@@ -208,6 +225,12 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
208
225
  */
209
226
  addInstance(geometryId: number): number;
210
227
 
228
+ /**
229
+ * @param geometryId The id of a geometry to remove from the [name] that was previously added via "addGeometry". Any
230
+ * instances referencing this geometry will also be removed as a side effect.
231
+ */
232
+ deleteGeometry(geometryId: number): this;
233
+
211
234
  /**
212
235
  * Removes an existing instance from the BatchedMesh using the given instanceId.
213
236
  * @param instanceId The id of an instance to remove from the BatchedMesh that was previously added via
@@ -223,6 +246,28 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
223
246
  */
224
247
  setGeometryAt(geometryId: number, geometry: BufferGeometry): number;
225
248
 
249
+ /**
250
+ * Repacks the sub geometries in [name] to remove any unused space remaining from previously deleted geometry,
251
+ * freeing up space to add new geometry.
252
+ */
253
+ optimize(): this;
254
+
255
+ /**
256
+ * Resizes the available space in BatchedMesh's vertex and index buffer attributes to the provided sizes. If the
257
+ * provided arguments shrink the geometry buffers but there is not enough unused space at the end of the geometry
258
+ * attributes then an error is thrown.
259
+ * @param maxVertexCount the max number of vertices to be used by all unique geometries to resize to.
260
+ * @param maxIndexCount the max number of indices to be used by all unique geometries to resize to.
261
+ */
262
+ setGeometrySize(maxVertexCount: number, maxIndexCount: number): void;
263
+
264
+ /**
265
+ * Resizes the necessary buffers to support the provided number of instances. If the provided arguments shrink the
266
+ * number of instances but there are not enough unused ids at the end of the list then an error is thrown.
267
+ * @param maxInstanceCount the max number of individual instances that can be added and rendered by the BatchedMesh.
268
+ */
269
+ setInstanceCount(maxInstanceCount: number): void;
270
+
226
271
  getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null;
227
272
  getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null;
228
273
  }
@@ -0,0 +1,41 @@
1
+ import { Plane } from "../math/Plane.js";
2
+ import { Group } from "./Group.js";
3
+
4
+ /**
5
+ * A special version of the Group object that defines clipping planes for decendant objects. ClippingGroups can be
6
+ * nested, with clipping planes accumulating by type: intersection or union.
7
+ */
8
+ declare class ClippingGroup extends Group {
9
+ /**
10
+ * Read-only flag to check if a given object is of type ClippingGroup.
11
+ */
12
+ readonly isClippingGroup: true;
13
+
14
+ /**
15
+ * User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects
16
+ * that are children of this ClippingGroup. Points in space whose signed distance to the plane is negative are
17
+ * clipped (not rendered). See the webgpu_clipping example. Default is `[]`.
18
+ */
19
+ clippingPlanes: Plane[];
20
+
21
+ /**
22
+ * Determines if the clipping planes defined by this object are applied. Default is `true`.
23
+ */
24
+ enabled: boolean;
25
+
26
+ /**
27
+ * Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
28
+ * Default is `false`.
29
+ */
30
+ clipIntersection: boolean;
31
+
32
+ /**
33
+ * Defines whether to clip shadows according to the clipping planes specified by this ClippingGroup. Default is
34
+ * `false`.
35
+ */
36
+ clipShadows: boolean;
37
+
38
+ constructor();
39
+ }
40
+
41
+ export { ClippingGroup };
@@ -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";
@@ -74,7 +74,7 @@ export interface WebGLRendererParameters extends WebGLCapabilitiesParameters {
74
74
  /**
75
75
  * Can be "high-performance", "low-power" or "default"
76
76
  */
77
- powerPreference?: string | undefined;
77
+ powerPreference?: WebGLPowerPreference | undefined;
78
78
 
79
79
  /**
80
80
  * default is true.
@@ -183,8 +183,8 @@ export class WebGLRenderer implements Renderer {
183
183
  * {@link SRGBColorSpace} and {@link LinearSRGBColorSpace}.
184
184
  * @default THREE.SRGBColorSpace.
185
185
  */
186
- get outputColorSpace(): ColorSpace;
187
- set outputColorSpace(colorSpace: ColorSpace);
186
+ get outputColorSpace(): string;
187
+ set outputColorSpace(colorSpace: string);
188
188
 
189
189
  get coordinateSystem(): typeof WebGLCoordinateSystem;
190
190
 
@@ -431,26 +431,39 @@ export class WebGLRenderer implements Renderer {
431
431
  copyFramebufferToTexture(texture: Texture, position?: Vector2 | null, level?: number): void;
432
432
 
433
433
  /**
434
- * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
435
- * 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}().
436
442
  *
437
443
  * @param srcTexture Specifies the source texture.
438
444
  * @param dstTexture Specifies the destination texture.
439
445
  * @param srcRegion Specifies the bounds
440
446
  * @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
441
- * @param level Specifies the destination mipmap level of the texture.
447
+ * @param srcLevel Specifies the source mipmap level of the texture.
448
+ * @param dstLevel Specifies the destination mipmap level of the texture.
442
449
  */
443
450
  copyTextureToTexture(
444
451
  srcTexture: Texture,
445
452
  dstTexture: Texture,
446
- srcRegion?: Box2 | null,
447
- dstPosition?: Vector2 | null,
448
- level?: number,
453
+ srcRegion?: Box2 | Box3 | null,
454
+ dstPosition?: Vector2 | Vector3 | null,
455
+ srcLevel?: number,
456
+ dstLevel?: number,
449
457
  ): void;
450
458
 
451
459
  /**
460
+ * @deprecated Use "copyTextureToTexture" instead.
461
+ *
452
462
  * Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
453
- * position.
463
+ * position. The `depthTexture` and `texture` property of 3D render targets are supported as well.
464
+ *
465
+ * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are
466
+ * intitialized e.g. via {@link .initRenderTarget}().
454
467
  *
455
468
  * @param srcTexture Specifies the source texture.
456
469
  * @param dstTexture Specifies the destination texture.
@@ -1,13 +1,20 @@
1
1
  import Info from "./Info.js";
2
2
  import Nodes from "./nodes/Nodes.js";
3
+ interface AnimationContext {
4
+ requestAnimationFrame(callback: FrameRequestCallback, frame?: XRFrame): number;
5
+ cancelAnimationFrame(handle: number): void;
6
+ }
3
7
  declare class Animation {
4
8
  nodes: Nodes;
5
9
  info: Info;
6
- animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
7
- requestId: number | null;
10
+ _context: AnimationContext;
11
+ _animationLoop: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null;
12
+ _requestId: number | null;
8
13
  constructor(nodes: Nodes, info: Info);
9
- _init(): void;
10
- dispose(): void;
14
+ start(): void;
15
+ stop(): void;
11
16
  setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): void;
17
+ setContext(context: AnimationContext): void;
18
+ dispose(): void;
12
19
  }
13
20
  export default Animation;
@@ -1,24 +1,26 @@
1
1
  import { Camera } from "../../cameras/Camera.js";
2
- import { Material } from "../../materials/Material.js";
3
2
  import { Matrix3 } from "../../math/Matrix3.js";
4
3
  import { Matrix4 } from "../../math/Matrix4.js";
5
4
  import { Plane } from "../../math/Plane.js";
6
5
  import { Vector4 } from "../../math/Vector4.js";
7
- import Renderer from "./Renderer.js";
6
+ import { ClippingGroup } from "../../objects/ClippingGroup.js";
7
+ import { Scene } from "../../scenes/Scene.js";
8
8
  declare class ClippingContext {
9
9
  version: number;
10
- globalClippingCount: number;
11
- localClippingCount: number;
12
- localClippingEnabled: boolean | undefined;
13
- localClipIntersection: boolean;
14
- planes: Vector4[];
15
- parentVersion: number;
10
+ clipIntersection: boolean | null;
11
+ cacheKey: string;
12
+ intersectionPlanes?: Plane[];
13
+ unionPlanes?: Plane[];
16
14
  viewNormalMatrix: Matrix3;
17
- cacheKey: number;
18
- viewMatrix?: Matrix4 | undefined;
19
- constructor();
20
- projectPlanes(source: readonly Plane[], offset: number): void;
21
- updateGlobal(renderer: Renderer, camera: Camera): void;
22
- update(parent: ClippingContext, material: Material): void;
15
+ clippingGroupContexts: WeakMap<ClippingGroup, ClippingContext>;
16
+ shadowPass: boolean;
17
+ viewMatrix?: Matrix4;
18
+ parentVersion: number | null;
19
+ constructor(parentContext?: ClippingContext | null);
20
+ projectPlanes(source: readonly Plane[], destination: readonly Vector4[], offset: number): void;
21
+ updateGlobal(scene: Scene, camera: Camera): void;
22
+ update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void;
23
+ getGroupContext(clippingGroup: ClippingGroup): ClippingContext;
24
+ get unionClippingCount(): number;
23
25
  }
24
26
  export default ClippingContext;
@@ -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;
@@ -5,6 +5,8 @@ import { Light } from "../../lights/Light.js";
5
5
  import { Material } from "../../materials/Material.js";
6
6
  import { LightsNode } from "../../nodes/Nodes.js";
7
7
  import BundleGroup from "./BundleGroup.js";
8
+ import ClippingContext from "./ClippingContext.js";
9
+ import Lighting from "./Lighting.js";
8
10
  export interface Bundle {
9
11
  bundleGroup: BundleGroup;
10
12
  camera: Camera;
@@ -19,17 +21,21 @@ export interface RenderItem {
19
21
  renderOrder: number | null;
20
22
  z: number | null;
21
23
  group: GeometryGroup | null;
24
+ clippingContext: ClippingContext | null;
22
25
  }
23
26
  declare class RenderList {
24
27
  renderItems: RenderItem[];
25
28
  renderItemsIndex: number;
26
29
  opaque: RenderItem[];
30
+ transparentDoublePass: RenderItem[];
27
31
  transparent: RenderItem[];
28
32
  bundles: Bundle[];
29
33
  lightsNode: LightsNode;
30
34
  lightsArray: Light[];
35
+ scene: Object3D;
36
+ camera: Camera;
31
37
  occlusionQueryCount: number;
32
- constructor();
38
+ constructor(lighting: Lighting, scene: Object3D, camera: Camera);
33
39
  begin(): this;
34
40
  getNextRenderItem(
35
41
  object: Object3D,
@@ -38,6 +44,7 @@ declare class RenderList {
38
44
  groupOrder: number,
39
45
  z: number,
40
46
  group: GeometryGroup | null,
47
+ clippingContext: ClippingContext | null,
41
48
  ): RenderItem;
42
49
  push(
43
50
  object: Object3D,
@@ -46,6 +53,7 @@ declare class RenderList {
46
53
  groupOrder: number,
47
54
  z: number,
48
55
  group: GeometryGroup | null,
56
+ clippingContext: ClippingContext | null,
49
57
  ): void;
50
58
  unshift(
51
59
  object: Object3D,
@@ -54,10 +62,10 @@ declare class RenderList {
54
62
  groupOrder: number,
55
63
  z: number,
56
64
  group: GeometryGroup | null,
65
+ clippingContext: ClippingContext | null,
57
66
  ): void;
58
67
  pushBundle(group: Bundle): void;
59
68
  pushLight(light: Light): void;
60
- getLightsNode(): LightsNode;
61
69
  sort(
62
70
  customOpaqueSort: ((a: RenderItem, b: RenderItem) => number) | null,
63
71
  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
  }