glsl-extract
extract uniforms and attributes from glsl programs
Last updated 10 years ago by chrisdickinson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install glsl-extract 
SYNC missed versions from official npm registry.

glsl-extract

extract attribute and uniform data from glsl files, no matter how nested.

var extract = require('glsl-extract')

extract(fs.createReadStream('test.glsl'))(function(err, info) {
  {attributes, uniforms} = info
  for(var def of uniforms) {
    {name, type} = def  // where "name" is the full dotted, array'd
                        // gl.getUniformLocation lookup path and
                        // type is the declared type.
  }
})

extract("also works with just text")(function(err, info) {
  // should execute on same frame.
})

api

extract(ReadableStream | String | Buffer[, getContextFunction) -> Continuable

Given a readable stream, string, or buffer, return a continuable that will trigger parsing. The continuable will call its callback with err (if any), and data, where data is comprised of {attributes:[GLSLLocation], uniforms:[GLSLLocation]}.

GLSLLocation

A GLSLLocation is just a plain object containing name (the appropriate name to pass to gl.getUniformLocation) and type (one of the primitive GLSL types).

license

MIT

Current Tags

  • 1.0.0                                ...           latest (10 years ago)

3 Versions

  • 1.0.0                                ...           10 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Downloads
Total 4
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (6)
Dev Dependencies (3)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE