Permalink
Browse files

add documentation

  • Loading branch information...
maxogden committed Jan 1, 2013
1 parent a1ba58b commit 7031fa9a1073dd7b2fe44a527f1db9ba6b15ee1f
Showing with 25 additions and 0 deletions.
  1. +25 −0 readme.md
View
@@ -23,6 +23,31 @@ browserify -r voxel-mesh > voxel-mesh-browserified.js
```javascript
var Mesh = require('voxel-mesh')
+var voxelData = require('voxel').generateExamples()['Hilly Terrain']
+var mesh = new Mesh(voxelData)
+mesh.createSurfaceMesh()
+threeJSScene.add(mesh)
+```
+
+## new Mesh(voxelData, scaleFactor, meshingAlgorithm)
+
+`voxelData` is required, `scaleFactor` defaults to `10` and `meshingAlgorithm` defaults to `greedy` (from the [voxel](http://npmjs.org/voxel) module)
+
+## Mesh.prototype.createSurfaceMesh(material)
+
+returns the generated surface mesh. `material` defaults to `new THREE.MeshNormalMaterial()`. after calling this method your mesh will also have `.surfaceMesh` populated with the new mesh
+
+## Mesh.prototype.createWireMesh(hexColor)
+
+returns the generated wire mesh. `hexColor` defaults to `0xffffff`. after calling this method your mesh will also have `.wireMesh` populated with the new mesh
+
+## Mesh.prototype.addToScene(scene)
+
+convenience method for adding the currently generated meshes (either `surfaceMesh` or `wireMesh`) to a `three.js` scene instance
+
+## Mesh.prototype.setPosition(x, y, z)
+
+convenience method for setting the position of the currently generated meshes (either `surfaceMesh` or `wireMesh`)
# license

0 comments on commit 7031fa9

Please sign in to comment.