display percent of image complete on command line
git-svn-id: svn://anubis/fart/trunk@265 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
5b4a0692e3
commit
781b46dcd4
12
main/fart.cc
12
main/fart.cc
@ -256,6 +256,11 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
else
|
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 */
|
/* "sequential" version */
|
||||||
for (int i = 0; i < height; i++)
|
for (int i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
@ -263,8 +268,15 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
int pixel = i * width + j;
|
int pixel = i * width + j;
|
||||||
scene.renderPixel(j, i, &data[3 * pixel]);
|
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 */
|
gettimeofday(&after, NULL); /* stop timing */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user