From c5c8cbe757622e700e1dab7ddc29354f2f2b10d0 Mon Sep 17 00:00:00 2001 From: yumcyawiz Date: Mon, 22 Nov 2021 03:51:17 +0900 Subject: [PATCH] fix tests --- examples/main.cpp | 144 +------------------------------- tests/CMakeLists.txt | 6 -- tests/test_intersector.cpp | 19 +---- tests/test_path_tracing.cpp | 147 +-------------------------------- tests/test_plane.cpp | 37 --------- tests/test_sphere.cpp | 36 -------- tests/visualize_photon_map.cpp | 66 +-------------- 7 files changed, 10 insertions(+), 445 deletions(-) delete mode 100644 tests/test_plane.cpp delete mode 100644 tests/test_sphere.cpp diff --git a/examples/main.cpp b/examples/main.cpp index 0f08714..2da6a48 100644 --- a/examples/main.cpp +++ b/examples/main.cpp @@ -4,146 +4,8 @@ #include "image.h" #include "integrator.h" #include "photon_map.h" -#include "primitive.h" #include "scene.h" -// cornellbox -void cornellboxScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto shortBox1 = std::make_shared( - Vec3f(1.3, 1.65, 0.65), Vec3f(-0.48, 0, 1.6), Vec3f(1.6, 0, 0.49)); - const auto shortBox2 = std::make_shared( - Vec3f(2.9, 0, 1.14), Vec3f(0, 1.65, 0), Vec3f(-0.5, 0, 1.58)); - const auto shortBox3 = std::make_shared( - Vec3f(1.3, 0, 0.65), Vec3f(0, 1.65, 0), Vec3f(1.6, 0, 0.49)); - const auto shortBox4 = std::make_shared( - Vec3f(0.82, 0, 2.25), Vec3f(0, 1.65, 0), Vec3f(0.48, 0, -1.6)); - const auto shortBox5 = std::make_shared( - Vec3f(2.4, 0, 2.72), Vec3f(0, 1.65, 0), Vec3f(-1.58, 0, -0.47)); - - const auto tallBox1 = std::make_shared( - Vec3f(4.23, 3.30, 2.47), Vec3f(-1.58, 0, 0.49), Vec3f(0.49, 0, 1.59)); - const auto tallBox2 = std::make_shared( - Vec3f(4.23, 0, 2.47), Vec3f(0, 3.3, 0), Vec3f(0.49, 0, 1.59)); - const auto tallBox3 = std::make_shared( - Vec3f(4.72, 0, 4.06), Vec3f(0, 3.3, 0), Vec3f(-1.58, 0, 0.5)); - const auto tallBox4 = std::make_shared( - Vec3f(3.14, 0, 4.56), Vec3f(0, 3.3, 0), Vec3f(-0.49, 0, -1.6)); - const auto tallBox5 = std::make_shared( - Vec3f(2.65, 0, 2.96), Vec3f(0, 3.3, 0), Vec3f(1.58, 0, -0.49)); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(shortBox1, white)); - scene.addPrimitive(Primitive(shortBox2, white)); - scene.addPrimitive(Primitive(shortBox3, white)); - scene.addPrimitive(Primitive(shortBox4, white)); - scene.addPrimitive(Primitive(shortBox5, white)); - scene.addPrimitive(Primitive(tallBox1, white)); - scene.addPrimitive(Primitive(tallBox2, white)); - scene.addPrimitive(Primitive(tallBox3, white)); - scene.addPrimitive(Primitive(tallBox4, white)); - scene.addPrimitive(Primitive(tallBox5, white)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - -// cornellbox with mirror sphere -void cornellboxMirrorScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - const auto mirror = std::make_shared(Vec3f(0.9)); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto smallSphere = - std::make_shared(Vec3f(1.5f, 1.0f, 1.5), 1.0f); - const auto bigSphere = - std::make_shared(Vec3f(3.75f, 1.5f, 3.5f), 1.5f); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(smallSphere, mirror)); - scene.addPrimitive(Primitive(bigSphere, mirror)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - -void cornellboxGlassScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - const auto glass = std::make_shared(Vec3f(0.99), 1.5f); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto smallSphere = - std::make_shared(Vec3f(1.5f, 1.0f, 1.5), 1.0f); - const auto bigSphere = - std::make_shared(Vec3f(3.75f, 1.5f, 3.5f), 1.5f); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(smallSphere, glass)); - scene.addPrimitive(Primitive(bigSphere, glass)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - int main() { const int width = 512; const int height = 512; @@ -154,15 +16,15 @@ int main() { const int n_estimation_caustics = 100; const bool final_gathering = true; const int max_depth = 100; - const Vec3f camPos(2.78, 2.73, -9); - const Vec3f lookAt(2.78, 2.73, 2.796); + const Vec3f camPos(0, 1, 7); + const Vec3f lookAt(0, 1, 0); Image image(width, height); const Camera camera(camPos, normalize(lookAt - camPos), 0.25 * PI); Scene scene; - cornellboxGlassScene(scene); + scene.loadModel("CornellBox-Original.obj"); scene.build(); // photon tracing and build photon map diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a3ebafd..5966580 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,12 +4,6 @@ target_link_libraries(test_image PRIVATE pm) add_executable(test_camera "test_camera.cpp") target_link_libraries(test_camera PRIVATE pm) -add_executable(test_sphere "test_sphere.cpp") -target_link_libraries(test_sphere PRIVATE pm) - -add_executable(test_plane "test_plane.cpp") -target_link_libraries(test_plane PRIVATE pm) - add_executable(test_intersector "test_intersector.cpp") target_link_libraries(test_intersector PRIVATE pm) diff --git a/tests/test_intersector.cpp b/tests/test_intersector.cpp index 85a861c..7e62458 100644 --- a/tests/test_intersector.cpp +++ b/tests/test_intersector.cpp @@ -1,31 +1,16 @@ #include "camera.h" #include "image.h" -#include "primitive.h" #include "scene.h" int main() { const int width = 512; const int height = 512; - const auto sphere_shape = std::make_shared(Vec3f(0, 1, 0), 1.0f); - const auto sphere2_shape = std::make_shared(Vec3f(-1, 1, -1), 1.0f); - const auto sphere3_shape = std::make_shared(Vec3f(1, 1, 1), 1.0f); - const auto floor_shape = std::make_shared( - Vec3f(5, 0, -5), Vec3f(-10, 0, 0), Vec3f(0, 0, 10)); - - const Primitive floor(floor_shape, nullptr); - const Primitive sphere(sphere_shape, nullptr); - const Primitive sphere2(sphere2_shape, nullptr); - const Primitive sphere3(sphere3_shape, nullptr); - Scene scene; - scene.addPrimitive(floor); - scene.addPrimitive(sphere); - scene.addPrimitive(sphere2); - scene.addPrimitive(sphere3); + scene.loadModel("CornellBox-Original.obj"); scene.build(); - Camera camera(Vec3f(0, 1, 5), Vec3f(0, 0, -1)); + Camera camera(Vec3f(0, 1, 7), Vec3f(0, 0, -1), 0.25f * PI); Image image(width, height); for (int i = 0; i < height; ++i) { diff --git a/tests/test_path_tracing.cpp b/tests/test_path_tracing.cpp index 5a4e54a..fa9da1b 100644 --- a/tests/test_path_tracing.cpp +++ b/tests/test_path_tracing.cpp @@ -4,160 +4,19 @@ #include "image.h" #include "integrator.h" #include "photon_map.h" -#include "primitive.h" #include "scene.h" -// cornellbox -void cornellboxScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto shortBox1 = std::make_shared( - Vec3f(1.3, 1.65, 0.65), Vec3f(-0.48, 0, 1.6), Vec3f(1.6, 0, 0.49)); - const auto shortBox2 = std::make_shared( - Vec3f(2.9, 0, 1.14), Vec3f(0, 1.65, 0), Vec3f(-0.5, 0, 1.58)); - const auto shortBox3 = std::make_shared( - Vec3f(1.3, 0, 0.65), Vec3f(0, 1.65, 0), Vec3f(1.6, 0, 0.49)); - const auto shortBox4 = std::make_shared( - Vec3f(0.82, 0, 2.25), Vec3f(0, 1.65, 0), Vec3f(0.48, 0, -1.6)); - const auto shortBox5 = std::make_shared( - Vec3f(2.4, 0, 2.72), Vec3f(0, 1.65, 0), Vec3f(-1.58, 0, -0.47)); - - const auto tallBox1 = std::make_shared( - Vec3f(4.23, 3.30, 2.47), Vec3f(-1.58, 0, 0.49), Vec3f(0.49, 0, 1.59)); - const auto tallBox2 = std::make_shared( - Vec3f(4.23, 0, 2.47), Vec3f(0, 3.3, 0), Vec3f(0.49, 0, 1.59)); - const auto tallBox3 = std::make_shared( - Vec3f(4.72, 0, 4.06), Vec3f(0, 3.3, 0), Vec3f(-1.58, 0, 0.5)); - const auto tallBox4 = std::make_shared( - Vec3f(3.14, 0, 4.56), Vec3f(0, 3.3, 0), Vec3f(-0.49, 0, -1.6)); - const auto tallBox5 = std::make_shared( - Vec3f(2.65, 0, 2.96), Vec3f(0, 3.3, 0), Vec3f(1.58, 0, -0.49)); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(shortBox1, white)); - scene.addPrimitive(Primitive(shortBox2, white)); - scene.addPrimitive(Primitive(shortBox3, white)); - scene.addPrimitive(Primitive(shortBox4, white)); - scene.addPrimitive(Primitive(shortBox5, white)); - scene.addPrimitive(Primitive(tallBox1, white)); - scene.addPrimitive(Primitive(tallBox2, white)); - scene.addPrimitive(Primitive(tallBox3, white)); - scene.addPrimitive(Primitive(tallBox4, white)); - scene.addPrimitive(Primitive(tallBox5, white)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - -// cornellbox with mirror sphere -void cornellboxMirrorScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - const auto mirror = std::make_shared(Vec3f(0.9)); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto smallSphere = - std::make_shared(Vec3f(1.5f, 1.0f, 1.5), 1.0f); - const auto bigSphere = - std::make_shared(Vec3f(3.75f, 1.5f, 3.5f), 1.5f); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(smallSphere, mirror)); - scene.addPrimitive(Primitive(bigSphere, mirror)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - -void cornellboxGlassScene(Scene& scene) { - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - const auto glass = std::make_shared(Vec3f(0.99), 1.5f); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto smallSphere = - std::make_shared(Vec3f(1.5f, 1.0f, 1.5), 1.0f); - const auto bigSphere = - std::make_shared(Vec3f(3.75f, 1.5f, 3.5f), 1.5f); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); - - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(smallSphere, glass)); - scene.addPrimitive(Primitive(bigSphere, glass)); - scene.addPrimitive(Primitive(light_shape, white, light)); -} - int main() { const int width = 512; const int height = 512; - const int n_samples = 10000; + const int n_samples = 100; const int max_depth = 100; - const Vec3f camPos(2.78, 2.73, -9); - const Vec3f lookAt(2.78, 2.73, 2.796); Image image(width, height); - - const Camera camera(camPos, normalize(lookAt - camPos), 0.25 * PI); + Camera camera(Vec3f(0, 1, 7), Vec3f(0, 0, -1), 0.25 * PI); Scene scene; - cornellboxGlassScene(scene); + scene.loadModel("CornellBox-Original.obj"); scene.build(); // photon tracing and build photon map diff --git a/tests/test_plane.cpp b/tests/test_plane.cpp deleted file mode 100644 index cb4a044..0000000 --- a/tests/test_plane.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "camera.h" -#include "image.h" -#include "primitive.h" - -int main() { - const int width = 512; - const int height = 512; - Image image(width, height); - - const auto shape = std::make_shared(Vec3f(2.5, 0, -2.5), - Vec3f(-5, 0, 0), Vec3f(0, 0, 5)); - const Primitive plane(shape, nullptr); - - Camera camera(Vec3f(0, 3, 3), Vec3f(0, 0, -1)); - - for (int i = 0; i < height; ++i) { - for (int j = 0; j < width; ++j) { - const float u = (2.0f * j - width) / height; - const float v = (2.0f * i - height) / height; - - Ray ray; - float pdf; - if (camera.sampleRay(Vec2f(u, v), ray, pdf)) { - IntersectInfo info; - if (plane.intersect(ray, info)) { - image.setPixel(i, j, 0.5f * (info.surfaceInfo.normal + 1.0f)); - } - } else { - image.setPixel(i, j, Vec3f(0)); - } - } - } - - image.writePPM("output.ppm"); - - return 0; -} \ No newline at end of file diff --git a/tests/test_sphere.cpp b/tests/test_sphere.cpp deleted file mode 100644 index 5db9d59..0000000 --- a/tests/test_sphere.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "camera.h" -#include "image.h" -#include "primitive.h" - -int main() { - const int width = 512; - const int height = 512; - - const auto shape = std::make_shared(Vec3f(0), 1.0f); - const Primitive sphere(shape, nullptr); - - Camera camera(Vec3f(0, 0, 3), Vec3f(0, 0, -1)); - - Image image(width, height); - for (int i = 0; i < height; ++i) { - for (int j = 0; j < width; ++j) { - const float u = (2.0f * j - width) / height; - const float v = (2.0f * i - height) / height; - - Ray ray; - float pdf; - if (camera.sampleRay(Vec2f(u, v), ray, pdf)) { - IntersectInfo info; - if (sphere.intersect(ray, info)) { - image.setPixel(i, j, 0.5f * (info.surfaceInfo.normal + 1.0f)); - } - } else { - image.setPixel(i, j, Vec3f(0)); - } - } - } - - image.writePPM("output.ppm"); - - return 0; -} \ No newline at end of file diff --git a/tests/visualize_photon_map.cpp b/tests/visualize_photon_map.cpp index 2ae0ce8..9c8f642 100644 --- a/tests/visualize_photon_map.cpp +++ b/tests/visualize_photon_map.cpp @@ -4,7 +4,6 @@ #include "image.h" #include "integrator.h" #include "photon_map.h" -#include "primitive.h" #include "scene.h" int main() { @@ -12,73 +11,12 @@ int main() { const int height = 512; const int n_photons = 1000000; const int max_depth = 100; - const Vec3f camPos(2.78, 2.73, -9); - const Vec3f lookAt(2.78, 2.73, 2.796); Image image(width, height); - - const Camera camera(camPos, normalize(lookAt - camPos), 0.25 * PI); - - // cornellbox scene - const auto white = std::make_shared(Vec3f(0.8)); - const auto red = std::make_shared(Vec3f(0.8, 0.05, 0.05)); - const auto green = std::make_shared(Vec3f(0.05, 0.8, 0.05)); - - const auto floor = - std::make_shared(Vec3f(0), Vec3f(0, 0, 5.592), Vec3f(5.56, 0, 0)); - const auto rightWall = - std::make_shared(Vec3f(0), Vec3f(0, 5.488, 0), Vec3f(0, 0, 5.592)); - const auto leftWall = std::make_shared( - Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0)); - const auto ceil = std::make_shared( - Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0), Vec3f(0, 0, 5.592)); - const auto backWall = std::make_shared( - Vec3f(0, 0, 5.592), Vec3f(0, 5.488, 0), Vec3f(5.56, 0, 0)); - - const auto shortBox1 = std::make_shared( - Vec3f(1.3, 1.65, 0.65), Vec3f(-0.48, 0, 1.6), Vec3f(1.6, 0, 0.49)); - const auto shortBox2 = std::make_shared( - Vec3f(2.9, 0, 1.14), Vec3f(0, 1.65, 0), Vec3f(-0.5, 0, 1.58)); - const auto shortBox3 = std::make_shared( - Vec3f(1.3, 0, 0.65), Vec3f(0, 1.65, 0), Vec3f(1.6, 0, 0.49)); - const auto shortBox4 = std::make_shared( - Vec3f(0.82, 0, 2.25), Vec3f(0, 1.65, 0), Vec3f(0.48, 0, -1.6)); - const auto shortBox5 = std::make_shared( - Vec3f(2.4, 0, 2.72), Vec3f(0, 1.65, 0), Vec3f(-1.58, 0, -0.47)); - - const auto tallBox1 = std::make_shared( - Vec3f(4.23, 3.30, 2.47), Vec3f(-1.58, 0, 0.49), Vec3f(0.49, 0, 1.59)); - const auto tallBox2 = std::make_shared( - Vec3f(4.23, 0, 2.47), Vec3f(0, 3.3, 0), Vec3f(0.49, 0, 1.59)); - const auto tallBox3 = std::make_shared( - Vec3f(4.72, 0, 4.06), Vec3f(0, 3.3, 0), Vec3f(-1.58, 0, 0.5)); - const auto tallBox4 = std::make_shared( - Vec3f(3.14, 0, 4.56), Vec3f(0, 3.3, 0), Vec3f(-0.49, 0, -1.6)); - const auto tallBox5 = std::make_shared( - Vec3f(2.65, 0, 2.96), Vec3f(0, 3.3, 0), Vec3f(1.58, 0, -0.49)); - - const auto light_shape = std::make_shared( - Vec3f(3.43, 5.486, 2.27), Vec3f(0, 0, 1.05), Vec3f(-1.3, 0, 0)); - const auto light = - std::make_shared(Vec3f(34, 19, 10), light_shape); + Camera camera(Vec3f(0, 1, 7), Vec3f(0, 0, -1), 0.25 * PI); Scene scene; - scene.addPrimitive(Primitive(floor, white)); - scene.addPrimitive(Primitive(rightWall, red)); - scene.addPrimitive(Primitive(leftWall, green)); - scene.addPrimitive(Primitive(ceil, white)); - scene.addPrimitive(Primitive(backWall, white)); - scene.addPrimitive(Primitive(shortBox1, white)); - scene.addPrimitive(Primitive(shortBox2, white)); - scene.addPrimitive(Primitive(shortBox3, white)); - scene.addPrimitive(Primitive(shortBox4, white)); - scene.addPrimitive(Primitive(shortBox5, white)); - scene.addPrimitive(Primitive(tallBox1, white)); - scene.addPrimitive(Primitive(tallBox2, white)); - scene.addPrimitive(Primitive(tallBox3, white)); - scene.addPrimitive(Primitive(tallBox4, white)); - scene.addPrimitive(Primitive(tallBox5, white)); - scene.addPrimitive(Primitive(light_shape, white, light)); + scene.loadModel("CornellBox-Original.obj"); scene.build(); // photon tracing and build photon map