Skip to content

Commit

Permalink
clipToViewport needs to take into account the resolution of the root …
Browse files Browse the repository at this point in the history
…renderer. (pixijs#11052)
  • Loading branch information
GoodBoyDigital authored Nov 13, 2024
1 parent 599405c commit 80b4f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/filters/FilterSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,16 @@ export class FilterSystem implements System
// here we constrain the bounds to the viewport we will render too
// this should not take into account the x, y offset of the viewport - as this is
// handled by the viewport on the gpu.
// need to factor in resolutions also..
bounds
.scale(resolution);

if (clipToViewport)
{
const viewPort = renderer.renderTarget.rootViewPort;

bounds.fitBounds(0, viewPort.width, 0, viewPort.height);
}

// round the bounds to the nearest pixel
bounds
.scale(resolution)
.ceil()
.scale(1 / resolution)
.pad(padding | 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export const scene: TestScene = {
vertex: circleVert,
fragment: circleFrag,
},
resolution: 2,

});

sprite.filters = customFilter;
Expand Down

0 comments on commit 80b4f6e

Please sign in to comment.