(&mut self, sample: CsvFrameSample)
| 198 | fn plan_fixed_steps( |
| 199 | frame_delta_seconds: f32, |
| 200 | fixed_timestep: f32, |
| 201 | accumulator: f32, |
| 202 | max_steps: u32, |
| 203 | ) -> FixedStepPlan { |
| 204 | let max_steps = max_steps.clamp(MIN_FIXED_STEPS_PER_FRAME, MAX_FIXED_STEPS_PER_FRAME); |
| 205 | let mut next_accumulator = |
| 206 | accumulator + frame_delta_seconds.clamp(0.0, MAX_FRAME_DELTA_SECONDS); |
| 207 | let mut steps = 0u32; |
| 208 | while next_accumulator >= fixed_timestep && steps < max_steps { |
| 209 | next_accumulator -= fixed_timestep; |
| 210 | steps += 1; |
| 211 | } |
| 212 | let dropped_catchup = steps == max_steps && next_accumulator >= fixed_timestep; |
| 213 | if dropped_catchup { |
| 214 | next_accumulator %= fixed_timestep; |
| 215 | } |
| 216 | FixedStepPlan { |
| 217 | steps, |
| 218 | step_seconds: fixed_timestep, |
| 219 | accumulator_after: next_accumulator, |
| 220 | dropped_catchup, |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | #[derive(Clone, Copy, Debug, Default)] |
no test coverage detected