Skip to content

Commit

Permalink
Accept transparent voxel list for transgreedy mesher in mesherExtraData
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Mar 15, 2014
1 parent badd17e commit f468f43
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions meshers/transgreedy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ 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]
, dimsXY = dimsX * dimsY;

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
Expand Down

0 comments on commit f468f43

Please sign in to comment.