dear_implot3d/lib.rs
1//! Dear ImPlot3D - Rust bindings (high level)
2//!
3//! Safe wrapper over `dear-implot3d-sys`, designed to integrate with
4//! `dear-imgui-rs`. Mirrors `dear-implot` design: context + Ui facade,
5//! builder-style helpers, optional `mint` inputs.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use dear_imgui_rs::*;
11//! use dear_implot3d::*;
12//!
13//! let mut imgui_ctx = Context::create();
14//! let plot3d_ctx = Plot3DContext::create(&imgui_ctx);
15//!
16//! // In your main loop:
17//! let ui = imgui_ctx.frame();
18//! let plot_ui = plot3d_ctx.get_plot_ui(&ui);
19//!
20//! if let Some(_token) = plot_ui.begin_plot("3D Plot").build() {
21//! let xs = [0.0, 1.0, 2.0];
22//! let ys = [0.0, 1.0, 0.0];
23//! let zs = [0.0, 0.5, 1.0];
24//! plot_ui.plot_line_f32("Line", &xs, &ys, &zs, Line3DFlags::NONE);
25//! }
26//! ```
27//!
28//! # Features
29//!
30//! - **mint**: Enable support for `mint` math types (Point3, Vector3)
31//!
32//! # Architecture
33//!
34//! This crate follows the same design patterns as `dear-implot`:
35//! - `Plot3DContext`: Manages the ImPlot3D context (create once)
36//! - `Plot3DUi`: Per-frame access to plotting functions
37//! - RAII tokens: `Plot3DToken` automatically calls `EndPlot` on drop
38//! - Builder pattern: Fluent API for configuring plots
39//! - Type-safe flags: Using `bitflags!` for compile-time safety
40
41pub(crate) use dear_imgui_rs::sys as imgui_sys;
42pub use dear_imgui_rs::{Context, Ui};
43pub(crate) use dear_implot3d_sys as sys;
44
45mod builder;
46mod compat_ffi;
47mod context;
48mod debug_state;
49mod demos;
50mod flags;
51mod image_builder;
52mod item_style;
53mod layout;
54mod mesh_builder;
55pub mod meshes;
56pub mod plots;
57mod style;
58mod surface_builder;
59mod ui;
60
61mod axis;
62
63pub use builder::Plot3DBuilder;
64pub use context::Plot3DContext;
65pub use flags::*;
66pub use image_builder::{Image3DByAxesBuilder, Image3DByCornersBuilder};
67pub use item_style::*;
68pub use layout::{Plot3DDataLayout, Plot3DDataOffset, Plot3DDataStride};
69pub use mesh_builder::Mesh3DBuilder;
70pub use plots::*;
71pub use style::*;
72pub use surface_builder::Surface3DBuilder;
73pub use ui::{Plot3DToken, Plot3DUi};
74
75pub(crate) use debug_state::{
76 debug_before_plot, debug_before_setup, debug_begin_plot, debug_end_plot,
77};
78pub(crate) use layout::{
79 axis_tick_count_to_i32, default_plot3d_spec, imvec2, imvec4, len_i32, plot3d_spec_from,
80 set_next_plot3d_spec, surface_count_to_i32, take_next_plot3d_spec, update_next_plot3d_spec,
81};