gzdoom/src/r_data/r_interpolate.h
Christoph Oelckers 66d28a24b8 - disabled the scripted virtual function module after finding out that it only works if each single class that may serve as a parent for scripting is explicitly declared.
Needless to say, this is simply too volatile and would require constant active maintenance, not to mention a huge amount of work up front to get going.
It also hid a nasty problem with the Destroy method. Due to the way the garbage collector works, Destroy cannot be exposed to scripts as-is. It may be called from scripts but it may not be overridden from scripts because the garbage collector can call this function after all data needed for calling a scripted override has already been destroyed because if that data is also being collected there is no guarantee that proper order of destruction is observed. So for now Destroy is just a normal native method to scripted classes
2016-11-25 00:25:26 +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 Destroy() 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