mirror of https://codeberg.org/topola/topola.git
feat(topola-egui): Replace "update timestep" with "step rate"
The term "timestep" is usually used to refer to a time step on some internal simulation time scale that is separate from the real time. There is however no time scale other than real time in Topola.
This commit is contained in:
parent
c163980073
commit
55ed4bf4cc
|
|
@ -41,7 +41,7 @@ pub struct MenuBar {
|
|||
pub show_primitive_indices: bool,
|
||||
pub show_appearance_panel: bool,
|
||||
pub fix_step_rate: bool,
|
||||
pub update_timestep: f32,
|
||||
pub step_rate: f32,
|
||||
}
|
||||
|
||||
impl MenuBar {
|
||||
|
|
@ -76,7 +76,7 @@ impl MenuBar {
|
|||
show_primitive_indices: false,
|
||||
show_appearance_panel: true,
|
||||
fix_step_rate: false,
|
||||
update_timestep: 0.25,
|
||||
step_rate: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -170,10 +170,13 @@ impl MenuBar {
|
|||
actions.debug.render_menu(ctx, ui, self);
|
||||
|
||||
ui.add_enabled_ui(self.fix_step_rate, |ui| {
|
||||
ui.label(tr.text("tr-menu-debug-update-timestep"));
|
||||
ui.label(tr.text("tr-menu-debug-step-rate"));
|
||||
ui.add(
|
||||
egui::widgets::Slider::new(&mut self.update_timestep, 0.01..=3.0)
|
||||
.suffix(" s"),
|
||||
egui::widgets::Slider::new(&mut self.step_rate, 100.0..=0.1)
|
||||
.suffix(format!(
|
||||
" {}",
|
||||
tr.text("tr-menu-debug-step-rate-unit")
|
||||
)),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ impl Viewport {
|
|||
workspace.advance_state_by_dt(
|
||||
tr,
|
||||
error_dialog,
|
||||
menu_bar.fix_step_rate.then_some(menu_bar.update_timestep),
|
||||
menu_bar.fix_step_rate.then_some(menu_bar.step_rate),
|
||||
&interactive_input,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,20 +76,18 @@ impl Workspace {
|
|||
&mut self,
|
||||
tr: &Translator,
|
||||
error_dialog: &mut ErrorDialog,
|
||||
maybe_update_timestep: Option<f32>,
|
||||
maybe_step_rate: Option<f32>,
|
||||
interactive_input: &InteractiveInput,
|
||||
) -> bool {
|
||||
let instant = Instant::now();
|
||||
|
||||
if maybe_update_timestep.is_some() {
|
||||
if maybe_step_rate.is_some() {
|
||||
self.update_counter += interactive_input.dt;
|
||||
}
|
||||
|
||||
while maybe_update_timestep
|
||||
.is_none_or(|update_timestep| self.update_counter >= update_timestep)
|
||||
{
|
||||
if let Some(update_timestep) = maybe_update_timestep {
|
||||
self.update_counter -= update_timestep;
|
||||
while maybe_step_rate.is_none_or(|step_rate| self.update_counter >= 1.0 / step_rate) {
|
||||
if let Some(step_rate) = maybe_step_rate {
|
||||
self.update_counter -= 1.0 / step_rate;
|
||||
}
|
||||
|
||||
if let ControlFlow::Break(()) = self.update_state(tr, error_dialog, interactive_input) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ tr-menu-debug-show-topo-navmesh = Show Topological Navmesh
|
|||
tr-menu-debug-show-bboxes = Show BBoxes
|
||||
tr-menu-debug-show-primitive-indices = Show Primitive Indices
|
||||
tr-menu-debug-fix-step-rate = Fix Step Rate
|
||||
tr-menu-debug-update-timestep = Update Timestep
|
||||
tr-menu-debug-step-rate = Step Rate
|
||||
tr-menu-debug-step-rate-unit = steps/s
|
||||
|
||||
tr-menu-help = Help
|
||||
tr-menu-help-online-documentation = Online Documentation
|
||||
|
|
@ -61,9 +62,9 @@ tr-menu-route-options-presort-by-pairwise-detours = Pairwise Detours
|
|||
|
||||
tr-menu-route-options-permutate = Permutate
|
||||
|
||||
## Continuously applied, so use frequentative or imperfective aspect if
|
||||
## possible, e.g. in Polish it should be "przeciskaj pod taśmami" (imperfective)
|
||||
## instead of "przeciśnij pod taśmami".
|
||||
## This refers to behavior that is continuously applied, so use frequentative or
|
||||
## imperfective aspect if possible, e.g. in Polish it should be "przeciskaj pod
|
||||
## taśmami" (imperfective) instead of "przeciśnij pod taśmami".
|
||||
|
||||
tr-menu-route-options-squeeze-through-under-bends = Squeeze through under Bends
|
||||
tr-menu-route-options-wrap-around-bands = Wrap around Bands
|
||||
|
|
@ -71,10 +72,6 @@ tr-menu-route-options-wrap-around-bands = Wrap around Bands
|
|||
##
|
||||
|
||||
tr-menu-inspect = Inspect
|
||||
|
||||
# Unused.
|
||||
tr-menu-inspect-compare-detours = Compare Detours
|
||||
|
||||
tr-menu-inspect-measure-length = Measure Length
|
||||
|
||||
tr-menu-preferences = Preferences
|
||||
|
|
|
|||
Loading…
Reference in New Issue