|
1291 | 1291 | #include <memory>
|
1292 | 1292 | #include <vector>
|
1293 | 1293 |
|
1294 |
| - using std::shared_ptr; |
1295 | 1294 | using std::make_shared;
|
| 1295 | + using std::shared_ptr; |
1296 | 1296 |
|
1297 | 1297 | class hittable_list : public hittable {
|
1298 | 1298 | public:
|
|
1406 | 1406 |
|
1407 | 1407 | // C++ Std Usings
|
1408 | 1408 |
|
1409 |
| - using std::shared_ptr; |
1410 | 1409 | using std::make_shared;
|
| 1410 | + using std::shared_ptr; |
1411 | 1411 | using std::sqrt;
|
1412 | 1412 |
|
1413 | 1413 | // Constants
|
|
1423 | 1423 |
|
1424 | 1424 | // Common Headers
|
1425 | 1425 |
|
| 1426 | + #include "color.h" |
1426 | 1427 | #include "ray.h"
|
1427 | 1428 | #include "vec3.h"
|
1428 | 1429 |
|
|
1436 | 1437 | this assumption in mind.
|
1437 | 1438 |
|
1438 | 1439 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete
|
1439 |
| - #include "vec3.h" |
1440 |
| - |
1441 | 1440 | #include <iostream>
|
1442 | 1441 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1443 | 1442 | [Listing [assume-rtw-color]: <kbd>[color.h]</kbd> Assume rtweekend.h in color.h]
|
|
1456 | 1455 |
|
1457 | 1456 |
|
1458 | 1457 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete
|
1459 |
| - using std::shared_ptr; |
1460 | 1458 | using std::make_shared;
|
| 1459 | + using std::shared_ptr; |
1461 | 1460 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1462 | 1461 | [Listing [assume-rtw-hittable-list]: <kbd>[hittable_list.h]</kbd>
|
1463 | 1462 | Assume rtweekend.h in hittable_list.h
|
|
1485 | 1484 | #include "rtweekend.h"
|
1486 | 1485 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1487 | 1486 |
|
| 1487 | + |
| 1488 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete |
1488 | 1489 | #include "color.h"
|
1489 | 1490 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
1490 | 1491 | #include "hittable.h"
|
|
1636 | 1637 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1637 | 1638 | // Common Headers
|
1638 | 1639 |
|
1639 |
| - |
| 1640 | + #include "color.h" |
1640 | 1641 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ Highlight
|
1641 | 1642 | #include "interval.h"
|
1642 | 1643 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
|
1720 | 1721 |
|
1721 | 1722 |
|
1722 | 1723 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1723 |
| - ... |
1724 | 1724 | color ray_color(const ray& r, const hittable& world) {
|
1725 | 1725 | hit_record rec;
|
1726 | 1726 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
|
1733 | 1733 | auto a = 0.5*(unit_direction.y() + 1.0);
|
1734 | 1734 | return (1.0-a)*color(1.0, 1.0, 1.0) + a*color(0.5, 0.7, 1.0);
|
1735 | 1735 | }
|
1736 |
| - ... |
1737 | 1736 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1738 | 1737 | [Listing [main-with-interval]: <kbd>[main.cc]</kbd> The new main using interval]
|
1739 | 1738 |
|
|
1772 | 1771 |
|
1773 | 1772 | #include "rtweekend.h"
|
1774 | 1773 |
|
1775 |
| - #include "color.h" |
1776 | 1774 | #include "hittable.h"
|
1777 | 1775 |
|
1778 | 1776 | class camera {
|
|
1812 | 1810 | ...
|
1813 | 1811 |
|
1814 | 1812 |
|
1815 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1816 | 1813 | color ray_color(const ray& r, const hittable& world) const {
|
| 1814 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1817 | 1815 | hit_record rec;
|
1818 | 1816 |
|
1819 | 1817 | if (world.hit(r, interval(0, infinity), rec)) {
|
|
1823 | 1821 | vec3 unit_direction = unit_vector(r.direction());
|
1824 | 1822 | auto a = 0.5*(unit_direction.y() + 1.0);
|
1825 | 1823 | return (1.0-a)*color(1.0, 1.0, 1.0) + a*color(0.5, 0.7, 1.0);
|
1826 |
| - } |
1827 | 1824 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
| 1825 | + } |
1828 | 1826 | };
|
1829 | 1827 |
|
1830 | 1828 | #endif
|
|
1839 | 1837 | migrated code:
|
1840 | 1838 |
|
1841 | 1839 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1842 |
| - ... |
1843 |
| - #include "rtweekend.h" |
1844 |
| - |
1845 |
| - #include "color.h" |
1846 |
| - #include "hittable.h" |
1847 |
| - |
1848 |
| - |
1849 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1850 |
| - #include <iostream> |
1851 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
1852 |
| - |
1853 | 1840 | class camera {
|
1854 | 1841 | public:
|
1855 | 1842 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
|
1925 | 1912 | <div class='together'>
|
1926 | 1913 | And here's the much reduced main:
|
1927 | 1914 |
|
1928 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
| 1915 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
1929 | 1916 | #include "rtweekend.h"
|
1930 | 1917 |
|
| 1918 | + |
| 1919 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1931 | 1920 | #include "camera.h"
|
| 1921 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
| 1922 | + #include "hittable.h" |
1932 | 1923 | #include "hittable_list.h"
|
1933 | 1924 | #include "sphere.h"
|
1934 | 1925 |
|
| 1926 | + |
| 1927 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ delete |
| 1928 | + color ray_color(const ray& r, const hittable& world) { |
| 1929 | + ... |
| 1930 | + } |
| 1931 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
| 1932 | + |
1935 | 1933 | int main() {
|
| 1934 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
1936 | 1935 | hittable_list world;
|
1937 | 1936 |
|
1938 | 1937 | world.add(make_shared<sphere>(point3(0,0,-1), 0.5));
|
|
1944 | 1943 | cam.image_width = 400;
|
1945 | 1944 |
|
1946 | 1945 | cam.render(world);
|
| 1946 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
1947 | 1947 | }
|
1948 | 1948 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1949 | 1949 | [Listing [main-with-new-camera]: <kbd>[main.cc]</kbd> The new main, using the new camera]
|
|
2001 | 2001 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ Highlight
|
2002 | 2002 | #include <cstdlib>
|
2003 | 2003 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
| 2004 | + #include <iostream> |
2004 | 2005 | #include <limits>
|
2005 | 2006 | #include <memory>
|
2006 | 2007 | ...
|
|
2076 | 2077 |
|
2077 | 2078 | Here's the updated `write_color()` function that incorporates the interval clamping function:
|
2078 | 2079 |
|
| 2080 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
| 2081 | + #include "interval.h" |
2079 | 2082 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
| 2083 | + #include "vec3.h" |
| 2084 | + |
| 2085 | + using color = vec3; |
| 2086 | + |
2080 | 2087 | void write_color(std::ostream& out, const color& pixel_color) {
|
2081 | 2088 | auto r = pixel_color.x();
|
2082 | 2089 | auto g = pixel_color.y();
|
|
2139 | 2146 | double pixel_samples_scale; // Color scale factor for a sum of pixel samples
|
2140 | 2147 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2141 | 2148 | point3 center; // Camera center
|
2142 |
| - ... |
| 2149 | + point3 pixel00_loc; // Location of pixel 0, 0 |
| 2150 | + vec3 pixel_delta_u; // Offset to pixel to the right |
| 2151 | + vec3 pixel_delta_v; // Offset to pixel below |
2143 | 2152 |
|
2144 | 2153 | void initialize() {
|
2145 | 2154 | image_height = int(image_width / aspect_ratio);
|
|
2177 | 2186 | }
|
2178 | 2187 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2179 | 2188 |
|
2180 |
| - ... |
| 2189 | + color ray_color(const ray& r, const hittable& world) const { |
| 2190 | + ... |
| 2191 | + } |
2181 | 2192 | };
|
2182 | 2193 |
|
2183 | 2194 | #endif
|
|
2815 | 2826 | that will be defined later. Since we're just specifying a pointer to the class, the compiler doesn't
|
2816 | 2827 | need to know the details of the class, solving the circular reference issue.
|
2817 | 2828 |
|
2818 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
2819 |
| - |
2820 | 2829 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
2821 |
| - #include "rtweekend.h" |
2822 |
| - |
2823 | 2830 | class material;
|
2824 | 2831 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2825 | 2832 |
|
|
2854 | 2861 | class sphere : public hittable {
|
2855 | 2862 | public:
|
2856 | 2863 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
2857 |
| - sphere(const point3& center, double radius, shared_ptr<material> mat) |
2858 |
| - : center(center), radius(fmax(0,radius)), mat(mat) {} |
| 2864 | + sphere(const point3& center, double radius) : center(center), radius(fmax(0,radius)) { |
| 2865 | + // TODO: Initialize the material pointer `mat`. |
| 2866 | + } |
2859 | 2867 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2860 | 2868 |
|
2861 | 2869 | bool hit(const ray& r, interval ray_t, hit_record& rec) const override {
|
|
2939 | 2947 | We'll need to use the C++ standard library function `std::fabs`, which returns the absolute value of
|
2940 | 2948 | its input. We'll add this to `rtweekend.h` since we'll use this in several future locations.
|
2941 | 2949 |
|
2942 |
| - |
2943 | 2950 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2944 | 2951 | // C++ Std Usings
|
2945 | 2952 |
|
|
2951 | 2958 | using std::shared_ptr;
|
2952 | 2959 | using std::sqrt;
|
2953 | 2960 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2954 |
| - [Listing [declare-fabs]: <kbd>rtweekend.h</kbd> Declaring std::fabs() |
| 2961 | + [Listing [declare-fabs]: <kbd>[rtweekend.h]</kbd> Declaring std::fabs()] |
2955 | 2962 |
|
2956 | 2963 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
2957 | 2964 | class vec3 {
|
|
3075 | 3082 | ...
|
3076 | 3083 | #include "rtweekend.h"
|
3077 | 3084 |
|
3078 |
| - #include "color.h" |
3079 | 3085 | #include "hittable.h"
|
3080 | 3086 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
3081 | 3087 | #include "material.h"
|
|
3113 | 3119 |
|
3114 | 3120 | </div>
|
3115 | 3121 |
|
| 3122 | +Now we'll update the `sphere` constructor to initialize the material pointer `mat`: |
| 3123 | + |
| 3124 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
| 3125 | + class sphere : public hittable { |
| 3126 | + public: |
| 3127 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
| 3128 | + sphere(const point3& center, double radius, shared_ptr<material> mat) |
| 3129 | + : center(center), radius(fmax(0,radius)), mat(mat) {} |
| 3130 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
| 3131 | + |
| 3132 | + ... |
| 3133 | + }; |
| 3134 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3135 | + [Listing [sphere-ctor-material]: <kbd>[sphere.h]</kbd> Initializing sphere with a material] |
| 3136 | + |
3116 | 3137 |
|
3117 | 3138 | A Scene with Metal Spheres
|
3118 | 3139 | ---------------------------
|
|
3122 | 3143 | #include "rtweekend.h"
|
3123 | 3144 |
|
3124 | 3145 | #include "camera.h"
|
3125 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
3126 |
| - #include "color.h" |
3127 |
| - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
3128 | 3146 | #include "hittable_list.h"
|
3129 | 3147 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
3130 | 3148 | #include "material.h"
|
|
3388 | 3406 |
|
3389 | 3407 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
3390 | 3408 | auto material_ground = make_shared<lambertian>(color(0.8, 0.8, 0.0));
|
3391 |
| - auto material_center = make_shared<lambertian>(color(0.1, 0.2, 0.5)); |
3392 | 3409 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
| 3410 | + auto material_center = make_shared<lambertian>(color(0.1, 0.2, 0.5)); |
3393 | 3411 | auto material_left = make_shared<dielectric>(1.5);
|
3394 | 3412 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
3395 | 3413 | auto material_right = make_shared<metal>(color(0.8, 0.6, 0.2), 1.0);
|
|
3576 | 3594 | bool cannot_refract = ri * sin_theta > 1.0;
|
3577 | 3595 | vec3 direction;
|
3578 | 3596 |
|
| 3597 | + |
3579 | 3598 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
|
3580 | 3599 | if (cannot_refract || reflectance(cos_theta, ri) > random_double())
|
3581 | 3600 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
|
4141 | 4160 | }
|
4142 | 4161 |
|
4143 | 4162 | ray get_ray(int i, int j) const {
|
| 4163 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
4144 | 4164 | // Construct a camera ray originating from the defocus disk and directed at a randomly
|
4145 | 4165 | // sampled point around the pixel location i, j.
|
| 4166 | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
4146 | 4167 |
|
4147 | 4168 | auto offset = sample_square();
|
4148 | 4169 | auto pixel_sample = pixel00_loc
|
|
0 commit comments