#include #include #include "camera/perspectivecamera.h" #include "scene/fastscene.h" #ifdef SUPERRENDERER_FOUND #include "renderer/superrenderer.h" #endif #include "light/ambientlight.h" #include "light/pointlight.h" #include "shader/toneshader.h" #include "primitive/infiniteplane.h" #include "shader/simpleshadowshader.h" #include "primitive/box.h" #include "shader/cloudshader.h" #include "common/noise/perlinnoise.h" #include "shader/noiseshader.h" #include "common/noise/cloudnoise.h" int main() { FastScene scene; scene.setBackgroundColor(Color(0.529f, 0.808f, 0.922f)); // Add lights auto mainLight = std::make_shared(Vector3d(5.0f, 10.0f, 0.0f), 100.0f); scene.add(mainLight); scene.add(std::make_shared(0.3f)); // Add the bus auto busShader = std::make_shared(mainLight); scene.addObj("data/Bus/source/T07-11M.obj", Vector3d(1.0f, 1.0f, 1.0f), Vector3d(10.0f, 0.0f, 10.0f), busShader); // Add floor // auto noise = std::make_shared(32); // noise->invert = true; // auto noiseShader = std::make_shared(noise, 0.2f); auto noiseShader = std::make_shared(std::make_shared(256, 10), 0.02f); // auto floorShader = std::make_shared(Color(0.9f, 0.9f, 0.9f)); scene.add(std::make_shared(Vector3d(0.0f, 0.0f, 0.0f), Vector3d(0.0f, 1.0f, 0.0f), noiseShader)); // Add box for volume shader auto cloudSettings = CloudSettings(); cloudSettings.scale = 0.2f; cloudSettings.densityIntensity = 2.0f; cloudSettings.densityTreshold = 0.55f; auto cloudShader = std::make_shared(cloudSettings); scene.add(std::make_shared(Vector3d(5.0f, 6.0f, 5.0f), Vector3d(6.0f, 4.0f, 6.0f), cloudShader)); // build the tree scene.buildTree(); // Set up the camera PerspectiveCamera camera; camera.setPosition(Vector3d(0.0f, 3.0f, 0.0f)); camera.setForwardDirection(normalized(Vector3d(1.0f, 0.15f, 0.6f))); camera.setUpDirection(normalized(Vector3d(0.0f, 1.0f, 0.0f))); camera.setFovAngle(90.0f); // Render the scene SuperRenderer sr; sr.setSuperSamplingFactor(1); sr.renderImage(scene, camera, 1024, 1024).save("result.png"); return 0; }