-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (20 loc) · 839 Bytes
/
Copy pathmain.cpp
File metadata and controls
28 lines (20 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <thread>
#include <chrono>
#include "ConfigReader.h"
#include "PngWriter.h"
#include "RayCaster.h"
int main(const int argc, const char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: RayTracer [config]" << std::endl;
exit(1);
}
auto config = RayTracer::ConfigReader::readConfig(argv[1]);
auto start = std::chrono::high_resolution_clock::now();
const auto pic = RayTracer::RayCaster::castRays(config, config.numSamples, std::thread::hardware_concurrency(), config.maxBounces);
std::cout << "Elapsed time: " << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start).count() << "ms" << std::endl;
//std::cout << pic.getDebugView() << std::endl;
RayTracer::PngWriter::writePng(pic, config.outputPath);
}