|
116 | 116 |
|
117 | 117 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
118 | 118 |
|
119 | | - for (int j = 0; j < image_height; ++j) { |
120 | | - for (int i = 0; i < image_width; ++i) { |
| 119 | + for (int j = 0; j < image_height; j++) { |
| 120 | + for (int i = 0; i < image_width; i++) { |
121 | 121 | auto r = double(i) / (image_width-1); |
122 | 122 | auto g = double(j) / (image_height-1); |
123 | 123 | auto b = 0; |
|
256 | 256 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
257 | 257 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
258 | 258 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
259 | | - for (int i = 0; i < image_width; ++i) { |
| 259 | + for (int i = 0; i < image_width; i++) { |
260 | 260 | auto r = double(i) / (image_width-1); |
261 | 261 | auto g = double(j) / (image_height-1); |
262 | 262 | auto b = 0; |
|
456 | 456 |
|
457 | 457 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
458 | 458 |
|
459 | | - for (int j = 0; j < image_height; ++j) { |
| 459 | + for (int j = 0; j < image_height; j++) { |
460 | 460 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
461 | | - for (int i = 0; i < image_width; ++i) { |
| 461 | + for (int i = 0; i < image_width; i++) { |
462 | 462 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
463 | 463 | auto pixel_color = color(double(i)/(image_width-1), double(j)/(image_height-1), 0); |
464 | 464 | write_color(std::cout, pixel_color); |
|
683 | 683 |
|
684 | 684 | std::cout << "P3\n" << image_width << " " << image_height << "\n255\n"; |
685 | 685 |
|
686 | | - for (int j = 0; j < image_height; ++j) { |
| 686 | + for (int j = 0; j < image_height; j++) { |
687 | 687 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
688 | | - for (int i = 0; i < image_width; ++i) { |
| 688 | + for (int i = 0; i < image_width; i++) { |
689 | 689 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
690 | 690 | auto pixel_center = pixel00_loc + (i * pixel_delta_u) + (j * pixel_delta_v); |
691 | 691 | auto ray_direction = pixel_center - camera_center; |
|
1484 | 1484 |
|
1485 | 1485 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
1486 | 1486 |
|
1487 | | - for (int j = 0; j < image_height; ++j) { |
| 1487 | + for (int j = 0; j < image_height; j++) { |
1488 | 1488 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
1489 | | - for (int i = 0; i < image_width; ++i) { |
| 1489 | + for (int i = 0; i < image_width; i++) { |
1490 | 1490 | auto pixel_center = pixel00_loc + (i * pixel_delta_u) + (j * pixel_delta_v); |
1491 | 1491 | auto ray_direction = pixel_center - camera_center; |
1492 | 1492 | ray r(camera_center, ray_direction); |
|
1781 | 1781 |
|
1782 | 1782 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
1783 | 1783 |
|
1784 | | - for (int j = 0; j < image_height; ++j) { |
| 1784 | + for (int j = 0; j < image_height; j++) { |
1785 | 1785 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
1786 | | - for (int i = 0; i < image_width; ++i) { |
| 1786 | + for (int i = 0; i < image_width; i++) { |
1787 | 1787 | auto pixel_center = pixel00_loc + (i * pixel_delta_u) + (j * pixel_delta_v); |
1788 | 1788 | auto ray_direction = pixel_center - center; |
1789 | 1789 | ray r(center, ray_direction); |
|
2038 | 2038 |
|
2039 | 2039 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
2040 | 2040 |
|
2041 | | - for (int j = 0; j < image_height; ++j) { |
| 2041 | + for (int j = 0; j < image_height; j++) { |
2042 | 2042 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
2043 | | - for (int i = 0; i < image_width; ++i) { |
| 2043 | + for (int i = 0; i < image_width; i++) { |
2044 | 2044 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
2045 | 2045 | color pixel_color(0,0,0); |
2046 | | - for (int sample = 0; sample < samples_per_pixel; ++sample) { |
| 2046 | + for (int sample = 0; sample < samples_per_pixel; sample++) { |
2047 | 2047 | ray r = get_ray(i, j); |
2048 | 2048 | pixel_color += ray_color(r, world); |
2049 | 2049 | } |
|
2351 | 2351 |
|
2352 | 2352 | std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; |
2353 | 2353 |
|
2354 | | - for (int j = 0; j < image_height; ++j) { |
| 2354 | + for (int j = 0; j < image_height; j++) { |
2355 | 2355 | std::clog << "\rScanlines remaining: " << (image_height - j) << ' ' << std::flush; |
2356 | | - for (int i = 0; i < image_width; ++i) { |
| 2356 | + for (int i = 0; i < image_width; i++) { |
2357 | 2357 | color pixel_color(0,0,0); |
2358 | | - for (int sample = 0; sample < samples_per_pixel; ++sample) { |
| 2358 | + for (int sample = 0; sample < samples_per_pixel; sample++) { |
2359 | 2359 | ray r = get_ray(i, j); |
2360 | 2360 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
2361 | 2361 | pixel_color += ray_color(r, max_depth, world); |
|
0 commit comments