@types/three 0.172.0 → 0.173.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 (72) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
  3. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  4. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  5. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  6. three/package.json +2 -2
  7. three/src/Three.Core.d.ts +2 -0
  8. three/src/Three.TSL.d.ts +9 -1
  9. three/src/animation/AnimationClip.d.ts +1 -1
  10. three/src/cameras/ArrayCamera.d.ts +7 -6
  11. three/src/cameras/Camera.d.ts +7 -7
  12. three/src/constants.d.ts +6 -0
  13. three/src/core/BufferAttribute.d.ts +5 -0
  14. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  15. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  16. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +1 -0
  17. three/src/math/Matrix4.d.ts +2 -1
  18. three/src/nodes/Nodes.d.ts +5 -1
  19. three/src/nodes/TSL.d.ts +4 -0
  20. three/src/nodes/accessors/Arrays.d.ts +9 -2
  21. three/src/nodes/accessors/BufferAttributeNode.d.ts +1 -1
  22. three/src/nodes/accessors/Camera.d.ts +1 -0
  23. three/src/nodes/accessors/MaterialNode.d.ts +3 -3
  24. three/src/nodes/accessors/StorageBufferNode.d.ts +7 -3
  25. three/src/nodes/core/ArrayNode.d.ts +26 -0
  26. three/src/nodes/core/Node.d.ts +9 -1
  27. three/src/nodes/core/NodeCache.d.ts +2 -1
  28. three/src/nodes/core/NodeVar.d.ts +6 -2
  29. three/src/nodes/core/StructNode.d.ts +21 -0
  30. three/src/nodes/core/StructType.d.ts +8 -0
  31. three/src/nodes/core/StructTypeNode.d.ts +33 -14
  32. three/src/nodes/core/VarNode.d.ts +8 -1
  33. three/src/nodes/core/VaryingNode.d.ts +9 -0
  34. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  35. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  36. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  37. three/src/nodes/math/MathNode.d.ts +2 -0
  38. three/src/nodes/math/OperatorNode.d.ts +2 -0
  39. three/src/nodes/shapes/Shapes.d.ts +4 -0
  40. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  41. three/src/nodes/tsl/TSLCore.d.ts +16 -3
  42. three/src/nodes/utils/MemberNode.d.ts +11 -0
  43. three/src/objects/BatchedMesh.d.ts +1 -0
  44. three/src/objects/InstancedMesh.d.ts +4 -3
  45. three/src/renderers/WebGLRenderer.d.ts +2 -2
  46. three/src/renderers/common/Animation.d.ts +13 -1
  47. three/src/renderers/common/BufferUtils.d.ts +1 -1
  48. three/src/renderers/common/BundleGroup.d.ts +1 -1
  49. three/src/renderers/common/ChainMap.d.ts +5 -5
  50. three/src/renderers/common/Color4.d.ts +7 -3
  51. three/src/renderers/common/Info.d.ts +0 -11
  52. three/src/renderers/common/Pipelines.d.ts +2 -2
  53. three/src/renderers/common/PostProcessing.d.ts +1 -1
  54. three/src/renderers/common/RenderContext.d.ts +6 -4
  55. three/src/renderers/common/RenderContexts.d.ts +14 -22
  56. three/src/renderers/common/RenderList.d.ts +2 -2
  57. three/src/renderers/common/RenderObject.d.ts +16 -8
  58. three/src/renderers/common/Renderer.d.ts +26 -9
  59. three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
  60. three/src/renderers/common/Uniform.d.ts +27 -1
  61. three/src/renderers/common/XRManager.d.ts +196 -0
  62. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  63. three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
  64. three/src/renderers/common/nodes/NodeLibrary.d.ts +3 -3
  65. three/src/renderers/common/nodes/NodeUniform.d.ts +31 -0
  66. three/src/renderers/common/nodes/Nodes.d.ts +8 -7
  67. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  68. three/src/textures/Texture.d.ts +2 -5
  69. three/src/textures/VideoFrameTexture.d.ts +27 -0
  70. three/examples/jsm/geometries/InstancedPointsGeometry.d.ts +0 -13
  71. three/examples/jsm/objects/InstancedPoints.d.ts +0 -10
  72. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
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: Mon, 06 Jan 2025 09:02:31 GMT
11
+ * Last updated: Fri, 31 Jan 2025 19:32:17 GMT
12
12
  * Dependencies: [@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
@@ -12,14 +12,6 @@ export interface TextGeometryParameters extends ExtrudeGeometryOptions {
12
12
  */
13
13
  size?: number | undefined;
14
14
 
15
- /**
16
- * Thickness to extrude text.
17
- * Expects a `Float`.
18
- * @defaultValue `50`
19
- * @deprecated THREE.TextGeometry: .height is now deprecated. Please use .depth instead
20
- */
21
- height?: number | undefined;
22
-
23
15
  /**
24
16
  * Thickness to extrude text.
25
17
  * Expects a `Float`.
@@ -1,4 +1,4 @@
1
- import { Camera, Group, Object3D, Object3DEventMap, Vector2, WebGLRenderer, XRTargetRaySpace } from "three";
1
+ import { Camera, Group, Object3D, Object3DEventMap, Raycaster, Vector2, WebGLRenderer, XRTargetRaySpace } from "three";
2
2
 
3
3
  export interface InteractiveObject3DEventMap extends Object3DEventMap {
4
4
  hoveron: { data: Vector2 };
@@ -14,7 +14,15 @@ export interface InteractiveObject3DEventMap extends Object3DEventMap {
14
14
  export class InteractiveObject3D extends Object3D<InteractiveObject3DEventMap> {}
15
15
 
16
16
  export class InteractiveGroup extends Group {
17
+ raycaster: Raycaster;
18
+
17
19
  listenToPointerEvents(renderer: WebGLRenderer, camera: Camera): void;
18
20
 
21
+ disconnectionPointerEvents(): void;
22
+
19
23
  listenToXRControllerEvents(controller: XRTargetRaySpace): void;
24
+
25
+ disconnectXrControllerEvents(): void;
26
+
27
+ disconnect(): void;
20
28
  }
@@ -6,6 +6,9 @@
6
6
 
7
7
  import { ShaderMaterial, ShaderMaterialParameters } from "three";
8
8
 
9
+ /**
10
+ * @deprecated Use THREE.MeshLambertMaterial instead.
11
+ */
9
12
  export class MeshGouraudMaterial extends ShaderMaterial {
10
13
  isMeshGouraudMaterial: true;
11
14
 
@@ -1,5 +1,7 @@
1
- import { WebGLRenderer } from "three";
1
+ export interface XRButtonRenderer {
2
+ xr: { setSession(session: XRSession): Promise<void> };
3
+ }
2
4
 
3
5
  export class XRButton {
4
- static createButton(renderer: WebGLRenderer, sessionInit?: XRSessionInit): HTMLElement;
6
+ static createButton(renderer: XRButtonRenderer, sessionInit?: XRSessionInit): HTMLElement;
5
7
  }
three/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/three",
3
- "version": "0.172.0",
3
+ "version": "0.173.0",
4
4
  "description": "TypeScript definitions for three",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three",
6
6
  "license": "MIT",
@@ -48,6 +48,6 @@
48
48
  "meshoptimizer": "~0.18.1"
49
49
  },
50
50
  "peerDependencies": {},
51
- "typesPublisherContentHash": "5a0a6eed488cac2cce6e55921ed12957eedbfbfc3847d24e7762d3d686ecaeac",
51
+ "typesPublisherContentHash": "87d1eae9912dd0ad6de0abf1b48f1f1492997e994d634cca6cfd07481576ed8f",
52
52
  "typeScriptVersion": "5.0"
53
53
  }
three/src/Three.Core.d.ts CHANGED
@@ -140,6 +140,7 @@ export * from "./renderers/WebGL3DRenderTarget.js";
140
140
  export * from "./renderers/WebGLArrayRenderTarget.js";
141
141
  export * from "./renderers/WebGLCubeRenderTarget.js";
142
142
  export * from "./renderers/WebGLRenderTarget.js";
143
+ export * from "./renderers/webxr/WebXRController.js";
143
144
  export * from "./scenes/Fog.js";
144
145
  export * from "./scenes/FogExp2.js";
145
146
  export * from "./scenes/Scene.js";
@@ -155,5 +156,6 @@ export * from "./textures/DepthTexture.js";
155
156
  export * from "./textures/FramebufferTexture.js";
156
157
  export * from "./textures/Source.js";
157
158
  export * from "./textures/Texture.js";
159
+ export * from "./textures/VideoFrameTexture.js";
158
160
  export * from "./textures/VideoTexture.js";
159
161
  export { createCanvasElement } from "./utils.js";
three/src/Three.TSL.d.ts CHANGED
@@ -43,6 +43,7 @@ export const anisotropyB: typeof TSL.anisotropyB;
43
43
  export const anisotropyT: typeof TSL.anisotropyT;
44
44
  export const any: typeof TSL.any;
45
45
  export const append: typeof TSL.append;
46
+ export const array: typeof TSL.array;
46
47
  export const arrayBuffer: typeof TSL.arrayBuffer;
47
48
  export const asin: typeof TSL.asin;
48
49
  export const assign: typeof TSL.assign;
@@ -57,6 +58,7 @@ export const atomicOr: typeof TSL.atomicOr;
57
58
  export const atomicStore: typeof TSL.atomicStore;
58
59
  export const atomicSub: typeof TSL.atomicSub;
59
60
  export const atomicXor: typeof TSL.atomicXor;
61
+ export const atomicLoad: typeof TSL.atomicLoad;
60
62
  export const attenuationColor: typeof TSL.attenuationColor;
61
63
  export const attenuationDistance: typeof TSL.attenuationDistance;
62
64
  export const attribute: typeof TSL.attribute;
@@ -93,6 +95,7 @@ export const bypass: typeof TSL.bypass;
93
95
  export const cache: typeof TSL.cache;
94
96
  export const call: typeof TSL.call;
95
97
  export const cameraFar: typeof TSL.cameraFar;
98
+ export const cameraIndex: typeof TSL.cameraIndex;
96
99
  export const cameraNear: typeof TSL.cameraNear;
97
100
  export const cameraNormalMatrix: typeof TSL.cameraNormalMatrix;
98
101
  export const cameraPosition: typeof TSL.cameraPosition;
@@ -114,6 +117,7 @@ export const colorSpaceToWorking: typeof TSL.colorSpaceToWorking;
114
117
  export const colorToDirection: typeof TSL.colorToDirection;
115
118
  export const compute: typeof TSL.compute;
116
119
  export const cond: typeof TSL.cond;
120
+ export const Const: typeof TSL.Const;
117
121
  export const context: typeof TSL.context;
118
122
  export const convert: typeof TSL.convert;
119
123
  export const convertColorSpace: typeof TSL.convertColorSpace;
@@ -219,6 +223,7 @@ export const lights: typeof TSL.lights;
219
223
  export const linearDepth: typeof TSL.linearDepth;
220
224
  export const linearToneMapping: typeof TSL.linearToneMapping;
221
225
  export const localId: typeof TSL.localId;
226
+ export const globalId: typeof TSL.globalId;
222
227
  export const log: typeof TSL.log;
223
228
  export const log2: typeof TSL.log2;
224
229
  export const logarithmicDepthToViewZ: typeof TSL.logarithmicDepthToViewZ;
@@ -254,7 +259,7 @@ export const materialLineWidth: typeof TSL.materialLineWidth;
254
259
  export const materialMetalness: typeof TSL.materialMetalness;
255
260
  export const materialNormal: typeof TSL.materialNormal;
256
261
  export const materialOpacity: typeof TSL.materialOpacity;
257
- export const materialPointWidth: typeof TSL.materialPointWidth;
262
+ export const materialPointSize: typeof TSL.materialPointSize;
258
263
  export const materialReference: typeof TSL.materialReference;
259
264
  export const materialReflectivity: typeof TSL.materialReflectivity;
260
265
  export const materialRefractionRatio: typeof TSL.materialRefractionRatio;
@@ -413,6 +418,7 @@ export const shaderStages: typeof TSL.shaderStages;
413
418
  export const shadow: typeof TSL.shadow;
414
419
  export const shadowPositionWorld: typeof TSL.shadowPositionWorld;
415
420
  export const sharedUniformGroup: typeof TSL.sharedUniformGroup;
421
+ export const shapeCircle: typeof TSL.shapeCircle;
416
422
  export const sheen: typeof TSL.sheen;
417
423
  export const sheenRoughness: typeof TSL.sheenRoughness;
418
424
  export const shiftLeft: typeof TSL.shiftLeft;
@@ -438,6 +444,7 @@ export const storageBarrier: typeof TSL.storageBarrier;
438
444
  export const storageObject: typeof TSL.storageObject;
439
445
  export const storageTexture: typeof TSL.storageTexture;
440
446
  export const string: typeof TSL.string;
447
+ export const struct: typeof TSL.struct;
441
448
  export const sub: typeof TSL.sub;
442
449
  export const subgroupIndex: typeof TSL.subgroupIndex;
443
450
  export const subgroupSize: typeof TSL.subgroupSize;
@@ -496,6 +503,7 @@ export const uv: typeof TSL.uv;
496
503
  export const uvec2: typeof TSL.uvec2;
497
504
  export const uvec3: typeof TSL.uvec3;
498
505
  export const uvec4: typeof TSL.uvec4;
506
+ export const Var: typeof TSL.Var;
499
507
  export const varying: typeof TSL.varying;
500
508
  export const varyingProperty: typeof TSL.varyingProperty;
501
509
  export const vec2: typeof TSL.vec2;
@@ -41,7 +41,7 @@ export class AnimationClip {
41
41
  validate(): boolean;
42
42
  optimize(): AnimationClip;
43
43
  clone(): this;
44
- toJSON(clip: AnimationClip): any;
44
+ toJSON(): AnimationClipJSON;
45
45
 
46
46
  static CreateFromMorphTargetSequence(
47
47
  name: string,
@@ -11,12 +11,6 @@ import { PerspectiveCamera } from "./PerspectiveCamera.js";
11
11
  * @see {@link https://github.com/mrdoob/three.js/blob/master/src/cameras/ArrayCamera.js | Source}
12
12
  */
13
13
  export class ArrayCamera extends PerspectiveCamera {
14
- /**
15
- * An array of cameras.
16
- * @param array. Default `[]`.
17
- */
18
- constructor(cameras?: PerspectiveCamera[]);
19
-
20
14
  /**
21
15
  * Read-only flag to check if a given object is of type {@link ArrayCamera}.
22
16
  * @remarks This is a _constant_ value
@@ -29,4 +23,11 @@ export class ArrayCamera extends PerspectiveCamera {
29
23
  * @defaultValue `[]`
30
24
  */
31
25
  cameras: PerspectiveCamera[];
26
+
27
+ index: number;
28
+
29
+ /**
30
+ * An array of cameras.
31
+ */
32
+ constructor(cameras?: PerspectiveCamera[]);
32
33
  }
@@ -16,8 +16,8 @@ export class Camera extends Object3D {
16
16
  /**
17
17
  * @remarks
18
18
  * Note that this class is not intended to be called directly; you probably want a
19
- * {@link THREE.PerspectiveCamera | PerspectiveCamera} or
20
- * {@link THREE.OrthographicCamera | OrthographicCamera} instead.
19
+ * {@link PerspectiveCamera | PerspectiveCamera} or
20
+ * {@link OrthographicCamera | OrthographicCamera} instead.
21
21
  */
22
22
  constructor();
23
23
 
@@ -36,7 +36,7 @@ export class Camera extends Object3D {
36
36
 
37
37
  /**
38
38
  * @override
39
- * The {@link THREE.Layers | layers} that the {@link Camera} is a member of.
39
+ * The {@link Layers | layers} that the {@link Camera} is a member of.
40
40
  * @remarks Objects must share at least one layer with the {@link Camera} to be n when the camera's viewpoint is rendered.
41
41
  * @defaultValue `new THREE.Layers()`
42
42
  */
@@ -45,19 +45,19 @@ export class Camera extends Object3D {
45
45
  /**
46
46
  * This is the inverse of matrixWorld.
47
47
  * @remarks MatrixWorld contains the Matrix which has the world transform of the {@link Camera} .
48
- * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
48
+ * @defaultValue {@link Matrix4 | `new THREE.Matrix4()`}
49
49
  */
50
50
  matrixWorldInverse: Matrix4;
51
51
 
52
52
  /**
53
53
  * This is the matrix which contains the projection.
54
- * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
54
+ * @defaultValue {@link Matrix4 | `new THREE.Matrix4()`}
55
55
  */
56
56
  projectionMatrix: Matrix4;
57
57
 
58
58
  /**
59
59
  * This is the inverse of projectionMatrix.
60
- * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
60
+ * @defaultValue {@link Matrix4 | `new THREE.Matrix4()`}
61
61
  */
62
62
  projectionMatrixInverse: Matrix4;
63
63
 
@@ -66,7 +66,7 @@ export class Camera extends Object3D {
66
66
  viewport?: Vector4;
67
67
 
68
68
  /**
69
- * Returns a {@link THREE.Vector3 | Vector3} representing the world space direction in which the {@link Camera} is looking.
69
+ * Returns a {@link Vector3 | Vector3} representing the world space direction in which the {@link Camera} is looking.
70
70
  * @remarks Note: A {@link Camera} looks down its local, negative z-axis.
71
71
  * @param target The result will be copied into this Vector3.
72
72
  */
three/src/constants.d.ts CHANGED
@@ -791,6 +791,12 @@ export const WebGLCoordinateSystem: 2000;
791
791
  export const WebGPUCoordinateSystem: 2001;
792
792
  export type CoordinateSystem = typeof WebGLCoordinateSystem | typeof WebGPUCoordinateSystem;
793
793
 
794
+ export const TimestampQuery: {
795
+ COMPUTE: "compute";
796
+ RENDER: "render";
797
+ };
798
+ export type TimestampQuery = "compute" | "render";
799
+
794
800
  ///////////////////////////////////////////////////////////////////////////////
795
801
  // Texture - Internal Pixel Formats
796
802
 
@@ -57,6 +57,11 @@ export class BufferAttribute {
57
57
  */
58
58
  constructor(array: TypedArray, itemSize: number, normalized?: boolean);
59
59
 
60
+ /**
61
+ * Unique number for this attribute instance.
62
+ */
63
+ readonly id: number;
64
+
60
65
  /**
61
66
  * Optional name for this attribute instance.
62
67
  * @defaultValue ''
@@ -1,7 +1,3 @@
1
- export {
2
- default as InstancedPointsNodeMaterial,
3
- InstancedPointsNodeMaterialParameters,
4
- } from "./InstancedPointsNodeMaterial.js";
5
1
  export { default as Line2NodeMaterial, Line2NodeMaterialParameters } from "./Line2NodeMaterial.js";
6
2
  export { default as LineBasicNodeMaterial, LineBasicNodeMaterialParameters } from "./LineBasicNodeMaterial.js";
7
3
  export { default as LineDashedNodeMaterial, LineDashedNodeMaterialParameters } from "./LineDashedNodeMaterial.js";
@@ -1,21 +1,14 @@
1
- import { Color } from "../../math/Color.js";
2
- import { Texture } from "../../textures/Texture.js";
3
- import { PointsMaterialParameters } from "../PointsMaterial.js";
4
- import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
1
+ import Node from "../../nodes/core/Node.js";
2
+ import SpriteNodeMaterial, { SpriteNodeMaterialParameters } from "./SpriteNodeMaterial.js";
5
3
 
6
- export interface PointsNodeMaterialParameters extends NodeMaterialParameters, PointsMaterialParameters {
4
+ export interface PointsNodeMaterialParameters extends SpriteNodeMaterialParameters {
5
+ sizeNode?: Node | null | undefined;
7
6
  }
8
7
 
9
- export default class PointsNodeMaterial extends NodeMaterial {
10
- readonly isPointsNodeMaterial: true;
8
+ export default class PointsNodeMaterial extends SpriteNodeMaterial {
9
+ sizeNode: Node | null;
11
10
 
12
- // Properties from PointsMaterial
13
- readonly isPointsMaterial: true;
14
- color: Color;
15
- map: Texture | null;
16
- alphaMap: Texture | null;
17
- size: number;
18
- sizeAttenuation: boolean;
11
+ readonly isPointsNodeMaterial: true;
19
12
 
20
13
  constructor(parameters?: PointsNodeMaterialParameters);
21
14
  }
@@ -68,6 +68,7 @@ interface AttributesData {
68
68
  interface RenderObjectData {
69
69
  material: MaterialData;
70
70
  geometry: {
71
+ id: number;
71
72
  attributes: AttributesData;
72
73
  indexVersion: number | null;
73
74
  drawRange: {
@@ -128,7 +128,8 @@ export class Matrix4 {
128
128
  makeRotationFromQuaternion(q: Quaternion): this;
129
129
 
130
130
  /**
131
- * Constructs a rotation matrix, looking from eye towards center with defined up vector.
131
+ * Sets the rotation component of the transformation matrix, looking from [eye]{@link Vector3} towards
132
+ * [target]{@link Vector3}, and oriented by the up-direction [up]{@link Vector3}.
132
133
  */
133
134
  lookAt(eye: Vector3, target: Vector3, up: Vector3): this;
134
135
 
@@ -2,6 +2,7 @@
2
2
  export * from "./core/constants.js";
3
3
 
4
4
  // core
5
+ export { default as ArrayNode } from "./core/ArrayNode.js";
5
6
  export { default as AssignNode } from "./core/AssignNode.js";
6
7
  export { default as AttributeNode } from "./core/AttributeNode.js";
7
8
  export { default as BypassNode } from "./core/BypassNode.js";
@@ -37,6 +38,8 @@ export { default as OutputStructNode } from "./core/OutputStructNode.js";
37
38
  export { default as ParameterNode } from "./core/ParameterNode.js";
38
39
  export { default as PropertyNode } from "./core/PropertyNode.js";
39
40
  export { default as StackNode } from "./core/StackNode.js";
41
+ export { default as StructNode } from "./core/StructNode.js";
42
+ export { default as StructTypeNode } from "./core/StructTypeNode.js";
40
43
  export { default as TempNode } from "./core/TempNode.js";
41
44
  export { default as UniformGroupNode } from "./core/UniformGroupNode.js";
42
45
  export { default as UniformNode } from "./core/UniformNode.js";
@@ -55,6 +58,7 @@ export { default as JoinNode } from "./utils/JoinNode.js";
55
58
  export { default as LoopNode } from "./utils/LoopNode.js";
56
59
  export { default as MatcapUVNode } from "./utils/MatcapUVNode.js";
57
60
  export { default as MaxMipLevelNode } from "./utils/MaxMipLevelNode.js";
61
+ export { default as MemberNode } from "./utils/MemberNode.js";
58
62
  export { default as ReflectorNode, ReflectorNodeParameters } from "./utils/ReflectorNode.js";
59
63
  export { default as RemapNode } from "./utils/RemapNode.js";
60
64
  export { default as RotateNode } from "./utils/RotateNode.js";
@@ -115,7 +119,7 @@ export { default as ScriptableNode } from "./code/ScriptableNode.js";
115
119
  export { default as ScriptableValueNode } from "./code/ScriptableValueNode.js";
116
120
 
117
121
  // geometry
118
- export { default as RangeNode, RangeModeBound } from "./geometry/RangeNode.js";
122
+ export { default as RangeNode } from "./geometry/RangeNode.js";
119
123
 
120
124
  // gpgpu
121
125
  export { default as ComputeNode } from "./gpgpu/ComputeNode.js";
three/src/nodes/TSL.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./core/OutputStructNode.js";
13
13
  export * from "./core/ParameterNode.js";
14
14
  export * from "./core/PropertyNode.js";
15
15
  export * from "./core/StackNode.js";
16
+ export * from "./core/StructNode.js";
16
17
  export * from "./core/UniformGroupNode.js";
17
18
  export * from "./core/UniformNode.js";
18
19
  export * from "./core/VaryingNode.js";
@@ -142,6 +143,9 @@ export * from "./pmrem/PMREMUtils.js";
142
143
  // procedural
143
144
  export * from "./procedural/Checker.js";
144
145
 
146
+ // shapes
147
+ export * from "./shapes/Shapes.js";
148
+
145
149
  // materialX
146
150
  export * from "./materialx/MaterialXNodes.js";
147
151
 
@@ -1,7 +1,14 @@
1
1
  import { TypedArray } from "../../core/BufferAttribute.js";
2
+ import { Struct } from "../core/StructNode.js";
2
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
4
  import StorageBufferNode from "./StorageBufferNode.js";
4
5
 
5
- export const attributeArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
6
+ export const attributeArray: (
7
+ count: TypedArray | number,
8
+ type?: string | Struct,
9
+ ) => ShaderNodeObject<StorageBufferNode>;
6
10
 
7
- export const instancedArray: (count: TypedArray | number, type?: string) => ShaderNodeObject<StorageBufferNode>;
11
+ export const instancedArray: (
12
+ count: TypedArray | number,
13
+ type?: string | Struct,
14
+ ) => ShaderNodeObject<StorageBufferNode>;
@@ -98,7 +98,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
98
98
  /**
99
99
  * Sets the `instanced` property to the given value.
100
100
  *
101
- * @param {Number} value - The value to set.
101
+ * @param {Boolean} value - The value to set.
102
102
  * @return {BufferAttributeNode} A reference to this node.
103
103
  */
104
104
  setInstanced(value: boolean): this;
@@ -4,6 +4,7 @@ import { Vector3 } from "../../math/Vector3.js";
4
4
  import UniformNode from "../core/UniformNode.js";
5
5
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
6
6
 
7
+ export const cameraIndex: ShaderNodeObject<UniformNode<number>>;
7
8
  export const cameraNear: ShaderNodeObject<UniformNode<number>>;
8
9
  export const cameraFar: ShaderNodeObject<UniformNode<number>>;
9
10
  export const cameraProjectionMatrix: ShaderNodeObject<UniformNode<Matrix4>>;
@@ -37,7 +37,7 @@ export type MaterialNodeScope =
37
37
  | typeof MaterialNode.LINE_GAP_SIZE
38
38
  | typeof MaterialNode.LINE_WIDTH
39
39
  | typeof MaterialNode.LINE_DASH_OFFSET
40
- | typeof MaterialNode.POINT_WIDTH
40
+ | typeof MaterialNode.POINT_SIZE
41
41
  | typeof MaterialNode.DISPERSION
42
42
  | typeof MaterialNode.LIGHT_MAP
43
43
  | typeof MaterialNode.AO
@@ -77,7 +77,7 @@ export default class MaterialNode extends Node {
77
77
  static LINE_GAP_SIZE: "gapSize";
78
78
  static LINE_WIDTH: "linewidth";
79
79
  static LINE_DASH_OFFSET: "dashOffset";
80
- static POINT_WIDTH: "pointWidth";
80
+ static POINT_SIZE: "size";
81
81
  static DISPERSION: "dispersion";
82
82
  static LIGHT_MAP: "light";
83
83
  static AO: "ao";
@@ -122,7 +122,7 @@ export const materialLineDashSize: ShaderNodeObject<MaterialNode>;
122
122
  export const materialLineGapSize: ShaderNodeObject<MaterialNode>;
123
123
  export const materialLineWidth: ShaderNodeObject<MaterialNode>;
124
124
  export const materialLineDashOffset: ShaderNodeObject<MaterialNode>;
125
- export const materialPointWidth: ShaderNodeObject<MaterialNode>;
125
+ export const materialPointSize: ShaderNodeObject<MaterialNode>;
126
126
  export const materialDispersion: ShaderNodeObject<MaterialNode>;
127
127
  export const materialLightMap: ShaderNodeObject<MaterialNode>;
128
128
  export const materialAO: ShaderNodeObject<MaterialNode>;
@@ -1,6 +1,8 @@
1
1
  import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
2
2
  import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
3
3
  import { NodeAccess } from "../core/constants.js";
4
+ import { Struct } from "../core/StructNode.js";
5
+ import StructTypeNode from "../core/StructTypeNode.js";
4
6
  import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
5
7
  import StorageArrayElementNode from "../utils/StorageArrayElementNode.js";
6
8
  import BufferNode from "./BufferNode.js";
@@ -8,6 +10,8 @@ import BufferNode from "./BufferNode.js";
8
10
  export default class StorageBufferNode extends BufferNode<StorageBufferAttribute | StorageInstancedBufferAttribute> {
9
11
  readonly isStorageBufferNode: true;
10
12
 
13
+ structTypeNode: StructTypeNode | null;
14
+
11
15
  access: NodeAccess;
12
16
  isAtomic: boolean;
13
17
  isPBO: boolean;
@@ -16,7 +20,7 @@ export default class StorageBufferNode extends BufferNode<StorageBufferAttribute
16
20
 
17
21
  constructor(
18
22
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
19
- bufferType?: string | null,
23
+ bufferType?: string | Struct | null,
20
24
  bufferCount?: number,
21
25
  );
22
26
 
@@ -37,7 +41,7 @@ export default class StorageBufferNode extends BufferNode<StorageBufferAttribute
37
41
 
38
42
  export const storage: (
39
43
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
40
- type?: string | null,
44
+ type?: string | Struct | null,
41
45
  count?: number,
42
46
  ) => ShaderNodeObject<StorageBufferNode>;
43
47
 
@@ -46,6 +50,6 @@ export const storage: (
46
50
  */
47
51
  export const storageObject: (
48
52
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
49
- type?: string | null,
53
+ type?: string | Struct | null,
50
54
  count?: number,
51
55
  ) => ShaderNodeObject<StorageBufferNode>;
@@ -0,0 +1,26 @@
1
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import Node from "./Node.js";
3
+ import TempNode from "./TempNode.js";
4
+
5
+ declare class ArrayNode extends TempNode {
6
+ count: number;
7
+ values: Node[];
8
+ readonly isArrayNode: true;
9
+
10
+ constructor(nodeType: string, count: number, values: Node[]);
11
+ }
12
+
13
+ export default ArrayNode;
14
+
15
+ interface ArrayFunction {
16
+ (values: Node[]): ShaderNodeObject<ArrayNode>;
17
+ (nodeType: string, count: number): ShaderNodeObject<ArrayNode>;
18
+ }
19
+
20
+ export const array: ArrayFunction;
21
+
22
+ declare module "../tsl/TSLCore.js" {
23
+ interface NodeElements {
24
+ toArray: typeof array;
25
+ }
26
+ }
@@ -241,6 +241,14 @@ declare class Node extends EventDispatcher<{
241
241
  * @return {String} The type of the node.
242
242
  */
243
243
  getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
244
+ /**
245
+ * Returns the node member type for the given name.
246
+ *
247
+ * @param {NodeBuilder} builder - The current node builder.
248
+ * @param {String} name - The name of the member.
249
+ * @return {String} The type of the node.
250
+ */
251
+ getMemberType(builder: NodeBuilder, name: string): string;
244
252
  /**
245
253
  * Returns the node's type.
246
254
  *
@@ -322,7 +330,7 @@ declare class Node extends EventDispatcher<{
322
330
  /**
323
331
  * Returns the child nodes as a JSON object.
324
332
  *
325
- * @return {Object} The serialized child objects as JSON.
333
+ * @return {Array<Object>} An iterable list of serialized child objects as JSON.
326
334
  */
327
335
  getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
328
336
  /**
@@ -7,6 +7,7 @@ import NodeCode from "./NodeCode.js";
7
7
  import NodeUniform from "./NodeUniform.js";
8
8
  import NodeVar from "./NodeVar.js";
9
9
  import NodeVarying from "./NodeVarying.js";
10
+ import StructType from "./StructType.js";
10
11
  export interface ShaderStageNodeData {
11
12
  properties?:
12
13
  | (
@@ -20,7 +21,7 @@ export interface ShaderStageNodeData {
20
21
  )
21
22
  | undefined;
22
23
  bufferAttribute?: NodeAttribute | undefined;
23
- structType?: Node | undefined;
24
+ structType?: StructType | undefined;
24
25
  uniform?: NodeUniform<unknown> | undefined;
25
26
  variable?: NodeVar | undefined;
26
27
  varying?: NodeVarying | undefined;
@@ -7,13 +7,17 @@
7
7
  declare class NodeVar {
8
8
  readonly isNodeVar: true;
9
9
  name: string;
10
- type: string | null;
10
+ type: string;
11
+ readOnly: boolean;
12
+ count: number | null;
11
13
  /**
12
14
  * Constructs a new node variable.
13
15
  *
14
16
  * @param {String} name - The name of the variable.
15
17
  * @param {String} type - The type of the variable.
18
+ * @param {Boolean} [readOnly=false] - The read-only flag.
19
+ * @param {Number?} [count=null] - The size.
16
20
  */
17
- constructor(name: string, type: string | null);
21
+ constructor(name: string, type: string, readOnly?: boolean, count?: number | null);
18
22
  }
19
23
  export default NodeVar;
@@ -0,0 +1,21 @@
1
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import Node from "./Node.js";
3
+ import StructTypeNode, { MembersLayout } from "./StructTypeNode.js";
4
+
5
+ declare class StructNode extends Node {
6
+ values: Node[];
7
+
8
+ constructor(structLayoutNode: StructTypeNode, values: Node[]);
9
+ }
10
+
11
+ export default StructNode;
12
+
13
+ export interface Struct {
14
+ (): ShaderNodeObject<StructNode>;
15
+ (values: Node[]): ShaderNodeObject<StructNode>;
16
+ (...values: Node[]): ShaderNodeObject<StructNode>;
17
+ layout: StructTypeNode;
18
+ isStruct: true;
19
+ }
20
+
21
+ export const struct: (membersLayout: MembersLayout, name?: string | null) => Struct;
@@ -0,0 +1,8 @@
1
+ import { MemberLayout } from "./StructTypeNode.js";
2
+ declare class StructType {
3
+ name: string;
4
+ members: MemberLayout[];
5
+ output: boolean;
6
+ constructor(name: string, members: MemberLayout[]);
7
+ }
8
+ export default StructType;