Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Framebuffer

Hierarchy

  • Framebuffer

Index

Constructors

constructor

  • new Framebuffer(gl: WebGLRenderingContext, width: number, height: number, withDepth: boolean, glVersion: number): Framebuffer
  • Parameters

    • gl: WebGLRenderingContext
    • width: number
    • height: number
    • withDepth: boolean
    • glVersion: number

    Returns Framebuffer

Properties

depthTexture

depthTexture: WebGLTexture

framebuffer

framebuffer: WebGLFramebuffer

height

height: number

isReady

isReady: boolean = true

renderbuffer

renderbuffer: WebGLRenderbuffer

texture

texture: WebGLTexture

width

width: number

Methods

bind

  • bind(): void

delete

  • delete(): void

get2DCanvas

  • get2DCanvas(): HTMLCanvasElement

getDepth

  • getDepth(x: number, y: number): number

getDepths

  • getDepths(points: { x: number; y: number }[]): number[]
  • Parameters

    • points: { x: number; y: number }[]

    Returns number[]

getId

  • getId(x: number, y: number): number

getIds

  • getIds(points: { x: number; y: number }[]): number[]
  • Parameters

    • points: { x: number; y: number }[]

    Returns number[]

getImageDataArray

  • getImageDataArray(): Uint8ClampedArray

getImageDataBlob

  • getImageDataBlob(callback: (blob: Blob) => void, type?: "png" | "jpeg"): void
  • Gets current image data as a BLOB. Use callback to handle data.

    Parameters

    • callback: (blob: Blob) => void

      Use callback to handle Blob

        • (blob: Blob): void
        • Parameters

          • blob: Blob

          Returns void

    • Default value type: "png" | "jpeg" = "png"

    Returns void

getImageDataUrl

  • getImageDataUrl(type?: "png" | "jpeg"): string
  • Gets current image data from the framebuffer as Base64 string

    Parameters

    • Default value type: "png" | "jpeg" = "png"

    Returns string

getPixel

  • getPixel(x: number, y: number): Uint8Array
  • Returns one pixel at defined position

    Parameters

    • x: number
    • y: number

    Returns Uint8Array

getXYZ

  • getXYZ(x: number, y: number): vec3
  • Computes normalised X, Y, Z of event in the clip space

    Parameters

    • x: number

      X coordinate of the event

    • y: number

      Y coordinate of the event

    Returns vec3

getXYZArray

  • getXYZArray(points: { x: number; y: number }[]): vec3[]
  • Parameters

    • points: { x: number; y: number }[]

    Returns vec3[]

getXYZRange

  • getXYZRange(x: number, y: number): { far: vec3; middle: vec3; near: vec3 }
  • Computes normalised X, Y, Z of event in the clip space with near and far bounds, This can be used to refine near and far clipping planes for more precise evaluation in the second pass.

    Parameters

    • x: number

      X coordinate of the event

    • y: number

      Y coordinate of the event

    Returns { far: vec3; middle: vec3; near: vec3 }

    • far: vec3
    • middle: vec3
    • near: vec3

Generated using TypeDoc