MCPcopy Create free account
hub / github.com/brenocq/implot3d / RenderPlotBackground

Function RenderPlotBackground

implot3d.cpp:711–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711void RenderPlotBackground(ImDrawList* draw_list, const ImPlot3DPlot& plot, const ImVec2* corners_pix, const bool* active_faces, const int plane_2d,
712 const int axis_corners[3][2]) {
713 const ImVec4 col_bg = GetStyleColorVec4(ImPlot3DCol_PlotBg);
714 const ImVec4 col_bg_hov = col_bg + ImVec4(0.03f, 0.03f, 0.03f, 0.0f);
715
716 int hovered_plane = -1;
717 if (!plot.Held) {
718 // If the mouse is not held, highlight plane hovering when mouse over it
719 hovered_plane = GetMouseOverPlane(active_faces, corners_pix);
720 if (GetMouseOverAxis(plot, corners_pix, plane_2d, axis_corners) != -1)
721 hovered_plane = -1;
722 } else {
723 // If the mouse is held, highlight the held plane
724 hovered_plane = plot.HeldPlaneIdx;
725 }
726
727 for (int a = 0; a < 3; a++) {
728 int idx[4]; // Corner indices
729 for (int i = 0; i < 4; i++)
730 idx[i] = faces[a + 3 * active_faces[a]][i];
731 const ImU32 col = ImGui::ColorConvertFloat4ToU32((hovered_plane == a) ? col_bg_hov : col_bg);
732 draw_list->AddQuadFilled(corners_pix[idx[0]], corners_pix[idx[1]], corners_pix[idx[2]], corners_pix[idx[3]], col);
733 }
734}
735
736void RenderAxisRects(ImDrawList* draw_list, const ImPlot3DPlot& plot, const ImVec2* corners_pix, const bool*, const int plane_2d,
737 const int axis_corners[3][2]) {

Callers 1

RenderPlotBoxFunction · 0.85

Calls 3

GetStyleColorVec4Function · 0.85
GetMouseOverPlaneFunction · 0.85
GetMouseOverAxisFunction · 0.85

Tested by

no test coverage detected