Skip to content

Commit e011e14

Browse files
authored
TRAANode: Add velocity node source (#32274)
1 parent 551960e commit e011e14

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

examples/jsm/tsl/display/TRAANode.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,20 @@ class TRAANode extends TempNode {
237237

238238
/**
239239
* Sync the post processing stack with the TRAA node.
240+
*
240241
* @private
241242
* @type {boolean}
242243
*/
243244
this._needsPostProcessingSync = false;
244245

246+
/**
247+
* The node used to render the scene's velocity.
248+
*
249+
* @private
250+
* @type {?VelocityNode}
251+
*/
252+
this._velocityNode = null;
253+
245254
}
246255

247256
/**
@@ -284,7 +293,7 @@ class TRAANode extends TempNode {
284293
this.camera.updateProjectionMatrix();
285294
this._originalProjectionMatrix.copy( this.camera.projectionMatrix );
286295

287-
velocity.setProjectionMatrix( this._originalProjectionMatrix );
296+
this._velocityNode.setProjectionMatrix( this._originalProjectionMatrix );
288297

289298
//
290299

@@ -320,7 +329,7 @@ class TRAANode extends TempNode {
320329

321330
this.camera.clearViewOffset();
322331

323-
velocity.setProjectionMatrix( null );
332+
this._velocityNode.setProjectionMatrix( null );
324333

325334
// update jitter index
326335

@@ -454,6 +463,16 @@ class TRAANode extends TempNode {
454463

455464
}
456465

466+
if ( builder.context.velocity !== undefined ) {
467+
468+
this._velocityNode = builder.context.velocity;
469+
470+
} else {
471+
472+
this._velocityNode = velocity;
473+
474+
}
475+
457476
const currentDepthStruct = struct( {
458477

459478
closestDepth: 'float',

0 commit comments

Comments
 (0)