Skip to content

Commit

Permalink
TRAAPassNode: Clean up. (#29671)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Oct 16, 2024
1 parent 6ba7313 commit ce402f3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions examples/jsm/tsl/display/TRAAPassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,20 @@ class TRAAPassNode extends PassNode {
this._pixelRatio = renderer.getPixelRatio();
const size = renderer.getSize( _size );

const needsRestart = this.setSize( size.width, size.height, renderer );
const needsRestart = this.setSize( size.width, size.height );

//
// save original/unjittered projection matrix for velocity pass

camera.updateProjectionMatrix();
this._originalProjectionMatrix.copy( camera.projectionMatrix );

// camera configuration

this._cameraNear.value = camera.near;
this._cameraFar.value = camera.far;

// configure jitter as view offset

const viewOffset = {

fullWidth: this.renderTarget.width,
Expand All @@ -107,9 +114,6 @@ class TRAAPassNode extends PassNode {

const jitterOffset = _JitterVectors[ this._jitterIndex ];

camera.updateProjectionMatrix();
this._originalProjectionMatrix.copy( camera.projectionMatrix );

camera.setViewOffset(

viewOffset.fullWidth, viewOffset.fullHeight,
Expand All @@ -120,6 +124,8 @@ class TRAAPassNode extends PassNode {

);

// configure velocity

const mrt = this.getMRT();
const velocityOutput = mrt.get( 'velocity' );

Expand All @@ -133,6 +139,8 @@ class TRAAPassNode extends PassNode {

}

// render sample

renderer.setMRT( mrt );

renderer.setClearColor( this.clearColor, this.clearAlpha );
Expand Down Expand Up @@ -224,7 +232,7 @@ class TRAAPassNode extends PassNode {
velocityTarget.isRenderTargetTexture = true;
velocityTarget.name = 'velocity';

this._sampleRenderTarget.textures.push( velocityTarget );
this._sampleRenderTarget.textures.push( velocityTarget ); // for MRT

}

Expand Down

0 comments on commit ce402f3

Please sign in to comment.