diff --git a/ex1.cpp b/ex1.cpp index a85f07b..0461208 100644 --- a/ex1.cpp +++ b/ex1.cpp @@ -10,8 +10,7 @@ #include "shader/flatshader.h" -int main() -{ +int main() { // Let's create a simple cornell box scene... SimpleScene scene; @@ -19,7 +18,6 @@ int main() auto red = std::make_shared(Color(1.0f, 0.3f, 0.2f)); auto white = std::make_shared(Color(1.0f, 1.0f, 1.0f)); auto blue = std::make_shared(Color(0.2f, 0.3f, 1.0f)); - auto black = std::make_shared(Color(0, 0, 0)); // Add shaders for the objects auto green = std::make_shared(Color(0.0f, 1.0f, 0.0f)); @@ -27,7 +25,7 @@ int main() auto orange = std::make_shared(Color(1.0f, 0.5f, 0.0f)); // Set up the cornell box walls - scene.add(std::make_shared(Vector3d(0.0f, 0.0f, +5.0f), Vector3d(0.0f, 0.0f, -1.0f), black)); + scene.add(std::make_shared(Vector3d(0.0f, 0.0f, +5.0f), Vector3d(0.0f, 0.0f, -1.0f), purple)); scene.add(std::make_shared(Vector3d(0.0f, 0.0f, -5.0f), Vector3d(0.0f, 0.0f, +1.0f), purple)); scene.add(std::make_shared(Vector3d(0.0f, +5.0f, 0.0f), Vector3d(0.0f, -1.0f, 0.0f), white)); scene.add(std::make_shared(Vector3d(0.0f, -5.0f, 0.0f), Vector3d(0.0f, +1.0f, 0.0f), white)); @@ -35,16 +33,16 @@ int main() scene.add(std::make_shared(Vector3d(-5.0f, 0.0f, 0.0f), Vector3d(+1.0f, 0.0f, 0.0f), red)); // Add a sphere - scene.add(std::make_shared(Vector3d(0.0f, 0.0f, 0.0f), 0.5f, green)); - scene.add(std::make_shared(Vector3d(0.5f, 0.0f, 0.0f), Vector3d(-0.5f, 0.0f, 0.0f), - Vector3d(0.0f, 0.0f, 0.5f), orange)); + scene.add(std::make_shared(Vector3d(-3.0f, 0.0f, 0.0f), 1.5f, green)); + scene.add(std::make_shared(Vector3d(0.0f, -5.0f, -4.0f), Vector3d(0.0f, -3.0f, 0.0f), + Vector3d(5.0f, -2.0f, -3.0f), orange)); // Set up the camera PerspectiveCamera camera; camera.setFovAngle(70); - camera.setPosition(Vector3d(0.0f, 4.0f, 0.0f)); - camera.setForwardDirection(Vector3d(0.0f, -1.0f, 0.0f)); - camera.setUpDirection(Vector3d(0.0f, 0.0f, 1.0f)); + camera.setPosition(Vector3d(-2.5f, 2.5f, -10.0f)); + camera.setForwardDirection(Vector3d(0.25f, -0.33f, 1.0f)); + camera.setUpDirection(Vector3d(0.2f, 1.0f, 0.0f)); // Render the scene SimpleRenderer renderer;