Skip to content

Commit da328ec

Browse files
authored
DepthOfFieldNode: New implementation. (#1768)
* DepthOfFieldNode: New implementation. * Format * Update three.js * Add examples * Update patch and delete examples
1 parent d4ce61c commit da328ec

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

examples-testing/changes.patch

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17264,23 +17264,21 @@ index c39b8793..3c6eaadf 100644
1726417264
init();
1726517265

1726617266
diff --git a/examples-testing/examples/webgpu_postprocessing_dof.ts b/examples-testing/examples/webgpu_postprocessing_dof.ts
17267-
index 8c1b8ca0..ef11d62e 100644
17267+
index 238ed4e4..eef4c8f6 100644
1726817268
--- a/examples-testing/examples/webgpu_postprocessing_dof.ts
1726917269
+++ b/examples-testing/examples/webgpu_postprocessing_dof.ts
17270-
@@ -8,7 +8,11 @@ import Stats from 'three/addons/libs/stats.module.js';
17270+
@@ -9,12 +9,17 @@ import Stats from 'three/addons/libs/stats.module.js';
1727117271

1727217272
//
1727317273

17274-
-let camera, scene, renderer, mesh, stats;
17274+
-let camera, scene, renderer, mesh, controls, stats;
1727517275
+let camera: THREE.PerspectiveCamera,
1727617276
+ scene: THREE.Scene,
1727717277
+ renderer: THREE.WebGPURenderer,
1727817278
+ mesh: THREE.InstancedMesh,
17279+
+ controls: OrbitControls,
1727917280
+ stats: Stats;
1728017281

17281-
let mouseX = 0,
17282-
mouseY = 0;
17283-
@@ -19,7 +23,7 @@ let windowHalfY = window.innerHeight / 2;
1728417282
let width = window.innerWidth;
1728517283
let height = window.innerHeight;
1728617284

@@ -17289,15 +17287,6 @@ index 8c1b8ca0..ef11d62e 100644
1728917287

1729017288
init();
1729117289

17292-
@@ -126,7 +130,7 @@ function init() {
17293-
gui.add(effectController.maxblur, 'value', 0.0, 0.01, 0.001).name('maxblur');
17294-
}
17295-
17296-
-function onPointerMove(event) {
17297-
+function onPointerMove(event: PointerEvent) {
17298-
if (event.isPrimary === false) return;
17299-
17300-
mouseX = event.clientX - windowHalfX;
1730117290
diff --git a/examples-testing/examples/webgpu_postprocessing_dof_basic.ts b/examples-testing/examples/webgpu_postprocessing_dof_basic.ts
1730217291
index 117f6888..9883f287 100644
1730317292
--- a/examples-testing/examples/webgpu_postprocessing_dof_basic.ts
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
import { ShaderNodeObject } from "three/tsl";
2-
import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";
2+
import { Node, TempNode, TextureNode } from "three/webgpu";
33

44
declare class DepthOfFieldNode extends TempNode {
55
textureNode: TextureNode;
66
viewZNode: Node;
77

8-
focus: UniformNode<number>;
9-
aperture: UniformNode<number>;
10-
maxblur: UniformNode<number>;
8+
focusDistanceNode: Node;
9+
focalLengthNode: Node;
10+
bokehScaleNode: Node;
1111

12-
constructor(textureNode: TextureNode, viewZNode: Node, focusNode: Node, apertureNode: Node, maxblurNode: Node);
12+
constructor(
13+
textureNode: TextureNode,
14+
viewZNode: Node,
15+
focusDistanceNode: Node,
16+
focalLengthNode: Node,
17+
bokehScaleNode: Node,
18+
);
1319
}
1420

1521
export default DepthOfFieldNode;
1622

1723
export const dof: (
1824
node: Node,
1925
viewZNode: Node,
20-
focus?: Node,
21-
aperture?: Node,
22-
maxblur?: Node,
26+
focusDistance?: Node | number,
27+
focalLength?: Node | number,
28+
bokehScale?: Node | number,
2329
) => ShaderNodeObject<DepthOfFieldNode>;

0 commit comments

Comments
 (0)