rapid-render
    Preparing search index...

    Class DynamicArrayBuffer

    A dynamic array buffer that can grow in size automatically when elements are added. It allocates an ArrayBuffer and provides typed array views to manipulate the data.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    bytePerElem: number

    The number of bytes per element based on the ArrayType.

    float32?: Float32Array<ArrayBufferLike>

    Float32Array view of the underlying memory buffer.

    maxElemNum: number

    The maximum number of elements the buffer can currently hold without resizing.

    typedArray:
        | Float32Array<ArrayBufferLike>
        | Uint32Array<ArrayBufferLike>
        | Uint16Array<ArrayBufferLike>

    The main typed array view corresponding to the specified ArrayType.

    uint16?: Uint16Array<ArrayBufferLike>

    Uint16Array view of the underlying memory buffer.

    uint32?: Uint32Array<ArrayBufferLike>

    Uint32Array view of the underlying memory buffer.

    usedElemNum: number

    The number of elements currently used in the buffer.

    Accessors

    • get length(): number

      The number of elements currently stored in the buffer.

      Returns number

    Methods

    • Resets the element usage count to zero. The underlying memory capacity is preserved.

      Returns void

    • Gets the value of the element at the specified index.

      Parameters

      • index: number

        The index of the element to retrieve.

      Returns number

      The requested element.

    • Returns a constrained view of the primary typed array up to the specified range. If end is omitted, returns the whole reallocated buffer slice.

      Parameters

      • begin: number = 0

        The starting index (inclusive). Defaults to 0.

      • Optionalend: number

        The ending index (exclusive). Optional.

      Returns
          | Float32Array<ArrayBufferLike>
          | Uint32Array<ArrayBufferLike>
          | Uint16Array<ArrayBufferLike>

      A subarray corresponding to the specified range.

    • Returns the typed array constructor for the corresponding ArrayType.

      Parameters

      Returns TypedArrayConstructor

      The typed array constructor.

      Dispatches an error if the specified type is unsupported.

    • Removes and returns the last element in the buffer.

      Returns number

      The removed element or undefined if the buffer is empty.

    • Appends an element to the buffer, using the primary typed array view.

      Parameters

      • value: number

        The item to add.

      Returns void

    • Appends a new 32-bit floating point element to the buffer.

      Parameters

      • value: number

        The item to add.

      Returns void

    • Appends a new 32-bit unsigned integer element to the buffer.

      Parameters

      • value: number

        The item to add.

      Returns void

    • Resets the buffer's used element count, effectively emptying it. Same behavior as clear.

      Returns void

    • Checks if the buffer has enough space for additional elements and resizes the buffer if necessary.

      Parameters

      • size: number = 0

        The number of new elements that need to be accommodated.

      Returns boolean

      true if the buffer was resized, false otherwise.

    • Reallocates the underlying array buffer to a new size and copies existing data.

      Parameters

      • size: number = ...

        The new maximum number of elements.

      Returns void

    • Returns the last element pushed to the buffer without removing it.

      Returns number

      The last element.

    • Updates the typed array views when the internal array buffer gets reallocated.

      Returns void