Hierarchy

  • CoreRenderer
    • WebGlCoreRenderer

Constructors

Properties

activeRttNode: null | CoreNode = null
clearColor: WebGlColor = ...
curBufferIdx: number = 0
curRenderOp: null | WebGlCoreRenderOp = null
defaultShader: WebGlCoreShader
defaultTexture: Texture

White pixel texture used by default when no texture is specified.

defShaderCtrl: BaseShaderController
fQuadBuffer: Float32Array
glw: WebGlContextWrapper
mode: undefined | "canvas" | "webgl"
options: CoreRendererOptions
quadBuffer: ArrayBuffer
quadBufferCollection: BufferCollection
quadBufferUsage: number = 0
renderOps: WebGlCoreRenderOp[] = []
renderToTextureActive: boolean = false

Whether the renderer is currently rendering to a texture.

rttNodes: CoreNode[] = []
shManager: CoreShaderManager
stage: Stage
system: CoreWebGlSystem
txMemManager: TextureMemoryManager
uiQuadBuffer: Uint32Array

Methods

  • This function adds a quad (a rectangle composed of two triangles) to the WebGL rendering pipeline.

    It takes a set of options that define the quad's properties, such as its dimensions, colors, texture, shader, and transformation matrix. The function first updates the shader properties with the current dimensions if necessary, then sets the default texture if none is provided. It then checks if a new render operation is needed, based on the current shader and clipping rectangle. If a new render operation is needed, it creates one and updates the current render operation. The function then adjusts the texture coordinates based on the texture options and adds the texture to the texture manager.

    Finally, it calculates the vertices for the quad, taking into account any transformations, and adds them to the quad buffer. The function updates the length and number of quads in the current render operation, and updates the current buffer index.

    Parameters

    • params: QuadOptions

    Returns void

  • Render the current set of RenderOps to render to the specified surface.

    TODO: 'screen' is the only supported surface at the moment.

    Parameters

    • surface: "screen" | CoreContextTexture = 'screen'

    Returns void

  • Updates the WebGL context's clear color and clears the color buffer.

    Parameters

    • color: number

      The color to set as the clear color, represented as a 32-bit integer.

    Returns void