|
757 | 757 |
|
758 | 758 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
759 | 759 | ...
|
760 |
| - color ray_color( |
| 760 | + color ray_color(...) |
761 | 761 | ...
|
762 | 762 |
|
763 | 763 | hittable_list cornell_box() {
|
764 |
| - hittable_list world; |
| 764 | + hittable_list objects; |
765 | 765 |
|
766 | 766 | auto red = make_shared<lambertian>(color(.65, .05, .05));
|
767 | 767 | auto white = make_shared<lambertian>(color(.73, .73, .73));
|
768 | 768 | auto green = make_shared<lambertian>(color(.12, .45, .15));
|
769 | 769 | auto light = make_shared<diffuse_light>(color(15, 15, 15));
|
770 | 770 |
|
771 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
772 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
773 |
| - world.add(make_shared<xz_rect>(213, 343, 227, 332, 554, light)); |
774 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
775 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
776 |
| - world.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
| 771 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
| 772 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
| 773 | + objects.add(make_shared<xz_rect>(213, 343, 227, 332, 554, light)); |
| 774 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
| 775 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
| 776 | + objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
777 | 777 |
|
778 | 778 | shared_ptr<hittable> box1 = make_shared<box>(point3(0,0,0), point3(165,330,165), white);
|
779 | 779 | box1 = make_shared<rotate_y>(box1, 15);
|
780 | 780 | box1 = make_shared<translate>(box1, vec3(265,0,295));
|
781 |
| - world.add(box1); |
| 781 | + objects.add(box1); |
782 | 782 |
|
783 | 783 | shared_ptr<hittable> box2 = make_shared<box>(point3(0,0,0), point3(165,165,165), white);
|
784 | 784 | box2 = make_shared<rotate_y>(box2, -18);
|
785 | 785 | box2 = make_shared<translate>(box2, vec3(130,0,65));
|
786 |
| - world.add(box2); |
| 786 | + objects.add(box2); |
787 | 787 |
|
788 |
| - return world; |
| 788 | + return objects; |
789 | 789 | }
|
790 | 790 |
|
791 | 791 | int main() {
|
|
1524 | 1524 |
|
1525 | 1525 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1526 | 1526 | hittable_list cornell_box() {
|
1527 |
| - hittable_list world; |
| 1527 | + hittable_list objects; |
1528 | 1528 |
|
1529 | 1529 | auto red = make_shared<lambertian>(color(.65, .05, .05));
|
1530 | 1530 | auto white = make_shared<lambertian>(color(.73, .73, .73));
|
1531 | 1531 | auto green = make_shared<lambertian>(color(.12, .45, .15));
|
1532 | 1532 | auto light = make_shared<diffuse_light>(color(15, 15, 15));
|
1533 | 1533 |
|
1534 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
1535 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
| 1534 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
| 1535 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
1536 | 1536 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
1537 |
| - world.add(make_shared<flip_face>(make_shared<xz_rect>(213, 343, 227, 332, 554, light))); |
| 1537 | + objects.add(make_shared<flip_face>(make_shared<xz_rect>(213, 343, 227, 332, 554, light))); |
1538 | 1538 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1539 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
1540 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
1541 |
| - world.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
| 1539 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
| 1540 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
| 1541 | + objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
1542 | 1542 |
|
1543 | 1543 | ...
|
1544 | 1544 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
2227 | 2227 | </div>
|
2228 | 2228 |
|
2229 | 2229 | <div class='together'>
|
2230 |
| -We also need to change the block to metal. |
| 2230 | +We also need to change the block to metal. We'll also swap out the short block for a glass sphere. |
2231 | 2231 |
|
2232 | 2232 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2233 |
| - hittable_list cornell_box(camera& cam, double aspect) { |
2234 |
| - hittable_list world; |
| 2233 | + hittable_list cornell_box() { |
| 2234 | + hittable_list objects; |
2235 | 2235 |
|
2236 | 2236 | auto red = make_shared<lambertian>(color(.65, .05, .05));
|
2237 | 2237 | auto white = make_shared<lambertian>(color(.73, .73, .73));
|
2238 | 2238 | auto green = make_shared<lambertian>(color(.12, .45, .15));
|
2239 | 2239 | auto light = make_shared<diffuse_light>(color(15, 15, 15));
|
2240 | 2240 |
|
2241 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
2242 |
| - world.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
2243 |
| - world.add(make_shared<xz_rect>(213, 343, 227, 332, 554, light)); |
2244 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
2245 |
| - world.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
2246 |
| - world.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
| 2241 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 555, green)); |
| 2242 | + objects.add(make_shared<yz_rect>(0, 555, 0, 555, 0, red)); |
| 2243 | + objects.add(make_shared<flip_face>(make_shared<xz_rect>(213, 343, 227, 332, 554, light))); |
| 2244 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 555, white)); |
| 2245 | + objects.add(make_shared<xz_rect>(0, 555, 0, 555, 0, white)); |
| 2246 | + objects.add(make_shared<xy_rect>(0, 555, 0, 555, 555, white)); |
2247 | 2247 |
|
2248 | 2248 |
|
2249 | 2249 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
|
2252 | 2252 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2253 | 2253 | box1 = make_shared<rotate_y>(box1, 15);
|
2254 | 2254 | box1 = make_shared<translate>(box1, vec3(265,0,295));
|
2255 |
| - world.add(box1); |
2256 |
| - |
2257 |
| - shared_ptr<hittable> box2 = make_shared<box>(point3(0,0,0), point3(165,165,165), white); |
2258 |
| - box2 = make_shared<rotate_y>(box2, -18); |
2259 |
| - box2 = make_shared<translate>(box2, vec3(130,0,65); |
2260 |
| - world.add(box2); |
2261 |
| - |
2262 |
| - point3 lookfrom(278, 278, -800); |
2263 |
| - point3 lookat(278, 278, 0); |
2264 |
| - vec3 vup(0, 1, 0); |
2265 |
| - auto dist_to_focus = 10.0; |
2266 |
| - auto aperture = 0.0; |
2267 |
| - auto vfov = 40.0; |
2268 |
| - auto time0 = 0.0; |
2269 |
| - auto time1 = 1.0; |
| 2255 | + objects.add(box1); |
2270 | 2256 |
|
2271 |
| - cam = camera(lookfrom, lookat, vup, vfov, aspect, aperture, dist_to_focus, time0, time1); |
| 2257 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
| 2258 | + auto glass = make_shared<dielectric>(1.5); |
| 2259 | + objects.add(make_shared<sphere>(point3(190,90,190), 90 , glass)); |
| 2260 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
2272 | 2261 |
|
2273 |
| - return world; |
| 2262 | + return objects; |
2274 | 2263 | }
|
2275 | 2264 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2276 | 2265 | [Listing [scene-cornell-al]: <kbd>[main.cc]</kbd> Cornell box scene with aluminum material]
|
|
0 commit comments