- use the templated warp functions instead of the limited GZDoom 1.x version. gl_WarpBuffer has been removed.

This commit is contained in:
Christoph Oelckers 2016-04-28 19:04:01 +02:00
commit e3fad118d2
3 changed files with 14 additions and 89 deletions

View file

@ -123,88 +123,6 @@ void gl_SetTextureMode(int type)
}
}
//===========================================================================
//
// FGLTex::WarpBuffer
//
//===========================================================================
BYTE *gl_WarpBuffer(BYTE *buffer, int Width, int Height, int warp, float Speed)
{
if (Width > 256 || Height > 256) return buffer;
DWORD *in = (DWORD*)buffer;
DWORD *out = (DWORD*)new BYTE[4 * Width*Height];
static DWORD linebuffer[256]; // anything larger will bring down performance so it is excluded above.
DWORD timebase = DWORD(r_FrameTime*Speed * 23 / 28);
int xsize = Width;
int ysize = Height;
int xmask = xsize - 1;
int ymask = ysize - 1;
int ds_xbits;
int i;
if (warp == 1)
{
for (ds_xbits = -1, i = Width; i; i >>= 1, ds_xbits++);
// pending consolidation with the software renderer's code.
/*
for (x = xsize - 1; x >= 0; x--)
{
int yt, yf = (finesine[(timebase + (x + 17) * 128)&FINEMASK] >> 13) & ymask;
const DWORD *source = in + x;
DWORD *dest = out + x;
for (yt = ysize; yt; yt--, yf = (yf + 1)&ymask, dest += xsize)
{
*dest = *(source + (yf << ds_xbits));
}
}
timebase = DWORD(r_FrameTime*Speed * 32 / 28);
int y;
for (y = ysize - 1; y >= 0; y--)
{
int xt, xf = (finesine[(timebase + y * 128)&FINEMASK] >> 13) & xmask;
DWORD *source = out + (y << ds_xbits);
DWORD *dest = linebuffer;
for (xt = xsize; xt; xt--, xf = (xf + 1)&xmask)
{
*dest++ = *(source + xf);
}
memcpy(out + y*xsize, linebuffer, xsize * sizeof(DWORD));
}
*/
}
else
{
int ybits;
for (ybits = -1, i = ysize; i; i >>= 1, ybits++);
/*
DWORD timebase = (r_FrameTime * Speed * 40 / 28);
for (x = xsize - 1; x >= 0; x--)
{
for (int y = ysize - 1; y >= 0; y--)
{
int xt = (x + 128
+ ((finesine[(y * 128 + timebase * 5 + 900) & 8191] * 2) >> FRACBITS)
+ ((finesine[(x * 256 + timebase * 4 + 300) & 8191] * 2) >> FRACBITS)) & xmask;
int yt = (y + 128
+ ((finesine[(y * 128 + timebase * 3 + 700) & 8191] * 2) >> FRACBITS)
+ ((finesine[(x * 256 + timebase * 4 + 1200) & 8191] * 2) >> FRACBITS)) & ymask;
const DWORD *source = in + (xt << ybits) + yt;
DWORD *dest = out + (x << ybits) + y;
*dest = *source;
}
}
*/
}
delete[] buffer;
return (BYTE*)out;
}
//==========================================================================
//
//