0
0
Fork 0
mirror of https://github.com/id-Software/DOOM-3-BFG.git synced 2025-03-14 14:40:44 +00:00

Redraw Imtui when DmapPacifierCompileProgressIncrement() hits a threshold

This commit is contained in:
Robert Beckebans 2024-06-21 21:16:04 +02:00
parent caebeef0ca
commit 9deff76115
2 changed files with 35 additions and 15 deletions
neo
renderer
tools/compilers

View file

@ -45,19 +45,6 @@ void CommandlineProgressBar::Increment( bool updateScreen )
{
if( ( count + 1 ) >= nextTicCount )
{
#if 1 //!defined( USE_NVRHI )
if( updateScreen )
{
// restore the original resolution, same as "vid_restart"
//glConfig.nativeScreenWidth = sysWidth;
//glConfig.nativeScreenHeight = sysHeight;
//R_SetNewMode( false );
// resize frame buffers (this triggers SwapBuffers)
//tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL );
}
#endif
size_t ticsNeeded = ( size_t )( ( ( double )( count + 1 ) / expectedCount ) * 50.0 );
do
@ -76,7 +63,6 @@ void CommandlineProgressBar::Increment( bool updateScreen )
common->Printf( "\n" );
}
#if 1 //!defined( USE_NVRHI )
if( updateScreen )
{
common->UpdateScreen( false );
@ -84,7 +70,6 @@ void CommandlineProgressBar::Increment( bool updateScreen )
// swap front / back buffers
tr.SwapCommandBuffers( NULL, NULL, NULL, NULL, NULL, NULL );
}
#endif
}
count++;

View file

@ -734,6 +734,8 @@ class idCommonLocal : public idCommon
private:
int count = 0;
int expectedCount = 0;
size_t tics = 0;
size_t nextTicCount = 0;
public:
bool com_refreshOnPrint = true; // update the screen every print for dmap
@ -1060,6 +1062,8 @@ public:
{
count = 0;
expectedCount = total;
tics = 0;
nextTicCount = 0;
stateUI.progress = 0;
}
@ -1069,6 +1073,37 @@ public:
count += step;
stateUI.progress = float( count ) / expectedCount;
// don't refresh the UI with every step if there are e.g. 1300 steps
if( ( count + 1 ) >= nextTicCount )
{
size_t ticsNeeded = ( size_t )( ( ( double )( count + 1 ) / expectedCount ) * 50.0 );
do
{
//common->Printf( "*" );
}
while( ++tics < ticsNeeded );
nextTicCount = ( size_t )( ( tics / 50.0 ) * expectedCount );
/*
if( count == ( expectedCount - 1 ) )
{
//if( tics < 51 )
//{
// common->Printf( "*" );
//}
//common->Printf( "\n" );
//stateUI.progress = 1;
}
*/
if( com_refreshOnPrint )
{
common->UpdateScreen( false );
}
}
}
};