@types/three 0.176.0 → 0.178.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 (214) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -1
  3. three/examples/jsm/capabilities/WebGL.d.ts +0 -11
  4. three/examples/jsm/controls/TransformControls.d.ts +16 -1
  5. three/examples/jsm/helpers/TextureHelper.d.ts +2 -2
  6. three/examples/jsm/helpers/TextureHelperGPU.d.ts +2 -2
  7. three/examples/jsm/loaders/LDrawLoader.d.ts +8 -3
  8. three/examples/jsm/loaders/SVGLoader.d.ts +1 -1
  9. three/examples/jsm/math/Octree.d.ts +3 -0
  10. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  11. three/examples/jsm/postprocessing/AfterimagePass.d.ts +13 -10
  12. three/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  13. three/examples/jsm/transpiler/AST.d.ts +77 -26
  14. three/examples/jsm/transpiler/TSLEncoder.d.ts +9 -3
  15. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +4 -4
  16. three/examples/jsm/tsl/display/BleachBypass.d.ts +2 -2
  17. three/examples/jsm/tsl/display/BloomNode.d.ts +2 -2
  18. three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +20 -0
  19. three/examples/jsm/tsl/display/DenoiseNode.d.ts +4 -4
  20. three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +6 -6
  21. three/examples/jsm/tsl/display/DotScreenNode.d.ts +2 -2
  22. three/examples/jsm/tsl/display/FXAANode.d.ts +3 -3
  23. three/examples/jsm/tsl/display/FilmNode.d.ts +4 -4
  24. three/examples/jsm/tsl/display/GTAONode.d.ts +3 -3
  25. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +5 -5
  26. three/examples/jsm/tsl/display/LensflareNode.d.ts +8 -8
  27. three/examples/jsm/tsl/display/Lut3DNode.d.ts +4 -4
  28. three/examples/jsm/tsl/display/MotionBlur.d.ts +4 -4
  29. three/examples/jsm/tsl/display/OutlineNode.d.ts +3 -3
  30. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +3 -3
  31. three/examples/jsm/tsl/display/SMAANode.d.ts +3 -3
  32. three/examples/jsm/tsl/display/SSRNode.d.ts +5 -5
  33. three/examples/jsm/tsl/display/Sepia.d.ts +2 -2
  34. three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +3 -3
  35. three/examples/jsm/tsl/display/TransitionNode.d.ts +4 -4
  36. three/examples/jsm/tsl/display/hashBlur.d.ts +10 -4
  37. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +5 -5
  38. three/package.json +3 -3
  39. three/src/Three.Core.d.ts +0 -2
  40. three/src/Three.TSL.d.ts +11 -18
  41. three/src/Three.WebGPU.Nodes.d.ts +1 -0
  42. three/src/Three.WebGPU.d.ts +3 -0
  43. three/src/animation/tracks/NumberKeyframeTrack.d.ts +1 -1
  44. three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +1 -1
  45. three/src/animation/tracks/StringKeyframeTrack.d.ts +1 -1
  46. three/src/animation/tracks/VectorKeyframeTrack.d.ts +1 -1
  47. three/src/constants.d.ts +13 -5
  48. three/src/core/BufferGeometry.d.ts +11 -2
  49. three/src/core/GLBufferAttribute.d.ts +18 -1
  50. three/src/core/RenderTarget.d.ts +3 -20
  51. three/src/extras/DataUtils.d.ts +4 -4
  52. three/src/geometries/CapsuleGeometry.d.ts +1 -0
  53. three/src/helpers/AxesHelper.d.ts +3 -1
  54. three/src/lights/SpotLightShadow.d.ts +2 -0
  55. three/src/lights/webgpu/ProjectorLight.d.ts +17 -0
  56. three/src/materials/LineBasicMaterial.d.ts +66 -34
  57. three/src/materials/LineDashedMaterial.d.ts +41 -21
  58. three/src/materials/Material.d.ts +408 -398
  59. three/src/materials/MeshBasicMaterial.d.ts +101 -62
  60. three/src/materials/MeshDepthMaterial.d.ts +71 -32
  61. three/src/materials/MeshDistanceMaterial.d.ts +65 -29
  62. three/src/materials/MeshLambertMaterial.d.ts +179 -103
  63. three/src/materials/MeshMatcapMaterial.d.ts +97 -55
  64. three/src/materials/MeshNormalMaterial.d.ts +76 -41
  65. three/src/materials/MeshPhongMaterial.d.ts +164 -100
  66. three/src/materials/MeshPhysicalMaterial.d.ts +164 -116
  67. three/src/materials/MeshStandardMaterial.d.ts +178 -91
  68. three/src/materials/MeshToonMaterial.d.ts +130 -81
  69. three/src/materials/PointsMaterial.d.ts +77 -30
  70. three/src/materials/RawShaderMaterial.d.ts +12 -7
  71. three/src/materials/ShaderMaterial.d.ts +186 -98
  72. three/src/materials/ShadowMaterial.d.ts +49 -23
  73. three/src/materials/SpriteMaterial.d.ts +62 -33
  74. three/src/materials/nodes/Line2NodeMaterial.d.ts +87 -40
  75. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +35 -16
  76. three/src/materials/nodes/LineDashedNodeMaterial.d.ts +75 -20
  77. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +49 -30
  78. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +49 -42
  79. three/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +38 -26
  80. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +36 -22
  81. three/src/materials/nodes/MeshPhongNodeMaterial.d.ts +68 -48
  82. three/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +240 -65
  83. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +99 -3
  84. three/src/materials/nodes/MeshStandardNodeMaterial.d.ts +83 -47
  85. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +42 -36
  86. three/src/materials/nodes/NodeMaterial.d.ts +418 -55
  87. three/src/materials/nodes/NodeMaterials.d.ts +3 -2
  88. three/src/materials/nodes/PointsNodeMaterial.d.ts +31 -7
  89. three/src/materials/nodes/ShadowNodeMaterial.d.ts +38 -11
  90. three/src/materials/nodes/SpriteNodeMaterial.d.ts +68 -18
  91. three/src/materials/nodes/VolumeNodeMaterial.d.ts +50 -14
  92. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +4 -0
  93. three/src/math/Box3.d.ts +8 -0
  94. three/src/math/Color.d.ts +1 -1
  95. three/src/math/ColorManagement.d.ts +12 -2
  96. three/src/math/Sphere.d.ts +8 -0
  97. three/src/math/Triangle.d.ts +3 -3
  98. three/src/nodes/Nodes.d.ts +2 -3
  99. three/src/nodes/TSL.d.ts +4 -3
  100. three/src/nodes/accessors/AccessorsUtils.d.ts +3 -3
  101. three/src/nodes/accessors/Bitangent.d.ts +0 -2
  102. three/src/nodes/accessors/CubeTextureNode.d.ts +16 -5
  103. three/src/nodes/accessors/Normal.d.ts +19 -5
  104. three/src/nodes/accessors/ReferenceBaseNode.d.ts +1 -1
  105. three/src/nodes/accessors/StorageBufferNode.d.ts +3 -2
  106. three/src/nodes/accessors/StorageTextureNode.d.ts +5 -5
  107. three/src/nodes/accessors/Tangent.d.ts +0 -2
  108. three/src/nodes/accessors/TangentUtils.d.ts +22 -0
  109. three/src/nodes/accessors/Texture3DNode.d.ts +5 -4
  110. three/src/nodes/accessors/TextureBicubic.d.ts +4 -2
  111. three/src/nodes/accessors/TextureNode.d.ts +24 -19
  112. three/src/nodes/accessors/TextureSizeNode.d.ts +3 -3
  113. three/src/nodes/accessors/UniformArrayNode.d.ts +2 -7
  114. three/src/nodes/code/FunctionCallNode.d.ts +3 -1
  115. three/src/nodes/code/FunctionNode.d.ts +2 -2
  116. three/src/nodes/code/ScriptableNode.d.ts +2 -2
  117. three/src/nodes/core/AssignNode.d.ts +7 -3
  118. three/src/nodes/core/AttributeNode.d.ts +1 -1
  119. three/src/nodes/core/BypassNode.d.ts +2 -2
  120. three/src/nodes/core/CacheNode.d.ts +1 -0
  121. three/src/nodes/core/ContextNode.d.ts +3 -3
  122. three/src/nodes/core/Node.d.ts +5 -4
  123. three/src/nodes/core/NodeUtils.d.ts +4 -0
  124. three/src/nodes/core/StackNode.d.ts +3 -13
  125. three/src/nodes/core/SubBuildNode.d.ts +15 -0
  126. three/src/nodes/core/VarNode.d.ts +4 -4
  127. three/src/nodes/core/VaryingNode.d.ts +3 -3
  128. three/src/nodes/display/BlendModes.d.ts +14 -10
  129. three/src/nodes/display/BumpMapNode.d.ts +4 -3
  130. three/src/nodes/display/ColorAdjustment.d.ts +17 -17
  131. three/src/nodes/display/ColorSpaceFunctions.d.ts +3 -3
  132. three/src/nodes/display/ColorSpaceNode.d.ts +6 -16
  133. three/src/nodes/display/FrontFacingNode.d.ts +1 -0
  134. three/src/nodes/display/PosterizeNode.d.ts +3 -3
  135. three/src/nodes/display/RenderOutputNode.d.ts +2 -2
  136. three/src/nodes/display/ScreenNode.d.ts +0 -10
  137. three/src/nodes/display/ToneMappingFunctions.d.ts +7 -7
  138. three/src/nodes/display/ToneMappingNode.d.ts +6 -6
  139. three/src/nodes/display/ViewportDepthTextureNode.d.ts +3 -3
  140. three/src/nodes/fog/Fog.d.ts +10 -10
  141. three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +4 -4
  142. three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +2 -2
  143. three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +4 -4
  144. three/src/nodes/geometry/RangeNode.d.ts +9 -2
  145. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +20 -20
  146. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -2
  147. three/src/nodes/lighting/PointShadowNode.d.ts +11 -11
  148. three/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  149. three/src/nodes/lighting/ShadowFilterNode.d.ts +11 -11
  150. three/src/nodes/lighting/SpotLightNode.d.ts +15 -1
  151. three/src/nodes/materialx/MaterialXNodes.d.ts +59 -59
  152. three/src/nodes/materialx/lib/mx_hsv.d.ts +3 -3
  153. three/src/nodes/materialx/lib/mx_noise.d.ts +206 -206
  154. three/src/nodes/materialx/lib/mx_transform_color.d.ts +2 -2
  155. three/src/nodes/math/ConditionalNode.d.ts +4 -19
  156. three/src/nodes/math/Hash.d.ts +2 -2
  157. three/src/nodes/math/MathNode.d.ts +21 -17
  158. three/src/nodes/math/OperatorNode.d.ts +41 -52
  159. three/src/nodes/math/TriNoise3D.d.ts +6 -6
  160. three/src/nodes/pmrem/PMREMNode.d.ts +3 -3
  161. three/src/nodes/pmrem/PMREMUtils.d.ts +20 -20
  162. three/src/nodes/procedural/Checker.d.ts +2 -2
  163. three/src/nodes/shapes/Shapes.d.ts +2 -2
  164. three/src/nodes/tsl/TSLBase.d.ts +1 -0
  165. three/src/nodes/tsl/TSLCore.d.ts +186 -81
  166. three/src/nodes/utils/CubeMapNode.d.ts +2 -2
  167. three/src/nodes/utils/DebugNode.d.ts +2 -2
  168. three/src/nodes/utils/Discard.d.ts +2 -2
  169. three/src/nodes/utils/EquirectUV.d.ts +4 -0
  170. three/src/nodes/utils/LoopNode.d.ts +2 -7
  171. three/src/nodes/utils/MatcapUV.d.ts +4 -0
  172. three/src/nodes/utils/Oscillators.d.ts +5 -5
  173. three/src/nodes/utils/Packing.d.ts +3 -3
  174. three/src/nodes/utils/PostProcessingUtils.d.ts +9 -9
  175. three/src/nodes/utils/RTTNode.d.ts +3 -3
  176. three/src/nodes/utils/ReflectorNode.d.ts +1 -0
  177. three/src/nodes/utils/RemapNode.d.ts +9 -9
  178. three/src/nodes/utils/RotateNode.d.ts +3 -3
  179. three/src/nodes/utils/SampleNode.d.ts +16 -0
  180. three/src/nodes/utils/SpriteSheetUVNode.d.ts +4 -4
  181. three/src/nodes/utils/SpriteUtils.d.ts +2 -2
  182. three/src/nodes/utils/StorageArrayElementNode.d.ts +4 -3
  183. three/src/nodes/utils/TriplanarTextures.d.ts +20 -0
  184. three/src/nodes/utils/UVUtils.d.ts +8 -7
  185. three/src/nodes/utils/ViewportUtils.d.ts +2 -2
  186. three/src/objects/LOD.d.ts +1 -1
  187. three/src/objects/Mesh.d.ts +8 -0
  188. three/src/objects/Sprite.d.ts +8 -0
  189. three/src/renderers/WebGLRenderer.d.ts +3 -3
  190. three/src/renderers/common/Backend.d.ts +3 -3
  191. three/src/renderers/common/RenderObject.d.ts +10 -2
  192. three/src/renderers/common/Renderer.d.ts +10 -5
  193. three/src/renderers/common/Storage3DTexture.d.ts +40 -0
  194. three/src/renderers/common/StorageArrayTexture.d.ts +29 -0
  195. three/src/renderers/common/Textures.d.ts +2 -2
  196. three/src/renderers/common/XRManager.d.ts +45 -0
  197. three/src/renderers/common/XRRenderTarget.d.ts +3 -2
  198. three/src/renderers/common/nodes/NodeLibrary.d.ts +4 -9
  199. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +1 -1
  200. three/src/renderers/common/nodes/Nodes.d.ts +1 -1
  201. three/src/renderers/webgpu/WebGPURenderer.d.ts +3 -0
  202. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +65 -0
  203. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -0
  204. three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +10 -1
  205. three/src/textures/DepthTexture.d.ts +4 -2
  206. three/src/textures/Source.d.ts +20 -16
  207. three/src/textures/Texture.d.ts +69 -2
  208. three/examples/jsm/effects/PeppersGhostEffect.d.ts +0 -10
  209. three/src/core/RenderTargetArray.d.ts +0 -9
  210. three/src/nodes/utils/EquirectUVNode.d.ts +0 -8
  211. three/src/nodes/utils/MatcapUVNode.d.ts +0 -8
  212. three/src/nodes/utils/TriplanarTexturesNode.d.ts +0 -36
  213. three/src/renderers/common/nodes/StandardNodeLibrary.d.ts +0 -5
  214. three/src/textures/DepthArrayTexture.d.ts +0 -14
three/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for three (https://threejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 24 Apr 2025 08:02:30 GMT
11
+ * Last updated: Tue, 01 Jul 2025 17:03:03 GMT
12
12
  * Dependencies: [@dimforge/rapier3d-compat](https://npmjs.com/package/@dimforge/rapier3d-compat), [@tweenjs/tween.js](https://npmjs.com/package/@tweenjs/tween.js), [@types/stats.js](https://npmjs.com/package/@types/stats.js), [@types/webxr](https://npmjs.com/package/@types/webxr), [@webgpu/types](https://npmjs.com/package/@webgpu/types), [fflate](https://npmjs.com/package/fflate), [meshoptimizer](https://npmjs.com/package/meshoptimizer)
13
13
 
14
14
  # Credits
@@ -28,7 +28,6 @@ export * from "./effects/AnaglyphEffect.js";
28
28
  export * from "./effects/AsciiEffect.js";
29
29
  export * from "./effects/OutlineEffect.js";
30
30
  export * from "./effects/ParallaxBarrierEffect.js";
31
- export * from "./effects/PeppersGhostEffect.js";
32
31
  export * from "./effects/StereoEffect.js";
33
32
 
34
33
  export * from "./environments/DebugEnvironment.js";
@@ -3,15 +3,4 @@ export default class WebGL {
3
3
  static isColorSpaceAvailable(colorSpace: PredefinedColorSpace): boolean;
4
4
  static getWebGL2ErrorMessage(): HTMLElement;
5
5
  static getErrorMessage(version: number): HTMLElement;
6
-
7
- /**
8
- * @deprecated isWebGLAvailable() has been deprecated and will be removed in r178. Use isWebGL2Available() instead.
9
- */
10
- static isWebGLAvailable(): boolean;
11
-
12
- /**
13
- * @deprecated getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage()
14
- * instead.
15
- */
16
- static getWebGLErrorMessage(): HTMLElement;
17
6
  }
@@ -1,4 +1,4 @@
1
- import { Camera, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3 } from "three";
1
+ import { Camera, ColorRepresentation, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3 } from "three";
2
2
 
3
3
  export type TransformControlsMode = "translate" | "rotate" | "scale";
4
4
 
@@ -240,6 +240,21 @@ declare class TransformControls extends Controls<TransformControlsEventMap> {
240
240
  * @param space The coordinate space in which transformations are applied.
241
241
  */
242
242
  setSpace(space: "world" | "local"): void;
243
+
244
+ /**
245
+ * Sets the colors of the control's gizmo.
246
+ *
247
+ * @param {number|Color|string} xAxis - The x-axis color.
248
+ * @param {number|Color|string} yAxis - The y-axis color.
249
+ * @param {number|Color|string} zAxis - The z-axis color.
250
+ * @param {number|Color|string} active - The color for active elements.
251
+ */
252
+ setColors(
253
+ xAxis: ColorRepresentation,
254
+ yAxis: ColorRepresentation,
255
+ zAxis: ColorRepresentation,
256
+ active: ColorRepresentation,
257
+ ): void;
243
258
  }
244
259
 
245
260
  declare class TransformControlsRoot extends Object3D {
@@ -1,6 +1,6 @@
1
- import { Mesh, Texture } from "three";
1
+ import { BufferGeometry, Mesh, ShaderMaterial, Texture } from "three";
2
2
 
3
- export class TextureHelper extends Mesh {
3
+ export class TextureHelper extends Mesh<BufferGeometry, ShaderMaterial> {
4
4
  texture: Texture;
5
5
  type: "TextureHelper";
6
6
 
@@ -1,6 +1,6 @@
1
- import { Mesh, Texture } from "three";
1
+ import { BufferGeometry, Mesh, NodeMaterial, Texture } from "three/webgpu";
2
2
 
3
- export class TextureHelper extends Mesh {
3
+ export class TextureHelper extends Mesh<BufferGeometry, NodeMaterial> {
4
4
  texture: Texture;
5
5
  type: "TextureHelper";
6
6
 
@@ -19,11 +19,16 @@ export class LDrawLoader extends Loader<Group> {
19
19
  ): this;
20
20
 
21
21
  preloadMaterials(url: string): Promise<void>;
22
- setFileMap(fileMap: Record<string, string>): void;
23
- setMaterials(materials: Material[]): void;
24
22
 
25
23
  parse(text: string, path: string, onLoad: (data: Group) => void, onError?: (error: unknown) => void): void;
26
24
 
27
- addMaterial(material: Material): void;
25
+ setMaterials(materials: Material[]): this;
26
+ clearMaterials(): this;
27
+ addMaterials(materials: Material[]): this;
28
+ addDefaultMaterials(): this;
29
+
30
+ setFileMap(fileMap: Record<string, string>): this;
31
+
32
+ addMaterial(material: Material): this;
28
33
  getMaterial(colourCode: string): Material | null;
29
34
  }
@@ -34,7 +34,7 @@ export class SVGLoader extends Loader<SVGResult> {
34
34
  ): StrokeStyle;
35
35
 
36
36
  /**
37
- * Generates a stroke with some witdh around the given path.
37
+ * Generates a stroke with some width around the given path.
38
38
  * @remarks The path can be open or closed (last point equals to first point)
39
39
  * @param points Array of Vector2D (the path). Minimum 2 points.
40
40
  * @param style Object with SVG properties as returned by SVGLoader.getStrokeStyle(), or SVGLoader.parse() in the path.userData.style object
@@ -10,6 +10,9 @@ export class Octree {
10
10
  triangles: Triangle[];
11
11
  layers: Layers;
12
12
 
13
+ trianglesPerLeaf: number;
14
+ maxLevel: number;
15
+
13
16
  constructor(box?: Box3 | null);
14
17
 
15
18
  addTriangle(triangle: Triangle): this;
@@ -8,6 +8,7 @@ export interface RapierPhysicsObject {
8
8
  world: RAPIER.World;
9
9
  addScene: (scene: Object3D) => void;
10
10
  addMesh: (mesh: Mesh, mass?: number, restitution?: number) => void;
11
+ removeMesh: (mesh: Mesh) => void;
11
12
  setMeshPosition: (mesh: Mesh, position: Vector, index?: number) => void;
12
13
  setMeshVelocity: (mesh: Mesh, velocity: Vector, index?: number) => void;
13
14
  addHeightfield: (
@@ -1,14 +1,17 @@
1
- import { IUniform, ShaderMaterial, WebGLRenderTarget } from "three";
1
+ import { IUniform, ShaderMaterial } from "three";
2
2
 
3
- import { FullScreenQuad, Pass } from "./Pass.js";
3
+ import { Pass } from "./Pass.js";
4
4
 
5
- export class AfterimagePass extends Pass {
6
- constructor(damp?: number);
7
- shader: object;
5
+ declare class AfterimagePass extends Pass {
8
6
  uniforms: Record<string, IUniform>;
9
- textureComp: WebGLRenderTarget;
10
- textureOld: WebGLRenderTarget;
11
- shaderMaterial: ShaderMaterial;
12
- compFsQuad: FullScreenQuad;
13
- copyFsQuad: FullScreenQuad;
7
+
8
+ compFsMaterial: ShaderMaterial;
9
+ copyFsMaterial: ShaderMaterial;
10
+
11
+ constructor(damp?: number);
12
+
13
+ get damp(): number;
14
+ set damp(value: number);
14
15
  }
16
+
17
+ export { AfterimagePass };
@@ -0,0 +1,7 @@
1
+ import { ShaderPass } from "./ShaderPass.js";
2
+
3
+ declare class FXAAPass extends ShaderPass {
4
+ constructor();
5
+ }
6
+
7
+ export { FXAAPass };
@@ -1,9 +1,17 @@
1
+ export class Comment {
2
+ constructor(comment: string);
3
+
4
+ comment: string;
5
+
6
+ readonly isComment: true;
7
+ }
8
+
1
9
  export class Program {
2
- constructor();
10
+ constructor(body?: Statement[]);
3
11
 
4
12
  body: Statement[];
5
13
 
6
- isProgram: true;
14
+ readonly isProgram: true;
7
15
  }
8
16
 
9
17
  // Boolean seems to be handled as a Unary
@@ -23,11 +31,16 @@ export type Statement =
23
31
  | FunctionCall
24
32
  | Return
25
33
  | Discard
34
+ | Continue
35
+ | Break
26
36
  | Accessor
27
37
  | StaticElement
28
38
  | DynamicElement
29
39
  | AccessorElements
30
40
  | For
41
+ | While
42
+ | Switch
43
+ | SwitchCase
31
44
  | null;
32
45
 
33
46
  export class VariableDeclaration {
@@ -46,7 +59,7 @@ export class VariableDeclaration {
46
59
 
47
60
  immutable: boolean;
48
61
 
49
- isVariableDeclaration: true;
62
+ readonly isVariableDeclaration: true;
50
63
  }
51
64
 
52
65
  export class Uniform {
@@ -55,7 +68,7 @@ export class Uniform {
55
68
  type: string;
56
69
  name: string;
57
70
 
58
- isUniform: true;
71
+ readonly isUniform: true;
59
72
  }
60
73
 
61
74
  export class Varying {
@@ -64,7 +77,7 @@ export class Varying {
64
77
  type: string;
65
78
  name: string;
66
79
 
67
- isVarying: true;
80
+ readonly isVarying: true;
68
81
  }
69
82
 
70
83
  export class FunctionParameter {
@@ -75,18 +88,18 @@ export class FunctionParameter {
75
88
  qualifier: string | null;
76
89
  immutable: boolean;
77
90
 
78
- isFunctionParameter: true;
91
+ readonly isFunctionParameter: true;
79
92
  }
80
93
 
81
94
  export class FunctionDeclaration {
82
- constructor(type: string, name: string, params?: FunctionParameter[]);
95
+ constructor(type: string, name: string, params?: FunctionParameter[], body?: Statement[]);
83
96
 
84
97
  type: string;
85
98
  name: string;
86
99
  params: FunctionParameter[];
87
100
  body: Statement[];
88
101
 
89
- isFunctionDeclaration: true;
102
+ readonly isFunctionDeclaration: true;
90
103
  }
91
104
 
92
105
  export class Expression {
@@ -94,7 +107,7 @@ export class Expression {
94
107
 
95
108
  expression: string;
96
109
 
97
- isExpression: true;
110
+ readonly isExpression: true;
98
111
  }
99
112
 
100
113
  export class Ternary {
@@ -104,7 +117,7 @@ export class Ternary {
104
117
  left: Statement;
105
118
  right: Statement;
106
119
 
107
- isTernary: true;
120
+ readonly isTernary: true;
108
121
  }
109
122
 
110
123
  export class Operator {
@@ -114,7 +127,7 @@ export class Operator {
114
127
  left: Statement;
115
128
  right: Statement;
116
129
 
117
- isOperator: true;
130
+ readonly isOperator: true;
118
131
  }
119
132
 
120
133
  export class Unary {
@@ -124,7 +137,7 @@ export class Unary {
124
137
  expression: Statement;
125
138
  after: boolean;
126
139
 
127
- isUnary: true;
140
+ readonly isUnary: true;
128
141
  }
129
142
 
130
143
  export class Number {
@@ -133,7 +146,7 @@ export class Number {
133
146
  type: string;
134
147
  value: string;
135
148
 
136
- isNumber: true;
149
+ readonly isNumber: true;
137
150
  }
138
151
 
139
152
  export class String {
@@ -141,18 +154,17 @@ export class String {
141
154
 
142
155
  value: string;
143
156
 
144
- isString: true;
157
+ readonly isString: true;
145
158
  }
146
159
 
147
160
  export class Conditional {
148
- constructor(cond?: Conditional | null);
161
+ constructor(cond?: Conditional | null, body?: Statement[]);
149
162
 
150
163
  cond: Conditional | null;
151
-
152
164
  body: Statement[];
153
165
  elseConditional: Conditional | null;
154
166
 
155
- isConditional: true;
167
+ readonly isConditional: true;
156
168
  }
157
169
 
158
170
  export class FunctionCall {
@@ -161,7 +173,7 @@ export class FunctionCall {
161
173
  name: string;
162
174
  params: Statement[];
163
175
 
164
- isFunctionCall: true;
176
+ readonly isFunctionCall: true;
165
177
  }
166
178
 
167
179
  export class Return {
@@ -169,13 +181,25 @@ export class Return {
169
181
 
170
182
  value: Statement;
171
183
 
172
- isReturn: true;
184
+ readonly isReturn: true;
173
185
  }
174
186
 
175
187
  export class Discard {
176
188
  constructor();
177
189
 
178
- isDiscard: true;
190
+ readonly isDiscard: true;
191
+ }
192
+
193
+ export class Continue {
194
+ constructor();
195
+
196
+ readonly isContinue: true;
197
+ }
198
+
199
+ export class Break {
200
+ constructor();
201
+
202
+ readonly isBreak: true;
179
203
  }
180
204
 
181
205
  export class Accessor {
@@ -183,7 +207,7 @@ export class Accessor {
183
207
 
184
208
  property: string;
185
209
 
186
- isAccessor: true;
210
+ readonly isAccessor: true;
187
211
  }
188
212
 
189
213
  export class StaticElement {
@@ -191,7 +215,7 @@ export class StaticElement {
191
215
 
192
216
  value: Statement;
193
217
 
194
- isStaticElement: true;
218
+ readonly isStaticElement: true;
195
219
  }
196
220
 
197
221
  export class DynamicElement {
@@ -199,7 +223,7 @@ export class DynamicElement {
199
223
 
200
224
  value: Statement;
201
225
 
202
- isDynamicElement: true;
226
+ readonly isDynamicElement: true;
203
227
  }
204
228
 
205
229
  export class AccessorElements {
@@ -208,17 +232,44 @@ export class AccessorElements {
208
232
  object: FunctionCall | Accessor;
209
233
  elements: (StaticElement | DynamicElement)[];
210
234
 
211
- isAccessorElements: true;
235
+ readonly isAccessorElements: true;
212
236
  }
213
237
 
214
238
  export class For {
215
- constructor(initialization: Statement, condition: Statement, afterthought: Statement);
239
+ constructor(initialization: Statement, condition: Statement, afterthought: Statement, body?: Statement[]);
216
240
 
217
241
  initialization: Statement;
218
242
  condition: Statement;
219
243
  afterthought: Statement;
244
+ body: Statement[];
245
+
246
+ readonly isFor: true;
247
+ }
248
+
249
+ export class While {
250
+ constructor(condition: Statement, body?: Statement[]);
251
+
252
+ condition: Statement;
253
+ body: Statement[];
254
+
255
+ readonly isWhile: true;
256
+ }
257
+
258
+ export class Switch {
259
+ constructor(discriminant: Statement, cases: Statement[]);
260
+
261
+ discriminant: Statement;
262
+ cases: Statement[];
263
+
264
+ readonly isSwitch: true;
265
+ }
266
+
267
+ export class SwitchCase {
268
+ constructor(body: Statement, conditions?: Statement[] | null);
220
269
 
221
270
  body: Statement[];
271
+ conditions: Statement[];
222
272
 
223
- isFor: true;
273
+ isDefault: boolean;
274
+ readonly isSwitchCase: true;
224
275
  }
@@ -1,14 +1,17 @@
1
1
  import {
2
+ Comment,
2
3
  Conditional,
3
4
  Expression,
4
5
  For,
5
6
  FunctionDeclaration,
6
7
  Program,
7
8
  Statement,
9
+ Switch,
8
10
  Ternary,
9
11
  Uniform,
10
12
  VariableDeclaration,
11
13
  Varying,
14
+ While,
12
15
  } from "./AST.js";
13
16
 
14
17
  export default class TSLEncoder {
@@ -19,23 +22,26 @@ export default class TSLEncoder {
19
22
  global: Set<string>;
20
23
  overloadings: Map<string, string>;
21
24
  iife: boolean;
22
- uniqueNames: boolean;
23
25
  reference: boolean;
26
+ block: Statement | null;
24
27
 
25
28
  addImport(name: string): void;
26
29
  emitUniform(node: Uniform): string;
27
- emitExpression(node: Expression): string;
30
+ emitExpression(node: Expression, output?: string | null): string;
28
31
  emitBody(body: Statement[]): string;
29
32
  emitTernary(node: Ternary): string;
30
33
  emitConditional(node: Conditional): string;
31
34
  emitLoop(node: For): string;
35
+ emitSwitch(switchNode: Switch): string;
32
36
  emitFor(node: For): string;
33
37
  emitForWhile(node: For): string;
38
+ emitWhile(node: While): string;
34
39
  emitVariables(node: VariableDeclaration, isRoot?: boolean): string;
35
40
  emitVarying(node: Varying): string;
36
41
  emitOverloadingFunction(nodes: FunctionDeclaration[]): string;
37
42
  emitFunction(node: FunctionDeclaration): string;
38
43
  setLastStatement(statement: Statement | null): void;
39
- emitExtraLine(statement: Statement): string;
44
+ emitComment(statement: Comment, body: Statement[]): string;
45
+ emitExtraLine(statement: Statement, body: Statement[]): string;
40
46
  emit(ast: Program): string;
41
47
  }
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode, Vector2 } from "three/webgpu";
3
3
 
4
4
  export default class AnamorphicNode extends TempNode {
@@ -17,7 +17,7 @@ export default class AnamorphicNode extends TempNode {
17
17
 
18
18
  export const anamorphic: (
19
19
  node: Node,
20
- threshold?: NodeRepresentation,
21
- scale?: NodeRepresentation,
22
- samples?: NodeRepresentation,
20
+ threshold?: Node,
21
+ scale?: Node,
22
+ samples?: Node | number,
23
23
  ) => ShaderNodeObject<AnamorphicNode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node } from "three/webgpu";
3
3
 
4
- export const bleach: (color: NodeRepresentation, opacity?: number) => ShaderNodeObject<Node>;
4
+ export const bleach: (color: Node, opacity?: number) => ShaderNodeObject<Node>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";
3
3
 
4
4
  declare class BloomNode extends TempNode {
@@ -17,7 +17,7 @@ declare class BloomNode extends TempNode {
17
17
  }
18
18
 
19
19
  export const bloom: (
20
- node: NodeRepresentation,
20
+ node: Node,
21
21
  strength?: number,
22
22
  radius?: number,
23
23
  threshold?: number,
@@ -0,0 +1,20 @@
1
+ import { ShaderNodeObject } from "three/tsl";
2
+ import { Node, TempNode, Vector2 } from "three/webgpu";
3
+
4
+ declare class ChromaticAberrationNode extends TempNode {
5
+ textureNode: Node;
6
+ strengthNode: Node;
7
+ centerNode: Node;
8
+ scaleNode: Node;
9
+
10
+ constructor(textureNode: Node, strengthNode: Node, centerNode: Node, scaleNode: Node);
11
+ }
12
+
13
+ export default ChromaticAberrationNode;
14
+
15
+ export const chromaticAberration: (
16
+ node: Node,
17
+ strength?: Node,
18
+ center?: Node | Vector2 | null,
19
+ scale?: Node,
20
+ ) => ShaderNodeObject<ChromaticAberrationNode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Camera, Node, TempNode, UniformNode } from "three/webgpu";
3
3
 
4
4
  declare class DenoiseNode extends TempNode {
@@ -20,8 +20,8 @@ declare class DenoiseNode extends TempNode {
20
20
  export default DenoiseNode;
21
21
 
22
22
  export const denoise: (
23
- node: NodeRepresentation,
24
- depthNode: NodeRepresentation,
25
- normalNode: NodeRepresentation,
23
+ node: Node,
24
+ depthNode: Node,
25
+ normalNode: Node,
26
26
  camera: Camera,
27
27
  ) => ShaderNodeObject<DenoiseNode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";
3
3
 
4
4
  declare class DepthOfFieldNode extends TempNode {
@@ -15,9 +15,9 @@ declare class DepthOfFieldNode extends TempNode {
15
15
  export default DepthOfFieldNode;
16
16
 
17
17
  export const dof: (
18
- node: NodeRepresentation,
19
- viewZNode: NodeRepresentation,
20
- focus?: NodeRepresentation,
21
- aperture?: NodeRepresentation,
22
- maxblur?: NodeRepresentation,
18
+ node: Node,
19
+ viewZNode: Node,
20
+ focus?: Node,
21
+ aperture?: Node,
22
+ maxblur?: Node,
23
23
  ) => ShaderNodeObject<DepthOfFieldNode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode, UniformNode, Vector2 } from "three/webgpu";
3
3
 
4
4
  declare class DotScreenNode extends TempNode {
@@ -13,7 +13,7 @@ declare class DotScreenNode extends TempNode {
13
13
  export default DotScreenNode;
14
14
 
15
15
  export const dotScreen: (
16
- node: NodeRepresentation,
16
+ node: Node,
17
17
  center?: Vector2,
18
18
  angle?: number,
19
19
  scale?: number,
@@ -1,5 +1,5 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
2
- import { TempNode, TextureNode } from "three/webgpu";
1
+ import { ShaderNodeObject } from "three/tsl";
2
+ import { Node, TempNode, TextureNode } from "three/webgpu";
3
3
 
4
4
  declare class FXAANode extends TempNode {
5
5
  textureNode: TextureNode;
@@ -9,4 +9,4 @@ declare class FXAANode extends TempNode {
9
9
 
10
10
  export default FXAANode;
11
11
 
12
- export const fxaa: (node: NodeRepresentation) => ShaderNodeObject<FXAANode>;
12
+ export const fxaa: (node: Node) => ShaderNodeObject<FXAANode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode } from "three/webgpu";
3
3
 
4
4
  declare class FilmNode extends TempNode {
@@ -12,7 +12,7 @@ declare class FilmNode extends TempNode {
12
12
  export default FilmNode;
13
13
 
14
14
  export const film: (
15
- inputNode: NodeRepresentation,
16
- intensityNode?: NodeRepresentation | null,
17
- uvNode?: NodeRepresentation | null,
15
+ inputNode: Node,
16
+ intensityNode?: Node | null,
17
+ uvNode?: Node | null,
18
18
  ) => ShaderNodeObject<FilmNode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Camera, Node, TempNode, TextureNode, UniformNode, Vector2 } from "three/webgpu";
3
3
 
4
4
  declare class GTAONode extends TempNode {
@@ -25,7 +25,7 @@ declare class GTAONode extends TempNode {
25
25
  export default GTAONode;
26
26
 
27
27
  export const ao: (
28
- depthNode: NodeRepresentation,
29
- normalNode: NodeRepresentation,
28
+ depthNode: Node,
29
+ normalNode: Node,
30
30
  camera: Camera,
31
31
  ) => ShaderNodeObject<GTAONode>;
@@ -1,4 +1,4 @@
1
- import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
1
+ import { ShaderNodeObject } from "three/tsl";
2
2
  import { Node, TempNode, TextureNode, Vector2 } from "three/webgpu";
3
3
 
4
4
  declare class GaussianBlurNode extends TempNode {
@@ -24,12 +24,12 @@ declare class GaussianBlurNode extends TempNode {
24
24
  export default GaussianBlurNode;
25
25
 
26
26
  export const gaussianBlur: (
27
- node: NodeRepresentation,
28
- directionNode?: NodeRepresentation | null,
27
+ node: Node,
28
+ directionNode?: Node | number | null,
29
29
  sigma?: number,
30
30
  ) => ShaderNodeObject<GaussianBlurNode>;
31
31
  export const premultipliedGaussianBlur: (
32
- node: NodeRepresentation,
33
- directionNode?: NodeRepresentation | null,
32
+ node: Node,
33
+ directionNode?: Node | number | null,
34
34
  sigma?: number,
35
35
  ) => ShaderNodeObject<GaussianBlurNode>;