Skip to content

Commit

Permalink
Nodes: Add StereoPassNode. (#1198)
Browse files Browse the repository at this point in the history
* Nodes: Add StereoPassNode.

* Update three.js

* Add examples

* Update patch and delete examples
  • Loading branch information
Methuselah96 authored Aug 25, 2024
1 parent 36eeccb commit d10e022
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
33 changes: 33 additions & 0 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13521,6 +13521,39 @@ index 4a2e6c80..22eeb6d0 100644

init();

diff --git a/examples-testing/examples/webgpu_display_stereo.ts b/examples-testing/examples/webgpu_display_stereo.ts
index 8063777c..51757359 100644
--- a/examples-testing/examples/webgpu_display_stereo.ts
+++ b/examples-testing/examples/webgpu_display_stereo.ts
@@ -1,10 +1,10 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

import { stereoPass } from 'three/tsl';

-let camera, scene, renderer, postProcessing;
+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer, postProcessing: THREE.PostProcessing;

-let mesh, dummy;
+let mesh: THREE.InstancedMesh, dummy: THREE.Mesh;

let mouseX = 0,
mouseY = 0;
@@ -79,12 +79,12 @@ function onWindowResize() {
camera.updateProjectionMatrix();
}

-function onDocumentMouseMove(event) {
+function onDocumentMouseMove(event: MouseEvent) {
mouseX = (event.clientX - windowHalfX) * 0.01;
mouseY = (event.clientY - windowHalfY) * 0.01;
}

-function extractPosition(matrix, position) {
+function extractPosition(matrix: THREE.Matrix4, position: THREE.Vector3) {
position.x = matrix.elements[12];
position.y = matrix.elements[13];
position.z = matrix.elements[14];
diff --git a/examples-testing/examples/webgpu_instancing_morph.ts b/examples-testing/examples/webgpu_instancing_morph.ts
index cfd72172..ae3271f9 100644
--- a/examples-testing/examples/webgpu_instancing_morph.ts
Expand Down
1 change: 1 addition & 0 deletions types/three/src/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ export { default as RGBShiftNode, rgbShift } from "./display/RGBShiftNode.js";
export { sepia } from "./display/SepiaNode.js";
export { default as SobelOperatorNode, sobel } from "./display/SobelOperatorNode.js";
export { default as SSAAPassNode, ssaaPass } from "./display/SSAAPassNode.js";
export { default as StereoPassNode, stereoPass } from "./display/StereoPassNode.js";
export { default as ToneMappingNode, toneMapping } from "./display/ToneMappingNode.js";
export { default as TransitionNode, transition } from "./display/TransitionNode.js";
export {
Expand Down
17 changes: 17 additions & 0 deletions types/three/src/nodes/display/StereoPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Camera } from "../../cameras/Camera.js";
import { StereoCamera } from "../../cameras/StereoCamera.js";
import { Scene } from "../../scenes/Scene.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import PassNode from "./PassNode.js";

declare class StereoPassNode extends PassNode {
readonly isStereoPassNode: true;

stereo: StereoCamera;

constructor(scene: Scene, camera: Camera);
}

export const stereoPass: (scene: Scene, camera: Camera) => ShaderNodeObject<StereoPassNode>;

export default StereoPassNode;

0 comments on commit d10e022

Please sign in to comment.