3d-viewer : synchronise colours with board stackup.
ADDED: 3d-viewer can now look up colours defined in board properties Fixes https://gitlab.com/kicad/code/kicad/issues/2261
This commit is contained in:
parent
8f778b5a0f
commit
183bbf6914
|
@ -107,9 +107,11 @@ CINFO3D_VISU::CINFO3D_VISU() :
|
|||
m_BgColorBot = SFVEC3D( 0.4, 0.4, 0.5 );
|
||||
m_BgColorTop = SFVEC3D( 0.8, 0.8, 0.9 );
|
||||
m_BoardBodyColor = SFVEC3D( 0.4, 0.4, 0.5 );
|
||||
m_SolderMaskColor = SFVEC3D( 0.1, 0.2, 0.1 );
|
||||
m_SolderMaskColorTop = SFVEC3D( 0.1, 0.2, 0.1 );
|
||||
m_SolderMaskColorBot = SFVEC3D( 0.1, 0.2, 0.1 );
|
||||
m_SolderPasteColor = SFVEC3D( 0.4, 0.4, 0.4 );
|
||||
m_SilkScreenColor = SFVEC3D( 0.9, 0.9, 0.9 );
|
||||
m_SilkScreenColorTop = SFVEC3D( 0.9, 0.9, 0.9 );
|
||||
m_SilkScreenColorBot = SFVEC3D( 0.9, 0.9, 0.9 );
|
||||
m_CopperColor = SFVEC3D( 0.75, 0.61, 0.23 );
|
||||
}
|
||||
|
||||
|
|
|
@ -497,9 +497,11 @@ public:
|
|||
SFVEC3D m_BgColorBot; ///< background bottom color
|
||||
SFVEC3D m_BgColorTop; ///< background top color
|
||||
SFVEC3D m_BoardBodyColor; ///< in realistic mode: FR4 board color
|
||||
SFVEC3D m_SolderMaskColor; ///< in realistic mode: solder mask color
|
||||
SFVEC3D m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
|
||||
SFVEC3D m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
|
||||
SFVEC3D m_SolderPasteColor; ///< in realistic mode: solder paste color
|
||||
SFVEC3D m_SilkScreenColor; ///< in realistic mode: SilkScreen color
|
||||
SFVEC3D m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
||||
SFVEC3D m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
||||
SFVEC3D m_CopperColor; ///< in realistic mode: copper color
|
||||
|
||||
|
||||
|
|
|
@ -219,36 +219,57 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
|||
|
||||
|
||||
// Silk screen material mixed with silk screen color
|
||||
m_materials.m_SilkS.m_Ambient = SFVEC3F( m_settings.m_SilkScreenColor.r,
|
||||
m_settings.m_SilkScreenColor.g,
|
||||
m_settings.m_SilkScreenColor.b );
|
||||
m_materials.m_SilkSTop.m_Ambient = SFVEC3F( m_settings.m_SilkScreenColorTop.r,
|
||||
m_settings.m_SilkScreenColorTop.g, m_settings.m_SilkScreenColorTop.b );
|
||||
|
||||
m_materials.m_SilkS.m_Specular = SFVEC3F( m_settings.m_SilkScreenColor.r *
|
||||
m_settings.m_SilkScreenColor.r + 0.10f,
|
||||
m_settings.m_SilkScreenColor.g *
|
||||
m_settings.m_SilkScreenColor.g + 0.10f,
|
||||
m_settings.m_SilkScreenColor.b *
|
||||
m_settings.m_SilkScreenColor.b + 0.10f );
|
||||
m_materials.m_SilkSTop.m_Specular = SFVEC3F(
|
||||
m_settings.m_SilkScreenColorTop.r * m_settings.m_SilkScreenColorTop.r + 0.10f,
|
||||
m_settings.m_SilkScreenColorTop.g * m_settings.m_SilkScreenColorTop.g + 0.10f,
|
||||
m_settings.m_SilkScreenColorTop.b * m_settings.m_SilkScreenColorTop.b + 0.10f );
|
||||
|
||||
m_materials.m_SilkS.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
m_materials.m_SilkSTop.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_SilkSTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Silk screen material mixed with silk screen color
|
||||
m_materials.m_SilkSBot.m_Ambient = SFVEC3F( m_settings.m_SilkScreenColorBot.r,
|
||||
m_settings.m_SilkScreenColorBot.g, m_settings.m_SilkScreenColorBot.b );
|
||||
|
||||
m_materials.m_SilkSBot.m_Specular = SFVEC3F(
|
||||
m_settings.m_SilkScreenColorBot.r * m_settings.m_SilkScreenColorBot.r + 0.10f,
|
||||
m_settings.m_SilkScreenColorBot.g * m_settings.m_SilkScreenColorBot.g + 0.10f,
|
||||
m_settings.m_SilkScreenColorBot.b * m_settings.m_SilkScreenColorBot.b + 0.10f );
|
||||
|
||||
m_materials.m_SilkSBot.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_SilkSBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Solder mask material mixed with solder mask color
|
||||
m_materials.m_SolderMask.m_Ambient = SFVEC3F( m_settings.m_SolderMaskColor.r * 0.3f,
|
||||
m_settings.m_SolderMaskColor.g * 0.3f,
|
||||
m_settings.m_SolderMaskColor.b * 0.3f );
|
||||
m_materials.m_SolderMaskTop.m_Ambient = SFVEC3F( m_settings.m_SolderMaskColorTop.r * 0.3f,
|
||||
m_settings.m_SolderMaskColorTop.g * 0.3f,
|
||||
m_settings.m_SolderMaskColorTop.b * 0.3f );
|
||||
|
||||
m_materials.m_SolderMask.m_Specular = SFVEC3F( m_settings.m_SolderMaskColor.r *
|
||||
m_settings.m_SolderMaskColor.r,
|
||||
m_settings.m_SolderMaskColor.g *
|
||||
m_settings.m_SolderMaskColor.g,
|
||||
m_settings.m_SolderMaskColor.b *
|
||||
m_settings.m_SolderMaskColor.b );
|
||||
m_materials.m_SolderMaskTop.m_Specular =
|
||||
SFVEC3F( m_settings.m_SolderMaskColorTop.r * m_settings.m_SolderMaskColorTop.r,
|
||||
m_settings.m_SolderMaskColorTop.g * m_settings.m_SolderMaskColorTop.g,
|
||||
m_settings.m_SolderMaskColorTop.b * m_settings.m_SolderMaskColorTop.b );
|
||||
|
||||
m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
|
||||
m_materials.m_SolderMask.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
m_materials.m_SolderMaskTop.m_Shininess = 0.8f * 128.0f;
|
||||
m_materials.m_SolderMaskTop.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMaskTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Solder mask material mixed with solder mask color
|
||||
m_materials.m_SolderMaskBot.m_Ambient = SFVEC3F( m_settings.m_SolderMaskColorBot.r * 0.3f,
|
||||
m_settings.m_SolderMaskColorBot.g * 0.3f,
|
||||
m_settings.m_SolderMaskColorBot.b * 0.3f );
|
||||
|
||||
m_materials.m_SolderMaskBot.m_Specular =
|
||||
SFVEC3F( m_settings.m_SolderMaskColorBot.r * m_settings.m_SolderMaskColorBot.r,
|
||||
m_settings.m_SolderMaskColorBot.g * m_settings.m_SolderMaskColorBot.g,
|
||||
m_settings.m_SolderMaskColorBot.b * m_settings.m_SolderMaskColorBot.b );
|
||||
|
||||
m_materials.m_SolderMaskBot.m_Shininess = 0.8f * 128.0f;
|
||||
m_materials.m_SolderMaskBot.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMaskBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
|
||||
// Epoxy material
|
||||
|
@ -284,17 +305,30 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
|||
m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Silk screen material
|
||||
m_materials.m_SilkS.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SilkS.m_Specular = matSpecularColor;
|
||||
m_materials.m_SilkS.m_Shininess = matShininess;
|
||||
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
m_materials.m_SilkSTop.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SilkSTop.m_Specular = matSpecularColor;
|
||||
m_materials.m_SilkSTop.m_Shininess = matShininess;
|
||||
m_materials.m_SilkSTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Silk screen material
|
||||
m_materials.m_SilkSBot.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SilkSBot.m_Specular = matSpecularColor;
|
||||
m_materials.m_SilkSBot.m_Shininess = matShininess;
|
||||
m_materials.m_SilkSBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Solder mask material
|
||||
m_materials.m_SolderMask.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SolderMask.m_Specular = matSpecularColor;
|
||||
m_materials.m_SolderMask.m_Shininess = matShininess;
|
||||
m_materials.m_SolderMask.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
m_materials.m_SolderMaskTop.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SolderMaskTop.m_Specular = matSpecularColor;
|
||||
m_materials.m_SolderMaskTop.m_Shininess = matShininess;
|
||||
m_materials.m_SolderMaskTop.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMaskTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Solder mask material
|
||||
m_materials.m_SolderMaskBot.m_Ambient = matAmbientColor;
|
||||
m_materials.m_SolderMaskBot.m_Specular = matSpecularColor;
|
||||
m_materials.m_SolderMaskBot.m_Shininess = matShininess;
|
||||
m_materials.m_SolderMaskBot.m_Transparency = 0.17f;
|
||||
m_materials.m_SolderMaskBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Epoxy material
|
||||
m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
|
||||
|
@ -318,9 +352,12 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
|
|||
switch( aLayerID )
|
||||
{
|
||||
case B_Mask:
|
||||
m_materials.m_SolderMaskBot.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SolderMaskBot );
|
||||
break;
|
||||
case F_Mask:
|
||||
m_materials.m_SolderMask.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SolderMask );
|
||||
m_materials.m_SolderMaskTop.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SolderMaskTop );
|
||||
break;
|
||||
|
||||
case B_Paste:
|
||||
|
@ -330,9 +367,11 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
|
|||
break;
|
||||
|
||||
case B_SilkS:
|
||||
m_materials.m_SilkSBot.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SilkSBot );
|
||||
case F_SilkS:
|
||||
m_materials.m_SilkS.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SilkS );
|
||||
m_materials.m_SilkSTop.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SilkSTop );
|
||||
break;
|
||||
|
||||
case B_Adhes:
|
||||
|
@ -385,8 +424,10 @@ SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color( PCB_LAYER_ID aLayerID )
|
|||
break;
|
||||
|
||||
case B_Mask:
|
||||
layerColor = m_settings.m_SolderMaskColorBot;
|
||||
break;
|
||||
case F_Mask:
|
||||
layerColor = m_settings.m_SolderMaskColor;
|
||||
layerColor = m_settings.m_SolderMaskColorTop;
|
||||
break;
|
||||
|
||||
case B_Paste:
|
||||
|
@ -395,8 +436,10 @@ SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color( PCB_LAYER_ID aLayerID )
|
|||
break;
|
||||
|
||||
case B_SilkS:
|
||||
layerColor = m_settings.m_SilkScreenColorBot;
|
||||
break;
|
||||
case F_SilkS:
|
||||
layerColor = m_settings.m_SilkScreenColor;
|
||||
layerColor = m_settings.m_SilkScreenColorTop;
|
||||
break;
|
||||
|
||||
case Dwgs_User:
|
||||
|
|
|
@ -200,8 +200,10 @@ private:
|
|||
struct
|
||||
{
|
||||
SMATERIAL m_Paste;
|
||||
SMATERIAL m_SilkS;
|
||||
SMATERIAL m_SolderMask;
|
||||
SMATERIAL m_SilkSBot;
|
||||
SMATERIAL m_SilkSTop;
|
||||
SMATERIAL m_SolderMaskBot;
|
||||
SMATERIAL m_SolderMaskTop;
|
||||
SMATERIAL m_EpoxyBoard;
|
||||
SMATERIAL m_Copper;
|
||||
SMATERIAL m_Plastic;
|
||||
|
|
|
@ -100,35 +100,55 @@ void C3D_RENDER_RAYTRACING::setupMaterials()
|
|||
0.0f, // transparency
|
||||
0.0f );
|
||||
|
||||
m_materials.m_SilkS = CBLINN_PHONG_MATERIAL(
|
||||
ConvertSRGBToLinear( SFVEC3F( 0.11f ) ),// ambient
|
||||
m_materials.m_SilkS = CBLINN_PHONG_MATERIAL( ConvertSRGBToLinear( SFVEC3F( 0.11f ) ), // ambient
|
||||
SFVEC3F( 0.0f, 0.0f, 0.0f ), // emissive
|
||||
glm::clamp( ((SFVEC3F)(1.0f) -
|
||||
ConvertSRGBToLinear( (SFVEC3F)m_settings.m_SilkScreenColor) ),
|
||||
glm::clamp(
|
||||
( ( SFVEC3F )( 1.0f )
|
||||
- ConvertSRGBToLinear( (SFVEC3F) m_settings.m_SilkScreenColorTop ) ),
|
||||
SFVEC3F( 0.0f ),
|
||||
SFVEC3F( 0.10f ) ), // specular
|
||||
0.078125f * 128.0f, // shiness
|
||||
0.0f, // transparency
|
||||
0.0f );
|
||||
|
||||
const float solderMask_gray = ( m_settings.m_SolderMaskColor.r +
|
||||
m_settings.m_SolderMaskColor.g +
|
||||
m_settings.m_SolderMaskColor.b ) / 3.0f;
|
||||
const float solderMaskTop_gray =
|
||||
( m_settings.m_SolderMaskColorTop.r + m_settings.m_SolderMaskColorTop.g
|
||||
+ m_settings.m_SolderMaskColorTop.b )
|
||||
/ 3.0f;
|
||||
|
||||
const float solderMask_transparency = solderMask_gray * 0.40f + 0.005f;
|
||||
const float solderMaskTop_transparency = solderMaskTop_gray * 0.40f + 0.005f;
|
||||
|
||||
m_materials.m_SolderMask = CBLINN_PHONG_MATERIAL(
|
||||
ConvertSRGBToLinear( (SFVEC3F)m_settings.m_SolderMaskColor ) *
|
||||
0.10f, // ambient
|
||||
ConvertSRGBToLinear( (SFVEC3F) m_settings.m_SolderMaskColorTop ) * 0.10f, // ambient
|
||||
SFVEC3F( 0.0f, 0.0f, 0.0f ), // emissive
|
||||
glm::clamp( ( (SFVEC3F)( 1.0f ) -
|
||||
ConvertSRGBToLinear( (SFVEC3F)m_settings.m_SolderMaskColor ) ),
|
||||
glm::clamp(
|
||||
( ( SFVEC3F )( 1.0f )
|
||||
- ConvertSRGBToLinear( (SFVEC3F) m_settings.m_SolderMaskColorTop ) ),
|
||||
SFVEC3F( 0.0f ),
|
||||
SFVEC3F( solderMask_gray * 2.0f ) ), // specular
|
||||
SFVEC3F( solderMaskTop_gray * 2.0f ) ), // specular
|
||||
0.85f * 128.0f, // shiness
|
||||
solderMask_transparency, // transparency
|
||||
solderMaskTop_transparency, // transparency
|
||||
0.16f ); // reflection
|
||||
|
||||
const float solderMaskBot_gray =
|
||||
( m_settings.m_SolderMaskColorBot.r + m_settings.m_SolderMaskColorBot.g
|
||||
+ m_settings.m_SolderMaskColorBot.b )
|
||||
/ 3.0f;
|
||||
|
||||
const float solderMaskBot_transparency = solderMaskBot_gray * 0.40f + 0.005f;
|
||||
|
||||
m_materials.m_SolderMask = CBLINN_PHONG_MATERIAL(
|
||||
ConvertSRGBToLinear( (SFVEC3F) m_settings.m_SolderMaskColorBot ) * 0.10f, // ambient
|
||||
SFVEC3F( 0.0f, 0.0f, 0.0f ), // emissive
|
||||
glm::clamp(
|
||||
( ( SFVEC3F )( 1.0f )
|
||||
- ConvertSRGBToLinear( (SFVEC3F) m_settings.m_SolderMaskColorBot ) ),
|
||||
SFVEC3F( 0.0f ),
|
||||
SFVEC3F( solderMaskBot_gray * 2.0f ) ), // specular
|
||||
0.85f * 128.0f, // shiness
|
||||
solderMaskBot_transparency, // transparency
|
||||
0.16f );
|
||||
|
||||
m_materials.m_SolderMask.SetCastShadows( true );
|
||||
m_materials.m_SolderMask.SetNrRefractionsSamples( 1 );
|
||||
m_materials.m_SolderMask.SetNrReflectionsSamples( 2 );
|
||||
|
@ -463,11 +483,18 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
|
|||
break;
|
||||
|
||||
case B_SilkS:
|
||||
materialLayer = &m_materials.m_SilkS;
|
||||
|
||||
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
layerColor = m_settings.m_SilkScreenColorBot;
|
||||
else
|
||||
layerColor = m_settings.GetLayerColor( layer_id );
|
||||
break;
|
||||
case F_SilkS:
|
||||
materialLayer = &m_materials.m_SilkS;
|
||||
|
||||
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
layerColor = m_settings.m_SilkScreenColor;
|
||||
layerColor = m_settings.m_SilkScreenColorTop;
|
||||
else
|
||||
layerColor = m_settings.GetLayerColor( layer_id );
|
||||
break;
|
||||
|
@ -650,7 +677,11 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
|
|||
|
||||
SFVEC3F layerColor;
|
||||
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
layerColor = m_settings.m_SolderMaskColor;
|
||||
|
||||
if( layer_id == B_Mask )
|
||||
layerColor = m_settings.m_SolderMaskColorBot;
|
||||
else
|
||||
layerColor = m_settings.m_SolderMaskColorTop;
|
||||
else
|
||||
layerColor = m_settings.GetLayerColor( layer_id );
|
||||
|
||||
|
|
|
@ -308,6 +308,9 @@ void EDA_3D_VIEWER::CreateMenuBar()
|
|||
colorSubmenu->AddItem( ID_MENU3D_PCB_BODY_COLOR, _( "Board Body Color..." ), "",
|
||||
setcolor_board_body_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_STACKUP_COLORS, _( "Get colors from physical stackup" ), "",
|
||||
nullptr, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddMenu( colorSubmenu );
|
||||
|
||||
prefsMenu->AddCheckItem( ID_MENU3D_AXIS_ONOFF, _( "Show 3D &Axis" ), "",
|
||||
|
|
|
@ -24,19 +24,25 @@
|
|||
|
||||
#include "eda_3d_viewer.h"
|
||||
|
||||
|
||||
#include "../3d_viewer_id.h"
|
||||
#include "../common_ogl/cogl_att_list.h"
|
||||
#include <3d_actions.h>
|
||||
#include <bitmaps.h>
|
||||
#include <board_stackup_manager/class_board_stackup.h>
|
||||
#include <board_stackup_manager/stackup_predefined_prms.h>
|
||||
#include <class_board.h>
|
||||
#include <dpi_scaling.h>
|
||||
#include <gestfich.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/toolbar.h>
|
||||
|
||||
|
||||
|
@ -414,6 +420,11 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
Set3DBoardBodyColorFromUser();
|
||||
break;
|
||||
|
||||
case ID_MENU3D_STACKUP_COLORS:
|
||||
SynchroniseColoursWithBoard();
|
||||
NewDisplay( true );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_REALISTIC_MODE:
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
|
||||
NewDisplay( true );
|
||||
|
@ -705,20 +716,30 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
|
|||
aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
|
||||
aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
|
||||
|
||||
// m_SolderMaskColor default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
|
||||
// m_SolderMaskColorTop default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColorTop.r, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColorTop.g, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColorTop.b, 180.0 * 0.2 / 255.0 );
|
||||
|
||||
// m_SolderMaskColorBot default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColorBot.r, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColorBot.g, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColorBot.b, 180.0 * 0.2 / 255.0 );
|
||||
|
||||
// m_SolderPasteColor default value = light grey
|
||||
aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 / 255.0 );
|
||||
aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 / 255.0 );
|
||||
aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 / 255.0 );
|
||||
|
||||
// m_SilkScreenColor default value = white
|
||||
aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
|
||||
// m_SilkScreenColorTop default value = white
|
||||
aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColorTop.r, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColorTop.g, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColorTop.b, 0.9 );
|
||||
|
||||
// m_SilkScreenColorBot default value = white
|
||||
aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColorBot.r, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColorBot.g, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColorBot.b, 0.9 );
|
||||
|
||||
// m_CopperColor default value = gold
|
||||
aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
|
||||
|
@ -829,17 +850,25 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
|||
aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
|
||||
aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
|
||||
|
||||
aCfg->Write( keySMaskColor_Red, m_settings.m_SolderMaskColor.r );
|
||||
aCfg->Write( keySMaskColor_Green, m_settings.m_SolderMaskColor.g );
|
||||
aCfg->Write( keySMaskColor_Blue, m_settings.m_SolderMaskColor.b );
|
||||
aCfg->Write( keySMaskColor_Red, m_settings.m_SolderMaskColorTop.r );
|
||||
aCfg->Write( keySMaskColor_Green, m_settings.m_SolderMaskColorTop.g );
|
||||
aCfg->Write( keySMaskColor_Blue, m_settings.m_SolderMaskColorTop.b );
|
||||
|
||||
aCfg->Write( keySMaskColor_Red, m_settings.m_SolderMaskColorBot.r );
|
||||
aCfg->Write( keySMaskColor_Green, m_settings.m_SolderMaskColorBot.g );
|
||||
aCfg->Write( keySMaskColor_Blue, m_settings.m_SolderMaskColorBot.b );
|
||||
|
||||
aCfg->Write( keySPasteColor_Red, m_settings.m_SolderPasteColor.r );
|
||||
aCfg->Write( keySPasteColor_Green, m_settings.m_SolderPasteColor.g );
|
||||
aCfg->Write( keySPasteColor_Blue, m_settings.m_SolderPasteColor.b );
|
||||
|
||||
aCfg->Write( keySilkColor_Red, m_settings.m_SilkScreenColor.r );
|
||||
aCfg->Write( keySilkColor_Green, m_settings.m_SilkScreenColor.g );
|
||||
aCfg->Write( keySilkColor_Blue, m_settings.m_SilkScreenColor.b );
|
||||
aCfg->Write( keySilkColor_Red, m_settings.m_SilkScreenColorTop.r );
|
||||
aCfg->Write( keySilkColor_Green, m_settings.m_SilkScreenColorTop.g );
|
||||
aCfg->Write( keySilkColor_Blue, m_settings.m_SilkScreenColorTop.b );
|
||||
|
||||
aCfg->Write( keySilkColor_Red, m_settings.m_SilkScreenColorBot.r );
|
||||
aCfg->Write( keySilkColor_Green, m_settings.m_SilkScreenColorBot.g );
|
||||
aCfg->Write( keySilkColor_Blue, m_settings.m_SilkScreenColorBot.b );
|
||||
|
||||
aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
|
||||
aCfg->Write( keyCopperColor_Green, m_settings.m_CopperColor.g );
|
||||
|
@ -869,15 +898,18 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
|||
aCfg->Write( keyRenderRAY_Backfloor, m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
|
||||
aCfg->Write( keyRenderRAY_Refractions, m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
|
||||
aCfg->Write( keyRenderRAY_Reflections, m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
|
||||
aCfg->Write( keyRenderRAY_PostProcess, m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
aCfg->Write(
|
||||
keyRenderRAY_PostProcess, m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
aCfg->Write( keyRenderRAY_AAliasing, m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
|
||||
aCfg->Write( keyRenderRAY_ProceduralT, m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
aCfg->Write( keyRenderRAY_ProceduralT,
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
|
||||
aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
|
||||
aCfg->Write( keyShowGrid, (int) m_settings.GridGet() );
|
||||
|
||||
aCfg->Write( keyShowFootprints_Normal, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
|
||||
aCfg->Write( keyShowFootprints_Insert, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
|
||||
aCfg->Write(
|
||||
keyShowFootprints_Insert, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
|
||||
aCfg->Write( keyShowFootprints_Virtual, m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
|
||||
|
||||
aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
|
||||
|
@ -891,6 +923,67 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
|
|||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::SynchroniseColoursWithBoard( void )
|
||||
{
|
||||
BOARD* brd = GetBoard();
|
||||
const FAB_LAYER_COLOR* stdColors = GetColorStandardList();
|
||||
wxColour color;
|
||||
if( brd )
|
||||
{
|
||||
BOARD_STACKUP stckp = brd->GetDesignSettings().GetStackupDescriptor();
|
||||
|
||||
for( BOARD_STACKUP_ITEM* stckpItem : stckp.GetList() )
|
||||
{
|
||||
wxString colorName = stckpItem->GetColor();
|
||||
|
||||
if( colorName.StartsWith( "#" ) ) // This is a user defined color.
|
||||
{
|
||||
color.Set( colorName );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i = 0; i < GetColorStandardListCount(); i++ )
|
||||
{
|
||||
if( stdColors[i].m_ColorName == colorName )
|
||||
{
|
||||
color = stdColors[i].m_Color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( color.IsOk() )
|
||||
{
|
||||
switch( stckpItem->GetBrdLayerId() )
|
||||
{
|
||||
case F_SilkS:
|
||||
m_settings.m_SilkScreenColorTop.r = color.Red() / 255.0;
|
||||
m_settings.m_SilkScreenColorTop.g = color.Green() / 255.0;
|
||||
m_settings.m_SilkScreenColorTop.b = color.Blue() / 255.0;
|
||||
break;
|
||||
case B_SilkS:
|
||||
m_settings.m_SilkScreenColorBot.r = color.Red() / 255.0;
|
||||
m_settings.m_SilkScreenColorBot.g = color.Green() / 255.0;
|
||||
m_settings.m_SilkScreenColorBot.b = color.Blue() / 255.0;
|
||||
break;
|
||||
case F_Mask:
|
||||
m_settings.m_SolderMaskColorTop.r = color.Red() / 255.0;
|
||||
m_settings.m_SolderMaskColorTop.g = color.Green() / 255.0;
|
||||
m_settings.m_SolderMaskColorTop.b = color.Blue() / 255.0;
|
||||
break;
|
||||
case B_Mask:
|
||||
m_settings.m_SolderMaskColorBot.r = color.Red() / 255.0;
|
||||
m_settings.m_SolderMaskColorBot.g = color.Green() / 255.0;
|
||||
m_settings.m_SolderMaskColorBot.b = color.Blue() / 255.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
|
||||
|
@ -1037,8 +1130,9 @@ bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
|
|||
colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
|
||||
|
||||
if( Set3DColorFromUser( m_settings.m_SilkScreenColor, _( "Silkscreen Color" ), &colors ) )
|
||||
if( Set3DColorFromUser( m_settings.m_SilkScreenColorTop, _( "Silkscreen Color" ), &colors ) )
|
||||
{
|
||||
m_settings.m_SilkScreenColorBot = m_settings.m_SilkScreenColorTop;
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
@ -1066,8 +1160,9 @@ bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
|
|||
colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
|
||||
|
||||
if( Set3DColorFromUser( m_settings.m_SolderMaskColor, _( "Solder Mask Color" ), &colors ) )
|
||||
if( Set3DColorFromUser( m_settings.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors ) )
|
||||
{
|
||||
m_settings.m_SolderMaskColorBot = m_settings.m_SolderMaskColorTop;
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,9 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
*/
|
||||
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
|
||||
|
||||
|
||||
void SynchroniseColoursWithBoard( void );
|
||||
|
||||
private:
|
||||
/// Called when user press the File->Exit
|
||||
void Exit3DFrame( wxCommandEvent &event );
|
||||
|
|
|
@ -39,6 +39,7 @@ enum id_3dview_frm
|
|||
ID_MENU3D_SOLDERPASTE_COLOR,
|
||||
ID_MENU3D_PCB_BODY_COLOR,
|
||||
ID_MENU3D_COPPER_COLOR,
|
||||
ID_MENU3D_STACKUP_COLORS,
|
||||
ID_MENU3D_AXIS_ONOFF,
|
||||
|
||||
ID_MENU3D_MODULE_ONOFF,
|
||||
|
|
|
@ -29,6 +29,7 @@ set( CVPCB_DIALOGS
|
|||
set( CVPCB_SRCS
|
||||
../common/base_units.cpp
|
||||
../pcbnew/tools/grid_helper.cpp
|
||||
../pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
|
||||
auto_associate.cpp
|
||||
cfg.cpp
|
||||
components_listbox.cpp
|
||||
|
|
|
@ -38,6 +38,7 @@ add_executable(test_gal_pixel_alignment WIN32
|
|||
../../qa_utils/pcb_test_frame.cpp
|
||||
../../qa_utils/mocks.cpp
|
||||
../../../common/base_units.cpp
|
||||
../../../pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
|
||||
../../../pcbnew/tools/pcb_tool_base.cpp
|
||||
../../../pcbnew/tools/pcb_actions.cpp
|
||||
../../../pcbnew/tools/pcbnew_selection.cpp
|
||||
|
|
Loading…
Reference in New Issue