RayTracer 1.0
Ray tracing is a technique used to generate realistic digital images by simulating the inverse path of light. Our goal is to create a program able to generate an image from a file describing the scene.
 
Loading...
Searching...
No Matches
main.cpp File Reference
#include <thread>
#include <cmath>
#include <algorithm>
#include <limits>
#include "../include/Main.hpp"
#include "../include/Exception.hpp"
#include "../include/Utils.hpp"
#include "../include/Display.hpp"
#include "../include/ConfigParser.hpp"
#include "../include/IMaterial.hpp"
#include "../include/AmbientLight.hpp"
#include "../include/DirectionalLight.hpp"
#include "../include/PointLight.hpp"
#include "../include/Sphere.hpp"
#include "../include/Plane.hpp"
#include "../include/Camera.hpp"
#include "../include/Scene.hpp"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 264 of file main.cpp.

265{
266 try {
267 Main main;
268 std::string file;
269 bool isDebug = false;
270 main.parseArguments(argc, argv, file, isDebug);
271
272 auto cfg = Config::parseScene(file);
273
274 if (isDebug) {
275 main.debug_config(cfg);
276 return 0;
277 }
278
279 Display display(cfg.camera.width, cfg.camera.height);
280 display.init();
281 std::thread worker(&Main::calculPPM, &main, cfg, std::ref(display));
282 display.run();
283 if (worker.joinable())
284 worker.join();
285
286 } catch (const RayTracerException &e) {
287 std::cerr << e.what() << std::endl;
288 return 84;
289 }
290
291 return 0;
292}
Definition Main.hpp:13
void calculPPM(const Config::Scene &cfg, Display &display)
Definition main.cpp:85
int main(int argc, char **argv)
Definition main.cpp:264
Scene parseScene(const std::string &path)

References Main::calculPPM(), Display::init(), main(), Config::parseScene(), and Display::run().