Engine API Reference - v2.6.1
    Preparing search index...

    Class VertexBuffer

    A vertex buffer is the mechanism via which the application specifies vertex data to the graphics hardware.

    Index

    Constructors

    • Create a new VertexBuffer instance.

      Parameters

      • graphicsDevice: GraphicsDevice

        The graphics device used to manage this vertex buffer.

      • format: VertexFormat

        The vertex format of this vertex buffer.

      • numVertices: number

        The number of vertices that this vertex buffer will hold.

      • Optionaloptions: { data?: ArrayBuffer; storage?: boolean; usage?: number }

        Object for passing optional arguments.

        • Optionaldata?: ArrayBuffer

          Initial data.

        • Optionalstorage?: boolean

          Defines if the vertex buffer can be used as a storage buffer by a compute shader. Defaults to false. Only supported on WebGPU.

        • Optionalusage?: number

          The usage type of the vertex buffer (see BUFFER_*). Defaults to BUFFER_STATIC.

      • ...args: any

      Returns VertexBuffer

    Methods

    • Returns the number of vertices stored in the specified vertex buffer.

      Returns number

      The number of vertices stored in the vertex buffer.

    • Returns the usage type of the specified vertex buffer. This indicates whether the buffer can be modified once and used many times BUFFER_STATIC, modified repeatedly and used many times BUFFER_DYNAMIC or modified once and used at most a few times BUFFER_STREAM.

      Returns number

      The usage type of the vertex buffer (see BUFFER_*).

    • Notifies the graphics engine that the client side copy of the vertex buffer's memory can be returned to the control of the graphics driver.

      Returns void