From 315827015cb0d10780a4e22556d6d3ccdd8a626d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Dec 2014 23:52:20 +0100 Subject: [PATCH] - made aspect ratio correction factor configurable through MAPINFO. --- src/gl/data/gl_data.cpp | 14 ++++++++++++++ src/gl/data/gl_data.h | 2 ++ src/gl/scene/gl_scene.cpp | 3 +-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 52166f0a8..6aa05c64a 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -212,6 +212,7 @@ struct FGLROptions : public FOptionalMapinfoData notexturefill = -1; skyrotatevector = FVector3(0,0,1); skyrotatevector2 = FVector3(0,0,1); + pixelstretch = 1.2f; } virtual FOptionalMapinfoData *Clone() const { @@ -225,6 +226,7 @@ struct FGLROptions : public FOptionalMapinfoData newopt->notexturefill = notexturefill; newopt->skyrotatevector = skyrotatevector; newopt->skyrotatevector2 = skyrotatevector2; + newopt->pixelstretch = pixelstretch; return newopt; } int fogdensity; @@ -236,6 +238,7 @@ struct FGLROptions : public FOptionalMapinfoData SBYTE notexturefill; FVector3 skyrotatevector; FVector3 skyrotatevector2; + float pixelstretch; }; DEFINE_MAP_OPTION(fogdensity, false) @@ -338,6 +341,15 @@ DEFINE_MAP_OPTION(skyrotate2, false) opt->skyrotatevector2.MakeUnit(); } +DEFINE_MAP_OPTION(pixelratio, false) +{ + FGLROptions *opt = info->GetOptData("gl_renderer"); + + parse.ParseAssign(); + parse.sc.MustGetFloat(); + opt->pixelstretch = (float)parse.sc.Float; +} + bool IsLightmodeValid() { return (glset.map_lightmode >= 0 && glset.map_lightmode <= 4) || glset.map_lightmode == 8; @@ -356,6 +368,7 @@ void InitGLRMapinfoData() glset.map_notexturefill = opt->notexturefill; glset.skyrotatevector = opt->skyrotatevector; glset.skyrotatevector2 = opt->skyrotatevector2; + glset.pixelstretch = opt->pixelstretch; } else { @@ -366,6 +379,7 @@ void InitGLRMapinfoData() glset.map_notexturefill = -1; glset.skyrotatevector = FVector3(0,0,1); glset.skyrotatevector2 = FVector3(0,0,1); + glset.pixelstretch = 1.2f; } if (!IsLightmodeValid()) glset.lightmode = gl_lightmode; diff --git a/src/gl/data/gl_data.h b/src/gl/data/gl_data.h index 42b6df26e..ac2fe0285 100644 --- a/src/gl/data/gl_data.h +++ b/src/gl/data/gl_data.h @@ -20,6 +20,8 @@ struct GLRenderSettings FVector3 skyrotatevector; FVector3 skyrotatevector2; + float pixelstretch; + }; extern GLRenderSettings glset; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 189c3acc3..b1efbf830 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -86,7 +86,6 @@ CVAR(Bool, gl_no_skyclear, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Float, gl_mask_threshold, 0.5f,CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Float, gl_mask_sprite_threshold, 0.5f,CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, gl_sort_textures, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -CVAR(Float, gl_aspect, 1.2f, 0) EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, cl_capfps) @@ -264,7 +263,7 @@ void FGLRenderer::SetProjection(float fov, float ratio, float fovratio) void FGLRenderer::SetViewMatrix(fixed_t viewx, fixed_t viewy, fixed_t viewz, bool mirror, bool planemirror) { float mult = mirror? -1:1; - float planemult = planemirror? -gl_aspect:gl_aspect; + float planemult = planemirror? -glset.pixelstretch : glset.pixelstretch; gl_RenderState.mViewMatrix.loadIdentity(); gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Roll, 0.0f, 0.0f, 1.0f);