diff options
author | Keuin <[email protected]> | 2022-04-15 12:32:42 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-15 12:32:42 +0800 |
commit | 4193adbbff4a5b633f59f88367fe1b74aec7789b (patch) | |
tree | 25056ac9e028e268193615724dda8c3ac12317d0 /main_simple_scanner.cpp | |
parent | 2ed39ad4eb9ebf64768dbf4aeefafc5ebb072ca7 (diff) |
Code Refactor:
- Add material class.
- Move diffuse routine into separate material classes.
Diffstat (limited to 'main_simple_scanner.cpp')
-rw-r--r-- | main_simple_scanner.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main_simple_scanner.cpp b/main_simple_scanner.cpp index 806fcfe..f0a2099 100644 --- a/main_simple_scanner.cpp +++ b/main_simple_scanner.cpp @@ -14,6 +14,7 @@ #include "hitlist.h" #include "sphere.h" #include "aa.h" +#include "material.h" #define DEMO_BALL @@ -35,11 +36,12 @@ void generate_image(uint16_t image_width, uint16_t image_height, double viewport } else { vp = new aa_viewport<T>{viewport_width, viewport_width / r, vec3d{0, 0, -focal_length}, samples}; } + material_diffuse_lambertian materi{0.5}; hitlist world; world.add_object(std::make_shared<sphere>( vec3d{0, -100.5, -1}, - 100)); // the earth - world.add_object(std::make_shared<sphere>(vec3d{0, 0, sphere_z}, sphere_r)); + 100, materi)); // the earth + world.add_object(std::make_shared<sphere>(vec3d{0, 0, sphere_z}, sphere_r, materi)); timer tm; std::cerr << "Rendering..." << std::endl; tm.start_measure(); |