summaryrefslogtreecommitdiff
path: root/material_dielectric.h
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-16 14:31:38 +0800
committerKeuin <[email protected]>2022-04-16 14:31:38 +0800
commitb26a0168788a28c384d394b9e3bb4ebaebc815c2 (patch)
tree19d7d1532e66c0b6c1dc976b4f34022554c49b1c /material_dielectric.h
parent1c27339c33a9170a519da847d9f00f8ffd5f47b9 (diff)
Add dielectric material. (glass ball)
Diffstat (limited to 'material_dielectric.h')
-rw-r--r--material_dielectric.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/material_dielectric.h b/material_dielectric.h
new file mode 100644
index 0000000..48382b4
--- /dev/null
+++ b/material_dielectric.h
@@ -0,0 +1,18 @@
+//
+// Created by Keuin on 2022/4/15.
+//
+
+#ifndef RT_MATERIAL_DIELECTRIC_H
+#define RT_MATERIAL_DIELECTRIC_H
+
+#include "vec.h"
+#include "material.h"
+
+class material_dielectric : public material {
+ double ri_inv;
+public:
+ explicit material_dielectric(double ri) : ri_inv{1.0 / ri} {}
+ bool scatter(ray3d &r, const object &hit_obj, double hit_t, random_uv_gen_3d &ruvg) const override;
+};
+
+#endif //RT_MATERIAL_DIELECTRIC_H