Rebel Fork Framework
Urho3D::NetworkValueSampler< T, Traits > Class Template Reference

#include <Urho3D/Replica/NetworkValue.h>

Classes

struct  InterpolationCache
struct  TimeAndValue

Public Types

using NetworkValueType = NetworkValue<T, Traits>
using InternalType = typename Traits::InternalType
using ReturnType = typename Traits::ReturnType

Public Member Functions

void Setup (unsigned maxExtrapolation, float smoothingConstant, float snapThreshold)
 Update sampler settings.
void UpdatePreviousValue (const NetworkTime &time, const ReturnType &value)
ea::optional< ReturnType > UpdateAndSample (const NetworkValueType &value, const NetworkTime &time, float timeStep)
 Update sampler state for new time and return current value.

Private Member Functions

float GetExtrapolationFactor (const NetworkTime &time, NetworkFrame baseFrame, unsigned maxExtrapolation) const
void UpdateCorrection (const NetworkValueType &value, float timeStep)
void UpdateCache (const NetworkValueType &value, NetworkFrame frame)
ReturnType CalculateValueFromCache (const NetworkValueType &value, const NetworkTime &time) const

Private Attributes

unsigned maxExtrapolation_ {}
float smoothingConstant_ {}
float snapThreshold_ {M_LARGE_VALUE}
ea::optional< InterpolationCache > interpolationCache_
ea::optional< TimeAndValue > previousValue_
ea::optional< NetworkFrame > extrapolationFrame_
ReturnType valueCorrection_ {}

Detailed Description

template<class T, class Traits = NetworkValueTraits<T>>
class Urho3D::NetworkValueSampler< T, Traits >

Helper class that manages continuous sampling of NetworkValue on the client side. Performs extrapolation and error smoothing.

Member Function Documentation

◆ UpdatePreviousValue()

template<class T, class Traits = NetworkValueTraits<T>>
void Urho3D::NetworkValueSampler< T, Traits >::UpdatePreviousValue ( const NetworkTime & time,
const ReturnType & value )
inline

Reset previous value to different value. Useful for smooth fade-in when sampler was disabled for a while and value was updated externally.


The documentation for this class was generated from the following file:
  • Urho3D/Replica/NetworkValue.h