surface-vectors
Debug utility for drawing surface vectors in WebGL.
Last updated 7 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install surface-vectors 
SYNC missed versions from official npm registry.

surface-vectors experimental

Debug utility for drawing surface vectors in WebGL.

Useful for visualising normal/tangent/bitangent vectors across a mesh's surface.

Usage

surface-vectors

If you're looking for a complete usage example, check out the demo and its source code.

sv = surfaceVectors(gl, cells, positions, vectors)

Prepare a pair of positions and vectors for rendering.

  • gl is the WebGL canvas context.
  • cells should be a list of element/face indices for your model: either a packed Float32Array, or a nested 2D array. See the bunny module's data for an example of this.
  • positions should a list of positions for your model: again, in either of the above formats.
  • vectors same format as positions and cells, instead containing the vectors to render from each point at the same index in positions.

sv.render(length, matrix, [color])

Draws the vectors to the screen.

  • length is the length at which to draw each vector.
  • matrix the matrix to multiply each position by. Ordinarily, you'd want this to be Projection * View * Model, like you would normally do shader-side.
  • color the color to use when drawing the vectors: a 3-element long array, and should contain RGB values from 0 to 1.

License

MIT. See LICENSE.md for details.

Current Tags

  • 0.0.0                                ...           latest (7 years ago)

1 Versions

  • 0.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |