0.0.0 • Published 12 years ago
surface-vectors v0.0.0
surface-vectors
Debug utility for drawing surface vectors in WebGL.
Useful for visualising normal/tangent/bitangent vectors across a mesh's surface.
Usage
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.
glis the WebGL canvas context.cellsshould be a list of element/face indices for your model: either a packedFloat32Array, or a nested 2D array. See the bunny module's data for an example of this.positionsshould a list of positions for your model: again, in either of the above formats.vectorssame format aspositionsandcells, instead containing the vectors to render from each point at the same index inpositions.
sv.render(length, matrix, color)
Draws the vectors to the screen.
lengthis the length at which to draw each vector.matrixthe matrix to multiply each position by. Ordinarily, you'd want this to be Projection View Model, like you would normally do shader-side.colorthe 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.
0.0.0
12 years ago
