mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- fixed SW's interpolation math.
This commit is contained in:
parent
a594ba32d4
commit
f76d139207
2 changed files with 18 additions and 1 deletions
|
@ -44,6 +44,10 @@ public:
|
||||||
{
|
{
|
||||||
return ticksS32 >> 16;
|
return ticksS32 >> 16;
|
||||||
}
|
}
|
||||||
|
double toScale16F() const
|
||||||
|
{
|
||||||
|
return ticksS32 * (1/(65536.*65536.));
|
||||||
|
}
|
||||||
ClockTicks& setFromScale16(int64_t const ticksScale16)
|
ClockTicks& setFromScale16(int64_t const ticksScale16)
|
||||||
{
|
{
|
||||||
ticksS32 = ticksScale16 << 16;
|
ticksS32 = ticksScale16 << 16;
|
||||||
|
|
|
@ -1994,6 +1994,19 @@ SWBOOL PicInView(short, SWBOOL);
|
||||||
void DoPlayerDiveMeter(PLAYERp pp);
|
void DoPlayerDiveMeter(PLAYERp pp);
|
||||||
void MoveScrollMode2D(PLAYERp pp);
|
void MoveScrollMode2D(PLAYERp pp);
|
||||||
|
|
||||||
|
|
||||||
|
static inline int32_t calc_smoothratio_demo(ClockTicks totalclk, ClockTicks ototalclk)
|
||||||
|
{
|
||||||
|
const int TICRATE = 120;
|
||||||
|
const int REALGAMETICSPERSEC = TICRATE / synctics;
|
||||||
|
|
||||||
|
int32_t rfreq = (refreshfreq != -1 ? refreshfreq : 60);
|
||||||
|
double elapsedTime = (totalclk - ototalclk).toScale16F();
|
||||||
|
double elapsedFrames = elapsedTime * rfreq * (1. / TICRATE);
|
||||||
|
double ratio = (elapsedFrames * REALGAMETICSPERSEC) / rfreq;
|
||||||
|
return clamp(xs_RoundToInt(ratio * 65536), 0, 65536);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drawscreen(PLAYERp pp)
|
drawscreen(PLAYERp pp)
|
||||||
{
|
{
|
||||||
|
@ -2063,7 +2076,7 @@ drawscreen(PLAYERp pp)
|
||||||
PreUpdatePanel();
|
PreUpdatePanel();
|
||||||
|
|
||||||
|
|
||||||
smoothratio = min(max(((int32_t) totalclock - ototalclock) * (65536 / synctics),0),65536);
|
smoothratio = calc_smoothratio_demo(totalclock, ototalclock);
|
||||||
|
|
||||||
if (!ScreenSavePic)
|
if (!ScreenSavePic)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue