15 #ifndef LERP_HELPERS_H 16 #define LERP_HELPERS_H 18 #include "directbase.h" 31 template<
class NumericType>
33 lerp_value(NumericType ¤t_value,
35 const NumericType &starting_value,
36 const NumericType &ending_value) {
37 current_value = starting_value + d * (ending_value - starting_value);
49 template<
class NumericType>
51 lerp_value_from_prev(NumericType ¤t_value,
52 double d,
double prev_d,
53 const NumericType &prev_value,
54 const NumericType &ending_value) {
56 current_value = ending_value;
58 NumericType starting_value =
59 (prev_value - prev_d * ending_value) / (1.0 - prev_d);
60 current_value = starting_value + d * (ending_value - starting_value);