pub struct Plot3DContext { /* private fields */ }Expand description
Plot3D context wrapper
This manages the ImPlot3D context lifetime. Create one instance per application and keep it alive for the duration of your program.
§Example
use dear_imgui_rs::*;
use dear_implot3d::*;
let mut imgui_ctx = Context::create();
let plot3d_ctx = Plot3DContext::create(&imgui_ctx);
// In your main loop:
let ui = imgui_ctx.frame();
let plot_ui = plot3d_ctx.get_plot_ui(&ui);Implementations§
Source§impl Plot3DContext
impl Plot3DContext
Sourcepub fn try_create(imgui: &Context) -> ImGuiResult<Self>
pub fn try_create(imgui: &Context) -> ImGuiResult<Self>
Try to create a new ImPlot3D context.
This should be called once after creating your ImGui context.
Sourcepub unsafe fn current() -> Option<Self>
pub unsafe fn current() -> Option<Self>
Get the current ImPlot3D context as a non-owning raw-context wrapper.
Returns None if no context is current.
§Safety
The returned value does not own the current ImPlot3D context and cannot prove that the associated ImGui context remains alive. The caller must ensure the raw ImPlot3D and ImGui contexts outlive the returned wrapper and are used on the same thread/context stack.
Sourcepub fn set_as_current(&self)
pub fn set_as_current(&self)
Set this context as the current ImPlot3D context.
Sourcepub fn raw_style_mut() -> *mut ImPlot3DStyle
pub fn raw_style_mut() -> *mut ImPlot3DStyle
Get a raw pointer to the current ImPlot3D style
This is an advanced function for direct style manipulation.
Prefer using the safe style functions in the style module.
Sourcepub unsafe fn raw(&self) -> *mut ImPlot3DContext
pub unsafe fn raw(&self) -> *mut ImPlot3DContext
Get the raw ImPlot3D context pointer.
§Safety
The caller must ensure the pointer is used safely and not stored beyond the lifetime of this context wrapper.
Sourcepub fn get_plot_ui<'ui>(&self, ui: &'ui Ui) -> Plot3DUi<'ui>
pub fn get_plot_ui<'ui>(&self, ui: &'ui Ui) -> Plot3DUi<'ui>
Get a per-frame plotting interface
Call this once per frame to get access to plotting functions.
The returned Plot3DUi is tied to the lifetime of the Ui frame.