diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 190ca50c..43c39ab7 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -3647,7 +3647,8 @@ void MainFrame_Construct(){ PreferencesDialog_addSettingsPreferences( FreeCaller1() ); g_brushCount.setCountChangedCallback( FreeCaller() ); - g_entityCount.setCountChangedCallback( FreeCaller() ); + g_patchCount.setCountChangedCallback( FreeCaller() ); + g_entityCount.setCountChangedCallback( FreeCaller() ); GlobalEntityCreator().setCounter( &g_entityCount ); GLWidget_sharedContextCreated = GlobalGL_sharedContextCreated; @@ -3661,6 +3662,7 @@ void MainFrame_Destroy(){ GlobalEntityCreator().setCounter( 0 ); g_entityCount.setCountChangedCallback( Callback() ); + g_patchCount.setCountChangedCallback( Callback() ); g_brushCount.setCountChangedCallback( Callback() ); } diff --git a/radiant/map.cpp b/radiant/map.cpp index 04282b5f..2170c93f 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -848,19 +848,14 @@ void Scene_EntityBreakdown( EntityBreakdown& entitymap ){ class CountStuffWalker : public scene::Graph::Walker { -int& m_patches; int& m_ents_ingame; int& m_groupents; int& m_groupents_ingame; public: -CountStuffWalker( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame ) - : m_patches( patches ), m_ents_ingame( ents_ingame ), m_groupents( groupents ), m_groupents_ingame( groupents_ingame ){ +CountStuffWalker( int& ents_ingame, int& groupents, int& groupents_ingame ) + : m_ents_ingame( ents_ingame ), m_groupents( groupents ), m_groupents_ingame( groupents_ingame ){ } bool pre( const scene::Path& path, scene::Instance& instance ) const { - Patch* patch = Node_getPatch( path.top() ); - if( patch != 0 ){ - ++m_patches; - } Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 ){ if( entity->isContainer() ){ @@ -882,8 +877,8 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { } }; -void Scene_CountStuff( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame ){ - GlobalSceneGraph().traverse( CountStuffWalker( patches, ents_ingame, groupents, groupents_ingame ) ); +void Scene_CountStuff( int& ents_ingame, int& groupents, int& groupents_ingame ){ + GlobalSceneGraph().traverse( CountStuffWalker( ents_ingame, groupents, groupents_ingame ) ); } WindowPosition g_posMapInfoWnd( -1, -1, c_default_window_pos.w, c_default_window_pos.h ); @@ -1088,12 +1083,10 @@ void DoMapInfo(){ g_object_unref( G_OBJECT( EntityBreakdownWalker ) ); - int n_patches = 0; int n_ents_ingame = 0; int n_groupents = 0; int n_groupents_ingame = 0; - Scene_CountStuff( n_patches, n_ents_ingame, n_groupents, n_groupents_ingame ); - //globalOutputStream() << n_patches << n_ents_ingame << n_groupents << n_groupents_ingame << "\n"; + Scene_CountStuff( n_ents_ingame, n_groupents, n_groupents_ingame ); char *markup; @@ -1101,7 +1094,7 @@ void DoMapInfo(){ gtk_label_set_markup( GTK_LABEL( w_brushes ), markup ); g_free( markup ); - markup = g_markup_printf_escaped( "%i ", n_patches ); + markup = g_markup_printf_escaped( "%i ", Unsigned( g_patchCount.get() ) ); gtk_label_set_markup( GTK_LABEL( w_patches ), markup ); g_free( markup ); @@ -1169,7 +1162,7 @@ void Map_LoadFile( const char *filename ){ globalOutputStream() << "--- LoadMapFile ---\n"; globalOutputStream() << g_map.m_name.c_str() << "\n"; - globalOutputStream() << Unsigned( g_brushCount.get() ) << " primitives\n"; + globalOutputStream() << Unsigned( g_brushCount.get() + g_patchCount.get() ) << " primitives\n"; globalOutputStream() << Unsigned( g_entityCount.get() ) << " entities\n"; //GlobalEntityCreator().printStatistics(); diff --git a/radiant/patch.cpp b/radiant/patch.cpp index 3fdd8b09..fc83c9ff 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -38,6 +38,7 @@ void Patch_textureChanged(){ } +Counter* PatchInstance::m_counter = 0; Shader* PatchInstance::m_state_selpoint; Shader* Patch::m_state_ctrl; Shader* Patch::m_state_lattice; diff --git a/radiant/patch.h b/radiant/patch.h index 180df2b7..67d1f9cb 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -1347,6 +1347,7 @@ const LightList* m_lightList; TransformModifier m_transform; public: +static Counter* m_counter; typedef LazyStatic StaticTypeCasts; @@ -1366,6 +1367,7 @@ PatchInstance( const scene::Path& path, scene::Instance* parent, Patch& patch ) m_transform( Patch::TransformChangedCaller( m_patch ), ApplyTransformCaller( *this ) ){ m_patch.instanceAttach( Instance::path() ); m_patch.attach( this ); + m_counter->increment(); m_lightList = &GlobalShaderCache().attach( *this ); m_patch.m_lightsChanged = LightsChangedCaller( *this ); @@ -1378,6 +1380,7 @@ PatchInstance( const scene::Path& path, scene::Instance* parent, Patch& patch ) m_patch.m_lightsChanged = Callback(); GlobalShaderCache().detach( *this ); + m_counter->decrement(); m_patch.detach( this ); m_patch.instanceDetach( Instance::path() ); } diff --git a/radiant/patchmodule.cpp b/radiant/patchmodule.cpp index 7f273591..b4785599 100644 --- a/radiant/patchmodule.cpp +++ b/radiant/patchmodule.cpp @@ -27,6 +27,8 @@ #include "patch.h" #include "patchmanip.h" +#include "qe3.h" + namespace { std::size_t g_patchModuleCount = 0; @@ -46,6 +48,8 @@ void Patch_Construct( EPatchType type ){ Patch::constructStatic( type ); PatchInstance::constructStatic(); + PatchInstance::m_counter = &g_patchCount; + if ( type == ePatchTypeDoom3 ) { MAX_PATCH_WIDTH = MAX_PATCH_HEIGHT = 99; } @@ -60,6 +64,8 @@ void Patch_Destroy(){ return; } + PatchInstance::m_counter = 0; + Patch::destroyStatic(); PatchInstance::destroyStatic(); } diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index c400b6c3..a6d488d6 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -118,28 +118,17 @@ void QE_InitVFS(){ } } -int g_numbrushes = 0; -int g_numentities = 0; -void QE_UpdateStatusBar(){ +SimpleCounter g_brushCount; +SimpleCounter g_patchCount; +SimpleCounter g_entityCount; + +void QE_brushCountChanged(){ char buffer[128]; - sprintf( buffer, "Brushes: %d Entities: %d", g_numbrushes, g_numentities ); + sprintf( buffer, "Brushes: %u Patches: %u Entities: %u", Unsigned( g_brushCount.get() ), Unsigned( g_patchCount.get() ), Unsigned( g_entityCount.get() ) ); g_pParentWnd->SetStatusText( g_pParentWnd->m_brushcount_status, buffer ); } -SimpleCounter g_brushCount; - -void QE_brushCountChanged(){ - g_numbrushes = int(g_brushCount.get() ); - QE_UpdateStatusBar(); -} - -SimpleCounter g_entityCount; - -void QE_entityCountChanged(){ - g_numentities = int(g_entityCount.get() ); - QE_UpdateStatusBar(); -} bool ConfirmModified( const char* title ){ if ( !Map_Modified( g_map ) ) { diff --git a/radiant/qe3.h b/radiant/qe3.h index 3b7d364b..05d63d52 100644 --- a/radiant/qe3.h +++ b/radiant/qe3.h @@ -36,7 +36,6 @@ void RunBSP( const char* name ); void QE_InitVFS(); void QE_brushCountChanged(); -void QE_entityCountChanged(); bool ConfirmModified( const char* title ); @@ -60,6 +59,7 @@ extern QEGlobals_t g_qeglobals; class SimpleCounter; extern SimpleCounter g_brushCount; +extern SimpleCounter g_patchCount; extern SimpleCounter g_entityCount; void bsp_init();