PokéRogue
    Preparing search index...

    The Glow Filter controller.

    This filter controller manages the glow effect for a Camera.

    The glow effect is a visual technique that creates a soft, luminous halo around game objects, characters, or UI elements. This effect is used to emphasize importance, enhance visual appeal, or convey a sense of energy, magic, or otherworldly presence. The effect can also be set on the inside of edges. The color and strength of the glow can be modified.

    This effect samples across an area. To avoid missing data at the edges, use controller.setPaddingOverride(null) to automatically pad game objects, or camera.getPaddingWrapper(x) to enlarge a camera.

    A Glow effect is added to a Camera via the FilterList component:

    const camera = this.cameras.main;

    camera.filters.internal.addGlow();
    camera.filters.external.addGlow();

    Conversion note from Phaser 3:

    • The shader now uses stochastic sampling instead of sampling along straight lines. This improves quality, especially around corners.
    • scale has been added to the parameter list, before knockout.
    • quality is no longer a fraction, but an integer value. The default has changed from 0.1 to 10. This is not a linear conversion, because of the quality improvement. Judge the quality by eye and adjust the value accordingly.

    Hierarchy (View Summary)

    Index
    • Parameters

      • camera: Camera

        The camera that owns this filter.

      • Optionalcolor: number

        The color of the glow effect as a number value. Default 0xffffff.

      • OptionalouterStrength: number

        The strength of the glow outward from the edge of textures. Default 4.

      • OptionalinnerStrength: number

        The strength of the glow inward from the edge of textures. Default 0.

      • Optionalscale: number

        The scale of the glow effect. This multiplies the fixed distance. Default 1.

      • Optionalknockout: boolean

        If true only the glow is drawn, not the texture itself. Default false.

      • Optionalquality: number

        The quality of the glow effect. This cannot be changed after the filter has been created. Default 10.

      • Optionaldistance: number

        The distance of the glow effect. This cannot be changed after the filter has been created. Default 10.

      Returns Glow

    active: boolean

    Toggle this boolean to enable or disable this filter, without removing it from and re-adding it to the Camera's filter list.

    allowBaseDraw: boolean

    If true, this filter will be permitted to draw to the base texture. This can be unwanted if, for example, the filter doesn't actually draw anything.

    This is an internal flag used by the renderer. You should not modify this value directly.

    camera: Camera

    A reference to the Camera that owns this filter.

    color: number

    The color of the glow effect, expressed as a hex color value in the format 0xRRGGBB. Getting this value converts it from the internal normalized glcolor array. Setting it updates glcolor for use by the WebGL renderer.

    currentPadding: Rectangle

    The padding currently being used by this filter. This is read during rendering via getPadding, and may be updated by subclass implementations. It is necessary for filters being used in an external list. You should not modify this value directly.

    distance: number

    The distance of the glow effect. This cannot be changed after the filter has been created. This controls the distance of the glow effect, in pixels. Integer values only.

    glcolor: number[]

    The internal RGBA color of the glow, stored as four normalized floating-point values (red, green, blue, alpha) in the range 0 to 1, for direct use by the WebGL renderer. To set the glow color, use the color property instead.

    ignoreDestroy: boolean

    Whether this filter controller will be destroyed when the FilterList that owns it is destroyed. If you enable this, you must ensure that you clean up the filter controller at an appropriate time. This allows you to reuse a controller for multiple objects; this is not recommended unless you know what you're doing. It tends to work best with external filters.

    innerStrength: number

    The strength of the glow inward from the edge of textures.

    knockout: boolean

    If true only the glow is drawn, not the texture itself.

    outerStrength: number

    The strength of the glow outward from the edge of textures.

    paddingOverride: Rectangle

    Padding override. This is on by default. If this is set, the filter will use this padding instead of calculating it. Prefer using setPaddingOverride instead of modifying this directly.

    quality: number

    The quality of the glow effect. This cannot be changed after the filter has been created. This controls the number of samples that the glow effect will run for. A higher number is higher quality, but slower to process. Integer values only.

    renderNode: string

    The ID of the RenderNode that this filter uses.

    scale: number

    The scale of the glow effect. This multiplies the fixed distance.

    • Destroys this Controller and nulls any references it holds.

      Returns void

    • Returns the amount of extra padding, in pixels, that this filter requires when rendering. The padding accounts for the glow effect extending beyond the original bounds of the Camera's rendered output.undefined

      Returns Rectangle

      The padding Rectangle.

    • Returns the rounded padding required for this filter.

      Most filters don't need extra padding, but some may sample beyond the texture boundaries, such as a blur or glow effect.

      The bounds are encoded as a Rectangle. To enlarge the bounds, the top and left values should be negative, and the bottom and right values should be positive.

      This method calls getPadding() to get the raw padding values, and uses Math.ceil() to set the values of paddingOverride and currentPadding.undefined

      Returns Rectangle

      The rounded padding required by this filter.

    • Sets the active state of this filter.

      A disabled filter will not be used.

      Parameters

      • value: boolean

        true to enable this filter, or false to disable it.

      Returns this

      This filter instance.

    • Sets the padding override. If this is set, the filter will use this padding instead of calculating it. Call setPaddingOverride(null) to clear the override. Call setPaddingOverride() to set the padding to 0.

      Parameters

      • Optionalleft: number | null

        The left padding. Default 0.

      • Optionaltop: number

        The top padding. Default 0.

      • Optionalright: number

        The right padding. Default 0.

      • Optionalbottom: number

        The bottom padding. Default 0.

      Returns void