An API and accompanying client for generating glslify shaders in the browser
An API and accompanying client for generating glslify shaders in the browser.
This is done by running glslify in the browser, but redirecting its functions to read and resolve modules to a thin server. Files are cached locally using level.js to speed up the bundling speed after the first run – it can even work offline after downloading the required package once!
See the example directory for a simple example.
Returns an express-style route handler.
cachedir is the location to store
temporary packages (using npm-file),
and defaults to
Given a request and response pair, handle a route. Will call
next if there
is an error or a appropriate route is not found.
Returns a function for compiling shaders within the browser.
should be the URI where you're hosting your copy of the
glslify-api server –
if you don't pass one in that's OK too, there's one being hosted at
ttl: the maximum amount of time to cache a file locally, in milliseconds.
Pass in a shader body
done will be called with either an error
or the glslified shader when ready.
Pipe a whole shader to the request body and get a glslified shader in return. This is a little more blunt than the approach in the client, but can be useful for small, quick experiments.
Returns the raw contents of
file from the
package package on npm.
MIT. See LICENSE.md for details.