3D-Viewer: parameterize raytracing lights, add it to options dialog

Remove some hacks related to postprocessing (not need now because the
previous postprocessing improvements, light parametrization could be
used for tune or future parameters could be implemented)
This commit is contained in:
Mario Luzeiro 2020-08-15 09:41:34 +01:00
parent a0c54951db
commit 78ac675316
10 changed files with 3344 additions and 172 deletions

View File

@ -646,6 +646,14 @@ public:
SFVEC3D m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
SFVEC3D m_CopperColor; ///< in realistic mode: copper color
// Raytracing light colors
SFVEC3F m_raytrace_lightColorCamera;
SFVEC3F m_raytrace_lightColorTop;
SFVEC3F m_raytrace_lightColorBottom;
std::vector<SFVEC3F> m_raytrace_lightColor;
std::vector<SFVEC2F> m_raytrace_lightSphericalCoords;
private:

View File

@ -941,67 +941,44 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
// /////////////////////////////////////////////////////////////////////////
m_lights.Clear();
// This will work as the front camera light.
const float light_camera_intensity = 0.20f;
const float light_top_bottom = 0.25f;
const float light_directional_intensity = ( 1.0f - ( light_camera_intensity +
light_top_bottom * 0.5f ) ) / 4.0f;
auto IsColorZero = [] ( const SFVEC3F& aSource )
{
return ( ( aSource.r < ( 1.0f / 255.0f ) ) &&
( aSource.g < ( 1.0f / 255.0f ) ) &&
( aSource.b < ( 1.0f / 255.0f ) ) );
};
m_camera_light = new CDIRECTIONALLIGHT( SFVEC3F( 0.0f, 0.0f, 0.0f ),
SFVEC3F( light_camera_intensity ) );
m_boardAdapter.m_raytrace_lightColorCamera );
m_camera_light->SetCastShadows( false );
m_lights.Add( m_camera_light );
// Option 1 - using Point Lights
if( !IsColorZero( m_boardAdapter.m_raytrace_lightColorCamera ) )
m_lights.Add( m_camera_light );
const SFVEC3F &boarCenter = m_boardAdapter.GetBBox3DU().GetCenter();
const SFVEC3F& boardCenter = m_boardAdapter.GetBBox3DU().GetCenter();
m_lights.Add( new CPOINTLIGHT( SFVEC3F( boarCenter.x, boarCenter.y, +RANGE_SCALE_3D * 2.0f ),
SFVEC3F( light_top_bottom ) ) );
if( !IsColorZero( m_boardAdapter.m_raytrace_lightColorTop ) )
m_lights.Add( new CPOINTLIGHT( SFVEC3F( boardCenter.x, boardCenter.y, +RANGE_SCALE_3D * 2.0f ),
m_boardAdapter.m_raytrace_lightColorTop ) );
m_lights.Add( new CPOINTLIGHT( SFVEC3F( boarCenter.x, boarCenter.y, -RANGE_SCALE_3D * 2.0f ),
SFVEC3F( light_top_bottom ) ) );
if( !IsColorZero( m_boardAdapter.m_raytrace_lightColorBottom ) )
m_lights.Add( new CPOINTLIGHT( SFVEC3F( boardCenter.x, boardCenter.y, -RANGE_SCALE_3D * 2.0f ),
m_boardAdapter.m_raytrace_lightColorBottom ) );
wxASSERT( m_boardAdapter.m_raytrace_lightColor.size()
== m_boardAdapter.m_raytrace_lightSphericalCoords.size() );
// http://www.flashandmath.com/mathlets/multicalc/coords/shilmay23fin.html
for( size_t i = 0; i < m_boardAdapter.m_raytrace_lightColor.size(); ++i )
{
if( !IsColorZero( m_boardAdapter.m_raytrace_lightColor[i] ) )
{
const SFVEC2F sc = m_boardAdapter.m_raytrace_lightSphericalCoords[i];
// Option 2 - Top/Bottom direction lights
/*
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 0.03f,
glm::pi<float>() * 0.25f ),
SFVEC3F( light_top_bottom ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 0.97f,
glm::pi<float>() * 1.25f ),
SFVEC3F( light_top_bottom ) ) );
*/
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 1.0f / 8.0f,
glm::pi<float>() * 1 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 1.0f / 8.0f,
glm::pi<float>() * 3 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 1.0f / 8.0f,
glm::pi<float>() * 5 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 1.0f / 8.0f,
glm::pi<float>() * 7 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 7.0f / 8.0f,
glm::pi<float>() * 1 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 7.0f / 8.0f,
glm::pi<float>() * 3 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 7.0f / 8.0f,
glm::pi<float>() * 5 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * 7.0f / 8.0f,
glm::pi<float>() * 7 / 4.0f ),
SFVEC3F( light_directional_intensity ) ) );
m_lights.Add( new CDIRECTIONALLIGHT( SphericalToCartesian( glm::pi<float>() * sc.x,
glm::pi<float>() * sc.y ),
m_boardAdapter.m_raytrace_lightColor[i] ) );
}
}
// Create an accelerator
@ -1458,30 +1435,8 @@ void C3D_RENDER_RAYTRACING::add_3D_models( const S3DMODEL *a3DModel,
CBLINN_PHONG_MATERIAL &blinnMaterial = (*materialVector)[imat];
SFVEC3F ambient;
if( m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) )
{
// apply a gain to the (dark) ambient colors
// http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIoKHgrMC4yMCleKDEvMi4wMCkpLTAuMzUiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjAsImVxIjoieCIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMCwid2luZG93IjpbIi0xLjI0OTUwNTMzOTIyMzYyIiwiMS42Nzc4MzQ0MTg1NjcxODQzIiwiLTAuNDM1NTA0NjQyODEwOTMwMjYiLCIxLjM2NTkzNTIwODEzNzI1OCJdLCJzaXplIjpbNjQ5LDM5OV19XQ--
// ambient = glm::max( (glm::pow((material.m_Ambient + 0.20f), SFVEC3F(1.0f / 2.00f)) - SFVEC3F(0.35f)), material.m_Ambient );
// http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIoKHgrMC4yMCleKDEvMS41OCkpLTAuMzUiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjAsImVxIjoieCIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMCwid2luZG93IjpbIi0xLjI0OTUwNTMzOTIyMzYyIiwiMS42Nzc4MzQ0MTg1NjcxODQzIiwiLTAuNDM1NTA0NjQyODEwOTMwMjYiLCIxLjM2NTkzNTIwODEzNzI1OCJdLCJzaXplIjpbNjQ5LDM5OV19XQ--
//ambient = glm::max( (glm::pow((material.m_Ambient + 0.20f), SFVEC3F(1.0f / 1.58f)) - SFVEC3F(0.35f)), material.m_Ambient );
// http://www.fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIoKHgrMC4yMCleKDEvMS41NCkpLTAuMzQiLCJjb2xvciI6IiMwMDAwMDAifSx7InR5cGUiOjAsImVxIjoieCIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMCwid2luZG93IjpbIi0yLjcyMTA5NTg0MjA1MDYwNSIsIjEuODUyODcyNTI5NDk3NTIyMyIsIi0xLjQyMTM3NjAxOTkyOTA4MDYiLCIxLjM5MzM3Mzc0NzE3NzQ2MTIiXSwic2l6ZSI6WzY0OSwzOTldfV0-
ambient = ConvertSRGBToLinear(
glm::pow((material.m_Ambient + 0.30f), SFVEC3F(1.0f / 1.54f)) - SFVEC3F(0.34f) );
}
else
{
ambient = ConvertSRGBToLinear( material.m_Ambient );
}
blinnMaterial = CBLINN_PHONG_MATERIAL(
ambient,
ConvertSRGBToLinear( material.m_Ambient ),
ConvertSRGBToLinear( material.m_Emissive ),
ConvertSRGBToLinear( material.m_Specular ),
material.m_Shininess * 180.0f,

View File

@ -1671,7 +1671,7 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor,
const SFVEC3F diffuseColorObj = aHitInfo.pHitObject->GetDiffuseColor( aHitInfo );
SFVEC3F outColor = objMaterial->GetEmissiveColor();
SFVEC3F outColor = objMaterial->GetEmissiveColor() + objMaterial->GetAmbientColor();
const LIST_LIGHT &lightList = m_lights.GetList();
@ -1771,37 +1771,13 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor,
shadow_att_factor_sum += shadow_att_factor_light;
}
if( !m_boardAdapter.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) )
{
outColor += objMaterial->Shade( aRay,
aHitInfo,
NdotL,
diffuseColorObj,
vectorToLight,
colorOfLight,
shadow_att_factor_light );
}
else
{
// This is a render hack in order to compensate for the lack of
// ambient and too much darkness when using post process shader
// It will calculate as it was not in shadow
outColor += objMaterial->Shade( aRay,
aHitInfo,
NdotL,
diffuseColorObj,
vectorToLight,
colorOfLight,
// The sampled point will be darkshaded by the post
// processing, so here it compensates to not shadow
// so much
glm::mix( 0.75f, 1.0f, shadow_att_factor_light )
);
}
}
else
{
outColor += objMaterial->GetAmbientColor();
outColor += objMaterial->Shade( aRay,
aHitInfo,
NdotL,
diffuseColorObj,
vectorToLight,
colorOfLight,
shadow_att_factor_light );
}
// Only use the headlight for preview

View File

@ -88,6 +88,52 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "render.raytrace_shadows",
&m_Render.raytrace_shadows, true ) );
m_params.emplace_back( new PARAM<COLOR4D>( "render.raytrace_lightColorCamera",
&m_Render.raytrace_lightColorCamera,
COLOR4D( 0.2, 0.2, 0.2, 1.0 ) ) );
m_params.emplace_back( new PARAM<COLOR4D>( "render.raytrace_lightColorTop",
&m_Render.raytrace_lightColorTop,
COLOR4D( 0.247, 0.247, 0.247, 1.0 ) ) );
m_params.emplace_back( new PARAM<COLOR4D>( "render.raytrace_lightColorBottom",
&m_Render.raytrace_lightColorBottom,
COLOR4D( 0.247, 0.247, 0.247, 1.0 ) ) );
std::vector<COLOR4D> default_colors =
{
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 ),
COLOR4D( 0.168, 0.168, 0.168, 1.0 )
};
m_params.emplace_back( new PARAM_LIST<COLOR4D>( "render.raytrace_lightColor",
&m_Render.raytrace_lightColor,
default_colors ) );
std::vector<int> default_elevation =
{
67, 67, 67, 67, -67, -67, -67, -67,
};
m_params.emplace_back( new PARAM_LIST<int>( "render.raytrace_lightElevation",
&m_Render.raytrace_lightElevation,
default_elevation ) );
std::vector<int> default_azimuth =
{
45, 135, 225, 315, 45, 135, 225, 315,
};
m_params.emplace_back( new PARAM_LIST<int>( "render.raytrace_lightAzimuth",
&m_Render.raytrace_lightAzimuth,
default_azimuth ) );
m_params.emplace_back( new PARAM<bool>( "render.realistic", &m_Render.realistic, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_adhesive", &m_Render.show_adhesive, true ) );

View File

@ -23,7 +23,7 @@
#include <settings/app_settings.h>
#include <settings/parameters.h>
#include <plugins/3dapi/xv3d_types.h>
class EDA_3D_VIEWER_SETTINGS : public APP_SETTINGS_BASE
{
@ -48,6 +48,14 @@ public:
bool raytrace_reflections;
bool raytrace_refractions;
bool raytrace_shadows;
KIGFX::COLOR4D raytrace_lightColorCamera;
KIGFX::COLOR4D raytrace_lightColorTop;
KIGFX::COLOR4D raytrace_lightColorBottom;
std::vector<KIGFX::COLOR4D> raytrace_lightColor;
std::vector<int> raytrace_lightElevation; // -90 .. 90
std::vector<int> raytrace_lightAzimuth; // 0 .. 359
bool realistic;
bool show_adhesive;
bool show_axis;

View File

@ -144,6 +144,45 @@ 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 ) );
auto Transfer_color = [] ( const SFVEC3F& aSource, wxColourPickerCtrl *aTarget )
{
aTarget->SetColour( wxColour( aSource.r * 255,
aSource.g * 255,
aSource.b * 255, 255 ) );
};
Transfer_color( m_settings.m_raytrace_lightColorCamera, m_colourPickerCameraLight );
Transfer_color( m_settings.m_raytrace_lightColorTop, m_colourPickerTopLight );
Transfer_color( m_settings.m_raytrace_lightColorBottom, m_colourPickerBottomLight );
Transfer_color( m_settings.m_raytrace_lightColor[0], m_colourPickerLight1 );
Transfer_color( m_settings.m_raytrace_lightColor[1], m_colourPickerLight2 );
Transfer_color( m_settings.m_raytrace_lightColor[2], m_colourPickerLight3 );
Transfer_color( m_settings.m_raytrace_lightColor[3], m_colourPickerLight4 );
Transfer_color( m_settings.m_raytrace_lightColor[4], m_colourPickerLight5 );
Transfer_color( m_settings.m_raytrace_lightColor[5], m_colourPickerLight6 );
Transfer_color( m_settings.m_raytrace_lightColor[6], m_colourPickerLight7 );
Transfer_color( m_settings.m_raytrace_lightColor[7], m_colourPickerLight8 );
m_spinCtrlLightElevation1->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[0].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation2->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[1].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation3->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[2].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation4->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[3].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation5->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[4].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation6->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[5].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation7->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[6].x * 180.0f - 90.0f ) );
m_spinCtrlLightElevation8->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[7].x * 180.0f - 90.0f ) );
m_spinCtrlLightAzimuth1->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[0].y * 180.0f ) );
m_spinCtrlLightAzimuth2->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[1].y * 180.0f ) );
m_spinCtrlLightAzimuth3->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[2].y * 180.0f ) );
m_spinCtrlLightAzimuth4->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[3].y * 180.0f ) );
m_spinCtrlLightAzimuth5->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[4].y * 180.0f ) );
m_spinCtrlLightAzimuth6->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[5].y * 180.0f ) );
m_spinCtrlLightAzimuth7->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[6].y * 180.0f ) );
m_spinCtrlLightAzimuth8->SetValue( (int)( m_settings.m_raytrace_lightSphericalCoords[7].y * 180.0f ) );
// Camera Options
m_checkBoxEnableAnimation->SetValue( m_canvas->AnimationEnabledGet() );
m_sliderAnimationSpeed->SetValue( m_canvas->MovingSpeedMultiplierGet() );
@ -199,6 +238,55 @@ 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() );
auto Transfer_color = [] ( SFVEC3F& aTarget, wxColourPickerCtrl *aSource )
{
const wxColour color = aSource->GetColour();
aTarget = SFVEC3F( color.Red() / 255.0f,
color.Green() / 255.0f,
color.Blue() / 255.0f );
};
Transfer_color( m_settings.m_raytrace_lightColorCamera, m_colourPickerCameraLight );
Transfer_color( m_settings.m_raytrace_lightColorTop, m_colourPickerTopLight );
Transfer_color( m_settings.m_raytrace_lightColorBottom, m_colourPickerBottomLight );
Transfer_color( m_settings.m_raytrace_lightColor[0], m_colourPickerLight1 );
Transfer_color( m_settings.m_raytrace_lightColor[1], m_colourPickerLight2 );
Transfer_color( m_settings.m_raytrace_lightColor[2], m_colourPickerLight3 );
Transfer_color( m_settings.m_raytrace_lightColor[3], m_colourPickerLight4 );
Transfer_color( m_settings.m_raytrace_lightColor[4], m_colourPickerLight5 );
Transfer_color( m_settings.m_raytrace_lightColor[5], m_colourPickerLight6 );
Transfer_color( m_settings.m_raytrace_lightColor[6], m_colourPickerLight7 );
Transfer_color( m_settings.m_raytrace_lightColor[7], m_colourPickerLight8 );
m_settings.m_raytrace_lightSphericalCoords[0].x = ( m_spinCtrlLightElevation1->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[1].x = ( m_spinCtrlLightElevation2->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[2].x = ( m_spinCtrlLightElevation3->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[3].x = ( m_spinCtrlLightElevation4->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[4].x = ( m_spinCtrlLightElevation5->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[5].x = ( m_spinCtrlLightElevation6->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[6].x = ( m_spinCtrlLightElevation7->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[7].x = ( m_spinCtrlLightElevation8->GetValue() + 90.0f ) / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[0].y = m_spinCtrlLightAzimuth1->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[1].y = m_spinCtrlLightAzimuth2->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[2].y = m_spinCtrlLightAzimuth3->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[3].y = m_spinCtrlLightAzimuth4->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[4].y = m_spinCtrlLightAzimuth5->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[5].y = m_spinCtrlLightAzimuth6->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[6].y = m_spinCtrlLightAzimuth7->GetValue() / 180.0f;
m_settings.m_raytrace_lightSphericalCoords[7].y = m_spinCtrlLightAzimuth8->GetValue() / 180.0f;
for( size_t i = 0; i < m_settings.m_raytrace_lightSphericalCoords.size(); ++i )
{
m_settings.m_raytrace_lightSphericalCoords[i].x = glm::clamp( m_settings.m_raytrace_lightSphericalCoords[i].x,
0.0f, 1.0f );
m_settings.m_raytrace_lightSphericalCoords[i].y = glm::clamp( m_settings.m_raytrace_lightSphericalCoords[i].y,
0.0f, 2.0f );
}
// Camera Options
m_canvas->AnimationEnabledSet( m_checkBoxEnableAnimation->GetValue() );
m_canvas->MovingSpeedMultiplierSet( m_sliderAnimationSpeed->GetValue() );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 15 2020)
// C++ code generated with wxFormBuilder (version 3.9.0 Aug 13 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -100,7 +100,7 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
fgSizer3DVisibility->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer3DVisibility->Add( 0, 0, 1, wxRIGHT|wxLEFT, 10 );
fgSizer3DVisibility->Add( 0, 0, 1, wxLEFT|wxRIGHT, 10 );
m_bitmap3DshapesTH = new wxStaticBitmap( sbSizer3DVis->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesTH, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@ -391,16 +391,17 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
wxBoxSizer* bSizerRaytracing;
bSizerRaytracing = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerRaytracingRenderOptions;
sbSizerRaytracingRenderOptions = new wxStaticBoxSizer( new wxStaticBox( m_panelRaytracing, wxID_ANY, _("Raytracing Render Options") ), wxVERTICAL );
sbSizerRaytracingRenderOptions->SetMinSize( wxSize( -1,32 ) );
wxFlexGridSizer* fgSizer9;
fgSizer9 = new wxFlexGridSizer( 4, 4, 0, 0 );
fgSizer9->SetFlexibleDirection( wxBOTH );
fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
fgSizer9->Add( 0, 0, 1, wxLEFT|wxRIGHT, 5 );
@ -452,13 +453,222 @@ 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|wxEXPAND, 5 );
sbSizerRaytracingRenderOptions->Add( fgSizer9, 1, wxALL, 5 );
bSizer8->Add( sbSizerRaytracingRenderOptions, 1, wxALL|wxEXPAND, 5 );
bSizer12->Add( sbSizerRaytracingRenderOptions, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerRaytracingLightConfiguration;
sbSizerRaytracingLightConfiguration = new wxStaticBoxSizer( new wxStaticBox( m_panelRaytracing, wxID_ANY, _("Lights configuration") ), wxVERTICAL );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
bSizerRaytracing->Add( bSizer8, 1, wxALL|wxEXPAND, 5 );
bSizer11->Add( 0, 0, 1, 0, 5 );
m_staticText17 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Ambient Camera Light"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText17->Wrap( -1 );
bSizer11->Add( m_staticText17, 0, wxALL, 5 );
m_colourPickerCameraLight = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxColour( 51, 51, 51 ), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
bSizer11->Add( m_colourPickerCameraLight, 0, 0, 5 );
bSizer11->Add( 0, 0, 1, 0, 5 );
sbSizerRaytracingLightConfiguration->Add( bSizer11, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxHORIZONTAL );
bSizer13->Add( 0, 0, 1, 0, 5 );
m_staticText5 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Top Light"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
bSizer13->Add( m_staticText5, 0, wxALL, 5 );
m_colourPickerTopLight = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxColour( 63, 63, 63 ), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
bSizer13->Add( m_colourPickerTopLight, 0, 0, 5 );
bSizer13->Add( 0, 0, 1, 0, 5 );
m_staticText6 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Bottom Light"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
bSizer13->Add( m_staticText6, 0, wxALL, 5 );
m_colourPickerBottomLight = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxColour( 63, 63, 63 ), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
bSizer13->Add( m_colourPickerBottomLight, 0, 0, 5 );
bSizer13->Add( 0, 0, 1, 0, 5 );
sbSizerRaytracingLightConfiguration->Add( bSizer13, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizer11;
fgSizer11 = new wxFlexGridSizer( 0, 9, 0, 0 );
fgSizer11->SetFlexibleDirection( wxBOTH );
fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer11->Add( 0, 0, 1, 0, 5 );
fgSizer11->Add( 0, 0, 1, 0, 5 );
m_staticText20 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Elevation °"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText20->Wrap( -1 );
fgSizer11->Add( m_staticText20, 0, wxALL, 5 );
m_staticText18 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Azimuth °"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText18->Wrap( -1 );
fgSizer11->Add( m_staticText18, 0, wxALL, 5 );
fgSizer11->Add( 0, 0, 1, 0, 5 );
fgSizer11->Add( 0, 0, 1, 0, 5 );
fgSizer11->Add( 0, 0, 1, 0, 5 );
m_staticText27 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Elevation °"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText27->Wrap( -1 );
fgSizer11->Add( m_staticText27, 0, wxALL, 5 );
m_staticText28 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("Azimuth °"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText28->Wrap( -1 );
fgSizer11->Add( m_staticText28, 0, wxALL, 5 );
m_staticText21 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("1"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21->Wrap( -1 );
fgSizer11->Add( m_staticText21, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight1 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight1, 0, wxALL, 5 );
m_spinCtrlLightElevation1 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation1, 0, wxALL, 1 );
m_spinCtrlLightAzimuth1 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth1, 0, wxALL, 1 );
fgSizer11->Add( 0, 0, 1, wxALL, 5 );
m_staticText22 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("5"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText22->Wrap( -1 );
fgSizer11->Add( m_staticText22, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight5 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight5, 0, wxALL, 5 );
m_spinCtrlLightElevation5 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 10, 0 );
fgSizer11->Add( m_spinCtrlLightElevation5, 0, wxALL, 1 );
m_spinCtrlLightAzimuth5 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth5, 0, wxALL, 1 );
m_staticText23 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("2"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText23->Wrap( -1 );
fgSizer11->Add( m_staticText23, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight2 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight2, 0, wxALL, 5 );
m_spinCtrlLightElevation2 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation2, 0, wxALL, 1 );
m_spinCtrlLightAzimuth2 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth2, 0, wxALL, 1 );
fgSizer11->Add( 0, 0, 1, wxALL, 5 );
m_staticText24 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("6"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText24->Wrap( -1 );
fgSizer11->Add( m_staticText24, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight6 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight6, 0, wxALL, 5 );
m_spinCtrlLightElevation6 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 10, 0 );
fgSizer11->Add( m_spinCtrlLightElevation6, 0, wxALL, 1 );
m_spinCtrlLightAzimuth6 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth6, 0, wxALL, 1 );
m_staticText25 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("3"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText25->Wrap( -1 );
fgSizer11->Add( m_staticText25, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight3 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight3, 0, wxALL, 5 );
m_spinCtrlLightElevation3 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation3, 0, wxALL, 1 );
m_spinCtrlLightAzimuth3 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth3, 0, wxALL, 1 );
fgSizer11->Add( 0, 0, 1, wxALL, 5 );
m_staticText26 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("7"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26->Wrap( -1 );
fgSizer11->Add( m_staticText26, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight7 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight7, 0, wxALL, 5 );
m_spinCtrlLightElevation7 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 10, 0 );
fgSizer11->Add( m_spinCtrlLightElevation7, 0, wxALL, 1 );
m_spinCtrlLightAzimuth7 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth7, 0, wxALL, 1 );
m_staticText171 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("4"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText171->Wrap( -1 );
fgSizer11->Add( m_staticText171, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight4 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight4, 0, wxALL, 5 );
m_spinCtrlLightElevation4 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 90, 0 );
fgSizer11->Add( m_spinCtrlLightElevation4, 0, wxALL, 1 );
m_spinCtrlLightAzimuth4 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth4, 0, wxALL, 1 );
fgSizer11->Add( 0, 0, 1, wxALL|wxEXPAND, 5 );
m_staticText181 = new wxStaticText( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, _("8"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText181->Wrap( -1 );
fgSizer11->Add( m_staticText181, 0, wxALIGN_CENTER|wxALL, 5 );
m_colourPickerLight8 = new wxColourPickerCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxSize( -1,-1 ), wxCLRP_DEFAULT_STYLE );
fgSizer11->Add( m_colourPickerLight8, 0, wxALL, 5 );
m_spinCtrlLightElevation8 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS, -90, 10, 0 );
fgSizer11->Add( m_spinCtrlLightElevation8, 0, wxALL, 1 );
m_spinCtrlLightAzimuth8 = new wxSpinCtrl( sbSizerRaytracingLightConfiguration->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 124,-1 ), wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
fgSizer11->Add( m_spinCtrlLightAzimuth8, 0, wxALL, 1 );
sbSizerRaytracingLightConfiguration->Add( fgSizer11, 0, wxALL|wxEXPAND, 5 );
bSizer12->Add( sbSizerRaytracingLightConfiguration, 1, wxALL|wxEXPAND, 5 );
bSizerRaytracing->Add( bSizer12, 1, wxALL|wxEXPAND, 5 );
m_panelRaytracing->SetSizer( bSizerRaytracing );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 15 2020)
// C++ code generated with wxFormBuilder (version 3.9.0 Aug 13 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -29,6 +29,7 @@
#include <wx/slider.h>
#include <wx/panel.h>
#include <wx/choice.h>
#include <wx/clrpicker.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -100,6 +101,48 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkBoxRaytracing_showReflections;
wxCheckBox* m_checkBoxRaytracing_antiAliasing;
wxCheckBox* m_checkBoxRaytracing_postProcessing;
wxStaticText* m_staticText17;
wxColourPickerCtrl* m_colourPickerCameraLight;
wxStaticText* m_staticText5;
wxColourPickerCtrl* m_colourPickerTopLight;
wxStaticText* m_staticText6;
wxColourPickerCtrl* m_colourPickerBottomLight;
wxStaticText* m_staticText20;
wxStaticText* m_staticText18;
wxStaticText* m_staticText27;
wxStaticText* m_staticText28;
wxStaticText* m_staticText21;
wxColourPickerCtrl* m_colourPickerLight1;
wxSpinCtrl* m_spinCtrlLightElevation1;
wxSpinCtrl* m_spinCtrlLightAzimuth1;
wxStaticText* m_staticText22;
wxColourPickerCtrl* m_colourPickerLight5;
wxSpinCtrl* m_spinCtrlLightElevation5;
wxSpinCtrl* m_spinCtrlLightAzimuth5;
wxStaticText* m_staticText23;
wxColourPickerCtrl* m_colourPickerLight2;
wxSpinCtrl* m_spinCtrlLightElevation2;
wxSpinCtrl* m_spinCtrlLightAzimuth2;
wxStaticText* m_staticText24;
wxColourPickerCtrl* m_colourPickerLight6;
wxSpinCtrl* m_spinCtrlLightElevation6;
wxSpinCtrl* m_spinCtrlLightAzimuth6;
wxStaticText* m_staticText25;
wxColourPickerCtrl* m_colourPickerLight3;
wxSpinCtrl* m_spinCtrlLightElevation3;
wxSpinCtrl* m_spinCtrlLightAzimuth3;
wxStaticText* m_staticText26;
wxColourPickerCtrl* m_colourPickerLight7;
wxSpinCtrl* m_spinCtrlLightElevation7;
wxSpinCtrl* m_spinCtrlLightAzimuth7;
wxStaticText* m_staticText171;
wxColourPickerCtrl* m_colourPickerLight4;
wxSpinCtrl* m_spinCtrlLightElevation4;
wxSpinCtrl* m_spinCtrlLightAzimuth4;
wxStaticText* m_staticText181;
wxColourPickerCtrl* m_colourPickerLight8;
wxSpinCtrl* m_spinCtrlLightElevation8;
wxSpinCtrl* m_spinCtrlLightAzimuth8;
wxStaticLine* m_staticlineH;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;

View File

@ -404,12 +404,13 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
auto set_color = [] ( const COLOR4D& aColor, SFVEC3D& aTarget )
{
aTarget.r = aColor.r;
aTarget.g = aColor.g;
aTarget.b = aColor.b;
};
auto set_color =
[] ( const COLOR4D& aColor, SFVEC3D& aTarget )
{
aTarget.r = aColor.r;
aTarget.g = aColor.g;
aTarget.b = aColor.b;
};
set_color( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), m_boardAdapter.m_BgColorBot );
set_color( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_boardAdapter.m_BgColorTop );
@ -423,6 +424,26 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
if( cfg )
{
m_boardAdapter.m_raytrace_lightColorCamera = m_boardAdapter.GetColor( cfg->m_Render.raytrace_lightColorCamera );
m_boardAdapter.m_raytrace_lightColorTop = m_boardAdapter.GetColor( cfg->m_Render.raytrace_lightColorTop );
m_boardAdapter.m_raytrace_lightColorBottom = m_boardAdapter.GetColor( cfg->m_Render.raytrace_lightColorBottom );
m_boardAdapter.m_raytrace_lightColor.resize( cfg->m_Render.raytrace_lightColor.size() );
m_boardAdapter.m_raytrace_lightSphericalCoords.resize( cfg->m_Render.raytrace_lightColor.size() );
for( size_t i = 0; i < cfg->m_Render.raytrace_lightColor.size(); ++i )
{
m_boardAdapter.m_raytrace_lightColor[i] = m_boardAdapter.GetColor( cfg->m_Render.raytrace_lightColor[i] );
SFVEC2F sphericalCoord = SFVEC2F( ( cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
sphericalCoord.x = glm::clamp( sphericalCoord.x, 0.0f, 1.0f );
sphericalCoord.y = glm::clamp( sphericalCoord.y, 0.0f, 2.0f );
m_boardAdapter.m_raytrace_lightSphericalCoords[i] = sphericalCoord;
}
#define TRANSFER_SETTING( flag, field ) m_boardAdapter.SetFlag( flag, cfg->m_Render.field )
TRANSFER_SETTING( FL_USE_REALISTIC_MODE, realistic );
@ -494,10 +515,11 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
auto save_color = [colors] ( SFVEC3D& aSource, LAYER_3D_ID aTarget )
{
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 ) );
};
auto save_color =
[colors] ( SFVEC3D& aSource, LAYER_3D_ID aTarget )
{
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 ) );
};
save_color( m_boardAdapter.m_BgColorBot, LAYER_3D_BACKGROUND_BOTTOM );
save_color( m_boardAdapter.m_BgColorTop, LAYER_3D_BACKGROUND_TOP );
@ -514,6 +536,26 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
if( cfg )
{
auto save_color =
[] ( const SFVEC3F& aSource, COLOR4D& aTarget )
{
aTarget = COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 );
};
save_color( m_boardAdapter.m_raytrace_lightColorCamera, cfg->m_Render.raytrace_lightColorCamera );
save_color( m_boardAdapter.m_raytrace_lightColorTop, cfg->m_Render.raytrace_lightColorTop );
save_color( m_boardAdapter.m_raytrace_lightColorBottom, cfg->m_Render.raytrace_lightColorBottom );
for( size_t i = 0; i < cfg->m_Render.raytrace_lightColor.size(); ++i )
{
save_color( m_boardAdapter.m_raytrace_lightColor[i], cfg->m_Render.raytrace_lightColor[i] );
cfg->m_Render.raytrace_lightElevation[i] = (int)( m_boardAdapter.m_raytrace_lightSphericalCoords[i].x * 180.0f - 90.0f );
cfg->m_Render.raytrace_lightAzimuth[i] = (int)( m_boardAdapter.m_raytrace_lightSphericalCoords[i].y * 180.0f );
}
#define TRANSFER_SETTING( field, flag ) cfg->m_Render.field = m_boardAdapter.GetFlag( flag )
cfg->m_Render.engine = static_cast<int>( m_boardAdapter.RenderEngineGet() );