1.0.0 • Published 10 years ago

cube-cube v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

cube-cube experimental

A lazy voxel mesher, for those times when you just want a bunch of cubes on your screen. Considerably slower, so use sparingly. Note that in many cases a culled or greedy mesher is preferable, see this article for more info.

Usage

NPM

cubes = cubecube(w, h, d, filter)

Where:

  • w is the number of cubes to generate across the mesh's width.
  • h is the number of cubes to generate across the mesh's height.
  • d is the number of cubes to generate across the mesh's depth.
  • f(x, y, z) A function you can use to exclude specific cubes from the final mesh. Optional.

Returns an array of simplicial-complexes, one for each cube generated. These can then be combined into a single mesh using mesh-combine. Note that each cube has additional properties other then positions and cells that you could use to transform the mesh:

  • centroid: the center position of the cube.
  • index: the [x, y, z] position of the cube within the larger cube.

See Also

License

MIT. See LICENSE.md for details.