Neurotic Pantaloon Maker

    primitive-box

    1.0.0 • Public • Published

    primitive-box

    stable

    A minimal box geometry for 3D rendering, NOT including normals, UVs.

    Only vertices and cell indices (quad faces). As this geometry is not triangulated it's not ready for rendering you might need to use e.g. geom-triangulate.

    You are probably looking for primitive-cube. The difference is that cube has separate faces that can be textured while box does not. This is one solid mesh which makes it perfect for subdivisions.

    Usage

    NPM

    mesh = createBox([sx, sy, sz])

    Parameters:
    sx - size x, defaults to 1
    sy - size y, defaults to sx
    sz - size z, defaults to sx

    Example

    var createBox = require('primtivie-box');
    var box = createCreate(1);

    cube will have the following structure:

    {
      positions: [ [x, y, z], [x, y, z], ... ],
      cells: [ [a, b, c, d], [c, d, e, f], ... ],
    }
    

    Demo

    Download or clone this repo and run:

    cd demo
    npm install
    npm start
    

    License

    MIT, see LICENSE.md for details.

    Install

    npm i primitive-box

    DownloadsWeekly Downloads

    20

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • vorg