phaser - v4.0.0-rc.4
    Preparing search index...

    This is a base class for all filters that use a shader. Most filters will extend this class.

    It takes care of setting up the shader program and vertex buffer layout. It also provides the run method which handles the rendering of the filter. When rendering, it generates a new DrawingContext to render to, and releases the input DrawingContext.

    Note: be careful when using gl_FragCoord in shader code. This built-in variable gives you the "window relative" coordinate of the pixel being processed. But this is actually relative to the framebuffer size, and Phaser treats all framebuffers except the main canvas as being vertically flipped. This means that gl_FragCoord.y = 0 in a shader will be the bottom of a framebuffer, but the top of the canvas. This means gl_FragCoord gives different results when it's inside a framebuffer (like a Render Texture or Filter) compared to the main canvas. Be aware of this restriction when writing shaders.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    indexBuffer: WebGLBufferWrapper

    The index buffer defining vertex order.

    The manager that owns this RenderNode.

    name: string

    The name of the RenderNode.

    programManager: ProgramManager

    The program manager used to create and manage shader programs. This contains shader variants.

    vertexBufferLayout: WebGLVertexBufferLayoutWrapper

    The vertex buffer layout for this RenderNode.

    This consists of 4 bytes, 0-3, forming corners of a quad instance.

    Methods

    • By default this is an empty method hook that you can override and use in your own custom render nodes.

      This method is called at the start of the run method. Don't forget to call it in your custom method.

      Parameters

      Returns void

    • By default this is an empty method hook that you can override and use in your own custom render nodes.

      This method is called at the end of the run method. Don't forget to call it in your custom method.

      Parameters

      Returns void

    • Run the filter. It returns a drawing context containing the output texture.

      Parameters

      • controller: Controller

        The filter controller.

      • inputDrawingContext: DrawingContext

        The drawing context containing the input texture. This is either the initial render, or the output of the previous filter. This will be released during the run process, and can no longer be used.

      • OptionaloutputDrawingContext: DrawingContext

        The drawing context where the output texture will be drawn. If not specified, a new drawing context will be generated. Generally, this parameter is used for the last filter in a chain, so the output texture is drawn to the main framebuffer.

      • Optionalpadding: Geom.Rectangle

        The padding to add to the input texture to create the output texture. If not specified, the controller is used to get the padding. This should be undefined for internal filters, so the controller will expand textures as needed; and defined as the negative padding of the previous filter for external filters, so the texture will shrink to the correct size.

      Returns DrawingContext

    • Set whether the node should report debug information. It wraps the run method with additional debug information.

      Parameters

      • debug: boolean

        Whether to report debug information.

      Returns void