- cleaned up the video scale mode code a bit, in order to increase future flexibility.
This commit is contained in:
parent
f1a6ef9cc8
commit
30087f7cd7
9 changed files with 118 additions and 55 deletions
|
|
@ -65,6 +65,7 @@
|
|||
#include "gl/shaders/gl_postprocessshader.h"
|
||||
#include "gl/renderer/gl_2ddrawer.h"
|
||||
#include "gl/stereo3d/gl_stereo3d.h"
|
||||
#include "r_videoscale.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -153,8 +154,6 @@ EXTERN_CVAR(Float, vid_contrast)
|
|||
EXTERN_CVAR(Float, vid_saturation)
|
||||
EXTERN_CVAR(Int, gl_satformula)
|
||||
|
||||
bool ViewportLinearScale();
|
||||
|
||||
void FGLRenderer::RenderScreenQuad()
|
||||
{
|
||||
mVBO->BindVBO();
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ EXTERN_CVAR(Int, vid_scalemode)
|
|||
|
||||
CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE);
|
||||
|
||||
bool ViewportIsScaled43();
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Renderer interface
|
||||
|
|
@ -283,7 +285,7 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
|
|||
int screenWidth = framebuffer->GetWidth();
|
||||
int screenHeight = framebuffer->GetHeight();
|
||||
float scaleX, scaleY;
|
||||
if (vid_scalemode == 1 || vid_scalemode == 2)
|
||||
if (ViewportIsScaled43())
|
||||
{
|
||||
scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (screenHeight * 1.2f));
|
||||
scaleY = scaleX * 1.2f;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "gl/gl_functions.h"
|
||||
#include "gl/renderer/gl_2ddrawer.h"
|
||||
#include "gl_debug.h"
|
||||
#include "r_videoscale.h"
|
||||
|
||||
EXTERN_CVAR (Float, vid_brightness)
|
||||
EXTERN_CVAR (Float, vid_contrast)
|
||||
|
|
@ -64,8 +65,6 @@ FGLRenderer *GLRenderer;
|
|||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
void gl_SetupMenu();
|
||||
int ViewportScaledWidth(int width);
|
||||
int ViewportScaledHeight(int height);
|
||||
|
||||
CUSTOM_CVAR(Int, vid_hwgamma, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
#include "gl/utility/gl_templates.h"
|
||||
#include "gl/gl_functions.h"
|
||||
#include "gl_debug.h"
|
||||
#include "r_videoscale.h"
|
||||
|
||||
#include "swrenderer/scene/r_light.h"
|
||||
|
||||
|
|
@ -93,9 +94,6 @@ EXTERN_CVAR(Bool, vid_vsync)
|
|||
EXTERN_CVAR(Float, transsouls)
|
||||
EXTERN_CVAR(Int, vid_refreshrate)
|
||||
EXTERN_CVAR(Bool, gl_legacy_mode)
|
||||
EXTERN_CVAR(Int, vid_scalemode)
|
||||
|
||||
bool ViewportLinearScale();
|
||||
|
||||
#ifdef WIN32
|
||||
extern cycle_t BlitCycles;
|
||||
|
|
@ -104,9 +102,6 @@ extern cycle_t BlitCycles;
|
|||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
|
||||
int ViewportScaledWidth(int width);
|
||||
int ViewportScaledHeight(int height);
|
||||
|
||||
#ifndef WIN32
|
||||
// This has to be in this file because system headers conflict Doom headers
|
||||
DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen)
|
||||
|
|
@ -729,7 +724,7 @@ void OpenGLSWFrameBuffer::Present()
|
|||
glViewport(0, 0, clientWidth, clientHeight);
|
||||
|
||||
float scaleX, scaleY;
|
||||
if (vid_scalemode == 1 || vid_scalemode == 2)
|
||||
if (ViewportIsScaled43())
|
||||
{
|
||||
scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f));
|
||||
scaleY = scaleX * 1.2f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue