{"name":"gl-geometry","version":"2.0.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.","main":"index.js","scripts":{"start":"budo test.js --open -- -t glslify"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","dependencies":{"array-pack-2d":"^0.1.0","dtype":"^0.1.0","gl-buffer":"^2.0.6","gl-to-dtype":"^1.1.0","gl-vao":"^1.1.2","is-typedarray":"0.0.0","isndarray":"^0.1.0"},"devDependencies":{"budo":"^6.0.0","bunny":"^1.0.1","canvas-fit":"0.0.0","canvas-orbit-camera":"0.0.0","face-normals":"0.0.0","gl-clear":"0.0.0","gl-context":"^0.1.0","gl-matrix":"^2.1.0","gl-shader":"^4.0.6","glslify":"^3.1.0","ndarray":"^1.0.15","normals":"^0.1.0","unindex-mesh":"0.0.0"},"repository":{"type":"git","url":"git://github.com/hughsk/gl-geometry.git"},"bugs":{"url":"https://github.com/hughsk/gl-geometry/issues"},"homepage":"https://github.com/hughsk/gl-geometry","keywords":["gl","webgl","geometry","vao","mesh","buffer","convenience","shader"],"gitHead":"e579eeda4183deac5b89060f37413f771d773719","_id":"gl-geometry@2.0.0","_shasum":"daa553e67d337eaf51ef8f2355f7e3028d729837","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"dist":{"shasum":"daa553e67d337eaf51ef8f2355f7e3028d729837","tarball":"http://registry-npm.ywwl.com/gl-geometry/download/gl-geometry-2.0.0.tgz","integrity":"sha512-+hO5UcMcmqNGHuG3291uNG5k757lNgJE73jGtGXAand/+HfAG7UUcVDq+uTZCQM/2TkoZOE3fDvtxRbldiLELA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDL2e2KhS5cdwNdIec9EX0/UMRfD7TAizuRsW81O+rjkAiEAiEHhY8IiHuaJSBXzMW0pPy8frvwroogWINe9COZa8Fc="}],"size":5400,"noattachment":false,"key":"/gl-geometry/-/gl-geometry-2.0.0.tgz"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"readme":"# gl-geometry [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)\n\nA flexible wrapper for [gl-vao](http://github.com/stackgl/gl-vao)\nand [gl-buffer](http://github.com/stackgl/gl-buffer) that you can use to\nset up renderable WebGL geometries from a variety of different formats.\n\n## Usage ##\n\n[![NPM](https://nodei.co/npm/gl-geometry.png)](https://nodei.co/npm/gl-geometry/)\n\n### geom = createGeometry(gl) ###\n\nCreates a new geometry attached to the WebGL canvas context `gl`.\n\n### geom.attr(name, values[, opt]) ###\n\nDefine or update an attribute value, for example using a simplicial complex:\n\n``` javascript\nvar createGeometry = require('gl-geometry')\nvar bunny = require('bunny')\n\nvar geom = createGeometry(gl)\n  .attr('positions', bunny)\n```\n\nThe following vertex formats are supported and will be normalized:\n\n* Arrays of arrays, e.g. `[[0, 0, 0], [1, 0, 0], [1, 1, 0]]`.\n\n* Flat arrays, e.g. `[0, 0, 0, 1, 0, 0, 1, 1, 0]`.\n\n* [Typed arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays),\n  preferably a `Float32Array`.\n\n* 1-dimensional [ndarrays](https://github.com/scijs/ndarray).\n\n* [simplicial complexes](https://github.com/mikolalysenko/simplicial-complex),\n  i.e. an object with a `positions` array and a `cells` array. The former is\n  a list of unique vertices in the mesh (if you've used three.js, think\n  `THREE.Vector3`), and the latter is an index mapping these vertices to faces\n  (`THREE.Face3`) in the mesh. It looks something like this:\n\n  ``` json\n  {\n    \"positions\": [\n      [0.0, 0.0, 0.0],\n      [1.5, 0.0, 0.0],\n      [1.5, 1.5, 0.0],\n      [0.0, 1.5, 0.0]\n    ],\n    \"cells\": [\n      [0, 1, 2],\n      [1, 2, 3]\n    ]\n  }\n  ```\n\nYou can specify `opt.size` for the vertex size, defaults to 3.\n\nYou can update attribute values by calling `attr` again with the same `name`:\n\n* By default the entire contents of the associated `gl-buffer` are replaced by\n`data`; the buffer will be resized accordingly.\n\n* Alternatively, you can pass `opt.offset` to copy `data` into the current\nbuffer at a specific offset (in bytes). In this case, the buffer cannot be\nresized.\n\n### geom.faces(values[, opt]) ###\n\nPass a simplicial complex's `cells` property here in any of the above formats\nto use it as your index when drawing the geometry. For example:\n\n``` javascript\nvar createGeometry = require('gl-geometry')\nvar bunny = require('bunny')\n\nbunny.normals = normals.vertexNormals(\n    bunny.cells\n  , bunny.positions\n)\n\nvar geom = createGeometry(gl)\n  .attr('positions', bunny.positions)\n  .attr('normals', bunny.normals)\n  .faces(bunny.cells)\n```\n\nYou can specify `opt.size` for the cell size, defaults to 3.\n\n### geom.bind([shader]) ###\n\nBinds the underlying [VAO](https://github.com/stackgl/gl-vao) – this must\nbe called before calling `geom.draw`. Optionally, you can pass in a\n[gl-shader](http://github.com/stackgl/gl-shader) to\nautomatically set up your attribute locations for you.\n\n### geom.draw(mode, start, stop) ###\n\nDraws the geometry to the screen using the currently bound shader.\n\nOptionally, you can pass in the drawing mode, which should be one of the\nfollowing:\n\n* `gl.POINTS`\n* `gl.LINES`\n* `gl.LINE_STRIP`\n* `gl.LINE_LOOP`\n* `gl.TRIANGLES`\n* `gl.TRIANGLE_STRIP`\n* `gl.TRIANGLE_FAN`\n\nThe default value is `gl.TRIANGLES`. You're also able to pass in a `start` and\n`stop` range for the points you want to render, just the same as you would\nwith `gl.drawArrays` or `gl.drawElements`.\n\n### geom.unbind() ###\n\nUnbinds the underlying VAO. This *must* be done when you're finished drawing,\nunless you're binding to another gl-geometry or gl-vao instance.\n\n### geom.dispose() ###\n\nDisposes the underlying element and array buffers, as well as the VAO.\n\n## See Also\n\n* [ArrayBuffer and Typed Arrays](https://www.khronos.org/registry/webgl/specs/1.0/#5.13)\n* [The WebGL Context](https://www.khronos.org/registry/webgl/specs/1.0/#5.14)\n* [simplicial-complex](http://github.com/mikolalysenko/simplicial-complex)\n* [ndarray](https://github.com/scijs/ndarray)\n* [gl-shader](https://github.com/stackgl/gl-shader)\n* [gl-buffer](https://github.com/stackgl/gl-buffer)\n* [gl-vao](https://github.com/stackgl/gl-vao)\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details.\n","publish_time":1451880604094,"_cnpm_publish_time":1451880604094,"dist-tags":{"latest":"3.1.1"}}