Options
All
  • Public
  • Public/Protected
  • All
Menu

System plugin to the renderer to manage the projection matrix.

The projectionMatrix is a global uniform provided to all shaders. It is used to transform points in world space to normalized device coordinates.

memberof

PIXI

Hierarchy

Index

Constructors

constructor

Properties

defaultFrame

defaultFrame: Rectangle

destinationFrame

destinationFrame: Rectangle

projectionMatrix

projectionMatrix: Matrix

renderer

renderer: Renderer

sourceFrame

sourceFrame: Rectangle

transform

transform: Matrix

Methods

calculateProjection

  • calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void
  • Calculates the projectionMatrix to map points inside sourceFrame to inside destinationFrame.

    Parameters

    • _destinationFrame: Rectangle
    • sourceFrame: Rectangle

      The source frame in world space.

    • _resolution: number
    • root: boolean

      Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection is y-flipped.

    Returns void

destroy

  • destroy(): void
  • Generic destroy methods to be overridden by the subclass

    Returns void

setTransform

  • setTransform(_matrix: Matrix): void
  • Sets the transform of the active render target to the given matrix

    Parameters

    Returns void

update

  • update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void
  • Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.

    NOTE: It is expected you call renderer.framebuffer.setViewport(destinationFrame) after this. This is because the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.

    NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected that you dirty the current bindings when calling this manually.

    Parameters

    • destinationFrame: Rectangle

      The rectangle in the render-target to render the contents into. If rendering to the canvas, the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.

    • sourceFrame: Rectangle

      The rectangle in world space that contains the contents being rendered.

    • resolution: number

      The resolution of the render-target, which is the ratio of world-space (or CSS) pixels to physical pixels.

    • root: boolean

      Whether the render-target is the screen. This is required because rendering to textures is y-flipped (i.e. upside down relative to the screen).

    Returns void

Generated using TypeDoc