@types/three 0.171.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 (152) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -5
  3. three/examples/jsm/controls/ArcballControls.d.ts +1 -1
  4. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  5. three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
  6. three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
  7. three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
  8. three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
  9. three/examples/jsm/lines/LineSegments2.d.ts +3 -1
  10. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
  11. three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
  12. three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
  13. three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
  14. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
  15. three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
  16. three/examples/jsm/webxr/XRButton.d.ts +4 -2
  17. three/package.json +2 -2
  18. three/src/Three.Core.d.ts +4 -1
  19. three/src/Three.TSL.d.ts +18 -5
  20. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  21. three/src/Three.WebGPU.d.ts +2 -2
  22. three/src/animation/AnimationClip.d.ts +1 -1
  23. three/src/cameras/ArrayCamera.d.ts +7 -6
  24. three/src/cameras/Camera.d.ts +7 -7
  25. three/src/cameras/CubeCamera.d.ts +19 -2
  26. three/src/constants.d.ts +6 -0
  27. three/src/core/BufferAttribute.d.ts +5 -0
  28. three/src/core/RenderTarget.d.ts +3 -5
  29. three/src/core/RenderTarget3D.d.ts +9 -0
  30. three/src/core/RenderTargetArray.d.ts +9 -0
  31. three/src/materials/Material.d.ts +3 -1
  32. three/src/materials/MeshDepthMaterial.d.ts +0 -5
  33. three/src/materials/MeshDistanceMaterial.d.ts +0 -5
  34. three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
  35. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
  36. three/src/materials/nodes/NodeMaterial.d.ts +3 -0
  37. three/src/materials/nodes/NodeMaterials.d.ts +0 -4
  38. three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
  39. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
  40. three/src/math/Matrix4.d.ts +2 -1
  41. three/src/nodes/Nodes.d.ts +6 -7
  42. three/src/nodes/TSL.d.ts +6 -3
  43. three/src/nodes/accessors/Arrays.d.ts +10 -2
  44. three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
  45. three/src/nodes/accessors/BufferNode.d.ts +4 -4
  46. three/src/nodes/accessors/Camera.d.ts +1 -0
  47. three/src/nodes/accessors/MaterialNode.d.ts +6 -6
  48. three/src/nodes/accessors/ModelNode.d.ts +10 -2
  49. three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
  50. three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
  51. three/src/nodes/accessors/TextureNode.d.ts +5 -0
  52. three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
  53. three/src/nodes/core/ArrayNode.d.ts +26 -0
  54. three/src/nodes/core/Node.d.ts +245 -0
  55. three/src/nodes/core/NodeAttribute.d.ts +13 -0
  56. three/src/nodes/core/NodeBuilder.d.ts +1 -2
  57. three/src/nodes/core/NodeCache.d.ts +23 -1
  58. three/src/nodes/core/NodeParser.d.ts +11 -0
  59. three/src/nodes/core/NodeUniform.d.ts +28 -0
  60. three/src/nodes/core/NodeVar.d.ts +18 -2
  61. three/src/nodes/core/NodeVarying.d.ts +14 -0
  62. three/src/nodes/core/StructNode.d.ts +21 -0
  63. three/src/nodes/core/StructType.d.ts +8 -0
  64. three/src/nodes/core/StructTypeNode.d.ts +41 -4
  65. three/src/nodes/core/UniformNode.d.ts +44 -0
  66. three/src/nodes/core/VarNode.d.ts +8 -1
  67. three/src/nodes/core/VaryingNode.d.ts +12 -0
  68. three/src/nodes/core/constants.d.ts +35 -0
  69. three/src/nodes/display/PassNode.d.ts +1 -1
  70. three/src/nodes/fog/Fog.d.ts +26 -0
  71. three/src/nodes/geometry/RangeNode.d.ts +6 -11
  72. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
  73. three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
  74. three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
  75. three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
  76. three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
  77. three/src/nodes/lighting/ShadowNode.d.ts +2 -1
  78. three/src/nodes/math/MathNode.d.ts +15 -4
  79. three/src/nodes/math/OperatorNode.d.ts +2 -0
  80. three/src/nodes/shapes/Shapes.d.ts +4 -0
  81. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  82. three/src/nodes/tsl/TSLCore.d.ts +62 -17
  83. three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
  84. three/src/nodes/utils/LoopNode.d.ts +23 -2
  85. three/src/nodes/utils/MemberNode.d.ts +11 -0
  86. three/src/objects/BatchedMesh.d.ts +1 -0
  87. three/src/objects/ClippingGroup.d.ts +1 -1
  88. three/src/objects/InstancedMesh.d.ts +4 -3
  89. three/src/renderers/WebGLRenderer.d.ts +10 -10
  90. three/src/renderers/common/Animation.d.ts +43 -1
  91. three/src/renderers/common/Attributes.d.ts +31 -0
  92. three/src/renderers/common/Backend.d.ts +11 -0
  93. three/src/renderers/common/Background.d.ts +22 -0
  94. three/src/renderers/common/BindGroup.d.ts +15 -0
  95. three/src/renderers/common/Binding.d.ts +24 -0
  96. three/src/renderers/common/Bindings.d.ts +54 -0
  97. three/src/renderers/common/Buffer.d.ts +31 -0
  98. three/src/renderers/common/BufferUtils.d.ts +26 -0
  99. three/src/renderers/common/BundleGroup.d.ts +22 -0
  100. three/src/renderers/common/ChainMap.d.ts +33 -3
  101. three/src/renderers/common/ClippingContext.d.ts +45 -0
  102. three/src/renderers/common/Color4.d.ts +40 -0
  103. three/src/renderers/common/ComputePipeline.d.ts +12 -0
  104. three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
  105. three/src/renderers/common/DataMap.d.ts +30 -0
  106. three/src/renderers/common/Geometries.d.ts +52 -0
  107. three/src/renderers/common/Info.d.ts +21 -5
  108. three/src/renderers/common/Pipeline.d.ts +11 -0
  109. three/src/renderers/common/Pipelines.d.ts +104 -0
  110. three/src/renderers/common/PostProcessing.d.ts +1 -1
  111. three/src/renderers/common/ProgrammableStage.d.ts +19 -1
  112. three/src/renderers/common/RenderBundle.d.ts +15 -4
  113. three/src/renderers/common/RenderBundles.d.ts +20 -2
  114. three/src/renderers/common/RenderContext.d.ts +27 -3
  115. three/src/renderers/common/RenderContexts.d.ts +37 -6
  116. three/src/renderers/common/RenderList.d.ts +85 -0
  117. three/src/renderers/common/RenderLists.d.ts +21 -0
  118. three/src/renderers/common/RenderObject.d.ts +163 -4
  119. three/src/renderers/common/RenderObjects.d.ts +53 -0
  120. three/src/renderers/common/RenderPipeline.d.ts +13 -0
  121. three/src/renderers/common/Renderer.d.ts +604 -10
  122. three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
  123. three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
  124. three/src/renderers/common/Textures.d.ts +66 -0
  125. three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
  126. three/src/renderers/common/Uniform.d.ts +133 -1
  127. three/src/renderers/common/UniformBuffer.d.ts +12 -0
  128. three/src/renderers/common/UniformsGroup.d.ts +103 -0
  129. three/src/renderers/common/XRManager.d.ts +196 -0
  130. three/src/renderers/common/XRRenderTarget.d.ts +23 -0
  131. three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
  132. three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
  133. three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
  134. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
  135. three/src/renderers/common/nodes/Nodes.d.ts +192 -17
  136. three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
  137. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
  138. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
  139. three/src/textures/DataTexture.d.ts +2 -2
  140. three/src/textures/Texture.d.ts +5 -5
  141. three/src/textures/VideoFrameTexture.d.ts +27 -0
  142. three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
  143. three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
  144. three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
  145. three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
  146. three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
  147. three/src/Three.Legacy.d.ts +0 -20
  148. three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
  149. three/src/nodes/core/UniformGroup.d.ts +0 -7
  150. three/src/nodes/fog/FogExp2Node.d.ts +0 -14
  151. three/src/nodes/fog/FogNode.d.ts +0 -20
  152. three/src/nodes/fog/FogRangeNode.d.ts +0 -19
@@ -5,6 +5,7 @@ import { LineDashedMaterialParameters } from "../LineDashedMaterial.js";
5
5
  import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";
6
6
 
7
7
  export interface Line2NodeMaterialParameters extends NodeMaterialParameters, LineDashedMaterialParameters {
8
+ worldUnits?: boolean | undefined;
8
9
  dashed?: boolean | undefined;
9
10
  }
10
11
 
@@ -1,14 +1,14 @@
1
- import ConstNode from "../../nodes/core/ConstNode.js";
1
+ import InputNode from "../../nodes/core/InputNode.js";
2
2
  import Node from "../../nodes/core/Node.js";
3
3
  import MeshPhysicalNodeMaterial, { MeshPhysicalNodeMaterialParameters } from "./MeshPhysicalNodeMaterial.js";
4
4
 
5
5
  export default class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
6
6
  thicknessColorNode: Node | null;
7
- thicknessDistortionNode: ConstNode<number>;
8
- thicknessAmbientNode: ConstNode<number>;
9
- thicknessAttenuationNode: ConstNode<number>;
10
- thicknessPowerNode: ConstNode<number>;
11
- thicknessScaleNode: ConstNode<number>;
7
+ thicknessDistortionNode: InputNode<number>;
8
+ thicknessAmbientNode: InputNode<number>;
9
+ thicknessAttenuationNode: InputNode<number>;
10
+ thicknessPowerNode: InputNode<number>;
11
+ thicknessScaleNode: InputNode<number>;
12
12
 
13
13
  constructor(parameters?: MeshPhysicalNodeMaterialParameters);
14
14
 
@@ -76,6 +76,9 @@ declare class NodeMaterial extends Material {
76
76
  setupClipping(builder: NodeBuilder): ClippingNode | null;
77
77
  setupHardwareClipping(builder: NodeBuilder): void;
78
78
  setupDepth(builder: NodeBuilder): void;
79
+ setupPositionView(): Node;
80
+ setupModelViewProjection(): Node;
81
+ setupVertex(builder: NodeBuilder): Node;
79
82
  setupPosition(builder: NodeBuilder): Node;
80
83
  setupDiffuseColor(builder: NodeBuilder): void;
81
84
  setupVariants(builder: NodeBuilder): void;
@@ -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: {
@@ -78,19 +79,75 @@ interface RenderObjectData {
78
79
  worldMatrix: Matrix4;
79
80
  version?: number;
80
81
  }
82
+ /**
83
+ * This class is used by {@link WebGPURenderer} as management component.
84
+ * It's primary purpose is to determine whether render objects require a
85
+ * refresh right before they are going to be rendered or not.
86
+ */
81
87
  declare class NodeMaterialObserver {
82
88
  renderObjects: WeakMap<RenderObject, RenderObjectData>;
83
89
  hasNode: boolean;
84
90
  hasAnimation: boolean;
85
91
  refreshUniforms: readonly RefreshUniform[];
86
92
  renderId: number;
93
+ /**
94
+ * Constructs a new node material observer.
95
+ *
96
+ * @param {NodeBuilder} builder - The node builder.
97
+ */
87
98
  constructor(builder: NodeBuilder);
99
+ /**
100
+ * Returns `true` if the given render object is verified for the first time of this observer.
101
+ *
102
+ * @param {RenderObject} renderObject - The render object.
103
+ * @return {Boolean} Whether the given render object is verified for the first time of this observer.
104
+ */
88
105
  firstInitialization(renderObject: RenderObject): boolean;
106
+ /**
107
+ * Returns monitoring data for the given render object.
108
+ *
109
+ * @param {RenderObject} renderObject - The render object.
110
+ * @return {Object} The monitoring data.
111
+ */
89
112
  getRenderObjectData(renderObject: RenderObject): RenderObjectData;
113
+ /**
114
+ * Returns an attribute data structure holding the attributes versions for
115
+ * monitoring.
116
+ *
117
+ * @param {Object} attributes - The geometry attributes.
118
+ * @return {Object} An object for monitoring the versions of attributes.
119
+ */
90
120
  getAttributesData(attributes: Record<string, BufferAttribute>): AttributesData;
121
+ /**
122
+ * Returns `true` if the node builder's material uses
123
+ * node properties.
124
+ *
125
+ * @param {NodeBuilder} builder - The current node builder.
126
+ * @return {Boolean} Whether the node builder's material uses node properties or not.
127
+ */
91
128
  containsNode(builder: NodeBuilder): boolean;
129
+ /**
130
+ * Returns a material data structure holding the material property values for
131
+ * monitoring.
132
+ *
133
+ * @param {Material} material - The material.
134
+ * @return {Object} An object for monitoring material properties.
135
+ */
92
136
  getMaterialData(material: Material): MaterialData;
137
+ /**
138
+ * Returns `true` if the given render object has not changed its state.
139
+ *
140
+ * @param {RenderObject} renderObject - The render object.
141
+ * @return {Boolean} Whether the given render object has changed its state or not.
142
+ */
93
143
  equals(renderObject: RenderObject): boolean;
144
+ /**
145
+ * Checks if the given render object requires a refresh.
146
+ *
147
+ * @param {RenderObject} renderObject - The render object.
148
+ * @param {NodeFrame} nodeFrame - The current node frame.
149
+ * @return {Boolean} Whether the given render object requires a refresh or not.
150
+ */
94
151
  needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): boolean;
95
152
  }
96
153
  export default NodeMaterialObserver;
@@ -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";
@@ -75,7 +79,6 @@ export { default as InstanceNode } from "./accessors/InstanceNode.js";
75
79
  export { default as MaterialNode, MaterialNodeScope } from "./accessors/MaterialNode.js";
76
80
  export { default as MaterialReferenceNode } from "./accessors/MaterialReferenceNode.js";
77
81
  export { default as ModelNode } from "./accessors/ModelNode.js";
78
- export { default as ModelViewProjectionNode } from "./accessors/ModelViewProjectionNode.js";
79
82
  export { default as MorphNode } from "./accessors/MorphNode.js";
80
83
  export { default as Object3DNode } from "./accessors/Object3DNode.js";
81
84
  export { default as PointUVNode } from "./accessors/PointUVNode.js";
@@ -115,13 +118,8 @@ export { default as FunctionNode } from "./code/FunctionNode.js";
115
118
  export { default as ScriptableNode } from "./code/ScriptableNode.js";
116
119
  export { default as ScriptableValueNode } from "./code/ScriptableValueNode.js";
117
120
 
118
- // fog
119
- export { default as FogExp2Node } from "./fog/FogExp2Node.js";
120
- export { default as FogNode } from "./fog/FogNode.js";
121
- export { default as FogRangeNode } from "./fog/FogRangeNode.js";
122
-
123
121
  // geometry
124
- export { default as RangeNode, RangeModeBound } from "./geometry/RangeNode.js";
122
+ export { default as RangeNode } from "./geometry/RangeNode.js";
125
123
 
126
124
  // gpgpu
127
125
  export { default as ComputeNode } from "./gpgpu/ComputeNode.js";
@@ -142,6 +140,7 @@ export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
142
140
  export { default as LightsNode } from "./lighting/LightsNode.js";
143
141
  export { default as PointLightNode } from "./lighting/PointLightNode.js";
144
142
  export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js";
143
+ export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js";
145
144
  export { default as ShadowNode } from "./lighting/ShadowNode.js";
146
145
  export { default as SpotLightNode } from "./lighting/SpotLightNode.js";
147
146
 
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";
@@ -115,9 +116,7 @@ export * from "./code/ScriptableNode.js";
115
116
  export * from "./code/ScriptableValueNode.js";
116
117
 
117
118
  // fog
118
- export * from "./fog/FogExp2Node.js";
119
- export * from "./fog/FogNode.js";
120
- export * from "./fog/FogRangeNode.js";
119
+ export * from "./fog/Fog.js";
121
120
 
122
121
  // geometry
123
122
  export * from "./geometry/RangeNode.js";
@@ -134,6 +133,7 @@ export * from "./accessors/Lights.js";
134
133
  export * from "./lighting/LightingContextNode.js";
135
134
  export * from "./lighting/LightsNode.js";
136
135
  export * from "./lighting/PointLightNode.js";
136
+ export * from "./lighting/ShadowBaseNode.js";
137
137
  export * from "./lighting/ShadowNode.js";
138
138
 
139
139
  // pmrem
@@ -143,6 +143,9 @@ export * from "./pmrem/PMREMUtils.js";
143
143
  // procedural
144
144
  export * from "./procedural/Checker.js";
145
145
 
146
+ // shapes
147
+ export * from "./shapes/Shapes.js";
148
+
146
149
  // materialX
147
150
  export * from "./materialx/MaterialXNodes.js";
148
151
 
@@ -1,6 +1,14 @@
1
+ import { TypedArray } from "../../core/BufferAttribute.js";
2
+ import { Struct } from "../core/StructNode.js";
1
3
  import { ShaderNodeObject } from "../tsl/TSLCore.js";
2
4
  import StorageBufferNode from "./StorageBufferNode.js";
3
5
 
4
- export const attributeArray: (count: number, type?: string) => ShaderNodeObject<StorageBufferNode>;
6
+ export const attributeArray: (
7
+ count: TypedArray | number,
8
+ type?: string | Struct,
9
+ ) => ShaderNodeObject<StorageBufferNode>;
5
10
 
6
- export const instancedArray: (count: number, type?: string) => ShaderNodeObject<StorageBufferNode>;
11
+ export const instancedArray: (
12
+ count: TypedArray | number,
13
+ type?: string | Struct,
14
+ ) => ShaderNodeObject<StorageBufferNode>;
@@ -4,6 +4,29 @@ 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 **/
8
+ /**
9
+ * In earlier `three.js` versions it was only possible to define attribute data
10
+ * on geometry level. With `BufferAttributeNode`, it is also possible to do this
11
+ * on the node level.
12
+ * ```js
13
+ * const geometry = new THREE.PlaneGeometry();
14
+ * const positionAttribute = geometry.getAttribute( 'position' );
15
+ *
16
+ * const colors = [];
17
+ * for ( let i = 0; i < position.count; i ++ ) {
18
+ * colors.push( 1, 0, 0 );
19
+ * }
20
+ *
21
+ * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) );
22
+ * ```
23
+ * This new approach is especially interesting when geometry data are generated via
24
+ * compute shaders. The below line converts a storage buffer into an attribute node.
25
+ * ```js
26
+ * material.positionNode = positionBuffer.toAttribute();
27
+ * ```
28
+ * @augments InputNode
29
+ */
7
30
  declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuffer | BufferAttribute> {
8
31
  static get type(): string;
9
32
  readonly isBufferNode: true;
@@ -13,39 +36,133 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
13
36
  usage: Usage;
14
37
  instanced: boolean;
15
38
  attribute: BufferAttribute | InterleavedBufferAttribute | null;
39
+ /**
40
+ * Constructs a new buffer attribute node.
41
+ *
42
+ * @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.
46
+ */
16
47
  constructor(
17
48
  value: TypedArray | InterleavedBuffer | BufferAttribute,
18
49
  bufferType?: string | null,
19
50
  bufferStride?: number,
20
51
  bufferOffset?: number,
21
52
  );
53
+ /**
54
+ * This method is overwritten since the attribute data might be shared
55
+ * and thus the hash should be shared as well.
56
+ *
57
+ * @param {NodeBuilder} builder - The current node builder.
58
+ * @return {String} The hash.
59
+ */
22
60
  getHash(builder: NodeBuilder): string;
61
+ /**
62
+ * This method is overwritten since the node type is inferred from
63
+ * the buffer attribute.
64
+ *
65
+ * @param {NodeBuilder} builder - The current node builder.
66
+ * @return {String} The node type.
67
+ */
23
68
  getNodeType(builder: NodeBuilder): string | null;
69
+ /**
70
+ * Depending on which value was passed to the node, `setup()` behaves
71
+ * differently. If no instance of `BufferAttribute` was passed, the method
72
+ * creates an internal attribute and configures it respectively.
73
+ *
74
+ * @param {NodeBuilder} builder - The current node builder.
75
+ */
24
76
  setup(builder: NodeBuilder): void;
77
+ /**
78
+ * Generates the code snippet of the buffer attribute node.
79
+ *
80
+ * @param {NodeBuilder} builder - The current node builder.
81
+ * @return {String} The generated code snippet.
82
+ */
25
83
  generate(builder: NodeBuilder): string | null | undefined;
84
+ /**
85
+ * Overwrites the default implementation to return a fixed value `'bufferAttribute'`.
86
+ *
87
+ * @param {NodeBuilder} builder - The current node builder.
88
+ * @return {String} The input type.
89
+ */
26
90
  getInputType(): string;
91
+ /**
92
+ * Sets the `usage` property to the given value.
93
+ *
94
+ * @param {Number} value - The usage to set.
95
+ * @return {BufferAttributeNode} A reference to this node.
96
+ */
27
97
  setUsage(value: Usage): this;
98
+ /**
99
+ * Sets the `instanced` property to the given value.
100
+ *
101
+ * @param {Boolean} value - The value to set.
102
+ * @return {BufferAttributeNode} A reference to this node.
103
+ */
28
104
  setInstanced(value: boolean): this;
29
105
  }
30
106
  export default BufferAttributeNode;
107
+ /**
108
+ * TSL function for creating a buffer attribute node.
109
+ *
110
+ * @function
111
+ * @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.
115
+ * @returns {BufferAttributeNode}
116
+ */
31
117
  export declare const bufferAttribute: (
32
118
  array: TypedArray | InterleavedBuffer | BufferAttribute,
33
119
  type?: string | null,
34
120
  stride?: number,
35
121
  offset?: number,
36
122
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
123
+ /**
124
+ * TSL function for creating a buffer attribute node but with dynamic draw usage.
125
+ * Use this function if attribute data are updated per frame.
126
+ *
127
+ * @function
128
+ * @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
+ * @returns {BufferAttributeNode}
133
+ */
37
134
  export declare const dynamicBufferAttribute: (
38
135
  array: TypedArray | InterleavedBuffer | BufferAttribute,
39
136
  type?: string | null,
40
137
  stride?: number,
41
138
  offset?: number,
42
139
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
140
+ /**
141
+ * TSL function for creating a buffer attribute node but with enabled instancing
142
+ *
143
+ * @function
144
+ * @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.
148
+ * @returns {BufferAttributeNode}
149
+ */
43
150
  export declare const instancedBufferAttribute: (
44
151
  array: TypedArray | InterleavedBuffer | BufferAttribute,
45
152
  type?: string | null,
46
153
  stride?: number,
47
154
  offset?: number,
48
155
  ) => import("../tsl/TSLCore.js").ShaderNodeObject<BufferAttributeNode>;
156
+ /**
157
+ * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
158
+ *
159
+ * @function
160
+ * @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.
164
+ * @returns {BufferAttributeNode}
165
+ */
49
166
  export declare const instancedDynamicBufferAttribute: (
50
167
  array: TypedArray | InterleavedBuffer | BufferAttribute,
51
168
  type?: string | null,
@@ -1,17 +1,17 @@
1
1
  import UniformNode from "../core/UniformNode.js";
2
2
  import { NodeOrType, ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export default class BufferNode extends UniformNode<unknown> {
4
+ export default class BufferNode<TValue> extends UniformNode<TValue> {
5
5
  isBufferNode: true;
6
6
 
7
7
  bufferType: string;
8
8
  bufferCount: number;
9
9
 
10
- constructor(value: unknown, bufferType: string, bufferCount?: number);
10
+ constructor(value: TValue, bufferType: string, bufferCount?: number);
11
11
  }
12
12
 
13
- export const buffer: (
13
+ export const buffer: <TValue>(
14
14
  value: unknown,
15
15
  nodeOrType: NodeOrType,
16
16
  count: number,
17
- ) => ShaderNodeObject<BufferNode>;
17
+ ) => ShaderNodeObject<BufferNode<TValue>>;
@@ -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,10 +37,10 @@ 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
- | typeof MaterialNode.AO_MAP
43
+ | typeof MaterialNode.AO
44
44
  | typeof MaterialNode.REFRACTION_RATIO;
45
45
 
46
46
  export default class MaterialNode extends Node {
@@ -77,10 +77,10 @@ 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
- static AO_MAP: "ao";
83
+ static AO: "ao";
84
84
  static REFRACTION_RATIO: "refractionRatio";
85
85
 
86
86
  scope: MaterialNodeScope;
@@ -122,8 +122,8 @@ 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
- export const materialAOMap: ShaderNodeObject<MaterialNode>;
128
+ export const materialAO: ShaderNodeObject<MaterialNode>;
129
129
  export const materialAnisotropyVector: ShaderNodeObject<UniformNode<Vector2>>;
@@ -18,7 +18,15 @@ export const modelScale: ShaderNodeObject<ModelNode>;
18
18
  export const modelViewPosition: ShaderNodeObject<ModelNode>;
19
19
  export const modelNormalMatrix: ShaderNodeObject<Node>;
20
20
  export const modelWorldMatrixInverse: ShaderNodeObject<UniformNode<Matrix4>>;
21
+
21
22
  export const modelViewMatrix: ShaderNodeObject<ModelNode>;
22
23
 
23
- export const highPrecisionModelViewMatrix: ShaderNodeObject<Node>;
24
- export const highPrecisionModelNormalViewMatrix: ShaderNodeObject<Node>;
24
+ // GPU Precision
25
+
26
+ export const mediumpModelViewMatrix: ShaderNodeObject<Node>;
27
+
28
+ // CPU Precision
29
+
30
+ export const highpModelViewMatrix: ShaderNodeObject<Node>;
31
+
32
+ export const highpModelNormalViewMatrix: ShaderNodeObject<Node>;
@@ -1,8 +1,4 @@
1
1
  import Node from "../core/Node.js";
2
- import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
2
+ import { ShaderNodeObject } from "../tsl/TSLCore.js";
3
3
 
4
- export default class ModelViewProjectionNode extends Node {
5
- constructor(positionNode?: Node);
6
- }
7
-
8
- export const modelViewProjection: (position?: NodeRepresentation) => ShaderNodeObject<ModelViewProjectionNode>;
4
+ export const modelViewProjection: ShaderNodeObject<Node>;
@@ -1,13 +1,17 @@
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";
7
9
 
8
- export default class StorageBufferNode extends BufferNode {
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 {
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
 
@@ -29,11 +33,15 @@ export default class StorageBufferNode extends BufferNode {
29
33
  setAccess(value: NodeAccess): this;
30
34
 
31
35
  toReadOnly(): this;
36
+
37
+ setAtmoic(value: boolean): this;
38
+
39
+ toAtomic(): this;
32
40
  }
33
41
 
34
42
  export const storage: (
35
43
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
36
- type?: string | null,
44
+ type?: string | Struct | null,
37
45
  count?: number,
38
46
  ) => ShaderNodeObject<StorageBufferNode>;
39
47
 
@@ -42,6 +50,6 @@ export const storage: (
42
50
  */
43
51
  export const storageObject: (
44
52
  value: StorageBufferAttribute | StorageInstancedBufferAttribute,
45
- type?: string | null,
53
+ type?: string | Struct | null,
46
54
  count?: number,
47
55
  ) => ShaderNodeObject<StorageBufferNode>;
@@ -31,8 +31,13 @@ export default class TextureNode extends UniformNode<Texture> {
31
31
 
32
32
  getSampler(): boolean;
33
33
 
34
+ /**
35
+ * @deprecated
36
+ */
34
37
  uv(uvNode: NodeRepresentation): ShaderNodeObject<Node>;
35
38
 
39
+ sample(uvNode: NodeRepresentation): ShaderNodeObject<Node>;
40
+
36
41
  blur(amountNode: NodeRepresentation): ShaderNodeObject<Node>;
37
42
 
38
43
  level(levelNode: NodeRepresentation): ShaderNodeObject<Node>;
@@ -7,15 +7,16 @@ declare class UniformArrayElementNode extends ArrayElementNode {
7
7
  constructor(arrayBuffer: Node, indexNode: Node);
8
8
  }
9
9
 
10
- declare class UniformArrayNode extends BufferNode {
10
+ declare class UniformArrayNode extends BufferNode<unknown[]> {
11
11
  array: unknown[];
12
12
  elementType: string | null;
13
+ paddedType: string;
13
14
 
14
15
  readonly isArrayBufferNode: true;
15
16
 
16
17
  constructor(value: unknown[], elementType?: string | null);
17
18
 
18
- getElementLength(): number;
19
+ getPaddedType(): string;
19
20
 
20
21
  element(indexNode: NodeRepresentation): ShaderNodeObject<UniformArrayElementNode>;
21
22
  }
@@ -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
+ }