From d62a1e73576d50e45310c2d0c0649cd24868f5b6 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sun, 10 Apr 2022 15:55:39 -0400 Subject: [PATCH] fixed they're now unified, but flipped :P --- app.js | 1 - region.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index c7151ab..0b960ce 100644 --- a/app.js +++ b/app.js @@ -23,7 +23,6 @@ let rebuildSurface = inVoxels => surfaceCubeGeometry.setAttribute("position", new T.BufferAttribute(pos, 3)); surfaceCubeGeometry.setIndex(ind); - //surfaceCubeGeometry.computeVertexNormals(); }; rebuildSurface(voxels); diff --git a/region.js b/region.js index 8e451ff..815406e 100644 --- a/region.js +++ b/region.js @@ -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) } }