Skip to content

Commit

Permalink
add: support for --fast flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabolol committed May 9, 2024
1 parent 3e0821a commit 12a8141
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sources/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ int main(int argc, char **argv)
{
Raytracer::Config::Manager manager;

if (argc != 2) {
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <config file>" << std::endl;
return 84;
}

std::string flag = "--fast";
bool fast = std::find(argv, argv + argc, flag) != argv + argc;
auto path = std::find_if(argv + 1, argv + argc, [](const char *arg) {
return arg[0] != '-';
});

try {
manager.parse(argv[1]);
manager.parse(*path);
manager.bootstrap();
manager.render();
manager.render(fast);
} catch (const Raytracer::Exceptions::Base &e) {
std::cerr << e.what() << std::endl;
return 84;
Expand Down

0 comments on commit 12a8141

Please sign in to comment.