mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- floatified r_interpolate.cpp.
This commit is contained in:
parent
27bad66f61
commit
d54a2364b9
4 changed files with 45 additions and 49 deletions
|
@ -52,8 +52,8 @@ class DSectorPlaneInterpolation : public DInterpolation
|
||||||
DECLARE_CLASS(DSectorPlaneInterpolation, DInterpolation)
|
DECLARE_CLASS(DSectorPlaneInterpolation, DInterpolation)
|
||||||
|
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
fixed_t oldheight, oldtexz;
|
double oldheight, oldtexz;
|
||||||
fixed_t bakheight, baktexz;
|
double bakheight, baktexz;
|
||||||
bool ceiling;
|
bool ceiling;
|
||||||
TArray<DInterpolation *> attached;
|
TArray<DInterpolation *> attached;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(fixed_t smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
void Serialize(FArchive &arc);
|
||||||
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
||||||
size_t PropagateMark();
|
size_t PropagateMark();
|
||||||
|
@ -82,8 +82,8 @@ class DSectorScrollInterpolation : public DInterpolation
|
||||||
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
|
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
|
||||||
|
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
fixed_t oldx, oldy;
|
double oldx, oldy;
|
||||||
fixed_t bakx, baky;
|
double bakx, baky;
|
||||||
bool ceiling;
|
bool ceiling;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(fixed_t smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
void Serialize(FArchive &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ class DWallScrollInterpolation : public DInterpolation
|
||||||
|
|
||||||
side_t *side;
|
side_t *side;
|
||||||
int part;
|
int part;
|
||||||
fixed_t oldx, oldy;
|
double oldx, oldy;
|
||||||
fixed_t bakx, baky;
|
double bakx, baky;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(fixed_t smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
void Serialize(FArchive &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,9 +135,9 @@ class DPolyobjInterpolation : public DInterpolation
|
||||||
DECLARE_CLASS(DPolyobjInterpolation, DInterpolation)
|
DECLARE_CLASS(DPolyobjInterpolation, DInterpolation)
|
||||||
|
|
||||||
FPolyObj *poly;
|
FPolyObj *poly;
|
||||||
TArray<fixed_t> oldverts, bakverts;
|
TArray<double> oldverts, bakverts;
|
||||||
fixed_t oldcx, oldcy;
|
double oldcx, oldcy;
|
||||||
fixed_t bakcx, bakcy;
|
double bakcx, bakcy;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(fixed_t smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
void Serialize(FArchive &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -251,9 +251,9 @@ void FInterpolator::RemoveInterpolation(DInterpolation *interp)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FInterpolator::DoInterpolations(fixed_t smoothratio)
|
void FInterpolator::DoInterpolations(double smoothratio)
|
||||||
{
|
{
|
||||||
if (smoothratio == FRACUNIT)
|
if (smoothratio >= 1.)
|
||||||
{
|
{
|
||||||
didInterp = false;
|
didInterp = false;
|
||||||
return;
|
return;
|
||||||
|
@ -440,13 +440,13 @@ void DSectorPlaneInterpolation::UpdateInterpolation()
|
||||||
{
|
{
|
||||||
if (!ceiling)
|
if (!ceiling)
|
||||||
{
|
{
|
||||||
oldheight = sector->floorplane.fixD();
|
oldheight = sector->floorplane.fD();
|
||||||
oldtexz = sector->GetPlaneTexZ(sector_t::floor);
|
oldtexz = sector->GetPlaneTexZF(sector_t::floor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldheight = sector->ceilingplane.fixD();
|
oldheight = sector->ceilingplane.fD();
|
||||||
oldtexz = sector->GetPlaneTexZ(sector_t::ceiling);
|
oldtexz = sector->GetPlaneTexZF(sector_t::ceiling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ void DSectorPlaneInterpolation::Restore()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
|
void DSectorPlaneInterpolation::Interpolate(double smoothratio)
|
||||||
{
|
{
|
||||||
secplane_t *pplane;
|
secplane_t *pplane;
|
||||||
int pos;
|
int pos;
|
||||||
|
@ -503,8 +503,8 @@ void DSectorPlaneInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pplane->setD(oldheight + FixedMul(bakheight - oldheight, smoothratio));
|
pplane->setD(oldheight + (bakheight - oldheight) * smoothratio);
|
||||||
sector->SetPlaneTexZ(pos, oldtexz + FixedMul(baktexz - oldtexz, smoothratio));
|
sector->SetPlaneTexZ(pos, oldtexz + (baktexz - oldtexz) * smoothratio);
|
||||||
P_RecalculateAttached3DFloors(sector);
|
P_RecalculateAttached3DFloors(sector);
|
||||||
sector->CheckPortalPlane(pos);
|
sector->CheckPortalPlane(pos);
|
||||||
}
|
}
|
||||||
|
@ -604,8 +604,8 @@ void DSectorScrollInterpolation::Destroy()
|
||||||
|
|
||||||
void DSectorScrollInterpolation::UpdateInterpolation()
|
void DSectorScrollInterpolation::UpdateInterpolation()
|
||||||
{
|
{
|
||||||
oldx = sector->GetXOffset(ceiling);
|
oldx = sector->GetXOffsetF(ceiling);
|
||||||
oldy = sector->GetYOffset(ceiling, false);
|
oldy = sector->GetYOffsetF(ceiling, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -626,7 +626,7 @@ void DSectorScrollInterpolation::Restore()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DSectorScrollInterpolation::Interpolate(fixed_t smoothratio)
|
void DSectorScrollInterpolation::Interpolate(double smoothratio)
|
||||||
{
|
{
|
||||||
bakx = sector->GetXOffset(ceiling);
|
bakx = sector->GetXOffset(ceiling);
|
||||||
baky = sector->GetYOffset(ceiling, false);
|
baky = sector->GetYOffset(ceiling, false);
|
||||||
|
@ -637,8 +637,8 @@ void DSectorScrollInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sector->SetXOffset(ceiling, oldx + FixedMul(bakx - oldx, smoothratio));
|
sector->SetXOffset(ceiling, oldx + (bakx - oldx) * smoothratio);
|
||||||
sector->SetYOffset(ceiling, oldy + FixedMul(baky - oldy, smoothratio));
|
sector->SetYOffset(ceiling, oldy + (baky - oldy) * smoothratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,8 +695,8 @@ void DWallScrollInterpolation::Destroy()
|
||||||
|
|
||||||
void DWallScrollInterpolation::UpdateInterpolation()
|
void DWallScrollInterpolation::UpdateInterpolation()
|
||||||
{
|
{
|
||||||
oldx = side->GetTextureXOffset(part);
|
oldx = side->GetTextureXOffsetF(part);
|
||||||
oldy = side->GetTextureYOffset(part);
|
oldy = side->GetTextureYOffsetF(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -717,7 +717,7 @@ void DWallScrollInterpolation::Restore()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DWallScrollInterpolation::Interpolate(fixed_t smoothratio)
|
void DWallScrollInterpolation::Interpolate(double smoothratio)
|
||||||
{
|
{
|
||||||
bakx = side->GetTextureXOffset(part);
|
bakx = side->GetTextureXOffset(part);
|
||||||
baky = side->GetTextureYOffset(part);
|
baky = side->GetTextureYOffset(part);
|
||||||
|
@ -728,8 +728,8 @@ void DWallScrollInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
side->SetTextureXOffset(part, oldx + FixedMul(bakx - oldx, smoothratio));
|
side->SetTextureXOffset(part, oldx + (bakx - oldx) * smoothratio);
|
||||||
side->SetTextureYOffset(part, oldy + FixedMul(baky - oldy, smoothratio));
|
side->SetTextureYOffset(part, oldy + (baky - oldy) * smoothratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,8 +788,8 @@ void DPolyobjInterpolation::UpdateInterpolation()
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||||
{
|
{
|
||||||
oldverts[i*2 ] = poly->Vertices[i]->fixX();
|
oldverts[i*2 ] = poly->Vertices[i]->fX();
|
||||||
oldverts[i*2+1] = poly->Vertices[i]->fixY();
|
oldverts[i*2+1] = poly->Vertices[i]->fY();
|
||||||
}
|
}
|
||||||
oldcx = poly->CenterSpot.x;
|
oldcx = poly->CenterSpot.x;
|
||||||
oldcy = poly->CenterSpot.y;
|
oldcy = poly->CenterSpot.y;
|
||||||
|
@ -818,7 +818,7 @@ void DPolyobjInterpolation::Restore()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
void DPolyobjInterpolation::Interpolate(double smoothratio)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||||
|
@ -830,8 +830,8 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
poly->Vertices[i]->set(
|
poly->Vertices[i]->set(
|
||||||
oldverts[i * 2] + FixedMul(bakverts[i * 2] - oldverts[i * 2], smoothratio),
|
oldverts[i * 2] + (bakverts[i * 2] - oldverts[i * 2]) * smoothratio,
|
||||||
oldverts[i * 2 + 1] + FixedMul(bakverts[i * 2 + 1] - oldverts[i * 2 + 1], smoothratio));
|
oldverts[i * 2 + 1] + (bakverts[i * 2 + 1] - oldverts[i * 2 + 1]) * smoothratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refcount == 0 && !changed)
|
if (refcount == 0 && !changed)
|
||||||
|
@ -842,8 +842,8 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
||||||
{
|
{
|
||||||
bakcx = poly->CenterSpot.x;
|
bakcx = poly->CenterSpot.x;
|
||||||
bakcy = poly->CenterSpot.y;
|
bakcy = poly->CenterSpot.y;
|
||||||
poly->CenterSpot.x = bakcx + FixedMul(bakcx - oldcx, smoothratio);
|
poly->CenterSpot.x = bakcx + (bakcx - oldcx) * smoothratio;
|
||||||
poly->CenterSpot.y = bakcy + FixedMul(bakcy - oldcy, smoothratio);
|
poly->CenterSpot.y = bakcy + (bakcy - oldcy) * smoothratio;
|
||||||
|
|
||||||
poly->ClearSubsectorLinks();
|
poly->ClearSubsectorLinks();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
virtual void Destroy();
|
virtual void Destroy();
|
||||||
virtual void UpdateInterpolation() = 0;
|
virtual void UpdateInterpolation() = 0;
|
||||||
virtual void Restore() = 0;
|
virtual void Restore() = 0;
|
||||||
virtual void Interpolate(fixed_t smoothratio) = 0;
|
virtual void Interpolate(double smoothratio) = 0;
|
||||||
virtual void Serialize(FArchive &arc);
|
virtual void Serialize(FArchive &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
void UpdateInterpolations();
|
void UpdateInterpolations();
|
||||||
void AddInterpolation(DInterpolation *);
|
void AddInterpolation(DInterpolation *);
|
||||||
void RemoveInterpolation(DInterpolation *);
|
void RemoveInterpolation(DInterpolation *);
|
||||||
void DoInterpolations(fixed_t smoothratio);
|
void DoInterpolations(double smoothratio);
|
||||||
void RestoreInterpolations();
|
void RestoreInterpolations();
|
||||||
void ClearInterpolations();
|
void ClearInterpolations();
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,7 +125,6 @@ fixed_t viewsin, viewtansin;
|
||||||
|
|
||||||
AActor *camera; // [RH] camera to draw from. doesn't have to be a player
|
AActor *camera; // [RH] camera to draw from. doesn't have to be a player
|
||||||
|
|
||||||
fixed_t r_TicFrac; // [RH] Fractional tic to render
|
|
||||||
double r_TicFracF; // same as floating point
|
double r_TicFracF; // same as floating point
|
||||||
DWORD r_FrameTime; // [RH] Time this frame started drawing (in ms)
|
DWORD r_FrameTime; // [RH] Time this frame started drawing (in ms)
|
||||||
bool r_NoInterpolate;
|
bool r_NoInterpolate;
|
||||||
|
@ -572,9 +571,9 @@ static void R_Shutdown ()
|
||||||
//CVAR (Int, tf, 0, 0)
|
//CVAR (Int, tf, 0, 0)
|
||||||
EXTERN_CVAR (Bool, cl_noprediction)
|
EXTERN_CVAR (Bool, cl_noprediction)
|
||||||
|
|
||||||
void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *iview)
|
void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *iview)
|
||||||
{
|
{
|
||||||
// frac = tf;
|
fixed_t frac = FLOAT2FIXED(Frac);
|
||||||
if (NoInterpolateView)
|
if (NoInterpolateView)
|
||||||
{
|
{
|
||||||
InterpolationPath.Clear();
|
InterpolationPath.Clear();
|
||||||
|
@ -1012,9 +1011,7 @@ void R_SetupFrame (AActor *actor)
|
||||||
{
|
{
|
||||||
r_TicFracF = 1.;
|
r_TicFracF = 1.;
|
||||||
}
|
}
|
||||||
r_TicFrac = FLOAT2FIXED(r_TicFracF);
|
R_InterpolateView (player, r_TicFracF, iview);
|
||||||
|
|
||||||
R_InterpolateView (player, r_TicFrac, iview);
|
|
||||||
|
|
||||||
#ifdef TEST_X
|
#ifdef TEST_X
|
||||||
viewx = TEST_X;
|
viewx = TEST_X;
|
||||||
|
@ -1025,7 +1022,7 @@ void R_SetupFrame (AActor *actor)
|
||||||
|
|
||||||
R_SetViewAngle ();
|
R_SetViewAngle ();
|
||||||
|
|
||||||
interpolator.DoInterpolations (r_TicFrac);
|
interpolator.DoInterpolations (r_TicFracF);
|
||||||
|
|
||||||
// Keep the view within the sector's floor and ceiling
|
// Keep the view within the sector's floor and ceiling
|
||||||
if (viewsector->PortalBlocksMovement(sector_t::ceiling))
|
if (viewsector->PortalBlocksMovement(sector_t::ceiling))
|
||||||
|
|
|
@ -33,7 +33,6 @@ extern int LocalViewPitch; // [RH] Used directly instead of consoleplayer's
|
||||||
extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate
|
extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate
|
||||||
extern int WidescreenRatio;
|
extern int WidescreenRatio;
|
||||||
|
|
||||||
extern fixed_t r_TicFrac;
|
|
||||||
extern double r_TicFracF;
|
extern double r_TicFracF;
|
||||||
extern DWORD r_FrameTime;
|
extern DWORD r_FrameTime;
|
||||||
extern int extralight;
|
extern int extralight;
|
||||||
|
|
Loading…
Reference in a new issue