Print pixel progress
Not entirely convinced this is a good idea yet. It slows down rendering by almost 2x.
This commit is contained in:
parent
ea1fac7501
commit
fdd96dbc27
1 changed files with 10 additions and 1 deletions
11
src/scene.cc
11
src/scene.cc
|
@ -155,17 +155,26 @@ Scene::render()
|
||||||
|
|
||||||
pixels = new Color[width * height];
|
pixels = new Color[width * height];
|
||||||
|
|
||||||
|
unsigned long numPrimaryRays = width * height;
|
||||||
|
|
||||||
Ray primary_ray;
|
Ray primary_ray;
|
||||||
Vector3 o, d;
|
Vector3 o, d;
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
primary_ray = mCamera->compute_primary_ray(x, width, y, height);
|
|
||||||
mStats.primaryRays++;
|
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);
|
Color c = trace_ray(primary_ray);
|
||||||
pixels[y * width + x] = c;
|
pixels[y * width + x] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<float> seconds = end - start;
|
std::chrono::duration<float> seconds = end - start;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue