Added r_useVirtualScreenResolution cvar to control whether to do 2D rendering at 640x480 and stretch to the current resolution (default), or render at the current resolution.

This commit is contained in:
Jonathan Young 2013-09-21 22:12:42 +10:00
parent b3983e582a
commit bb2e41b5d7
9 changed files with 115 additions and 62 deletions

View file

@ -511,7 +511,7 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
if( armorPulse > 0.0f && armorPulse < 1.0f ) if( armorPulse > 0.0f && armorPulse < 1.0f )
{ {
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f - armorPulse ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f - armorPulse );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial );
} }
@ -538,13 +538,13 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
if( alpha < 1.0f ) if( alpha < 1.0f )
{ {
renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.slow.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha ); renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.slow.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial );
} }
if( bfgVision ) if( bfgVision )
{ {
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial );
} }
} }
@ -561,7 +561,7 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
else else
{ {
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, mtr ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, mtr );
} }
} }
} }
@ -656,7 +656,7 @@ void idPlayerView::ScreenFade()
if( fadeColor[ 3 ] != 0.0f ) if( fadeColor[ 3 ] != 0.0f )
{ {
renderSystem->SetColor4( fadeColor[ 0 ], fadeColor[ 1 ], fadeColor[ 2 ], fadeColor[ 3 ] ); renderSystem->SetColor4( fadeColor[ 0 ], fadeColor[ 1 ], fadeColor[ 2 ], fadeColor[ 3 ] );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) );
} }
} }
@ -1076,11 +1076,11 @@ void FullscreenFX_Helltime::AccumPass( const renderView_t* view )
if( clearAccumBuffer ) if( clearAccumBuffer )
{ {
clearAccumBuffer = false; clearAccumBuffer = false;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial );
} }
else else
{ {
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterials[level] ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterials[level] );
} }
} }
@ -1095,7 +1095,7 @@ void FullscreenFX_Helltime::HighQuality()
float t1 = 0.0f; float t1 = 0.0f;
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
} }
/* /*
@ -1201,11 +1201,11 @@ void FullscreenFX_Multiplayer::AccumPass( const renderView_t* view )
if( clearAccumBuffer ) if( clearAccumBuffer )
{ {
clearAccumBuffer = false; clearAccumBuffer = false;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial );
} }
else else
{ {
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterial );
} }
} }
@ -1220,7 +1220,7 @@ void FullscreenFX_Multiplayer::HighQuality()
float t1 = 0.0f; float t1 = 0.0f;
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
} }
/* /*
@ -1375,18 +1375,18 @@ void FullscreenFX_Warp::HighQuality()
p.outer1.x = center.x + x1 * radius; p.outer1.x = center.x + x1 * radius;
p.outer1.y = center.y + y1 * radius; p.outer1.y = center.y + y1 * radius;
p.outer1.z = p.outer1.x / ( float )SCREEN_WIDTH; p.outer1.z = p.outer1.x / ( float )renderSystem->GetVirtualWidth();
p.outer1.w = 1 - ( p.outer1.y / ( float )SCREEN_HEIGHT ); p.outer1.w = 1 - ( p.outer1.y / ( float )renderSystem->GetVirtualHeight() );
p.outer2.x = center.x + x2 * radius; p.outer2.x = center.x + x2 * radius;
p.outer2.y = center.y + y2 * radius; p.outer2.y = center.y + y2 * radius;
p.outer2.z = p.outer2.x / ( float )SCREEN_WIDTH; p.outer2.z = p.outer2.x / ( float )renderSystem->GetVirtualWidth();
p.outer2.w = 1 - ( p.outer2.y / ( float )SCREEN_HEIGHT ); p.outer2.w = 1 - ( p.outer2.y / ( float )renderSystem->GetVirtualHeight() );
p.center.x = center.x; p.center.x = center.x;
p.center.y = center.y; p.center.y = center.y;
p.center.z = p.center.x / ( float )SCREEN_WIDTH; p.center.z = p.center.x / ( float )renderSystem->GetVirtualWidth();
p.center.w = 1 - ( p.center.y / ( float )SCREEN_HEIGHT ); p.center.w = 1 - ( p.center.y / ( float )renderSystem->GetVirtualHeight() );
// draw it // draw it
DrawWarp( p, interp ); DrawWarp( p, interp );
@ -1436,7 +1436,7 @@ void FullscreenFX_EnviroSuit::HighQuality()
float t0 = 1.0f; float t0 = 1.0f;
float s1 = 1.0f; float s1 = 1.0f;
float t1 = 0.0f; float t1 = 0.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
} }
/* /*
@ -1527,7 +1527,7 @@ void FullscreenFX_DoubleVision::HighQuality()
renderSystem->SetColor4( color.x, color.y, color.z, 1.0f ); renderSystem->SetColor4( color.x, color.y, color.z, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
renderSystem->SetColor4( color.x, color.y, color.z, 0.5f ); renderSystem->SetColor4( color.x, color.y, color.z, 0.5f );
s0 = 0.0f; s0 = 0.0f;
@ -1535,7 +1535,7 @@ void FullscreenFX_DoubleVision::HighQuality()
s1 = ( 1.0 - shift ); s1 = ( 1.0 - shift );
t1 = 0.0f; t1 = 0.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
} }
/* /*
@ -1594,7 +1594,7 @@ void FullscreenFX_InfluenceVision::HighQuality()
if( player->GetInfluenceMaterial() ) if( player->GetInfluenceMaterial() )
{ {
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, pct ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, pct );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() );
} }
else if( player->GetInfluenceEntity() == NULL ) else if( player->GetInfluenceEntity() == NULL )
{ {
@ -1712,7 +1712,7 @@ void FullscreenFX_Bloom::HighQuality()
float yScale = 1.0f; float yScale = 1.0f;
renderSystem->SetColor4( alpha, alpha, alpha, 1 ); renderSystem->SetColor4( alpha, alpha, alpha, 1 );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s1, t2 * yScale, s2, t1 * yScale, drawMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s1, t2 * yScale, s2, t1 * yScale, drawMaterial );
shift += currentIntensity; shift += currentIntensity;
} }
@ -1881,7 +1881,7 @@ void FullscreenFXManager::Blendback( float alpha )
float t0 = 1.0f; float t0 = 1.0f;
float s1 = 1.0f; float s1 = 1.0f;
float t1 = 0.0f; float t1 = 0.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, blendBackMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, blendBackMaterial );
} }
} }

View file

@ -858,22 +858,22 @@ void idCommonLocal::RenderSplash()
const float sysAspect = sysWidth / sysHeight; const float sysAspect = sysWidth / sysHeight;
const float splashAspect = 16.0f / 9.0f; const float splashAspect = 16.0f / 9.0f;
const float adjustment = sysAspect / splashAspect; const float adjustment = sysAspect / splashAspect;
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f; const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f;
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f; const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f;
if( barHeight > 0.0f ) if( barHeight > 0.0f )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
} }
if( barWidth > 0.0f ) if( barWidth > 0.0f )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
} }
renderSystem->SetColor4( 1, 1, 1, 1 ); renderSystem->SetColor4( 1, 1, 1, 1 );
renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, splashScreen ); renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, splashScreen );
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu ); const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
renderSystem->RenderCommandBuffers( cmd ); renderSystem->RenderCommandBuffers( cmd );
@ -890,8 +890,8 @@ void idCommonLocal::RenderBink( const char* path )
const float sysHeight = renderSystem->GetHeight(); const float sysHeight = renderSystem->GetHeight();
const float sysAspect = sysWidth / sysHeight; const float sysAspect = sysWidth / sysHeight;
const float movieAspect = ( 16.0f / 9.0f ); const float movieAspect = ( 16.0f / 9.0f );
const float imageWidth = SCREEN_WIDTH * movieAspect / sysAspect; const float imageWidth = renderSystem->GetVirtualWidth() * movieAspect / sysAspect;
const float chop = 0.5f * ( SCREEN_WIDTH - imageWidth ); const float chop = 0.5f * ( renderSystem->GetVirtualWidth() - imageWidth );
idStr materialText; idStr materialText;
materialText.Format( "{ translucent { videoMap %s } }", path ); materialText.Format( "{ translucent { videoMap %s } }", path );
@ -902,7 +902,7 @@ void idCommonLocal::RenderBink( const char* path )
while( Sys_Milliseconds() <= material->GetCinematicStartTime() + material->CinematicLength() ) while( Sys_Milliseconds() <= material->GetCinematicStartTime() + material->CinematicLength() )
{ {
renderSystem->DrawStretchPic( chop, 0, imageWidth, SCREEN_HEIGHT, 0, 0, 1, 1, material ); renderSystem->DrawStretchPic( chop, 0, imageWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, material );
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu ); const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
renderSystem->RenderCommandBuffers( cmd ); renderSystem->RenderCommandBuffers( cmd );
Sys_GenerateEvents(); Sys_GenerateEvents();

View file

@ -70,6 +70,8 @@ public:
void Clear(); void Clear();
private: private:
void Resize();
void KeyDownEvent( int key ); void KeyDownEvent( int key );
void Linefeed(); void Linefeed();
@ -138,6 +140,9 @@ private:
idList< overlayText_t > overlayText; idList< overlayText_t > overlayText;
idList< idDebugGraph*> debugGraphs; idList< idDebugGraph*> debugGraphs;
int lastVirtualScreenWidth;
int lastVirtualScreenHeight;
static idCVar con_speed; static idCVar con_speed;
static idCVar con_notifyTime; static idCVar con_notifyTime;
static idCVar con_noPrint; static idCVar con_noPrint;
@ -356,9 +361,9 @@ void idConsoleLocal::Init()
keyCatching = false; keyCatching = false;
LOCALSAFE_LEFT = 32; LOCALSAFE_LEFT = 32;
LOCALSAFE_RIGHT = 608; LOCALSAFE_RIGHT = SCREEN_WIDTH - LOCALSAFE_LEFT;
LOCALSAFE_TOP = 24; LOCALSAFE_TOP = 24;
LOCALSAFE_BOTTOM = 456; LOCALSAFE_BOTTOM = SCREEN_HEIGHT - LOCALSAFE_TOP;
LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT; LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT;
LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP; LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP;
@ -514,6 +519,24 @@ void idConsoleLocal::Dump( const char* fileName )
fileSystem->CloseFile( f ); fileSystem->CloseFile( f );
} }
/*
==============
idConsoleLocal::Resize
==============
*/
void idConsoleLocal::Resize()
{
if( renderSystem->GetVirtualWidth() == lastVirtualScreenWidth && renderSystem->GetVirtualHeight() == lastVirtualScreenHeight )
return;
lastVirtualScreenWidth = renderSystem->GetVirtualWidth();
lastVirtualScreenHeight = renderSystem->GetVirtualHeight();
LOCALSAFE_RIGHT = renderSystem->GetVirtualWidth() - LOCALSAFE_LEFT;
LOCALSAFE_BOTTOM = renderSystem->GetVirtualHeight() - LOCALSAFE_TOP;
LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT;
LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP;
}
/* /*
================ ================
idConsoleLocal::PageUp idConsoleLocal::PageUp
@ -1036,7 +1059,7 @@ void idConsoleLocal::DrawInput()
renderSystem->DrawSmallChar( LOCALSAFE_LEFT + 1 * SMALLCHAR_WIDTH, y, ']' ); renderSystem->DrawSmallChar( LOCALSAFE_LEFT + 1 * SMALLCHAR_WIDTH, y, ']' );
consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, true ); consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, renderSystem->GetVirtualWidth() - 3 * SMALLCHAR_WIDTH, true );
} }
@ -1119,29 +1142,29 @@ void idConsoleLocal::DrawSolidConsole( float frac )
int lines; int lines;
int currentColor; int currentColor;
lines = idMath::Ftoi( SCREEN_HEIGHT * frac ); lines = idMath::Ftoi( renderSystem->GetVirtualHeight() * frac );
if( lines <= 0 ) if( lines <= 0 )
{ {
return; return;
} }
if( lines > SCREEN_HEIGHT ) if( lines > renderSystem->GetVirtualHeight() )
{ {
lines = SCREEN_HEIGHT; lines = renderSystem->GetVirtualHeight();
} }
// draw the background // draw the background
y = frac * SCREEN_HEIGHT - 2; y = frac * renderSystem->GetVirtualHeight() - 2;
if( y < 1.0f ) if( y < 1.0f )
{ {
y = 0.0f; y = 0.0f;
} }
else else
{ {
renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, SCREEN_WIDTH, y ); renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, renderSystem->GetVirtualWidth(), y );
} }
renderSystem->DrawFilled( colorCyan, 0, y, SCREEN_WIDTH, 2 ); renderSystem->DrawFilled( colorCyan, 0, y, renderSystem->GetVirtualWidth(), 2 );
// draw the version number // draw the version number
@ -1233,6 +1256,8 @@ ForceFullScreen is used by the editor
*/ */
void idConsoleLocal::Draw( bool forceFullScreen ) void idConsoleLocal::Draw( bool forceFullScreen )
{ {
Resize();
if( forceFullScreen ) if( forceFullScreen )
{ {
// if we are forced full screen because of a disconnect, // if we are forced full screen because of a disconnect,

View file

@ -233,7 +233,7 @@ void idCommonLocal::DrawWipeModel()
float fade = ( float )( currentTime - wipeStartTime ) / ( wipeStopTime - wipeStartTime ); float fade = ( float )( currentTime - wipeStartTime ) / ( wipeStopTime - wipeStartTime );
renderSystem->SetColor4( 1, 1, 1, fade ); renderSystem->SetColor4( 1, 1, 1, fade );
renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, wipeMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, wipeMaterial );
} }
/* /*
@ -262,22 +262,22 @@ void idCommonLocal::Draw()
const float sysAspect = sysWidth / sysHeight; const float sysAspect = sysWidth / sysHeight;
const float doomAspect = 4.0f / 3.0f; const float doomAspect = 4.0f / 3.0f;
const float adjustment = sysAspect / doomAspect; const float adjustment = sysAspect / doomAspect;
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f; const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f;
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f; const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f;
if( barHeight > 0.0f ) if( barHeight > 0.0f )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
} }
if( barWidth > 0.0f ) if( barWidth > 0.0f )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
} }
renderSystem->SetColor4( 1, 1, 1, 1 ); renderSystem->SetColor4( 1, 1, 1, 1 );
renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial ); renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial );
} }
#endif #endif
// RB end // RB end
@ -287,7 +287,7 @@ void idCommonLocal::Draw()
if( !gameDraw ) if( !gameDraw )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
} }
game->Shell_Render(); game->Shell_Render();
} }
@ -314,7 +314,7 @@ void idCommonLocal::Draw()
if( !gameDraw ) if( !gameDraw )
{ {
renderSystem->SetColor( colorBlack ); renderSystem->SetColor( colorBlack );
renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
} }
// save off the 2D drawing from the game // save off the 2D drawing from the game
@ -326,7 +326,7 @@ void idCommonLocal::Draw()
else else
{ {
renderSystem->SetColor4( 0, 0, 0, 1 ); renderSystem->SetColor4( 0, 0, 0, 1 );
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial ); renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
} }
{ {

View file

@ -266,13 +266,13 @@ void idGuiModel::EmitFullScreen()
viewDef->scissor.x2 = viewDef->viewport.x2 - viewDef->viewport.x1; viewDef->scissor.x2 = viewDef->viewport.x2 - viewDef->viewport.x1;
viewDef->scissor.y2 = viewDef->viewport.y2 - viewDef->viewport.y1; viewDef->scissor.y2 = viewDef->viewport.y2 - viewDef->viewport.y1;
viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / SCREEN_WIDTH; viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / renderSystem->GetVirtualWidth();
viewDef->projectionMatrix[0 * 4 + 1] = 0.0f; viewDef->projectionMatrix[0 * 4 + 1] = 0.0f;
viewDef->projectionMatrix[0 * 4 + 2] = 0.0f; viewDef->projectionMatrix[0 * 4 + 2] = 0.0f;
viewDef->projectionMatrix[0 * 4 + 3] = 0.0f; viewDef->projectionMatrix[0 * 4 + 3] = 0.0f;
viewDef->projectionMatrix[1 * 4 + 0] = 0.0f; viewDef->projectionMatrix[1 * 4 + 0] = 0.0f;
viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / SCREEN_HEIGHT; viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / renderSystem->GetVirtualHeight();
viewDef->projectionMatrix[1 * 4 + 2] = 0.0f; viewDef->projectionMatrix[1 * 4 + 2] = 0.0f;
viewDef->projectionMatrix[1 * 4 + 3] = 0.0f; viewDef->projectionMatrix[1 * 4 + 3] = 0.0f;

View file

@ -167,12 +167,7 @@ const int BIGCHAR_HEIGHT = 16;
const int SCREEN_WIDTH = 640; const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480; const int SCREEN_HEIGHT = 480;
const int TITLESAFE_LEFT = 32; extern idCVar r_useVirtualScreenResolution;
const int TITLESAFE_RIGHT = 608;
const int TITLESAFE_TOP = 24;
const int TITLESAFE_BOTTOM = 456;
const int TITLESAFE_WIDTH = TITLESAFE_RIGHT - TITLESAFE_LEFT;
const int TITLESAFE_HEIGHT = TITLESAFE_BOTTOM - TITLESAFE_TOP;
class idRenderWorld; class idRenderWorld;
@ -201,6 +196,8 @@ public:
virtual bool IsFullScreen() const = 0; virtual bool IsFullScreen() const = 0;
virtual int GetWidth() const = 0; virtual int GetWidth() const = 0;
virtual int GetHeight() const = 0; virtual int GetHeight() const = 0;
virtual int GetVirtualWidth() const = 0;
virtual int GetVirtualHeight() const = 0;
// return w/h of a single pixel. This will be 1.0 for normal cases. // return w/h of a single pixel. This will be 1.0 for normal cases.
// A side-by-side stereo 3D frame will have a pixel aspect of 0.5. // A side-by-side stereo 3D frame will have a pixel aspect of 0.5.

View file

@ -206,6 +206,7 @@ idCVar stereoRender_enable( "stereoRender_enable", "0", CVAR_INTEGER | CVAR_ARCH
idCVar stereoRender_swapEyes( "stereoRender_swapEyes", "0", CVAR_BOOL | CVAR_ARCHIVE, "reverse eye adjustments" ); idCVar stereoRender_swapEyes( "stereoRender_swapEyes", "0", CVAR_BOOL | CVAR_ARCHIVE, "reverse eye adjustments" );
idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_ARCHIVE, "subtract from opposite eye to reduce ghosting" ); idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_ARCHIVE, "subtract from opposite eye to reduce ghosting" );
idCVar r_useVirtualScreenResolution( "r_useVirtualScreenResolution", "1", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "do 2D rendering at 640x480 and stretch to the current resolution" );
// GL_ARB_multitexture // GL_ARB_multitexture
PFNGLACTIVETEXTUREPROC qglActiveTextureARB; PFNGLACTIVETEXTUREPROC qglActiveTextureARB;
@ -2753,6 +2754,34 @@ int idRenderSystemLocal::GetHeight() const
return glConfig.nativeScreenHeight; return glConfig.nativeScreenHeight;
} }
/*
========================
idRenderSystemLocal::GetVirtualWidth
========================
*/
int idRenderSystemLocal::GetVirtualWidth() const
{
if( r_useVirtualScreenResolution.GetBool() )
{
return SCREEN_WIDTH;
}
return glConfig.nativeScreenWidth;
}
/*
========================
idRenderSystemLocal::GetVirtualHeight
========================
*/
int idRenderSystemLocal::GetVirtualHeight() const
{
if( r_useVirtualScreenResolution.GetBool() )
{
return SCREEN_HEIGHT;
}
return glConfig.nativeScreenHeight;
}
/* /*
======================== ========================
idRenderSystemLocal::GetStereo3DMode idRenderSystemLocal::GetStereo3DMode

View file

@ -729,6 +729,8 @@ public:
virtual void EnableStereoScopicRendering( const stereo3DMode_t mode ) const; virtual void EnableStereoScopicRendering( const stereo3DMode_t mode ) const;
virtual int GetWidth() const; virtual int GetWidth() const;
virtual int GetHeight() const; virtual int GetHeight() const;
virtual int GetVirtualWidth() const;
virtual int GetVirtualHeight() const;
virtual float GetPixelAspect() const; virtual float GetPixelAspect() const;
virtual float GetPhysicalScreenWidthInCentimeters() const; virtual float GetPhysicalScreenWidthInCentimeters() const;
virtual idRenderWorld* AllocRenderWorld(); virtual idRenderWorld* AllocRenderWorld();

View file

@ -140,7 +140,7 @@ void idSWF::Render( idRenderSystem* gui, int time, bool isSplitscreen )
renderBorder = renderState.matrix.tx / scale; renderBorder = renderState.matrix.tx / scale;
scaleToVirtual.Set( ( float )SCREEN_WIDTH / sysWidth, ( float )SCREEN_HEIGHT / sysHeight ); scaleToVirtual.Set( ( float )renderSystem->GetVirtualWidth() / sysWidth, ( float )renderSystem->GetVirtualHeight() / sysHeight );
RenderSprite( gui, mainspriteInstance, renderState, time, isSplitscreen ); RenderSprite( gui, mainspriteInstance, renderState, time, isSplitscreen );