Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BlitPass

This rendering pass blits the color attachment of a given rgba-framebuffer into the target buffer provided on frame. For rendering, a direct blit is used. However, if this is not supported, a textured, screen-aligned triangle is used for blitting as fallback.

The blit component can be used as follows:

this.blit.framebuffer = this.intermediateFBO;
this.blit.frame(this.defaultFBO, null, null);

This pass also provides some basic debugging facilities, such as blitting the input as linearized depth (packed or not packed) etc. An additional WebGL program will be initialized when a debug mode is specified for the first time. The default program blit remains untouched in order to keep it as minimal as possible.

Hierarchy

Index

Constructors

constructor

Properties

Protected _context

_context: Context

Read-only access to the objects context, used to get context information and WebGL API access.

Protected _debug

_debug: Debug = BlitPass.Debug.None
see

debug

Protected _debugProgram

_debugProgram: Program | undefined = undefined

Protected _drawBuffer

_drawBuffer: GLenum

Protected _far

_far: GLfloat = 0

Protected _framebuffer

_framebuffer: Framebuffer

Protected _ndcTriangle

_ndcTriangle: NdcFillingTriangle

Geometry used to draw on. This is not provided by default to allow for geometry sharing. If no triangle is given, the ndc triangle will be created and managed internally.

Protected _ndcTriangleShared

_ndcTriangleShared: boolean = false

Tracks ownership of the ndc-filling triangle.

Protected _near

_near: GLfloat = 0

If provided, depth will be linearized when depth data is blitted.

Protected _program

_program: Program

Protected _readBuffer

_readBuffer: GLenum

Protected _target

_target: Framebuffer
see

target

Protected _uDebugMode

_uDebugMode: WebGLUniformLocation | undefined

Uniform for passing the debug mode to the specialized blit program.

Protected _uLinearize

_uLinearize: WebGLUniformLocation | undefined

Uniform used to pass near and far data to the specialized blit program for linearization.

Accessors

debug

  • set debug(mode: Debug): void
  • Specify a debug mode for blitting @see {@link Blitpass.Debug}. If the debug mode is set to anything except Debug.None for the first time, a specialized debug program will be created, initialized, and used for blit.

    Parameters

    Returns void

drawBuffer

  • set drawBuffer(drawBuffer: GLenum): void
  • The draw buffer to blit to (currently, this is expected to refer to a texture attachment of this.target or gl.BACK). Please note that this will be ignored if WebGL 1 is used without a WEBGLdraw_buffer extension. Furthermore, if the drawBuffer is gl.BACK, a DefaultBuffer is expected as target.

    Parameters

    • drawBuffer: GLenum

      GLenum that specifies the draw buffer.

    Returns void

far

  • set far(far: GLfloat | undefined): void
  • Debug-feature: if linearized is enabled, depth buffer blitting will use this far value for linearization.

    Parameters

    • far: GLfloat | undefined

    Returns void

framebuffer

  • Sets the framebuffer that is to be blitted.

    Parameters

    • framebuffer: Framebuffer

      Framebuffer that is to be blitted.

    Returns void

initialized

  • get initialized(): boolean

near

  • set near(near: GLfloat | undefined): void
  • Debug-feature: if linearized is enabled, depth buffer blitting will use this near value for linearization.

    Parameters

    • near: GLfloat | undefined

    Returns void

readBuffer

  • set readBuffer(readBuffer: GLenum): void
  • The read buffer to blit from (currently, this is expected to refer to a texture attachment of this._framebuffer).

    Parameters

    • readBuffer: GLenum

      GLenum that is to be queried from the FBO.

    Returns void

target

  • Framebuffer to blit the given framebuffer (@see framebuffer} into.

    Parameters

    Returns void

Methods

Protected assertInitialized

  • assertInitialized(): void
  • Asserts the objects initialization status to be true. Note that the implementation is cached and forwarded to either an empty function when initialized and to an acutal assert(false) otherwise.

    Returns void

Protected assertUninitialized

  • assertUninitialized(): undefined
  • Asserts the objects initialization status to be false. Note that the implementation is cached and forwarded to either an empty function when uninitialized and to an acutal assert(false) otherwise.

    Returns undefined

frame

  • frame(): void
  • A blit frame either blits or draws the color attachment of the given framebuffer to the target framebuffer. For program based/indirect blit a viewport filling area, i.e., a screen-aligned triangle is used.

    Returns void

Private functionBlit

  • functionBlit(): void
  • Uses direct blit via glBlitFramebuffer for blitting a single read buffer into the given target's draw buffer.

    Returns void

initialize

  • Specializes this pass's initialization. This pass either requires blitFramebuffer support or creates screen- aligned triangle geometry and a single program. All attribute and dynamic uniform locations are cached.

    Parameters

    • Optional ndcTriangle: NdcFillingTriangle

      If specified, assumed to be used as shared geometry. If none is specified, a ndc-filling triangle will be created internally.

    Returns boolean

Private programBlit

  • programBlit(program: Program): void
  • Uses indirect blit by drawing a textured, screen-aligned triangle into the given target framebuffer.

    Parameters

    • program: Program

      The program the is used for blitting, either the minimal blit or debug blit.

    Returns void

uninitialize

  • uninitialize(): void
  • Specializes this pass's uninitialization. Program and geometry resources are released (if allocated). Cached uniform and attribute locations are invalidated.

    Returns void

Static Protected assertInitializedFalse

Static Protected assertUninitializedFalse

Static assert_initialized

Static assert_uninitialized

Static initialize

  • Method decorator for initialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be initialized, invokes its initialization with arbitrary number of parameters, and sets the initialization status to the initialization success (either false or true). In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to either a static, always-failing assert or an empty/undefined function.

    Returns MethodDecorator

Static uninitialize

  • Method decorator for uninitialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be uninitialized, invokes its uninitialization, and falsifies the initialization status. In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to a static, always-failing assert and an empty/undefined function respectively.

    Returns MethodDecorator