summaryrefslogtreecommitdiff
path: root/main_simple_scanner.cpp
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 /main_simple_scanner.cpp
parent1c27339c33a9170a519da847d9f00f8ffd5f47b9 (diff)
Add dielectric material. (glass ball)
Diffstat (limited to 'main_simple_scanner.cpp')
-rw-r--r--main_simple_scanner.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/main_simple_scanner.cpp b/main_simple_scanner.cpp
index b116933..6e79293 100644
--- a/main_simple_scanner.cpp
+++ b/main_simple_scanner.cpp
@@ -16,10 +16,12 @@
#include "aa.h"
#include "material_diffusive.h"
#include "material_reflective.h"
+#include "material_dielectric.h"
// Select the scene to render
//#define SCENE_DIFFUSE
-#define SCENE_REFLECT
+//#define SCENE_REFLECT
+#define SCENE_DIALECT
// T: intermediate color depth
template<typename T>
@@ -59,6 +61,18 @@ void generate_image(uint16_t image_width, uint16_t image_height, double viewport
world.add_object(std::make_shared<sphere>(vec3d{0.0, 0.0, -1.0}, 0.5, m_ball_center));
world.add_object(std::make_shared<sphere>(vec3d{1.0, 0.0, -1.0}, 0.5, m_ball_right));
#endif
+#ifdef SCENE_DIALECT
+ material_diffuse_lambertian m_ground{{0.8, 0.8, 0.0}};
+ material_diffuse_lambertian m_ball_center{{0.7, 0.3, 0.3}};
+ material_dielectric m_ball_left{1.5};
+ material_reflective m_ball_right{{0.8, 0.6, 0.2}};
+ // the earth
+ world.add_object(std::make_shared<sphere>(vec3d{0.0, -100.5, -1.0}, 100.0, m_ground));
+ // three balls
+ world.add_object(std::make_shared<sphere>(vec3d{-1.0, 0.0, -1.0}, 0.5, m_ball_left));
+ world.add_object(std::make_shared<sphere>(vec3d{0.0, 0.0, -1.0}, 0.5, m_ball_center));
+ world.add_object(std::make_shared<sphere>(vec3d{1.0, 0.0, -1.0}, 0.5, m_ball_right));
+#endif
timer tm;
std::cerr << "Rendering..." << std::endl;
tm.start_measure();