-
Notifications
You must be signed in to change notification settings - Fork 2
Time–step Policies
TODO: Overview
NOTE: The new time-step policy only takes affect after the current frame.
Specifies the application's time-step policy.
yeti::TimeStepPolicy::Description time_step_policy_desc;
time_step_policy_desc.type = yeti::TimeStepPolicy::FIXED;
time_step_policy_desc.config.fixed.delta_time_per_step = 1.f/60.f;
yeti::TimeStepPolicy *time_step_policy = yeti::TimeStepPolicy::create(time_step_policy_desc);
app->set_time_step_policy(time_step_policy);
time_step_policy = TimeStepPolicy.fixed(1.0/60.0)
Application.set_time_step_policy(time_step_policy)
Gets the application's time-step policy.
yeti::TimeStepPolicy *time_step_policy = app->time_step_policy();
time_step_policy = Application.get_time_step_policy()
TODO(mike): Explain
Creates a variable time-step policy. Variable time-step policies simply pass-through the frame's delta-time.
yeti::TimeStepPolicy::Description time_step_policy_desc;
time_step_policy_desc.type = yeti::TimeStepPolicy::VARIABLE;
yeti::TimeStepPolicy *time_step_policy = yeti::TimeStepPolicy::create(time_step_policy_desc);
variable = TimeStepPolicy.variable()
Creates a fixed time-step policy. Fixed time-step policies skip logical updates until the accumulated delta-times reach or exceed a multiple of a specified target, after which n logical updates are performed where n = floor(accumulated_delta_times/target)
.
yeti::TimeStepPolicy::Description time_step_policy_desc;
time_step_policy_desc.type = yeti::TimeStepPolicy::FIXED;
time_step_policy_desc.config.fixed.delta_time_per_step = 1.f/60.f;
yeti::TimeStepPolicy *time_step_policy = yeti::TimeStepPolicy::create(time_step_policy_desc);
fixed = TimeStepPolicy.fixed(1.0/60.0)
Creates a smoothed time-step policy. Smoothed time-step policies smooth fluctuations in frame delta-times by using a running average of n historical frame-times with m of the highest and lowest frame-times being disregarded, where n=history
and m=outliers
. In pseduo-code:
history = { ... }
avg = sum(sort(history)[m..(len(history)-m*2)])/(len(history)-m*2)
return lerp(avg, dt, intertia)
yeti::TimeStepPolicy::Description time_step_policy_desc;
time_step_policy_desc.type = yeti::TimeStepPolicy::SMOOTHED;
time_step_policy_desc.config.smoothed.history = 11;
time_step_policy_desc.config.smoothed.outliers = 2;
time_step_policy_desc.config.smoothed.intertia = 0.1f;
time_step_policy_desc.config.smoothed.payback = false;
yeti::TimeStepPolicy *time_step_policy = yeti::TimeStepPolicy::create(time_step_policy_desc);
smoothed = TimeStepPolicy.smoothed(11, 2, 0.1)
Creates a smoothed-with-debt-payback time-step policy. Smoothed-with-debt-payback time-step policies keep track of the time debt introduced by smoothing and pay it back over payback frames.
yeti::TimeStepPolicy::Description time_step_policy_desc;
time_step_policy_desc.type = yeti::TimeStepPolicy::SMOOTHED;
time_step_policy_desc.config.smoothed.history = 11;
time_step_policy_desc.config.smoothed.outliers = 2;
time_step_policy_desc.config.smoothed.intertia = 0.1f;
time_step_policy_desc.config.smoothed.payback = 6;
yeti::TimeStepPolicy *time_step_policy = yeti::TimeStepPolicy::create(time_step_policy_desc);
smoothed = TimeStepPolicy.smoothed_with_debt_payback(11, 2, 0.1, 6)