ENABLE_RENDER_STATISTICS -> FPS averaged to last second

This commit is contained in:
enricoturri1966 2020-12-08 11:43:00 +01:00
parent 1185ec9d2a
commit bf3786be59
2 changed files with 23 additions and 16 deletions

View file

@ -1679,22 +1679,20 @@ void GLCanvas3D::render()
if (wxGetApp().plater()->is_render_statistic_dialog_visible()) {
ImGuiWrapper& imgui = *wxGetApp().imgui();
imgui.begin(std::string("Render statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
imgui.text("Last frame: ");
imgui.text("Last frame:");
ImGui::SameLine();
imgui.text(std::to_string(m_render_stats.last_frame));
long long average = m_render_stats.get_average();
imgui.text(std::to_string(average));
ImGui::SameLine();
imgui.text(" ms");
imgui.text("FPS: ");
imgui.text("ms");
imgui.text("FPS:");
ImGui::SameLine();
imgui.text(std::to_string(static_cast<int>(1000.0f / static_cast<float>(m_render_stats.last_frame))));
// imgui.text("Imgui FPS: ");
// ImGui::SameLine();
// imgui.text(std::to_string(static_cast<int>(ImGui::GetIO().Framerate)));
imgui.text(std::to_string((average == 0) ? 0 : static_cast<int>(1000.0f / static_cast<float>(average))));
ImGui::Separator();
imgui.text("Compressed textures: ");
imgui.text("Compressed textures:");
ImGui::SameLine();
imgui.text(OpenGLManager::are_compressed_textures_supported() ? "supported" : "not supported");
imgui.text("Max texture size: ");
imgui.text("Max texture size:");
ImGui::SameLine();
imgui.text(std::to_string(OpenGLManager::get_gl_info().get_max_tex_size()));
imgui.end();
@ -1707,8 +1705,6 @@ void GLCanvas3D::render()
std::string tooltip;
// Negative coordinate means out of the window, likely because the window was deactivated.
// In that case the tooltip should be hidden.
if (m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0.) {
@ -1745,7 +1741,7 @@ void GLCanvas3D::render()
#if ENABLE_RENDER_STATISTICS
auto end_time = std::chrono::high_resolution_clock::now();
m_render_stats.last_frame = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count();
m_render_stats.add_frame(std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count());
#endif // ENABLE_RENDER_STATISTICS
}