Plane geometry including UVs and normals
mesh = createPlane([sx, sy, nx, ny, options])
Parameters:
sx
- size x, defaults to 1
sy
- size y, defaults to sx
nx
- num x subdivisions, defaults to 1
ny
- num y subdivisions, defaults to nx
options
- { quads: bool }
options.quads
- generates quads instead of triangles, defaults to false
var createPlane = require('primitive-plane');
var plane = createPlane(1, 1, 2, 2, { quads: true });
plane
will have the following structure:
{
positions: [ [x, y, z], [x, y, z], ... ],
cells: [ [a, b, c], [a, b, c], ... ],
uvs: [ [u, v], [u, v], ... ],
normals: [ [x, y, z], [x, y, z], ... ]
}
Download or clone this repo and run:
cd demo
npm install
npm start
MIT, see LICENSE.md for details.