gl-geometry
Advanced tools
+21
| The MIT License (MIT) | ||
| Copyright (c) 2015 Hugh Kennedy | ||
| 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. |
+3
-0
@@ -25,2 +25,5 @@ var normalize = require('./normalize') | ||
| this._attributes = [] | ||
| this._keys = [] | ||
| this._length = 0 | ||
| this._dirty = true | ||
@@ -27,0 +30,0 @@ if (this._index) { |
+8
-0
@@ -18,2 +18,10 @@ var pack = require('array-pack-2d') | ||
| // if we get a nested 2D array (with the second array being typed) | ||
| if (Array.isArray(attr) && ista(attr[0])) { | ||
| return { | ||
| buffer: createBuffer(gl, pack(attr, type), mode) | ||
| , length: ( attr.length * attr[0].length ) / size | ||
| } | ||
| } | ||
| // if we get a 1D array | ||
@@ -20,0 +28,0 @@ if (Array.isArray(attr)) { |
+3
-2
| { | ||
| "name": "gl-geometry", | ||
| "version": "1.2.0", | ||
| "version": "1.3.0", | ||
| "description": "A flexible wrapper for gl-vao and gl-buffer that you can use to set up renderable WebGL geometries from a variety of different formats.", | ||
@@ -28,3 +28,4 @@ "main": "index.js", | ||
| "gl-matrix": "^2.1.0", | ||
| "glslify": "^1.3.0", | ||
| "gl-shader": "^4.0.6", | ||
| "glslify": "^3.1.0", | ||
| "ndarray": "^1.0.15", | ||
@@ -31,0 +32,0 @@ "normals": "^0.1.0", |
+10
-11
| # gl-geometry [](http://github.com/badges/stability-badges) | ||
| A flexible wrapper for [gl-vao](http://github.com/mikolalysenko/gl-vao) | ||
| and [gl-buffer](http://github.com/mikolalysenko/gl-buffer) that you can use to | ||
| A flexible wrapper for [gl-vao](http://github.com/stackgl/gl-vao) | ||
| and [gl-buffer](http://github.com/stackgl/gl-buffer) that you can use to | ||
| set up renderable WebGL geometries from a variety of different formats. | ||
@@ -36,3 +36,3 @@ | ||
| * 1-dimensional [ndarrays](http://github.com/mikolalysenko/ndarray). | ||
| * 1-dimensional [ndarrays](https://github.com/scijs/ndarray). | ||
@@ -65,3 +65,3 @@ * [simplicial complexes](https://github.com/mikolalysenko/simplicial-complex), | ||
| Pass a simplicial complex's `cells` property here in any of the above formats | ||
| to use it as your index when drawing the geometry. For example: | ||
| to use it as your index when drawing the geometry. This can only be called after all of the `.attr` calls. For example: | ||
@@ -87,6 +87,5 @@ ``` javascript | ||
| Binds the underlying [VAO](https://github.com/gl-modules/gl-vao) – this must | ||
| Binds the underlying [VAO](https://github.com/stackgl/gl-vao) – this must | ||
| be called before calling `geom.draw`. Optionally, you can pass in a | ||
| [gl-shader](http://github.com/gl-modules/gl-shader) or | ||
| [glslify](http://github.com/chrisdickinson/glslify) shader instance to | ||
| [gl-shader](http://github.com/stackgl/gl-shader) to | ||
| automatically set up your attribute locations for you. | ||
@@ -127,6 +126,6 @@ | ||
| * [simplicial-complex](http://github.com/mikolalysenko/simplicial-complex) | ||
| * [ndarray](http://github.com/mikolalysenko/ndarray) | ||
| * [gl-shader](http://github.com/mikolalysenko/gl-shader) | ||
| * [gl-buffer](http://github.com/mikolalysenko/gl-buffer) | ||
| * [gl-vao](http://github.com/mikolalysenko/gl-vao) | ||
| * [ndarray](https://github.com/scijs/ndarray) | ||
| * [gl-shader](https://github.com/stackgl/gl-shader) | ||
| * [gl-buffer](https://github.com/stackgl/gl-buffer) | ||
| * [gl-vao](https://github.com/stackgl/gl-vao) | ||
@@ -133,0 +132,0 @@ ## License |
+6
-5
@@ -12,2 +12,3 @@ var createCamera = require('canvas-orbit-camera') | ||
| var bunny = require('bunny') | ||
| var createShader = require('gl-shader') | ||
@@ -47,7 +48,7 @@ var createGeom = require('./') | ||
| var projection = mat4.create() | ||
| var shader = glslify({ | ||
| vert: './test.vert' | ||
| , frag: './test.frag' | ||
| })(gl) | ||
| var shader = createShader(gl, | ||
| glslify('./test.vert'), | ||
| glslify('./test.frag') | ||
| ) | ||
| canvas.width = 300 | ||
@@ -54,0 +55,0 @@ canvas.height = 300 |
14132
11.01%8
14.29%260
4.42%13
8.33%131
-0.76%