A helper class that generates ranges of dummy data for buffer or texture operations efficiently. Tries to minimize allocations and data updates.

Hierarchy

  • DataArrayGenerator

Constructors

Methods

  • Returns a copy of the generated data. Note that this still changes the underlying buffer, so any previously generated views will still be overwritten, but the returned copy won't reflect future generate* calls.

    Parameters

    • byteSize: number

      Number of bytes the returned array should contain.

    • Optional start: number = 0

      The value of the first element generated in the view.

    • Optional offset: number = 0

      Offset of the generated data within the view. Preceeding values will be 0.

    Returns Uint8Array

    A new Uint8Array copy of the generated data.

  • Returns a new view into the generated data that's the correct length. Because this is a view previously returned views from the same generator will have their values overwritten as well.

    Parameters

    • byteSize: number

      Number of bytes the returned view should contain.

    • Optional start: number = 0

      The value of the first element generated in the view.

    • Optional offset: number = 0

      Offset of the generated data within the view. Preceeding values will be 0.

    Returns Uint8Array

    A new Uint8Array view into the generated data.

Generated using TypeDoc