Package Exports
- quad-indices
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (quad-indices) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
quad-indices
Creates the indices for a quad mesh (two triangles), ideal for sprites, 2D lines, font glyphs, billboards, and other features.
var createIndices = require('quad-indices')
//basic usage:
var quad = createIndices()
// --> new Uint16Array([0, 1, 2, 0, 2, 3])
//N quads:
var quad = createIndices(2)
// --> new Uint16Array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7])
//counter-clockwise
var quad = createIndices({ clockwise: false })
// --> new Uint16Array([0, 1, 2, 2, 1, 3])
//different array type
var quad = createIndices({ dtype: 'uint8' })
// --> new Uint8Array([0, 1, 2, 0, 2, 3])
Usage
quad = createIndices([opt])
Returns the indices for a quad mesh. opt
is optional; it can be a number (the count
or number of quads to return), or a list of options:
count
the number of quads to index, default 1type
(string) the dtype of the returned array, default '"uint16"'clockwise
(boolean) the orientation of the indices, default true
License
MIT, see LICENSE.md for details.