import { VertexLayout } from '../VertexLayout'; import { Device } from '../Device'; import { BufferTypeOption, BufferUsageOption, DataTypeOption } from '../enums'; /** * Data type that is accepted by the `setData*` methods * * @public */ export declare type BufferDataOption = number[] | ArrayBuffer | ArrayBufferView; /** * Constructor options for {@link Buffer} * * @public */ export interface BufferOptions { /** * The buffer type e.b. `VertexBuffer` or `IndexBuffer` */ type?: BufferTypeOption; /** * The buffer usage. Defaults to `Static` */ usage?: BufferUsageOption; /** * The VertexBuffer layout. Usable only for vertex buffers */ layout?: VertexLayout; /** * The actual data to set on the buffer. */ data?: T; /** * The data type of a single element `data` * * @remarks * - For IndexBuffer defaults to `ushort` * - For VertexBuffer defaults to `float` */ dataType?: DataTypeOption; /** * Size in bytes of a single element in the buffer * * @remarks * - For VertexBuffer this is the size in bytes of a whole vertex. * - For IndexBuffer this is the size in bytes of a single index element. */ stride?: number; } /** * @public */ export declare abstract class Buffer { abstract readonly device: Device; protected $type: number; /** * The buffer type e.g. VertexBuffer or IndexBuffer */ get type(): number; protected $dataType: number; /** * The data element type */ get dataType(): number; protected $sizeInBytes: number; /** * The size of the data in bytes */ get sizeInBytes(): number; protected $usage: number; /** * */ get usage(): number; protected $stride: number; /** * Size in bytes of a single element in the buffer * * @remarks * - For VertexBuffer this is the size in bytes of a whole vertex. * - For IndexBuffer this is the size in bytes of a single index value. */ get stride(): number; protected $elementCount: number; /** * The total number of elements in this buffer * * @remarks * - For VertexBuffer this is the count of all vertices. * - For IndexBuffer this is the count of all indices. */ get elementCount(): number; protected $layout: VertexLayout; /** * */ get layout(): VertexLayout; /** * Translates and returns the current 'type' property to a readable name. * * @remarks * This property exists purely for debugging */ get typeName(): string; /** * Translates and returns the current 'usage' property to a readable name. * * @remarks * This property exists purely for debugging */ get usageName(): string; /** * Translates and returns the current 'dataType' property to a readable name. * * @remarks * This property exists purely for debugging */ get dataTypeName(): string; /** * Indicates whether this is an IndexBuffer */ get isIndexBuffer(): boolean; /** * Indicates whether this is a VertexBuffer */ get isVertexBuffer(): boolean; /** * */ init(opts: BufferOptions): this; abstract create(): this; abstract destroy(): this; abstract bind(): this; abstract setData(src: BufferDataOption, srcByteOffset?: number, srcByteLength?: number): this; abstract setSubData(byteOffset: number, src: BufferDataOption, srcByteOffset?: number, srcByteLength?: number): this; setDataElementOffset(data: BufferDataOption, srcElementOffset: number, srcElementCount: number): this; setSubDataElementOffset(elementOffset: number, src: BufferDataOption, srcElementOffset: number, srcElementCount: number): this; abstract getBufferSubData(srcByteOffset: number, dst: ArrayBufferView, dstOffset: number, dstLength: number): this; getData(): ArrayBufferView; protected convertDataOption(src: BufferDataOption): ArrayBufferView; } //# sourceMappingURL=Buffer.d.ts.map