larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

View File

@@ -0,0 +1,9 @@
node_modules
*.log
.DS_Store
bundle.js
test
test.js
demo
example
!.gitignore

View 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.

View File

@@ -0,0 +1,35 @@
# glsl-token-string
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
Simple helper package that converts an array of GLSL tokens to a plain GLSL
source string.
## Usage
[![NPM](https://nodei.co/npm/glsl-token-string.png)](https://nodei.co/npm/glsl-token-string/)
### `src = stringify(tokens)`
``` javascript
var tokenize = require('glsl-tokenizer/string')
var stringify = require('glsl-token-string')
var assert = require('assert')
var src = 'vec3 light = vec3(1.0);'
var tokens = tokenize(src)
assert(stringify(tokens) === src)
```
## See Also
* [glsl-tokenizer](http://github.com/stackgl/glsl-tokenizer)
* [glsl-token-scope](http://github.com/stackgl/glsl-token-scope)
* [glsl-token-depth](http://github.com/stackgl/glsl-token-depth)
* [glsl-token-properties](http://github.com/stackgl/glsl-token-properties)
* [glsl-token-assignments](http://github.com/stackgl/glsl-token-assignments)
## License
MIT. See [LICENSE.md](http://github.com/stackgl/glsl-token-string/blob/master/LICENSE.md) for details.

View File

@@ -0,0 +1,20 @@
precision mediump float;
attribute vec3 aPosition;
attribute vec3 aNormal;
uniform mat4 uProj;
uniform mat4 uView;
uniform mat4 uModel;
varying float vLight;
struct x {
float y;
float z;
};
void main( void ) {
vLight = dot(aNormal, vec3(0, 1, 0));
gl_Position = uProj * uView * uModel * vec4(aPosition, 1);
}

View File

@@ -0,0 +1,12 @@
module.exports = toString
function toString(tokens) {
var output = []
for (var i = 0; i < tokens.length; i++) {
if (tokens[i].type === 'eof') continue
output.push(tokens[i].data)
}
return output.join('')
}

View File

@@ -0,0 +1,32 @@
{
"name": "glsl-token-string",
"version": "1.0.1",
"description": "Converts an array of GLSL tokens to a plain source string",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "node test | tap-spec"
},
"author": {
"name": "Hugh Kennedy",
"email": "hughskennedy@gmail.com",
"url": "http://hughsk.io/"
},
"dependencies": {},
"devDependencies": {
"glsl-tokenizer": "^2.0.0",
"tap-spec": "^2.1.2",
"tape": "^3.0.3"
},
"repository": {
"type": "git",
"url": "git://github.com/stackgl/glsl-token-string.git"
},
"keywords": [
"ecosystem:stackgl"
],
"homepage": "https://github.com/stackgl/glsl-token-string",
"bugs": {
"url": "https://github.com/stackgl/glsl-token-string/issues"
}
}