VertexBuffer

Hierarchy

  • VertexBuffer

Index

Constructors

constructor

  • 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): VertexBuffer
  • Constructor

    Parameters

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

    Returns VertexBuffer

Properties

byteOffset

byteOffset: number

Gets the byte offset.

byteStride

byteStride: number

Gets the byte stride.

instanceDivisor

instanceDivisor: number

Gets or sets the instance divisor when in instanced mode

normalized

normalized: boolean

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

type

type: number

Gets the data type of each component in the array.

Static BYTE

BYTE: number

The byte type.

Static ColorKind

ColorKind: string

Static FLOAT

FLOAT: number

The float type.

Static INT

INT: number

The integer type.

Static MatricesIndicesExtraKind

MatricesIndicesExtraKind: string

Static MatricesIndicesKind

MatricesIndicesKind: string

Static MatricesWeightsExtraKind

MatricesWeightsExtraKind: string

Static MatricesWeightsKind

MatricesWeightsKind: string

Static NormalKind

NormalKind: string

Static PositionKind

PositionKind: string

Static SHORT

SHORT: number

The short type.

Static TangentKind

TangentKind: string

Static UNSIGNED_BYTE

UNSIGNED_BYTE: number

The unsigned byte type.

Static UNSIGNED_INT

UNSIGNED_INT: number

The unsigned integer type.

Static UNSIGNED_SHORT

UNSIGNED_SHORT: number

The unsigned short type.

Static UV2Kind

UV2Kind: string

Static UV3Kind

UV3Kind: string

Static UV4Kind

UV4Kind: string

Static UV5Kind

UV5Kind: string

Static UV6Kind

UV6Kind: string

Static UVKind

UVKind: string

Methods

create

  • Creates the underlying WebGLBuffer from the passed numeric array or Float32Array. Returns the created WebGLBuffer.

    Parameters

    Returns void

dispose

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

    Returns void

forEach

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

    Parameters

    • count: number

      the number of values to enumerate

    • callback: function

      the callback function called for each value

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

          • value: number
          • index: number

          Returns void

    Returns void

getBuffer

  • Returns the WebGLBuffer associated to the VertexBuffer.

    Returns Nullable<WebGLBuffer>

getData

  • Returns an array of numbers or a typed array containing the VertexBuffer data.

    Returns Nullable<DataArray>

getInstanceDivisor

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

    Returns number

getIsInstanced

  • getIsInstanced(): boolean
  • Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?

    Returns boolean

getKind

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

    Returns string

getOffset

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

    Returns number

getSize

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

    Returns number

getStrideSize

  • getStrideSize(): number
  • Returns the stride as a multiple of the type byte length. DEPRECATED. Use byteStride instead.

    Returns number

isUpdatable

  • isUpdatable(): boolean
  • Boolean : is the VertexBuffer updatable ?

    Returns boolean

update

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

    Parameters

    Returns void

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.

    Parameters

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

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

    Parameters

    • kind: string

      The kind string to deduce

    Returns number

    The deduced stride

Static ForEach

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

    Parameters

    • 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 total number of components

    • normalized: boolean

      whether the data is normalized

    • callback: function

      the callback function called for each value

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

          • value: number
          • index: number

          Returns void

    Returns void

Static GetTypeByteLength

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

    Parameters

    • type: number

      the type

    Returns number

    the number of bytes

Generated using TypeDoc