@types/three 0.176.0 → 0.177.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 (55) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  4. three/examples/jsm/math/Octree.d.ts +3 -0
  5. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  6. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  7. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -1
  8. three/package.json +3 -3
  9. three/src/Three.Core.d.ts +0 -2
  10. three/src/Three.TSL.d.ts +5 -5
  11. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  12. three/src/Three.WebGPU.d.ts +1 -0
  13. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  14. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  15. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  16. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  17. three/src/core/BufferGeometry.d.ts +5 -1
  18. three/src/core/RenderTarget.d.ts +3 -20
  19. three/src/extras/DataUtils.d.ts +4 -4
  20. three/src/geometries/CapsuleGeometry.d.ts +1 -0
  21. three/src/lights/SpotLightShadow.d.ts +2 -0
  22. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  23. three/src/materials/nodes/NodeMaterial.d.ts +2 -0
  24. three/src/materials/nodes/SpriteNodeMaterial.d.ts +2 -0
  25. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -0
  26. three/src/math/Box3.d.ts +8 -0
  27. three/src/math/ColorManagement.d.ts +12 -2
  28. three/src/math/Sphere.d.ts +8 -0
  29. three/src/math/Triangle.d.ts +3 -3
  30. three/src/nodes/Nodes.d.ts +1 -0
  31. three/src/nodes/accessors/CubeTextureNode.d.ts +12 -1
  32. three/src/nodes/accessors/TextureNode.d.ts +11 -6
  33. three/src/nodes/core/AssignNode.d.ts +5 -1
  34. three/src/nodes/core/CacheNode.d.ts +3 -0
  35. three/src/nodes/core/Node.d.ts +5 -4
  36. three/src/nodes/core/NodeUtils.d.ts +4 -0
  37. three/src/nodes/display/BlendModes.d.ts +4 -0
  38. three/src/nodes/display/ColorSpaceNode.d.ts +2 -12
  39. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  40. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  41. three/src/nodes/tsl/TSLCore.d.ts +11 -6
  42. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  43. three/src/objects/Mesh.d.ts +8 -0
  44. three/src/objects/Sprite.d.ts +8 -0
  45. three/src/renderers/WebGLRenderer.d.ts +2 -2
  46. three/src/renderers/common/Renderer.d.ts +5 -0
  47. three/src/renderers/common/XRManager.d.ts +45 -0
  48. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  49. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
  50. three/src/textures/DepthTexture.d.ts +4 -2
  51. three/src/textures/Source.d.ts +20 -16
  52. three/src/textures/Texture.d.ts +69 -2
  53. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  54. three/src/core/RenderTargetArray.d.ts +0 -9
  55. three/src/textures/DepthArrayTexture.d.ts +0 -14
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 24 Apr 2025 08:02:30 GMT
11
+ * Last updated: Mon, 02 Jun 2025 15:36:26 GMT
12
12
  * Dependencies: [@dimforge/rapier3d-compat](https://npmjs.com/package/@dimforge/rapier3d-compat), [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [@webgpu/types](https://npmjs.com/package/@webgpu/types), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
13
13
 
14
14
  # Credits
@@ -28,7 +28,6 @@ export * from "./effects/AnaglyphEffect.js";
28
28
  export * from "./effects/AsciiEffect.js";
29
29
  export * from "./effects/OutlineEffect.js";
30
30
  export * from "./effects/ParallaxBarrierEffect.js";
31
- export * from "./effects/PeppersGhostEffect.js";
32
31
  export * from "./effects/StereoEffect.js";
33
32
 
34
33
  export * from "./environments/DebugEnvironment.js";
@@ -19,11 +19,16 @@ export class LDrawLoader extends Loader<Group> {
19
19
  ): this;
20
20
 
21
21
  preloadMaterials(url: string): Promise<void>;
22
- setFileMap(fileMap: Record<string, string>): void;
23
- setMaterials(materials: Material[]): void;
24
22
 
25
23
  parse(text: string, path: string, onLoad: (data: Group) => void, onError?: (error: unknown) => void): void;
26
24
 
27
- addMaterial(material: Material): void;
25
+ setMaterials(materials: Material[]): this;
26
+ clearMaterials(): this;
27
+ addMaterials(materials: Material[]): this;
28
+ addDefaultMaterials(): this;
29
+
30
+ setFileMap(fileMap: Record<string, string>): this;
31
+
32
+ addMaterial(material: Material): this;
28
33
  getMaterial(colourCode: string): Material | null;
29
34
  }
@@ -10,6 +10,9 @@ export class Octree {
10
10
  triangles: Triangle[];
11
11
  layers: Layers;
12
12
 
13
+ trianglesPerLeaf: number;
14
+ maxLevel: number;
15
+
13
16
  constructor(box?: Box3 | null);
14
17
 
15
18
  addTriangle(triangle: Triangle): this;
@@ -1,14 +1,17 @@
1
- import { IUniform, ShaderMaterial, WebGLRenderTarget } from "three";
1
+ import { IUniform, ShaderMaterial } from "three";
2
2
 
3
- import { FullScreenQuad, Pass } from "./Pass.js";
3
+ import { Pass } from "./Pass.js";
4
4
 
5
- export class AfterimagePass extends Pass {
6
- constructor(damp?: number);
7
- shader: object;
5
+ declare class AfterimagePass extends Pass {
8
6
  uniforms: Record<string, IUniform>;
9
- textureComp: WebGLRenderTarget;
10
- textureOld: WebGLRenderTarget;
11
- shaderMaterial: ShaderMaterial;
12
- compFsQuad: FullScreenQuad;
13
- copyFsQuad: FullScreenQuad;
7
+
8
+ compFsMaterial: ShaderMaterial;
9
+ copyFsMaterial: ShaderMaterial;
10
+
11
+ constructor(damp?: number);
12
+
13
+ get damp(): number;
14
+ set damp(value: number);
14
15
  }
16
+
17
+ export { AfterimagePass };
@@ -0,0 +1,7 @@
1
+ import { ShaderPass } from "./ShaderPass.js";
2
+
3
+ declare class FXAAPass extends ShaderPass {
4
+ constructor();
5
+ }
6
+
7
+ export { FXAAPass };
@@ -1,8 +1,14 @@
1
1
  import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
2
2
  import { Node } from "three/webgpu";
3
3
 
4
+ interface HashBlurOptions {
5
+ repeats?: NodeRepresentation | undefined;
6
+ mask?: NodeRepresentation | null | undefined;
7
+ premultipliedAlpha?: boolean | undefined;
8
+ }
9
+
4
10
  export const hashBlur: (
5
11
  textureNode: NodeRepresentation,
6
12
  bluramount?: NodeRepresentation,
7
- repeats?: NodeRepresentation,
13
+ options?: HashBlurOptions,
8
14
  ) => ShaderNodeObject<Node>;
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.176.0",
3
+ "version": "0.177.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "scripts": {},
42
42
  "dependencies": {
43
- "@dimforge/rapier3d-compat": "^0.12.0",
43
+ "@dimforge/rapier3d-compat": "~0.12.0",
44
44
  "@tweenjs/tween.js": "~23.1.3",
45
45
  "@types/stats.js": "*",
46
46
  "@types/webxr": "*",
@@ -49,6 +49,6 @@
49
49
  "meshoptimizer": "~0.18.1"
50
50
  },
51
51
  "peerDependencies": {},
52
- "typesPublisherContentHash": "2633ecc9f78b2c3a7ff53ae098668242bacbcea8b1a3e8ca27d1bf0a943233a6",
52
+ "typesPublisherContentHash": "b00477afa796eb933a6474b328923a76b02409bbc6391520fd096f0ace56fb28",
53
53
  "typeScriptVersion": "5.1"
54
54
  }
three/src/Three.Core.d.ts CHANGED
@@ -39,7 +39,6 @@ export * from "./core/Object3D.js";
39
39
  export * from "./core/Raycaster.js";
40
40
  export * from "./core/RenderTarget.js";
41
41
  export * from "./core/RenderTarget3D.js";
42
- export * from "./core/RenderTargetArray.js";
43
42
  export * from "./core/Uniform.js";
44
43
  export * from "./core/UniformsGroup.js";
45
44
  export * from "./extras/Controls.js";
@@ -153,7 +152,6 @@ export * from "./textures/CubeTexture.js";
153
152
  export * from "./textures/Data3DTexture.js";
154
153
  export * from "./textures/DataArrayTexture.js";
155
154
  export * from "./textures/DataTexture.js";
156
- export * from "./textures/DepthArrayTexture.js";
157
155
  export * from "./textures/DepthTexture.js";
158
156
  export * from "./textures/FramebufferTexture.js";
159
157
  export * from "./textures/Source.js";
three/src/Three.TSL.d.ts CHANGED
@@ -327,6 +327,7 @@ export const mx_transform_uv: typeof TSL.mx_transform_uv;
327
327
  export const mx_worley_noise_float: typeof TSL.mx_worley_noise_float;
328
328
  export const mx_worley_noise_vec2: typeof TSL.mx_worley_noise_vec2;
329
329
  export const mx_worley_noise_vec3: typeof TSL.mx_worley_noise_vec3;
330
+ export const namespace: typeof TSL.namespace;
330
331
  export const negate: typeof TSL.negate;
331
332
  export const neutralToneMapping: typeof TSL.neutralToneMapping;
332
333
  export const nodeArray: typeof TSL.nodeArray;
@@ -385,6 +386,7 @@ export const pow: typeof TSL.pow;
385
386
  export const pow2: typeof TSL.pow2;
386
387
  export const pow3: typeof TSL.pow3;
387
388
  export const pow4: typeof TSL.pow4;
389
+ export const premult: typeof TSL.premult;
388
390
  export const property: typeof TSL.property;
389
391
  export const radians: typeof TSL.radians;
390
392
  export const rand: typeof TSL.rand;
@@ -477,13 +479,10 @@ export const textureLoad: typeof TSL.textureLoad;
477
479
  export const textureSize: typeof TSL.textureSize;
478
480
  export const textureStore: typeof TSL.textureStore;
479
481
  export const thickness: typeof TSL.thickness;
480
- export const threshold: typeof TSL.threshold;
481
482
  export const time: typeof TSL.time;
482
483
  export const timerDelta: typeof TSL.timerDelta;
483
484
  export const timerGlobal: typeof TSL.timerGlobal;
484
485
  export const timerLocal: typeof TSL.timerLocal;
485
- export const toOutputColorSpace: typeof TSL.toOutputColorSpace;
486
- export const toWorkingColorSpace: typeof TSL.toWorkingColorSpace;
487
486
  export const toneMapping: typeof TSL.toneMapping;
488
487
  export const toneMappingExposure: typeof TSL.toneMappingExposure;
489
488
  export const toonOutlinePass: typeof TSL.toonOutlinePass;
@@ -500,8 +499,6 @@ export const transformedTangentView: typeof TSL.transformedTangentView;
500
499
  export const transformedTangentWorld: typeof TSL.transformedTangentWorld;
501
500
  export const transmission: typeof TSL.transmission;
502
501
  export const transpose: typeof TSL.transpose;
503
- export const tri: typeof TSL.tri;
504
- export const tri3: typeof TSL.tri3;
505
502
  export const triNoise3D: typeof TSL.triNoise3D;
506
503
  export const triplanarTexture: typeof TSL.triplanarTexture;
507
504
  export const triplanarTextures: typeof TSL.triplanarTextures;
@@ -509,9 +506,12 @@ export const trunc: typeof TSL.trunc;
509
506
  export const tslFn: typeof TSL.tslFn;
510
507
  export const uint: typeof TSL.uint;
511
508
  export const uniform: typeof TSL.uniform;
509
+ export const uniformCubeTexture: typeof TSL.uniformCubeTexture;
512
510
  export const uniformArray: typeof TSL.uniformArray;
513
511
  export const uniformGroup: typeof TSL.uniformGroup;
512
+ export const uniformTexture: typeof TSL.uniformTexture;
514
513
  export const uniforms: typeof TSL.uniforms;
514
+ export const unpremult: typeof TSL.unpremult;
515
515
  export const userData: typeof TSL.userData;
516
516
  export const uv: typeof TSL.uv;
517
517
  export const uvec2: typeof TSL.uvec2;
@@ -11,6 +11,7 @@ export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.Nod
11
11
  import * as RendererUtils from "./renderers/common/RendererUtils.js";
12
12
  export { RendererUtils };
13
13
  export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js";
14
+ export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js";
14
15
  export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js";
15
16
  export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js";
16
17
  export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js";
@@ -11,6 +11,7 @@ export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.js"
11
11
  import * as RendererUtils from "./renderers/common/RendererUtils.js";
12
12
  export { RendererUtils };
13
13
  export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js";
14
+ export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js";
14
15
  export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js";
15
16
  export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js";
16
17
  export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js";
@@ -13,5 +13,5 @@ export class NumberKeyframeTrack extends KeyframeTrack {
13
13
  * @param {Array<number>} values - A list of keyframe values.
14
14
  * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
15
15
  */
16
- constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
16
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
17
17
  }
@@ -13,5 +13,5 @@ export class QuaternionKeyframeTrack extends KeyframeTrack {
13
13
  * @param {Array<number>} values - A list of keyframe values.
14
14
  * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
15
15
  */
16
- constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
16
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
17
17
  }
@@ -14,5 +14,5 @@ export class StringKeyframeTrack extends KeyframeTrack {
14
14
  * @param {Array<number>} times - A list of keyframe times.
15
15
  * @param {Array<number>} values - A list of keyframe values.
16
16
  */
17
- constructor(name: string, times: Array<number>, values: Array<number>);
17
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>);
18
18
  }
@@ -13,5 +13,5 @@ export class VectorKeyframeTrack extends KeyframeTrack {
13
13
  * @param {Array<number>} values - A list of keyframe values.
14
14
  * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
15
15
  */
16
- constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
16
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
17
17
  }
@@ -172,7 +172,11 @@ export class BufferGeometry<
172
172
  * You will have to call {@link dispose | .dispose}(), and create a new instance of {@link THREE.BufferGeometry | BufferGeometry}.
173
173
  * @defaultValue `{}`
174
174
  */
175
- morphAttributes: Record<"position" | "normal" | "color", Array<BufferAttribute | InterleavedBufferAttribute>>;
175
+ morphAttributes: {
176
+ position?: Array<BufferAttribute | InterleavedBufferAttribute> | undefined;
177
+ normal?: Array<BufferAttribute | InterleavedBufferAttribute> | undefined;
178
+ color?: Array<BufferAttribute | InterleavedBufferAttribute> | undefined;
179
+ };
176
180
 
177
181
  /**
178
182
  * Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.
@@ -1,27 +1,9 @@
1
- import {
2
- MagnificationTextureFilter,
3
- MinificationTextureFilter,
4
- PixelFormatGPU,
5
- TextureDataType,
6
- Wrapping,
7
- } from "../constants.js";
8
1
  import { Vector4 } from "../math/Vector4.js";
9
2
  import { DepthTexture } from "../textures/DepthTexture.js";
10
- import { Texture } from "../textures/Texture.js";
3
+ import { Texture, TextureParameters } from "../textures/Texture.js";
11
4
  import { EventDispatcher } from "./EventDispatcher.js";
12
5
 
13
- export interface RenderTargetOptions {
14
- depth?: number | undefined;
15
- wrapS?: Wrapping | undefined;
16
- wrapT?: Wrapping | undefined;
17
- magFilter?: MagnificationTextureFilter | undefined;
18
- minFilter?: MinificationTextureFilter | undefined;
19
- generateMipmaps?: boolean | undefined; // true
20
- format?: number | undefined; // RGBAFormat
21
- type?: TextureDataType | undefined; // UnsignedByteType
22
- anisotropy?: number | undefined; // 1
23
- colorSpace?: string | undefined;
24
- internalFormat?: PixelFormatGPU | null | undefined; // null
6
+ export interface RenderTargetOptions extends TextureParameters {
25
7
  depthBuffer?: boolean | undefined; // true
26
8
  stencilBuffer?: boolean | undefined; // false
27
9
  resolveDepthBuffer?: boolean | undefined; // true
@@ -33,6 +15,7 @@ export interface RenderTargetOptions {
33
15
  */
34
16
  samples?: number | undefined;
35
17
  count?: number | undefined;
18
+ depth?: number | undefined;
36
19
  multiview?: boolean | undefined;
37
20
  }
38
21
 
@@ -14,9 +14,9 @@ declare function toHalfFloat(val: number): number;
14
14
  */
15
15
  declare function fromHalfFloat(val: number): number;
16
16
 
17
- declare const DataUtils: {
18
- toHalfFloat: typeof toHalfFloat;
19
- fromHalfFloat: typeof fromHalfFloat;
20
- };
17
+ declare class DataUtils {
18
+ static toHalfFloat(val: number): number;
19
+ static fromHalfFloat(val: number): number;
20
+ }
21
21
 
22
22
  export { DataUtils, fromHalfFloat, toHalfFloat };
@@ -48,6 +48,7 @@ export class CapsuleGeometry extends BufferGeometry {
48
48
  readonly height: number;
49
49
  readonly capSegments: number;
50
50
  readonly radialSegments: number;
51
+ readonly heightSegments: number;
51
52
  };
52
53
 
53
54
  /** @internal */
@@ -69,4 +69,6 @@ export class SpotLightShadow extends LightShadow<PerspectiveCamera> {
69
69
  * @defaultValue `1`
70
70
  */
71
71
  focus: number;
72
+
73
+ aspect: number;
72
74
  }
@@ -0,0 +1,17 @@
1
+ import { ColorRepresentation } from "../../math/Color.js";
2
+ import { SpotLight } from "../SpotLight.js";
3
+
4
+ declare class ProjectorLight extends SpotLight {
5
+ aspect: number | null;
6
+
7
+ constructor(
8
+ color?: ColorRepresentation,
9
+ intensity?: number,
10
+ distance?: number,
11
+ angle?: number,
12
+ penumbra?: number,
13
+ decay?: number,
14
+ );
15
+ }
16
+
17
+ export default ProjectorLight;
@@ -22,6 +22,7 @@ export interface NodeMaterialParameters extends MaterialParameters {
22
22
  backdropNode?: Node | null | undefined;
23
23
  backdropAlphaNode?: Node | null | undefined;
24
24
  alphaTestNode?: Node | null | undefined;
25
+ maskNode?: Node | null | undefined;
25
26
 
26
27
  positionNode?: Node | null | undefined;
27
28
  geometryNode?: Node | null | undefined;
@@ -55,6 +56,7 @@ declare class NodeMaterial extends Material {
55
56
  backdropNode: Node | null;
56
57
  backdropAlphaNode: Node | null;
57
58
  alphaTestNode: Node | null;
59
+ maskNode: Node | null;
58
60
 
59
61
  positionNode: Node | null;
60
62
  geometryNode: Node | null;
@@ -5,6 +5,8 @@ import { SpriteMaterialParameters } from "../SpriteMaterial.js";
5
5
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
6
6
 
7
7
  export interface SpriteNodeMaterialParameters extends NodeMaterialParameters, SpriteMaterialParameters {
8
+ rotationNode?: Node | null | undefined;
9
+ scaleNode?: Node | null | undefined;
8
10
  }
9
11
 
10
12
  export default class SpriteNodeMaterial extends NodeMaterial {
@@ -12,6 +12,7 @@ declare const refreshUniforms: readonly [
12
12
  "anisotropyMap",
13
13
  "anisotropyRotation",
14
14
  "aoMap",
15
+ "aoMapIntensity",
15
16
  "attenuationColor",
16
17
  "attenuationDistance",
17
18
  "bumpMap",
@@ -24,8 +25,10 @@ declare const refreshUniforms: readonly [
24
25
  "dispersion",
25
26
  "displacementMap",
26
27
  "emissive",
28
+ "emissiveIntensity",
27
29
  "emissiveMap",
28
30
  "envMap",
31
+ "envMapIntensity",
29
32
  "gradientMap",
30
33
  "ior",
31
34
  "iridescence",
@@ -33,6 +36,7 @@ declare const refreshUniforms: readonly [
33
36
  "iridescenceMap",
34
37
  "iridescenceThicknessMap",
35
38
  "lightMap",
39
+ "lightMapIntensity",
36
40
  "map",
37
41
  "matcap",
38
42
  "metalness",
three/src/math/Box3.d.ts CHANGED
@@ -63,4 +63,12 @@ export class Box3 {
63
63
  * @deprecated Use {@link Box3#intersectsSphere .intersectsSphere()} instead.
64
64
  */
65
65
  isIntersectionSphere(s: any): any;
66
+
67
+ toJSON(): Box3JSON;
68
+ fromJSON(json: Box3JSON): this;
69
+ }
70
+
71
+ export interface Box3JSON {
72
+ min: number[];
73
+ max: number[];
66
74
  }
@@ -29,9 +29,9 @@ export interface ColorManagement {
29
29
 
30
30
  convert: (color: Color, sourceColorSpace: string, targetColorSpace: string) => Color;
31
31
 
32
- fromWorkingColorSpace: (color: Color, targetColorSpace: string) => Color;
32
+ workingToColorSpace: (color: Color, targetColorSpace: string) => Color;
33
33
 
34
- toWorkingColorSpace: (color: Color, sourceColorSpace: string) => Color;
34
+ colorSpaceToWorking: (color: Color, sourceColorSpace: string) => Color;
35
35
 
36
36
  getPrimaries: (colorSpace: string) => [number, number, number, number, number, number];
37
37
 
@@ -40,6 +40,16 @@ export interface ColorManagement {
40
40
  getLuminanceCoefficients: (target: Vector3, colorSpace?: string) => [number, number, number];
41
41
 
42
42
  define: (colorSpaces: Record<string, ColorSpaceDefinition>) => void;
43
+
44
+ /**
45
+ * @deprecated .fromWorkingColorSpace() has been renamed to .workingToColorSpace().
46
+ */
47
+ fromWorkingColorSpace: (color: Color, targetColorSpace: string) => Color;
48
+
49
+ /**
50
+ * @deprecated .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().
51
+ */
52
+ toWorkingColorSpace: (color: Color, sourceColorSpace: string) => Color;
43
53
  }
44
54
 
45
55
  export const ColorManagement: ColorManagement;
@@ -44,4 +44,12 @@ export class Sphere {
44
44
  * @deprecated Use {@link Sphere#isEmpty .isEmpty()} instead.
45
45
  */
46
46
  empty(): any;
47
+
48
+ toJSON(): SphereJSON;
49
+ fromJSON(json: SphereJSON): this;
50
+ }
51
+
52
+ export interface SphereJSON {
53
+ radius: number;
54
+ center: number[];
47
55
  }
@@ -83,7 +83,7 @@ export class Triangle {
83
83
  target: Vector4,
84
84
  ): Vector4 | null;
85
85
  static getInterpolatedAttribute(
86
- attr: BufferAttribute,
86
+ attr: BufferAttribute | InterleavedBufferAttribute,
87
87
  i1: number,
88
88
  i2: number,
89
89
  i3: number,
@@ -91,7 +91,7 @@ export class Triangle {
91
91
  target: Vector2,
92
92
  ): Vector2;
93
93
  static getInterpolatedAttribute(
94
- attr: BufferAttribute,
94
+ attr: BufferAttribute | InterleavedBufferAttribute,
95
95
  i1: number,
96
96
  i2: number,
97
97
  i3: number,
@@ -99,7 +99,7 @@ export class Triangle {
99
99
  target: Vector3,
100
100
  ): Vector3;
101
101
  static getInterpolatedAttribute(
102
- attr: BufferAttribute,
102
+ attr: BufferAttribute | InterleavedBufferAttribute,
103
103
  i1: number,
104
104
  i2: number,
105
105
  i3: number,
@@ -139,6 +139,7 @@ export { default as LightingNode } from "./lighting/LightingNode.js";
139
139
  export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
140
140
  export { default as LightsNode } from "./lighting/LightsNode.js";
141
141
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
142
+ export { default as ProjectorLightNode } from "./lighting/ProjectorLightNode.js";
142
143
  export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js";
143
144
  export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js";
144
145
  export { default as ShadowNode } from "./lighting/ShadowNode.js";
@@ -20,9 +20,20 @@ declare class CubeTextureNode extends TextureNode {
20
20
 
21
21
  export default CubeTextureNode;
22
22
 
23
- export const cubeTexture: (
23
+ export const cubeTextureBase: (
24
24
  value: CubeTexture,
25
25
  uvNode?: NodeRepresentation,
26
26
  levelNode?: NodeRepresentation,
27
27
  biasNode?: NodeRepresentation,
28
28
  ) => ShaderNodeObject<CubeTextureNode>;
29
+
30
+ export const cubeTexture: (
31
+ value?: CubeTexture,
32
+ uvNode?: NodeRepresentation | null,
33
+ levelNode?: NodeRepresentation | null,
34
+ biasNode?: NodeRepresentation | null,
35
+ ) => ShaderNodeObject<CubeTextureNode>;
36
+
37
+ export const uniformCubeTexture: (
38
+ value?: CubeTexture,
39
+ ) => ShaderNodeObject<CubeTextureNode>;
@@ -19,7 +19,7 @@ export default class TextureNode extends UniformNode<Texture> {
19
19
  referenceNode: Node | null;
20
20
 
21
21
  constructor(
22
- value: Texture,
22
+ value?: Texture,
23
23
  uvNode?: ShaderNodeObject<Node> | null,
24
24
  levelNode?: ShaderNodeObject<Node> | null,
25
25
  biasNode?: ShaderNodeObject<Node> | null,
@@ -56,13 +56,18 @@ export default class TextureNode extends UniformNode<Texture> {
56
56
  }
57
57
 
58
58
  export const texture: (
59
- value: Texture,
60
- uvNode?: NodeRepresentation,
61
- levelNode?: NodeRepresentation,
62
- biasNode?: NodeRepresentation,
59
+ value?: Texture,
60
+ uvNode?: NodeRepresentation | null,
61
+ levelNode?: NodeRepresentation | null,
62
+ biasNode?: NodeRepresentation | null,
63
63
  ) => ShaderNodeObject<TextureNode>;
64
+
65
+ export const uniformTexture: (
66
+ value?: Texture,
67
+ ) => ShaderNodeObject<TextureNode>;
68
+
64
69
  export const textureLoad: (
65
- value: Texture,
70
+ value?: Texture,
66
71
  uvNode?: NodeRepresentation,
67
72
  levelNode?: NodeRepresentation,
68
73
  biasNode?: NodeRepresentation,
@@ -3,12 +3,16 @@ import Node from "./Node.js";
3
3
  import NodeBuilder from "./NodeBuilder.js";
4
4
  import TempNode from "./TempNode.js";
5
5
 
6
- export default class AssignNode extends TempNode {
6
+ declare class AssignNode extends TempNode {
7
+ readonly isAssignNode: true;
8
+
7
9
  constructor(targetNode: Node, sourceNode: Node);
8
10
 
9
11
  needsSplitAssign(builder: NodeBuilder): boolean;
10
12
  }
11
13
 
14
+ export default AssignNode;
15
+
12
16
  export const assign: (targetNode: NodeRepresentation, sourceNode: NodeRepresentation) => ShaderNodeObject<AssignNode>;
13
17
 
14
18
  declare module "../tsl/TSLCore.js" {
@@ -1,4 +1,5 @@
1
1
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import ContextNode from "./ContextNode.js";
2
3
  import Node from "./Node.js";
3
4
  import NodeCache from "./NodeCache.js";
4
5
 
@@ -13,6 +14,8 @@ export default class CacheNode extends Node {
13
14
 
14
15
  export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject<CacheNode>;
15
16
 
17
+ export const namespace: (node: Node, namespace: string) => ShaderNodeObject<ContextNode>;
18
+
16
19
  declare module "../tsl/TSLCore.js" {
17
20
  interface NodeElements {
18
21
  cache: typeof cache;
@@ -157,7 +157,7 @@ declare class Node extends EventDispatcher<{
157
157
  /**
158
158
  * By default this method returns the value of the {@link Node#global} flag. This method
159
159
  * can be overwritten in derived classes if an analytical way is required to determine the
160
- * global status.
160
+ * global cache referring to the current shader-stage.
161
161
  *
162
162
  * @param {NodeBuilder} builder - The current node builder.
163
163
  * @return {boolean} Whether this node is global or not.
@@ -281,8 +281,9 @@ declare class Node extends EventDispatcher<{
281
281
  * This stage analyzes the node hierarchy and ensures descendent nodes are built.
282
282
  *
283
283
  * @param {NodeBuilder} builder - The current node builder.
284
+ * @param {?Node} output - The target output node.
284
285
  */
285
- analyze(builder: NodeBuilder): void;
286
+ analyze(builder: NodeBuilder, output?: Node | null): void;
286
287
  /**
287
288
  * Represents the generate stage which is the third step of the build process, see {@link Node#build} method.
288
289
  * This state builds the output node and returns the resulting shader string.
@@ -326,10 +327,10 @@ declare class Node extends EventDispatcher<{
326
327
  * - **generate**: Generates the shader code for the node. Returns the generated shader string.
327
328
  *
328
329
  * @param {NodeBuilder} builder - The current node builder.
329
- * @param {?string} [output=null] - Can be used to define the output type.
330
+ * @param {string|Node|null} [output=null] - Can be used to define the output type.
330
331
  * @return {Node|string|null} The result of the build process, depending on the build stage.
331
332
  */
332
- build(builder: NodeBuilder, output?: string | null): Node | string | null;
333
+ build(builder: NodeBuilder, output?: string | Node | null): Node | string | null;
333
334
  /**
334
335
  * Returns the child nodes as a JSON object.
335
336
  *
@@ -24,6 +24,10 @@ export function getTypeFromLength(length: number): string | undefined;
24
24
 
25
25
  export function getLengthFromType(type: string): number | undefined;
26
26
 
27
+ export function getMemoryLengthFromType(type: string): number | undefined;
28
+
29
+ export function getByteBoundaryFromType(type: string): number | undefined;
30
+
27
31
  export function getValueType(value: unknown): string | null;
28
32
 
29
33
  export function getValueFromType(
@@ -11,6 +11,10 @@ export const blendOverlay: (base: NodeRepresentation, blend: NodeRepresentation)
11
11
 
12
12
  export const blendColor: (base: NodeRepresentation, blend: NodeRepresentation) => ShaderNodeObject<Node>;
13
13
 
14
+ export const premult: (color: NodeRepresentation) => ShaderNodeObject<Node>;
15
+
16
+ export const unpremult: (color: NodeRepresentation) => ShaderNodeObject<Node>;
17
+
14
18
  /**
15
19
  * @deprecated
16
20
  */
@@ -27,20 +27,13 @@ export default class ColorSpaceNode extends TempNode {
27
27
  resolveColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): string;
28
28
  }
29
29
 
30
- export const toOutputColorSpace: (
31
- node: NodeRepresentation,
32
- ) => ShaderNodeObject<ColorSpaceNode>;
33
- export const toWorkingColorSpace: (
34
- node: NodeRepresentation,
35
- ) => ShaderNodeObject<ColorSpaceNode>;
36
-
37
30
  export const workingToColorSpace: (
38
31
  node: NodeRepresentation,
39
- colorSpace: string,
32
+ targetColorSpace: string,
40
33
  ) => ShaderNodeObject<ColorSpaceNode>;
41
34
  export const colorSpaceToWorking: (
42
35
  node: NodeRepresentation,
43
- colorSpace: string,
36
+ sourceColorSpace: string,
44
37
  ) => ShaderNodeObject<ColorSpaceNode>;
45
38
 
46
39
  export const convertColorSpace: (
@@ -51,9 +44,6 @@ export const convertColorSpace: (
51
44
 
52
45
  declare module "../tsl/TSLCore.js" {
53
46
  interface NodeElements {
54
- toOutputColorSpace: typeof toOutputColorSpace;
55
- toWorkingColorSpace: typeof toWorkingColorSpace;
56
-
57
47
  workingToColorSpace: typeof workingToColorSpace;
58
48
  colorSpaceToWorking: typeof colorSpaceToWorking;
59
49
  }
@@ -0,0 +1,5 @@
1
+ import SpotLightNode from "./SpotLightNode.js";
2
+
3
+ declare class ProjectorLightNode extends SpotLightNode {}
4
+
5
+ export default ProjectorLightNode;
@@ -1,8 +1,10 @@
1
1
  import { SpotLight } from "../../lights/SpotLight.js";
2
2
  import Node from "../core/Node.js";
3
+ import NodeBuilder from "../core/NodeBuilder.js";
4
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
5
  import AnalyticLightNode from "./AnalyticLightNode.js";
4
6
 
5
- export default class PointLightNode extends AnalyticLightNode<SpotLight> {
7
+ declare class SpotLightNode extends AnalyticLightNode<SpotLight> {
6
8
  directionNode: Node;
7
9
 
8
10
  coneCosNode: Node;
@@ -11,5 +13,17 @@ export default class PointLightNode extends AnalyticLightNode<SpotLight> {
11
13
  cutoffDistanceNode: Node;
12
14
  decayExponentNode: Node;
13
15
 
16
+ colorNode: Node;
17
+
14
18
  constructor(light?: SpotLight | null);
19
+
20
+ getLightCoord(builder: NodeBuilder): ShaderNodeObject<Node>;
15
21
  }
22
+
23
+ declare module "three" {
24
+ export interface SpotLight {
25
+ attenuationNode?: ((lightNode: SpotLightNode) => Node) | null | undefined;
26
+ }
27
+ }
28
+
29
+ export default SpotLightNode;
@@ -7,8 +7,6 @@ import StackNode from "../core/StackNode.js";
7
7
  import ConvertNode from "../utils/ConvertNode.js";
8
8
 
9
9
  export interface NodeElements {
10
- toGlobal: (node: Node) => Node;
11
-
12
10
  toStack: typeof Stack;
13
11
 
14
12
  toColor: typeof color;
@@ -248,17 +246,24 @@ interface Layout {
248
246
 
249
247
  interface ShaderNodeFn<Args extends readonly unknown[]> {
250
248
  (...args: Args): ShaderNodeObject<ShaderCallNodeInternal>;
249
+
251
250
  shaderNode: ShaderNodeObject<ShaderNodeInternal>;
251
+ id: number;
252
+
253
+ getNodeType: (builder: NodeBuilder) => string | null;
254
+ getCacheKey: (force?: boolean) => number;
255
+
252
256
  setLayout: (layout: Layout) => this;
253
- once: () => this;
257
+
258
+ once: (namespace?: string | null) => this;
254
259
  }
255
260
 
256
- export function Fn(jsFunc: () => void): ShaderNodeFn<[]>;
261
+ export function Fn(jsFunc: (builder: NodeBuilder) => void): ShaderNodeFn<[]>;
257
262
  export function Fn<T extends readonly unknown[]>(
258
- jsFunc: (args: T) => void,
263
+ jsFunc: (args: T, builder: NodeBuilder) => void,
259
264
  ): ShaderNodeFn<ProxiedTuple<T>>;
260
265
  export function Fn<T extends { readonly [key: string]: unknown }>(
261
- jsFunc: (args: T) => void,
266
+ jsFunc: (args: T, builder: NodeBuilder) => void,
262
267
  ): ShaderNodeFn<[ProxiedObject<T>]>;
263
268
 
264
269
  export const setCurrentStack: (stack: StackNode | null) => void;
@@ -33,6 +33,7 @@ declare class ReflectorBaseNode extends Node {
33
33
  virtualCameras: WeakMap<Camera, Camera>;
34
34
  renderTargets: Map<Camera, RenderTarget>;
35
35
  forceUpdate: boolean;
36
+ hasOutput: boolean;
36
37
 
37
38
  constructor(textureNode: TextureNode, parameters?: ReflectorNodeParameters);
38
39
 
@@ -76,6 +76,14 @@ export class Mesh<
76
76
  */
77
77
  morphTargetDictionary?: { [key: string]: number } | undefined;
78
78
 
79
+ /**
80
+ * The number of instances of this mesh.
81
+ * Can only be used with {@link WebGPURenderer}.
82
+ *
83
+ * @default 1
84
+ */
85
+ count: number;
86
+
79
87
  /**
80
88
  * Updates the morphTargets to have no influence on the object
81
89
  * @remarks Resets the {@link morphTargetInfluences} and {@link morphTargetDictionary} properties.
@@ -62,4 +62,12 @@ export class Sprite<TEventMap extends Object3DEventMap = Object3DEventMap> exten
62
62
  * @defaultValue {@link THREE.Vector2 | `new Vector2(0.5, 0.5)`}.
63
63
  */
64
64
  center: Vector2;
65
+
66
+ /**
67
+ * The number of instances of this sprite.
68
+ * Can only be used with {@link WebGPURenderer}.
69
+ *
70
+ * @default 1
71
+ */
72
+ count: number;
65
73
  }
@@ -202,8 +202,6 @@ export class WebGLRenderer {
202
202
 
203
203
  shadowMap: WebGLShadowMap;
204
204
 
205
- pixelRatio: number;
206
-
207
205
  capabilities: WebGLCapabilities;
208
206
  properties: WebGLProperties;
209
207
  renderLists: WebGLRenderLists;
@@ -408,6 +406,7 @@ export class WebGLRenderer {
408
406
  height: number,
409
407
  buffer: TypedArray,
410
408
  activeCubeFaceIndex?: number,
409
+ textureIndex?: number,
411
410
  ): void;
412
411
 
413
412
  readRenderTargetPixelsAsync(
@@ -418,6 +417,7 @@ export class WebGLRenderer {
418
417
  height: number,
419
418
  buffer: TypedArray,
420
419
  activeCubeFaceIndex?: number,
420
+ textureIndex?: number,
421
421
  ): Promise<TypedArray>;
422
422
 
423
423
  /**
@@ -341,6 +341,7 @@ declare class Renderer {
341
341
  * @return {RenderContext} The current render context.
342
342
  */
343
343
  _renderScene(scene: Scene, camera: Camera, useFrameBufferTarget?: boolean): RenderContext | undefined;
344
+ _setXRLayerSize(width: number, height: number): void;
344
345
  /**
345
346
  * The output pass performs tone mapping and color space conversion.
346
347
  *
@@ -676,6 +677,10 @@ declare class Renderer {
676
677
  * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set.
677
678
  */
678
679
  getOutputRenderTarget(): RenderTarget<Texture> | null;
680
+ /**
681
+ * Resets the renderer to the initial state before WebXR started.
682
+ */
683
+ _resetXRState(): void;
679
684
  /**
680
685
  * Callback for {@link Renderer#setRenderObjectFunction}.
681
686
  *
@@ -1,6 +1,7 @@
1
1
  import { ArrayCamera } from "../../cameras/ArrayCamera.js";
2
2
  import { PerspectiveCamera } from "../../cameras/PerspectiveCamera.js";
3
3
  import { EventDispatcher } from "../../core/EventDispatcher.js";
4
+ import { RenderTarget } from "../../core/RenderTarget.js";
4
5
  import { CylinderGeometry } from "../../geometries/CylinderGeometry.js";
5
6
  import { PlaneGeometry } from "../../geometries/PlaneGeometry.js";
6
7
  import { Material } from "../../materials/Material.js";
@@ -11,6 +12,7 @@ import { Vector3 } from "../../math/Vector3.js";
11
12
  import { Mesh } from "../../objects/Mesh.js";
12
13
  import { WebXRController } from "../webxr/WebXRController.js";
13
14
  import { AnimationContext } from "./Animation.js";
15
+ import QuadMesh from "./QuadMesh.js";
14
16
  import Renderer from "./Renderer.js";
15
17
  import { XRRenderTarget } from "./XRRenderTarget.js";
16
18
  export interface XRManagerEventMap {
@@ -77,6 +79,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
77
79
  _xrRenderTarget: XRRenderTarget | null;
78
80
  _layers: XRLayerObject[];
79
81
  _supportsLayers: boolean;
82
+ _frameBufferTargets:
83
+ | WeakMap<XRRenderTarget, {
84
+ frameBufferTarget: RenderTarget | null;
85
+ quad: QuadMesh;
86
+ }>
87
+ | null;
80
88
  _createXRLayer: (layer: XRLayerObject) => XRLayer;
81
89
  _gl: WebGL2RenderingContext | null;
82
90
  _currentAnimationContext: AnimationContext | null;
@@ -211,6 +219,21 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
211
219
  * @return {boolean} Whether the engine renders to a multiview render target or not.
212
220
  */
213
221
  useMultiview(): boolean;
222
+ /**
223
+ * This method can be used in XR applications to create a quadratic layer that presents a separate
224
+ * rendered scene.
225
+ *
226
+ * @param {number} width - The width of the layer plane in world units.
227
+ * @param {number} height - The height of the layer plane in world units.
228
+ * @param {Vector3} translation - The position/translation of the layer plane in world units.
229
+ * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
230
+ * @param {number} pixelwidth - The width of the layer's render target in pixels.
231
+ * @param {number} pixelheight - The height of the layer's render target in pixels.
232
+ * @param {Function} rendercall - A callback function that renders the layer. Similar to code in
233
+ * the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
234
+ * @param {Object} [attributes={}] - Allows to configure the layer's render target.
235
+ * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene.
236
+ */
214
237
  createQuadLayer(
215
238
  width: number,
216
239
  height: number,
@@ -221,6 +244,22 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
221
244
  rendercall: () => void,
222
245
  attributes?: LayerAttributes,
223
246
  ): Mesh<PlaneGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
247
+ /**
248
+ * This method can be used in XR applications to create a cylindrical layer that presents a separate
249
+ * rendered scene.
250
+ *
251
+ * @param {number} radius - The radius of the cylinder in world units.
252
+ * @param {number} centralAngle - The central angle of the cylinder in radians.
253
+ * @param {number} aspectratio - The aspect ratio.
254
+ * @param {Vector3} translation - The position/translation of the layer plane in world units.
255
+ * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
256
+ * @param {number} pixelwidth - The width of the layer's render target in pixels.
257
+ * @param {number} pixelheight - The height of the layer's render target in pixels.
258
+ * @param {Function} rendercall - A callback function that renders the layer. Similar to code in
259
+ * the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
260
+ * @param {Object} [attributes={}] - Allows to configure the layer's render target.
261
+ * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene.
262
+ */
224
263
  createCylinderLayer(
225
264
  radius: number,
226
265
  centralAngle: number,
@@ -232,6 +271,12 @@ declare class XRManager extends EventDispatcher<XRManagerEventMap> {
232
271
  rendercall: () => void,
233
272
  attributes?: LayerAttributes,
234
273
  ): Mesh<CylinderGeometry, MeshBasicMaterial, import("../../core/Object3D.js").Object3DEventMap>;
274
+ /**
275
+ * Renders the XR layers that have been previously added to the scene.
276
+ *
277
+ * This method is usually called in your animation loop before rendering
278
+ * the actual scene via `renderer.render( scene, camera );`.
279
+ */
235
280
  renderLayers(): void;
236
281
  /**
237
282
  * Returns the current XR session.
@@ -48,6 +48,7 @@ export default class WGSLNodeBuilder extends NodeBuilder {
48
48
  texture: Texture,
49
49
  textureProperty: string,
50
50
  uvIndexSnippet: string,
51
+ depthSnippet: string | null,
51
52
  valueSnippet: string,
52
53
  ): string;
53
54
  isUnfilterable(texture: Texture): boolean;
@@ -225,7 +225,7 @@ export enum GPUBlendFactor {
225
225
  SrcAlpha = "src-alpha",
226
226
  OneMinusSrcAlpha = "one-minus-src-alpha",
227
227
  Dst = "dst",
228
- OneMinusDstColor = "one-minus-dst",
228
+ OneMinusDst = "one-minus-dst",
229
229
  DstAlpha = "dst-alpha",
230
230
  OneMinusDstAlpha = "one-minus-dst-alpha",
231
231
  SrcAlphaSaturated = "src-alpha-saturated",
@@ -28,6 +28,7 @@ export class DepthTexture extends Texture {
28
28
  * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.NearestFilter}
29
29
  * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
30
30
  * @param format See {@link DepthTexture.format | .format}. Default {@link THREE.DepthFormat}
31
+ * @param {number} [depth=1] - The depth of the texture.
31
32
  */
32
33
  constructor(
33
34
  width: number,
@@ -40,6 +41,7 @@ export class DepthTexture extends Texture {
40
41
  minFilter?: MinificationTextureFilter,
41
42
  anisotropy?: number,
42
43
  format?: DepthTexturePixelFormat,
44
+ depth?: number,
43
45
  );
44
46
 
45
47
  /**
@@ -53,8 +55,8 @@ export class DepthTexture extends Texture {
53
55
  * Overridden with a record type holding width and height.
54
56
  * @override
55
57
  */
56
- get image(): { width: number; height: number };
57
- set image(value: { width: number; height: number });
58
+ get image(): { width: number; height: number; depth: number };
59
+ set image(value: { width: number; height: number; depth: number });
58
60
 
59
61
  /**
60
62
  * @override
@@ -1,3 +1,5 @@
1
+ import { Vector3 } from "../math/Vector3.js";
2
+
1
3
  export type SerializedImage =
2
4
  | string
3
5
  | {
@@ -18,12 +20,6 @@ export class SourceJSON {
18
20
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js | Source}
19
21
  */
20
22
  export class Source {
21
- /**
22
- * Create a new instance of {@link Source}
23
- * @param data The data definition of a texture. Default `null`
24
- */
25
- constructor(data: any);
26
-
27
23
  /**
28
24
  * Flag to check if a given object is of type {@link Source}.
29
25
  * @remarks This is a _constant_ value
@@ -33,6 +29,12 @@ export class Source {
33
29
 
34
30
  readonly id: number;
35
31
 
32
+ /**
33
+ * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
34
+ * @remarks This gets automatically assigned and shouldn't be edited.
35
+ */
36
+ uuid: string;
37
+
36
38
  /**
37
39
  * The actual data of a texture.
38
40
  * @remarks The type of this property depends on the texture that uses this instance.
@@ -49,23 +51,25 @@ export class Source {
49
51
  dataReady: boolean;
50
52
 
51
53
  /**
52
- * When the property is set to `true`, the engine allocates the memory for the texture (if necessary) and triggers
53
- * the actual texture upload to the GPU next time the source is used.
54
+ * This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
55
+ * @remarks Expects a `Integer`
56
+ * @defaultValue `0`
54
57
  */
55
- set needsUpdate(value: boolean);
58
+ version: number;
56
59
 
57
60
  /**
58
- * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
59
- * @remarks This gets automatically assigned and shouldn't be edited.
61
+ * Create a new instance of {@link Source}
62
+ * @param data The data definition of a texture. Default `null`
60
63
  */
61
- uuid: string;
64
+ constructor(data: any);
65
+
66
+ getSize(target: Vector3): Vector3;
62
67
 
63
68
  /**
64
- * This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
65
- * @remarks Expects a `Integer`
66
- * @defaultValue `0`
69
+ * When the property is set to `true`, the engine allocates the memory for the texture (if necessary) and triggers
70
+ * the actual texture upload to the GPU next time the source is used.
67
71
  */
68
- version: number;
72
+ set needsUpdate(value: boolean);
69
73
 
70
74
  /**
71
75
  * Convert the data {@link Source} to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  AnyMapping,
3
3
  AnyPixelFormat,
4
+ ColorSpace,
4
5
  MagnificationTextureFilter,
5
6
  Mapping,
6
7
  MinificationTextureFilter,
@@ -17,6 +18,32 @@ import { CompressedTextureMipmap } from "./CompressedTexture.js";
17
18
  import { CubeTexture } from "./CubeTexture.js";
18
19
  import { Source } from "./Source.js";
19
20
 
21
+ // NOTE: DOM upload fields are not implemented where parameters are accepted.
22
+ export interface TextureParameters {
23
+ mapping?: AnyMapping | undefined;
24
+ // image?: TexImageSource | OffscreenCanvas | undefined;
25
+ // channel?: number | undefined;
26
+
27
+ wrapS?: Wrapping | undefined;
28
+ wrapT?: Wrapping | undefined;
29
+ wrapR?: Wrapping | undefined;
30
+
31
+ format?: PixelFormat | undefined;
32
+ internalFormat?: PixelFormatGPU | null | undefined;
33
+ type?: TextureDataType | undefined;
34
+ colorSpace?: ColorSpace | undefined;
35
+
36
+ magFilter?: MagnificationTextureFilter | undefined;
37
+ minFilter?: MinificationTextureFilter | undefined;
38
+ anisotropy?: number | undefined;
39
+
40
+ flipY?: boolean | undefined;
41
+
42
+ generateMipmaps?: boolean | undefined;
43
+ // premultiplyAlpha?: boolean | undefined;
44
+ // unpackAlignment?: number | undefined;
45
+ }
46
+
20
47
  export interface TextureJSON {
21
48
  metadata: { version: number; type: string; generator: string };
22
49
 
@@ -99,7 +126,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
99
126
  format?: PixelFormat,
100
127
  type?: TextureDataType,
101
128
  anisotropy?: number,
102
- colorSpace?: string,
129
+ colorSpace?: ColorSpace,
103
130
  );
104
131
 
105
132
  /**
@@ -151,6 +178,21 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
151
178
  */
152
179
  source: Source;
153
180
 
181
+ /**
182
+ * The width of the texture in pixels.
183
+ */
184
+ get width(): number;
185
+
186
+ /**
187
+ * The height of the texture in pixels.
188
+ */
189
+ get height(): number;
190
+
191
+ /**
192
+ * The depth of the texture in pixels.
193
+ */
194
+ get depth(): number;
195
+
154
196
  /**
155
197
  * An image object, typically created using the {@link THREE.TextureLoader.load | TextureLoader.load()} method.
156
198
  * @remarks This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
@@ -382,7 +424,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
382
424
  *
383
425
  * @default false
384
426
  */
385
- isTextureArray: boolean;
427
+ isArrayTexture: boolean;
386
428
 
387
429
  /**
388
430
  * An object that can be used to store custom data about the texture.
@@ -391,6 +433,12 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
391
433
  */
392
434
  userData: Record<string, any>;
393
435
 
436
+ /**
437
+ * This can be used to only update a subregion or specific rows of the texture (for example, just the
438
+ * first 3 rows). Use the `addUpdateRange()` function to add ranges to this array.
439
+ */
440
+ updateRanges: Array<{ start: number; count: number }>;
441
+
394
442
  /**
395
443
  * This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
396
444
  * @remarks Expects a `Integer`
@@ -461,6 +509,19 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
461
509
  */
462
510
  updateMatrix(): void;
463
511
 
512
+ /**
513
+ * Adds a range of data in the data texture to be updated on the GPU.
514
+ *
515
+ * @param {number} start - Position at which to start update.
516
+ * @param {number} count - The number of components to update.
517
+ */
518
+ addUpdateRange(start: number, count: number): void;
519
+
520
+ /**
521
+ * Clears the update ranges.
522
+ */
523
+ clearUpdateRanges(): void;
524
+
464
525
  /**
465
526
  * Make copy of the texture. Note this is not a "deep copy", the image is shared. Cloning the texture automatically
466
527
  * marks it for texture upload.
@@ -469,6 +530,12 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
469
530
 
470
531
  copy(source: Texture): this;
471
532
 
533
+ /**
534
+ * Sets this texture's properties based on `values`.
535
+ * @param values - A container with texture parameters.
536
+ */
537
+ setValues(values: TextureParameters): void;
538
+
472
539
  /**
473
540
  * Convert the texture to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
474
541
  * @param meta Optional object containing metadata.
@@ -1,10 +0,0 @@
1
- import { Camera, Scene, WebGLRenderer } from "three";
2
-
3
- export class PeppersGhostEffect {
4
- constructor(renderer: WebGLRenderer);
5
- cameraDistance: number;
6
- reflectFromAbove: boolean;
7
-
8
- render(scene: Scene, camera: Camera): void;
9
- setSize(width: number, height: number): void;
10
- }
@@ -1,9 +0,0 @@
1
- import { RenderTarget, RenderTargetOptions } from "./RenderTarget.js";
2
-
3
- declare class RenderTargetArray extends RenderTarget {
4
- readonly isRenderTargetArray: true;
5
-
6
- constructor(width?: number, height?: number, depth?: number, options?: RenderTargetOptions);
7
- }
8
-
9
- export { RenderTargetArray };
@@ -1,14 +0,0 @@
1
- import { DepthTexture } from "./DepthTexture.js";
2
-
3
- declare class DepthArrayTexture extends DepthTexture {
4
- readonly isDepthArrayTexture: true;
5
- layerUpdates: Set<number>;
6
-
7
- constructor(width?: number, height?: number, depth?: number);
8
-
9
- addLayerUpdate(layerIndex: number): void;
10
-
11
- clearLayerUpdates(): void;
12
- }
13
-
14
- export { DepthArrayTexture };