Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/engine/client/cl_avi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ bool CL_OpenAVIForWriting( const char *fileName )

afd.frameRate = cl_aviFrameRate->integer;
afd.framePeriod = ( int )( 1000000.0f / afd.frameRate );
afd.width = cls.glconfig.vidWidth;
afd.height = cls.glconfig.vidHeight;
afd.width = cls.windowConfig.vidWidth;
afd.height = cls.windowConfig.vidHeight;

if ( cl_aviMotionJpeg->integer )
{
Expand Down
20 changes: 18 additions & 2 deletions src/engine/client/cl_cgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,15 @@ void CGameVM::CGameStaticInit()

void CGameVM::CGameInit(int serverMessageNum, int clientNum)
{
this->SendMsg<CGameInitMsg>(serverMessageNum, clientNum, cls.glconfig, cl.gameState);
glconfig_t glConfig;
memset( &glConfig, 0, sizeof( glconfig_t ) );
glConfig.displayAspect = cls.windowConfig.displayAspect;
glConfig.displayWidth = cls.windowConfig.displayWidth;
glConfig.displayHeight = cls.windowConfig.displayHeight;
glConfig.vidWidth = cls.windowConfig.vidWidth;
glConfig.vidHeight = cls.windowConfig.vidHeight;

this->SendMsg<CGameInitMsg>(serverMessageNum, clientNum, glConfig, cl.gameState);
NetcodeTable psTable;
size_t psSize;
this->SendMsg<VM::GetNetcodeTablesMsg>(psTable, psSize);
Expand Down Expand Up @@ -1038,7 +1046,15 @@ void CGameVM::CGameTextInputEvent(int c)

void CGameVM::CGameRocketInit()
{
this->SendMsg<CGameRocketInitMsg>(cls.glconfig);
glconfig_t glConfig;
memset( &glConfig, 0, sizeof( glconfig_t ) );
glConfig.displayAspect = cls.windowConfig.displayAspect;
glConfig.displayWidth = cls.windowConfig.displayWidth;
glConfig.displayHeight = cls.windowConfig.displayHeight;
glConfig.vidWidth = cls.windowConfig.vidWidth;
glConfig.vidHeight = cls.windowConfig.vidHeight;

this->SendMsg<CGameRocketInitMsg>( glConfig );
}

void CGameVM::CGameRocketFrame()
Expand Down
28 changes: 14 additions & 14 deletions src/engine/client/cl_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ bool Con_CheckResize()

bool ret = true;

if ( cls.glconfig.vidWidth )
if ( cls.windowConfig.vidWidth )
{
int consoleVidWidth = cls.glconfig.vidWidth - 2 * (consoleState.margin.sides + consoleState.padding.sides );
int consoleVidWidth = cls.windowConfig.vidWidth - 2 * (consoleState.margin.sides + consoleState.padding.sides );
textWidthInChars = consoleVidWidth / SCR_ConsoleFontUnicharWidth( 'W' );
}
else
Expand Down Expand Up @@ -483,7 +483,7 @@ bool CL_InternalConsolePrint( const char *text )
}

//Video hasn't been initialized
if ( ! cls.glconfig.vidWidth ) {
if ( ! cls.windowConfig.vidWidth ) {
return false;
}

Expand Down Expand Up @@ -586,7 +586,7 @@ Draws the background of the console (on the virtual 640x480 resolution)
*/
void Con_DrawBackground()
{
const int consoleWidth = cls.glconfig.vidWidth - 2 * consoleState.margin.sides;
const int consoleWidth = cls.windowConfig.vidWidth - 2 * consoleState.margin.sides;

// draw the background
Color::Color color (
Expand Down Expand Up @@ -617,7 +617,7 @@ void Con_DrawBackground()
consoleState.border.sides, consoleState.height + consoleState.border.bottom, borderColor );

//right border
SCR_FillRect( cls.glconfig.vidWidth - consoleState.margin.sides, consoleState.margin.top - consoleState.border.top,
SCR_FillRect( cls.windowConfig.vidWidth - consoleState.margin.sides, consoleState.margin.top - consoleState.border.top,
consoleState.border.sides, consoleState.border.top + consoleState.height, borderColor );

//bottom border
Expand Down Expand Up @@ -670,7 +670,7 @@ void Con_DrawRightFloatingTextLine( const int linePosition, const Color::Color&
+ charHeight;

i = strlen( text );
currentWidthLocation = cls.glconfig.vidWidth
currentWidthLocation = cls.windowConfig.vidWidth
- SCR_ConsoleFontStringWidth( text, i )
- consoleState.margin.sides - consoleState.padding.sides;

Expand Down Expand Up @@ -727,7 +727,7 @@ void Con_DrawConsoleScrollbackIndicator( int lineDrawPosition )
void Con_DrawConsoleScrollbar()
{
const int freeConsoleHeight = consoleState.height - consoleState.padding.top - consoleState.padding.bottom;
const float scrollBarX = cls.glconfig.vidWidth - consoleState.margin.sides - consoleState.padding.sides - 2 * consoleState.border.sides;
const float scrollBarX = cls.windowConfig.vidWidth - consoleState.margin.sides - consoleState.padding.sides - 2 * consoleState.border.sides;
const float scrollBarY = consoleState.margin.top + consoleState.border.top + consoleState.padding.top + freeConsoleHeight * 0.10f;
const float scrollBarLength = freeConsoleHeight * 0.80f;
const float scrollBarWidth = consoleState.border.sides * 2;
Expand Down Expand Up @@ -783,7 +783,7 @@ void Con_DrawScrollbackMarkerline( int lineDrawPosition )

SCR_FillRect( consoleState.margin.sides + consoleState.border.sides + consoleState.padding.sides/2,
lineDrawPosition + SCR_ConsoleFontCharVPadding(),
cls.glconfig.vidWidth - 2 * consoleState.margin.sides - 2 * consoleState.border.sides - consoleState.padding.sides/2 - scrollBarImpliedPadding,
cls.windowConfig.vidWidth - 2 * consoleState.margin.sides - 2 * consoleState.border.sides - consoleState.padding.sides/2 - scrollBarImpliedPadding,
1, color );
}

Expand Down Expand Up @@ -933,7 +933,7 @@ void Con_DrawAnimatedConsole()
//clip about text and content to the console
contentClipping [ 0 ] = consoleState.margin.sides + consoleState.border.sides; //x
contentClipping [ 1 ] = consoleState.margin.top + consoleState.border.top; //y
contentClipping [ 2 ] = cls.glconfig.vidWidth - consoleState.margin.sides - consoleState.border.sides; //x-end
contentClipping [ 2 ] = cls.windowConfig.vidWidth - consoleState.margin.sides - consoleState.border.sides; //x-end
contentClipping [ 3 ] = consoleState.margin.top + consoleState.border.top + consoleState.height ; //y-end
re.SetClipRegion( contentClipping );

Expand Down Expand Up @@ -1019,7 +1019,7 @@ void Con_UpdateConsoleState()
/*
* calculate current console height
*/
consoleState.height = con_height->integer * 0.01f * (cls.glconfig.vidHeight
consoleState.height = con_height->integer * 0.01f * (cls.windowConfig.vidHeight
- consoleState.margin.top - consoleState.margin.bottom
- consoleState.border.top - consoleState.border.bottom
);
Expand All @@ -1038,9 +1038,9 @@ void Con_UpdateConsoleState()
consoleState.height *= consoleState.currentAnimationFraction;
}

if ( consoleState.height > cls.glconfig.vidHeight )
if ( consoleState.height > cls.windowConfig.vidHeight )
{
consoleState.height = cls.glconfig.vidHeight;
consoleState.height = cls.windowConfig.vidHeight;
}

/*
Expand Down Expand Up @@ -1082,7 +1082,7 @@ void Con_RunAnimatedConsole()
Con_UpdateConsoleState( ); //recalculate
}

consoleVidWidth = cls.glconfig.vidWidth - 2 * (consoleState.margin.sides + consoleState.padding.sides );
consoleVidWidth = cls.windowConfig.vidWidth - 2 * (consoleState.margin.sides + consoleState.padding.sides );

if( 2 * con_horizontalPadding->value >= consoleVidWidth )
{
Expand Down Expand Up @@ -1214,7 +1214,7 @@ class GraphicalTarget : public Log::Target {
}

//Video hasn't been initialized
if ( ! cls.glconfig.vidWidth ) {
if ( ! cls.windowConfig.vidWidth ) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/engine/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ bool CL_InitRenderer()
fileHandle_t f;

// this sets up the renderer and calls R_Init
if ( !re.BeginRegistration( &cls.glconfig, &cls.glconfig2 ) )
if ( !re.BeginRegistration( &cls.windowConfig ) )
{
return false;
}
Expand All @@ -2126,7 +2126,7 @@ bool CL_InitRenderer()
else
{
// This gets 12px on 1920×1080 screen, which is libRocket default for 1em
int fontScale = std::min(cls.glconfig.vidWidth, cls.glconfig.vidHeight) / 90;
int fontScale = std::min(cls.windowConfig.vidWidth, cls.windowConfig.vidHeight) / 90;

// fontScale / 12px gets 1px on 1920×1080 screen
cls.consoleFont = re.RegisterFont( cl_consoleFont->string, cl_consoleFontSize->integer * fontScale / 12 );
Expand All @@ -2145,7 +2145,7 @@ bool CL_InitRenderer()

cls.whiteShader = re.RegisterShader( "white", RSF_NOMIP );

g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
g_console_field_width = cls.windowConfig.vidWidth / SMALLCHAR_WIDTH - 2;
g_consoleField.SetWidth(g_console_field_width);

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/client/cl_scrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void SCR_AdjustFrom640( float *x, float *y, float *w, float *h )
float yscale;

// scale for screen sizes
xscale = cls.glconfig.vidWidth / 640.0;
yscale = cls.glconfig.vidHeight / 480.0;
xscale = cls.windowConfig.vidWidth / 640.0;
yscale = cls.windowConfig.vidHeight / 480.0;

if ( x )
{
Expand Down
4 changes: 2 additions & 2 deletions src/engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ struct clientStatic_t
char updateInfoString[ MAX_INFO_STRING ];

// rendering info
glconfig_t glconfig;
glconfig2_t glconfig2;
WindowConfig windowConfig;
GLConfig glConfig;
qhandle_t charSetShader;
qhandle_t whiteShader;
bool useLegacyConsoleFont;
Expand Down
9 changes: 4 additions & 5 deletions src/engine/null/null_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,11 @@ const char *RE_ShaderNameFromHandle( qhandle_t )
return "";
}

bool RE_BeginRegistration( glconfig_t *config, glconfig2_t *glconfig2 )
bool RE_BeginRegistration( WindowConfig* windowCfg )
{
*config = glconfig_t{};
config->vidWidth = 640;
config->vidHeight = 480;
*glconfig2 = glconfig2_t{};
*windowCfg = WindowConfig{};
windowCfg->vidWidth = 640;
windowCfg->vidHeight = 480;

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/GLMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class GLVAO {
vboAttributeLayout_t& attr = attrs[spec->attrIndex];
ASSERT_NQ( spec->numComponents, 0U );
attr.componentType = spec->componentStorageType;
if ( attr.componentType == GL_HALF_FLOAT && !glConfig2.halfFloatVertexAvailable ) {
if ( attr.componentType == GL_HALF_FLOAT && !glConfig.halfFloatVertexAvailable ) {
attr.componentType = GL_FLOAT;
}
attr.numComponents = spec->numComponents;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/renderer/GLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_public.h"
#include "tr_types.h"

extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init
extern glconfig2_t glConfig2;
extern WindowConfig windowConfig; // outside of TR since it shouldn't be cleared during ref re-init
extern GLConfig glConfig;

void GL_CheckErrors_( const char *filename, int line );

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/InternalImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int R_GetImageCustomScalingStep( const image_t *image, const imageParams_t &imag
// Scale down the image size according to the screen size.
if ( image->bits & IF_FITSCREEN )
{
int largerSide = std::max( glConfig.vidWidth, glConfig.vidHeight );
int largerSide = std::max( windowConfig.vidWidth, windowConfig.vidHeight );

if ( scaledDimension > largerSide )
{
Expand Down
10 changes: 5 additions & 5 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void MaterialSystem::GenerateWorldCommandBuffer( std::vector<MaterialSurface>& s
Log::Debug( "Generating world command buffer" );

// TexBundles
if ( glConfig2.maxUniformBlockSize >= MIN_MATERIAL_UBO_SIZE ) {
if ( glConfig.maxUniformBlockSize >= MIN_MATERIAL_UBO_SIZE ) {
texDataBufferType = GL_UNIFORM_BUFFER;
texDataBindingPoint = BufferBind::TEX_DATA;
} else {
Expand Down Expand Up @@ -813,7 +813,7 @@ void BindShaderLightMapping( Material* material ) {
gl_lightMappingShaderMaterial->SetReliefMapping( material->enableReliefMapping );
/* Reflective specular setting is different here than in ProcessMaterialLightMapping(),
because we don't have cubemaps built yet at this point, but for the purposes of the material ordering there's no difference */
gl_lightMappingShaderMaterial->SetReflectiveSpecular( glConfig2.reflectionMapping && material->enableSpecularMapping && !( tr.refdef.rdflags & RDF_NOCUBEMAP ) );
gl_lightMappingShaderMaterial->SetReflectiveSpecular( glConfig.reflectionMapping && material->enableSpecularMapping && !( tr.refdef.rdflags & RDF_NOCUBEMAP ) );
gl_lightMappingShaderMaterial->SetPhysicalShading( material->enablePhysicalMapping );

// Bind shader program.
Expand All @@ -836,7 +836,7 @@ void BindShaderLightMapping( Material* material ) {
gl_lightMappingShaderMaterial->SetUniform_LightGrid2Bindless( GL_BindToTMU( BIND_LIGHTGRID2, tr.lightGrid2Image ) );
}

if ( glConfig2.realtimeLighting ) {
if ( glConfig.realtimeLighting ) {
// bind u_LightTiles
gl_lightMappingShaderMaterial->SetUniform_LightTilesBindless(
GL_BindToTMU( BIND_LIGHTTILES, tr.lighttileRenderImage )
Expand All @@ -852,7 +852,7 @@ void BindShaderLightMapping( Material* material ) {
gl_lightMappingShaderMaterial->SetUniform_Time( backEnd.refdef.floatTime - backEnd.currentEntity->e.shaderTime );

// TODO: Move this to a per-entity buffer
if ( glConfig2.reflectionMapping && !( tr.refdef.rdflags & RDF_NOCUBEMAP ) ) {
if ( glConfig.reflectionMapping && !( tr.refdef.rdflags & RDF_NOCUBEMAP ) ) {
bool isWorldEntity = backEnd.currentEntity == &tr.worldEntity;

vec3_t position;
Expand Down Expand Up @@ -1466,7 +1466,7 @@ void MaterialSystem::AddStageTextures( MaterialSurface* surface, shader_t* shade
}
surface->texDataDynamic[stage] = dynamic;

if ( glConfig2.realtimeLighting ) {
if ( glConfig.realtimeLighting ) {
material->AddTexture( tr.lighttileRenderImage->texture );
}
}
Expand Down
Loading