frak-slang
Lightweight GLSL preprocessor for FRAK Engine.
Features
- Declare uniforms/attributes/varyings only once
- #include
- Have both vertex and fragment shader entry points in the same file
- Transpile into standard GLSL vertex and fragment shader
- Unused variables and functions are culled
- Extract shader parameters
- Command line tool for integrating into build scripts
Limitations
- Preprocessor directives inside functions are not evaluated
- Unused variables and functions inside preprocessor directives are not culled
- Comments on the same line as #include directives are not handled
Install
npm install frak-slang
Usage (as library)
var FRAKSlang = ; FRAKSlang;
Usage (as command line tool)
frak-slang -o <output_filename> -t <glsl|json> <file.glsl>
- The default value for --type (-t) is GLSL
- If the type is GLSL the output will result in two files: output_filename.vert and output_filename.frag