Print pixel progress

Not entirely convinced this is a good idea yet. It slows down rendering by almost 2x.
This commit is contained in:
Eryn Wells 2014-08-02 00:51:55 -07:00
parent ea1fac7501
commit fdd96dbc27

View file

@ -155,17 +155,26 @@ Scene::render()
pixels = new Color[width * height];
unsigned long numPrimaryRays = width * height;
Ray primary_ray;
Vector3 o, d;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
primary_ray = mCamera->compute_primary_ray(x, width, y, height);
mStats.primaryRays++;
printf("\rRendering pixels... (%ld/%ld) %3.0f%%",
mStats.primaryRays, numPrimaryRays,
((float)mStats.primaryRays / (float)numPrimaryRays) * 100);
primary_ray = mCamera->compute_primary_ray(x, width, y, height);
Color c = trace_ray(primary_ray);
pixels[y * width + x] = c;
}
}
printf("\n");
end = std::chrono::system_clock::now();
std::chrono::duration<float> seconds = end - start;