npm.io
4.2.5 • Published 2 years ago

@types/gl-shader

Licence
MIT
Version
4.2.5
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/gl-shader

Summary

This package contains type definitions for gl-shader (https://github.com/stackgl/gl-shader).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gl-shader.

index.d.ts

interface Parameter {
    type: string;
    name: string;
}

interface Attribute {
    location: number[] | number;
    pointer(type?: number, normalized?: boolean, stride?: number, offset?: number): number;
}

declare class Shader {
    readonly gl: WebGLRenderingContext;
    readonly program: WebGLProgram;
    readonly vertShader: WebGLShader;
    readonly fragShader: WebGLShader;
    readonly attributes: { [key: string]: Attribute & any[] };

    uniforms: { [key: string]: any };

    constructor(gl: WebGLRenderingContext);

    bind(): void;
    dispose(): void;

    update(vertex: string, fragment: string, uniforms?: Parameter[], attributes?: Parameter[]): void;
    update(obj: { vertex: string; fragment: string; uniforms: Parameter[]; attributes: Parameter[] }): void;
}

declare function createShader(
    gl: WebGLRenderingContext,
    vertex: string,
    fragment: string,
    uniforms?: Parameter[],
    attributes?: Parameter[],
): Shader;

declare function createShader(
    gl: WebGLRenderingContext,
    options: {
        vertex: string;
        fragment: string;
        uniforms?: Parameter[] | undefined;
        attributes?: Parameter[] | undefined;
    },
): Shader;

export = createShader;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: none

Credits

These definitions were written by .