Skip to content

Commit

Permalink
Node: Add DotScreenNode and RGBShiftNode. (#1063)
Browse files Browse the repository at this point in the history
* Node: Add DotScreenNode and RGBShiftNode.

* Update three.js

* Add examples

* Fixes

* Update patch

* Delete examples
  • Loading branch information
Methuselah96 authored Jun 28, 2024
1 parent c9a1c5b commit 3e7291d
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14228,6 +14228,21 @@ index 2540603f..0d2dd795 100644

init();

diff --git a/examples-testing/examples/webgpu_postprocessing.ts b/examples-testing/examples/webgpu_postprocessing.ts
index ed4a0d19..7e8e080b 100644
--- a/examples-testing/examples/webgpu_postprocessing.ts
+++ b/examples-testing/examples/webgpu_postprocessing.ts
@@ -4,8 +4,8 @@ import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
import PostProcessing from 'three/addons/renderers/common/PostProcessing.js';
import { pass } from 'three/nodes';

-let camera, renderer, postProcessing;
-let object;
+let camera: THREE.PerspectiveCamera, renderer: WebGPURenderer, postProcessing: PostProcessing;
+let object: THREE.Object3D;

init();

diff --git a/examples-testing/examples/webgpu_postprocessing_afterimage.ts b/examples-testing/examples/webgpu_postprocessing_afterimage.ts
index b89f2921..c3cfcdfe 100644
--- a/examples-testing/examples/webgpu_postprocessing_afterimage.ts
Expand Down
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,12 @@ export {
sRGBToLinear,
} from "./display/ColorSpaceNode.js";
export { default as DepthOfFieldNode, dof } from "./display/DepthOfFieldNode.js";
export { default as DotScreenNode, dotScreen } from "./display/DotScreenNode.js";
export { default as FrontFacingNode, faceDirection, frontFacing } from "./display/FrontFacingNode.js";
export { default as GaussianBlurNode, gaussianBlur } from "./display/GaussianBlurNode.js";
export { default as NormalMapNode, normalMap } from "./display/NormalMapNode.js";
export { default as PosterizeNode, posterize } from "./display/PosterizeNode.js";
export { default as RGBShiftNode, rgbShift } from "./display/RGBShiftNode.js";
export { default as SobelOperatorNode, sobel } from "./display/SobelOperatorNode.js";
export { default as ToneMappingNode, toneMapping } from "./display/ToneMappingNode.js";
export {
Expand Down
32 changes: 32 additions & 0 deletions types/three/examples/jsm/nodes/display/DotScreenNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Vector2 } from "three";
import TextureNode from "../accessors/TextureNode.js";
import Node from "../core/Node.js";
import TempNode from "../core/TempNode.js";
import UniformNode from "../core/UniformNode.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";

export default class DotScreenNode extends TempNode {
colorNode: Node;
center: UniformNode<Vector2>;
angle: UniformNode<number>;
scale: UniformNode<number>;

constructor(colorNode: Node, center?: Vector2, angle?: number, scale?: number);

getTextureNode(): ShaderNodeObject<TextureNode>;

setSize(width: number, height: number): void;
}

export const dotScreen: (
node: NodeRepresentation,
center?: Vector2,
angle?: number,
scale?: number,
) => ShaderNodeObject<DotScreenNode>;

declare module "../shadernode/ShaderNode.js" {
interface NodeElements {
dotScreen: typeof dotScreen;
}
}
24 changes: 24 additions & 0 deletions types/three/examples/jsm/nodes/display/RGBShiftNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import TextureNode from "../accessors/TextureNode.js";
import TempNode from "../core/TempNode.js";
import UniformNode from "../core/UniformNode.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";

export default class RGBShiftNode extends TempNode {
textureNode: TextureNode;
amount: UniformNode<number>;
angle: UniformNode<number>;

constructor(textureNode: TextureNode, amount?: number, angle?: number);

getTextureNode(): TextureNode;

setSize(width: number, height: number): void;
}

export const rgbShift: (node: NodeRepresentation, amount?: number, angle?: number) => ShaderNodeObject<RGBShiftNode>;

declare module "../shadernode/ShaderNode.js" {
interface NodeElements {
rgbShift: typeof rgbShift;
}
}

0 comments on commit 3e7291d

Please sign in to comment.