@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
57 lines • 2.57 kB
TypeScript
import { TgdEvent } from "../event";
import { TgdProgram } from "../program";
import { WebglImage, WebglTexParameter } from "../types";
import { WebglTextureInternalFormat, WebglTextureParameters } from "../webgl";
interface TgdTexture2DStorage {
width: number;
height: number;
levels: number;
flipY: boolean;
internalFormat: "R8" | "R16F" | "R32F" | "R8UI" | "RG8" | "RG16F" | "RG32F" | "RG8UI" | "RGB8" | "SRGB8" | "RGB565" | "R11F_G11F_B10F" | "RGB9_E5" | "RGB16F" | "RGB32F" | "RGB8UI" | "RGBA8" | "SRGB8_ALPHA8" | "RGB5_A1" | "RGBA4" | "RGBA16F" | "RGBA32F" | "RGBA8UI" | "COMPRESSED_R11_EAC" | "COMPRESSED_SIGNED_R11_EAC" | "COMPRESSED_RG11_EAC" | "COMPRESSED_SIGNED_RG11_EAC" | "COMPRESSED_RGB8_ETC2" | "COMPRESSED_RGBA8_ETC2_EAC" | "COMPRESSED_SRGB8_ETC2" | "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC" | "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2" | "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
}
export declare class TgdTexture2D {
readonly name: string;
readonly gl: WebGL2RenderingContext;
readonly eventChange: TgdEvent<TgdTexture2D>;
private readonly _texture;
private _width;
private _height;
private readonly storage;
private static counter;
constructor(context: {
gl: WebGL2RenderingContext;
}, storage?: Partial<TgdTexture2DStorage>);
delete(): void;
get width(): number;
get height(): number;
resize(width: number, height: number): void;
get glTexture(): WebGLTexture;
bind(): void;
loadBitmap(bmp: WebglImage | null | Promise<WebglImage | null>, options?: {
level?: number;
}): this;
loadData(data: Uint8Array | Uint8ClampedArray, options: {
width: number;
height: number;
internalFormat: WebglTextureInternalFormat;
format: "RED" | "RG" | "RGB" | "RGBA" | "RED_INTEGER" | "RG_INTEGER" | "RGB_INTEGER" | "RGBA_INTEGER";
level?: number;
offset?: number;
}): this;
/**
*
* @param unit Unit to link the texture to
* @param program The program that owns the uniform to update
* @param uniformName The uniform that hold the texture
*/
activate(unit: number, program?: TgdProgram, uniformName?: string): this;
generateMipmap(): this;
setParams(parameters: WebglTextureParameters): this;
set textureBaseLevel(value: number);
get textureBaseLevel(): number;
set textureMaxLevel(value: number);
get textureMaxLevel(): number;
getParameter(parameter: WebglTexParameter): number | boolean | null;
}
export {};
//# sourceMappingURL=texture2d.d.ts.map