Class: FilterSystem

PIXI.systems.FilterSystem

System plugin to the renderer to manage the filters.

new PIXI.systems.FilterSystem (renderer)

Name Type Description
renderer PIXI.Renderer

The renderer this System works for.

Extends

Members

activeState object

Active state

defaultFilterStack Array.<Object> readonly

List of filters for the FilterSystem

globalUniforms PIXI.UniformGroup

This uniform group is attached to filter uniforms when used

Properties:
Name Type Description
outputFrame PIXI.Rectangle
inputSize Float32Array
inputPixel Float32Array
inputClamp Float32Array
resolution Number
filterArea Float32Array
filterClamp Fload32Array

quad PIXI.Quad

A very simple geometry used when drawing a filter effect to the screen

quadUv PIXI.QuadUv

Quad UVs

The renderer this manager works for.

statePool Array.<Object>

a pool for storing filter states, save us creating new ones each tick

tempRect PIXI.Rectangle

Temporary rect for maths

texturePool Object

stores a bunch of PO2 textures used for filtering

Methods

applyFilter (filter, input, output, clear)

Draws a filter.

Name Type Description
filter PIXI.Filter

The filter to draw.

input PIXI.RenderTexture

The input render target.

output PIXI.RenderTexture

The target to output to.

clear boolean

Should the output be cleared before rendering to it

calculateNormalizedScreenSpaceMatrix (outputMatrix)PIXI.Matrix Deprecated : since 5.0.0

Name Type Description
outputMatrix PIXI.Matrix

The matrix to output to.

Returns:
Type Description
PIXI.Matrix The mapped matrix.

calculateScreenSpaceMatrix (outputMatrix)PIXI.Matrix Deprecated : since 5.0.0

Name Type Description
outputMatrix PIXI.Matrix

the matrix to output to.

Returns:
Type Description
PIXI.Matrix The mapped matrix.

calculateSpriteMatrix (outputMatrix, sprite)PIXI.Matrix

Multiply input normalized coordinates to this matrix to get sprite texture normalized coordinates.

Use outputMatrix * vTextureCoord in the shader.

Name Type Description
outputMatrix PIXI.Matrix

The matrix to output to.

sprite PIXI.Sprite

The sprite to map to.

Returns:
Type Description
PIXI.Matrix The mapped matrix.

contextChange (gl) inherited

Generic method called when there is a WebGL context change.

Name Type Description
gl WebGLRenderingContext

new webgl context

destroy (contextLost) overrides

Destroys this Filter System.

Name Type Default Description
contextLost boolean false optional

context was lost, do not free shaders

emptyPool ()

Empties the texture pool.

getFilterTexture (resolution)PIXI.RenderTexture

Gets extra render texture to use inside current filter

Name Type Description
resolution number

resolution of the renderTexture

Returns:
Type Description
PIXI.RenderTexture

getOptimalFilterTexture (minWidth, minHeight, resolution)PIXI.RenderTexture protected

Gets a Power-of-Two render texture or fullScreen texture

TODO move to a separate class could be on renderer?

Name Type Default Description
minWidth number

The minimum width of the render texture in real pixels.

minHeight number

The minimum height of the render texture in real pixels.

resolution number 1 optional

The resolution of the render texture.

Returns:
Type Description
PIXI.RenderTexture The new render texture.

Pops off the filter and applies it.

push (target, filters)

Adds a new filter to the System.

Name Type Description
target PIXI.DisplayObject

The target of the filter to render.

filters Array.<PIXI.Filter>

The filters to apply.

returnFilterTexture (renderTexture)

Frees a render texture back into the pool.

Name Type Description
renderTexture PIXI.RenderTexture

The renderTarget to free