#include #include #include #include #include #include #include "camera/perspectivecamera.h" #include "renderer/simplerenderer.h" #include "scene/simplescene.h" #include "primitive/box.h" #include "primitive/infiniteplane.h" #include "primitive/sphere.h" #include "primitive/triangle.h" int main() { SimpleScene scene; scene.setBackgroundColor(Color(0, 0, 0)); // Add shaders auto red = std::make_shared(Color(1.0f, 0.3f, 0.2f)); auto gray = std::make_shared(Color(0.78f, 0.78f, 0.78f)); auto blue = std::make_shared(Color(0.2f, 0.3f, 1.0f)); auto orange = std::make_shared(Color(1.0f, 0.64f, 0.0f), 1.0f, Color(1.0f, 1.0f, 1.0f), 1.0f, 25.0f); scene.add(std::make_shared(Vector3d(5.0f, -5.0f, 0.0f), Vector3d(4.0f, 4.0f, 4.0f), red)); scene.add(std::make_shared(Vector3d(-5.0f, -3.0f, 1.0f), Vector3d(1.0f, 6.0f, 1.0f), blue)); scene.add(std::make_shared(Vector3d(-3.5f, 4.0f, -2.0f), Vector3d(2.0f, 2.0f, 2.0f), orange)); scene.add(std::make_shared(Vector3d(2.0f, 4.0f, 0.0f), 1.0f, orange)); scene.add(std::make_shared(Vector3d(0.0f, 0.0f, -11.0f), 100.0f)); // Set up the camera PerspectiveCamera camera; camera.setFovAngle(90.0f); camera.setPosition(Vector3d(0.0f, 0.0f, -10.0f)); camera.setForwardDirection(Vector3d(0.0f, 0.0f, 1.0f)); camera.setUpDirection(Vector3d(0.0f, 1.0f, 0.0f)); // Render the scene SimpleRenderer renderer; Texture img = renderer.renderImage(scene, camera, 512, 512); img.save("beforeBloom.png"); Bloom bloom = Bloom(img.getImage(), 0.88f, img); img.setTexture(bloom.bloom(100, 300.0f, 1.5f)); img.save("afterBloom.png"); return 0; }