- Added pixelratio support for the softpoly renderer.

This commit is contained in:
Rachael Alexanderson 2016-11-17 02:50:54 -05:00
parent b02e3d9514
commit 7447c49dc5
1 changed files with 14 additions and 1 deletions

View File

@ -26,8 +26,10 @@
#include "sbar.h"
#include "r_data/r_translate.h"
#include "r_poly.h"
#include "gl/data/gl_data.h"
CVAR(Bool, r_debug_cull, 0, 0)
void InitGLRMapinfoData();
/////////////////////////////////////////////////////////////////////////////
@ -66,13 +68,24 @@ void RenderPolyScene::ClearBuffers()
void RenderPolyScene::SetupPerspectiveMatrix()
{
static bool bDidSetup = false;
if (!bDidSetup)
{
InitGLRMapinfoData();
bDidSetup = true;
}
float pixelstretch = (glset.pixelstretch) ? glset.pixelstretch : 1.2;
float ratio = WidescreenRatio;
float fovratio = (WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(FieldOfView.Radians() / 2) / fovratio)).Degrees);
TriMatrix worldToView =
TriMatrix::scale(1.0f, (float)YaspectMul, 1.0f) *
TriMatrix::scale(1.0f, 1.2f, 1.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::scale(1.0f, pixelstretch, 1.0f) *
TriMatrix::swapYZ() *
TriMatrix::translate((float)-ViewPos.X, (float)-ViewPos.Y, (float)-ViewPos.Z);
WorldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;