TypeSL (Typescript Shader Language) enables Typescript -> GLSL Transpile.
Table of Contents
vert(attribute: RectangleAttribute, uniform: RectangleUniform): RectangleVarying {
const positionVec4 = new Vec4(attribute.aPosition, 1.0);
this.gl_Position = uniform.uProjectionMatrix * uniform.uModelViewMatrix * positionVec4;
return {
vTexCoord: attribute.aTexCoord
};
}
transpiles to
#version 300 es
precision highp float;
attribute vec3 aPosition;
attribute vec2 aTexCoord;
varying vec2 vTexCoord;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelViewMatrix;
void main() {
vec4 positionVec4 = vec4(aPosition, 1.0);
gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;
vTexCoord = aTexCoord;
}
NodeJS is a javascript runtime. This will enables run tslc.
npm (Node Package Manager) is package manager for nodejs, you need this for install TypeSL transpiler.
npm install (-g) typesl
or
yarn (global) add typesl
tslc {target file}
- CLI support (sorry)
- Fragment shader (sorry)
- Geometry shader
- Operator methods
- Core profile
Pull request and issues always open!
MIT License