• Public
  • Public/Protected
  • All

Class VertexBuffer

Specialized buffer used to store vertex data


  • VertexBuffer




  • new VertexBuffer(engine: any, data: DataArray | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number, type?: number, normalized?: boolean, useBytes?: boolean, divisor?: number, takeBufferOwnership?: boolean): VertexBuffer
  • Constructor


    • engine: any

      the engine

    • data: DataArray | Buffer

      the data to use for this vertex buffer

    • kind: string

      the vertex buffer kind

    • updatable: boolean

      whether the data is updatable

    • Optional postponeInternalCreation: boolean

      whether to postpone creating the internal WebGL buffer (optional)

    • Optional stride: number

      the stride (optional)

    • Optional instanced: boolean

      whether the buffer is instanced (optional)

    • Optional offset: number

      the offset of the data (optional)

    • Optional size: number

      the number of components (optional)

    • Optional type: number

      the type of the component (optional)

    • Optional normalized: boolean

      whether the data contains normalized data (optional)

    • Optional useBytes: boolean

      set to true if stride and offset are in bytes (optional)

    • Optional divisor: number

      defines the instance divisor to use (1 by default)

    • Optional takeBufferOwnership: boolean

      defines if the buffer should be released when the vertex buffer is disposed

    Returns VertexBuffer


Readonly byteOffsetSearch playground for byteOffset

byteOffset: number

Gets the byte offset.

Readonly byteStrideSearch playground for byteStride

byteStride: number

Gets the byte stride.

Readonly normalizedSearch playground for normalized

normalized: boolean

Gets whether integer data values should be normalized into a certain range when being casted to a float.

Readonly typeSearch playground for type

type: number

Gets the data type of each component in the array.

Static Readonly BYTESearch playground for BYTE

BYTE: number

The byte type.

Static Readonly ColorKindSearch playground for ColorKind

ColorKind: string


Static Readonly FLOATSearch playground for FLOAT

FLOAT: number

The float type.

Static Readonly INTSearch playground for INT

INT: number

The integer type.

Static Readonly MatricesIndicesExtraKindSearch playground for MatricesIndicesExtraKind

MatricesIndicesExtraKind: string

Additional matrix indices (for bones)

Static Readonly MatricesIndicesKindSearch playground for MatricesIndicesKind

MatricesIndicesKind: string

Matrix indices (for bones)

Static Readonly MatricesWeightsExtraKindSearch playground for MatricesWeightsExtraKind

MatricesWeightsExtraKind: string

Additional matrix weights (for bones)

Static Readonly MatricesWeightsKindSearch playground for MatricesWeightsKind

MatricesWeightsKind: string

Matrix weights (for bones)

Static Readonly NormalKindSearch playground for NormalKind

NormalKind: string


Static Readonly PositionKindSearch playground for PositionKind

PositionKind: string


Static Readonly SHORTSearch playground for SHORT

SHORT: number

The short type.

Static Readonly TangentKindSearch playground for TangentKind

TangentKind: string


Static Readonly UNSIGNED_BYTESearch playground for UNSIGNED_BYTE


The unsigned byte type.

Static Readonly UNSIGNED_INTSearch playground for UNSIGNED_INT


The unsigned integer type.

Static Readonly UNSIGNED_SHORTSearch playground for UNSIGNED_SHORT


The unsigned short type.

Static Readonly UV2KindSearch playground for UV2Kind

UV2Kind: string

Texture coordinates 2

Static Readonly UV3KindSearch playground for UV3Kind

UV3Kind: string

Texture coordinates 3

Static Readonly UV4KindSearch playground for UV4Kind

UV4Kind: string

Texture coordinates 4

Static Readonly UV5KindSearch playground for UV5Kind

UV5Kind: string

Texture coordinates 5

Static Readonly UV6KindSearch playground for UV6Kind

UV6Kind: string

Texture coordinates 6

Static Readonly UVKindSearch playground for UVKind

UVKind: string

Texture coordinates



  • get instanceDivisor(): number
  • set instanceDivisor(value: number): any
  • Gets or sets the instance divisor when in instanced mode

    Returns number

  • Gets or sets the instance divisor when in instanced mode


    • value: number

    Returns any


createSearch playground for create

  • Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property


    • Optional data: DataArray

      defines the data to store

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Disposes the VertexBuffer and the underlying WebGLBuffer.

    Returns void

forEachSearch playground for forEach

  • forEach(count: number, callback: (value: number, index: number) => void): void
  • Enumerates each value of this vertex buffer as numbers.


    • count: number

      the number of values to enumerate

    • callback: (value: number, index: number) => void

      the callback function called for each value

        • (value: number, index: number): void
        • Parameters

          • value: number
          • index: number

          Returns void

    Returns void

getBufferSearch playground for getBuffer

  • Gets underlying native buffer

    Returns Nullable<DataBuffer>

    underlying native buffer

getDataSearch playground for getData

  • Gets current buffer's data

    Returns Nullable<DataArray>

    a DataArray or null

getInstanceDivisorSearch playground for getInstanceDivisor

  • getInstanceDivisor(): number
  • Returns the instancing divisor, zero for non-instanced (integer).

    Returns number

    a number

getIsInstancedSearch playground for getIsInstanced

  • getIsInstanced(): boolean
  • Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced

    Returns boolean

    true if this buffer is instanced

getKindSearch playground for getKind

  • getKind(): string
  • Returns the kind of the VertexBuffer (string)

    Returns string

    a string

getOffsetSearch playground for getOffset

  • getOffset(): number
  • Returns the offset as a multiple of the type byte length.


    Please use byteOffset instead.

    Returns number

    the offset in bytes

getSizeSearch playground for getSize

  • getSize(): number
  • Returns the number of components per vertex attribute (integer)

    Returns number

    the size in float

getStrideSizeSearch playground for getStrideSize

  • getStrideSize(): number
  • Gets the stride in float32 units (i.e. byte stride / 4). May not be an integer if the byte stride is not divisible by 4.


    Please use byteStride instead.

    Returns number

    the stride in float32 units

isUpdatableSearch playground for isUpdatable

  • isUpdatable(): boolean
  • Gets a boolean indicating if the VertexBuffer is updatable?

    Returns boolean

    true if the buffer is updatable

updateSearch playground for update

  • Updates the underlying buffer according to the passed numeric array or Float32Array. This function will create a new buffer if the current one is not updatable


    Returns void

updateDirectlySearch playground for updateDirectly

  • updateDirectly(data: DataArray, offset: number, useBytes?: boolean): void
  • Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array. Returns the directly updated WebGLBuffer.


    • data: DataArray

      the new data

    • offset: number

      the new offset

    • Optional useBytes: boolean

      set to true if the offset is in bytes

    Returns void

Static DeduceStrideSearch playground for DeduceStride

  • DeduceStride(kind: string): number
  • Deduces the stride given a kind.


    • kind: string

      The kind string to deduce

    Returns number

    The deduced stride

Static ForEachSearch playground for ForEach

  • ForEach(data: DataArray, byteOffset: number, byteStride: number, componentCount: number, componentType: number, count: number, normalized: boolean, callback: (value: number, index: number) => void): void
  • Enumerates each value of the given parameters as numbers.


    • data: DataArray

      the data to enumerate

    • byteOffset: number

      the byte offset of the data

    • byteStride: number

      the byte stride of the data

    • componentCount: number

      the number of components per element

    • componentType: number

      the type of the component

    • count: number

      the number of values to enumerate

    • normalized: boolean

      whether the data is normalized

    • callback: (value: number, index: number) => void

      the callback function called for each value

        • (value: number, index: number): void
        • Parameters

          • value: number
          • index: number

          Returns void

    Returns void

Static GetTypeByteLengthSearch playground for GetTypeByteLength

  • GetTypeByteLength(type: number): number
  • Gets the byte length of the given type.


    • type: number

      the type

    Returns number

    the number of bytes


  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method