mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-15 14:51:13 +00:00
b8f7e305db
This addresses the main issue with TObjPtr, namely that using it required pulling in the entire class hierarchy in basic headers like r_defs which polluted nearly every single source file in the project.
72 lines
1.3 KiB
C++
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
|
|
|