diff --git a/meshers/transgreedy.js b/meshers/transgreedy.js index 321a2e0..87ae7c6 100644 --- a/meshers/transgreedy.js +++ b/meshers/transgreedy.js @@ -21,13 +21,7 @@ function removeFlags(v) { return (v & kNoFlagsMask); } -function getType(voxels, offset) { - // return voxels[offset]; - var type = voxels[offset]; - return type | (type in kTransparentTypes ? kTransparentMask : 0); -} - -return function ohSoGreedyMesher(volume, dims) { +return function ohSoGreedyMesher(volume, dims, mesherExtraData) { var vertices = [], faces = [] , dimsX = dims[0] , dimsY = dims[1] @@ -35,6 +29,13 @@ return function ohSoGreedyMesher(volume, dims) { var tVertices = [], tFaces = [] + var transparentTypes = mesherExtraData ? (mesherExtraData.transparentTypes || {}) : {}; + var getType = function(voxels, offset) { + var type = voxels[offset]; + return type | (type in transparentTypes ? kTransparentMask : 0); + } + + //Sweep over 3-axes for(var d=0; d<3; ++d) { var i, j, k, l, w, W, h, n, c