export declare type UBOType = 'float' | 'int' | 'bool' | 'boolean' | 'mat4' | 'mat3' | 'vec2' | 'vec3' | 'vec4'; export interface UBOItem { type: UBOType; offset?: number; alignment?: number; blockSize?: number; alignedByteLength?: number; data: ArrayBufferView | ArrayBuffer; } export declare class GLUniformBufferObject { private static TYPE_TO_SIZE; private gl; private items; /** * The draw type of the buffer * @member {gl.STATIC_DRAW|gl.DYNAMIC_DRAW|gl.STREAM_DRAW} */ private drawType; private type; private buffer; private _bindingPoint; private _byteLength; constructor(gl: WebGL2RenderingContext, bindPoint?: number, drawType?: number); /** * Add an item/property to the UBO * make sure that the order of the items is right */ addItem(name: string, type: UBOType, data?: ArrayBuffer | ArrayBufferView): void; /** * Add an block of items/properties to the UBO * make sure the order is the same as in the shader */ addBlock(items: Array<{ name: string; type: UBOType; data?: ArrayBuffer | ArrayBufferView; }>): void; /** * Update the item data * @param name - name of the item * @param data - new data * @param updateGL - */ updateItem(name: string, data: ArrayBuffer | ArrayBufferView, updateGL?: boolean): void; hasItem(name: string): boolean; removeItem(name: string): void; /** * Update the Buffer for a single item * @param name */ updateGL(name: string): void; /** * upload one buffer instead of adding multiple small items * @param data - the buffer containing all values * @param byteLength - the aligned componentTypeCount of the UBO */ uploadBuffer(byteLength: number, data?: ArrayBufferView | ArrayBuffer, length?: number): number; /** * Uploads all data to the gpu */ upload(): number; bindUBO(bindingPoint?: number, offset?: number, size?: number): void; private bind; private unbind; destroy(): void; private updateItemAlignment; bindingPoint: number; byteLength: number; }