3d-viewer: Fix some issues and clean code.
This commit is contained in:
parent
fafd19c616
commit
d089ff5215
|
@ -143,6 +143,22 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* return true if we are in realistic mode render
|
||||
*/
|
||||
bool isRealisticMode() const;
|
||||
|
||||
/**
|
||||
* return true if aItem should be displayed
|
||||
* @param aItem = an item of DISPLAY3D_FLG enum
|
||||
*/
|
||||
bool isEnabled( DISPLAY3D_FLG aItem ) const;
|
||||
|
||||
/* Helper function
|
||||
* @return true if aLayer should be displayed, false otherwise
|
||||
*/
|
||||
bool is3DLayerEnabled( LAYER_ID aLayer ) const;
|
||||
|
||||
/**
|
||||
* Helper function SetGLTechLayersColor
|
||||
* Initialize the color to draw the non copper layers
|
||||
|
|
|
@ -53,11 +53,6 @@
|
|||
#include <trackball.h>
|
||||
#include <3d_draw_basic_functions.h>
|
||||
|
||||
/* Helper function
|
||||
* returns true if aLayer should be displayed, false otherwise
|
||||
*/
|
||||
static bool Is3DLayerEnabled( LAYER_ID aLayer );
|
||||
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
* B_Cu , B_Adhes, B_Paste ), B_SilkS
|
||||
|
@ -333,8 +328,8 @@ void EDA_3D_CANVAS::Redraw()
|
|||
|
||||
InitGL();
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && g_Parm_3D_Visu.IsRealisticMode() &&
|
||||
g_Parm_3D_Visu.GetFlag( FL_RENDER_SHADOWS ) )
|
||||
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||
isEnabled( FL_RENDER_SHADOWS ) )
|
||||
{
|
||||
GenerateFakeShadowsTextures();
|
||||
}
|
||||
|
@ -348,7 +343,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glClearDepth( 1.0 );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_SMOOTH ) )
|
||||
if( isEnabled( FL_RENDER_SMOOTH ) )
|
||||
{
|
||||
glShadeModel( GL_SMOOTH );
|
||||
}
|
||||
|
@ -450,7 +445,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||
CreateDrawGL_List();
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
|
||||
if( isEnabled( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
|
||||
glCallList( m_glLists[GL_ID_AXIS] );
|
||||
|
||||
// move the board in order to draw it with its center at 0,0 3D coordinates
|
||||
|
@ -461,7 +456,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
// draw all objects in lists
|
||||
// transparent objects should be drawn after opaque objects
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
||||
if( isEnabled( FL_MODULE ) )
|
||||
{
|
||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||
CreateDrawGL_List();
|
||||
|
@ -470,9 +465,9 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
|
||||
if( isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||
{
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_SOLDERMASK ) )
|
||||
if( isEnabled( FL_SOLDERMASK ) || !isRealisticMode() )
|
||||
{
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
@ -501,7 +496,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
if( isEnabled( FL_RENDER_TEXTURES ) && isRealisticMode() )
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
@ -522,7 +517,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glCallList( m_glLists[GL_ID_TECH_LAYERS] );
|
||||
}
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) || g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) )
|
||||
if( isEnabled( FL_COMMENTS ) || isEnabled( FL_COMMENTS ) )
|
||||
{
|
||||
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
||||
CreateDrawGL_List();
|
||||
|
@ -531,9 +526,8 @@ void EDA_3D_CANVAS::Redraw()
|
|||
}
|
||||
|
||||
// Draw Component Shadow
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) &&
|
||||
g_Parm_3D_Visu.IsRealisticMode() &&
|
||||
g_Parm_3D_Visu.GetFlag( FL_RENDER_SHADOWS ) )
|
||||
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||
isEnabled( FL_RENDER_SHADOWS ) )
|
||||
{
|
||||
glEnable( GL_CULL_FACE );
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
|
@ -575,7 +569,7 @@ void EDA_3D_CANVAS::Redraw()
|
|||
glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
||||
|
||||
// Draw Solid Shapes
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
||||
if( isEnabled( FL_MODULE ) )
|
||||
{
|
||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||
CreateDrawGL_List();
|
||||
|
@ -584,19 +578,18 @@ void EDA_3D_CANVAS::Redraw()
|
|||
}
|
||||
|
||||
// Grid uses transparency: draw it after all objects
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) && m_glLists[GL_ID_GRID] )
|
||||
if( isEnabled( FL_GRID ) && m_glLists[GL_ID_GRID] )
|
||||
glCallList( m_glLists[GL_ID_GRID] );
|
||||
|
||||
// This list must be drawn last, because it contains the
|
||||
// transparent gl objects, which should be drawn after all
|
||||
// non transparent objects
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] )
|
||||
if( isEnabled( FL_MODULE ) && m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] )
|
||||
glCallList( m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] );
|
||||
|
||||
// Draw Board Shadow
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) &&
|
||||
g_Parm_3D_Visu.IsRealisticMode() &&
|
||||
g_Parm_3D_Visu.GetFlag( FL_RENDER_SHADOWS ) )
|
||||
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||
isEnabled( FL_RENDER_SHADOWS ) )
|
||||
{
|
||||
if( m_glLists[GL_ID_SHADOW_BOARD] )
|
||||
{
|
||||
|
@ -696,9 +689,9 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
// If FL_RENDER_SHOW_HOLES_IN_ZONES is true, holes are correctly removed from copper zones areas.
|
||||
// If FL_RENDER_SHOW_HOLES_IN_ZONES is false, holes are not removed from copper zones areas,
|
||||
// but the calculation time is twice shorter.
|
||||
bool remove_Holes = g_Parm_3D_Visu.GetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||
bool remove_Holes = isEnabled( FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||
|
||||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
||||
bool realistic_mode = isRealisticMode();
|
||||
|
||||
// Number of segments to convert a circle to polygon
|
||||
// Boost polygon (at least v 1.54, v1.55 and previous) in very rare cases crashes
|
||||
|
@ -758,7 +751,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
|
||||
// Skip non enabled layers in normal mode,
|
||||
// and internal layers in realistic mode
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
if( !is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
bufferPolys.RemoveAllContours();
|
||||
|
@ -823,7 +816,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
}
|
||||
|
||||
// Draw copper zones
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
|
||||
if( isEnabled( FL_ZONE ) )
|
||||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
|
@ -903,7 +896,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
thickness,
|
||||
g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_USE_COPPER_THICKNESS ) == true )
|
||||
if( isEnabled( FL_USE_COPPER_THICKNESS ) == true )
|
||||
{
|
||||
thickness -= ( 0.04 * IU_PER_MM );
|
||||
}
|
||||
|
@ -917,7 +910,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
throughHolesListBuilt = true;
|
||||
}
|
||||
|
||||
if ( !g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
|
||||
if ( !isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||
{
|
||||
SetGLCopperColor();
|
||||
|
||||
|
@ -940,10 +933,10 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
|||
|
||||
glEndList();
|
||||
|
||||
|
||||
// Build the body board:
|
||||
glNewList( aBodyOnlyList, GL_COMPILE );
|
||||
|
||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
||||
if( isRealisticMode() )
|
||||
{
|
||||
SetGLEpoxyColor( 0.95 );
|
||||
}
|
||||
|
@ -1069,18 +1062,15 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
F_Mask,
|
||||
};
|
||||
|
||||
// User layers are not drawn here, only technical layers
|
||||
for( LSEQ seq = LSET::AllTechMask().Seq( teckLayerList, DIM( teckLayerList ) ); seq; ++seq )
|
||||
{
|
||||
LAYER_ID layer = *seq;
|
||||
|
||||
// Skip user layers, which are not drawn here
|
||||
// if( IsUserLayer( layer) )
|
||||
// continue;
|
||||
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
if( !is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
if( layer == Edge_Cuts && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
|
||||
if( layer == Edge_Cuts && isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||
continue;
|
||||
|
||||
bufferPolys.RemoveAllContours();
|
||||
|
@ -1132,7 +1122,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
|||
}
|
||||
|
||||
// Draw non copper zones
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
|
||||
if( isEnabled( FL_ZONE ) )
|
||||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
|
@ -1237,7 +1227,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
|
|||
{
|
||||
LAYER_ID layer = *aux;
|
||||
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
if( !is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
bufferPolys.RemoveAllContours();
|
||||
|
@ -1369,7 +1359,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
}
|
||||
|
||||
// draw modules 3D shapes
|
||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] && g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] && isEnabled( FL_MODULE ) )
|
||||
{
|
||||
m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] = glGenLists( 1 );
|
||||
|
||||
|
@ -1468,10 +1458,9 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
|
|||
}
|
||||
|
||||
|
||||
static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
||||
bool EDA_3D_CANVAS::is3DLayerEnabled( LAYER_ID aLayer ) const
|
||||
{
|
||||
DISPLAY3D_FLG flg;
|
||||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
||||
|
||||
// see if layer needs to be shown
|
||||
// check the flags
|
||||
|
@ -1499,7 +1488,7 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
|||
|
||||
case Dwgs_User:
|
||||
case Cmts_User:
|
||||
if( realistic_mode )
|
||||
if( isRealisticMode() )
|
||||
return false;
|
||||
|
||||
flg = FL_COMMENTS;
|
||||
|
@ -1507,7 +1496,7 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
|||
|
||||
case Eco1_User:
|
||||
case Eco2_User:
|
||||
if( realistic_mode )
|
||||
if( isRealisticMode() )
|
||||
return false;
|
||||
|
||||
flg = FL_ECO;
|
||||
|
@ -1516,20 +1505,20 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
|||
case B_Cu:
|
||||
case F_Cu:
|
||||
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
|
||||
|| realistic_mode;
|
||||
|| isRealisticMode();
|
||||
break;
|
||||
|
||||
default:
|
||||
// the layer is an internal copper layer, used the visibility
|
||||
//
|
||||
if( realistic_mode )
|
||||
if( isRealisticMode() )
|
||||
return false;
|
||||
|
||||
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer );
|
||||
}
|
||||
|
||||
// The layer has a flag, return the flag
|
||||
return g_Parm_3D_Visu.GetFlag( flg );
|
||||
return isEnabled( flg );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,19 @@
|
|||
|
||||
#define TEXTURE_PCB_SCALE 5.0
|
||||
|
||||
// return true if we are in realistic mode render
|
||||
bool EDA_3D_CANVAS::isRealisticMode() const
|
||||
{
|
||||
return g_Parm_3D_Visu.IsRealisticMode();
|
||||
}
|
||||
|
||||
// return true if aItem should be displayed
|
||||
bool EDA_3D_CANVAS::isEnabled( DISPLAY3D_FLG aItem ) const
|
||||
{
|
||||
return g_Parm_3D_Visu.GetFlag( aItem );
|
||||
}
|
||||
|
||||
|
||||
// Helper function: initialize the copper color to draw the board
|
||||
// in realistic mode.
|
||||
void EDA_3D_CANVAS::SetGLCopperColor()
|
||||
|
@ -58,9 +71,9 @@ void EDA_3D_CANVAS::SetGLCopperColor()
|
|||
void EDA_3D_CANVAS::SetGLEpoxyColor( double aTransparency )
|
||||
{
|
||||
// Generates an epoxy color, near board color
|
||||
glColor4f( 0.45 * 0.85 - (1.0 - g_Parm_3D_Visu.m_BoardColor.m_Red) * 0.32,
|
||||
0.39 * 0.85 - (1.0 - g_Parm_3D_Visu.m_BoardColor.m_Green) * 0.28,
|
||||
0.33 * 0.85 - (1.0 - g_Parm_3D_Visu.m_BoardColor.m_Blue) * 0.23,
|
||||
glColor4f( g_Parm_3D_Visu.m_BoardBodyColor.m_Red,
|
||||
g_Parm_3D_Visu.m_BoardBodyColor.m_Green,
|
||||
g_Parm_3D_Visu.m_BoardBodyColor.m_Blue,
|
||||
aTransparency );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
|
@ -74,9 +87,9 @@ void EDA_3D_CANVAS::SetGLEpoxyColor( double aTransparency )
|
|||
void EDA_3D_CANVAS::SetGLSolderMaskColor( double aTransparency )
|
||||
{
|
||||
// Generates a solder mask color
|
||||
glColor4f( g_Parm_3D_Visu.m_BoardColor.m_Red,
|
||||
g_Parm_3D_Visu.m_BoardColor.m_Green,
|
||||
g_Parm_3D_Visu.m_BoardColor.m_Blue,
|
||||
glColor4f( g_Parm_3D_Visu.m_SolderMaskColor.m_Red,
|
||||
g_Parm_3D_Visu.m_SolderMaskColor.m_Green,
|
||||
g_Parm_3D_Visu.m_SolderMaskColor.m_Blue,
|
||||
aTransparency );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
|
@ -91,7 +104,7 @@ void EDA_3D_CANVAS::SetGLTechLayersColor( LAYER_NUM aLayer )
|
|||
{
|
||||
EDA_COLOR_T color;
|
||||
|
||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
||||
if( isRealisticMode() )
|
||||
{
|
||||
switch( aLayer )
|
||||
{
|
||||
|
@ -102,26 +115,15 @@ void EDA_3D_CANVAS::SetGLTechLayersColor( LAYER_NUM aLayer )
|
|||
|
||||
case B_SilkS:
|
||||
case F_SilkS:
|
||||
glColor4f( g_Parm_3D_Visu.m_SilkScreenColor.m_Red,
|
||||
g_Parm_3D_Visu.m_SilkScreenColor.m_Green,
|
||||
g_Parm_3D_Visu.m_SilkScreenColor.m_Blue, 0.96 );
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
// http://en.wikipedia.org/wiki/Luminance_(relative)
|
||||
double luminance = g_Parm_3D_Visu.m_BoardColor.m_Red * 0.2126 +
|
||||
g_Parm_3D_Visu.m_BoardColor.m_Green * 0.7152 +
|
||||
g_Parm_3D_Visu.m_BoardColor.m_Blue * 0.0722;
|
||||
|
||||
if( luminance < 0.5 )
|
||||
{
|
||||
glColor4f( 0.9, 0.9, 0.9, 0.96 );
|
||||
}
|
||||
else
|
||||
{
|
||||
glColor4f( 0.1, 0.1, 0.1, 0.96 );
|
||||
}
|
||||
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
SetGLTexture( m_text_silk, 10.0f );
|
||||
}
|
||||
SetGLTexture( m_text_silk, 10.0f );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case B_Mask:
|
||||
|
@ -319,7 +321,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
|
|||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu ) -
|
||||
g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
|
||||
|
||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
||||
if( isRealisticMode() )
|
||||
SetGLCopperColor();
|
||||
else
|
||||
SetGLColor( DARKGRAY );
|
||||
|
@ -371,7 +373,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
|
|||
aVia->LayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
// Drawing via hole:
|
||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
||||
if( isRealisticMode() )
|
||||
SetGLCopperColor();
|
||||
else
|
||||
{
|
||||
|
|
|
@ -50,14 +50,6 @@ static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
|
|||
static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
|
||||
static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
|
||||
|
||||
static const wxChar keyBoardColor_Red[] = wxT( "BoardColor_Red" );
|
||||
static const wxChar keyBoardColor_Green[] = wxT( "BoardColor_Green" );
|
||||
static const wxChar keyBoardColor_Blue[] = wxT( "BoardColor_Blue" );
|
||||
|
||||
static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
|
||||
static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
|
||||
static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
|
||||
|
||||
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||
static const wxChar keyRenderShadows[] = wxT( "Render_Shadows" );
|
||||
static const wxChar keyRenderRemoveHoles[] = wxT( "Render_RemoveHoles" );
|
||||
|
@ -242,14 +234,6 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
aCfg->Read( keyBgColor_Green_Top, &g_Parm_3D_Visu.m_BgColor_Top.m_Green, 0.8 );
|
||||
aCfg->Read( keyBgColor_Blue_Top, &g_Parm_3D_Visu.m_BgColor_Top.m_Blue, 0.9 );
|
||||
|
||||
aCfg->Read( keyBoardColor_Red, &g_Parm_3D_Visu.m_BoardColor.m_Red, 0.0 );
|
||||
aCfg->Read( keyBoardColor_Green, &g_Parm_3D_Visu.m_BoardColor.m_Green, 0.5 );
|
||||
aCfg->Read( keyBoardColor_Blue, &g_Parm_3D_Visu.m_BoardColor.m_Blue, 0.0 );
|
||||
|
||||
aCfg->Read( keyCopperColor_Red, &g_Parm_3D_Visu.m_CopperColor.m_Red, 0.8 );
|
||||
aCfg->Read( keyCopperColor_Green, &g_Parm_3D_Visu.m_CopperColor.m_Green, 0.75 );
|
||||
aCfg->Read( keyCopperColor_Blue, &g_Parm_3D_Visu.m_CopperColor.m_Blue, 0.0 );
|
||||
|
||||
bool tmp;
|
||||
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
|
@ -323,14 +307,6 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
aCfg->Write( keyBgColor_Green_Top, g_Parm_3D_Visu.m_BgColor_Top.m_Green );
|
||||
aCfg->Write( keyBgColor_Blue_Top, g_Parm_3D_Visu.m_BgColor_Top.m_Blue );
|
||||
|
||||
aCfg->Write( keyBoardColor_Red, g_Parm_3D_Visu.m_BoardColor.m_Red );
|
||||
aCfg->Write( keyBoardColor_Green, g_Parm_3D_Visu.m_BoardColor.m_Green );
|
||||
aCfg->Write( keyBoardColor_Blue, g_Parm_3D_Visu.m_BoardColor.m_Blue );
|
||||
|
||||
aCfg->Write( keyCopperColor_Red, g_Parm_3D_Visu.m_CopperColor.m_Red );
|
||||
aCfg->Write( keyCopperColor_Green, g_Parm_3D_Visu.m_CopperColor.m_Green );
|
||||
aCfg->Write( keyCopperColor_Blue, g_Parm_3D_Visu.m_CopperColor.m_Blue );
|
||||
|
||||
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
|
||||
aCfg->Write( keyRenderShadows, prms.GetFlag( FL_RENDER_SHADOWS ) );
|
||||
|
@ -491,21 +467,6 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
Set3DBgColor( g_Parm_3D_Visu.m_BgColor_Top );
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BOARDCOLOR_SELECTION:
|
||||
if( Set3DBgColor( g_Parm_3D_Visu.m_BoardColor ) == true )
|
||||
{
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
NewDisplay(GL_ID_BOARD);
|
||||
}
|
||||
return;
|
||||
|
||||
case ID_MENU3D_COPPERCOLOR_SELECTION:
|
||||
if( Set3DBgColor( g_Parm_3D_Visu.m_CopperColor ) == true )
|
||||
{
|
||||
NewDisplay(GL_ID_BOARD);
|
||||
}
|
||||
return;
|
||||
|
||||
case ID_MENU3D_REALISTIC_MODE:
|
||||
g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
|
||||
NewDisplay();
|
||||
|
|
|
@ -195,16 +195,7 @@ void EDA_3D_FRAME::CreateMenuBar()
|
|||
_( "Background Top Color" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
AddMenuItem( backgrounColorMenu, ID_MENU3D_BGCOLOR_SELECTION,
|
||||
_( "Background Botton Color" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
backgrounColorMenu->AppendSeparator();
|
||||
|
||||
AddMenuItem( backgrounColorMenu, ID_MENU3D_BOARDCOLOR_SELECTION,
|
||||
_( "Board Mask Color" ), KiBitmap( pads_mask_layers_xpm ) );
|
||||
|
||||
AddMenuItem( backgrounColorMenu, ID_MENU3D_COPPERCOLOR_SELECTION,
|
||||
_( "Copper Color" ), KiBitmap( use_3D_copper_thickness_xpm ) );
|
||||
//
|
||||
_( "Background Bottom Color" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
|
||||
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
|
||||
|
|
|
@ -33,8 +33,6 @@ enum id_3dview_frm
|
|||
ID_MENU3D_COLOR,
|
||||
ID_MENU3D_BGCOLOR_SELECTION,
|
||||
ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||
ID_MENU3D_BOARDCOLOR_SELECTION,
|
||||
ID_MENU3D_COPPERCOLOR_SELECTION,
|
||||
ID_MENU3D_USE_COPPER_THICKNESS,
|
||||
ID_MENU3D_AXIS_ONOFF,
|
||||
ID_MENU3D_MODULE_ONOFF,
|
||||
|
|
|
@ -66,6 +66,33 @@ INFO3D_VISU::INFO3D_VISU()
|
|||
m_epoxyThickness = 0;
|
||||
m_nonCopperLayerThickness = 0;
|
||||
|
||||
// Set copper color, in realistic mode
|
||||
#define LUMINANCE 0.7/255.0
|
||||
m_CopperColor.m_Red = 255.0*LUMINANCE;
|
||||
m_CopperColor.m_Green = 223.0*LUMINANCE;
|
||||
m_CopperColor.m_Blue = 0.0*LUMINANCE;
|
||||
|
||||
// Set the solder mask color, in realistic mode
|
||||
#undef LUMINANCE
|
||||
#define LUMINANCE 0.2/255.0
|
||||
m_SolderMaskColor.m_Red = 100.0*LUMINANCE;
|
||||
m_SolderMaskColor.m_Green = 255.0*LUMINANCE;
|
||||
m_SolderMaskColor.m_Blue = 180.0*LUMINANCE;
|
||||
|
||||
// Set the silk screen mask color, in realistic mode
|
||||
#undef LUMINANCE
|
||||
#define LUMINANCE 0.9
|
||||
m_SilkScreenColor.m_Red = 1.0*LUMINANCE;
|
||||
m_SilkScreenColor.m_Green = 1.0*LUMINANCE;
|
||||
m_SilkScreenColor.m_Blue = 1.0*LUMINANCE;
|
||||
|
||||
// Set the body board (FR4) color, in realistic mode
|
||||
#undef LUMINANCE
|
||||
#define LUMINANCE 0.2/255.0
|
||||
m_BoardBodyColor.m_Red = 255.0*LUMINANCE;
|
||||
m_BoardBodyColor.m_Green = 218.0*LUMINANCE;
|
||||
m_BoardBodyColor.m_Blue = 110.0*LUMINANCE;
|
||||
|
||||
// default all special item layers Visible
|
||||
for( ii = 0; ii < FL_LAST; ii++ )
|
||||
m_drawFlags[ii] = true;
|
||||
|
|
|
@ -89,8 +89,10 @@ public:
|
|||
double m_3D_Grid; // 3D grid value, in mm
|
||||
S3D_COLOR m_BgColor;
|
||||
S3D_COLOR m_BgColor_Top;
|
||||
S3D_COLOR m_BoardColor;
|
||||
S3D_COLOR m_CopperColor;
|
||||
S3D_COLOR m_BoardBodyColor; // in realistic mode: FR4 board color
|
||||
S3D_COLOR m_SolderMaskColor; // in realistic mode: solder mask color
|
||||
S3D_COLOR m_SilkScreenColor; // in realistic mode: SilkScreen color
|
||||
S3D_COLOR m_CopperColor; // in realistic mode: copper color
|
||||
wxPoint m_BoardPos; // center board actual position in board units
|
||||
wxSize m_BoardSize; // board actual size in board units
|
||||
int m_CopperLayersCount; // Number of copper layers actually used by the board
|
||||
|
|
Loading…
Reference in New Issue