3D-Viewer: Parameterize soldermask transparency
This commit is contained in:
parent
6e72f609f0
commit
0302fe5570
|
@ -110,15 +110,15 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
|||
SetFlag( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE, false );
|
||||
SetFlag( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE, false );
|
||||
|
||||
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_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_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 );
|
||||
m_BgColorBot = SFVEC4F( 0.4, 0.4, 0.5, 1.0 );
|
||||
m_BgColorTop = SFVEC4F( 0.8, 0.8, 0.9, 1.0 );
|
||||
m_BoardBodyColor = SFVEC4F( 0.4, 0.4, 0.5, 1.0 );
|
||||
m_SolderMaskColorTop = SFVEC4F( 0.1, 0.2, 0.1, 0.17 );
|
||||
m_SolderMaskColorBot = SFVEC4F( 0.1, 0.2, 0.1, 0.17 );
|
||||
m_SolderPasteColor = SFVEC4F( 0.4, 0.4, 0.4, 1.0 );
|
||||
m_SilkScreenColorTop = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
|
||||
m_SilkScreenColorBot = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
|
||||
m_CopperColor = SFVEC4F( 0.75, 0.61, 0.23, 1.0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -464,23 +464,23 @@ float BOARD_ADAPTER::GetModulesZcoord3DIU( bool aIsFlipped ) const
|
|||
}
|
||||
|
||||
|
||||
SFVEC3F BOARD_ADAPTER::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
||||
SFVEC4F BOARD_ADAPTER::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
||||
{
|
||||
wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
|
||||
|
||||
const COLOR4D color = m_colors->GetColor( aLayerId );
|
||||
|
||||
return SFVEC3F( color.r, color.g, color.b );
|
||||
return SFVEC4F( color.r, color.g, color.b, color.a );
|
||||
}
|
||||
|
||||
|
||||
SFVEC3F BOARD_ADAPTER::GetItemColor( int aItemId ) const
|
||||
SFVEC4F BOARD_ADAPTER::GetItemColor( int aItemId ) const
|
||||
{
|
||||
return GetColor( m_colors->GetColor( aItemId ) );
|
||||
}
|
||||
|
||||
|
||||
SFVEC3F BOARD_ADAPTER::GetColor( COLOR4D aColor ) const
|
||||
SFVEC4F BOARD_ADAPTER::GetColor( COLOR4D aColor ) const
|
||||
{
|
||||
return SFVEC3F( aColor.r, aColor.g, aColor.b );
|
||||
return SFVEC4F( aColor.r, aColor.g, aColor.b, aColor.a );
|
||||
}
|
||||
|
|
|
@ -317,21 +317,21 @@ class BOARD_ADAPTER
|
|||
* @param aLayerId: the layer to get the color information
|
||||
* @return the color in SFVEC3F format
|
||||
*/
|
||||
SFVEC3F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
|
||||
SFVEC4F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
|
||||
|
||||
/**
|
||||
* @brief GetItemColor - get the technical color of a layer
|
||||
* @param aItemId: the item id to get the color information
|
||||
* @return the color in SFVEC3F format
|
||||
*/
|
||||
SFVEC3F GetItemColor( int aItemId ) const;
|
||||
SFVEC4F GetItemColor( int aItemId ) const;
|
||||
|
||||
/**
|
||||
* @brief GetColor
|
||||
* @param aColor: the color mapped
|
||||
* @return the color in SFVEC3F format
|
||||
*/
|
||||
SFVEC3F GetColor( COLOR4D aColor ) const;
|
||||
SFVEC4F GetColor( COLOR4D aColor ) const;
|
||||
|
||||
/**
|
||||
* @brief GetLayerTopZpos3DU - Get the top z position
|
||||
|
@ -636,15 +636,15 @@ class BOARD_ADAPTER
|
|||
SHAPE_POLY_SET& aCornerBuffer ) const;
|
||||
|
||||
public:
|
||||
SFVEC3D m_BgColorBot; ///< background bottom color
|
||||
SFVEC3D m_BgColorTop; ///< background top color
|
||||
SFVEC3D m_BoardBodyColor; ///< in realistic mode: FR4 board 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_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
||||
SFVEC3D m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
||||
SFVEC3D m_CopperColor; ///< in realistic mode: copper color
|
||||
SFVEC4F m_BgColorBot; ///< background bottom color
|
||||
SFVEC4F m_BgColorTop; ///< background top color
|
||||
SFVEC4F m_BoardBodyColor; ///< in realistic mode: FR4 board color
|
||||
SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
|
||||
SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
|
||||
SFVEC4F m_SolderPasteColor; ///< in realistic mode: solder paste color
|
||||
SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
||||
SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
||||
SFVEC4F m_CopperColor; ///< in realistic mode: copper color
|
||||
|
||||
// Raytracing light colors
|
||||
|
||||
|
|
|
@ -248,37 +248,8 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
|||
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_SolderMaskTop.m_Ambient = SFVEC3F(
|
||||
m_boardAdapter.m_SolderMaskColorTop.r * 0.3f,
|
||||
m_boardAdapter.m_SolderMaskColorTop.g * 0.3f,
|
||||
m_boardAdapter.m_SolderMaskColorTop.b * 0.3f );
|
||||
|
||||
m_materials.m_SolderMaskTop.m_Specular = SFVEC3F(
|
||||
m_boardAdapter.m_SolderMaskColorTop.r * m_boardAdapter.m_SolderMaskColorTop.r,
|
||||
m_boardAdapter.m_SolderMaskColorTop.g * m_boardAdapter.m_SolderMaskColorTop.g,
|
||||
m_boardAdapter.m_SolderMaskColorTop.b * m_boardAdapter.m_SolderMaskColorTop.b );
|
||||
|
||||
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_boardAdapter.m_SolderMaskColorBot.r * 0.3f,
|
||||
m_boardAdapter.m_SolderMaskColorBot.g * 0.3f,
|
||||
m_boardAdapter.m_SolderMaskColorBot.b * 0.3f );
|
||||
|
||||
m_materials.m_SolderMaskBot.m_Specular = SFVEC3F(
|
||||
m_boardAdapter.m_SolderMaskColorBot.r * m_boardAdapter.m_SolderMaskColorBot.r,
|
||||
m_boardAdapter.m_SolderMaskColorBot.g * m_boardAdapter.m_SolderMaskColorBot.g,
|
||||
m_boardAdapter.m_SolderMaskColorBot.b * m_boardAdapter.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 );
|
||||
|
||||
m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
|
||||
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Epoxy material
|
||||
m_materials.m_EpoxyBoard.m_Ambient = SFVEC3F( 117.0f / 255.0f,
|
||||
|
@ -325,18 +296,10 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
|||
m_materials.m_SilkSBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Solder mask material
|
||||
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 );
|
||||
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_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Epoxy material
|
||||
m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
|
||||
|
@ -359,14 +322,25 @@ 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, 1.0f );
|
||||
break;
|
||||
case F_Mask:
|
||||
m_materials.m_SolderMaskTop.m_Diffuse = get_layer_color( aLayerID );
|
||||
OGL_SetMaterial( m_materials.m_SolderMaskTop, 1.0f );
|
||||
case B_Mask:
|
||||
{
|
||||
const SFVEC4F layerColor = get_layer_color( aLayerID );
|
||||
|
||||
m_materials.m_SolderMask.m_Diffuse = layerColor;
|
||||
m_materials.m_SolderMask.m_Transparency = layerColor.a;
|
||||
|
||||
if( m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
{
|
||||
m_materials.m_SolderMask.m_Ambient = m_materials.m_SolderMask.m_Diffuse * 0.3f;
|
||||
|
||||
m_materials.m_SolderMask.m_Specular = m_materials.m_SolderMask.m_Diffuse *
|
||||
m_materials.m_SolderMask.m_Diffuse;
|
||||
}
|
||||
|
||||
OGL_SetMaterial( m_materials.m_SolderMask, 1.0f );
|
||||
break;
|
||||
}
|
||||
|
||||
case B_Paste:
|
||||
case F_Paste:
|
||||
|
@ -421,9 +395,9 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
|
|||
}
|
||||
|
||||
|
||||
SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color( PCB_LAYER_ID aLayerID )
|
||||
SFVEC4F C3D_RENDER_OGL_LEGACY::get_layer_color( PCB_LAYER_ID aLayerID )
|
||||
{
|
||||
SFVEC3F layerColor = m_boardAdapter.GetLayerColor( aLayerID );
|
||||
SFVEC4F layerColor = m_boardAdapter.GetLayerColor( aLayerID );
|
||||
|
||||
if( m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||
{
|
||||
|
|
|
@ -200,8 +200,7 @@ private:
|
|||
SMATERIAL m_Paste;
|
||||
SMATERIAL m_SilkSBot;
|
||||
SMATERIAL m_SilkSTop;
|
||||
SMATERIAL m_SolderMaskBot;
|
||||
SMATERIAL m_SolderMaskTop;
|
||||
SMATERIAL m_SolderMask;
|
||||
SMATERIAL m_EpoxyBoard;
|
||||
SMATERIAL m_Copper;
|
||||
SMATERIAL m_Plastic;
|
||||
|
@ -209,7 +208,7 @@ private:
|
|||
}m_materials;
|
||||
|
||||
void set_layer_material( PCB_LAYER_ID aLayerID );
|
||||
SFVEC3F get_layer_color( PCB_LAYER_ID aLayerID );
|
||||
SFVEC4F get_layer_color( PCB_LAYER_ID aLayerID );
|
||||
};
|
||||
|
||||
#endif // C3D_RENDER_OGL_LEGACY_H_
|
||||
|
|
|
@ -48,6 +48,25 @@
|
|||
#include <base_units.h>
|
||||
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
|
||||
/**
|
||||
* @brief TransparencyAlphaControl
|
||||
* Perform an interpolation step to easy control the transparency based on the
|
||||
* gray color value and alpha
|
||||
* @param aGrayColorValue - diffuse gray value
|
||||
* @param aAlpha - control
|
||||
* @return transparency to use in material
|
||||
*/
|
||||
static float TransparencyAlphaControl( float aGrayColorValue, float aAlpha )
|
||||
{
|
||||
const float aaa = aAlpha * aAlpha * aAlpha;
|
||||
|
||||
// 1.00-1.05*(1.0-x)^3
|
||||
float ca = 1.0f - aAlpha;
|
||||
ca = 1.00f - 1.05f * ca * ca * ca;
|
||||
|
||||
return glm::max( glm::min( aGrayColorValue * ca + aaa, 1.0f ), 0.0f );
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale convertion from 3d model units to pcb units
|
||||
*/
|
||||
|
@ -112,12 +131,14 @@ void C3D_RENDER_RAYTRACING::setupMaterials()
|
|||
0.0f, // transparency
|
||||
0.0f );
|
||||
|
||||
const float solderMaskTop_gray =
|
||||
// Assume that SolderMaskTop == SolderMaskBot
|
||||
const float solderMask_gray =
|
||||
( m_boardAdapter.m_SolderMaskColorTop.r + m_boardAdapter.m_SolderMaskColorTop.g
|
||||
+ m_boardAdapter.m_SolderMaskColorTop.b )
|
||||
/ 3.0f;
|
||||
|
||||
const float solderMaskTop_transparency = solderMaskTop_gray * 0.40f + 0.005f;
|
||||
const float solderMask_transparency = TransparencyAlphaControl( solderMask_gray,
|
||||
m_boardAdapter.m_SolderMaskColorTop.a );
|
||||
|
||||
m_materials.m_SolderMask = CBLINN_PHONG_MATERIAL(
|
||||
ConvertSRGBToLinear( (SFVEC3F) m_boardAdapter.m_SolderMaskColorTop ) * 0.10f, // ambient
|
||||
|
@ -126,30 +147,11 @@ void C3D_RENDER_RAYTRACING::setupMaterials()
|
|||
( ( SFVEC3F )( 1.0f )
|
||||
- ConvertSRGBToLinear( (SFVEC3F) m_boardAdapter.m_SolderMaskColorTop ) ),
|
||||
SFVEC3F( 0.0f ),
|
||||
SFVEC3F( solderMaskTop_gray * 2.0f ) ), // specular
|
||||
SFVEC3F( solderMask_gray * 2.0f ) ), // specular
|
||||
0.85f * 128.0f, // shiness
|
||||
solderMaskTop_transparency, // transparency
|
||||
solderMask_transparency, // transparency
|
||||
0.16f ); // reflection
|
||||
|
||||
const float solderMaskBot_gray =
|
||||
( m_boardAdapter.m_SolderMaskColorBot.r + m_boardAdapter.m_SolderMaskColorBot.g
|
||||
+ m_boardAdapter.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_boardAdapter.m_SolderMaskColorBot ) * 0.10f, // ambient
|
||||
SFVEC3F( 0.0f, 0.0f, 0.0f ), // emissive
|
||||
glm::clamp(
|
||||
( ( SFVEC3F )( 1.0f )
|
||||
- ConvertSRGBToLinear( (SFVEC3F) m_boardAdapter.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 );
|
||||
|
|
|
@ -456,11 +456,12 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
|||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
auto set_color =
|
||||
[] ( const COLOR4D& aColor, SFVEC3D& aTarget )
|
||||
[] ( const COLOR4D& aColor, SFVEC4F& aTarget )
|
||||
{
|
||||
aTarget.r = aColor.r;
|
||||
aTarget.g = aColor.g;
|
||||
aTarget.b = aColor.b;
|
||||
aTarget.a = aColor.a;
|
||||
};
|
||||
|
||||
set_color( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), m_boardAdapter.m_BgColorBot );
|
||||
|
@ -567,9 +568,9 @@ 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] ( SFVEC4F& aSource, LAYER_3D_ID aTarget )
|
||||
{
|
||||
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 ) );
|
||||
colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, aSource.a ) );
|
||||
};
|
||||
|
||||
save_color( m_boardAdapter.m_BgColorBot, LAYER_3D_BACKGROUND_BOTTOM );
|
||||
|
@ -703,11 +704,13 @@ void EDA_3D_VIEWER::SynchroniseColoursWithBoard()
|
|||
m_boardAdapter.m_SolderMaskColorTop.r = color.Red() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorTop.g = color.Green() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorTop.b = color.Blue() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorTop.a = color.Alpha() / 255.0;
|
||||
break;
|
||||
case B_Mask:
|
||||
m_boardAdapter.m_SolderMaskColorBot.r = color.Red() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorBot.g = color.Green() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorBot.b = color.Blue() / 255.0;
|
||||
m_boardAdapter.m_SolderMaskColorBot.a = color.Alpha() / 255.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -835,13 +838,14 @@ void EDA_3D_VIEWER::RenderEngineChanged()
|
|||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors )
|
||||
bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors,
|
||||
bool aAllowOpacityControl )
|
||||
{
|
||||
KIGFX::COLOR4D newcolor;
|
||||
KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
|
||||
KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 - aColor.a );
|
||||
|
||||
DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
|
||||
DIALOG_COLOR_PICKER picker( this, oldcolor, aAllowOpacityControl, aPredefinedColors );
|
||||
|
||||
if( picker.ShowModal() != wxID_OK )
|
||||
return false;
|
||||
|
@ -854,6 +858,7 @@ bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
|||
aColor.r = newcolor.r;
|
||||
aColor.g = newcolor.g;
|
||||
aColor.b = newcolor.b;
|
||||
aColor.a = 1.0 - newcolor.a;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -881,25 +886,30 @@ bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
|
|||
{
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, "Saturated Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, "Red Light Orange" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, "Green blue (dark)" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
|
||||
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" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, 1.0 - 0.17, "Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, 1.0 - 0.17, "Light Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, 1.0 - 0.17, "Saturated Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, 1.0 - 0.17, "Red" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, 1.0 - 0.17, "Red Light Orange" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, 1.0 - 0.17, "Red 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, 1.0 - 0.17, "Blue" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, 1.0 - 0.17, "Light blue 1" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, 1.0 - 0.17, "Light blue 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, 1.0 - 0.17, "Green blue (dark)" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, 1.0 - 0.17, "Black" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, 1.0 - 0.17, "White" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, 1.0 - 0.17, "Purple" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, 1.0 - 0.17, "Purple Dark" ) );
|
||||
|
||||
if( Set3DColorFromUser( m_boardAdapter.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors ) )
|
||||
if( Set3DColorFromUser( m_boardAdapter.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors, true ) )
|
||||
{
|
||||
m_boardAdapter.m_SolderMaskColorBot = m_boardAdapter.m_SolderMaskColorTop;
|
||||
|
||||
if( m_boardAdapter.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
NewDisplay( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,8 +113,9 @@ class EDA_3D_VIEWER : public EDA_3D_BOARD_HOLDER, public KIWAY_PLAYER
|
|||
* @param aPredefinedColors is a reference to a CUSTOM_COLOR_ITEM list which contains
|
||||
* a few predefined colors
|
||||
*/
|
||||
bool Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors );
|
||||
bool Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle,
|
||||
CUSTOM_COLORS_LIST* aPredefinedColors,
|
||||
bool aAllowOpacityControl = false );
|
||||
|
||||
/**
|
||||
* Set the solder mask color from a set of colors
|
||||
|
|
|
@ -47,6 +47,15 @@ struct CUSTOM_COLOR_ITEM
|
|||
m_ColorName = aName;
|
||||
}
|
||||
|
||||
CUSTOM_COLOR_ITEM( double red, double green, double blue, double alpha, const wxString& aName )
|
||||
{
|
||||
m_Color.r = red;
|
||||
m_Color.g = green;
|
||||
m_Color.b = blue;
|
||||
m_Color.a = alpha;
|
||||
m_ColorName = aName;
|
||||
}
|
||||
|
||||
CUSTOM_COLOR_ITEM( const KIGFX::COLOR4D& aColor, const wxString& aName )
|
||||
: m_Color( aColor ), m_ColorName( aName)
|
||||
{}
|
||||
|
|
|
@ -205,7 +205,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) :
|
|||
CLR( "3d_viewer.copper", LAYER_3D_COPPER, COLOR4D( 0.7, 0.61, 0.0, 1.0 ) );
|
||||
CLR( "3d_viewer.silkscreen_bottom", LAYER_3D_SILKSCREEN_BOTTOM, COLOR4D( 0.9, 0.9, 0.9, 1.0 ) );
|
||||
CLR( "3d_viewer.silkscreen_top", LAYER_3D_SILKSCREEN_TOP, COLOR4D( 0.9, 0.9, 0.9, 1.0 ) );
|
||||
CLR( "3d_viewer.soldermask", LAYER_3D_SOLDERMASK, COLOR4D( 0.08, 0.2, 0.14, 1.0 ) );
|
||||
CLR( "3d_viewer.soldermask", LAYER_3D_SOLDERMASK, COLOR4D( 0.08, 0.2, 0.14, 0.17 ) );
|
||||
CLR( "3d_viewer.solderpaste", LAYER_3D_SOLDERPASTE, COLOR4D( 0.5, 0.5, 0.5, 1.0 ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue