UNPKG

wgsl-canvas

Version:

A TypeScript library for rendering WGSL shaders with WebGPU

38 lines (37 loc) 1.04 kB
import { WGSLCanvasOptions } from './types'; export declare class WGSLCanvas { private canvas; private context; private device; private adapter; private pipeline; private vertexBuffer; private uniformBuffer; private bindGroup; private uniforms; private textures; private animationId; private startTime; private time; private mouseX; private mouseY; private options; constructor(canvas?: HTMLCanvasElement | WGSLCanvasOptions, options?: WGSLCanvasOptions); private mergeOptions; private setupCanvas; private setupEventListeners; init(): Promise<void>; private setupVertexBuffer; load(fragment: string, vertex?: string): Promise<void>; private getDefaultVertexShader; private processFragmentShader; private createPipeline; private setupUniformBuffer; private updateUniforms; private render; play(): void; pause(): void; toggle(): void; resize(width?: number, height?: number): void; destroy(): void; }