diff --git a/include/bondRenderer.h b/include/bondRenderer.h index 15bba47..1ad61dd 100644 --- a/include/bondRenderer.h +++ b/include/bondRenderer.h @@ -50,7 +50,7 @@ class BondRenderer shader->setUniform("lightColour", glm::vec4(1.0f,1.0f,1.0f,1.0f)); shader->setUniform("ambientLight", 0.1f); setBondScale(1.0f); - setGlobalAlpha(globalAlpha); + setGlobalAlpha(1.0f); init(); for (const auto & ibonds : bonds) { diff --git a/include/consoleWindow.h b/include/consoleWindow.h index 0ae4c31..13f6a5b 100644 --- a/include/consoleWindow.h +++ b/include/consoleWindow.h @@ -77,6 +77,7 @@ This is free software, and you are welcome to redistribute it under certain cond Commands.push_back("CLEAR"); AutoScroll = true; ScrollToBottom = false; + focussed = false; addLog(std::string(banner)); } ~ConsoleWindow() diff --git a/include/infoWindow.h b/include/infoWindow.h index ef8ff34..2b002cb 100644 --- a/include/infoWindow.h +++ b/include/infoWindow.h @@ -35,13 +35,16 @@ void infoWindow const std::unique_ptr & structure, const Camera & camera, const VisualisationState & visualisationState, - const float & delta + const float delta ) { auto cx = fixedLengthNumber(camera.position().x, 6); auto cy = fixedLengthNumber(camera.position().y, 6); auto cz = fixedLengthNumber(camera.position().z, 6); + auto ift = fixedLengthNumber(delta,6); + auto fps = fixedLengthNumber(1.0/(delta*1e-3),4); + ImGui::Begin("Information"); unsigned size = std::ceil(structure->frameCount()/10.0); @@ -49,7 +52,7 @@ void infoWindow ImGui::Text("Frame %*lu / %*lu", size, visualisationState.frame+1, size, structure->frameCount()); ImGui::Text("Frame caching %s", (structure->framePositionsLoaded() ? "complete." : "in progress.")); ImGui::Text("Camera %s, %s, %s", cx.c_str(), cy.c_str(), cz.c_str()); - ImGui::Text("Frame Time (FPS) %s ms (%s)", fixedLengthNumber(delta,6).c_str(), fixedLengthNumber(1.0/(delta*1e-3),4).c_str()); + ImGui::Text("Frame Time (FPS) %s ms (%s)", ift.c_str(), fps.c_str()); ImGui::End(); } diff --git a/src/main.cpp b/src/main.cpp index 08aafa0..0a04098 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,7 +44,9 @@ int main(int argv, char ** argc) jGLInstance->setMSAA(options.msaa.value); double deltas[60]; - double delta = 0; + for (int i = 0; i < 60; i++) { deltas[i] = 0.0; } + + float delta = 0; unsigned frameId = 0; bool readInProgress = false; bool playBackward = false; @@ -351,7 +353,6 @@ int main(int argv, char ** argc) { setTransparencySorting(structure->atoms, atomRenderer, bondRenderer); } - visualisationState.elementsUpdated = false; } bondRenderer.draw(); @@ -371,9 +372,9 @@ int main(int argv, char ** argc) ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); - infoWindow(structure, camera, visualisationState, delta); CameraWindow().draw(options); consoleWindow.draw("Console", console); + infoWindow(structure, camera, visualisationState, delta); ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } @@ -457,6 +458,7 @@ int main(int argv, char ** argc) auto toc = std::chrono::high_resolution_clock::now(); deltas[frameId] = std::chrono::duration_cast(toc-tic).count(); frameId = (frameId+1) % 60; + visualisationState.elementsUpdated = false; } jGLInstance->finish();