2008-03-21 17:35:49 +00:00
|
|
|
#ifndef R_INTERPOLATE_H
|
|
|
|
#define R_INTERPOLATE_H
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
2008-06-03 14:38:42 +00:00
|
|
|
#include "dobject.h"
|
|
|
|
#include "r_defs.h"
|
2008-03-21 17:35:49 +00:00
|
|
|
|
|
|
|
// BUILD stuff for interpolating between frames, but modified (rather a lot)
|
|
|
|
#define INTERPOLATION_BUCKETS 107
|
|
|
|
|
2008-06-03 14:38:42 +00:00
|
|
|
#if 0
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
class DInterpolation : public DObject
|
2008-03-21 17:35:49 +00:00
|
|
|
{
|
2008-05-30 06:56:50 +00:00
|
|
|
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
|
|
|
|
DInterpolation *Next;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
DInterpolation();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-06-03 14:38:42 +00:00
|
|
|
virtual void Destroy();
|
|
|
|
virtual void CopyInterpToOld() = 0;
|
|
|
|
virtual void CopyBakToInterp() = 0;
|
|
|
|
virtual void DoAnInterpolation(fixed_t smoothratio) = 0;
|
|
|
|
virtual void Serialize(FArchive &arc);
|
2008-03-21 17:35:49 +00:00
|
|
|
};
|
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
class DSectorPlaneInterpolation : public DInterpolation
|
2008-03-21 17:35:49 +00:00
|
|
|
{
|
2008-05-30 06:56:50 +00:00
|
|
|
DECLARE_CLASS(DSectorPlaneInterpolation, DInterpolation)
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
sector_t *sector;
|
|
|
|
fixed_t oldheight, oldtexz;
|
|
|
|
fixed_t bakheight, baktexz;
|
|
|
|
bool floor;
|
|
|
|
TArray<DInterpolation *> attached;
|
2008-03-21 17:35:49 +00:00
|
|
|
|
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
DSectorPlaneInterpolation(sector_t *sector, int plane, bool attach);
|
|
|
|
void Destroy();
|
|
|
|
void CopyInterpToOld();
|
|
|
|
void CopyBakToInterp();
|
|
|
|
void DoAnInterpolation(fixed_t smoothratio);
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
|
|
|
size_t PropagateMark();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DSectorScrollInterpolation : public DInterpolation
|
|
|
|
{
|
2008-06-03 14:38:42 +00:00
|
|
|
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
|
2008-05-30 06:56:50 +00:00
|
|
|
|
|
|
|
sector_t *sector;
|
|
|
|
fixed_t oldx, oldy;
|
|
|
|
fixed_t bakx, baky;
|
|
|
|
bool floor;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
DSectorScrollInterpolation(sector_t *sector, int plane);
|
|
|
|
void Destroy();
|
|
|
|
void CopyInterpToOld();
|
|
|
|
void CopyBakToInterp();
|
|
|
|
void DoAnInterpolation(fixed_t smoothratio);
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DWallScrollInterpolation : public DInterpolation
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(DWallScrollInterpolation, DInterpolation)
|
|
|
|
|
|
|
|
side_t *side;
|
|
|
|
side_t::ETexpart part;
|
|
|
|
fixed_t oldx, oldy;
|
|
|
|
fixed_t bakx, baky;
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
DWallScrollInterpolation(side_t *side, side_t::ETexpart part);
|
|
|
|
void Destroy();
|
|
|
|
void CopyInterpToOld();
|
|
|
|
void CopyBakToInterp();
|
|
|
|
void DoAnInterpolation(fixed_t smoothratio);
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DPolyobjInterpolation : public DInterpolation
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(DPolyobjInterpolation, DInterpolation)
|
|
|
|
|
|
|
|
FPolyobj *poly;
|
|
|
|
vertex_t *oldverts, *bakverts;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-06-03 14:38:42 +00:00
|
|
|
DPolyobjInterpolation(FPolyObj *poly);
|
2008-05-30 06:56:50 +00:00
|
|
|
void Destroy();
|
2008-03-21 17:35:49 +00:00
|
|
|
void CopyInterpToOld();
|
|
|
|
void CopyBakToInterp();
|
|
|
|
void DoAnInterpolation(fixed_t smoothratio);
|
2008-05-30 06:56:50 +00:00
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FInterpolator
|
|
|
|
{
|
|
|
|
DInterpolation *curiposhash[INTERPOLATION_BUCKETS];
|
|
|
|
|
|
|
|
int CountInterpolations ();
|
|
|
|
int CountInterpolations (int *usedbuckets, int *minbucketfill, int *maxbucketfill);
|
|
|
|
|
|
|
|
private:
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-06-03 14:38:42 +00:00
|
|
|
size_t HashKey(FName type, void *interptr, int param);
|
|
|
|
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param, DInterpolation **&interp_p);
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
public:
|
2008-06-03 14:38:42 +00:00
|
|
|
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param);
|
2008-05-30 06:56:50 +00:00
|
|
|
void UpdateInterpolations();
|
|
|
|
void AddInterpolation(DInterpolation *);
|
|
|
|
void RemoveInterpolation(DInterpolation *);
|
|
|
|
void DoInterpolations(fixed_t smoothratio);
|
|
|
|
void RestoreInterpolations();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class FArchive;
|
2008-03-21 17:35:49 +00:00
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
enum EInterpType
|
|
|
|
{
|
|
|
|
INTERP_SectorFloor, // Pass a sector_t *
|
|
|
|
INTERP_SectorCeiling, // Pass a sector_t *
|
|
|
|
INTERP_Vertex, // Pass a vertex_t *
|
|
|
|
INTERP_FloorPanning, // Pass a sector_t *
|
|
|
|
INTERP_CeilingPanning, // Pass a sector_t *
|
|
|
|
INTERP_WallPanning_Top, // Pass a side_t *
|
|
|
|
INTERP_WallPanning_Mid,
|
|
|
|
INTERP_WallPanning_Bottom,
|
2008-03-21 17:35:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void updateinterpolations();
|
|
|
|
void setinterpolation(EInterpType, void *interptr, bool dolinks = true);
|
|
|
|
void stopinterpolation(EInterpType, void *interptr, bool dolinks = true);
|
|
|
|
void dointerpolations(fixed_t smoothratio);
|
|
|
|
void restoreinterpolations();
|
|
|
|
void clearinterpolations();
|
|
|
|
void SerializeInterpolations(FArchive &arc);
|
|
|
|
|
2008-05-30 06:56:50 +00:00
|
|
|
#endif
|
|
|
|
|