More consistent formatting.

This commit is contained in:
Jeff Young 2021-08-02 11:34:36 +01:00
parent 210671b10a
commit 4943d2f0a3
2 changed files with 96 additions and 101 deletions

View File

@ -433,8 +433,7 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
set_color( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_boardAdapter.m_BgColorTop );
set_color( colors->GetColor( LAYER_3D_BOARD ), m_boardAdapter.m_BoardBodyColor );
set_color( colors->GetColor( LAYER_3D_COPPER ), m_boardAdapter.m_CopperColor );
set_color( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ),
m_boardAdapter.m_SilkScreenColorBot );
set_color( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), m_boardAdapter.m_SilkScreenColorBot );
set_color( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), m_boardAdapter.m_SilkScreenColorTop );
set_color( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ), m_boardAdapter.m_SolderMaskColorBot );
set_color( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ), m_boardAdapter.m_SolderMaskColorTop );
@ -477,8 +476,7 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
TRANSFER_SETTING( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, opengl_show_model_bbox );
TRANSFER_SETTING( FL_HIGHLIGHT_ROLLOVER_ITEM, opengl_highlight_on_rollover );
TRANSFER_SETTING( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE, opengl_AA_disableOnMove );
TRANSFER_SETTING( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE,
opengl_thickness_disableOnMove );
TRANSFER_SETTING( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE, opengl_thickness_disableOnMove );
TRANSFER_SETTING( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE, opengl_vias_disableOnMove );
TRANSFER_SETTING( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE, opengl_holes_disableOnMove );
@ -576,8 +574,10 @@ void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
float( colors->GetColor( aTarget ).a ) );
if( aSource != newSFVEC4Fcolor )
{
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b,
aSource.a ) );
}
};
save_color( m_boardAdapter.m_BgColorBot, LAYER_3D_BACKGROUND_BOTTOM );
@ -598,7 +598,6 @@ void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
if( cfg )
{
auto save_color =
[] ( const SFVEC3F& aSource, COLOR4D& aTarget )
{

View File

@ -37,81 +37,81 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
m_Camera()
{
m_params.emplace_back( new PARAM<int>( "render.engine", &m_Render.engine,
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
static_cast<int>( RENDER_ENGINE::RAYTRACING ) ) );
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ),
static_cast<int>( RENDER_ENGINE::RAYTRACING ) ) );
m_params.emplace_back( new PARAM<int>( "render.grid_type", &m_Render.grid_type,
static_cast<int>( GRID3D_TYPE::NONE ),
static_cast<int>( GRID3D_TYPE::NONE ),
static_cast<int>( GRID3D_TYPE::GRID_10MM ) ) );
static_cast<int>( GRID3D_TYPE::NONE ),
static_cast<int>( GRID3D_TYPE::NONE ),
static_cast<int>( GRID3D_TYPE::GRID_10MM ) ) );
m_params.emplace_back( new PARAM<int>( "render.material_mode", &m_Render.material_mode,
static_cast<int>( MATERIAL_MODE::NORMAL ),
static_cast<int>( MATERIAL_MODE::NORMAL ),
static_cast<int>( MATERIAL_MODE::CAD_MODE ) ) );
static_cast<int>( MATERIAL_MODE::NORMAL ),
static_cast<int>( MATERIAL_MODE::NORMAL ),
static_cast<int>( MATERIAL_MODE::CAD_MODE ) ) );
m_params.emplace_back( new PARAM<int>( "render.opengl_AA_mode", &m_Render.opengl_AA_mode,
static_cast<int>( ANTIALIASING_MODE::AA_8X ),
static_cast<int>( ANTIALIASING_MODE::AA_NONE ),
static_cast<int>( ANTIALIASING_MODE::AA_8X ) ) );
static_cast<int>( ANTIALIASING_MODE::AA_8X ),
static_cast<int>( ANTIALIASING_MODE::AA_NONE ),
static_cast<int>( ANTIALIASING_MODE::AA_8X ) ) );
m_params.emplace_back( new PARAM<COLOR4D>( "render.opengl_selection_color",
&m_Render.opengl_selection_color,
COLOR4D( 0.0, 1.0, 0.0, 1.0 ) ) );
// OpenGL options
m_params.emplace_back( new PARAM<bool>(
"render.opengl_copper_thickness", &m_Render.opengl_copper_thickness, true ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_show_model_bbox", &m_Render.opengl_show_model_bbox, false ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_highlight_on_rollover", &m_Render.opengl_highlight_on_rollover, true ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_AA_disableOnMove", &m_Render.opengl_AA_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_thickness_disableOnMove", &m_Render.opengl_thickness_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_vias_disableOnMove", &m_Render.opengl_vias_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_holes_disableOnMove", &m_Render.opengl_holes_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>(
"render.opengl_render_bbox_only_OnMove", &m_Render.opengl_render_bbox_only_OnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_copper_thickness",
&m_Render.opengl_copper_thickness, true ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_show_model_bbox",
&m_Render.opengl_show_model_bbox, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_highlight_on_rollover",
&m_Render.opengl_highlight_on_rollover, true ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_AA_disableOnMove",
&m_Render.opengl_AA_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_thickness_disableOnMove",
&m_Render.opengl_thickness_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_vias_disableOnMove",
&m_Render.opengl_vias_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_holes_disableOnMove",
&m_Render.opengl_holes_disableOnMove, false ) );
m_params.emplace_back( new PARAM<bool>( "render.opengl_render_bbox_only_OnMove",
&m_Render.opengl_render_bbox_only_OnMove, false ) );
// Raytracing options
m_params.emplace_back( new PARAM<bool>( "render.raytrace_anti_aliasing",
&m_Render.raytrace_anti_aliasing, true ) );
&m_Render.raytrace_anti_aliasing, true ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_backfloor",
&m_Render.raytrace_backfloor, false ) );
&m_Render.raytrace_backfloor, false ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_post_processing",
&m_Render.raytrace_post_processing, true ) );
&m_Render.raytrace_post_processing, true ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_procedural_textures",
&m_Render.raytrace_procedural_textures, true ) );
&m_Render.raytrace_procedural_textures, true ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_reflections",
&m_Render.raytrace_reflections, true ) );
&m_Render.raytrace_reflections, true ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_refractions",
&m_Render.raytrace_refractions, true ) );
&m_Render.raytrace_refractions, true ) );
m_params.emplace_back( new PARAM<bool>( "render.raytrace_shadows",
&m_Render.raytrace_shadows, true ) );
&m_Render.raytrace_shadows, true ) );
m_params.emplace_back( new PARAM<int>( "render.raytrace_nrsamples_shadows",
&m_Render.raytrace_nrsamples_shadows, 3 ) );
&m_Render.raytrace_nrsamples_shadows, 3 ) );
m_params.emplace_back( new PARAM<int>( "render.raytrace_nrsamples_reflections",
&m_Render.raytrace_nrsamples_reflections, 3 ) );
&m_Render.raytrace_nrsamples_reflections, 3 ) );
m_params.emplace_back( new PARAM<int>( "render.raytrace_nrsamples_refractions",
&m_Render.raytrace_nrsamples_refractions, 4 ) );
&m_Render.raytrace_nrsamples_refractions, 4 ) );
m_params.emplace_back( new PARAM<int>( "render.raytrace_recursivelevel_reflections",
&m_Render.raytrace_recursivelevel_reflections, 3 ) );
&m_Render.raytrace_recursivelevel_reflections, 3 ) );
m_params.emplace_back( new PARAM<int>( "render.raytrace_recursivelevel_refractions",
&m_Render.raytrace_recursivelevel_refractions, 2 ) );
&m_Render.raytrace_recursivelevel_refractions, 2 ) );
m_params.emplace_back( new PARAM<float>( "render.raytrace_spread_shadows",
&m_Render.raytrace_spread_shadows, 0.05f ) );
&m_Render.raytrace_spread_shadows, 0.05f ) );
m_params.emplace_back( new PARAM<float>( "render.raytrace_spread_reflections",
&m_Render.raytrace_spread_reflections, 0.025f ) );
&m_Render.raytrace_spread_reflections, 0.025f ) );
m_params.emplace_back( new PARAM<float>( "render.raytrace_spread_refractions",
&m_Render.raytrace_spread_refractions, 0.025f ) );
&m_Render.raytrace_spread_refractions, 0.025f ) );
m_params.emplace_back( new PARAM<COLOR4D>( "render.raytrace_lightColorCamera",
&m_Render.raytrace_lightColorCamera,
@ -159,43 +159,45 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
&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 ) );
m_params.emplace_back( new PARAM<bool>( "render.show_axis", &m_Render.show_axis, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_board_body", &m_Render.show_board_body, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_comments", &m_Render.show_comments, true ) );
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 ) );
m_params.emplace_back( new PARAM<bool>( "render.show_axis",
&m_Render.show_axis, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_board_body",
&m_Render.show_board_body, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_comments",
&m_Render.show_comments, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_eco", &m_Render.show_eco, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
&m_Render.show_footprints_insert, true ) );
&m_Render.show_footprints_insert, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
&m_Render.show_footprints_normal, true ) );
&m_Render.show_footprints_normal, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_virtual",
&m_Render.show_footprints_virtual, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_silkscreen", &m_Render.show_silkscreen, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_soldermask", &m_Render.show_soldermask, true ) );
m_params.emplace_back(
new PARAM<bool>( "render.show_solderpaste", &m_Render.show_solderpaste, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_zones", &m_Render.show_zones, true ) );
&m_Render.show_footprints_virtual, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen",
&m_Render.show_silkscreen, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask",
&m_Render.show_soldermask, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_solderpaste",
&m_Render.show_solderpaste, true ) );
m_params.emplace_back( new PARAM<bool>( "render.show_zones",
&m_Render.show_zones, true ) );
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
&m_Render.subtract_mask_from_silk, false ) );
&m_Render.subtract_mask_from_silk, false ) );
m_params.emplace_back( new PARAM<bool>( "render.clip_silk_on_via_annulus",
&m_Render.clip_silk_on_via_annulus, false ) );
&m_Render.clip_silk_on_via_annulus, false ) );
m_params.emplace_back( new PARAM<bool>( "render.plated_and_bare_copper",
&m_Render.renderPlatedPadsAsPlated, false ) );
&m_Render.renderPlatedPadsAsPlated, false ) );
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
&m_Camera.animation_enabled, true ) );
&m_Camera.animation_enabled, true ) );
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
&m_Camera.moving_speed_multiplier, 3 ) );
&m_Camera.moving_speed_multiplier, 3 ) );
m_params.emplace_back( new PARAM<double>( "camera.rotation_increment",
&m_Camera.rotation_increment, 10.0 ) );
&m_Camera.rotation_increment, 10.0 ) );
m_params.emplace_back( new PARAM<int>( "camera.projection_mode",
&m_Camera.projection_mode, 1 ) );
&m_Camera.projection_mode, 1 ) );
}
@ -203,18 +205,15 @@ bool EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
{
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
ret &= fromLegacy<int>( aCfg, "RenderEngine", "render.engine" );
ret &= fromLegacy<int>( aCfg, "ShowGrid3D", "render.grid_type" );
ret &= fromLegacy<int>( aCfg, "Render_Material", "render.material_mode" );
ret &= fromLegacy<bool>(
aCfg, "Render_OGL_ShowCopperThickness", "render.opengl_copper_thickness" );
ret &= fromLegacy<bool>(
aCfg, "Render_OGL_ShowModelBoudingBoxes", "render.opengl_show_model_bbox" );
ret &= fromLegacy<int>( aCfg, "RenderEngine", "render.engine" );
ret &= fromLegacy<int>( aCfg, "ShowGrid3D", "render.grid_type" );
ret &= fromLegacy<int>( aCfg, "Render_Material", "render.material_mode" );
ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowCopperThickness", "render.opengl_copper_thickness" );
ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowModelBoudingBoxes", "render.opengl_show_model_bbox" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_AntiAliasing", "render.raytrace_anti_aliasing" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Backfloor", "render.raytrace_backfloor" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_PostProcess", "render.raytrace_post_processing" );
ret &= fromLegacy<bool>(
aCfg, "Render_RAY_ProceduralTextures", "render.raytrace_procedural_textures" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_ProceduralTextures", "render.raytrace_procedural_textures" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Reflections", "render.raytrace_reflections" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Refractions", "render.raytrace_refractions" );
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Shadows", "render.raytrace_shadows" );
@ -233,31 +232,28 @@ bool EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<bool>( aCfg, "ShowZones", "render.show_zones" );
ret &= fromLegacy<bool>( aCfg, "SubtractMaskFromSilk", "render.subtract_mask_from_silk" );
auto migrate_color =
[&] ( const std::string& k_r, const std::string& k_g, const std::string& k_b,
std::string destKey, double alpha = 1.0 )
auto do_color =
[&] ( const std::string& key_r, const std::string& key_g, const std::string& key_b,
std::string key_dest, double alpha = 1.0 )
{
COLOR4D color( 1, 1, 1, alpha );
if( aCfg->Read( k_r, &color.r ) &&
aCfg->Read( k_g, &color.g ) && aCfg->Read( k_b, &color.b ) )
if( aCfg->Read( key_r, &color.r )
&& aCfg->Read( key_g, &color.g )
&& aCfg->Read( key_b, &color.b ) )
{
Set( destKey, color );
Set( key_dest, color );
}
};
migrate_color( "BgColor_Red", "BgColor_Green", "BgColor_Blue", "colors.background_bottom" );
migrate_color(
"BgColor_Red_Top", "BgColor_Green_Top", "BgColor_Blue_Top", "colors.background_top" );
migrate_color(
"BoardBodyColor_Red", "BoardBodyColor_Green", "BoardBodyColor_Blue", "colors.board" );
migrate_color( "CopperColor_Red", "CopperColor_Green", "CopperColor_Blue", "colors.copper" );
migrate_color(
"SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_bottom" );
migrate_color( "SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_top" );
migrate_color( "SMaskColor_Red", "SMaskColor_Green", "SMaskColor_Blue", "colors.soldermask", 0.83 );
migrate_color(
"SPasteColor_Red", "SPasteColor_Green", "SPasteColor_Blue", "colors.solderpaste" );
do_color( "BgColor_Red", "BgColor_Green", "BgColor_Blue", "colors.background_bottom" );
do_color( "BgColor_Red_Top", "BgColor_Green_Top", "BgColor_Blue_Top", "colors.background_top" );
do_color( "BoardBodyColor_Red", "BoardBodyColor_Green", "BoardBodyColor_Blue", "colors.board" );
do_color( "CopperColor_Red", "CopperColor_Green", "CopperColor_Blue", "colors.copper" );
do_color( "SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_bottom" );
do_color( "SilkColor_Red", "SilkColor_Green", "SilkColor_Blue", "colors.silkscreen_top" );
do_color( "SMaskColor_Red", "SMaskColor_Green", "SMaskColor_Blue", "colors.soldermask", 0.83 );
do_color( "SPasteColor_Red", "SPasteColor_Green", "SPasteColor_Blue", "colors.solderpaste" );
return ret;
}