mirror of
https://gitlab.com/Trygve/contour-creator.git
synced 2024-11-24 16:10:18 +00:00
bugfix
This commit is contained in:
parent
df7cac1095
commit
790cf44f8b
10
src/main.cpp
10
src/main.cpp
@ -21,10 +21,10 @@ std::vector<Point> produce_cellmap(HeightMap* heightmap, float z)
|
|||||||
for (int i = 0; i<length; i++) {
|
for (int i = 0; i<length; i++) {
|
||||||
int y = i/(heightmap->width-1);
|
int y = i/(heightmap->width-1);
|
||||||
int x = i%(heightmap->width-1);
|
int x = i%(heightmap->width-1);
|
||||||
uint8_t result = (heightmap->get_pixel(x,y)>z) +
|
uint8_t result = (heightmap->get_pixel(x,y)>z)*8 +
|
||||||
(heightmap->get_pixel(x+1,y)>z)*2 +
|
(heightmap->get_pixel(x+1,y)>z)*4 +
|
||||||
(heightmap->get_pixel(x+1,y+1)>z)*4 +
|
(heightmap->get_pixel(x+1,y+1)>z)*2 +
|
||||||
(heightmap->get_pixel(x,y+1)>z)*8;
|
(heightmap->get_pixel(x,y+1)>z);
|
||||||
if (result != 0 and result != 15 ) {
|
if (result != 0 and result != 15 ) {
|
||||||
points.push_back(Point(x, y, result));
|
points.push_back(Point(x, y, result));
|
||||||
};
|
};
|
||||||
@ -132,7 +132,7 @@ constexpr std::tuple<double, double, double, double> marching_squares_lookup(int
|
|||||||
switch (mcase) {
|
switch (mcase) {
|
||||||
case 1: return {0, 0.5, 0.5, 0};
|
case 1: return {0, 0.5, 0.5, 0};
|
||||||
case 2: return {1, 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 4: return {0.5, 1, 1, 0.5};
|
||||||
case 5: return {0, 0, 0, 0}; //FIXME
|
case 5: return {0, 0, 0, 0}; //FIXME
|
||||||
case 6: return {0.5, 1, 0.5, 0};
|
case 6: return {0.5, 1, 0.5, 0};
|
||||||
|
Loading…
Reference in New Issue
Block a user