they're now unified, but flipped :P
This commit is contained in:
Seth Trowbridge 2022-04-10 15:55:39 -04:00
parent c3f29258be
commit d62a1e7357
2 changed files with 6 additions and 7 deletions

1
app.js
View File

@ -23,7 +23,6 @@ let rebuildSurface = inVoxels =>
surfaceCubeGeometry.setAttribute("position", new T.BufferAttribute(pos, 3));
surfaceCubeGeometry.setIndex(ind);
//surfaceCubeGeometry.computeVertexNormals();
};
rebuildSurface(voxels);

View File

@ -136,13 +136,13 @@ const Region =
CD = Region.I(x, y-1, z );
CB = Region.I(x, y, z-1);
if(!inVoxels[BU]){ Face(BU, BC, TC, TU); } // XZ (away from origin) | "top" (these labels assume y-up)
if(!inVoxels[BR]){ Face(BC, BR, TR, TC); } // YZ (away from origin) | "side"
if(!inVoxels[TA]){ Face(TA, TU, TC, TR); } // XY (away from origin) | "side"
if(!inVoxels[BU]){ Face(BU, BC, TC, TU); } // XZ (away from origin)
if(!inVoxels[BR]){ Face(BC, BR, TR, TC); } // YZ (away from origin)
if(!inVoxels[TA]){ Face(TA, TU, TC, TR); } // XY (away from origin)
if(!inVoxels[CL]){ Face(BA, BU, TU, TA); } // YZ (touches the origin) | "side"
if(!inVoxels[CD]){ Face(BR, BA, TA, TR); } // XZ (touches the origin) | "bottom"
if(!inVoxels[CB]){ Face(BA, BU, BC, BR); } // XY (touches the origin) | "side" <-- this one needs normals flipped
if(!inVoxels[CL]){ Face(BA, BU, TU, TA); } // YZ (touches the origin)
if(!inVoxels[CD]){ Face(BR, BA, TA, TR); } // XZ (touches the origin)
if(!inVoxels[CB]){ Face(BU, BA, BR, BC); } // XY (touches the origin)
}
}