ts-glsl icon indicating copy to clipboard operation
ts-glsl copied to clipboard

A GLSL Parser implemented purely in TypeScript type annotations.

ts-glsl

A GLSL Parser implemented purely in TypeScript type annotations.

In accordance with GLSL ES Specification 1.0.

See the live demo

You can install ts-glsl in your own project with npm install ts-glsl.

import { Parse } from 'ts-glsl';

const vertex = `
attribute vec3 position;
varying vec2 uv;
void main() {
    gl_Position = vec4(position, 1.0);
    uv = position.xy;
}
`

type AST = Parse<typeof vertex>;

License

MIT