diff options
author | Keuin <[email protected]> | 2022-05-03 15:59:11 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-05-03 15:59:11 +0800 |
commit | 12ec4e8284afb30ed894d9926362141cdfb24b96 (patch) | |
tree | 2c1c43f953c2e19fc945d227f63881b44db893e5 /material_dielectric.h | |
parent | 038e32a2345b064cb793a8ece77f1eda1bd824b0 (diff) |
Refactor: do not invert ri in constructor of material_dielectric.
Rewrite material_dielectric::scatter to stop using vec3::refract and switch to ri instead of ri_inv.
Diffstat (limited to 'material_dielectric.h')
-rw-r--r-- | material_dielectric.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/material_dielectric.h b/material_dielectric.h index 46b17da..14cd680 100644 --- a/material_dielectric.h +++ b/material_dielectric.h @@ -9,7 +9,7 @@ #include "material.h" class material_dielectric : public material { - double ri_inv; + double ri; // refractive index, 1.0 for air and 1.5 for glasses static double reflectance(double cosine, double ref_idx) { assert(cosine > 0); @@ -21,7 +21,7 @@ class material_dielectric : public material { } public: - explicit material_dielectric(double ri) : ri_inv{1.0 / ri} {} + explicit material_dielectric(double ri) : ri{ri} {} bool scatter(ray3d &r, const object &hit_obj, double hit_t, random_uv_gen_3d &ruvg) const override; }; |