modern-canvas
Version:
A JavaScript WebGL rendering engine. only the ESM.
66 lines (65 loc) • 2.67 kB
TypeScript
import type { ClearOrBool } from './const';
import type { GlExtensions, GlRenderingContext, GlTarget } from './types';
import { Renderer } from '../shared';
import { GlBufferSystem } from './buffer';
import { GlGeometrySystem } from './geometry';
import { GlBatch2DSystem } from './GlBatch2DSystem';
import { GlColorMaskSystem } from './GlColorMaskSystem';
import { GlMaskSystem } from './GlMaskSystem';
import { GlScissorSystem } from './GlScissorSystem';
import { GlStencilSystem } from './GlStencilSystem';
import { GlViewportSystem } from './GlViewportSystem';
import { GlRenderTargetSystem } from './renderTarget';
import { GlShaderSystem } from './shader';
import { GlStateSystem } from './state';
import { GlTextureSystem } from './texture';
export interface GlRenderer {
texture: GlTextureSystem;
buffer: GlBufferSystem;
shader: GlShaderSystem;
geometry: GlGeometrySystem;
renderTarget: GlRenderTargetSystem;
state: GlStateSystem;
mask: GlMaskSystem;
colorMask: GlColorMaskSystem;
stencil: GlStencilSystem;
scissor: GlScissorSystem;
batch2D: GlBatch2DSystem;
viewport: GlViewportSystem;
}
export declare class GlRenderer extends Renderer {
contextLost: boolean;
gl: GlRenderingContext;
version: 1 | 2;
extensions: GlExtensions;
protected _systems: (GlShaderSystem | GlTextureSystem | GlGeometrySystem | GlBufferSystem | GlStateSystem | GlBatch2DSystem | GlColorMaskSystem | GlMaskSystem | GlRenderTargetSystem | GlScissorSystem | GlStencilSystem | GlViewportSystem)[];
readonly bindPoints: Map<number, GlTarget>;
readonly supports: {
uint32Indices: boolean;
uniformBufferObject: boolean;
vertexArrayObject: boolean;
srgbTextures: boolean;
nonPowOf2wrapping: boolean;
msaa: boolean;
nonPowOf2mipmaps: boolean;
};
constructor(view?: HTMLCanvasElement | WebGLRenderingContext | WebGL2RenderingContext, options?: WebGLContextAttributes);
protected _setupContext(view: HTMLCanvasElement, options?: WebGLContextAttributes): this;
protected _setupExtensions(): this;
protected _setupSupports(): this;
protected _setupBindPoints(): this;
/**
* Setup polyfill
*
* @protected
*/
protected _setupPolyfill(): this;
protected _contextLost(event: WebGLContextEvent): void;
protected _contextRestored(): void;
resize(width: number, height: number, updateStyle?: boolean): void;
clear(clear?: ClearOrBool): void;
reset(): void;
flush(): void;
destroy(): void;
toPixels(x?: number, y?: number, width?: number, height?: number): Uint8ClampedArray<ArrayBuffer>;
}