While glsify has a bunch of nice features that my plugin lacks, one thing mine can do which (as far as I know) glsify cannot, is provide support for redefining #define statements from JavaScript. I find this quite useful if I need to have several similar shaders and want to tweak their behavior from JavaScript. Something like (see https://github.com/felixpalmer/amd-three.js/blob/master/js/a...):
define( ["shader!simple.vert"], function ( simpleVert ) {
simpleFrag.define( "faceColor", "vec3(1.0, 0, 0)" );
var vertexShader = simpleVert.value;
} );
Do you have any thoughts on this feature, or even plans to support something like this in the future?
I don't think it supports anything like that yet. There is some talk about using glslify at runtime, to build "uber shaders" depending on particular needs, and it seems like this kind of feature would be nice.
> Now, when somebody checks out your code, they can just run `npm init` on the package and it will grab all the GLSL snippets you’ve saved as dependencies.
Should they run `npm install` here to get all the package dependencies? Not `npm init`?
I had the problem of modularizing GLSL code myself and ended up writing a Require.js plugin which supported #include statements. Take a look at the shaders in here if interested: https://github.com/felixpalmer/lod-terrain/tree/master/js/sh... and https://github.com/felixpalmer/amd-three.js/blob/master/js/l...
While glsify has a bunch of nice features that my plugin lacks, one thing mine can do which (as far as I know) glsify cannot, is provide support for redefining #define statements from JavaScript. I find this quite useful if I need to have several similar shaders and want to tweak their behavior from JavaScript. Something like (see https://github.com/felixpalmer/amd-three.js/blob/master/js/a...):
define( ["shader!simple.vert"], function ( simpleVert ) { simpleFrag.define( "faceColor", "vec3(1.0, 0, 0)" ); var vertexShader = simpleVert.value; } );
Do you have any thoughts on this feature, or even plans to support something like this in the future?