Skip to content

Feat: ImPlot3DSpec#169

Merged
brenocq merged 11 commits intomainfrom
feat/spec
Feb 14, 2026
Merged

Feat: ImPlot3DSpec#169
brenocq merged 11 commits intomainfrom
feat/spec

Conversation

@brenocq
Copy link
Copy Markdown
Owner

@brenocq brenocq commented Feb 12, 2026

Closes #166

As ImPlot is moving towards ImPlotSpec API as a replacement for the SetNextXX API (epezent/implot#519), ImPlot3D should do the same.

All plotting functions now take ImPlot3DSpec as argument.

How to use ImPlot3DSpec

There are two ways of populating the ImPlot3DSpec:
1. By declaring and defining a struct instance:

ImPlot3DSpec spec;
spec.LineColor = ImVec4(1,0,0,1);
spec.LineWeight = 2.0f;
spec.Marker = ImPlot3DMarker_Circle;
spec.Flags = ImPlot3DItemFlags_NoLegend | ImPlot3DLineFlags_Segments;
ImPlot3D::PlotLine("Line", xs, ys, zs, 100, spec);

2. Inline using ImPlot3DProp,value pairs (order does NOT matter):

 ImPlot3D::PlotLine("Line", xs, ys, zs, 100, {
 ImPlot3DProp_LineColor, ImVec4(1,0,0,1),
 ImPlot3DProp_LineWeight, 2.0f,
 ImPlot3DProp_Marker, ImPlot3DMarker_Circle,
 ImPlot3DProp_Flags, ImPlot3DItemFlags_NoLegend | ImPlot3DLineFlags_Segments
});

ImPlot3DSpec enum and structs:

// Plotting properties. These provide syntactic sugar for creating ImPlot3DSpec from (ImPlot3DProp,value) pairs
enum ImPlot3DProp_ {
    ImPlot3DProp_LineColor,       // Line color; IMPLOT3D_AUTO_COL will use next Colormap color
    ImPlot3DProp_LineWeight,      // Line weight in pixels
    ImPlot3DProp_FillColor,       // Fill color (applies to shaded regions); IMPLOT3D_AUTO_COL will use next Colormap color
    ImPlot3DProp_FillAlpha,       // Alpha multiplier (applies to FillColor and MarkerFillColor)
    ImPlot3DProp_Marker,          // Marker type
    ImPlot3DProp_MarkerSize,      // Size of markers (radius) *in pixels*
    ImPlot3DProp_MarkerLineColor, // Marker outline color; IMPLOT3D_AUTO_COL will use next LineColor
    ImPlot3DProp_MarkerFillColor, // Marker fill color; IMPLOT3D_AUTO_COL will use LineColor
    ImPlot3DProp_Offset,          // Data index offset
    ImPlot3DProp_Stride,          // Data stride in bytes; IMPLOT3D_AUTO will result in sizeof(T) where T is the type passed to PlotX
    ImPlot3DProp_Flags            // Optional item flags; can be composed from common ImPlot3DItemFlags and/or specialized ImPlot3DXFlags
};

...

struct ImPlot3DSpec {
    ImVec4 LineColor = IMPLOT3D_AUTO_COL;        // Line color; IMPLOT3D_AUTO_COL will use next Colormap color
    float LineWeight = 1.0f;                     // Line weight in pixels
    ImVec4 FillColor = IMPLOT3D_AUTO_COL;        // Fill color (applies to shaded regions); IMPLOT3D_AUTO_COL will use next Colormap color
    float FillAlpha = IMPLOT3D_AUTO;             // Alpha multiplier (applies to FillColor and MarkerFillColor)
    ImPlot3DMarker Marker = ImPlot3DMarker_Auto; // Marker type
    float MarkerSize = IMPLOT3D_AUTO;            // Size of markers (radius) *in pixels*
    ImVec4 MarkerLineColor = IMPLOT3D_AUTO_COL;  // Marker outline color; IMPLOT3D_AUTO_COL will use LineColor
    ImVec4 MarkerFillColor = IMPLOT3D_AUTO_COL;  // Marker fill color; IMPLOT3D_AUTO_COL will use LineColor
    int Offset = 0;                              // Data index offset
    int Stride = IMPLOT3D_AUTO;                  // Data stride in bytes; IMPLOT3D_AUTO will result in sizeof(T) where T is the type passed to PlotX
    ImPlot3DItemFlags Flags =
        ImPlot3DItemFlags_None; // Optional item flags; can be composed from common ImPlot3DItemFlags and/or specialized ImPlot3DXFlags

⚠️ Breaking changes

  • SetNextLineStyle has been removed, styling should be set via ImPlot3DSpec.
    // Before
    ImPlot3D::SetNextLineStyle(line_color, line_weight);
    ImPlot3D::PlotLine("Line", xs, ys, zs, count);
    
    // After
    ImPlot3DSpec spec;
    spec.LineColor = line_color;
    spec.LineWeight = line_weight;
    ImPlot3D::PlotLine("Line", xs, ys, zs, count, spec);
  • SetNextFillStyle has been removed, styling should be set via ImPlot3DSpec.
    // Before
    ImPlot3D::SetNextFillStyle(fill_color, fill_alpha);
    ImPlot3D::PlotTriangle("Triangle", xs, ys, zs, count);
    
    // After
    ImPlot3DSpec spec;
    spec.FillColor = fill_color;
    spec.FillAlpha = fill_alpha;
    ImPlot3D::PlotTriangle("Triangle", xs, ys, zs, count, spec);
  • SetNextMarkerStyle has been removed, styling should be set via ImPlot3DSpec.
    // Before
    ImPlot3D::SetNextMarkerStyle(marker, marker_size, fill_color, line_weight, marker_outline_color);
    ImPlot3D::PlotScatter("Scatter", xs, ys, zs, count);
    
    // After
    ImPlot3DSpec spec;
    spec.LineWeight = line_weight;
    spec.Marker = marker;
    spec.MarkerSize = marker_size;
    spec.MarkerLineColor = marker_outline_color;
    spec.MarkerFillColor = fill_color;
    ImPlot3D::PlotScatter("Scatter", xs, ys, zs, count, spec);
  • Flags, Offset and Stride should also be set via ImPlot3DSpec now.

@brenocq brenocq self-assigned this Feb 12, 2026
@brenocq brenocq added type:feat New feature or request prio:high High priority status:review The task is under review labels Feb 12, 2026
@brenocq brenocq linked an issue Feb 12, 2026 that may be closed by this pull request
3 tasks
@brenocq brenocq merged commit 0817902 into main Feb 14, 2026
9 checks passed
@brenocq brenocq deleted the feat/spec branch February 14, 2026 06:21
@github-actions github-actions bot added status:done Task completed successfully and removed status:review The task is under review labels Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:high High priority status:done Task completed successfully type:feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] ImPlot3DSpec

1 participant