Skip to content

Commit ce402f3

Browse files
authored
TRAAPassNode: Clean up. (#29671)
1 parent 6ba7313 commit ce402f3

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

examples/jsm/tsl/display/TRAAPassNode.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,20 @@ class TRAAPassNode extends PassNode {
8383
this._pixelRatio = renderer.getPixelRatio();
8484
const size = renderer.getSize( _size );
8585

86-
const needsRestart = this.setSize( size.width, size.height, renderer );
86+
const needsRestart = this.setSize( size.width, size.height );
8787

88-
//
88+
// save original/unjittered projection matrix for velocity pass
89+
90+
camera.updateProjectionMatrix();
91+
this._originalProjectionMatrix.copy( camera.projectionMatrix );
92+
93+
// camera configuration
8994

9095
this._cameraNear.value = camera.near;
9196
this._cameraFar.value = camera.far;
9297

98+
// configure jitter as view offset
99+
93100
const viewOffset = {
94101

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

108115
const jitterOffset = _JitterVectors[ this._jitterIndex ];
109116

110-
camera.updateProjectionMatrix();
111-
this._originalProjectionMatrix.copy( camera.projectionMatrix );
112-
113117
camera.setViewOffset(
114118

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

121125
);
122126

127+
// configure velocity
128+
123129
const mrt = this.getMRT();
124130
const velocityOutput = mrt.get( 'velocity' );
125131

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

134140
}
135141

142+
// render sample
143+
136144
renderer.setMRT( mrt );
137145

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

227-
this._sampleRenderTarget.textures.push( velocityTarget );
235+
this._sampleRenderTarget.textures.push( velocityTarget ); // for MRT
228236

229237
}
230238

0 commit comments

Comments
 (0)