|
1128 | 1128 | auto c = oc.length_squared() - radius*radius; |
1129 | 1129 |
|
1130 | 1130 | auto discriminant = h*h - a*c; |
1131 | | - if (discriminant < 0) return false; |
| 1131 | + if (discriminant < 0) |
| 1132 | + return false; |
| 1133 | + |
1132 | 1134 | auto sqrtd = sqrt(discriminant); |
1133 | 1135 |
|
1134 | 1136 | // Find the nearest root that lies in the acceptable range. |
|
1436 | 1438 | assumption in mind. |
1437 | 1439 |
|
1438 | 1440 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete |
1439 | | - #include "vec3.h" |
1440 | | - |
1441 | 1441 | #include <iostream> |
1442 | 1442 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1443 | 1443 | [Listing [assume-rtw-color]: <kbd>[color.h]</kbd> Assume rtweekend.h inclusion for color.h] |
|
1490 | 1490 |
|
1491 | 1491 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete |
1492 | 1492 | #include "color.h" |
| 1493 | + #include "ray.h" |
| 1494 | + #include "vec3.h" |
1493 | 1495 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1494 | 1496 | #include "hittable.h" |
1495 | 1497 | #include "hittable_list.h" |
|
2042 | 2044 | return distribution(generator); |
2043 | 2045 | } |
2044 | 2046 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
2045 | | - [Listing [random-double-alt]: <kbd>[rtweekend.h]</kbd> random_double(), alternate implemenation] |
| 2047 | + [Listing [random-double-alt]: <kbd>[rtweekend.h]</kbd> |
| 2048 | + random_double(), alternate implementation |
| 2049 | + ] |
2046 | 2050 |
|
2047 | 2051 |
|
2048 | 2052 | Generating Pixels with Multiple Samples |
|
3147 | 3151 | #include "rtweekend.h" |
3148 | 3152 |
|
3149 | 3153 | #include "camera.h" |
| 3154 | + #include "hittable.h" |
3150 | 3155 | #include "hittable_list.h" |
3151 | 3156 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3152 | 3157 | #include "material.h" |
|
3412 | 3417 | auto material_ground = make_shared<lambertian>(color(0.8, 0.8, 0.0)); |
3413 | 3418 | auto material_center = make_shared<lambertian>(color(0.1, 0.2, 0.5)); |
3414 | 3419 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3415 | | - auto material_left = make_shared<dielectric>(1.5); |
| 3420 | + auto material_left = make_shared<dielectric>(1.50); |
3416 | 3421 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
3417 | 3422 | auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 1.0); |
3418 | 3423 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
3655 | 3660 | ... |
3656 | 3661 | auto material_ground = make_shared<lambertian>(color(0.8, 0.8, 0.0)); |
3657 | 3662 | auto material_center = make_shared<lambertian>(color(0.1, 0.2, 0.5)); |
3658 | | - auto material_left = make_shared<dielectric>(1.50); |
3659 | 3663 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3660 | | - auto material_bubble = make_shared<dielectric>(0.67); |
| 3664 | + auto material_left = make_shared<dielectric>(1.50); |
| 3665 | + auto material_bubble = make_shared<dielectric>(1.00 / 1.50); |
3661 | 3666 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
3662 | 3667 | auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 0.0); |
3663 | 3668 |
|
|
3926 | 3931 | auto material_ground = make_shared<lambertian>(color(0.8, 0.8, 0.0)); |
3927 | 3932 | auto material_center = make_shared<lambertian>(color(0.1, 0.2, 0.5)); |
3928 | 3933 | auto material_left = make_shared<dielectric>(1.50); |
3929 | | - auto material_bubble = make_shared<dielectric>(0.67); |
3930 | | - auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 0.0); |
| 3934 | + auto material_bubble = make_shared<dielectric>(1.00 / 1.50); |
| 3935 | + auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 1.0); |
3931 | 3936 |
|
3932 | 3937 | world.add(make_shared<sphere>(point3( 0.0, -100.5, -1.0), 100.0, material_ground)); |
3933 | 3938 | world.add(make_shared<sphere>(point3( 0.0, 0.0, -1.2), 0.5, material_center)); |
|
3944 | 3949 | cam.max_depth = 50; |
3945 | 3950 |
|
3946 | 3951 |
|
3947 | | - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3948 | 3952 | cam.vfov = 90; |
| 3953 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3949 | 3954 | cam.lookfrom = point3(-2,2,1); |
3950 | 3955 | cam.lookat = point3(0,0,-1); |
3951 | 3956 | cam.vup = vec3(0,1,0); |
|
4201 | 4206 | } |
4202 | 4207 | }; |
4203 | 4208 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
4204 | | - [Listing [camera-dof]: <kbd>[camera.h]</kbd> Camera with adjustable depth-of-field (dof)] |
| 4209 | + [Listing [camera-dof]: <kbd>[camera.h]</kbd> Camera with adjustable depth-of-field] |
4205 | 4210 |
|
4206 | 4211 | <div class='together'> |
4207 | 4212 | Using a large aperture: |
|
0 commit comments