@realsee/five
Version:
Realsee Renderer SDK
21 lines (20 loc) • 1.66 kB
TypeScript
export declare enum GL_TYPE {
BYTE = 5120,
UNSIGNED_BYTE = 5121,
SHORT = 5122,
UNSIGNED_SHORT = 5123,
INT = 5124,
UNSIGNED_INT = 5125,
FLOAT = 5126,
DOUBLE = 5130
}
export type AnyTypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
export type TypedArray<T extends GL_TYPE> = T extends GL_TYPE.DOUBLE ? Float64Array : T extends GL_TYPE.FLOAT ? Float32Array : T extends GL_TYPE.UNSIGNED_SHORT ? Uint16Array : T extends GL_TYPE.UNSIGNED_INT ? Uint32Array : T extends GL_TYPE.UNSIGNED_BYTE ? Uint8Array : T extends GL_TYPE.BYTE ? Int8Array : T extends GL_TYPE.SHORT ? Int16Array : T extends GL_TYPE.INT ? Int32Array : never;
export type TypedArrayConstructor<T extends GL_TYPE> = T extends GL_TYPE.DOUBLE ? typeof Float64Array : T extends GL_TYPE.FLOAT ? typeof Float32Array : T extends GL_TYPE.UNSIGNED_SHORT ? typeof Uint16Array : T extends GL_TYPE.UNSIGNED_INT ? typeof Uint32Array : T extends GL_TYPE.UNSIGNED_BYTE ? typeof Uint8Array : T extends GL_TYPE.BYTE ? typeof Int8Array : T extends GL_TYPE.SHORT ? typeof Int16Array : T extends GL_TYPE.INT ? typeof Int32Array : never;
export declare const GL_TYPE_TO_ARRAY_TYPE: {
[key in GL_TYPE]: TypedArrayConstructor<key>;
};
export declare function getArrayType<T extends GL_TYPE>(glType: T): TypedArrayConstructor<T>;
export declare function getByteSize(glType: number): number;
export declare function createTypedArray<T extends GL_TYPE>(glType: T, buffer: ArrayBuffer, byteOffset?: number, length?: number): TypedArray<T>;
export declare function glTypeFromName(name: string): GL_TYPE;