mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Fix perspective when status bar is visible
This commit is contained in:
parent
7447c49dc5
commit
eac9367ace
1 changed files with 12 additions and 3 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
|
|
||||||
CVAR(Bool, r_debug_cull, 0, 0)
|
CVAR(Bool, r_debug_cull, 0, 0)
|
||||||
|
EXTERN_CVAR(Int, screenblocks)
|
||||||
void InitGLRMapinfoData();
|
void InitGLRMapinfoData();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -76,17 +77,25 @@ void RenderPolyScene::SetupPerspectiveMatrix()
|
||||||
bDidSetup = true;
|
bDidSetup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pixelstretch = (glset.pixelstretch) ? glset.pixelstretch : 1.2;
|
int height;
|
||||||
|
if (screenblocks >= 10)
|
||||||
|
{
|
||||||
|
height = SCREENHEIGHT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
height = (screenblocks*SCREENHEIGHT / 10) & ~7;
|
||||||
|
}
|
||||||
|
viewheight = height; // So viewheight was calculated incorrectly. That's just.. wonderful.
|
||||||
|
|
||||||
float ratio = WidescreenRatio;
|
float ratio = WidescreenRatio;
|
||||||
float fovratio = (WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
float fovratio = (WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
||||||
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
||||||
TriMatrix worldToView =
|
TriMatrix worldToView =
|
||||||
TriMatrix::scale(1.0f, 1.2f, 1.0f) *
|
|
||||||
TriMatrix::rotate((float)ViewPitch.Radians(), 1.0f, 0.0f, 0.0f) *
|
TriMatrix::rotate((float)ViewPitch.Radians(), 1.0f, 0.0f, 0.0f) *
|
||||||
TriMatrix::rotate((float)(ViewAngle - 90).Radians(), 0.0f, -1.0f, 0.0f) *
|
TriMatrix::rotate((float)(ViewAngle - 90).Radians(), 0.0f, -1.0f, 0.0f) *
|
||||||
TriMatrix::scale(1.0f, pixelstretch, 1.0f) *
|
|
||||||
TriMatrix::swapYZ() *
|
TriMatrix::swapYZ() *
|
||||||
|
TriMatrix::scale(1.0f, 1.0f, glset.pixelstretch) *
|
||||||
TriMatrix::translate((float)-ViewPos.X, (float)-ViewPos.Y, (float)-ViewPos.Z);
|
TriMatrix::translate((float)-ViewPos.X, (float)-ViewPos.Y, (float)-ViewPos.Z);
|
||||||
WorldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;
|
WorldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue