| 167 | |
| 168 | |
| 169 | void CImGuiMainWnd::Render() |
| 170 | { |
| 171 | if (!RenderBegin()) |
| 172 | { |
| 173 | RenderEnd(); |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | ImGui::Text("OGSR Editor"); |
| 178 | |
| 179 | CImGuiEditor& editor = CImGuiEditor::Get(); |
| 180 | |
| 181 | for (auto& wnd : editor.Windows()) |
| 182 | { |
| 183 | if (wnd->m_bCanHide) |
| 184 | if (ImGui::Button(wnd->m_Name.c_str())) |
| 185 | wnd->m_Opened = !wnd->m_Opened; |
| 186 | } |
| 187 | |
| 188 | if (ImGui::Button("Demo Window")) |
| 189 | editor.m_bShowDemoWindow = !editor.m_bShowDemoWindow; |
| 190 | |
| 191 | bool full = editor.target_stage == EditorStage::Full; |
| 192 | if (ImGui::Checkbox("Active", &full)) |
| 193 | editor.target_stage = full ? EditorStage::Full : EditorStage::Light; |
| 194 | |
| 195 | const float framerate = ImGui::GetIO().Framerate; |
| 196 | |
| 197 | static xr_vector<float> frames; |
| 198 | |
| 199 | // Get frames |
| 200 | const size_t max_frames = static_cast<size_t>(ImGui::GetContentRegionAvail().x / 2.f); // Max frames to show |
| 201 | if (frames.size() > max_frames) |
| 202 | { |
| 203 | frames.resize(max_frames); |
| 204 | for (size_t i = 1; i < frames.size(); i++) |
| 205 | { |
| 206 | frames[i - 1] = frames[i]; |
| 207 | } |
| 208 | frames[frames.size() - 1] = framerate; |
| 209 | } |
| 210 | else |
| 211 | { |
| 212 | frames.push_back(framerate); |
| 213 | } |
| 214 | |
| 215 | ImGui::Text("TPS %.3f ms/frame (%.1f FPS)", 1000.0f / framerate, framerate); |
| 216 | |
| 217 | ImGui::PlotHistogram("##FPS", frames.data(), frames.size(), 0, nullptr, 0.0f, 300.0f, ImVec2{ImGui::GetContentRegionAvail().x, 100}); |
| 218 | |
| 219 | #ifdef TRACY_ENABLE |
| 220 | ImGui::Separator(); |
| 221 | |
| 222 | static int stack_levels = 8; |
| 223 | ImGui::SliderInt("Depth", &stack_levels, 0, 8); |
| 224 | |
| 225 | auto& perf = PIXEventsStatistics(); |
| 226 | for (size_t i = 0; i < perf.count; i++) |
no test coverage detected