0.3.6 • Published 7 years ago

frak-slang v0.3.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

frak-slang

Lightweight GLSL preprocessor for FRAK Engine.

NPM

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 = require('frak-slang');

FRAKSlang.compile(glslSource, {
    // handle included files
    include: function(includedFile, parentFile, done) {
        /* ... */
        done(includedFileData, includedFilePath);
    },
    sourceURI: 'main/glsl/file/location'
}, function(compiled) {
    // compiled = {
    //   vertex: 'vertex program code here',
    //   fragment: 'fragment program code here'
    // }
});

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
0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago