Class Viewport

Viewport determines to which RenderTarget should rendering be performed. It allows you to render to a sub-region of the target by specifying the area rectangle, and allows you to set up color/depth/stencil clear values for that specific region.

Hierarchy

  • FrameworkObject
    • Viewport

Constructors

  • Creates a new viewport.

    Parameters

    • target: RenderTarget
    • Optionalx: number
    • Optionaly: number
    • Optionalwidth: number
    • Optionalheight: number
    • OptionalisVerticalFlipRequired: boolean
    • OptionalisInternalConstructor: boolean

    Returns Viewport

    Viewport coordinates are normalized in [0, 1] range.

Accessors

  • get clearDepth(): number
  • Determines the value to clear the depth buffer to before rendering, if depth clear is enabled.

    Returns number

  • set clearDepth(value): void
  • Parameters

    • value: number

    Returns void

  • get clearStencil(): number
  • Determines the value to clear the stencil buffer to before rendering, if stencil clear is enabled.

    Returns number

  • set clearStencil(value): void
  • Parameters

    • value: number

    Returns void

  • set isIsVerticalFlipRequired(value): void
  • Determines if the viewport image should be flipped on the Y axis after rendering.

    Parameters

    • value: boolean

    Returns void

  • get isVerticalFlipRequired(): boolean
  • Determines if the viewport image should be flipped on the Y axis after rendering.

    Returns boolean

Methods

  • Notifies the Viewport that the render target changed to recompute dependencies such as aspect ratio and area.

    Returns void

  • Calculates the area of the viewport based on the available area in pixels (width and height ), as well as the provided aspect ratio.

    Parameters

    • width: number
    • height: number
    • aspectRatio: number

    Returns Rect2