1.0.2 • Published 10 years ago
primitive-rounded-cube v1.0.2
![]()
primitive-rounded-cube
A rounded cube geometry for 3D rendering, including normals, UVs and cell indices (faces).
Usage
mesh = createRoundedCube([sx, sy, sz, nx, ny, nz, r])
Parameters:sx - size x, defaults to 1sy - size y, defaults to sxsz - size z, defaults to sx
nx - num subdivisions on x axis, defaults to 1ny - num subdivisions on y axis, defaults to sxnz - num subdivisions on z axis, defaults to sx
r - rounded corner/edge radius, defaults to 0
Example
var createRoundedCube = require('primtivie-rounded-cube');
var cube = createRoundedCube(1, 1, 1, 20, 20, 20, 0.1);cube 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], ... ]
}Demo
Download or clone this repo and run:
cd demo
npm install
npm startLicense
MIT, see LICENSE.md for details.
