qzdoom/src/r_data/r_interpolate.h
Christoph Oelckers 7b7623d2c4 - split DObject::Destroy into the main method, a native OnDestroy and a scripted OnDestroy method and made the main method non-virtual
This was done to ensure it can be properly overridden in scripts without causing problems when called during engine shutdown for the type and symbol objects the VM needs to work and to have the scripted version always run first.
Since the scripted OnDestroy method never calls the native version - the native one is run after the scripted one - this can be simply skipped over during shutdown.
2017-01-12 22:49:18 +01:00

72 lines
1.3 KiB
C++

#ifndef R_INTERPOLATE_H
#define R_INTERPOLATE_H
#include "dobject.h"
//==========================================================================
//
//
//
//==========================================================================
class DInterpolation : public DObject
{
friend struct FInterpolator;
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
HAS_OBJECT_POINTERS
TObjPtr<DInterpolation> Next;
TObjPtr<DInterpolation> Prev;
protected:
int refcount;
DInterpolation();
public:
int AddRef();
int DelRef(bool force = false);
void OnDestroy() override;
virtual void UpdateInterpolation() = 0;
virtual void Restore() = 0;
virtual void Interpolate(double smoothratio) = 0;
virtual void Serialize(FSerializer &arc);
};
//==========================================================================
//
//
//
//==========================================================================
struct FInterpolator
{
TObjPtr<DInterpolation> Head;
bool didInterp;
int count;
int CountInterpolations ();
public:
FInterpolator()
{
Head = NULL;
didInterp = false;
count = 0;
}
void UpdateInterpolations();
void AddInterpolation(DInterpolation *);
void RemoveInterpolation(DInterpolation *);
void DoInterpolations(double smoothratio);
void RestoreInterpolations();
void ClearInterpolations();
};
extern FInterpolator interpolator;
#endif