diff --git a/main/fart.cc b/main/fart.cc index 320131e..a660e79 100644 --- a/main/fart.cc +++ b/main/fart.cc @@ -256,6 +256,11 @@ int main(int argc, char * argv[]) } else { + int total_pixels = height * width; + int total_pixels_1000 = total_pixels / 1000; + if (total_pixels_1000 < 1) + total_pixels_1000 = 1; + int pixel_num = 0; /* "sequential" version */ for (int i = 0; i < height; i++) { @@ -263,8 +268,15 @@ int main(int argc, char * argv[]) { int pixel = i * width + j; scene.renderPixel(j, i, &data[3 * pixel]); + pixel_num++; + if (pixel_num % total_pixels_1000 == 0) + { + double pct = 100.0 * pixel_num / (double) total_pixels; + printf("\e[8D%2.1f%%", pct); + } } } + printf("\e[8D"); } gettimeofday(&after, NULL); /* stop timing */