-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
34 lines (27 loc) · 1.13 KB
/
main.cpp
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
29
30
31
32
33
34
#include <iostream>
#include <chrono>
#include "ToonViewerApp.hpp"
using namespace GLOO;
int main(int argc, char** argv) {
// Populate the executable directory we're running the project from
SetProjectExecutableDir(argv[0]);
// After populating the base path, update the rest of the path names from the gloo.cfg file.
UpdateRelativePathsFromConfig();
// Populate the model to render with if it's specified
std::string filename = argc >= 2 ? std::string(argv[1]) : "";
auto app = make_unique<ToonViewerApp>("NPR Studio", glm::ivec2(1440, 900), filename);
app->SetupScene();
using Clock = std::chrono::high_resolution_clock;
using TimePoint =
std::chrono::time_point<Clock, std::chrono::duration<double>>;
TimePoint last_tick_time = Clock::now();
TimePoint start_tick_time = last_tick_time;
while (!app->IsFinished()) {
TimePoint current_tick_time = Clock::now();
double delta_time = (current_tick_time - last_tick_time).count();
double total_elapsed_time = (current_tick_time - start_tick_time).count();
app->Tick(delta_time, total_elapsed_time);
last_tick_time = current_tick_time;
}
return 0;
}