phaser - v4.0.0-rc.4
    Preparing search index...

    This render node draws triangles with vertex color in batches.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    batchEntries: WebGLBatchEntry[]

    The entries in the batch. Each entry represents a "sub-batch" of quads which use the same pool of textures. This allows the renderer to continue to buffer quads into the same batch without needing to upload the vertex buffer. When the batch flushes, there will be one vertex buffer upload, and one draw call per batch entry.

    bytesPerIndexPerInstance: number

    The number of bytes per index per instance. This is used to advance the index buffer, and accounts for the size of a Uint16Array element.

    bytesPerInstance: number

    The number of bytes per instance, used to determine how much of the vertex buffer to upload.

    currentBatchEntry: WebGLBatchEntry

    The current batch entry being filled with textures.

    floatsPerInstance: number

    The number of floats per instance, used to determine how much of the vertex buffer to update.

    indexBuffer: WebGLBufferWrapper

    The index buffer defining vertex order.

    indicesPerInstance: number

    The number of indices per instance. This is usually 6 for a quad. Each index corresponds to a vertex in the vertex buffer.

    instanceCount: number

    The number of instances currently in the batch.

    instancesPerBatch: number

    The number of instances per batch, used to determine the size of the vertex buffer, and the number of instances to render.

    This is usually limited by the maximum number of vertices that can be distinguished with a 16-bit UNSIGNED_INT index buffer, which is 65536. This is set in the game render config as batchSize.

    The manager that owns this RenderNode.

    maxTexturesPerBatch: number

    The maximum number of textures per batch entry. This is usually set to the maximum number of texture units available, but it might be smaller for some uses.

    name: string

    The name of the RenderNode.

    nextRenderOptions: object

    The render options currently being built.

    programManager: ProgramManager

    The program manager used to create and manage shader programs. This contains shader variants.

    renderOptions: object

    The current render options to which the batch is built. These help define the shader.

    vertexBufferLayout: WebGLVertexBufferLayoutWrapper

    The layout, data, and vertex buffer used to store the vertex data.

    The default layout is for a quad with position, texture coordinate, texture ID, tint effect, and tint color on each vertex.

    vertexCount: number

    The number of vertices currently in the batch.

    verticesPerInstance: number

    The number of vertices per instance.

    This is usually 4 for a quad.

    Each vertex corresponds to an index in the element buffer.

    Methods

    • Add data to the batch.

      The data is composed of vertices and indexed triangles. Each triangle is defined by three indices into the vertices array.

      Parameters

      • currentContext: DrawingContext

        The current drawing context.

      • indexes: number[]

        The index data. Each triangle is defined by three indices into the vertices array, so the length of this should be a multiple of 3.

      • vertices: number[]

        The vertices data. Each vertex is defined by an x-coordinate and a y-coordinate.

      • colors: number[]

        The color data. Each vertex has a color as a Uint32 value.

      • Optionallighting: boolean

        Should this batch use lighting? Default false.

      Returns void

    • By default this is an empty method hook that you can override and use in your own custom render nodes.

      This method is called at the start of the run method. Don't forget to call it in your custom method.

      Parameters

      Returns void

    • By default this is an empty method hook that you can override and use in your own custom render nodes.

      This method is called at the end of the run method. Don't forget to call it in your custom method.

      Parameters

      Returns void

    • Set new dimensions for the renderer. This should be overridden by subclasses.

      This is called automatically when the renderer is resized.

      Parameters

      • width: number

        The new width of the renderer.

      • height: number

        The new height of the renderer.

      Returns void

    • Draw then empty the current batch.

      This method is called automatically, by either this node or the manager, when the batch is full, or when something else needs to be rendered.

      Parameters

      Returns void

    • Set whether the node should report debug information. It wraps the run method with additional debug information.

      Parameters

      • debug: boolean

        Whether to report debug information.

      Returns void

    • Update the uniforms for the current shader program.

      This method is called automatically when the batch is run.

      Parameters

      Returns void

    • Update the number of draw calls per batch. This should be overridden by subclasses.

      This is called automatically by a listener for the Phaser.Renderer.Events.SET_PARALLEL_TEXTURE_UNITS event, triggered by the RenderNodeManager.

      Parameters

      • Optionalcount: number

        The new number of draw calls per batch. If undefined, the maximum number of texture units is used.

      Returns void