Arguments u, v and p of method material::emitted() are all already included in the rec argument. Consider cleaning up the argument list of method material::emitted() in listing 33 and in the call to this method in the camera class in listing 34.
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
class material { |
|
public: |
|
... |
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
|
virtual color emitted( |
|
const ray& r_in, const hit_record& rec, double u, double v, const point3& p |
|
) const { |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
return color(0,0,0); |
|
} |
|
... |
|
}; |
|
|
|
class diffuse_light : public material { |
|
public: |
|
... |
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
|
color emitted(const ray& r_in, const hit_record& rec, double u, double v, const point3& p) |
|
const override { |
|
if (!rec.front_face) |
|
return color(0,0,0); |
|
return tex->value(u, v, p); |
|
} |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
|
|
... |
|
}; |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
[Listing [emitted-directional]: <kbd>[material.h]</kbd> Material emission, directional] |
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
class camera { |
|
... |
|
private: |
|
color ray_color(const ray& r, int depth, const hittable& world) const { |
|
... |
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight |
|
color color_from_emission = rec.mat->emitted(r, rec, rec.u, rec.v, rec.p); |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ |
|
|
|
... |
|
} |
|
}; |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
[Listing [emitted-ray-color]: <kbd>[camera.h]</kbd> Material emission, camera::ray_color() changes] |
Arguments
u,vandpof methodmaterial::emitted()are all already included in therecargument. Consider cleaning up the argument list of methodmaterial::emitted()in listing 33 and in the call to this method in thecameraclass in listing 34.raytracing.github.io/books/RayTracingTheRestOfYourLife.html
Lines 2629 to 2681 in 0ab7db4