|
|
@@ -37,13 +37,6 @@ class AfterImageNode extends TempNode {
|
|
|
*/
|
|
|
this.textureNode = textureNode;
|
|
|
|
|
|
- /**
|
|
|
- * The texture represents the pervious frame.
|
|
|
- *
|
|
|
- * @type {TextureNode}
|
|
|
- */
|
|
|
- this.textureNodeOld = texture( null );
|
|
|
-
|
|
|
/**
|
|
|
* How quickly the after-image fades. A higher value means the after-image
|
|
|
* persists longer, while a lower value means it fades faster. Should be in
|
|
|
@@ -79,6 +72,14 @@ class AfterImageNode extends TempNode {
|
|
|
*/
|
|
|
this._textureNode = passTexture( this, this._compRT.texture );
|
|
|
|
|
|
+ /**
|
|
|
+ * The texture represents the pervious frame.
|
|
|
+ *
|
|
|
+ * @private
|
|
|
+ * @type {TextureNode}
|
|
|
+ */
|
|
|
+ this._textureNodeOld = texture( this._oldRT.texture );
|
|
|
+
|
|
|
/**
|
|
|
* The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
|
|
|
* its effect once per frame in `updateBefore()`.
|
|
|
@@ -139,18 +140,20 @@ class AfterImageNode extends TempNode {
|
|
|
|
|
|
this.setSize( _size.x, _size.y );
|
|
|
|
|
|
- const currentTexture = textureNode.value;
|
|
|
+ // make sure texture nodes point to correct render targets
|
|
|
+
|
|
|
+ this._textureNode.value = this._compRT.texture;
|
|
|
+ this._textureNodeOld.value = this._oldRT.texture;
|
|
|
|
|
|
- this.textureNodeOld.value = this._oldRT.texture;
|
|
|
+ // composite
|
|
|
|
|
|
- // comp
|
|
|
_quadMesh.material = this._materialComposed;
|
|
|
_quadMesh.name = 'AfterImage';
|
|
|
|
|
|
renderer.setRenderTarget( this._compRT );
|
|
|
_quadMesh.render( renderer );
|
|
|
|
|
|
- // Swap the textures
|
|
|
+ // swap
|
|
|
|
|
|
const temp = this._oldRT;
|
|
|
this._oldRT = this._compRT;
|
|
|
@@ -158,8 +161,6 @@ class AfterImageNode extends TempNode {
|
|
|
|
|
|
//
|
|
|
|
|
|
- textureNode.value = currentTexture;
|
|
|
-
|
|
|
RendererUtils.restoreRendererState( renderer, _rendererState );
|
|
|
|
|
|
}
|
|
|
@@ -173,7 +174,7 @@ class AfterImageNode extends TempNode {
|
|
|
setup( builder ) {
|
|
|
|
|
|
const textureNode = this.textureNode;
|
|
|
- const textureNodeOld = this.textureNodeOld;
|
|
|
+ const textureNodeOld = this._textureNodeOld;
|
|
|
|
|
|
//
|
|
|
|