progress indicator back.

This commit is contained in:
Michal Marcinkowski
2015-02-18 19:51:57 -05:00
parent 971381b150
commit 88c976e16e

View File

@@ -435,19 +435,42 @@ namespace openspace {
// GUI PRINT
// Using a macro to shorten line length and increase readability
#define PrintText(i, format, ...) Freetype::print(font, 10, static_cast<float>(startY - font_size_mono * i * 2), format, __VA_ARGS__);
#define PrintText(i, format, size, ...) Freetype::print(font, size, static_cast<float>(startY - font_size_mono * i * 2), format, __VA_ARGS__);
#define PrintColorText(i, format, size, color, ...) Freetype::print(font, size, static_cast<float>(startY - font_size_mono * i * 2), color, format, __VA_ARGS__);
int i = 0;
PrintText(i++, "Date: %s", Time::ref().currentTimeUTC().c_str());
PrintText(i++, "Avg. Frametime: %.5f", sgct::Engine::instance()->getAvgDt());
PrintText(i++, "Drawtime: %.5f", sgct::Engine::instance()->getDrawTime());
PrintText(i++, "Frametime: %.5f", sgct::Engine::instance()->getDt());
PrintText(i++, "Origin: (% .5f, % .5f, % .5f, % .5f)", origin[0], origin[1], origin[2], origin[3]);
PrintText(i++, "Cam pos: (% .5f, % .5f, % .5f, % .5f)", position[0], position[1], position[2], position[3]);
PrintText(i++, "View dir: (% .5f, % .5f, % .5f)", viewdirection[0], viewdirection[1], viewdirection[2]);
PrintText(i++, "Cam->origin: (% .15f, % .4f)", pssl[0], pssl[1]);
PrintText(i++, "Scaling: (% .5f, % .5f)", scaling[0], scaling[1]);
PrintText(i++, "Date: %s", 20, Time::ref().currentTimeUTC().c_str());
PrintText(i++, "Avg. Frametime: %.5f", 10, sgct::Engine::instance()->getAvgDt());
PrintText(i++, "Drawtime: %.5f", 10, sgct::Engine::instance()->getDrawTime());
PrintText(i++, "Frametime: %.5f", 10, sgct::Engine::instance()->getDt());
PrintText(i++, "Origin: (% .5f, % .5f, % .5f, % .5f)", 10, origin[0], origin[1], origin[2], origin[3]);
PrintText(i++, "Cam pos: (% .5f, % .5f, % .5f, % .5f)", 10, position[0], position[1], position[2], position[3]);
PrintText(i++, "View dir: (% .5f, % .5f, % .5f)", 10, viewdirection[0], viewdirection[1], viewdirection[2]);
PrintText(i++, "Cam->origin: (% .15f, % .4f)", 10, pssl[0], pssl[1]);
PrintText(i++, "Scaling: (% .5f, % .5f)", 10, scaling[0], scaling[1]);
double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - Time::ref().currentTime();
double t = 0.0;
t = 1.f - remaining / openspace::ImageSequencer::ref().getIntervalLength();
std::string progress = "|";
int g = ((t)* 20) + 1;
for (int i = 0; i < g; i++) progress.append("-"); progress.append(">");
for (int i = 0; i < 21 - g; i++) progress.append(" ");
std::string str = "";
openspace::SpiceManager::ref().getDateFromET(openspace::ImageSequencer::ref().getNextCaptureTime(), str);
progress.append("|");
if (remaining > 0){
glm::vec4 g1(0, t, 0, 1);
glm::vec4 g2(1 - t);
PrintColorText(i++, "Next projection in | %.0f seconds", 10, g1 + g2, remaining);
PrintColorText(i++, "%s %.1f %%", 10, g1 + g2, progress.c_str(), t * 100);
}
glm::vec4 w(1);
PrintColorText(i++, "Ucoming : %s", 10, w, str.c_str());
#undef PrintText
}