mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-13 09:24:53 +00:00
larry babby and threejs for glsl
This commit is contained in:
8
webGl/my-threejs-test/node_modules/glsl-token-scope/.npmignore
generated
vendored
Normal file
8
webGl/my-threejs-test/node_modules/glsl-token-scope/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
*.log
|
||||
.DS_Store
|
||||
bundle.js
|
||||
test
|
||||
test.js
|
||||
demo
|
||||
example
|
||||
12
webGl/my-threejs-test/node_modules/glsl-token-scope/LICENSE.md
generated
vendored
Normal file
12
webGl/my-threejs-test/node_modules/glsl-token-scope/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright (c) 2014 [stackgl](http://github.com/stackgl/) contributors
|
||||
|
||||
*stackgl contributors listed at <https://github.com/stackgl/contributing/blob/master/CONTRIBUTING.md#contributors>*
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
60
webGl/my-threejs-test/node_modules/glsl-token-scope/README.md
generated
vendored
Normal file
60
webGl/my-threejs-test/node_modules/glsl-token-scope/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# glsl-token-scope
|
||||
|
||||
[](http://github.com/badges/stability-badges)
|
||||
|
||||
Infer the scope of each token in an array of GLSL tokens.
|
||||
|
||||
## Usage
|
||||
|
||||
[](https://nodei.co/npm/glsl-token-scope/)
|
||||
|
||||
### `scope(tokens)`
|
||||
|
||||
Where `tokens` is an array of tokens returned from
|
||||
[`glsl-tokenizer`](http://github.com/stackgl/glsl-tokenizer). Each token will
|
||||
be modified in-place, and given `scope` and `stack` properties.
|
||||
|
||||
`token.scope` is a unique number for the token's current scope.
|
||||
|
||||
`token.stack` is an array containing the scopes available to the current token.
|
||||
|
||||
Note that you must first determine the scope depth of each token using
|
||||
[`glsl-token-depth`](http://github.com/stackgl/glsl-token-depth)
|
||||
|
||||
``` javascript
|
||||
var tokenize = require('glsl-tokenizer/string')
|
||||
var depth = require('glsl-token-depth')
|
||||
var scope = require('glsl-token-scope')
|
||||
var fs = require('fs')
|
||||
|
||||
var src = fs.readFileSync('shader.frag', 'utf8')
|
||||
var tokens = tokenize(src)
|
||||
|
||||
depth(tokens)
|
||||
scope(tokens)
|
||||
|
||||
tokens[0].scope // 0
|
||||
tokens[1].scope // 0
|
||||
tokens[2].scope // 1
|
||||
tokens[3].scope // 1
|
||||
tokens[4].scope // 0
|
||||
tokens[5].scope // 2
|
||||
// ...
|
||||
|
||||
tokens[0].stack // [0]
|
||||
tokens[1].stack // [0]
|
||||
tokens[2].stack // [0, 1]
|
||||
tokens[3].stack // [0, 1]
|
||||
tokens[4].stack // [0]
|
||||
tokens[5].stack // [0, 2]
|
||||
// ...
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
* [stackgl/glsl-tokenizer](http://github.com/stackgl/glsl-tokenizer)
|
||||
* [stackgl/glsl-token-depth](http://github.com/stackgl/glsl-token-depth)
|
||||
|
||||
## License
|
||||
|
||||
MIT. See [LICENSE.md](http://github.com/stackgl/glsl-token-scope/blob/master/LICENSE.md) for details.
|
||||
30
webGl/my-threejs-test/node_modules/glsl-token-scope/index.js
generated
vendored
Normal file
30
webGl/my-threejs-test/node_modules/glsl-token-scope/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
module.exports = tokenScope
|
||||
|
||||
function tokenScope(tokens) {
|
||||
var stack = [0]
|
||||
var inc = stack[0]
|
||||
var ldepth = 0
|
||||
|
||||
if (!tokens || !tokens.length) return tokens
|
||||
if (!('depth' in tokens[0])) {
|
||||
throw new Error('glsl-token-scope: No scope depth defined on tokens! Use glsl-token-depth on these tokens first')
|
||||
}
|
||||
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var token = tokens[i]
|
||||
var depth = token.depth
|
||||
|
||||
if (depth > ldepth) {
|
||||
stack.push(++inc)
|
||||
} else
|
||||
if (depth < ldepth) {
|
||||
stack.splice(-1, 1)
|
||||
}
|
||||
|
||||
token.scope = stack[stack.length - 1]
|
||||
token.stack = stack.slice()
|
||||
ldepth = token.depth
|
||||
}
|
||||
|
||||
return tokens
|
||||
}
|
||||
38
webGl/my-threejs-test/node_modules/glsl-token-scope/package.json
generated
vendored
Normal file
38
webGl/my-threejs-test/node_modules/glsl-token-scope/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "glsl-token-scope",
|
||||
"version": "1.1.2",
|
||||
"description": "Infer the scope of each token in an array of GLSL tokens",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "node test | tap-spec",
|
||||
"start": "node test/eyeball"
|
||||
},
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
"url": "http://hughsk.io/"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chalk": "^0.5.1",
|
||||
"glsl-token-depth": "^1.1.0",
|
||||
"glsl-tokenizer": "^2.0.0",
|
||||
"tap-spec": "^2.1.1",
|
||||
"tape": "^3.0.3"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/stackgl/glsl-token-scope.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ecosystem:stackgl",
|
||||
"glsl",
|
||||
"tokens",
|
||||
"syntax"
|
||||
],
|
||||
"homepage": "https://github.com/stackgl/glsl-token-scope",
|
||||
"bugs": {
|
||||
"url": "https://github.com/stackgl/glsl-token-scope/issues"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user