diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index 1d463f945a..b40487d5c6 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -40,6 +40,8 @@ #include #include +#include <../3d_rendering/opengl/render_3d_opengl.h> + #define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D // Render Row abbreviation to reduce source width @@ -294,6 +296,7 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl std::bitset visibleLayers = m_frame->GetAdapter().GetVisibleLayers(); const std::map& colors = m_frame->GetAdapter().GetLayerColors(); bool killFollow = false; + bool doFastRefresh = false; // true to just refresh the display // Special-case controls switch( aLayer ) @@ -339,6 +342,15 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl killFollow = true; break; + case LAYER_3D_TH_MODELS: + case LAYER_3D_SMD_MODELS: + case LAYER_3D_VIRTUAL_MODELS: + case LAYER_3D_MODELS_NOT_IN_POS: + case LAYER_3D_MODELS_MARKED_DNP: + doFastRefresh = true; + visibleLayers.set( aLayer, isVisible ); + break; + default: visibleLayers.set( aLayer, isVisible ); break; @@ -353,7 +365,17 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl syncLayerPresetSelection(); UpdateLayerCtls(); - m_frame->NewDisplay( true ); + + if( doFastRefresh + && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL ) + { + RENDER_3D_OPENGL* renderer = + static_cast( m_frame->GetCanvas()->GetCurrentRender() ); + renderer->Load3dModelsIfNeeded(); + m_frame->GetCanvas()->Request_refresh(); + } + else + m_frame->NewDisplay( true ); }