From 4078e026efcbc02085d520ca95340b4c8647f0c7 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Sun, 11 Jul 2021 10:00:38 -0400 Subject: [PATCH] fix incorrect fills --- index.html | 1 - region.js | 16 +++++++++------- scene.js | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index b258832..ea11c07 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,6 @@ let surfaceTest = () => let voxels = []; voxels[Region.I(2, 2, 2)] = true; voxels[Region.I(2, 3, 2)] = true; - voxels[Region.I(3, 2, 2)] = true; let surface = Region.Surface(voxels) console.log(surface); diff --git a/region.js b/region.js index a82f617..3bd8a0c 100644 --- a/region.js +++ b/region.js @@ -104,21 +104,23 @@ export const Region = { let [x, y, z] = Region.XYZ(i); + console.log("at", x, y, z); + // bottom: at, "up", corner, right BA = i; - BU = Region.I(x+1, y, z); - BC = Region.I(x+1, y+1, z); - BR = Region.I(x, y+1, z); + BU = Region.I(x, y+1, z ); + BC = Region.I(x+1, y+1, z ); + BR = Region.I(x+1, y, z ); // top: at, "up" corner, right TA = Region.I(x, y, z+1); - TU = Region.I(x+1, y, z+1); + TU = Region.I(x, y+1, z+1); TC = Region.I(x+1, y+1, z+1); - TR = Region.I(x, y+1, z+1); + TR = Region.I(x+1, y, z+1); // check: left, "down", below - CL = Region.I(x-1, y, z); - CD = Region.I(x, y-1, z); + CL = Region.I(x-1, y, z ); + CD = Region.I(x, y-1, z ); CB = Region.I(x, y, z-1); if(!inVoxels[BU]){ Face(BU, BC, TC, TU); } diff --git a/scene.js b/scene.js index 8ee65a0..c4734ba 100644 --- a/scene.js +++ b/scene.js @@ -45,7 +45,7 @@ export function Scene(inSettings) scene.add(light); //scene.add(new T.GridHelper(10, 10)); light.position.set(-1, 2, 4); - camera.position.set(0, 5, -5); + camera.position.set(0, 5, 5); camera.lookAt(new T.Vector3(0,0,0)); controls.update();