@thi.ng/webgl
Version:
WebGL & GLSL abstraction layer
64 lines • 2.76 kB
TypeScript
import type { Nullable } from "@thi.ng/api";
import { TextureFilter, TextureFormat, TextureRepeat, TextureTarget, TextureType, type ITexture, type TextureOpts } from "./api/texture.js";
export declare const bindTextures: (textures?: ITexture[]) => void;
export declare const unbindTextures: (textures?: ITexture[]) => void;
export declare class Texture implements ITexture {
gl: WebGLRenderingContext;
tex: WebGLTexture;
target: TextureTarget;
format: TextureFormat;
filter: TextureFilter[];
wrap: TextureRepeat[];
type: TextureType;
size: number[];
constructor(gl: WebGLRenderingContext, opts?: Partial<TextureOpts>);
configure(opts?: Partial<TextureOpts>, unbind?: boolean): boolean;
protected configureImage(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureImage2d(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureImage3d(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureFilter(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureWrap(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureLOD(target: TextureTarget, opts: Partial<TextureOpts>): void;
protected configureLevels(target: TextureTarget, opts: Partial<TextureOpts>): void;
bind(id?: number): boolean;
unbind(id?: number): boolean;
release(): boolean;
}
export declare const defTexture: (gl: WebGLRenderingContext, opts?: Partial<TextureOpts>) => Texture;
/**
* Creates cube map texture from given 6 `face` texture sources. The
* given options are shared by each each side/face of the cube map. The
* following options are applied to the cube map directly:
*
* - `filter`
* - `mipmap`
*
* The following options are ignored entirely:
*
* - `target`
* - `image`
*
* @param gl -
* @param faces - in order: +x,-x,+y,-y,+z,-z
* @param opts -
*/
export declare const defTextureCubeMap: (gl: WebGLRenderingContext, faces: (ArrayBufferView | TexImageSource)[], opts?: Partial<TextureOpts>) => Texture;
/**
* Creates & configure a new float texture.
*
* **Important:** Since each texel will hold 4x 32-bit float values, the
* `data` buffer needs to have a length of at least `4 * width *
* height`.
*
* Under WebGL 1.0, we assume the caller has previously enabled the
* `OES_texture_float` extension.
*
* @param gl - GL context
* @param data - texture data
* @param width - width
* @param height - height
* @param format -
* @param type -
*/
export declare const defTextureFloat: (gl: WebGLRenderingContext, data: Nullable<Float32Array>, width: number, height: number, format?: TextureFormat, type?: TextureType) => Texture;
//# sourceMappingURL=texture.d.ts.map