glsl-token-depth

WebJar for glsl-token-depth

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

glsl-token-depth
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

glsl-token-depth
WebJar for glsl-token-depth
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/glslify/glsl-token-depth

Download glsl-token-depth

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-depth/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>glsl-token-depth</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-depth/
implementation 'org.webjars.npm:glsl-token-depth:1.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/glsl-token-depth/
implementation ("org.webjars.npm:glsl-token-depth:1.1.2")
'org.webjars.npm:glsl-token-depth:jar:1.1.2'
<dependency org="org.webjars.npm" name="glsl-token-depth" rev="1.1.2">
  <artifact name="glsl-token-depth" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='glsl-token-depth', version='1.1.2')
)
libraryDependencies += "org.webjars.npm" % "glsl-token-depth" % "1.1.2"
[org.webjars.npm/glsl-token-depth "1.1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

glsl-token-depth

experimental

Determine the scope depth of an array of GLSL tokens.

Useful for inferring the scope of variables in a GLSL shader without having to fully parse the source.

Usage

NPM

depth(tokens)

Where tokens is an array of tokens returned from glsl-tokenizer. Each token will be modified in-place, and given a depth property.

var tokenize = require('glsl-tokenizer/string')
var depth    = require('glsl-token-depth')
var fs       = require('fs')

var src = fs.readFileSync('shader.frag', 'utf8')
var tokens = tokenize(src)

depth(tokens)

tokens[0].depth // 0
tokens[1].depth // 0
tokens[2].depth // 0
tokens[3].depth // 0
tokens[4].depth // 1
// ...

See Also

License

MIT. See LICENSE.md for details.

org.webjars.npm

Versions

Version
1.1.2