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

Function RenderPrimitivesEx

implot3d_items.cpp:1064–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1062
1063/// Renders primitive shapes (pre-built renderer variant)
1064template <class _Renderer> void RenderPrimitivesEx(const _Renderer& renderer) {
1065 ImPlot3DPlot& plot = *GetCurrentPlot();
1066 ImDrawList3D& draw_list_3d = plot.DrawList;
1067 ImPlot3DBox cull_box;
1068 if (ImHasFlag(plot.Flags, ImPlot3DFlags_NoClip)) {
1069 cull_box.Min = ImPlot3DPoint(-HUGE_VAL, -HUGE_VAL, -HUGE_VAL);
1070 cull_box.Max = ImPlot3DPoint(HUGE_VAL, HUGE_VAL, HUGE_VAL);
1071 } else {
1072 cull_box.Min = plot.RangeMin();
1073 cull_box.Max = plot.RangeMax();
1074 }
1075
1076 // Find how many can be reserved up to end of current draw command's limit
1077 unsigned int prims_to_render = ImMin(renderer.Prims, (ImDrawList3D::MaxIdx() - draw_list_3d._VtxCurrentIdx) / renderer.VtxConsumed);
1078
1079 // Reserve vertices and indices to render the primitives
1080 draw_list_3d.PrimReserve(prims_to_render * renderer.IdxConsumed, prims_to_render * renderer.VtxConsumed);
1081
1082 // Initialize renderer
1083 renderer.Init(draw_list_3d);
1084
1085 // Render primitives
1086 int num_culled = 0;
1087 for (unsigned int i = 0; i < prims_to_render; i++)
1088 if (!renderer.Render(draw_list_3d, cull_box, i))
1089 num_culled++;
1090 // Unreserve unused vertices and indices
1091 draw_list_3d.PrimUnreserve(num_culled * renderer.IdxConsumed, num_culled * renderer.VtxConsumed);
1092}
1093
1094/// Renders primitive shapes (single-template-param renderer convenience wrapper)
1095template <template <class> class _Renderer, class _Getter, typename... Args> void RenderPrimitives(const _Getter& getter, Args... args) {

Callers 3

RenderPrimitivesFunction · 0.85
RenderPrimitives2Function · 0.85
RenderPrimitives3Function · 0.85

Calls 9

GetCurrentPlotFunction · 0.85
ImHasFlagFunction · 0.85
ImPlot3DPointClass · 0.85
RangeMinMethod · 0.80
RangeMaxMethod · 0.80
PrimReserveMethod · 0.80
PrimUnreserveMethod · 0.80
InitMethod · 0.45
RenderMethod · 0.45

Tested by

no test coverage detected