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

Method Render

implot3d_items.cpp:472–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470 void Init(ImDrawList3D& draw_list_3d) const { GetLineRenderProps(draw_list_3d, HalfWeight, UV0, UV1); }
471
472 IMPLOT3D_INLINE bool Render(ImDrawList3D& draw_list_3d, const ImPlot3DBox& cull_box, int prim) const {
473 // Get the next point in plot coordinates
474 ImPlot3DPoint P2_plot = Getter(prim + 1);
475 bool visible = false;
476
477 // Check for NaNs in P1_plot and P2_plot
478 if (!ImNan(P1_plot.x) && !ImNan(P1_plot.y) && !ImNan(P1_plot.z) && !ImNan(P2_plot.x) && !ImNan(P2_plot.y) && !ImNan(P2_plot.z)) {
479
480 // Clip the line segment to the culling box
481 ImPlot3DPoint P1_clipped, P2_clipped;
482 visible = cull_box.ClipLineSegment(P1_plot, P2_plot, P1_clipped, P2_clipped);
483
484 if (visible) {
485 // Convert clipped points to pixel coordinates
486 ImVec2 P1_screen = PlotToPixels(P1_clipped);
487 ImVec2 P2_screen = PlotToPixels(P2_clipped);
488 // Render the line segment
489 PrimLine(draw_list_3d, P1_screen, P2_screen, HalfWeight, ColGetter(prim), UV0, UV1, GetPointDepth((P1_plot + P2_plot) * 0.5));
490 }
491 }
492
493 // Update P1_plot if P2_plot is valid
494 if (!ImNan(P2_plot.x) && !ImNan(P2_plot.y) && !ImNan(P2_plot.z))
495 P1_plot = P2_plot;
496
497 return visible;
498 }
499
500 const _Getter& Getter;
501 const _GetterColor ColGetter;

Callers

nothing calls this directly

Calls 5

ImNanFunction · 0.85
PlotToPixelsFunction · 0.85
PrimLineFunction · 0.85
GetPointDepthFunction · 0.85
ClipLineSegmentMethod · 0.80

Tested by

no test coverage detected