Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds: Introduce three.tsl.js #1417

Merged
merged 15 commits into from
Dec 14, 2024
79 changes: 34 additions & 45 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
@@ -881,15 +881,9 @@ index b12b0421..c3b378aa 100644
}

diff --git a/examples-testing/examples/misc_controls_fly.ts b/examples-testing/examples/misc_controls_fly.ts
index 6326af66..e88957c0 100644
index a8a603bb..e88957c0 100644
--- a/examples-testing/examples/misc_controls_fly.ts
+++ b/examples-testing/examples/misc_controls_fly.ts
@@ -1,4 +1,4 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';
import { pass } from 'three/tsl';
import { film } from 'three/addons/tsl/display/FilmNode.js';

@@ -16,11 +16,15 @@ const MARGIN = 0;
let SCREEN_HEIGHT = window.innerHeight - MARGIN * 2;
let SCREEN_WIDTH = window.innerWidth;
@@ -13768,14 +13762,14 @@ index 5638c902..a274a953 100644

renderer.render(scene, camera);
diff --git a/examples-testing/examples/webgpu_lights_tiled.ts b/examples-testing/examples/webgpu_lights_tiled.ts
index ed195757..7ee84406 100644
index ed195757..84114277 100644
--- a/examples-testing/examples/webgpu_lights_tiled.ts
+++ b/examples-testing/examples/webgpu_lights_tiled.ts
@@ -1,8 +1,9 @@
-import * as THREE from 'three';
-import { texture, uv, pass, uniform } from 'three/tsl';
+import * as THREE from 'three/webgpu';
+import { texture, uv, pass, uniform, Node, ShaderNodeObject, UniformNode } from 'three/tsl';
+import { texture, uv, pass, uniform, ShaderNodeObject } from 'three/tsl';
import { bloom } from 'three/addons/tsl/display/BloomNode.js';

import { TiledLighting } from 'three/addons/lighting/TiledLighting.js';
@@ -13806,8 +13800,8 @@ index ed195757..7ee84406 100644
+ lightDummy: THREE.InstancedMesh,
+ stats: Stats,
+ controls: OrbitControls,
+ compose: ShaderNodeObject<Node>,
+ tileInfluence: ShaderNodeObject<UniformNode<number>>,
+ compose: ShaderNodeObject<THREE.Node>,
+ tileInfluence: ShaderNodeObject<THREE.UniformNode<number>>,
+ lighting: TiledLighting,
+ count: number,
+ postProcessing: THREE.PostProcessing;
@@ -14587,10 +14581,10 @@ index a749bd6d..16bcee89 100644
init();

diff --git a/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts b/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts
index 989361b6..d324a37f 100644
index 989361b6..491df42d 100644
--- a/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts
+++ b/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts
@@ -1,12 +1,31 @@
@@ -1,12 +1,30 @@
-import * as THREE from 'three';
-import { mix, step, texture, screenUV, mrt, output, transformedNormalWorld, uv, vec2 } from 'three/tsl';
+import * as THREE from 'three/webgpu';
@@ -14605,7 +14599,6 @@ index 989361b6..d324a37f 100644
+ uv,
+ vec2,
+ ShaderNodeObject,
+ MRTNode,
+} from 'three/tsl';

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -14616,7 +14609,7 @@ index 989361b6..d324a37f 100644
-let quadMesh, sceneMRT, renderTarget, readbackTarget, material, readbackMaterial, pixelBuffer, pixelBufferTexture;
+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGPURenderer, torus: THREE.Mesh;
+let quadMesh: THREE.QuadMesh,
+ sceneMRT: ShaderNodeObject<MRTNode>,
+ sceneMRT: ShaderNodeObject<THREE.MRTNode>,
+ renderTarget: THREE.RenderTarget,
+ readbackTarget: THREE.RenderTarget,
+ material: THREE.NodeMaterial,
@@ -14626,7 +14619,7 @@ index 989361b6..d324a37f 100644

const gui = new GUI();

@@ -109,7 +128,7 @@ function onWindowResize() {
@@ -109,7 +127,7 @@ function onWindowResize() {
renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr);
}

@@ -14635,7 +14628,7 @@ index 989361b6..d324a37f 100644
const selection = options.selection;

torus.rotation.y = (time / 1000) * 0.4;
@@ -143,12 +162,26 @@ async function readback() {
@@ -143,12 +161,26 @@ async function readback() {
const selection = options.selection;

if (selection === 'diffuse') {
@@ -14889,7 +14882,7 @@ index 06af5ab4..e543f68b 100644
postProcessing.outputNode = combinedPass;

diff --git a/examples-testing/examples/webgpu_postprocessing_ao.ts b/examples-testing/examples/webgpu_postprocessing_ao.ts
index 1957d7a9..34c14633 100644
index 1957d7a9..d76a7142 100644
--- a/examples-testing/examples/webgpu_postprocessing_ao.ts
+++ b/examples-testing/examples/webgpu_postprocessing_ao.ts
@@ -1,7 +1,7 @@
@@ -14898,7 +14891,7 @@ index 1957d7a9..34c14633 100644
-import { ao } from 'three/addons/tsl/display/GTAONode.js';
-import { denoise } from 'three/addons/tsl/display/DenoiseNode.js';
+import * as THREE from 'three/webgpu';
+import { pass, mrt, output, normalView, Node, ShaderNodeObject } from 'three/tsl';
+import { pass, mrt, output, normalView, ShaderNodeObject } from 'three/tsl';
+import GTAONode, { ao } from 'three/addons/tsl/display/GTAONode.js';
+import DenoiseNode, { denoise } from 'three/addons/tsl/display/DenoiseNode.js';

@@ -14919,9 +14912,9 @@ index 1957d7a9..34c14633 100644
-let aoPass, denoisePass, blendPassAO, blendPassDenoise, scenePassColor;
+let aoPass: ShaderNodeObject<GTAONode>,
+ denoisePass: ShaderNodeObject<DenoiseNode>,
+ blendPassAO: ShaderNodeObject<Node>,
+ blendPassDenoise: ShaderNodeObject<Node>,
+ scenePassColor: ShaderNodeObject<Node>;
+ blendPassAO: ShaderNodeObject<THREE.Node>,
+ blendPassDenoise: ShaderNodeObject<THREE.Node>,
+ scenePassColor: ShaderNodeObject<THREE.Node>;

const params = {
distanceExponent: 1,
@@ -14990,17 +14983,15 @@ index a1f885c6..15a5c3fe 100644
init();

diff --git a/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts b/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts
index e4624db9..4e54e3bd 100644
index e4624db9..0cf7cf09 100644
--- a/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts
+++ b/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts
@@ -1,5 +1,5 @@
@@ -1,4 +1,4 @@
-import * as THREE from 'three';
-import { pass, mrt, output, float, uniform } from 'three/tsl';
+import * as THREE from 'three/webgpu';
+import { pass, mrt, output, float, uniform, UniformNode } from 'three/tsl';
import { pass, mrt, output, float, uniform } from 'three/tsl';
import { bloom } from 'three/addons/tsl/display/BloomNode.js';

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -85,9 +85,10 @@ window.addEventListener('pointerdown', event => {
const intersects = raycaster.intersectObjects(scene.children, false);

@@ -15010,7 +15001,7 @@ index e4624db9..4e54e3bd 100644
+ .material;

- const bloomIntensity = material.mrtNode.get('bloomIntensity');
+ const bloomIntensity = material.mrtNode!.get('bloomIntensity') as UniformNode<number>;
+ const bloomIntensity = material.mrtNode!.get('bloomIntensity') as THREE.UniformNode<number>;
bloomIntensity.value = bloomIntensity.value === 0 ? 1 : 0;
}
});
@@ -15127,14 +15118,13 @@ index d0a1b51e..bfe5d434 100644
init();

diff --git a/examples-testing/examples/webgpu_postprocessing_masking.ts b/examples-testing/examples/webgpu_postprocessing_masking.ts
index fc87be20..54310173 100644
index fc87be20..5f8ab8b3 100644
--- a/examples-testing/examples/webgpu_postprocessing_masking.ts
+++ b/examples-testing/examples/webgpu_postprocessing_masking.ts
@@ -1,8 +1,8 @@
-import * as THREE from 'three';
-import { pass, texture } from 'three/tsl';
+import * as THREE from 'three/webgpu';
+import { Node, pass, texture } from 'three/tsl';
import { pass, texture } from 'three/tsl';

-let camera, postProcessing, renderer;
-let box, torus;
@@ -15148,7 +15138,7 @@ index fc87be20..54310173 100644
const sceneMask2 = pass(maskScene2, camera).a;

- let compose = base;
+ let compose: Node = base;
+ let compose: THREE.Node = base;
compose = sceneMask1.mix(compose, texture(texture1));
compose = sceneMask2.mix(compose, texture(texture2));

@@ -15237,18 +15227,17 @@ index d25c12c5..a74590cf 100644
selectedObjects.push(object);
}
diff --git a/examples-testing/examples/webgpu_postprocessing_pixel.ts b/examples-testing/examples/webgpu_postprocessing_pixel.ts
index ff53a4b4..4a0d8755 100644
index ff53a4b4..ee8bb78b 100644
--- a/examples-testing/examples/webgpu_postprocessing_pixel.ts
+++ b/examples-testing/examples/webgpu_postprocessing_pixel.ts
@@ -1,13 +1,24 @@
@@ -1,4 +1,4 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

-import { uniform } from 'three/tsl';
+import { uniform, UniformNode } from 'three/tsl';
@@ -6,8 +6,19 @@ import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
import { uniform } from 'three/tsl';
import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js';

-let camera, scene, renderer, postProcessing, crystalMesh, clock;
@@ -15261,9 +15250,9 @@ index ff53a4b4..4a0d8755 100644
+ clock: THREE.Clock;
+let gui: GUI,
+ effectController: {
+ pixelSize: UniformNode<number>;
+ normalEdgeStrength: UniformNode<number>;
+ depthEdgeStrength: UniformNode<number>;
+ pixelSize: THREE.UniformNode<number>;
+ normalEdgeStrength: THREE.UniformNode<number>;
+ depthEdgeStrength: THREE.UniformNode<number>;
+ pixelAlignedPanning: boolean;
+ };

@@ -15478,7 +15467,7 @@ index 9a5558e9..05dbf9db 100644

init();
diff --git a/examples-testing/examples/webgpu_postprocessing_transition.ts b/examples-testing/examples/webgpu_postprocessing_transition.ts
index dc70b8e9..8c9da56f 100644
index dc70b8e9..ae7a2ade 100644
--- a/examples-testing/examples/webgpu_postprocessing_transition.ts
+++ b/examples-testing/examples/webgpu_postprocessing_transition.ts
@@ -1,16 +1,31 @@
@@ -15490,7 +15479,7 @@ index dc70b8e9..8c9da56f 100644
import TWEEN from 'three/addons/libs/tween.module.js';
-import { uniform, pass } from 'three/tsl';
-import { transition } from 'three/addons/tsl/display/TransitionNode.js';
+import { uniform, pass, ShaderNodeObject, UniformNode } from 'three/tsl';
+import { uniform, pass, ShaderNodeObject } from 'three/tsl';
+import TransitionNode, { transition } from 'three/addons/tsl/display/TransitionNode.js';

-let renderer, postProcessing, transitionController, transitionPass;
@@ -15508,12 +15497,12 @@ index dc70b8e9..8c9da56f 100644
+ animateScene: boolean;
+ animateTransition: boolean;
+ transition: number;
+ _transition: UniformNode<number>;
+ _transition: THREE.UniformNode<number>;
+ useTexture: boolean;
+ _useTexture: UniformNode<number>;
+ _useTexture: THREE.UniformNode<number>;
+ texture: number;
+ cycle: boolean;
+ threshold: UniformNode<number>;
+ threshold: THREE.UniformNode<number>;
+}
+
+const effectController: EffectController = {
10 changes: 5 additions & 5 deletions src-testing/changes.patch
Original file line number Diff line number Diff line change
@@ -7551,7 +7551,7 @@ index 07bcda18..6ebfd686 100644
}

diff --git a/src-testing/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.ts b/src-testing/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.ts
index 1f3f5b5b..34c4e17d 100644
index 9de87c2f..77fb975a 100644
--- a/src-testing/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.ts
+++ b/src-testing/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.ts
@@ -1,4 +1,4 @@
@@ -7949,10 +7949,10 @@ index 1f3f5b5b..34c4e17d 100644
const nodeData = this.getDataFromNode(node, shaderStage, this.globalCache);

diff --git a/src-testing/src/renderers/webgpu/WebGPUBackend.ts b/src-testing/src/renderers/webgpu/WebGPUBackend.ts
index 2cb79b70..6b5b60e0 100644
index d29fe26c..7c98ca73 100644
--- a/src-testing/src/renderers/webgpu/WebGPUBackend.ts
+++ b/src-testing/src/renderers/webgpu/WebGPUBackend.ts
@@ -983,7 +983,7 @@ class WebGPUBackend extends Backend {
@@ -984,7 +984,7 @@ class WebGPUBackend extends Backend {
this.textureUtils.destroyTexture(texture);
}

@@ -7962,7 +7962,7 @@ index 2cb79b70..6b5b60e0 100644
}

diff --git a/src-testing/src/renderers/webgpu/nodes/WGSLNodeBuilder.ts b/src-testing/src/renderers/webgpu/nodes/WGSLNodeBuilder.ts
index 99e8cfef..37812056 100644
index 8c21a98a..55252c3b 100644
--- a/src-testing/src/renderers/webgpu/nodes/WGSLNodeBuilder.ts
+++ b/src-testing/src/renderers/webgpu/nodes/WGSLNodeBuilder.ts
@@ -10,7 +10,7 @@ import {
@@ -7982,7 +7982,7 @@ index 99e8cfef..37812056 100644
+import UniformNode from '../../../nodes/core/UniformNode.js';

// GPUShaderStage is not defined in browsers not supporting WebGPU
const GPUShaderStage = self.GPUShaderStage;
const GPUShaderStage = typeof self !== 'undefined' ? self.GPUShaderStage : { VERTEX: 1, FRAGMENT: 2, COMPUTE: 4 };
@@ -204,7 +206,13 @@ class WGSLNodeBuilder extends NodeBuilder {
return texture.isVideoTexture === true && texture.colorSpace !== NoColorSpace;
}
2 changes: 1 addition & 1 deletion three.js
Submodule three.js updated 214 files
1 change: 1 addition & 0 deletions types/three/build/three.tsl.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../src/Three.TSL.js";
1 change: 1 addition & 0 deletions types/three/build/three.tsl.min.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../src/Three.TSL.js";
3 changes: 1 addition & 2 deletions types/three/examples/jsm/csm/CSMShadowNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Camera, DirectionalLightShadow, Light, Object3D } from "three";
import { Node } from "three/tsl";
import { Camera, DirectionalLightShadow, Light, Node, Object3D } from "three/webgpu";
import { CSMFrustum } from "./CSMFrustum.js";

export type CSMShadowNodeMode = "uniform" | "logarithmic" | "practical" | "custom";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodeMaterial, NodeMaterialParameters } from "three/tsl";
import { NodeMaterial, NodeMaterialParameters } from "three/webgpu";

declare class LDrawConditionalLineMaterial extends NodeMaterial {
readonly isLDrawConditionalLineMaterial: true;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/objects/SkyMesh.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ShaderNodeObject, UniformNode } from "three/tsl";
import { BoxGeometry, Mesh, NodeMaterial, Vector3 } from "three/webgpu";
import { ShaderNodeObject } from "three/tsl";
import { BoxGeometry, Mesh, NodeMaterial, UniformNode, Vector3 } from "three/webgpu";

declare class SkyMesh extends Mesh<BoxGeometry, NodeMaterial> {
turbidity: ShaderNodeObject<UniformNode<number>>;
15 changes: 13 additions & 2 deletions types/three/examples/jsm/objects/Water2Mesh.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { TempNode, TextureNode, UniformNode, Vector2, Vector3 } from "three/tsl";
import { BufferGeometry, Color, ColorRepresentation, Mesh, NodeMaterial, Texture } from "three/webgpu";
import {
BufferGeometry,
Color,
ColorRepresentation,
Mesh,
NodeMaterial,
TempNode,
Texture,
TextureNode,
UniformNode,
Vector2,
Vector3,
} from "three/webgpu";

export interface WaterMeshOptions {
normalMap0: Texture;
13 changes: 11 additions & 2 deletions types/three/examples/jsm/objects/WaterMesh.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { TextureNode, UniformNode } from "three/tsl";
import { BufferGeometry, Color, ColorRepresentation, Mesh, NodeMaterial, Texture, Vector3 } from "three/webgpu";
import {
BufferGeometry,
Color,
ColorRepresentation,
Mesh,
NodeMaterial,
Texture,
TextureNode,
UniformNode,
Vector3,
} from "three/webgpu";

export interface WaterMeshOptions {
resolution?: number | undefined;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/AfterImageNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { ShaderNodeObject } from "three/tsl";
import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";

export default class AfterImageNode extends TempNode {
textureNode: TextureNode;
2 changes: 1 addition & 1 deletion types/three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Scene } from "three";
import { ShaderNodeObject } from "three/tsl";
import { Camera, Scene } from "three/webgpu";
import StereoCompositePassNode from "./StereoCompositePassNode.js";

declare class AnaglyphPassNode extends StereoCompositePassNode {
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/AnamorphicNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Vector2 } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, Vector2 } from "three/webgpu";

export default class AnamorphicNode extends TempNode {
textureNode: Node;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/BleachBypass.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Node, NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node } from "three/webgpu";

export const bleach: (color: NodeRepresentation, opacity?: number) => ShaderNodeObject<Node>;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/BloomNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";

declare class BloomNode extends TempNode {
inputNode: Node;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/DenoiseNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Matrix4 } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Camera, Node, TempNode, UniformNode } from "three/webgpu";

declare class DenoiseNode extends TempNode {
textureNode: Node;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";

declare class DepthOfFieldNode extends TempNode {
textureNode: TextureNode;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/DotScreenNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Vector2 } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, UniformNode, Vector2 } from "three/webgpu";

declare class DotScreenNode extends TempNode {
inputNode: Node;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/FXAANode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NodeRepresentation, ShaderNodeObject, TempNode, TextureNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { TempNode, TextureNode } from "three/webgpu";

declare class FXAANode extends TempNode {
textureNode: TextureNode;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/FilmNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode } from "three/webgpu";

declare class FilmNode extends TempNode {
inputNode: Node;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/GTAONode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Vector2 } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Camera, Node, TempNode, TextureNode, UniformNode, Vector2 } from "three/webgpu";

declare class GTAONode extends TempNode {
depthNode: Node;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/GaussianBlurNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Vector2 } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, TextureNode, Vector2 } from "three/webgpu";

declare class GaussianBlurNode extends TempNode {
textureNode: TextureNode;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/LensflareNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Vector3 } from "three";
import { NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { TempNode, TextureNode, UniformNode, Vector3 } from "three/webgpu";

interface LensflareNodeParams {
ghostTint?: NodeRepresentation | undefined;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/Lut3DNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Data3DTexture } from "three";
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, Texture3DNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Data3DTexture, Node, TempNode, Texture3DNode, UniformNode } from "three/webgpu";

declare class Lut3DNode extends TempNode {
inputNode: Node;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/MotionBlur.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node } from "three/webgpu";

export const motionBlur: (
inputNode: NodeRepresentation,
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/OutlineNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { Camera, Object3D, Scene } from "three/webgpu";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Camera, Node, Object3D, Scene, TempNode, TextureNode, UniformNode } from "three/webgpu";

export interface OutlineNodeParams {
selectedObjects?: Object3D[] | undefined;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Scene } from "three";
import { ShaderNodeObject } from "three/tsl";
import { Camera, Scene } from "three/webgpu";
import StereoCompositePassNode from "./StereoCompositePassNode.js";

declare class ParallaxBarrierPassNode extends StereoCompositePassNode {
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/PixelationPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Scene } from "three";
import { PassNode, ShaderNodeObject, UniformNode } from "three/tsl";
import { ShaderNodeObject } from "three/tsl";
import { Camera, PassNode, Scene, UniformNode } from "three/webgpu";

declare class PixelationPassNode extends PassNode {
pixelSize: UniformNode<number>;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/RGBShiftNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { TempNode, TextureNode, UniformNode } from "three/webgpu";

export default class RGBShiftNode extends TempNode {
textureNode: TextureNode;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/SMAANode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NodeRepresentation, ShaderNodeObject, TempNode, TextureNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { TempNode, TextureNode } from "three/webgpu";

declare class SMAANode extends TempNode {
textureNode: TextureNode;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/SSAAPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Color, RenderTarget, Scene } from "three";
import { PassNode, ShaderNodeObject, UniformNode } from "three/tsl";
import { ShaderNodeObject } from "three/tsl";
import { Camera, Color, PassNode, RenderTarget, Scene, UniformNode } from "three/webgpu";

declare class SSAAPassNode extends PassNode {
readonly isSSAAPassNode: boolean;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/SSRNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { Camera } from "three/webgpu";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Camera, Node, TempNode, TextureNode, UniformNode } from "three/webgpu";

declare class SSRNode extends TempNode {
colorNode: ShaderNodeObject<Node>;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/Sepia.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Node, NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node } from "three/webgpu";

export const sepia: (color: NodeRepresentation) => ShaderNodeObject<Node>;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/SobelOperatorNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NodeRepresentation, ShaderNodeObject, TempNode, TextureNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { TempNode, TextureNode } from "three/webgpu";

declare class SobelOperatorNode extends TempNode {
textureNode: TextureNode;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Camera, CoordinateSystem, Scene, StereoCamera } from "three";
import { PassNode } from "three/tsl";
import { Camera, CoordinateSystem, PassNode, Scene, StereoCamera } from "three/webgpu";

declare class StereoCompositePassNode extends PassNode {
readonly isStereoCompositePassNode: true;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/StereoPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, Scene, StereoCamera } from "three";
import { PassNode, ShaderNodeObject } from "three/tsl";
import { ShaderNodeObject } from "three/tsl";
import { Camera, PassNode, Scene, StereoCamera } from "three/webgpu";

declare class StereoPassNode extends PassNode {
readonly isStereoPassNode: true;
4 changes: 2 additions & 2 deletions types/three/examples/jsm/tsl/display/TRAAPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Camera, ColorRepresentation, Scene } from "three";
import { PassNode, ShaderNodeObject } from "three/tsl";
import { ShaderNodeObject } from "three/tsl";
import { Camera, ColorRepresentation, PassNode, Scene } from "three/webgpu";

declare class TRAAPassNode extends PassNode {
readonly isTRAAPassNode: true;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/TransitionNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject, TempNode, TextureNode, UniformNode } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";

declare class TransitionNode extends TempNode {
textureNodeA: TextureNode;
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/display/hashBlur.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Node, NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { Node } from "three/webgpu";

export const hashBlur: (
textureNode: NodeRepresentation,
3 changes: 2 additions & 1 deletion types/three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LightsNode, Node, NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { NodeRepresentation, ShaderNodeObject } from "three/tsl";
import { LightsNode, Node } from "three/webgpu";

export const circleIntersectsAABB: (
circleCenter: NodeRepresentation,
2 changes: 1 addition & 1 deletion types/three/package.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
"./addons/*": "./examples/jsm/*",
"./src/*": "./src/*",
"./webgpu": "./build/three.webgpu.js",
"./tsl": "./build/three.webgpu.js"
"./tsl": "./build/three.tsl.js"
},
"dependencies": {
"@tweenjs/tween.js": "~23.1.3",
527 changes: 527 additions & 0 deletions types/three/src/Three.TSL.d.ts

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion types/three/src/Three.WebGPU.Nodes.d.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js";
export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js";
export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js";
export * from "./nodes/Nodes.js";
export * from "./nodes/TSL.js";
import * as TSL from "./nodes/TSL.js";
export { TSL };
export { ClippingGroup } from "./objects/ClippingGroup.js";
export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js";
export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js";
3 changes: 2 additions & 1 deletion types/three/src/Three.WebGPU.d.ts
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js";
export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js";
export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js";
export * from "./nodes/Nodes.js";
export * from "./nodes/TSL.js";
import * as TSL from "./nodes/TSL.js";
export { TSL };
export { ClippingGroup } from "./objects/ClippingGroup.js";
export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js";
export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js";
1 change: 0 additions & 1 deletion types/three/src/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
@@ -138,7 +138,6 @@ export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js";
export { default as IrradianceNode } from "./lighting/IrradianceNode.js";
export { default as LightingContextNode } from "./lighting/LightingContextNode.js";
export { default as LightingNode } from "./lighting/LightingNode.js";
export { default as LightNode, LightNodeScope } from "./lighting/LightNode.js";
export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
export { default as LightsNode } from "./lighting/LightsNode.js";
export { default as PointLightNode } from "./lighting/PointLightNode.js";
6 changes: 5 additions & 1 deletion types/three/src/nodes/TSL.d.ts
Original file line number Diff line number Diff line change
@@ -123,11 +123,15 @@ export * from "./fog/FogRangeNode.js";
export * from "./geometry/RangeNode.js";

// gpgpu
export * from "./gpgpu/AtomicFunctionNode.js";
export * from "./gpgpu/BarrierNode.js";
export * from "./gpgpu/ComputeBuiltinNode.js";
export * from "./gpgpu/ComputeNode.js";
export * from "./gpgpu/WorkgroupInfoNode.js";

// lighting
export * from "./accessors/Lights.js";
export * from "./lighting/LightingContextNode.js";
export * from "./lighting/LightNode.js";
export * from "./lighting/LightsNode.js";
export * from "./lighting/PointLightNode.js";
export * from "./lighting/ShadowNode.js";
15 changes: 15 additions & 0 deletions types/three/src/nodes/accessors/Lights.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Light } from "../../lights/Light.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

export function lightShadowMatrix(light: Light): ShaderNodeObject<Node>;

export function lightProjectionUV(light: Light): ShaderNodeObject<Node>;

export function lightPosition(light: Light): ShaderNodeObject<Node>;

export function lightTargetPosition(light: Light): ShaderNodeObject<Node>;

export function lightViewPosition(light: Light): ShaderNodeObject<Node>;

export const lightTargetDirection: (light: Light) => ShaderNodeObject<Node>;
2 changes: 2 additions & 0 deletions types/three/src/nodes/core/IndexNode.d.ts
Original file line number Diff line number Diff line change
@@ -24,5 +24,7 @@ export default IndexNode;

export const vertexIndex: ShaderNodeObject<IndexNode>;
export const instanceIndex: ShaderNodeObject<IndexNode>;
export const subgroupIndex: ShaderNodeObject<IndexNode>;
export const invocationSubgroupIndex: ShaderNodeObject<IndexNode>;
export const invocationLocalIndex: ShaderNodeObject<IndexNode>;
export const drawIndex: ShaderNodeObject<IndexNode>;
7 changes: 6 additions & 1 deletion types/three/src/nodes/core/StackNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ShaderNodeObject } from "../tsl/TSLCore.js";
import Node from "./Node.js";

export default class StackNode extends Node {
declare class StackNode extends Node {
isStackNode: true;
nodes: Node[];
outputNode: Node | null;
@@ -25,3 +26,7 @@ export default class StackNode extends Node {
*/
else(method: () => void): this;
}

export default StackNode;

export const stack: () => ShaderNodeObject<StackNode>;
5 changes: 5 additions & 0 deletions types/three/src/nodes/display/ScreenNode.d.ts
Original file line number Diff line number Diff line change
@@ -37,6 +37,11 @@ export const viewportUV: ShaderNodeObject<Node>;

// Deprecated

/**
* @deprecated "viewportResolution" is deprecated. Use "screenSize" instead.
*/
export const viewportResolution: ShaderNodeObject<ScreenNode>;

/**
* @deprecated "viewportTopLeft" is deprecated. Use "viewportUV" instead.
*/
88 changes: 88 additions & 0 deletions types/three/src/nodes/gpgpu/AtomicFunctionNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import Node from "../core/Node.js";
import TempNode from "../core/TempNode.js";
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";

export type AtomicMethod =
| typeof AtomicFunctionNode.ATOMIC_LOAD
| typeof AtomicFunctionNode.ATOMIC_STORE
| typeof AtomicFunctionNode.ATOMIC_ADD
| typeof AtomicFunctionNode.ATOMIC_SUB
| typeof AtomicFunctionNode.ATOMIC_MAX
| typeof AtomicFunctionNode.ATOMIC_MIN
| typeof AtomicFunctionNode.ATOMIC_AND
| typeof AtomicFunctionNode.ATOMIC_OR
| typeof AtomicFunctionNode.ATOMIC_XOR;

declare class AtomicFunctionNode extends TempNode {
method: AtomicMethod;
pointerNode: Node;
valueNode: Node;
storeNode: Node;

constructor(method: AtomicMethod, pointerNode: Node, valueNode: Node, storeNode?: Node | null);

static ATOMIC_LOAD: "atomicLoad";
static ATOMIC_STORE: "atomicStore";
static ATOMIC_ADD: "atomicAdd";
static ATOMIC_SUB: "atomicSub";
static ATOMIC_MAX: "atomicMax";
static ATOMIC_MIN: "atomicMin";
static ATOMIC_AND: "atomicAnd";
static ATOMIC_OR: "atomicOr";
static ATOMIC_XOR: "atomicXor";
}

export const atomicFunc: (
method: AtomicMethod,
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicStore: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicAdd: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicSub: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicMax: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicMin: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicAnd: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicOr: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;

export const atomicXor: (
pointerNode: NodeRepresentation,
valueNode: NodeRepresentation,
storeNode?: NodeRepresentation | null,
) => ShaderNodeObject<AtomicFunctionNode>;
12 changes: 12 additions & 0 deletions types/three/src/nodes/gpgpu/BarrierNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

declare class BarrierNode extends Node {
scope: string;

constructor(scope: string);
}

export const workgroupBarrier: () => ShaderNodeObject<Node>;
export const storageBarrier: () => ShaderNodeObject<Node>;
export const textureBarrier: () => ShaderNodeObject<Node>;
13 changes: 13 additions & 0 deletions types/three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

declare class ComputeBuiltinNode extends Node {
constructor(builtinName: string, nodeType: string);
}

export default ComputeBuiltinNode;

export const numWorkgroups: ShaderNodeObject<ComputeBuiltinNode>;
export const workgroupId: ShaderNodeObject<ComputeBuiltinNode>;
export const localId: ShaderNodeObject<ComputeBuiltinNode>;
export const subgroupSize: ShaderNodeObject<ComputeBuiltinNode>;
17 changes: 17 additions & 0 deletions types/three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

declare class WorkgroupInfoNode extends Node {
bufferType: string;
bufferCount: number;

readonly isWorkgroupInfoNode: true;

scope: string;

constructor(scope: string, bufferType: string, bufferCount?: number);
}

export default WorkgroupInfoNode;

export const workgroupArray: (type: string, count?: number) => ShaderNodeObject<WorkgroupInfoNode>;
18 changes: 0 additions & 18 deletions types/three/src/nodes/lighting/LightNode.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions types/three/src/nodes/lighting/LightsNode.d.ts
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@ import { Light } from "../../lights/Light.js";
import Node from "../core/Node.js";
import { NodeBuilder } from "../Nodes.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";
import LightNode from "./LightNode.js";
import LightingNode from "./LightingNode.js";

declare class LightsNode extends Node {
constructor();

setupLightsNode(builder: NodeBuilder): void;

setupLights(builder: NodeBuilder, lightNodes: LightNode[]): void;
setupLights(builder: NodeBuilder, lightNodes: LightingNode[]): void;

setLights(lights: Light[]): this;

3 changes: 3 additions & 0 deletions types/three/src/nodes/math/OperatorNode.d.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ export type OperatorNodeOp =
| ">>"
| "<<"
| "=="
| "!="
| "&&"
| "||"
| "^^"
@@ -42,6 +43,7 @@ export const mul: Operator;
export const div: Operator;
export const modInt: Operator;
export const equal: Operator;
export const notEqual: Operator;
export const lessThan: Operator;
export const greaterThan: Operator;
export const lessThanEqual: Operator;
@@ -65,6 +67,7 @@ declare module "../tsl/TSLCore.js" {
div: typeof div;
modInt: typeof modInt;
equal: typeof equal;
notEqual: typeof notEqual;
lessThan: typeof lessThan;
greaterThan: typeof greaterThan;
lessThanEqual: typeof lessThanEqual;
5 changes: 5 additions & 0 deletions types/three/src/nodes/tsl/TSLBase.d.ts
Original file line number Diff line number Diff line change
@@ -19,3 +19,8 @@ export * from "../math/OperatorNode.js";
export * from "../utils/Discard.js";
export * from "../utils/RemapNode.js";
export * from "./TSLCore.js";

/**
* @deprecated
*/
export function addNodeElement(name: string): void;
3 changes: 3 additions & 0 deletions types/three/src/nodes/tsl/TSLCore.d.ts
Original file line number Diff line number Diff line change
@@ -172,6 +172,8 @@ type ConstructedNode<T> = T extends new(...args: any[]) => infer R ? (R extends

export type NodeOrType = Node | string;

export const defined: (v: unknown) => unknown;

export const getConstNodeType: (value: NodeOrType) => string | null;

export class ShaderNode<T = {}, R extends Node = Node> {
@@ -271,3 +273,4 @@ export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject<ConstNode<Arr

export const element: (node: NodeRepresentation, indexNode: NodeRepresentation) => ShaderNodeObject<Node>;
export const convert: (node: NodeRepresentation, types: string) => ShaderNodeObject<Node>;
export const split: (node: NodeRepresentation, channels?: string) => ShaderNodeObject<Node>;
2 changes: 1 addition & 1 deletion types/three/src/nodes/utils/SplitNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Node from "../core/Node.js";
import { SwizzleOption } from "../tsl/TSLCore.js";

/** swizzle node */
export default class SplitNode extends Node {
node: Node;
components: string;
@@ -11,5 +10,6 @@ export default class SplitNode extends Node {
* @param components swizzle like string, default = "x"
*/
constructor(node: Node, components?: SwizzleOption);

getVectorLength(): number;
}
16 changes: 2 additions & 14 deletions types/three/test/unit/examples/jsm/nodes/ShaderNode/ShaderNode.ts
Original file line number Diff line number Diff line change
@@ -2,20 +2,8 @@
* Various tests of ShaderNode and related type inference
*/

import {
color,
ConstNode,
MaterialNode,
Node,
nodeArray,
nodeImmutable,
PropertyNode,
ShaderNode,
ShaderNodeObject,
Swizzable,
tslFn,
vec3,
} from "three/webgpu";
import { color, nodeArray, nodeImmutable, ShaderNode, ShaderNodeObject, Swizzable, tslFn, vec3 } from "three/tsl";
import { ConstNode, MaterialNode, Node, PropertyNode } from "three/webgpu";

// just to type check
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
14 changes: 2 additions & 12 deletions types/three/test/unit/examples/jsm/nodes/core/FunctionNode.ts
Original file line number Diff line number Diff line change
@@ -2,18 +2,8 @@
* Various tests of func, fn and call
*/

import {
call,
code,
FunctionCallNode,
FunctionNode,
glslFn,
Node,
ProxiedObject,
Swizzable,
uv,
wgslFn,
} from "three/webgpu";
import { call, code, glslFn, ProxiedObject, Swizzable, uv, wgslFn } from "three/tsl";
import { FunctionCallNode, FunctionNode, Node } from "three/webgpu";

export const mx_noise = code("whatever");
const includes = [mx_noise];
Original file line number Diff line number Diff line change
@@ -5,25 +5,8 @@
* between ShaderNode a normal node.
*/

import {
add,
atan2,
cos,
div,
dot,
float,
mat3,
max,
mix,
mul,
Node,
ShaderNode,
sin,
sqrt,
sub,
TempNode,
vec3,
} from "three/webgpu";
import { add, atan2, cos, div, dot, float, mat3, max, mix, mul, ShaderNode, sin, sqrt, sub, vec3 } from "three/tsl";
import { Node, TempNode } from "three/webgpu";

const luminanceNode = new ShaderNode<{ color: Node }>(({ color }) => {
const LUMA = vec3(0.2125, 0.7154, 0.0721);
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import {
mx_worley_noise_vec3,
vec2,
vec3,
} from "three/webgpu";
} from "three/tsl";

mx_aastep(0, 1);

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mx_hsvtorgb, mx_rgbtohsv, vec3 } from "three/webgpu";
import { mx_hsvtorgb, mx_rgbtohsv, vec3 } from "three/tsl";

mx_hsvtorgb(vec3(0));
mx_rgbtohsv(vec3(0));
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import {
mx_worley_noise_vec2,
mx_worley_noise_vec3,
} from "three/src/nodes/materialx/lib/mx_noise.js";
import { float, vec2 } from "three/webgpu";
import { float, vec2 } from "three/tsl";

mx_select(true, 1, 0);
mx_negate_if(true, 1);
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { mx_srgb_texture_to_lin_rec709, vec3 } from "three/webgpu";
import { mx_srgb_texture_to_lin_rec709, vec3 } from "three/tsl";

mx_srgb_texture_to_lin_rec709(vec3(0));