| 4063 | } |
| 4064 | |
| 4065 | void ImPlot3D::ShowMetricsWindow(bool* p_popen) { |
| 4066 | static bool show_frame_rects = false; |
| 4067 | static bool show_canvas_rects = false; |
| 4068 | static bool show_plot_rects = false; |
| 4069 | static bool show_plot_box = false; |
| 4070 | static bool show_axis_line = false; |
| 4071 | static bool show_axis_corner_indexes = false; |
| 4072 | static bool show_axis_face_indexes = false; |
| 4073 | static bool show_axis_edge_indexes = false; |
| 4074 | static bool show_legend_rects = false; |
| 4075 | |
| 4076 | ImDrawList& fg = *ImGui::GetForegroundDrawList(); |
| 4077 | |
| 4078 | ImPlot3DContext& gp = *GImPlot3D; |
| 4079 | ImGuiIO& io = ImGui::GetIO(); |
| 4080 | ImGui::Begin("Metrics (ImPlot3D)", p_popen); |
| 4081 | ImGui::Text("ImPlot3D " IMPLOT3D_VERSION); |
| 4082 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 4083 | ImGui::Text("Mouse Position: [%.0f,%.0f]", io.MousePos.x, io.MousePos.y); |
| 4084 | ImGui::Separator(); |
| 4085 | if (ImGui::TreeNode("Tools")) { |
| 4086 | if (ImGui::Button("Bust Plot Cache")) |
| 4087 | BustPlotCache(); |
| 4088 | ImGui::SameLine(); |
| 4089 | if (ImGui::Button("Bust Item Cache")) |
| 4090 | BustItemCache(); |
| 4091 | ImGui::Checkbox("Show Frame Rects", &show_frame_rects); |
| 4092 | ImGui::Checkbox("Show Canvas Rects", &show_canvas_rects); |
| 4093 | ImGui::Checkbox("Show Plot Rects", &show_plot_rects); |
| 4094 | ImGui::Checkbox("Show Plot Box", &show_plot_box); |
| 4095 | ImGui::Checkbox("Show Axis Line", &show_axis_line); |
| 4096 | ImGui::Checkbox("Show Axis Corner Indexes", &show_axis_corner_indexes); |
| 4097 | ImGui::Checkbox("Show Axis Face Indexes", &show_axis_face_indexes); |
| 4098 | ImGui::Checkbox("Show Axis Edge Indexes", &show_axis_edge_indexes); |
| 4099 | ImGui::Checkbox("Show Legend Rects", &show_legend_rects); |
| 4100 | ImGui::TreePop(); |
| 4101 | } |
| 4102 | const int n_plots = gp.Plots.GetBufSize(); |
| 4103 | bool active_faces[3]; |
| 4104 | ImVec2 corners_pix[8]; |
| 4105 | ImPlot3DPoint corners[8]; |
| 4106 | int plane_2d = -1; |
| 4107 | int axis_corners[3][2]; |
| 4108 | char buff[16]; |
| 4109 | // Enum used to indicate how a certain type will be displayed |
| 4110 | enum class DisplayedType { |
| 4111 | Hidden, // Hidden type that is not displayed. Used when the object should not be displayed. Will be used when: |
| 4112 | // 1. 2D plot and this type should not be used, |
| 4113 | // 2. The flag show_plot_box is disabled |
| 4114 | Active, // Part of the faces of the box that are active |
| 4115 | NotActive // Part of the faces of the box that are not active when show_plot_box is active |
| 4116 | }; |
| 4117 | |
| 4118 | // Render rectangles |
| 4119 | for (int p = 0; p < n_plots; ++p) { |
| 4120 | ImPlot3DPlot& plot = *gp.Plots.GetByIndex(p); |
| 4121 | if (show_frame_rects) |
| 4122 | fg.AddRect(plot.FrameRect.Min, plot.FrameRect.Max, IM_COL32(255, 0, 255, 255)); |
nothing calls this directly
no test coverage detected