@lightningjs/renderer
    Preparing search index...

    Interface WebGlCoreRenderer

    Use import { WebGlRenderer } @lightningjs/renderer/webgl instead

    interface WebGlCoreRenderer {
        activeRttNode: null | CoreNode;
        clearColor: WebGlColor;
        curBufferIdx: number;
        curRenderOp: null | WebGlRenderOp;
        defaultShaderNode: null | WebGlShaderNode<Record<string, unknown>>;
        defaultTextureCoords: Bound;
        fQuadBuffer: Float32Array;
        glw: GlContextWrapper;
        mode: undefined | "canvas" | "webgl";
        numQuadsRendered: number;
        quadBuffer: ArrayBuffer;
        quadBufferCollection: BufferCollection;
        quadBufferUsage: number;
        renderOps: WebGlRenderOp[];
        renderToTextureActive: boolean;
        rttNodes: CoreNode[];
        stage: Stage;
        system: CoreWebGlSystem;
        uiQuadBuffer: Uint32Array;
        addQuad(node: CoreNode): void;
        addRenderOp(renderable: WebGlRenderOp): void;
        createCtxTexture(textureSource: Texture): CoreContextTexture;
        createShaderNode(
            shaderKey: string,
            shaderType: WebGlShaderType,
            props?: Record<string, unknown>,
            program?: WebGlShaderProgram,
        ): WebGlShaderNode<Record<string, unknown>>;
        createShaderProgram(
            shaderType: WebGlShaderType,
            props: Record<string, unknown>,
        ): WebGlShaderProgram;
        getBufferInfo(): null | BufferInfo;
        getDefaultShaderNode(): WebGlShaderNode;
        getQuadCount(): number;
        getTextureCoords(node: CoreNode): undefined | Bound;
        removeRTTNode(node: CoreNode): void;
        render(surface?: "screen" | CoreContextTexture): void;
        renderRTTNodes(): void;
        renderToTexture(node: CoreNode): void;
        reset(): void;
        reuseRenderOp(node: CoreNode): boolean;
        supportsShaderType(shaderType: Readonly<WebGlShaderType>): boolean;
        updateClearColor(color: number): void;
        updateViewport(): void;
    }

    Hierarchy

    • CoreRenderer
      • WebGlCoreRenderer
    Index

    Properties

    activeRttNode: null | CoreNode = null
    clearColor: WebGlColor = ...
    curBufferIdx: number = 0
    curRenderOp: null | WebGlRenderOp = null
    defaultShaderNode: null | WebGlShaderNode<Record<string, unknown>> = null
    defaultTextureCoords: Bound = ...
    fQuadBuffer: Float32Array
    glw: GlContextWrapper
    mode: undefined | "canvas" | "webgl"
    numQuadsRendered: number = 0
    quadBuffer: ArrayBuffer
    quadBufferCollection: BufferCollection
    quadBufferUsage: number = 0

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

    renderOps: WebGlRenderOp[] = []
    renderToTextureActive: boolean = false

    Whether the renderer is currently rendering to a texture.

    rttNodes: CoreNode[] = []
    stage: Stage
    system: CoreWebGlSystem
    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

      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

    • Sets the glClearColor to the specified color. *

      Parameters

      • color: number

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

      Returns void