glslify-import
A transform stream for glslify that adds an `import` directive to your shaders.
Last updated 3 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install glslify-import 
SYNC missed versions from official npm registry.

glslify-import

A transform stream for glslify that adds an import directive to your shaders.

Usage

Given a basic shader:

// main.frag
#pragma glslify: import('./common.glsl')

void main() {
  gl_FragColor = vec4(color, 1.0);
}

You can import ./common.glsl:

// common.glsl
varying vec3 color;

And have the contents inlined into your shader:

varying vec3 color;

void main() {
  gl_FragColor = vec4(color, 1.0);
}

You can also use glslify pragmas and the like from your imported files as well. Useful for the cases when you want to include a common "base" set of definitions in your shaders without losing the niceties of glslify.

Current Tags

  • 3.1.0                                ...           latest (3 years ago)

6 Versions

  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago

Copyright 2014 - 2016 © taobao.org |