Skip to content

Commit f9a44bc

Browse files
chore: fix camera
1 parent c48e8c8 commit f9a44bc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/InOneWeekend/camera.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class camera {
3838
initialize();
3939

4040
std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n";
41+
std::flush(std::cout);
4142

4243
int image_size_in_bytes = sizeof(color) * image_width * image_height;
4344
color *rendered_image = (color *) mmap(nullptr, image_size_in_bytes,
@@ -61,7 +62,9 @@ class camera {
6162
}
6263
}
6364

64-
for (int i = 0; i < remainder; i++) {
65+
std::clog << processes * lines_per_child << " " << image_height << "\n";
66+
67+
for (int i = processes * lines_per_child; i < image_height; i++) {
6568
renderLine(i, world, rendered_image);
6669
}
6770
std::clog << "Remainder done. \n";
@@ -70,6 +73,8 @@ class camera {
7073
wait(NULL);
7174
}
7275

76+
77+
7378
for (int i = 0; i < image_height; i++) {
7479
for (int j = 0; j < image_width; j++) {
7580
write_color(std::cout, rendered_image[i * image_width + j]);

0 commit comments

Comments
 (0)