Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to store data that will be store in GPU memory

Hierarchy

  • Buffer

Index

Constructors

  • new Buffer(engine: ThinEngine, data: DataArray | DataBuffer, updatable: boolean, stride?: number, postponeInternalCreation?: boolean, instanced?: boolean, useBytes?: boolean, divisor?: number, label?: string): Buffer
  • Constructor

    Parameters

    • engine: ThinEngine

      the engine

    • data: DataArray | DataBuffer

      the data to use for this buffer

    • updatable: boolean

      whether the data is updatable

    • Optional stride: number

      the stride (optional)

    • Optional postponeInternalCreation: boolean

      whether to postpone creating the internal WebGL buffer (optional)

    • Optional instanced: boolean

      whether the buffer is instanced (optional)

    • Optional useBytes: boolean

      set to true if the stride in in bytes (optional)

    • Optional divisor: number

      sets an optional divisor for instances (1 by default)

    • Optional label: string

      defines the label of the buffer (for debug purpose)

    Returns Buffer

Properties

byteStride: number

Gets the byte stride.

Accessors

  • get isDisposed(): boolean
  • Gets a boolean indicating if the Buffer is disposed

    Returns boolean

Methods

  • Store data into the buffer. Creates the buffer if not used already. If the buffer was already used, it will be updated only if it is updatable, otherwise it will do nothing.

    Parameters

    Returns void

  • createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean, useBytes?: boolean, divisor?: number): VertexBuffer
  • Create a new VertexBuffer based on the current buffer

    Parameters

    • kind: string

      defines the vertex buffer kind (position, normal, etc.)

    • offset: number

      defines offset in the buffer (0 by default)

    • size: number

      defines the size in floats of attributes (position is 3 for instance)

    • Optional stride: number

      defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)

    • Optional instanced: boolean

      defines if the vertex buffer contains indexed data

    • Optional useBytes: boolean

      defines if the offset and stride are in bytes *

    • Optional divisor: number

      sets an optional divisor for instances (1 by default)

    Returns VertexBuffer

    the new vertex buffer

  • dispose(): void
  • Release all resources

    Returns void

  • Gets underlying native buffer

    Returns Nullable<DataBuffer>

    underlying native buffer

  • Gets current buffer's data

    Returns Nullable<DataArray>

    a DataArray or null

  • 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.

    deprecated

    Please use byteStride instead.

    Returns number

    the stride in float32 units

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

    Returns boolean

    true if the buffer is updatable

  • Update current buffer data

    Parameters

    Returns void

  • updateDirectly(data: DataArray, offset: number, vertexCount?: number, useBytes?: boolean): void
  • Updates the data directly.

    Parameters

    • data: DataArray

      the new data

    • offset: number

      the new offset

    • Optional vertexCount: number

      the vertex count (optional)

    • Optional useBytes: boolean

      set to true if the offset is in bytes

    Returns void

Legend

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

Settings

Theme