From 59babfa33245a4f772bf5b56b3f8bf6dd4cee1cc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 9 Feb 2022 10:10:48 +0100 Subject: [PATCH] 3D viewer: fix a sometimes incorrect render engine initialization. inside the EDA_3D_CANVAS, it was initialized before settings are read, and can be set to raytracing, although we always start 3D viewer in opengl mode, thus creating a incorrect (not working) initialization. --- 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 6 ++++-- 3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp | 12 ++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index b65aee71a9..2524168872 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -137,7 +137,9 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, m_3d_render_raytracing->SetBusyIndicatorFactory( busy_indicator_factory ); m_3d_render_opengl->SetBusyIndicatorFactory( busy_indicator_factory ); - RenderEngineChanged(); + // We always start with the opengl engine (raytracing is avoided due to very + // long calculation time) + m_3d_render = m_3d_render_opengl; m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() ); diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index b41717d75b..aaac3aad11 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -444,18 +444,10 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg ) { m_boardAdapter.m_Cfg = cfg; - // When opening the 3D viewer, we use the opengl mode, not the ray tracing engine + // When opening the 3D viewer, we use the opengl mode, never the ray tracing engine // because the ray tracing is very time consumming, and can be seen as not working // (freeze window) with large boards. -#if 0 - RENDER_ENGINE engine = static_cast( cfg->m_Render.engine ); - wxLogTrace( m_logTrace, engine == RENDER_ENGINE::RAYTRACING ? - wxT( "EDA_3D_VIEWER_FRAME::LoadSettings render setting Ray Trace" ) - : - wxT( "EDA_3D_VIEWER_FRAME::LoadSettings render setting OpenGL" ) ); -#else m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL; -#endif m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled ); m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );