mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-02 08:53:29 +00:00
Fix sky stretching on widescreen displays
This commit is contained in:
parent
b0e9adfc10
commit
19030b555f
1 changed files with 5 additions and 9 deletions
|
@ -880,21 +880,17 @@ static DWORD lastskycol_bgra[4];
|
||||||
static int skycolplace;
|
static int skycolplace;
|
||||||
static int skycolplace_bgra;
|
static int skycolplace_bgra;
|
||||||
|
|
||||||
// Treat sky as a cube rather than a cylinder
|
CVAR(Bool, r_linearsky, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
CVAR(Bool, r_cubesky, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
|
||||||
|
|
||||||
// Get a column of sky when there is only one sky texture.
|
// Get a column of sky when there is only one sky texture.
|
||||||
static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
|
static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
|
||||||
{
|
{
|
||||||
int tx;
|
int tx;
|
||||||
if (r_cubesky)
|
if (r_linearsky)
|
||||||
{
|
{
|
||||||
int tx0 = (UMulScale16((skyangle + xtoviewangle[0]) ^ skyflip, frontcyl) + frontpos) >> FRACBITS;
|
angle_t xangle = (angle_t)((0.5 - x / (double)viewwidth) * FocalTangent * ANGLE_90);
|
||||||
int tx1 = tx0 - ((UMulScale16(xtoviewangle[0], frontcyl) * 2) >> FRACBITS);
|
angle_t column = (skyangle + xangle) ^ skyflip;
|
||||||
tx = (int)(tx0 + (tx1 - tx0) * x / viewwidth + 0.5);
|
tx = (UMulScale16(column, frontcyl) + frontpos) >> FRACBITS;
|
||||||
tx %= fronttex->GetWidth();
|
|
||||||
if (tx < 0)
|
|
||||||
tx += fronttex->GetWidth();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue