@types/three 0.175.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 (84) hide show
  1. three/README.md +2 -2
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/helpers/RapierHelper.d.ts +13 -0
  4. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  5. three/examples/jsm/loaders/LottieLoader.d.ts +4 -0
  6. three/examples/jsm/math/Octree.d.ts +3 -0
  7. three/examples/jsm/misc/MD2CharacterComplex.d.ts +1 -1
  8. three/examples/jsm/physics/RapierPhysics.d.ts +12 -0
  9. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  10. three/examples/jsm/postprocessing/BokehPass.d.ts +2 -2
  11. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  12. three/examples/jsm/tsl/display/hashBlur.d.ts +7 -1
  13. three/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
  14. three/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
  15. three/package.json +4 -3
  16. three/src/Three.Core.d.ts +1 -1
  17. three/src/Three.TSL.d.ts +13 -5
  18. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  19. three/src/Three.WebGPU.d.ts +1 -0
  20. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  21. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  22. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  23. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  24. three/src/audio/AudioListener.d.ts +1 -1
  25. three/src/cameras/ArrayCamera.d.ts +5 -0
  26. three/src/constants.d.ts +16 -15
  27. three/src/core/BufferGeometry.d.ts +5 -1
  28. three/src/core/RenderTarget.d.ts +11 -19
  29. three/src/extras/DataUtils.d.ts +4 -4
  30. three/src/geometries/CapsuleGeometry.d.ts +11 -3
  31. three/src/lights/LightShadow.d.ts +8 -0
  32. three/src/lights/SpotLightShadow.d.ts +2 -0
  33. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  34. three/src/materials/Material.d.ts +3 -8
  35. three/src/materials/ShaderMaterial.d.ts +1 -1
  36. three/src/materials/nodes/NodeMaterial.d.ts +12 -2
  37. three/src/materials/nodes/SpriteNodeMaterial.d.ts +2 -0
  38. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +12 -0
  39. three/src/math/Box3.d.ts +8 -0
  40. three/src/math/ColorManagement.d.ts +12 -2
  41. three/src/math/FrustumArray.d.ts +27 -0
  42. three/src/math/Sphere.d.ts +8 -0
  43. three/src/math/Triangle.d.ts +3 -3
  44. three/src/nodes/Nodes.d.ts +1 -0
  45. three/src/nodes/TSL.d.ts +1 -0
  46. three/src/nodes/accessors/CubeTextureNode.d.ts +12 -1
  47. three/src/nodes/accessors/InstanceNode.d.ts +2 -3
  48. three/src/nodes/accessors/TextureNode.d.ts +11 -6
  49. three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
  50. three/src/nodes/core/AssignNode.d.ts +5 -1
  51. three/src/nodes/core/CacheNode.d.ts +3 -0
  52. three/src/nodes/core/Node.d.ts +11 -7
  53. three/src/nodes/core/NodeUtils.d.ts +4 -0
  54. three/src/nodes/core/NodeVarying.d.ts +11 -1
  55. three/src/nodes/core/StackNode.d.ts +7 -1
  56. three/src/nodes/core/VaryingNode.d.ts +6 -0
  57. three/src/nodes/display/BlendModes.d.ts +4 -0
  58. three/src/nodes/display/ColorSpaceNode.d.ts +2 -12
  59. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -2
  60. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  61. three/src/nodes/lighting/ShadowFilterNode.d.ts +28 -0
  62. three/src/nodes/lighting/ShadowNode.d.ts +26 -24
  63. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  64. three/src/nodes/math/OperatorNode.d.ts +9 -0
  65. three/src/nodes/tsl/TSLCore.d.ts +45 -32
  66. three/src/nodes/utils/DebugNode.d.ts +2 -1
  67. three/src/nodes/utils/ReflectorNode.d.ts +2 -1
  68. three/src/objects/Mesh.d.ts +8 -0
  69. three/src/objects/Sprite.d.ts +8 -0
  70. three/src/renderers/WebGLRenderer.d.ts +2 -2
  71. three/src/renderers/common/Animation.d.ts +2 -2
  72. three/src/renderers/common/Renderer.d.ts +24 -0
  73. three/src/renderers/common/Textures.d.ts +0 -7
  74. three/src/renderers/common/TimestampQueryPool.d.ts +1 -0
  75. three/src/renderers/common/XRManager.d.ts +55 -1
  76. three/src/renderers/webgpu/WebGPUBackend.d.ts +1 -0
  77. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  78. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
  79. three/src/textures/DepthTexture.d.ts +4 -2
  80. three/src/textures/Source.d.ts +20 -16
  81. three/src/textures/Texture.d.ts +76 -2
  82. three/src/textures/VideoFrameTexture.d.ts +1 -1
  83. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  84. three/src/core/RenderTargetArray.d.ts +0 -9
@@ -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.
@@ -377,6 +419,13 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
377
419
  */
378
420
  isRenderTargetTexture: boolean;
379
421
 
422
+ /**
423
+ * Indicates if a texture should be handled like a texture array.
424
+ *
425
+ * @default false
426
+ */
427
+ isArrayTexture: boolean;
428
+
380
429
  /**
381
430
  * An object that can be used to store custom data about the texture.
382
431
  * @remarks It should not hold references to functions as these will not be cloned.
@@ -384,6 +433,12 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
384
433
  */
385
434
  userData: Record<string, any>;
386
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
+
387
442
  /**
388
443
  * This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
389
444
  * @remarks Expects a `Integer`
@@ -432,7 +487,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
432
487
  /**
433
488
  * A callback function, called when the texture is updated _(e.g., when needsUpdate has been set to true and then the texture is used)_.
434
489
  */
435
- onUpdate: () => void;
490
+ onUpdate: ((texture: Texture) => void) | null;
436
491
 
437
492
  /**
438
493
  * Transform the **UV** based on the value of this texture's
@@ -454,6 +509,19 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
454
509
  */
455
510
  updateMatrix(): void;
456
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
+
457
525
  /**
458
526
  * Make copy of the texture. Note this is not a "deep copy", the image is shared. Cloning the texture automatically
459
527
  * marks it for texture upload.
@@ -462,6 +530,12 @@ export class Texture extends EventDispatcher<{ dispose: {} }> {
462
530
 
463
531
  copy(source: Texture): this;
464
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
+
465
539
  /**
466
540
  * Convert the texture to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
467
541
  * @param meta Optional object containing metadata.
@@ -21,7 +21,7 @@ declare class VideoFrameTexture extends VideoTexture {
21
21
  );
22
22
 
23
23
  // FIXME Replace with VideoFrame when we no longer need to support TypeScript 5.0
24
- setFrame(frane: unknown): void;
24
+ setFrame(frame: unknown): void;
25
25
  }
26
26
 
27
27
  export { VideoFrameTexture };
@@ -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 };