Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00d6fb0

Browse files
committed
Aufgabe 3 c workingopen image.ppmopen image.ppmopen image.ppm
1 parent 54c93ba commit 00d6fb0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/InOneWeekend/camera.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class camera {
2323
public:
2424
double aspect_ratio = 1.0; // Ratio of image width over height
25-
int image_width = 100; // Rendered image width in pixel count
25+
int image_width = 60; // Rendered image width in pixel count
2626
int samples_per_pixel = 10; // Count of random samples for each pixel
2727
int max_depth = 10; // Maximum number of ray bounces into scene
2828

@@ -37,6 +37,8 @@ class camera {
3737
void render(const hittable& world) {
3838
initialize();
3939

40+
std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n";
41+
4042
std::clog << "P3\n" << image_width << ' ' << image_height << "\n255\n" << std::endl;
4143

4244
int core_count = 6;
@@ -57,13 +59,12 @@ class camera {
5759
else if (pid == 0) {
5860
//Child proccess
5961
std::clog << "Created child process number: " << i << std::endl;
60-
int j = i*render_tile_size;
61-
while (j < j+(i*render_tile_size)) {
62+
int start = i*render_tile_size;
63+
int j = start;
64+
while (j < start + render_tile_size) {
6265
render_line(j, world, rendered_image);
6366
j++;
6467
}
65-
66-
std::clog << "process" << i << "finished" << std::endl;
6768
exit(0);
6869
}
6970
}
@@ -108,7 +109,7 @@ class camera {
108109
printf("Wait failed.\n");
109110
exit(1);
110111
}
111-
std::clog << "child number" << n << " finished" << std::endl;
112+
std::clog << "process finished" << std::endl;
112113
n--;
113114
}
114115

0 commit comments

Comments
 (0)