diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index d35b6926ab..5af17925c6 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -655,6 +655,18 @@ public: std::vector m_raytrace_lightColor; std::vector m_raytrace_lightSphericalCoords; + // Raytracing options + int m_raytrace_nrsamples_shadows; + int m_raytrace_nrsamples_reflections; + int m_raytrace_nrsamples_refractions; + + float m_raytrace_spread_shadows; + float m_raytrace_spread_reflections; + float m_raytrace_spread_refractions; + + int m_raytrace_recursivelevel_reflections; + int m_raytrace_recursivelevel_refractions; + private: BOARD* m_board; diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index 5e8c284d82..6edb19292d 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -74,6 +74,12 @@ static float TransparencyControl( float aGrayColorValue, float aTransparency ) void C3D_RENDER_RAYTRACING::setupMaterials() { + CMATERIAL::SetDefaultNrRefractionsSamples( m_boardAdapter.m_raytrace_nrsamples_refractions ); + CMATERIAL::SetDefaultNrReflectionsSamples( m_boardAdapter.m_raytrace_nrsamples_reflections ); + + CMATERIAL::SetDefaultRefractionsLevel( m_boardAdapter.m_raytrace_recursivelevel_refractions ); + CMATERIAL::SetDefaultReflectionsLevel( m_boardAdapter.m_raytrace_recursivelevel_reflections ); + double mmTo3Dunits = IU_PER_MM * m_boardAdapter.BiuTo3Dunits(); if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) ) @@ -154,7 +160,6 @@ void C3D_RENDER_RAYTRACING::setupMaterials() m_materials.m_SolderMask.SetCastShadows( true ); m_materials.m_SolderMask.SetNrRefractionsSamples( 1 ); - m_materials.m_SolderMask.SetNrReflectionsSamples( 2 ); if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) ) m_materials.m_SolderMask.SetNormalPerturbator( &m_solder_mask_normal_perturbator ); @@ -172,7 +177,6 @@ void C3D_RENDER_RAYTRACING::setupMaterials() 0.0f ); // reflection m_materials.m_EpoxyBoard.SetAbsorvance( 10.0f ); - m_materials.m_EpoxyBoard.SetNrRefractionsSamples( 3 ); if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) ) m_materials.m_EpoxyBoard.SetNormalPerturbator( &m_board_normal_perturbator ); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp index 835899508d..6da71fa5a2 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp @@ -1663,7 +1663,7 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, SFVEC3F outColor = objMaterial->GetEmissiveColor() + objMaterial->GetAmbientColor(); - if( aRecursiveLevel > 5 ) + if( aRecursiveLevel > 7 ) return outColor; SFVEC3F hitPoint = aHitInfo.m_HitPoint; @@ -1718,14 +1718,8 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, { nr_lights_that_can_cast_shadows++; #if USE_EXPERIMENTAL_SOFT_SHADOWS - if( (!is_aa_enabled) || - - // For rays that are recursive, just calculate one hit shadow - (aRecursiveLevel > 0) || - - // Only use soft shadows if using post processing - (!m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) ) - ) + // For rays that are recursive, just calculate one hit shadow + if( aRecursiveLevel > 0 ) { #endif RAY rayToLight; @@ -1743,18 +1737,26 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, else { - const unsigned int shadow_number_of_samples = 3; + const unsigned int shadow_number_of_samples = m_boardAdapter.m_raytrace_nrsamples_shadows; const float shadow_inc_factor = 1.0f / (float)(shadow_number_of_samples); for( unsigned int i = 0; i < shadow_number_of_samples; ++i ) { - const SFVEC3F unifVector = UniformRandomHemisphereDirection(); - const SFVEC3F disturbed_vector_to_light = glm::normalize( vectorToLight + - unifVector * - 0.05f ); - RAY rayToLight; - rayToLight.Init( hitPoint, disturbed_vector_to_light ); + + if( i == 0 ) + { + rayToLight.Init( hitPoint, vectorToLight ); + } + else + { + const SFVEC3F unifVector = UniformRandomHemisphereDirection(); + const SFVEC3F disturbed_vector_to_light = glm::normalize( vectorToLight + + unifVector * + m_boardAdapter.m_raytrace_spread_shadows ); + + rayToLight.Init( hitPoint, disturbed_vector_to_light ); + } // !TODO: there are multiple ways that this tests can be // optimized. Eg: by packing rays or to test against the @@ -1803,8 +1805,7 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, // Reflections // ///////////////////////////////////////////////////////////////////// - if( !aIsInsideObject && - (objMaterial->GetReflection() > 0.0f) && + if( ( objMaterial->GetReflection() > 0.0f ) && m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) && ( aRecursiveLevel < objMaterial->GetReflectionsRecursiveLevel() ) ) { @@ -1818,14 +1819,22 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, for( unsigned int i = 0; i < reflection_number_of_samples; ++i ) { - // Apply some randomize to the reflected vector - const SFVEC3F random_reflectVector = - glm::normalize( reflectVector + - UniformRandomHemisphereDirection() * - 0.025f ); - RAY reflectedRay; - reflectedRay.Init( hitPoint, random_reflectVector ); + + if( i == 0 ) + { + reflectedRay.Init( hitPoint, reflectVector ); + } + else + { + // Apply some randomize to the reflected vector + const SFVEC3F random_reflectVector = + glm::normalize( reflectVector + + UniformRandomHemisphereDirection() * + m_boardAdapter.m_raytrace_spread_reflections ); + + reflectedRay.Init( hitPoint, random_reflectVector ); + } HITINFO reflectedHit; reflectedHit.m_tHit = std::numeric_limits::infinity(); @@ -1856,7 +1865,8 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, const float objTransparency = aHitInfo.pHitObject->GetModelTransparency(); if( ( objTransparency > 0.0f ) && - m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) ) + m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) && + ( aRecursiveLevel < objMaterial->GetRefractionsRecursiveLevel() ) ) { const float airIndex = 1.000293f; const float glassIndex = 1.49f; @@ -1884,20 +1894,19 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor, { RAY refractedRay; - if( refractions_number_of_samples > 1 ) + if( i == 0 ) + { + refractedRay.Init( startPoint, refractedVector ); + } + else { // apply some randomize to the refracted vector const SFVEC3F randomizeRefractedVector = glm::normalize( refractedVector + UniformRandomHemisphereDirection() * - 0.15f * - (1.0f - objTransparency) ); + m_boardAdapter.m_raytrace_spread_refractions ); refractedRay.Init( startPoint, randomizeRefractedVector ); } - else - { - refractedRay.Init( startPoint, refractedVector ); - } HITINFO refractedHit; refractedHit.m_tHit = std::numeric_limits::infinity(); diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.cpp index 51a044883d..9e9c488093 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.cpp @@ -31,6 +31,11 @@ #include <3d_math.h> #include +int CMATERIAL::m_default_nrsamples_refractions = 4; +int CMATERIAL::m_default_nrsamples_reflections = 3; +int CMATERIAL::m_default_refractions_recursive_levels = 2; +int CMATERIAL::m_default_reflections_recursive_levels = 3; + // This may be a good value if based on nr of lights // that contribute to the illumination of that point #define AMBIENT_FACTOR (1.0f / 6.0f) @@ -46,8 +51,10 @@ CMATERIAL::CMATERIAL() m_cast_shadows = true; m_reflection = 0.0f; m_absorbance = 1.0f; - m_refraction_nr_samples = 4; - m_reflections_nr_samples = 3; + m_refraction_nr_samples = m_default_nrsamples_refractions; + m_reflections_nr_samples = m_default_nrsamples_reflections; + m_refractions_recursive_levels = m_default_refractions_recursive_levels; + m_reflections_recursive_levels = m_default_reflections_recursive_levels; m_normal_perturbator = NULL; } @@ -78,9 +85,10 @@ CMATERIAL::CMATERIAL( const SFVEC3F &aAmbient, m_absorbance = 1.0f; m_reflection = aReflection; m_cast_shadows = true; - m_refraction_nr_samples = 4; - m_reflections_nr_samples = 3; - m_reflections_recursive_levels = 2; + m_refraction_nr_samples = m_default_nrsamples_refractions; + m_reflections_nr_samples = m_default_nrsamples_reflections; + m_refractions_recursive_levels = m_default_refractions_recursive_levels; + m_reflections_recursive_levels = m_default_reflections_recursive_levels; m_normal_perturbator = NULL; } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.h b/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.h index c74299e9de..a2221a0b2b 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.h +++ b/3d-viewer/3d_rendering/3d_render_raytracing/cmaterial.h @@ -191,9 +191,23 @@ private: float m_scale; }; + /// A base material class that can be used to derive a material implementation class CMATERIAL { +public: + static void SetDefaultNrRefractionsSamples( unsigned int aNrRefractions ) { m_default_nrsamples_refractions = aNrRefractions; } + static void SetDefaultNrReflectionsSamples( unsigned int aNrReflections ) { m_default_nrsamples_reflections = aNrReflections; } + + static void SetDefaultRefractionsLevel( unsigned int aRefractionLevel ) { m_default_refractions_recursive_levels = aRefractionLevel; } + static void SetDefaultReflectionsLevel( unsigned int aReflectionLevel ) { m_default_reflections_recursive_levels = aReflectionLevel; } + +private: + static int m_default_nrsamples_refractions; + static int m_default_nrsamples_reflections; + static int m_default_refractions_recursive_levels; + static int m_default_reflections_recursive_levels; + public: CMATERIAL(); CMATERIAL( const SFVEC3F &aAmbient, @@ -216,11 +230,13 @@ public: unsigned int GetNrRefractionsSamples() const { return m_refraction_nr_samples; } unsigned int GetNrReflectionsSamples() const { return m_reflections_nr_samples; } unsigned int GetReflectionsRecursiveLevel() const { return m_reflections_recursive_levels; } + unsigned int GetRefractionsRecursiveLevel() const { return m_refractions_recursive_levels; } void SetAbsorvance( float aAbsorvanceFactor ) { m_absorbance = aAbsorvanceFactor; } void SetNrRefractionsSamples( unsigned int aNrRefractions ) { m_refraction_nr_samples = aNrRefractions; } void SetNrReflectionsSamples( unsigned int aNrReflections ) { m_reflections_nr_samples = aNrReflections; } void SetReflectionsRecursiveLevel( unsigned int aReflectionsLevel ) { m_reflections_recursive_levels = aReflectionsLevel; } + void SetRefractionsRecursiveLevel( unsigned int aRefractionsLevel ) { m_refractions_recursive_levels = aRefractionsLevel; } /** * @brief SetCastShadows - Set if the material can receive shadows @@ -270,6 +286,7 @@ protected: bool m_cast_shadows; ///< true if this object will block the light unsigned int m_refraction_nr_samples; ///< nr of rays that will be interpolated for this material if it is a transparent unsigned int m_reflections_nr_samples; ///< nr of rays that will be interpolated for this material if it is reflective + unsigned int m_refractions_recursive_levels; ///< nr of levels it allows for refractions recursiveness unsigned int m_reflections_recursive_levels; ///< nr of levels it allows for reflection recursiveness const CPROCEDURALGENERATOR *m_normal_perturbator; diff --git a/3d-viewer/3d_viewer/3d_viewer_settings.cpp b/3d-viewer/3d_viewer/3d_viewer_settings.cpp index 10ae5a15c5..872d3c1a80 100644 --- a/3d-viewer/3d_viewer/3d_viewer_settings.cpp +++ b/3d-viewer/3d_viewer/3d_viewer_settings.cpp @@ -88,6 +88,25 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() m_params.emplace_back( new PARAM( "render.raytrace_shadows", &m_Render.raytrace_shadows, true ) ); + m_params.emplace_back( new PARAM( "render.raytrace_nrsamples_shadows", + &m_Render.raytrace_nrsamples_shadows, 3 ) ); + m_params.emplace_back( new PARAM( "render.raytrace_nrsamples_reflections", + &m_Render.raytrace_nrsamples_reflections, 3 ) ); + m_params.emplace_back( new PARAM( "render.raytrace_nrsamples_refractions", + &m_Render.raytrace_nrsamples_refractions, 4 ) ); + + m_params.emplace_back( new PARAM( "render.raytrace_recursivelevel_reflections", + &m_Render.raytrace_recursivelevel_reflections, 3 ) ); + m_params.emplace_back( new PARAM( "render.raytrace_recursivelevel_refractions", + &m_Render.raytrace_recursivelevel_refractions, 2 ) ); + + m_params.emplace_back( new PARAM( "render.raytrace_spread_shadows", + &m_Render.raytrace_spread_shadows, 0.05f ) ); + m_params.emplace_back( new PARAM( "render.raytrace_spread_reflections", + &m_Render.raytrace_spread_reflections, 0.025f ) ); + m_params.emplace_back( new PARAM( "render.raytrace_spread_refractions", + &m_Render.raytrace_spread_refractions, 0.025f ) ); + m_params.emplace_back( new PARAM( "render.raytrace_lightColorCamera", &m_Render.raytrace_lightColorCamera, COLOR4D( 0.2, 0.2, 0.2, 1.0 ) ) ); diff --git a/3d-viewer/3d_viewer/3d_viewer_settings.h b/3d-viewer/3d_viewer/3d_viewer_settings.h index 27c87cb5f3..966ee699d3 100644 --- a/3d-viewer/3d_viewer/3d_viewer_settings.h +++ b/3d-viewer/3d_viewer/3d_viewer_settings.h @@ -49,6 +49,17 @@ public: bool raytrace_refractions; bool raytrace_shadows; + int raytrace_nrsamples_shadows; + int raytrace_nrsamples_reflections; + int raytrace_nrsamples_refractions; + + float raytrace_spread_shadows; + float raytrace_spread_reflections; + float raytrace_spread_refractions; + + int raytrace_recursivelevel_reflections; + int raytrace_recursivelevel_refractions; + KIGFX::COLOR4D raytrace_lightColorCamera; KIGFX::COLOR4D raytrace_lightColorTop; KIGFX::COLOR4D raytrace_lightColorBottom; diff --git a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option.cpp b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option.cpp index fc3cc7da23..9e0816e964 100644 --- a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option.cpp +++ b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option.cpp @@ -217,6 +217,17 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow() m_checkBoxRaytracing_antiAliasing->SetValue( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) ); m_checkBoxRaytracing_proceduralTextures->SetValue( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) ); + m_spinCtrl_NrSamples_Shadows->SetValue( m_settings.m_raytrace_nrsamples_shadows ); + m_spinCtrl_NrSamples_Reflections->SetValue( m_settings.m_raytrace_nrsamples_reflections ); + m_spinCtrl_NrSamples_Refractions->SetValue( m_settings.m_raytrace_nrsamples_refractions ); + + m_spinCtrlDouble_SpreadFactor_Shadows->SetValue( m_settings.m_raytrace_spread_shadows * 100.0f ); + m_spinCtrlDouble_SpreadFactor_Reflections->SetValue( m_settings.m_raytrace_spread_reflections * 100.0f ); + m_spinCtrlDouble_SpreadFactor_Refractions->SetValue( m_settings.m_raytrace_spread_refractions * 100.0f ); + + m_spinCtrlRecursiveLevel_Reflections->SetValue( m_settings.m_raytrace_recursivelevel_reflections ); + m_spinCtrlRecursiveLevel_Refractions->SetValue( m_settings.m_raytrace_recursivelevel_refractions ); + TransferLightDataToWindow(); // Camera Options @@ -274,6 +285,17 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow() m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, m_checkBoxRaytracing_antiAliasing->GetValue() ); m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, m_checkBoxRaytracing_proceduralTextures->GetValue() ); + m_settings.m_raytrace_nrsamples_shadows = m_spinCtrl_NrSamples_Shadows->GetValue(); + m_settings.m_raytrace_nrsamples_reflections = m_spinCtrl_NrSamples_Reflections->GetValue(); + m_settings.m_raytrace_nrsamples_refractions= m_spinCtrl_NrSamples_Refractions->GetValue(); + + m_settings.m_raytrace_spread_shadows = static_cast( m_spinCtrlDouble_SpreadFactor_Shadows->GetValue() ) / 100.0f; + m_settings.m_raytrace_spread_reflections = static_cast( m_spinCtrlDouble_SpreadFactor_Reflections->GetValue() ) / 100.0f; + m_settings.m_raytrace_spread_refractions = static_cast( m_spinCtrlDouble_SpreadFactor_Refractions->GetValue() ) / 100.0f; + + m_settings.m_raytrace_recursivelevel_reflections = m_spinCtrlRecursiveLevel_Reflections->GetValue(); + m_settings.m_raytrace_recursivelevel_refractions = m_spinCtrlRecursiveLevel_Refractions->GetValue(); + auto Transfer_color = [] ( SFVEC3F& aTarget, wxColourPickerCtrl *aSource ) { const wxColour color = aSource->GetColour(); diff --git a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.cpp b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.cpp index 76219cc65c..bc5c14d551 100644 --- a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.cpp +++ b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.cpp @@ -404,18 +404,11 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi sbSizerRaytracingRenderOptions->SetMinSize( wxSize( -1,32 ) ); wxFlexGridSizer* fgSizer9; - fgSizer9 = new wxFlexGridSizer( 4, 4, 0, 0 ); + fgSizer9 = new wxFlexGridSizer( 2, 4, 0, 0 ); fgSizer9->SetFlexibleDirection( wxBOTH ); fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE ); - fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); - - m_checkBoxRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Shadows"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxRaytracing_renderShadows->SetValue(true); - fgSizer9->Add( m_checkBoxRaytracing_renderShadows, 0, wxALL, 5 ); - - fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); m_checkBoxRaytracing_proceduralTextures = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Procedural textures"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -430,20 +423,6 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi fgSizer9->Add( m_checkBoxRaytracing_addFloor, 0, wxALL, 5 ); - fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); - - m_checkBoxRaytracing_showRefractions = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Refractions"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxRaytracing_showRefractions->SetValue(true); - fgSizer9->Add( m_checkBoxRaytracing_showRefractions, 0, wxALL, 5 ); - - - fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); - - m_checkBoxRaytracing_showReflections = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Reflections"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxRaytracing_showReflections->SetValue(true); - fgSizer9->Add( m_checkBoxRaytracing_showReflections, 0, wxALL, 5 ); - - fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); m_checkBoxRaytracing_antiAliasing = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Anti-aliasing"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -458,7 +437,106 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi fgSizer9->Add( m_checkBoxRaytracing_postProcessing, 0, wxALL, 5 ); - sbSizerRaytracingRenderOptions->Add( fgSizer9, 1, wxALL, 5 ); + sbSizerRaytracingRenderOptions->Add( fgSizer9, 0, wxALL, 5 ); + + m_staticline4 = new wxStaticLine( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + sbSizerRaytracingRenderOptions->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 ); + + wxFlexGridSizer* fgSizer111; + fgSizer111 = new wxFlexGridSizer( 0, 5, 0, 0 ); + fgSizer111->SetFlexibleDirection( wxBOTH ); + fgSizer111->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer111->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); + + + fgSizer111->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_staticText19 = new wxStaticText( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Number of Samples"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText19->Wrap( -1 ); + fgSizer111->Add( m_staticText19, 0, wxALL, 5 ); + + m_staticText201 = new wxStaticText( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Spread Factor %"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText201->Wrap( -1 ); + fgSizer111->Add( m_staticText201, 0, wxALL, 5 ); + + m_staticText211 = new wxStaticText( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Recursive Level"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText211->Wrap( -1 ); + fgSizer111->Add( m_staticText211, 0, wxALL, 5 ); + + + fgSizer111->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_checkBoxRaytracing_renderShadows = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Shadows"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxRaytracing_renderShadows->SetValue(true); + fgSizer111->Add( m_checkBoxRaytracing_renderShadows, 0, wxALL, 5 ); + + m_spinCtrl_NrSamples_Shadows = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 64, 0 ); + m_spinCtrl_NrSamples_Shadows->SetToolTip( _("Number of rays that will be cast, into light direction, to evaluate a shadow point") ); + + fgSizer111->Add( m_spinCtrl_NrSamples_Shadows, 0, wxALL, 5 ); + + m_spinCtrlDouble_SpreadFactor_Shadows = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 ); + m_spinCtrlDouble_SpreadFactor_Shadows->SetDigits( 1 ); + m_spinCtrlDouble_SpreadFactor_Shadows->SetToolTip( _("Random direction factor of the cast rays") ); + + fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Shadows, 0, wxALL, 5 ); + + + fgSizer111->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizer111->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); + + m_checkBoxRaytracing_showReflections = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Reflections"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxRaytracing_showReflections->SetValue(true); + fgSizer111->Add( m_checkBoxRaytracing_showReflections, 0, wxALL, 5 ); + + m_spinCtrl_NrSamples_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 32, 0 ); + m_spinCtrl_NrSamples_Reflections->SetToolTip( _("Number of rays that will be cast to evaluate a reflection point") ); + + fgSizer111->Add( m_spinCtrl_NrSamples_Reflections, 0, wxALL, 5 ); + + m_spinCtrlDouble_SpreadFactor_Reflections = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 ); + m_spinCtrlDouble_SpreadFactor_Reflections->SetDigits( 1 ); + m_spinCtrlDouble_SpreadFactor_Reflections->SetToolTip( _("Random direction factor of the cast rays") ); + + fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Reflections, 0, wxALL, 5 ); + + m_spinCtrlRecursiveLevel_Reflections = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 ); + m_spinCtrlRecursiveLevel_Reflections->SetToolTip( _("Interactions number that a ray can travel through objects. (higher number of levels improve results, specially on very transparent boards)") ); + + fgSizer111->Add( m_spinCtrlRecursiveLevel_Reflections, 0, wxALL, 5 ); + + + fgSizer111->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 ); + + m_checkBoxRaytracing_showRefractions = new wxCheckBox( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, _("Refractions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxRaytracing_showRefractions->SetValue(true); + fgSizer111->Add( m_checkBoxRaytracing_showRefractions, 0, wxALL, 5 ); + + m_spinCtrl_NrSamples_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 5, 0 ); + m_spinCtrl_NrSamples_Refractions->SetToolTip( _("Number of rays that will be cast to evaluate a refraction point") ); + + fgSizer111->Add( m_spinCtrl_NrSamples_Refractions, 0, wxALL, 5 ); + + m_spinCtrlDouble_SpreadFactor_Refractions = new wxSpinCtrlDouble( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 0.1, 25, 0, 1 ); + m_spinCtrlDouble_SpreadFactor_Refractions->SetDigits( 1 ); + m_spinCtrlDouble_SpreadFactor_Refractions->SetToolTip( _("Random direction factor of the cast rays") ); + + fgSizer111->Add( m_spinCtrlDouble_SpreadFactor_Refractions, 0, wxALL, 5 ); + + m_spinCtrlRecursiveLevel_Refractions = new wxSpinCtrl( sbSizerRaytracingRenderOptions->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, 1, 7, 0 ); + m_spinCtrlRecursiveLevel_Refractions->SetToolTip( _("Number of bounces that a ray can hit reflective objects") ); + + fgSizer111->Add( m_spinCtrlRecursiveLevel_Refractions, 0, wxALL, 5 ); + + + sbSizerRaytracingRenderOptions->Add( fgSizer111, 1, wxALL, 5 ); + + + sbSizerRaytracingRenderOptions->Add( 0, 0, 1, wxEXPAND, 5 ); bSizer12->Add( sbSizerRaytracingRenderOptions, 0, wxALL|wxEXPAND, 5 ); @@ -470,7 +548,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi m_panel4->SetSizer( bSizerRaytracing ); m_panel4->Layout(); bSizerRaytracing->Fit( m_panel4 ); - m_notebook2->AddPage( m_panel4, _("Render Options"), false ); + m_notebook2->AddPage( m_panel4, _("Render Options"), true ); m_panel5 = new wxPanel( m_notebook2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer17; bSizer17 = new wxBoxSizer( wxVERTICAL ); @@ -700,7 +778,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi m_panel5->SetSizer( bSizer17 ); m_panel5->Layout(); bSizer17->Fit( m_panel5 ); - m_notebook2->AddPage( m_panel5, _("Lights configuration"), true ); + m_notebook2->AddPage( m_panel5, _("Lights configuration"), false ); bSizer14->Add( m_notebook2, 1, wxEXPAND | wxALL, 5 ); diff --git a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.fbp b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.fbp index 2975d66612..9e17ec2949 100644 --- a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.fbp +++ b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.fbp @@ -3650,7 +3650,7 @@ Render Options - 0 + 1 1 1 @@ -3716,11 +3716,11 @@ bSizer12 wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + wxID_ANY Raytracing Render Options -1,32 @@ -3728,10 +3728,10 @@ wxVERTICAL 1 none - + 5 wxALL - 1 + 0 4 wxBOTH @@ -3742,7 +3742,7 @@ fgSizer9 wxFLEX_GROWMODE_NONE none - 4 + 2 0 5 @@ -3754,80 +3754,6 @@ 0 - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Shadows - - 0 - - - 0 - - 1 - m_checkBoxRaytracing_renderShadows - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxLEFT|wxRIGHT - 1 - - 0 - protected - 0 - - 5 wxALL @@ -3976,154 +3902,6 @@ 0 - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Refractions - - 0 - - - 0 - - 1 - m_checkBoxRaytracing_showRefractions - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxLEFT|wxRIGHT - 1 - - 0 - protected - 0 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Reflections - - 0 - - - 0 - - 1 - m_checkBoxRaytracing_showReflections - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxLEFT|wxRIGHT - 1 - - 0 - protected - 0 - - 5 wxALL @@ -4264,6 +4042,1029 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline4 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxALL + 1 + + 5 + wxBOTH + + + 0 + + fgSizer111 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxLEFT|wxRIGHT + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Number of Samples + 0 + + 0 + + + 0 + + 1 + m_staticText19 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Spread Factor % + 0 + + 0 + + + 0 + + 1 + m_staticText201 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Recursive Level + 0 + + 0 + + + 0 + + 1 + m_staticText211 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Shadows + + 0 + + + 0 + + 1 + m_checkBoxRaytracing_renderShadows + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 64 + + 0 + + 1 + + 0 + + 1 + m_spinCtrl_NrSamples_Shadows + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Number of rays that will be cast, into light direction, to evaluate a shadow point + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 1 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 0 + 25 + + 0 + + 0.1 + + 0 + + 1 + m_spinCtrlDouble_SpreadFactor_Shadows + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Random direction factor of the cast rays + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxLEFT|wxRIGHT + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Reflections + + 0 + + + 0 + + 1 + m_checkBoxRaytracing_showReflections + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 32 + + 0 + + 1 + + 0 + + 1 + m_spinCtrl_NrSamples_Reflections + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Number of rays that will be cast to evaluate a reflection point + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 1 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 0 + 25 + + 0 + + 0.1 + + 0 + + 1 + m_spinCtrlDouble_SpreadFactor_Reflections + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Random direction factor of the cast rays + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 5 + + 0 + + 1 + + 0 + + 1 + m_spinCtrlRecursiveLevel_Reflections + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Interactions number that a ray can travel through objects. (higher number of levels improve results, specially on very transparent boards) + + + + + + + + 5 + wxLEFT|wxRIGHT + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Refractions + + 0 + + + 0 + + 1 + m_checkBoxRaytracing_showRefractions + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 5 + + 0 + + 1 + + 0 + + 1 + m_spinCtrl_NrSamples_Refractions + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Number of rays that will be cast to evaluate a refraction point + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 1 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 0 + 25 + + 0 + + 0.1 + + 0 + + 1 + m_spinCtrlDouble_SpreadFactor_Refractions + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Random direction factor of the cast rays + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 7 + + 0 + + 1 + + 0 + + 1 + m_spinCtrlRecursiveLevel_Refractions + 1 + + + protected + 1 + + Resizable + 1 + 124,-1 + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + Number of bounces that a ray can hit reflective objects + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + @@ -4274,8 +5075,8 @@ Lights configuration - 1 - + 0 + 1 1 1 @@ -4326,16 +5127,16 @@ wxTAB_TRAVERSAL - + bSizer17 wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + wxID_ANY Lights configuration -1,-1 @@ -4787,7 +5588,7 @@ - + 5 wxALL|wxEXPAND 0 @@ -7123,30 +7924,30 @@ - + 5 wxEXPAND 1 - + bSizer19 wxHORIZONTAL none - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALL 0 - + 1 1 1 diff --git a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.h b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.h index ce3486d16b..45004f0b4a 100644 --- a/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.h +++ b/3d-viewer/3d_viewer/dialogs/dialog_3D_view_option_base.h @@ -96,13 +96,25 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM wxPanel* m_panelRaytracing; wxNotebook* m_notebook2; wxPanel* m_panel4; - wxCheckBox* m_checkBoxRaytracing_renderShadows; wxCheckBox* m_checkBoxRaytracing_proceduralTextures; wxCheckBox* m_checkBoxRaytracing_addFloor; - wxCheckBox* m_checkBoxRaytracing_showRefractions; - wxCheckBox* m_checkBoxRaytracing_showReflections; wxCheckBox* m_checkBoxRaytracing_antiAliasing; wxCheckBox* m_checkBoxRaytracing_postProcessing; + wxStaticLine* m_staticline4; + wxStaticText* m_staticText19; + wxStaticText* m_staticText201; + wxStaticText* m_staticText211; + wxCheckBox* m_checkBoxRaytracing_renderShadows; + wxSpinCtrl* m_spinCtrl_NrSamples_Shadows; + wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Shadows; + wxCheckBox* m_checkBoxRaytracing_showReflections; + wxSpinCtrl* m_spinCtrl_NrSamples_Reflections; + wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Reflections; + wxSpinCtrl* m_spinCtrlRecursiveLevel_Reflections; + wxCheckBox* m_checkBoxRaytracing_showRefractions; + wxSpinCtrl* m_spinCtrl_NrSamples_Refractions; + wxSpinCtrlDouble* m_spinCtrlDouble_SpreadFactor_Refractions; + wxSpinCtrl* m_spinCtrlRecursiveLevel_Refractions; wxPanel* m_panel5; wxStaticText* m_staticText17; wxColourPickerCtrl* m_colourPickerCameraLight; diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp index 627000d79f..87313a731f 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp @@ -535,6 +535,17 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg ) m_boardAdapter.GridSet( static_cast( cfg->m_Render.grid_type ) ); m_boardAdapter.AntiAliasingSet( static_cast( cfg->m_Render.opengl_AA_mode ) ); + m_boardAdapter.m_raytrace_nrsamples_shadows = cfg->m_Render.raytrace_nrsamples_shadows; + m_boardAdapter.m_raytrace_nrsamples_reflections = cfg->m_Render.raytrace_nrsamples_reflections; + m_boardAdapter.m_raytrace_nrsamples_refractions = cfg->m_Render.raytrace_nrsamples_refractions; + + m_boardAdapter.m_raytrace_spread_shadows = cfg->m_Render.raytrace_spread_shadows; + m_boardAdapter.m_raytrace_spread_reflections = cfg->m_Render.raytrace_spread_reflections; + m_boardAdapter.m_raytrace_spread_refractions = cfg->m_Render.raytrace_spread_refractions; + + m_boardAdapter.m_raytrace_recursivelevel_refractions = cfg->m_Render.raytrace_recursivelevel_refractions; + m_boardAdapter.m_raytrace_recursivelevel_reflections = cfg->m_Render.raytrace_recursivelevel_reflections; + // When opening the 3D viewer, we use the opengl mode, not the ray tracing engine // because the ray tracing is very time consumming, and can be seen as not working // (freeze window) with large boards. @@ -608,6 +619,17 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg ) cfg->m_Render.raytrace_lightAzimuth[i] = (int)( m_boardAdapter.m_raytrace_lightSphericalCoords[i].y * 180.0f ); } + cfg->m_Render.raytrace_nrsamples_shadows = m_boardAdapter.m_raytrace_nrsamples_shadows; + cfg->m_Render.raytrace_nrsamples_reflections = m_boardAdapter.m_raytrace_nrsamples_reflections; + cfg->m_Render.raytrace_nrsamples_refractions = m_boardAdapter.m_raytrace_nrsamples_refractions; + + cfg->m_Render.raytrace_spread_shadows = m_boardAdapter.m_raytrace_spread_shadows; + cfg->m_Render.raytrace_spread_reflections = m_boardAdapter.m_raytrace_spread_reflections; + cfg->m_Render.raytrace_spread_refractions = m_boardAdapter.m_raytrace_spread_refractions; + + cfg->m_Render.raytrace_recursivelevel_refractions = m_boardAdapter.m_raytrace_recursivelevel_refractions; + cfg->m_Render.raytrace_recursivelevel_reflections = m_boardAdapter.m_raytrace_recursivelevel_reflections; + #define TRANSFER_SETTING( field, flag ) cfg->m_Render.field = m_boardAdapter.GetFlag( flag ) cfg->m_Render.engine = static_cast( m_boardAdapter.RenderEngineGet() );