Skip to content

Commit bfe332d

Browse files
authored
PassNode: Fix scissor and viewport setup. (#33204)
1 parent 21ae313 commit bfe332d

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

src/nodes/display/PassNode.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,26 @@ class PassNode extends TempNode {
886886

887887
this.renderTarget.setSize( effectiveWidth, effectiveHeight );
888888

889-
if ( this._scissor !== null ) this.renderTarget.scissor.copy( this._scissor );
890-
if ( this._viewport !== null ) this.renderTarget.viewport.copy( this._viewport );
889+
// scissor
890+
891+
if ( this._scissor !== null ) {
892+
893+
this.renderTarget.scissor.copy( this._scissor ).multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
894+
this.renderTarget.scissorTest = true;
895+
896+
} else {
897+
898+
this.renderTarget.scissorTest = false;
899+
900+
}
901+
902+
// viewport
903+
904+
if ( this._viewport !== null ) {
905+
906+
this.renderTarget.viewport.copy( this._viewport ).multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
907+
908+
}
891909

892910
}
893911

@@ -922,8 +940,6 @@ class PassNode extends TempNode {
922940

923941
}
924942

925-
this._scissor.multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
926-
927943
}
928944

929945
}
@@ -958,8 +974,6 @@ class PassNode extends TempNode {
958974

959975
}
960976

961-
this._viewport.multiplyScalar( this._pixelRatio * this._resolutionScale ).floor();
962-
963977
}
964978

965979
}

0 commit comments

Comments
 (0)