Cafu Engine
cf::GameSys::VarInterpolatorT< T > Class Template Reference

Linearly interpolates a value over a period of time. More...

#include "Interpolator.hpp"

Inheritance diagram for cf::GameSys::VarInterpolatorT< T >:

Public Member Functions

 VarInterpolatorT (cf::TypeSys::VarT< T > &v)
 
cf::TypeSys::VarBaseTGetVar () const override
 Returns the variable that this is an interpolator for. More...
 
void ReInit () override
 Re-initializes this interpolator to the variable's current value. More...
 
void UpdateTargetValue () override
 Updates the interpolator to interpolate from the current interpolated value to the current value of the variable (the new target value). More...
 
void UpdateAfterReprediction () override
 Updates the interpolator to account for the new target value after the local human player's reprediction has been performed. More...
 
void UpdateAfterPrediction () override
 Updates the interpolator to account for the new target value after the local human player's prediction has been performed. More...
 
void AdvanceTime (float Time) override
 Advances the interpolation over the given time. More...
 
void SetCurrentValue () override
 Assigns the interpolation's current value to the variable. More...
 
void SetTargetValue () override
 Assigns the interpolation's target value to the variable. More...
 

Detailed Description

template<class T>
class cf::GameSys::VarInterpolatorT< T >

Linearly interpolates a value over a period of time.

The course of the interpolation is adapted/updated whenever a new reference value is set. This is mostly intended for game entities on clients, where we interpolate from the "current" value towards the reference value of the most recent server update. If the subsequent server update happens to arrive later than the one before it, our interpolation may (briefly) turn into an extrapolation for bridging the gap.

Member Function Documentation

template<class T >
void cf::GameSys::VarInterpolatorT< T >::AdvanceTime ( float  Time)
inlineoverridevirtual

Advances the interpolation over the given time.

Implements cf::GameSys::ApproxBaseT.

template<class T >
cf::TypeSys::VarBaseT* cf::GameSys::VarInterpolatorT< T >::GetVar ( ) const
inlineoverridevirtual

Returns the variable that this is an interpolator for.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::ReInit ( )
inlineoverridevirtual

Re-initializes this interpolator to the variable's current value.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::SetCurrentValue ( )
inlineoverridevirtual

Assigns the interpolation's current value to the variable.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::SetTargetValue ( )
inlineoverridevirtual

Assigns the interpolation's target value to the variable.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::UpdateAfterPrediction ( )
inlineoverridevirtual

Updates the interpolator to account for the new target value after the local human player's prediction has been performed.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::UpdateAfterReprediction ( )
inlineoverridevirtual

Updates the interpolator to account for the new target value after the local human player's reprediction has been performed.

Implements cf::GameSys::ApproxBaseT.

template<class T >
void cf::GameSys::VarInterpolatorT< T >::UpdateTargetValue ( )
inlineoverridevirtual

Updates the interpolator to interpolate from the current interpolated value to the current value of the variable (the new target value).

Implements cf::GameSys::ApproxBaseT.


The documentation for this class was generated from the following file: