Просмотр исходного кода

TRAANode: Add velocity node source (#32274)

Shota Matsuda 6 дней назад
Родитель
Сommit
e011e147ea
1 измененных файлов с 21 добавлено и 2 удалено
  1. 21 2
      examples/jsm/tsl/display/TRAANode.js

+ 21 - 2
examples/jsm/tsl/display/TRAANode.js

@@ -237,11 +237,20 @@ class TRAANode extends TempNode {
 
 		/**
 		 * Sync the post processing stack with the TRAA node.
+		 *
 		 * @private
 		 * @type {boolean}
 		 */
 		this._needsPostProcessingSync = false;
 
+		/**
+		 * The node used to render the scene's velocity.
+		 *
+		 * @private
+		 * @type {?VelocityNode}
+		 */
+		this._velocityNode = null;
+
 	}
 
 	/**
@@ -284,7 +293,7 @@ class TRAANode extends TempNode {
 		this.camera.updateProjectionMatrix();
 		this._originalProjectionMatrix.copy( this.camera.projectionMatrix );
 
-		velocity.setProjectionMatrix( this._originalProjectionMatrix );
+		this._velocityNode.setProjectionMatrix( this._originalProjectionMatrix );
 
 		//
 
@@ -320,7 +329,7 @@ class TRAANode extends TempNode {
 
 		this.camera.clearViewOffset();
 
-		velocity.setProjectionMatrix( null );
+		this._velocityNode.setProjectionMatrix( null );
 
 		// update jitter index
 
@@ -454,6 +463,16 @@ class TRAANode extends TempNode {
 
 		}
 
+		if ( builder.context.velocity !== undefined ) {
+
+			this._velocityNode = builder.context.velocity;
+
+		} else {
+
+			this._velocityNode = velocity;
+
+		}
+
 		const currentDepthStruct = struct( {
 
 			closestDepth: 'float',

粤ICP备19079148号