gl-triangle-strip-indexer
Creates typed arrays capable of being passed to WebGL element arrays for triangle strip meshes.
var createIndices = var createBuffer = var createVAO = var indexData = var vertexData = // to use element indexes >= 65535, use "OES_element_index_uint."gl var indexBuffer = ;var vao = vaovao
API
createIndices(width, height[, out]) -> out
Returns a typed array containing indexes representing a triangle strip. Each alternating column will introduce one degenerate triangle, and produces the following pattern:
*--*--*
| /|\ |
|/ | \|
*--*--*
| /|\ |
|/ | \|
*--*--*
The size of the returned array will be height + (height - 1) * (2 * (width - 1))
. The array
can be passed in as the optional out
parameter, in which case a subarray will be returned.
If out
is not provided, createIndices
will instantiate one of the correct datatype and size.
License
MIT