@types/three 0.173.0 → 0.175.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 (136) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +1 -1
  3. three/examples/jsm/animation/CCDIKSolver.d.ts +3 -2
  4. three/examples/jsm/controls/PointerLockControls.d.ts +4 -1
  5. three/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
  6. three/examples/jsm/interactive/HTMLMesh.d.ts +9 -2
  7. three/examples/jsm/loaders/LUTImageLoader.d.ts +2 -2
  8. three/examples/jsm/loaders/MTLLoader.d.ts +2 -1
  9. three/examples/jsm/misc/Timer.d.ts +13 -2
  10. three/examples/jsm/objects/Reflector.d.ts +1 -0
  11. three/examples/jsm/postprocessing/HalftonePass.d.ts +1 -1
  12. three/examples/jsm/postprocessing/LUTPass.d.ts +1 -1
  13. three/examples/jsm/postprocessing/SMAAPass.d.ts +1 -1
  14. three/examples/jsm/transpiler/AST.d.ts +218 -1
  15. three/examples/jsm/transpiler/TSLEncoder.d.ts +35 -1
  16. three/examples/jsm/tsl/math/Bayer.d.ts +4 -0
  17. three/examples/jsm/tsl/utils/Raymarching.d.ts +9 -0
  18. three/examples/jsm/webxr/VRButton.d.ts +4 -2
  19. three/package.json +2 -2
  20. three/src/Three.TSL.d.ts +7 -1
  21. three/src/Three.d.ts +6 -1
  22. three/src/animation/AnimationAction.d.ts +219 -19
  23. three/src/animation/AnimationClip.d.ts +140 -28
  24. three/src/animation/AnimationMixer.d.ts +100 -8
  25. three/src/animation/AnimationObjectGroup.d.ts +55 -14
  26. three/src/animation/AnimationUtils.d.ts +154 -43
  27. three/src/animation/KeyframeTrack.d.ts +134 -25
  28. three/src/animation/PropertyBinding.d.ts +89 -31
  29. three/src/animation/PropertyMixer.d.ts +62 -5
  30. three/src/animation/tracks/BooleanKeyframeTrack.d.ts +12 -4
  31. three/src/animation/tracks/ColorKeyframeTrack.d.ts +10 -4
  32. three/src/animation/tracks/NumberKeyframeTrack.d.ts +10 -4
  33. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +10 -4
  34. three/src/animation/tracks/StringKeyframeTrack.d.ts +12 -4
  35. three/src/animation/tracks/VectorKeyframeTrack.d.ts +10 -4
  36. three/src/constants.d.ts +2 -2
  37. three/src/core/BufferAttribute.d.ts +11 -0
  38. three/src/core/BufferGeometry.d.ts +1 -3
  39. three/src/core/Raycaster.d.ts +4 -0
  40. three/src/extras/Controls.d.ts +1 -1
  41. three/src/extras/Earcut.d.ts +5 -3
  42. three/src/extras/ImageUtils.d.ts +1 -0
  43. three/src/extras/PMREMGenerator.d.ts +15 -2
  44. three/src/geometries/TorusGeometry.d.ts +5 -6
  45. three/src/lights/PointLight.d.ts +1 -1
  46. three/src/loaders/FileLoader.d.ts +2 -2
  47. three/src/loaders/LoaderUtils.d.ts +0 -5
  48. three/src/materials/Material.d.ts +3 -0
  49. three/src/materials/nodes/NodeMaterial.d.ts +2 -1
  50. three/src/materials/nodes/VolumeNodeMaterial.d.ts +14 -2
  51. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -4
  52. three/src/nodes/Nodes.d.ts +2 -2
  53. three/src/nodes/TSL.d.ts +1 -0
  54. three/src/nodes/accessors/BufferAttributeNode.d.ts +36 -26
  55. three/src/nodes/accessors/Lights.d.ts +1 -1
  56. three/src/nodes/accessors/MaterialProperties.d.ts +5 -0
  57. three/src/nodes/accessors/ModelNode.d.ts +1 -0
  58. three/src/nodes/accessors/Object3DNode.d.ts +7 -5
  59. three/src/nodes/accessors/SkinningNode.d.ts +4 -3
  60. three/src/nodes/accessors/StorageTextureNode.d.ts +2 -2
  61. three/src/nodes/accessors/Texture3DNode.d.ts +2 -2
  62. three/src/nodes/accessors/TextureNode.d.ts +3 -1
  63. three/src/nodes/code/ExpressionNode.d.ts +3 -2
  64. three/src/nodes/code/ScriptableNode.d.ts +1 -1
  65. three/src/nodes/code/ScriptableValueNode.d.ts +1 -1
  66. three/src/nodes/core/LightingModel.d.ts +13 -28
  67. three/src/nodes/core/Node.d.ts +24 -24
  68. three/src/nodes/core/NodeAttribute.d.ts +3 -3
  69. three/src/nodes/core/NodeCache.d.ts +2 -2
  70. three/src/nodes/core/NodeParser.d.ts +1 -1
  71. three/src/nodes/core/NodeUniform.d.ts +4 -4
  72. three/src/nodes/core/NodeVar.d.ts +4 -4
  73. three/src/nodes/core/NodeVarying.d.ts +2 -2
  74. three/src/nodes/core/StructTypeNode.d.ts +3 -3
  75. three/src/nodes/core/UniformNode.d.ts +7 -7
  76. three/src/nodes/core/constants.d.ts +0 -1
  77. three/src/nodes/display/PassNode.d.ts +10 -1
  78. three/src/nodes/functions/BSDF/LTC.d.ts +5 -1
  79. three/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
  80. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +1 -12
  81. three/src/nodes/lighting/AnalyticLightNode.d.ts +13 -1
  82. three/src/nodes/lighting/LightingContextNode.d.ts +18 -4
  83. three/src/nodes/lighting/LightsNode.d.ts +24 -0
  84. three/src/nodes/lighting/PointLightNode.d.ts +8 -7
  85. three/src/nodes/lighting/ShadowBaseNode.d.ts +3 -0
  86. three/src/nodes/math/ConditionalNode.d.ts +4 -4
  87. three/src/nodes/math/MathNode.d.ts +20 -12
  88. three/src/nodes/math/OperatorNode.d.ts +57 -26
  89. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  90. three/src/nodes/tsl/TSLCore.d.ts +3 -0
  91. three/src/nodes/utils/DebugNode.d.ts +20 -0
  92. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  93. three/src/nodes/utils/SpriteSheetUVNode.d.ts +2 -2
  94. three/src/objects/LOD.d.ts +4 -3
  95. three/src/renderers/common/Animation.d.ts +6 -6
  96. three/src/renderers/common/Attributes.d.ts +2 -2
  97. three/src/renderers/common/BindGroup.d.ts +2 -2
  98. three/src/renderers/common/Binding.d.ts +2 -2
  99. three/src/renderers/common/Buffer.d.ts +3 -3
  100. three/src/renderers/common/BufferUtils.d.ts +7 -8
  101. three/src/renderers/common/BundleGroup.d.ts +2 -2
  102. three/src/renderers/common/ChainMap.d.ts +3 -3
  103. three/src/renderers/common/ClippingContext.d.ts +3 -3
  104. three/src/renderers/common/Color4.d.ts +8 -8
  105. three/src/renderers/common/ComputePipeline.d.ts +1 -1
  106. three/src/renderers/common/CubeRenderTarget.d.ts +6 -0
  107. three/src/renderers/common/DataMap.d.ts +2 -2
  108. three/src/renderers/common/Geometries.d.ts +4 -4
  109. three/src/renderers/common/Info.d.ts +2 -2
  110. three/src/renderers/common/Pipeline.d.ts +1 -1
  111. three/src/renderers/common/Pipelines.d.ts +9 -9
  112. three/src/renderers/common/ProgrammableStage.d.ts +4 -4
  113. three/src/renderers/common/RenderContext.d.ts +2 -2
  114. three/src/renderers/common/RenderContexts.d.ts +3 -3
  115. three/src/renderers/common/RenderList.d.ts +11 -11
  116. three/src/renderers/common/RenderObject.d.ts +13 -13
  117. three/src/renderers/common/RenderObjects.d.ts +3 -3
  118. three/src/renderers/common/RenderPipeline.d.ts +1 -1
  119. three/src/renderers/common/Renderer.d.ts +143 -108
  120. three/src/renderers/common/Textures.d.ts +6 -6
  121. three/src/renderers/common/TimestampQueryPool.d.ts +13 -1
  122. three/src/renderers/common/Uniform.d.ts +13 -13
  123. three/src/renderers/common/UniformBuffer.d.ts +1 -1
  124. three/src/renderers/common/UniformsGroup.d.ts +13 -13
  125. three/src/renderers/common/XRManager.d.ts +79 -15
  126. three/src/renderers/common/XRRenderTarget.d.ts +4 -4
  127. three/src/renderers/common/extras/PMREMGenerator.d.ts +9 -2
  128. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
  129. three/src/renderers/common/nodes/NodeLibrary.d.ts +11 -11
  130. three/src/renderers/common/nodes/NodeUniform.d.ts +9 -9
  131. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +1 -1
  132. three/src/renderers/common/nodes/Nodes.d.ts +11 -11
  133. three/src/renderers/webgl/WebGLState.d.ts +7 -6
  134. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
  135. three/src/textures/CanvasTexture.d.ts +1 -1
  136. three/examples/jsm/geometries/ParametricGeometries.d.ts +0 -32
@@ -1,10 +1,18 @@
1
1
  import { KeyframeTrack } from "../KeyframeTrack.js";
2
2
 
3
+ /**
4
+ * A track for boolean keyframe values.
5
+ */
3
6
  export class BooleanKeyframeTrack extends KeyframeTrack {
4
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>);
5
-
6
7
  /**
7
- * @default 'bool'
8
+ * Constructs a new boolean keyframe track.
9
+ *
10
+ * This keyframe track type has no `interpolation` parameter because the
11
+ * interpolation is always discrete.
12
+ *
13
+ * @param {string} name - The keyframe track's name.
14
+ * @param {Array<number>} times - A list of keyframe times.
15
+ * @param {Array<number>} values - A list of keyframe values.
8
16
  */
9
- ValueTypeName: string;
17
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>);
10
18
  }
@@ -1,11 +1,17 @@
1
1
  import { InterpolationModes } from "../../constants.js";
2
2
  import { KeyframeTrack } from "../KeyframeTrack.js";
3
3
 
4
+ /**
5
+ * A track for color keyframe values.
6
+ */
4
7
  export class ColorKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
-
7
8
  /**
8
- * @default 'color'
9
+ * Constructs a new color keyframe track.
10
+ *
11
+ * @param {string} name - The keyframe track's name.
12
+ * @param {Array<number>} times - A list of keyframe times.
13
+ * @param {Array<number>} values - A list of keyframe values.
14
+ * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
9
15
  */
10
- ValueTypeName: string;
16
+ constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
11
17
  }
@@ -1,11 +1,17 @@
1
1
  import { InterpolationModes } from "../../constants.js";
2
2
  import { KeyframeTrack } from "../KeyframeTrack.js";
3
3
 
4
+ /**
5
+ * A track for numeric keyframe values.
6
+ */
4
7
  export class NumberKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
-
7
8
  /**
8
- * @default 'number'
9
+ * Constructs a new number keyframe track.
10
+ *
11
+ * @param {string} name - The keyframe track's name.
12
+ * @param {Array<number>} times - A list of keyframe times.
13
+ * @param {Array<number>} values - A list of keyframe values.
14
+ * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
9
15
  */
10
- ValueTypeName: string;
16
+ constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
11
17
  }
@@ -1,11 +1,17 @@
1
1
  import { InterpolationModes } from "../../constants.js";
2
2
  import { KeyframeTrack } from "../KeyframeTrack.js";
3
3
 
4
+ /**
5
+ * A track for Quaternion keyframe values.
6
+ */
4
7
  export class QuaternionKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
-
7
8
  /**
8
- * @default 'quaternion'
9
+ * Constructs a new Quaternion keyframe track.
10
+ *
11
+ * @param {string} name - The keyframe track's name.
12
+ * @param {Array<number>} times - A list of keyframe times.
13
+ * @param {Array<number>} values - A list of keyframe values.
14
+ * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
9
15
  */
10
- ValueTypeName: string;
16
+ constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
11
17
  }
@@ -1,10 +1,18 @@
1
1
  import { KeyframeTrack } from "../KeyframeTrack.js";
2
2
 
3
+ /**
4
+ * A track for string keyframe values.
5
+ */
3
6
  export class StringKeyframeTrack extends KeyframeTrack {
4
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<any>);
5
-
6
7
  /**
7
- * @default 'string'
8
+ * Constructs a new string keyframe track.
9
+ *
10
+ * This keyframe track type has no `interpolation` parameter because the
11
+ * interpolation is always discrete.
12
+ *
13
+ * @param {string} name - The keyframe track's name.
14
+ * @param {Array<number>} times - A list of keyframe times.
15
+ * @param {Array<number>} values - A list of keyframe values.
8
16
  */
9
- ValueTypeName: string;
17
+ constructor(name: string, times: Array<number>, values: Array<number>);
10
18
  }
@@ -1,11 +1,17 @@
1
1
  import { InterpolationModes } from "../../constants.js";
2
2
  import { KeyframeTrack } from "../KeyframeTrack.js";
3
3
 
4
+ /**
5
+ * A track for vector keyframe values.
6
+ */
4
7
  export class VectorKeyframeTrack extends KeyframeTrack {
5
- constructor(name: string, times: ArrayLike<number>, values: ArrayLike<number>, interpolation?: InterpolationModes);
6
-
7
8
  /**
8
- * @default 'vector'
9
+ * Constructs a new vector keyframe track.
10
+ *
11
+ * @param {string} name - The keyframe track's name.
12
+ * @param {Array<number>} times - A list of keyframe times.
13
+ * @param {Array<number>} values - A list of keyframe values.
14
+ * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
9
15
  */
10
- ValueTypeName: string;
16
+ constructor(name: string, times: Array<number>, values: Array<number>, interpolation?: InterpolationModes);
11
17
  }
three/src/constants.d.ts CHANGED
@@ -420,7 +420,7 @@ export const RGFormat: 1030;
420
420
  export const RGIntegerFormat: 1031;
421
421
 
422
422
  /**
423
- * {@link RGBIntegerFormat} discrads the alpha components and reads the red, green, and blue components.
423
+ * {@link RGBIntegerFormat} discards the alpha components and reads the red, green, and blue components.
424
424
  */
425
425
  export const RGBIntegerFormat: 1032;
426
426
 
@@ -478,7 +478,7 @@ export const RGBA_S3TC_DXT1_Format: 33777;
478
478
  */
479
479
  export const RGBA_S3TC_DXT3_Format: 33778;
480
480
  /**
481
- * A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 compression in how the alpha compression is done.
481
+ * A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs from the DXT3 compression in how the alpha compression is done.
482
482
  * @remarks Require support for the _WEBGL_compressed_texture_s3tc_ WebGL extension.
483
483
  */
484
484
  export const RGBA_S3TC_DXT5_Format: 33779;
@@ -13,6 +13,17 @@ export type TypedArray =
13
13
  | Float32Array
14
14
  | Float64Array;
15
15
 
16
+ export type TypedArrayConstructor =
17
+ | Int8ArrayConstructor
18
+ | Uint8ArrayConstructor
19
+ | Uint8ClampedArrayConstructor
20
+ | Int16ArrayConstructor
21
+ | Uint16ArrayConstructor
22
+ | Int32ArrayConstructor
23
+ | Uint32ArrayConstructor
24
+ | Float32ArrayConstructor
25
+ | Float64ArrayConstructor;
26
+
16
27
  export interface BufferAttributeJSON {
17
28
  itemSize: number;
18
29
  type: string;
@@ -172,9 +172,7 @@ 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: {
176
- [name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; // TODO Replace for 'Record<>'
177
- };
175
+ morphAttributes: Record<"position" | "normal" | "color", Array<BufferAttribute | InterleavedBufferAttribute>>;
178
176
 
179
177
  /**
180
178
  * 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.
@@ -17,6 +17,10 @@ export interface Face {
17
17
  export interface Intersection<TIntersected extends Object3D = Object3D> {
18
18
  /** Distance between the origin of the ray and the intersection */
19
19
  distance: number;
20
+ /**
21
+ * Some objects (f.e. {@link Points}) provide the distance of the intersection to the nearest point on the ray. For
22
+ * other objects it will be `undefined`
23
+ */
20
24
  distanceToRay?: number | undefined;
21
25
  /** Point of intersection, in world coordinates */
22
26
  point: Vector3;
@@ -32,7 +32,7 @@ declare abstract class Controls<TEventMap extends {}> extends EventDispatcher<TE
32
32
  * Connects the controls to the DOM. This method has so called "side effects" since it adds the module's event
33
33
  * listeners to the DOM.
34
34
  */
35
- connect(): void;
35
+ connect(element: HTMLElement): void;
36
36
 
37
37
  /**
38
38
  * Disconnects the controls from the DOM.
@@ -5,11 +5,13 @@
5
5
  * @see {@link https://threejs.org/docs/index.html#api/en/extras/Earcut | Official Documentation}
6
6
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/Earcut.js | Source}
7
7
  */
8
- export const Earcut: {
8
+ declare class Earcut {
9
9
  /**
10
10
  * Triangulates the given shape definition by returning an array of triangles
11
11
  * @remarks
12
12
  * A triangle is defined by three consecutive integers representing vertex indices.
13
13
  */
14
- triangulate(data: number[], holeIndices?: number[], dim?: number): number[];
15
- };
14
+ static triangulate(data: number[], holeIndices?: number[], dim?: number): number[];
15
+ }
16
+
17
+ export { Earcut };
@@ -10,6 +10,7 @@ declare class ImageUtils {
10
10
  */
11
11
  static getDataURL(
12
12
  image: HTMLImageElement | HTMLCanvasElement | CanvasImageSource | ImageBitmap | ImageData,
13
+ type?: string,
13
14
  ): string;
14
15
 
15
16
  /**
@@ -1,9 +1,15 @@
1
+ import { Vector3 } from "../math/Vector3.js";
1
2
  import { WebGLRenderer } from "../renderers/WebGLRenderer.js";
2
3
  import { WebGLRenderTarget } from "../renderers/WebGLRenderTarget.js";
3
4
  import { Scene } from "../scenes/Scene.js";
4
5
  import { CubeTexture } from "../textures/CubeTexture.js";
5
6
  import { Texture } from "../textures/Texture.js";
6
7
 
8
+ export interface PMREMGeneratorOptions {
9
+ size?: number | undefined;
10
+ position?: Vector3 | undefined;
11
+ }
12
+
7
13
  /**
8
14
  * This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cubeMap environment texture.
9
15
  * @remarks
@@ -38,13 +44,20 @@ export class PMREMGenerator {
38
44
  /**
39
45
  * Generates a PMREM from a supplied Scene, which can be faster than using an image if networking bandwidth is low
40
46
  * @remarks
41
- * Optional near and far planes ensure the scene is rendered in its entirety (the cubeCamera is placed at the origin).
47
+ * Optional near and far planes ensure the scene is rendered in its entirety.
42
48
  * @param scene The given scene.
43
49
  * @param sigma Specifies a blur radius in radians to be applied to the scene before PMREM generation. Default `0`.
44
50
  * @param near The near plane value. Default `0.1`.
45
51
  * @param far The far plane value. Default `100`.
52
+ * @param {?Object} [options={}]
46
53
  */
47
- fromScene(scene: Scene, sigma?: number, near?: number, far?: number): WebGLRenderTarget;
54
+ fromScene(
55
+ scene: Scene,
56
+ sigma?: number,
57
+ near?: number,
58
+ far?: number,
59
+ options?: PMREMGeneratorOptions,
60
+ ): WebGLRenderTarget;
48
61
 
49
62
  /**
50
63
  * Generates a PMREM from an equirectangular texture, which can be either LDR or HDR. The ideal input image size is
@@ -16,12 +16,11 @@ import { BufferGeometry } from "../core/BufferGeometry.js";
16
16
  */
17
17
  export class TorusGeometry extends BufferGeometry {
18
18
  /**
19
- * Create a new instance of {@link TorusGeometry}
20
- * @param radius Radius of the torus, from the center of the torus to the center of the tube. Expects a `Float`. Default `1`.
21
- * @param tube Radius of the tube. Expects a `Float`. Default `0.4`.
22
- * @param radialSegments Expects a `Integer`.Default is `12`.
23
- * @param tubularSegments Expects a `Integer`. Default `48`.
24
- * @param arc Central angle. Expects a `Float`. Default `Math.PI * 2`
19
+ * @param radius Radius of the torus, from the center of the torus to the center of the tube. Default `1`.
20
+ * @param tube Radius of the tube. Must be smaller than `radius`. Default is `0.4`.
21
+ * @param radialSegments Default is `12`.
22
+ * @param tubularSegments Default is `48`.
23
+ * @param arc Central angle. Default is Math.PI * 2.
25
24
  */
26
25
  constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number);
27
26
 
@@ -22,7 +22,7 @@ import { PointLightShadow } from "./PointLightShadow.js";
22
22
  export class PointLight extends Light<PointLightShadow> {
23
23
  /**
24
24
  * Creates a new PointLight.
25
- * @param color Hexadecimal color of the light. Default is 0xffffff (white). Expects a `Integer`
25
+ * @param color Hexadecimal color of the light. Default is 0xffffff (white). Expects an `Integer`
26
26
  * @param intensity Numeric value of the light's strength/intensity. Expects a `Float`. Default `1`
27
27
  * @param distance Maximum range of the light. Default is 0 (no limit).
28
28
  * @param decay The amount the light dims along the distance of the light. Expects a `Float`. Default `2`
@@ -11,8 +11,8 @@ export class FileLoader extends Loader<string | ArrayBuffer> {
11
11
  onError?: (err: unknown) => void,
12
12
  ): void;
13
13
 
14
- mimeType: string | undefined;
15
- responseType: string | undefined;
14
+ mimeType: string;
15
+ responseType: string;
16
16
 
17
17
  setMimeType(mimeType: string): FileLoader;
18
18
  setResponseType(responseType: string): FileLoader;
@@ -1,9 +1,4 @@
1
1
  export class LoaderUtils {
2
- /**
3
- * @deprecated decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.
4
- */
5
- static decodeText(array: BufferSource): string;
6
-
7
2
  static extractUrlBase(url: string): string;
8
3
 
9
4
  static resolveURL(url: string, path: string): string;
@@ -52,6 +52,7 @@ export interface MaterialParameters {
52
52
  precision?: "highp" | "mediump" | "lowp" | null | undefined;
53
53
  premultipliedAlpha?: boolean | undefined;
54
54
  forceSinglePass?: boolean | undefined;
55
+ allowOverride?: boolean | undefined;
55
56
  dithering?: boolean | undefined;
56
57
  side?: Side | undefined;
57
58
  shadowSide?: Side | undefined;
@@ -479,6 +480,8 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
479
480
  */
480
481
  forceSinglePass: boolean;
481
482
 
483
+ allowOverride: boolean;
484
+
482
485
  /**
483
486
  * Whether to apply dithering to the color to remove the appearance of banding. Default is false.
484
487
  * @default false
@@ -60,7 +60,7 @@ declare class NodeMaterial extends Material {
60
60
 
61
61
  depthNode: Node | null;
62
62
  shadowPositionNode: Node | null;
63
- receivedShadowNode: Node | null;
63
+ receivedShadowNode: (() => Node) | null;
64
64
  castShadowNode: Node | null;
65
65
 
66
66
  outputNode: Node | null;
@@ -89,6 +89,7 @@ declare class NodeMaterial extends Material {
89
89
  setupOutgoingLight(): Node;
90
90
  setupLightingModel(builder: NodeBuilder): LightingModel;
91
91
  setupLighting(builder: NodeBuilder): Node;
92
+ setupFog(builder: NodeBuilder, outputNode: Node): Node;
92
93
  setupOutput(builder: NodeBuilder, outputNode: Node): Node;
93
94
 
94
95
  setDefaultValues(material: Material): void;
@@ -1,10 +1,22 @@
1
+ import FunctionNode from "../../nodes/code/FunctionNode.js";
1
2
  import Node from "../../nodes/core/Node.js";
3
+ import { ShaderNodeObject } from "../../nodes/tsl/TSLCore.js";
2
4
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
3
5
 
6
+ export interface VolumeNodeMaterialParameters extends NodeMaterialParameters {
7
+ steps?: number | undefined;
8
+
9
+ scatteringNode?: Node | null | undefined;
10
+ }
11
+
4
12
  export default class VolumeNodeMaterial extends NodeMaterial {
5
- lights: boolean;
6
13
  readonly isVolumeNodeMaterial: true;
7
- testNode: Node | null;
14
+
15
+ steps: number;
16
+
17
+ scatteringNode: (params: { positionRay: ShaderNodeObject<Node> }) => Node | null;
18
+
19
+ offsetNode?: Node | undefined;
8
20
 
9
21
  constructor(parameters?: NodeMaterialParameters);
10
22
  }
@@ -100,7 +100,7 @@ declare class NodeMaterialObserver {
100
100
  * Returns `true` if the given render object is verified for the first time of this observer.
101
101
  *
102
102
  * @param {RenderObject} renderObject - The render object.
103
- * @return {Boolean} Whether the given render object is verified for the first time of this observer.
103
+ * @return {boolean} Whether the given render object is verified for the first time of this observer.
104
104
  */
105
105
  firstInitialization(renderObject: RenderObject): boolean;
106
106
  /**
@@ -123,7 +123,7 @@ declare class NodeMaterialObserver {
123
123
  * node properties.
124
124
  *
125
125
  * @param {NodeBuilder} builder - The current node builder.
126
- * @return {Boolean} Whether the node builder's material uses node properties or not.
126
+ * @return {boolean} Whether the node builder's material uses node properties or not.
127
127
  */
128
128
  containsNode(builder: NodeBuilder): boolean;
129
129
  /**
@@ -138,7 +138,7 @@ declare class NodeMaterialObserver {
138
138
  * Returns `true` if the given render object has not changed its state.
139
139
  *
140
140
  * @param {RenderObject} renderObject - The render object.
141
- * @return {Boolean} Whether the given render object has changed its state or not.
141
+ * @return {boolean} Whether the given render object has changed its state or not.
142
142
  */
143
143
  equals(renderObject: RenderObject): boolean;
144
144
  /**
@@ -146,7 +146,7 @@ declare class NodeMaterialObserver {
146
146
  *
147
147
  * @param {RenderObject} renderObject - The render object.
148
148
  * @param {NodeFrame} nodeFrame - The current node frame.
149
- * @return {Boolean} Whether the given render object requires a refresh or not.
149
+ * @return {boolean} Whether the given render object requires a refresh or not.
150
150
  */
151
151
  needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): boolean;
152
152
  }
@@ -14,7 +14,6 @@ export {
14
14
  default as LightingModel,
15
15
  LightingModelDirectInput,
16
16
  LightingModelDirectRectAreaInput,
17
- LightingModelIndirectInput,
18
17
  LightingModelReflectedLight,
19
18
  } from "./core/LightingModel.js";
20
19
  export { default as MRTNode } from "./core/MRTNode.js";
@@ -52,6 +51,7 @@ export { NodeUtils };
52
51
  // utils
53
52
  export { default as ArrayElementNode } from "./utils/ArrayElementNode.js";
54
53
  export { default as ConvertNode } from "./utils/ConvertNode.js";
54
+ export { default as DebugNode } from "./utils/DebugNode.js";
55
55
  export { default as EquirectUVNode } from "./utils/EquirectUVNode.js";
56
56
  export { default as FunctionOverloadingNode } from "./utils/FunctionOverloadingNode.js";
57
57
  export { default as JoinNode } from "./utils/JoinNode.js";
@@ -134,7 +134,7 @@ export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js";
134
134
  export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js";
135
135
  export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js";
136
136
  export { default as IrradianceNode } from "./lighting/IrradianceNode.js";
137
- export { default as LightingContextNode } from "./lighting/LightingContextNode.js";
137
+ export { default as LightingContextNode, LightingContext } from "./lighting/LightingContextNode.js";
138
138
  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";
three/src/nodes/TSL.d.ts CHANGED
@@ -133,6 +133,7 @@ export * from "./accessors/Lights.js";
133
133
  export * from "./lighting/LightingContextNode.js";
134
134
  export * from "./lighting/LightsNode.js";
135
135
  export * from "./lighting/PointLightNode.js";
136
+ export * from "./lighting/PointShadowNode.js";
136
137
  export * from "./lighting/ShadowBaseNode.js";
137
138
  export * from "./lighting/ShadowNode.js";
138
139
 
@@ -4,7 +4,8 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js";
4
4
  import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js";
5
5
  import InputNode from "../core/InputNode.js";
6
6
  import NodeBuilder from "../core/NodeBuilder.js";
7
- /** @module BufferAttributeNode **/
7
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
8
+ import BufferNode from "./BufferNode.js";
8
9
  /**
9
10
  * In earlier `three.js` versions it was only possible to define attribute data
10
11
  * on geometry level. With `BufferAttributeNode`, it is also possible to do this
@@ -40,9 +41,9 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
40
41
  * Constructs a new buffer attribute node.
41
42
  *
42
43
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data.
43
- * @param {String?} [bufferType=null] - The buffer type (e.g. `'vec3'`).
44
- * @param {Number} [bufferStride=0] - The buffer stride.
45
- * @param {Number} [bufferOffset=0] - The buffer offset.
44
+ * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`).
45
+ * @param {number} [bufferStride=0] - The buffer stride.
46
+ * @param {number} [bufferOffset=0] - The buffer offset.
46
47
  */
47
48
  constructor(
48
49
  value: TypedArray | InterleavedBuffer | BufferAttribute,
@@ -55,7 +56,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
55
56
  * and thus the hash should be shared as well.
56
57
  *
57
58
  * @param {NodeBuilder} builder - The current node builder.
58
- * @return {String} The hash.
59
+ * @return {string} The hash.
59
60
  */
60
61
  getHash(builder: NodeBuilder): string;
61
62
  /**
@@ -63,7 +64,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
63
64
  * the buffer attribute.
64
65
  *
65
66
  * @param {NodeBuilder} builder - The current node builder.
66
- * @return {String} The node type.
67
+ * @return {string} The node type.
67
68
  */
68
69
  getNodeType(builder: NodeBuilder): string | null;
69
70
  /**
@@ -78,27 +79,27 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
78
79
  * Generates the code snippet of the buffer attribute node.
79
80
  *
80
81
  * @param {NodeBuilder} builder - The current node builder.
81
- * @return {String} The generated code snippet.
82
+ * @return {string} The generated code snippet.
82
83
  */
83
84
  generate(builder: NodeBuilder): string | null | undefined;
84
85
  /**
85
86
  * Overwrites the default implementation to return a fixed value `'bufferAttribute'`.
86
87
  *
87
88
  * @param {NodeBuilder} builder - The current node builder.
88
- * @return {String} The input type.
89
+ * @return {string} The input type.
89
90
  */
90
91
  getInputType(): string;
91
92
  /**
92
93
  * Sets the `usage` property to the given value.
93
94
  *
94
- * @param {Number} value - The usage to set.
95
+ * @param {number} value - The usage to set.
95
96
  * @return {BufferAttributeNode} A reference to this node.
96
97
  */
97
98
  setUsage(value: Usage): this;
98
99
  /**
99
100
  * Sets the `instanced` property to the given value.
100
101
  *
101
- * @param {Boolean} value - The value to set.
102
+ * @param {boolean} value - The value to set.
102
103
  * @return {BufferAttributeNode} A reference to this node.
103
104
  */
104
105
  setInstanced(value: boolean): this;
@@ -107,11 +108,12 @@ export default BufferAttributeNode;
107
108
  /**
108
109
  * TSL function for creating a buffer attribute node.
109
110
  *
111
+ * @tsl
110
112
  * @function
111
113
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
112
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
113
- * @param {Number} [stride=0] - The buffer stride.
114
- * @param {Number} [offset=0] - The buffer offset.
114
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
115
+ * @param {number} [stride=0] - The buffer stride.
116
+ * @param {number} [offset=0] - The buffer offset.
115
117
  * @returns {BufferAttributeNode}
116
118
  */
117
119
  export declare const bufferAttribute: (
@@ -119,16 +121,17 @@ export declare const bufferAttribute: (
119
121
  type?: string | null,
120
122
  stride?: number,
121
123
  offset?: number,
122
- ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
124
+ ) => ShaderNodeObject<BufferAttributeNode>;
123
125
  /**
124
126
  * TSL function for creating a buffer attribute node but with dynamic draw usage.
125
127
  * Use this function if attribute data are updated per frame.
126
128
  *
129
+ * @tsl
127
130
  * @function
128
131
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
129
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
130
- * @param {Number} [stride=0] - The buffer stride.
131
- * @param {Number} [offset=0] - The buffer offset.
132
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
133
+ * @param {number} [stride=0] - The buffer stride.
134
+ * @param {number} [offset=0] - The buffer offset.
132
135
  * @returns {BufferAttributeNode}
133
136
  */
134
137
  export declare const dynamicBufferAttribute: (
@@ -136,15 +139,16 @@ export declare const dynamicBufferAttribute: (
136
139
  type?: string | null,
137
140
  stride?: number,
138
141
  offset?: number,
139
- ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
142
+ ) => ShaderNodeObject<BufferAttributeNode>;
140
143
  /**
141
144
  * TSL function for creating a buffer attribute node but with enabled instancing
142
145
  *
146
+ * @tsl
143
147
  * @function
144
148
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
145
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
146
- * @param {Number} [stride=0] - The buffer stride.
147
- * @param {Number} [offset=0] - The buffer offset.
149
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
150
+ * @param {number} [stride=0] - The buffer stride.
151
+ * @param {number} [offset=0] - The buffer offset.
148
152
  * @returns {BufferAttributeNode}
149
153
  */
150
154
  export declare const instancedBufferAttribute: (
@@ -152,15 +156,16 @@ export declare const instancedBufferAttribute: (
152
156
  type?: string | null,
153
157
  stride?: number,
154
158
  offset?: number,
155
- ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
159
+ ) => ShaderNodeObject<BufferAttributeNode>;
156
160
  /**
157
161
  * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
158
162
  *
163
+ * @tsl
159
164
  * @function
160
165
  * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
161
- * @param {String?} [type=null] - The buffer type (e.g. `'vec3'`).
162
- * @param {Number} [stride=0] - The buffer stride.
163
- * @param {Number} [offset=0] - The buffer offset.
166
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
167
+ * @param {number} [stride=0] - The buffer stride.
168
+ * @param {number} [offset=0] - The buffer offset.
164
169
  * @returns {BufferAttributeNode}
165
170
  */
166
171
  export declare const instancedDynamicBufferAttribute: (
@@ -168,4 +173,9 @@ export declare const instancedDynamicBufferAttribute: (
168
173
  type?: string | null,
169
174
  stride?: number,
170
175
  offset?: number,
171
- ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
176
+ ) => ShaderNodeObject<BufferAttributeNode>;
177
+ declare module "../tsl/TSLCore.js" {
178
+ interface NodeElements {
179
+ toAttribute: <TValue>(bufferNode: BufferNode<TValue>) => ShaderNodeObject<BufferAttributeNode>;
180
+ }
181
+ }
@@ -4,7 +4,7 @@ import { ShaderNodeObject } from "../tsl/TSLCore.js";
4
4
 
5
5
  export function lightShadowMatrix(light: Light): ShaderNodeObject<Node>;
6
6
 
7
- export function lightProjectionUV(light: Light): ShaderNodeObject<Node>;
7
+ export function lightProjectionUV(light: Light, position?: Node): ShaderNodeObject<Node>;
8
8
 
9
9
  export function lightPosition(light: Light): ShaderNodeObject<Node>;
10
10
 
@@ -1,4 +1,9 @@
1
+ import { Matrix4 } from "../../math/Matrix4.js";
1
2
  import UniformNode from "../core/UniformNode.js";
2
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
 
4
5
  export const materialRefractionRatio: ShaderNodeObject<UniformNode<number>>;
6
+
7
+ export const materialEnvIntensity: ShaderNodeObject<UniformNode<number>>;
8
+
9
+ export const materialEnvRotation: ShaderNodeObject<UniformNode<Matrix4>>;