summaryrefslogtreecommitdiff
path: root/material_dielectric.cpp
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-16 19:08:28 +0800
committerKeuin <[email protected]>2022-04-16 19:08:28 +0800
commit60d8221109304bc4f207dda8a42623cae488af5d (patch)
tree5f4c59a81d58d14666226ee1f7da5299db98f9f5 /material_dielectric.cpp
parent52d11df35ca9846085b910e2e40434b48847d9d8 (diff)
Move trace logging to tracelog.h.
Pixel-wise, comprehensive, beautiful trace logging.
Diffstat (limited to 'material_dielectric.cpp')
-rw-r--r--material_dielectric.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/material_dielectric.cpp b/material_dielectric.cpp
index ed8e4eb..61e34ec 100644
--- a/material_dielectric.cpp
+++ b/material_dielectric.cpp
@@ -3,6 +3,7 @@
//
#include "material_dielectric.h"
+#include "tracelog.h"
bool material_dielectric::scatter(ray3d &r, const object &hit_obj, double hit_t, random_uv_gen_3d &ruvg) const {
const auto hit_p = r.at(hit_t);
@@ -22,9 +23,11 @@ bool material_dielectric::scatter(ray3d &r, const object &hit_obj, double hit_t,
// determine reflection or refraction using Schlick's Approximation.
if (reflectance(cos1, ri_) > ruvg.range01_scalar()) {
// reflect
+ TRACELOG(" reflect (dielectric material, schlick, ri=%-10f)\n", ri_);
r2 = n.reflect(r.direction());
} else {
// refract
+ TRACELOG(" refract (dielectric material, schlick, ri=%-10f)\n", ri_);
r2 = n.refract<true>(r.direction(), ri_);
}
r.direction(r2.unit_vec());