@bitheral/marching-cubes
v1.4.7
Published
Marching Cubes Algorithm for Three.js
Downloads
5
Readme
A Marching Cubes algorithm package for Three.js
This package is in part a port of Paul Bourke's marching cubes algorithm, to help create an environment using the Three.js library.
This package was developed in concurrence with my dissertation project, which is a procedural environment generator using WebGL. It is recommended to check out the project for a more complete example.
Installation
npm install @bitheral/marching-cubes
Usage
import { VolumeNew: Volume } from '@bitheral/marching-cubes';
import { Vector3, Mesh, MeshBasicMaterial } from 'three';
// Create Marching Cubes volume
const volume = new Volume(32, new Vector3(), new Vector3());
volume.March();
// Create Three.js mesh
const geometry = volume.geometry;
const material = new MeshBasicMaterial({ color: 0x00ff00 });
const mesh = new Mesh(geometry, material);
// Add mesh to scene...