diff --git a/src/main.cpp b/src/main.cpp index 408592f..ee25b53 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,10 +21,10 @@ std::vector produce_cellmap(HeightMap* heightmap, float z) for (int i = 0; iwidth-1); int x = i%(heightmap->width-1); - uint8_t result = (heightmap->get_pixel(x,y)>z) + - (heightmap->get_pixel(x+1,y)>z)*2 + - (heightmap->get_pixel(x+1,y+1)>z)*4 + - (heightmap->get_pixel(x,y+1)>z)*8; + uint8_t result = (heightmap->get_pixel(x,y)>z)*8 + + (heightmap->get_pixel(x+1,y)>z)*4 + + (heightmap->get_pixel(x+1,y+1)>z)*2 + + (heightmap->get_pixel(x,y+1)>z); if (result != 0 and result != 15 ) { points.push_back(Point(x, y, result)); }; @@ -132,7 +132,7 @@ constexpr std::tuple marching_squares_lookup(int switch (mcase) { case 1: return {0, 0.5, 0.5, 0}; case 2: return {1, 0.5, 0.5, 0}; - case 3: return {0, 0.5, 1, 0}; + case 3: return {0, 0.5, 1, 0.5}; case 4: return {0.5, 1, 1, 0.5}; case 5: return {0, 0, 0, 0}; //FIXME case 6: return {0.5, 1, 0.5, 0};