Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CanvasVisionMask, WeatherEffects#weather, and CanvasBackgroundAlterationEffects#vision containers are missing filterArea #7266

Closed
dev7355608 opened this issue Jun 11, 2022 · 2 comments
Assignees
Labels
canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. sfx Issues related to visual effects like weather

Comments

@dev7355608
Copy link

Environment Details

  • Foundry VTT Version: 10.270

Issue Description

If the filterArea is not set, the bounds of the container are calculated every frame if a filter is applied, which can have a noticeable performance impact at least in the case of the weather container. It might even be a good idea to override bounds calculation for the reason that a filter might be attached to one of the parents of the weather container: this would cause bounds calculation of the weather container, if no filterArea is set on the parent.

class ParticleContainer extends PIXI.Container {
    filterArea = canvas.app.screen;
    accessibleChildren = false;
    interactiveChildren = false;

    calculateBounds() {
        const bounds = this._bounds;
        const { x, y, width, height } = canvas.dimensions.rect;
        bounds.clear();
        bounds.addFrame(this.transform, x, y, x + width, y + height);
        bounds.updateID = this._boundsID;
    }
}

The InterfaceCanvasGroup also doesn't have filterArea set.

@aaclayton aaclayton added bug Functionality which is not working as intended canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. sfx Issues related to visual effects like weather labels Jun 12, 2022
@aaclayton aaclayton added this to the Version 10 - Development 2 milestone Jun 12, 2022
@Feu-Secret
Copy link

Good suggestion!

@Feu-Secret Feu-Secret self-assigned this Jun 12, 2022
@aaclayton aaclayton removed the bug Functionality which is not working as intended label Jun 22, 2022
@aaclayton aaclayton assigned Feu-Secret and unassigned Feu-Secret Jul 4, 2022
@Feu-Secret Feu-Secret self-assigned this Jul 25, 2022
@Feu-Secret
Copy link

Overview of the changes:

  • Added the filterArea = canvas.app.renderer.screen in CanvasVisionMask, WeatherEffects#weather and CanvasBackgroundAlterationEffects#vision
  • Added a new specialized container FullCanvasContainer, where bounds are not computed with children, but with canvas dimensions.
  • WeatherEffects#weather is now a FullCanvasContainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. sfx Issues related to visual effects like weather
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants