mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Merged LordHavoc's image compression progress bar
This commit is contained in:
parent
e6498e2975
commit
1e4292e52a
2 changed files with 96 additions and 7 deletions
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
|
||||
#include "Common_local.h"
|
||||
#include "../renderer/Image.h" // now I did it!
|
||||
#include "../renderer/Image.h"
|
||||
|
||||
// RB begin
|
||||
#if defined(USE_DOOMCLASSIC)
|
||||
|
@ -194,7 +194,8 @@ gameReturn_t idGameThread::RunGameAndDraw( int numGameFrames_, idUserCmdMgr& use
|
|||
numGameFrames = numGameFrames_;
|
||||
|
||||
// start the thread going
|
||||
if( com_smp.GetInteger() <= 0 )
|
||||
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
|
||||
if( com_smp.GetBool() == false || com_editors != 0 )
|
||||
{
|
||||
// run it in the main thread so PIX profiling catches everything
|
||||
Run();
|
||||
|
@ -249,8 +250,49 @@ void idCommonLocal::Draw()
|
|||
Sys_Sleep( com_sleepDraw.GetInteger() );
|
||||
}
|
||||
|
||||
if( loadGUI != NULL )
|
||||
if( loadPacifierBinarizeActive )
|
||||
{
|
||||
// foresthale 2014-05-30: when binarizing an asset we show a special
|
||||
// overlay indicating progress
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
|
||||
// render the loading gui (idSWF actually) if it is loaded
|
||||
// (we want to see progress of the loading gui binarize too)
|
||||
if( loadGUI != NULL )
|
||||
loadGUI->Render( renderSystem, Sys_Milliseconds() );
|
||||
|
||||
// update our progress estimates
|
||||
int time = Sys_Milliseconds();
|
||||
if( loadPacifierBinarizeProgress > 0.0f )
|
||||
loadPacifierBinarizeTimeLeft = ( 1.0 - loadPacifierBinarizeProgress ) * ( time - loadPacifierBinarizeStartTime ) * 0.001f / loadPacifierBinarizeProgress;
|
||||
else
|
||||
loadPacifierBinarizeTimeLeft = -1.0f;
|
||||
|
||||
// prepare our strings
|
||||
const char* text;
|
||||
if( loadPacifierBinarizeTimeLeft >= 99.5f )
|
||||
text = va( "Binarizing %3.0f%% ETA %2.0f minutes", loadPacifierBinarizeProgress * 100.0f, loadPacifierBinarizeTimeLeft / 60.0f );
|
||||
else if( loadPacifierBinarizeTimeLeft )
|
||||
text = va( "Binarizing %3.0f%% ETA %2.0f seconds", loadPacifierBinarizeProgress * 100.0f, loadPacifierBinarizeTimeLeft );
|
||||
else
|
||||
text = va( "Binarizing %3.0f%%", loadPacifierBinarizeProgress * 100.0f );
|
||||
|
||||
// draw our basic overlay
|
||||
renderSystem->SetColor( idVec4( 0.0f, 0.0f, 0.5f, 1.0f ) );
|
||||
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - 48, SCREEN_WIDTH, 48, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->SetColor( idVec4( 0.0f, 0.5f, 0.8f, 1.0f ) );
|
||||
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - 48, loadPacifierBinarizeProgress * SCREEN_WIDTH, 32, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawSmallStringExt( 0, SCREEN_HEIGHT - 48, loadPacifierBinarizeFilename.c_str(), idVec4( 1.0f, 1.0f, 1.0f, 1.0f ), true );
|
||||
renderSystem->DrawSmallStringExt( 0, SCREEN_HEIGHT - 32, va( "%s %d/%d lvls", loadPacifierBinarizeInfo.c_str(), loadPacifierBinarizeMiplevel, loadPacifierBinarizeMiplevelTotal ), idVec4( 1.0f, 1.0f, 1.0f, 1.0f ), true );
|
||||
renderSystem->DrawSmallStringExt( 0, SCREEN_HEIGHT - 16, text, idVec4( 1.0f, 1.0f, 1.0f, 1.0f ), true );
|
||||
}
|
||||
else if( loadGUI != NULL )
|
||||
{
|
||||
// foresthale 2014-05-30: showing a black background looks better than flickering in widescreen
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
|
||||
loadGUI->Render( renderSystem, Sys_Milliseconds() );
|
||||
}
|
||||
// RB begin
|
||||
|
@ -371,6 +413,7 @@ void idCommonLocal::UpdateScreen( bool captureToImage, bool releaseMouse )
|
|||
// build all the draw commands without running a new game tic
|
||||
Draw();
|
||||
|
||||
// foresthale 2014-03-01: note: the only place that has captureToImage=true is idAutoRender::StartBackgroundAutoSwaps
|
||||
if( captureToImage )
|
||||
{
|
||||
renderSystem->CaptureRenderToImage( "_currentRender", false );
|
||||
|
@ -479,6 +522,8 @@ void idCommonLocal::Frame()
|
|||
|
||||
eventLoop->RunEventLoop();
|
||||
|
||||
renderSystem->OnFrame();
|
||||
|
||||
// Activate the shell if it's been requested
|
||||
if( showShellRequested && game )
|
||||
{
|
||||
|
@ -554,7 +599,9 @@ void idCommonLocal::Frame()
|
|||
// This may block if the GPU isn't finished renderng the previous frame.
|
||||
frameTiming.startSyncTime = Sys_Microseconds();
|
||||
const emptyCommand_t* renderCommands = NULL;
|
||||
if( com_smp.GetInteger() > 0 )
|
||||
|
||||
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
|
||||
if( com_smp.GetInteger() > 0 && com_editors == 0 )
|
||||
{
|
||||
renderCommands = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
}
|
||||
|
@ -783,12 +830,12 @@ void idCommonLocal::Frame()
|
|||
// start the game / draw command generation thread going in the background
|
||||
gameReturn_t ret = gameThread.RunGameAndDraw( numGameFrames, userCmdMgr, IsClient(), gameFrame - numGameFrames );
|
||||
|
||||
if( com_smp.GetInteger() < 0 )
|
||||
{
|
||||
// foresthale 2014-05-12: also check com_editors as many of them are not particularly thread-safe (editLights for example)
|
||||
if( !com_smp.GetInteger() < 0 )
|
||||
// RB: this is the same as Doom 3 renderSystem->EndFrame()
|
||||
renderSystem->SwapCommandBuffers_FinishRendering( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
}
|
||||
else if( com_smp.GetInteger() == 0 )
|
||||
else if( com_smp.GetInteger() == 0 || com_editors != 0 )
|
||||
{
|
||||
// in non-smp mode, run the commands we just generated, instead of
|
||||
// frame-delayed ones from a background thread
|
||||
|
|
|
@ -217,6 +217,35 @@ void idImage::AllocImage( const idImageOpts& imgOpts, textureFilter_t tf, textur
|
|||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
// foresthale 2014-05-30: give a nice progress display when binarizing
|
||||
commonLocal.LoadPacifierBinarizeFilename( GetName() , "generated image" );
|
||||
if( opts.numLevels > 1 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.height * 4 / 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.height );
|
||||
}
|
||||
|
||||
commonLocal.LoadPacifierBinarizeEnd();
|
||||
|
||||
|
||||
// foresthale 2014-05-30: give a nice progress display when binarizing
|
||||
commonLocal.LoadPacifierBinarizeFilename( GetName(), "generated cube image" );
|
||||
if( opts.numLevels > 1 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.width * 6 * 4 / 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.width * 6 );
|
||||
}
|
||||
|
||||
commonLocal.LoadPacifierBinarizeEnd();
|
||||
|
||||
===============
|
||||
GetGeneratedName
|
||||
|
||||
|
@ -474,6 +503,19 @@ void idImage::ActuallyLoadImage( bool fromBackEnd )
|
|||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.width * 6 );
|
||||
}
|
||||
|
||||
commonLocal.LoadPacifierBinarizeEnd();
|
||||
|
||||
// foresthale 2014-05-30: give a nice progress display when binarizing
|
||||
commonLocal.LoadPacifierBinarizeFilename( generatedName.c_str(), binarizeReason.c_str() );
|
||||
if( opts.numLevels > 1 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.width * 6 * 4 / 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressTotal( opts.width * opts.width * 6 );
|
||||
}
|
||||
|
||||
im.Load2DFromMemory( opts.width, opts.height, pic, opts.numLevels, opts.format, opts.colorFormat, opts.gammaMips );
|
||||
commonLocal.LoadPacifierBinarizeEnd();
|
||||
|
||||
|
|
Loading…
Reference in a new issue