UNPKG

728 BMarkdownView Raw
1# glslify-import #
2
3A transform stream for [glslify](http://github.com/stackgl/glslify)
4that adds an `import` directive to your shaders.
5
6## Usage ##
7
8Given a basic shader:
9
10``` glsl
11// main.frag
12#pragma glslify: import('./common.glsl')
13
14void main() {
15 gl_FragColor = vec4(color, 1.0);
16}
17```
18
19You can import `./common.glsl`:
20
21``` glsl
22// common.glsl
23varying vec3 color;
24```
25
26And have the contents inlined into your shader:
27
28``` glsl
29varying vec3 color;
30
31void main() {
32 gl_FragColor = vec4(color, 1.0);
33}
34```
35
36You can also use glslify pragmas and the like from your imported files as well.
37Useful for the cases when you want to include a common "base" set of
38definitions in your shaders without losing the niceties of glslify.