Skip to content

Commit

Permalink
Addons: Add TRAAPassNode. (#1341)
Browse files Browse the repository at this point in the history
* Addons: Add TRAAPassNode.

* Update three.js

* Add examples

* Update patch and delete examples
  • Loading branch information
Methuselah96 authored Nov 10, 2024
1 parent 89faa15 commit bb8f3c2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
22 changes: 22 additions & 0 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15376,6 +15376,28 @@ index a8995b5c..9afd9009 100644

geometry = new THREE.BoxGeometry(0.05, 0.05, 0.05);
material = new THREE.MeshStandardNodeMaterial({ color: 'green', metalness: 0.3 });
diff --git a/examples-testing/examples/webgpu_postprocessing_traa.ts b/examples-testing/examples/webgpu_postprocessing_traa.ts
index 9a5558e9..05dbf9db 100644
--- a/examples-testing/examples/webgpu_postprocessing_traa.ts
+++ b/examples-testing/examples/webgpu_postprocessing_traa.ts
@@ -1,11 +1,14 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';
import { mrt, output, velocity } from 'three/tsl';
import { traaPass } from 'three/addons/tsl/display/TRAAPassNode.js';

import Stats from 'three/addons/libs/stats.module.js';

-let camera, scene, renderer, postProcessing;
-let stats;
+let camera: THREE.PerspectiveCamera,
+ scene: THREE.Scene,
+ renderer: THREE.WebGPURenderer,
+ postProcessing: THREE.PostProcessing;
+let stats: Stats;
let index = 0;

init();
diff --git a/examples-testing/examples/webgpu_postprocessing_transition.ts b/examples-testing/examples/webgpu_postprocessing_transition.ts
index dc70b8e9..8c9da56f 100644
--- a/examples-testing/examples/webgpu_postprocessing_transition.ts
Expand Down
15 changes: 15 additions & 0 deletions types/three/examples/jsm/tsl/display/TRAAPassNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Camera, ColorRepresentation, Scene } from "three";
import { PassNode, ShaderNodeObject } from "three/tsl";

declare class TRAAPassNode extends PassNode {
readonly isTRAAPassNode: true;

clearColor: ColorRepresentation;
clearAlpha: number;

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

export default TRAAPassNode;

export const traaPass: (scene: Scene, camera: Camera) => ShaderNodeObject<TRAAPassNode>;
4 changes: 4 additions & 0 deletions types/three/src/nodes/accessors/VelocityNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import UniformNode from "../core/UniformNode.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

declare class VelocityNode extends TempNode {
projectionMatrix: Matrix4 | null;

previousModelWorldMatrix: UniformNode<Matrix4>;
previousProjectionMatrix: UniformNode<Matrix4>;
previousCameraViewMatrix: UniformNode<Matrix4>;

constructor();

setProjectionMatrix(projectionMatrix: Matrix4 | null): void;
}

export default VelocityNode;
Expand Down

0 comments on commit bb8f3c2

Please sign in to comment.