3D-Viewer: when possible, uses only the board edges to calculate boundings

Add Report messages to Raytracing

Fixes https://gitlab.com/kicad/code/kicad/issues/6316
This commit is contained in:
Mario Luzeiro 2020-11-10 16:30:11 +00:00 committed by Wayne Stambaugh
parent 753383d6ec
commit e105451f44
2 changed files with 30 additions and 14 deletions

View File

@ -278,9 +278,31 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
{
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::InitSettings" ) );
if( aStatusReporter )
aStatusReporter->Report( _( "Build board outline" ) );
wxString msg;
const bool succeedToGetBoardPolygon = createBoardPolygon( &msg );
if( aWarningReporter )
{
if( !succeedToGetBoardPolygon )
aWarningReporter->Report( msg, RPT_SEVERITY_WARNING );
else
aWarningReporter->Report( wxEmptyString );
}
// Calculates the board bounding box (board outlines + items)
// to ensure any item, even outside the board outlines can be seen
EDA_RECT bbbox = m_board->ComputeBoundingBox( false );
bool boardEdgesOnly = true;
if( m_board->IsFootprintHolder() || !GetFlag( FL_USE_REALISTIC_MODE )
|| !succeedToGetBoardPolygon )
boardEdgesOnly = false;
EDA_RECT bbbox = m_board->ComputeBoundingBox( boardEdgesOnly );
// Gives a non null size to avoid issues in zoom / scale calculations
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
@ -422,19 +444,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
unsigned stats_startCreateBoardPolyTime = GetRunningMicroSecs();
#endif
if( aStatusReporter )
aStatusReporter->Report( _( "Build board body" ) );
wxString msg;
if( aWarningReporter )
{
if( !createBoardPolygon( &msg ) )
aWarningReporter->Report( msg, RPT_SEVERITY_WARNING );
else
aWarningReporter->Report( wxEmptyString );
}
if( aStatusReporter )
aStatusReporter->Report( _( "Create layers" ) );

View File

@ -485,6 +485,9 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
setupMaterials();
if( aStatusReporter )
aStatusReporter->Report( _( "Load Raytracing: board" ) );
// Create and add the outline board
// /////////////////////////////////////////////////////////////////////////
@ -696,6 +699,8 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
}
}
if( aStatusReporter )
aStatusReporter->Report( _( "Load Raytracing: layers" ) );
// Add layers maps (except B_Mask and F_Mask)
// /////////////////////////////////////////////////////////////////////////
@ -952,6 +957,8 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
unsigned stats_startLoad3DmodelsTime = stats_endConvertTime;
#endif
if( aStatusReporter )
aStatusReporter->Report( _( "Loading 3D models" ) );
load_3D_models( m_object_container, aOnlyLoadCopperAndShapes );