From 7447c49dc5c87639f1cf88c5bb7285ce44c08cbb Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 17 Nov 2016 02:50:54 -0500 Subject: [PATCH] - Added pixelratio support for the softpoly renderer. --- src/r_poly.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/r_poly.cpp b/src/r_poly.cpp index d4f24be59c..25fae638e5 100644 --- a/src/r_poly.cpp +++ b/src/r_poly.cpp @@ -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;