mirror of
https://github.com/Zenithsiz/zsw.git
synced 2026-02-03 09:50:31 +00:00
frame_times::draw_plot now receives the duration indices directly.
This commit is contained in:
parent
fff2887cba
commit
b9e0e4b7f7
@ -13,7 +13,11 @@ use {
|
||||
};
|
||||
|
||||
/// Draws a frame time's plot
|
||||
fn draw_plot(ui: &mut egui::Ui, display: &FrameTimesDisplay, charts: impl IntoIterator<Item = egui_plot::BarChart>) {
|
||||
fn draw_plot<T, I, D>(ui: &mut egui::Ui, frame_times: &FrameTimes<T>, display: &FrameTimesDisplay, duration_idxs: I)
|
||||
where
|
||||
I: IntoIterator<Item = D>,
|
||||
D: DurationIdx<T>,
|
||||
{
|
||||
let legend = egui_plot::Legend::default().follow_insertion_order(true);
|
||||
|
||||
let plot = egui_plot::Plot::new("Render frame times")
|
||||
@ -26,6 +30,11 @@ fn draw_plot(ui: &mut egui::Ui, display: &FrameTimesDisplay, charts: impl IntoIt
|
||||
};
|
||||
|
||||
plot.show(ui, |plot_ui| {
|
||||
let mut prev_heights = vec![0.0; frame_times.len()];
|
||||
let charts = duration_idxs.into_iter().map(move |duration_idx| {
|
||||
self::create_frame_time_chart(frame_times, display, &mut prev_heights, &duration_idx)
|
||||
});
|
||||
|
||||
for chart in charts {
|
||||
plot_ui.bar_chart(chart);
|
||||
}
|
||||
|
||||
@ -11,12 +11,7 @@ use {
|
||||
pub fn draw(ui: &mut egui::Ui, render_frame_times: &mut FrameTimes<RenderFrameTime>) {
|
||||
let display = super::draw_display_settings(ui, render_frame_times);
|
||||
|
||||
let mut prev_heights = vec![0.0; render_frame_times.len()];
|
||||
let charts = DurationIdx::iter().map(|duration_idx| {
|
||||
super::create_frame_time_chart(render_frame_times, &display, &mut prev_heights, &duration_idx)
|
||||
});
|
||||
|
||||
super::draw_plot(ui, &display, charts);
|
||||
super::draw_plot(ui, render_frame_times, &display, DurationIdx::iter());
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
|
||||
@ -95,12 +95,7 @@ pub fn draw(ui: &mut egui::Ui, render_frame_times: &mut FrameTimes<RenderPanelsF
|
||||
)
|
||||
.sorted();
|
||||
|
||||
let mut prev_heights = vec![0.0; render_frame_times.len()];
|
||||
let charts = duration_idxs.map(|duration_idx| {
|
||||
super::create_frame_time_chart(render_frame_times, &display, &mut prev_heights, &duration_idx)
|
||||
});
|
||||
|
||||
super::draw_plot(ui, &display, charts);
|
||||
super::draw_plot(ui, render_frame_times, &display, duration_idxs);
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user