UNPKG

pex-context

Version:

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.

78 lines (77 loc) 2.08 kB
export function addEnums(ctx: any): void; export type PexContextOptions = { gl?: WebGLRenderingContext | WebGL2RenderingContext; width?: number; height?: number; pixelRatio?: number; type?: "webgl" | "webgl2"; debug?: boolean; }; /** * All resources are plain js object and once constructed their properties can be accessed directly. * Please note those props are read only. To set new values or upload new data to GPU see [updating resources]{@link ctx.update}. */ export type PexResource = { name: string; }; export type PexTexture2D = object; export type PexAttribute = { /** * ctx.vertexBuffer() or ctx.indexBuffer() */ buffer: object; offset?: number; stride?: number; divisor?: number; normalized?: boolean; }; export type PexCommand = { pass: import("./pass.js").PassOptions; pipeline: import("./pipeline.js").PipelineOptions; /** * vertex attributes, map of `attributeName: ctx.vertexBuffer()` or [`attributeName: PexAttribute`]{@link PexAttribute} */ attributes?: object; /** * indices, `ctx.indexBuffer()` or [`PexAttribute`]{@link PexAttribute} */ indices?: object; /** * number of vertices to draw */ count?: number; /** * number instances to draw */ instances?: number; /** * shader uniforms, map of `name: value` */ uniforms?: object; /** * drawing viewport bounds */ viewport?: Viewport; /** * scissor test bounds */ scissor?: Viewport; multiDraw?: MultiDrawOptions; baseVertex?: number; baseInstance?: number; }; export type MultiDrawOptions = object; export type PexContextSetOptions = { width?: number; height?: number; pixelRatio?: number; }; /** * [x, y, w, h] */ export type Viewport = number[]; /** * [r, g, b, a] */ export type Color = number[]; export type TypedArray = (Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array);