- made aspect ratio correction factor configurable through MAPINFO.

This commit is contained in:
Christoph Oelckers 2014-12-29 23:52:20 +01:00
parent 45cf65afbd
commit 315827015c
3 changed files with 17 additions and 2 deletions

View file

@ -212,6 +212,7 @@ struct FGLROptions : public FOptionalMapinfoData
notexturefill = -1; notexturefill = -1;
skyrotatevector = FVector3(0,0,1); skyrotatevector = FVector3(0,0,1);
skyrotatevector2 = FVector3(0,0,1); skyrotatevector2 = FVector3(0,0,1);
pixelstretch = 1.2f;
} }
virtual FOptionalMapinfoData *Clone() const virtual FOptionalMapinfoData *Clone() const
{ {
@ -225,6 +226,7 @@ struct FGLROptions : public FOptionalMapinfoData
newopt->notexturefill = notexturefill; newopt->notexturefill = notexturefill;
newopt->skyrotatevector = skyrotatevector; newopt->skyrotatevector = skyrotatevector;
newopt->skyrotatevector2 = skyrotatevector2; newopt->skyrotatevector2 = skyrotatevector2;
newopt->pixelstretch = pixelstretch;
return newopt; return newopt;
} }
int fogdensity; int fogdensity;
@ -236,6 +238,7 @@ struct FGLROptions : public FOptionalMapinfoData
SBYTE notexturefill; SBYTE notexturefill;
FVector3 skyrotatevector; FVector3 skyrotatevector;
FVector3 skyrotatevector2; FVector3 skyrotatevector2;
float pixelstretch;
}; };
DEFINE_MAP_OPTION(fogdensity, false) DEFINE_MAP_OPTION(fogdensity, false)
@ -338,6 +341,15 @@ DEFINE_MAP_OPTION(skyrotate2, false)
opt->skyrotatevector2.MakeUnit(); opt->skyrotatevector2.MakeUnit();
} }
DEFINE_MAP_OPTION(pixelratio, false)
{
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
parse.ParseAssign();
parse.sc.MustGetFloat();
opt->pixelstretch = (float)parse.sc.Float;
}
bool IsLightmodeValid() bool IsLightmodeValid()
{ {
return (glset.map_lightmode >= 0 && glset.map_lightmode <= 4) || glset.map_lightmode == 8; 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.map_notexturefill = opt->notexturefill;
glset.skyrotatevector = opt->skyrotatevector; glset.skyrotatevector = opt->skyrotatevector;
glset.skyrotatevector2 = opt->skyrotatevector2; glset.skyrotatevector2 = opt->skyrotatevector2;
glset.pixelstretch = opt->pixelstretch;
} }
else else
{ {
@ -366,6 +379,7 @@ void InitGLRMapinfoData()
glset.map_notexturefill = -1; glset.map_notexturefill = -1;
glset.skyrotatevector = FVector3(0,0,1); glset.skyrotatevector = FVector3(0,0,1);
glset.skyrotatevector2 = FVector3(0,0,1); glset.skyrotatevector2 = FVector3(0,0,1);
glset.pixelstretch = 1.2f;
} }
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode; if (!IsLightmodeValid()) glset.lightmode = gl_lightmode;

View file

@ -20,6 +20,8 @@ struct GLRenderSettings
FVector3 skyrotatevector; FVector3 skyrotatevector;
FVector3 skyrotatevector2; FVector3 skyrotatevector2;
float pixelstretch;
}; };
extern GLRenderSettings glset; extern GLRenderSettings glset;

View file

@ -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_threshold, 0.5f,CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Float, gl_mask_sprite_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(Bool, gl_sort_textures, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Float, gl_aspect, 1.2f, 0)
EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Bool, cl_capfps) 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) void FGLRenderer::SetViewMatrix(fixed_t viewx, fixed_t viewy, fixed_t viewz, bool mirror, bool planemirror)
{ {
float mult = mirror? -1:1; 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.loadIdentity();
gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Roll, 0.0f, 0.0f, 1.0f); gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Roll, 0.0f, 0.0f, 1.0f);