dear-implot3d
High-level Rust bindings for ImPlot3D, integrating with dear-imgui-rs.
This crate sits on top of dear-implot3d-sys (FFI to cimplot3d) and mirrors
the ergonomics of dear-implot.
Links
- Upstream: https://github.com/brenocq/implot3d
- C API: https://github.com/cimgui/cimplot3d
Compatibility
| Item | Version |
|---|---|
| Crate | 0.5.x |
| dear-imgui-rs | 0.5.x |
| dear-implot3d-sys | 0.5.x |
See also: docs/COMPATIBILITY.md in the workspace for the full matrix.
Features
- Safe, idiomatic Rust API - Type-safe wrappers over the C API
- Builder pattern - Fluent API for configuring plots
- RAII tokens - Automatic cleanup with
Plot3DToken - Type-safe flags - Using
bitflags!for compile-time safety - Modular plot types - Separate modules for each plot type
- f32/f64 support - Separate functions for different numeric types
- Optional
mintsupport - Interoperability with math libraries (glam, nalgebra, cgmath, etc.) - Predefined meshes - Cube, sphere meshes included
- Comprehensive API - Line, scatter, surface, triangle, quad, mesh, image, and text plots
Quick Start
use *;
use *;
let mut imgui_ctx = create;
let plot3d_ctx = create;
// In your main loop:
let ui = imgui_ctx.frame;
let plot_ui = plot3d_ctx.get_plot_ui;
if let Some = plot_ui.begin_plot
.size
.build
Examples
See examples/implot3d_basic.rs for a comprehensive demo that replicates the official ImPlot3D C++ demo.
Run with:
Predefined Meshes
The meshes module provides ready-to-use mesh data:
use *;
// Cube (8 vertices, 36 indices)
plot_ui.mesh.plot;
// Sphere (162 vertices, 960 indices)
plot_ui.mesh.plot;
Mint Support
When the mint feature is enabled, you can use mint::Point3<f32> types:
use Point3;
let points = vec!;
plot_ui.plot_line_mint;
Notes
- The underlying C API comes from
cimplot3dwhich depends onimplot3d. Ensure git submodules are initialized with--recursive.
License
See workspace root.