All: Fix an issue due to duplicate ID used in menus and toolbars between a frame and its parents, related to wxUpdateUIEvent events loop.
wxUpdateUIEvent events are be sent to parent frames, when opening a menu in a child frame, if a child frame and its parents share same ID for menuitems (or tools) The wrong menuitem can be used in some cases ( because there are more than one menuitem with the same identifier), by a wxUpdateUIEvent event function executed in a parent frame. 3D viewer: Add patch from Mario Luzeiro, fix some issues, and clean code.
This commit is contained in:
commit
259425a21a
|
@ -520,8 +520,8 @@ GLuint load_and_generate_texture( tsImage *image )
|
||||||
|
|
||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
|
|
||||||
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
return texture;
|
return texture;
|
||||||
|
@ -547,7 +547,7 @@ void EDA_3D_CANVAS::InitGL()
|
||||||
glEnable( GL_ALPHA_TEST );
|
glEnable( GL_ALPHA_TEST );
|
||||||
glEnable( GL_LINE_SMOOTH );
|
glEnable( GL_LINE_SMOOTH );
|
||||||
// glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards
|
// glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards
|
||||||
glShadeModel( GL_SMOOTH );
|
glEnable( GL_NORMALIZE );
|
||||||
glEnable( GL_COLOR_MATERIAL );
|
glEnable( GL_COLOR_MATERIAL );
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ void EDA_3D_CANVAS::SetLights()
|
||||||
{
|
{
|
||||||
/* set viewing projection */
|
/* set viewing projection */
|
||||||
GLfloat Z_axis_pos[4] = { 0.0, 0.0, 30.0, 0.0 };
|
GLfloat Z_axis_pos[4] = { 0.0, 0.0, 30.0, 0.0 };
|
||||||
GLfloat lowZ_axis_pos[4] = { 0.0, 0.0, -30.0, 0.5 };
|
// GLfloat lowZ_axis_pos[4] = { 0.0, 0.0, -30.0, 0.5 };
|
||||||
|
|
||||||
// activate lights. 2 lights are used:
|
// activate lights. 2 lights are used:
|
||||||
// One is above the xy plane, the other is below the xy plane
|
// One is above the xy plane, the other is below the xy plane
|
||||||
|
@ -577,14 +577,21 @@ void EDA_3D_CANVAS::SetLights()
|
||||||
light_color[3] = 1.0;
|
light_color[3] = 1.0;
|
||||||
|
|
||||||
// Light above the xy plane
|
// Light above the xy plane
|
||||||
// The default setting for GL_AMBIENT light intensity is (0.0, 0.0, 0.0, 1.0)
|
light_color[0] = light_color[1] = light_color[2] = 0.1;
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, Z_axis_pos );
|
glLightfv( GL_LIGHT0, GL_AMBIENT, light_color );
|
||||||
|
|
||||||
light_color[0] = light_color[1] = light_color[2] = 1.0;
|
light_color[0] = light_color[1] = light_color[2] = 1.0;
|
||||||
glLightfv( GL_LIGHT0, GL_DIFFUSE, light_color );
|
glLightfv( GL_LIGHT0, GL_DIFFUSE, light_color );
|
||||||
|
|
||||||
light_color[0] = light_color[1] = light_color[2] = 0.2;
|
light_color[0] = light_color[1] = light_color[2] = 1.0;
|
||||||
glLightfv( GL_LIGHT0, GL_SPECULAR, light_color );
|
glLightfv( GL_LIGHT0, GL_SPECULAR, light_color );
|
||||||
|
|
||||||
|
glLightfv( GL_LIGHT0, GL_POSITION, Z_axis_pos );
|
||||||
|
|
||||||
|
light_color[0] = light_color[1] = light_color[2] = 0.1;
|
||||||
|
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, light_color );
|
||||||
|
|
||||||
|
/*
|
||||||
// Light below the xy plane
|
// Light below the xy plane
|
||||||
glLightfv( GL_LIGHT1, GL_POSITION, lowZ_axis_pos );
|
glLightfv( GL_LIGHT1, GL_POSITION, lowZ_axis_pos );
|
||||||
light_color[0] = light_color[1] = light_color[2] = 0.4;
|
light_color[0] = light_color[1] = light_color[2] = 0.4;
|
||||||
|
@ -592,9 +599,9 @@ void EDA_3D_CANVAS::SetLights()
|
||||||
|
|
||||||
light_color[0] = light_color[1] = light_color[2] = 0.1;
|
light_color[0] = light_color[1] = light_color[2] = 0.1;
|
||||||
glLightfv( GL_LIGHT1, GL_SPECULAR, light_color );
|
glLightfv( GL_LIGHT1, GL_SPECULAR, light_color );
|
||||||
|
*/
|
||||||
glEnable( GL_LIGHT0 ); // White spot on Z axis ( top )
|
glEnable( GL_LIGHT0 ); // White spot on Z axis ( top )
|
||||||
// glEnable( GL_LIGHT1 ); // White spot on Z axis ( bottom )
|
glDisable( GL_LIGHT1 ); // White spot on Z axis ( bottom )
|
||||||
glEnable( GL_LIGHTING );
|
glEnable( GL_LIGHTING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,22 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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
|
* Helper function SetGLTechLayersColor
|
||||||
* Initialize the color to draw the non copper layers
|
* Initialize the color to draw the non copper layers
|
||||||
|
|
|
@ -53,11 +53,6 @@
|
||||||
#include <trackball.h>
|
#include <trackball.h>
|
||||||
#include <3d_draw_basic_functions.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
|
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||||
* Z orientation is 1.0 for all layers but "back" layers:
|
* Z orientation is 1.0 for all layers but "back" layers:
|
||||||
* B_Cu , B_Adhes, B_Paste ), B_SilkS
|
* B_Cu , B_Adhes, B_Paste ), B_SilkS
|
||||||
|
@ -109,8 +104,8 @@ static void blur_tex( GLuint aTex, int aPasses, GLuint aTexture_size )
|
||||||
|
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
glBindTexture( GL_TEXTURE_2D, aTex );
|
glBindTexture( GL_TEXTURE_2D, aTex );
|
||||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||||
|
|
||||||
while (aPasses > 0)
|
while (aPasses > 0)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +167,7 @@ void EDA_3D_CANVAS::Create_and_Render_Shadow_Buffer( GLuint *aDst_gl_texture,
|
||||||
{
|
{
|
||||||
if( m_glLists[GL_ID_BODY] )
|
if( m_glLists[GL_ID_BODY] )
|
||||||
{
|
{
|
||||||
glCallList( m_glLists[GL_ID_BOARD] );
|
glCallList( m_glLists[GL_ID_BODY] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +306,7 @@ void EDA_3D_CANVAS::GenerateFakeShadowsTextures()
|
||||||
glTranslatef( 0, 0, -0.4f );
|
glTranslatef( 0, 0, -0.4f );
|
||||||
glRotatef( 180.0, 0.0, 1.0, 0.0 );
|
glRotatef( 180.0, 0.0, 1.0, 0.0 );
|
||||||
|
|
||||||
Create_and_Render_Shadow_Buffer( &m_text_fake_shadow_board, 512, true, 10 );
|
Create_and_Render_Shadow_Buffer( &m_text_fake_shadow_board, 512, true, 20 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,8 +328,8 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
InitGL();
|
InitGL();
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && g_Parm_3D_Visu.IsRealisticMode() &&
|
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||||
g_Parm_3D_Visu.HightQualityMode() )
|
isEnabled( FL_RENDER_SHADOWS ) )
|
||||||
{
|
{
|
||||||
GenerateFakeShadowsTextures();
|
GenerateFakeShadowsTextures();
|
||||||
}
|
}
|
||||||
|
@ -348,6 +343,15 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
glClearDepth( 1.0 );
|
glClearDepth( 1.0 );
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||||
|
|
||||||
|
if( isEnabled( FL_RENDER_SMOOTH ) )
|
||||||
|
{
|
||||||
|
glShadeModel( GL_SMOOTH );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glShadeModel( GL_FLAT );
|
||||||
|
}
|
||||||
|
|
||||||
// Draw background
|
// Draw background
|
||||||
glMatrixMode( GL_PROJECTION );
|
glMatrixMode( GL_PROJECTION );
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
@ -362,24 +366,22 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
// Draw the background ( rectangle with color gradient)
|
// Draw the background ( rectangle with color gradient)
|
||||||
glBegin( GL_QUADS );
|
glBegin( GL_QUADS );
|
||||||
#define BGCOLOR1(x) (x)
|
glColor4f( g_Parm_3D_Visu.m_BgColor_Top.m_Red,
|
||||||
#define BGCOLOR2(x) (x * 0.3)
|
g_Parm_3D_Visu.m_BgColor_Top.m_Green,
|
||||||
glColor4f( BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Red ),
|
g_Parm_3D_Visu.m_BgColor_Top.m_Blue,
|
||||||
BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Green ),
|
|
||||||
BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Blue ),
|
|
||||||
1.0 );
|
1.0 );
|
||||||
glVertex2f( -1.0, 1.0 ); // Top left corner
|
glVertex2f( -1.0, 1.0 ); // Top left corner
|
||||||
|
|
||||||
glColor4f( BGCOLOR2( g_Parm_3D_Visu.m_BgColor.m_Red ),
|
glColor4f( g_Parm_3D_Visu.m_BgColor.m_Red,
|
||||||
BGCOLOR2( g_Parm_3D_Visu.m_BgColor.m_Green ),
|
g_Parm_3D_Visu.m_BgColor.m_Green,
|
||||||
BGCOLOR2( g_Parm_3D_Visu.m_BgColor.m_Blue ),
|
g_Parm_3D_Visu.m_BgColor.m_Blue,
|
||||||
1.0 );
|
1.0 );
|
||||||
glVertex2f( -1.0,-1.0 ); // bottom left corner
|
glVertex2f( -1.0,-1.0 ); // bottom left corner
|
||||||
glVertex2f( 1.0,-1.0 ); // bottom right corner
|
glVertex2f( 1.0,-1.0 ); // bottom right corner
|
||||||
|
|
||||||
glColor4f( BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Red ),
|
glColor4f( g_Parm_3D_Visu.m_BgColor_Top.m_Red,
|
||||||
BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Green ),
|
g_Parm_3D_Visu.m_BgColor_Top.m_Green,
|
||||||
BGCOLOR1( g_Parm_3D_Visu.m_BgColor.m_Blue ),
|
g_Parm_3D_Visu.m_BgColor_Top.m_Blue,
|
||||||
1.0 );
|
1.0 );
|
||||||
glVertex2f( 1.0, 1.0 ); // top right corner
|
glVertex2f( 1.0, 1.0 ); // top right corner
|
||||||
|
|
||||||
|
@ -403,7 +405,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
|
|
||||||
// Initialize Projection Matrix for Ortographic View
|
// Initialize Projection Matrix for Ortographic View
|
||||||
glOrtho( -size.x / orthoReductionFactor, size.x / orthoReductionFactor,
|
glOrtho( -size.x / orthoReductionFactor, size.x / orthoReductionFactor,
|
||||||
-size.y / orthoReductionFactor, size.y / orthoReductionFactor, 1, 10 );
|
-size.y / orthoReductionFactor, size.y / orthoReductionFactor, 1, 100 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -411,7 +413,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
double ratio_HV = (double) size.x / size.y;
|
double ratio_HV = (double) size.x / size.y;
|
||||||
|
|
||||||
// Initialize Projection Matrix for Perspective View
|
// Initialize Projection Matrix for Perspective View
|
||||||
gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 );
|
gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// position viewer
|
// position viewer
|
||||||
|
@ -443,7 +445,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
|
||||||
CreateDrawGL_List();
|
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] );
|
glCallList( m_glLists[GL_ID_AXIS] );
|
||||||
|
|
||||||
// move the board in order to draw it with its center at 0,0 3D coordinates
|
// move the board in order to draw it with its center at 0,0 3D coordinates
|
||||||
|
@ -454,29 +456,68 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
// draw all objects in lists
|
// draw all objects in lists
|
||||||
// transparent objects should be drawn after opaque objects
|
// 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] )
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||||
CreateDrawGL_List();
|
CreateDrawGL_List();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glEnable( GL_BLEND );
|
||||||
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
if( isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||||
glEnable( GL_COLOR_MATERIAL );
|
{
|
||||||
SetOpenGlDefaultMaterial();
|
if( isEnabled( FL_SOLDERMASK ) || !isRealisticMode() )
|
||||||
glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
{
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
|
|
||||||
|
glDisable( GL_LIGHTING );
|
||||||
|
|
||||||
|
if( m_glLists[GL_ID_BODY] )
|
||||||
|
{
|
||||||
|
glCallList( m_glLists[GL_ID_BODY] );
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable( GL_LIGHTING );
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable( GL_COLOR_MATERIAL );
|
||||||
|
SetOpenGlDefaultMaterial();
|
||||||
|
glm::vec4 specular( g_Parm_3D_Visu.m_CopperColor.m_Red * 0.3,
|
||||||
|
g_Parm_3D_Visu.m_CopperColor.m_Green * 0.3,
|
||||||
|
g_Parm_3D_Visu.m_CopperColor.m_Blue * 0.3, 1.0 );
|
||||||
|
GLint shininess_value = 8;
|
||||||
|
|
||||||
|
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
||||||
|
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||||
|
|
||||||
|
if( isEnabled( FL_RENDER_TEXTURES ) && isRealisticMode() )
|
||||||
|
{
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_glLists[GL_ID_BOARD] )
|
if( m_glLists[GL_ID_BOARD] )
|
||||||
{
|
{
|
||||||
glCallList( m_glLists[GL_ID_BOARD] );
|
glCallList( m_glLists[GL_ID_BOARD] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetOpenGlDefaultMaterial();
|
||||||
|
|
||||||
if( m_glLists[GL_ID_TECH_LAYERS] )
|
if( m_glLists[GL_ID_TECH_LAYERS] )
|
||||||
{
|
{
|
||||||
glCallList( m_glLists[GL_ID_TECH_LAYERS] );
|
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] )
|
if( ! m_glLists[GL_ID_AUX_LAYERS] )
|
||||||
CreateDrawGL_List();
|
CreateDrawGL_List();
|
||||||
|
@ -485,7 +526,8 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw Component Shadow
|
// Draw Component Shadow
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.HightQualityMode() )
|
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||||
|
isEnabled( FL_RENDER_SHADOWS ) )
|
||||||
{
|
{
|
||||||
glEnable( GL_CULL_FACE );
|
glEnable( GL_CULL_FACE );
|
||||||
glDisable( GL_DEPTH_TEST );
|
glDisable( GL_DEPTH_TEST );
|
||||||
|
@ -527,7 +569,7 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
||||||
|
|
||||||
// Draw Solid Shapes
|
// Draw Solid Shapes
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
|
if( isEnabled( FL_MODULE ) )
|
||||||
{
|
{
|
||||||
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
if( ! m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] )
|
||||||
CreateDrawGL_List();
|
CreateDrawGL_List();
|
||||||
|
@ -536,17 +578,18 @@ void EDA_3D_CANVAS::Redraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grid uses transparency: draw it after all objects
|
// 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] );
|
glCallList( m_glLists[GL_ID_GRID] );
|
||||||
|
|
||||||
// This list must be drawn last, because it contains the
|
// This list must be drawn last, because it contains the
|
||||||
// transparent gl objects, which should be drawn after all
|
// transparent gl objects, which should be drawn after all
|
||||||
// non transparent objects
|
// 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] );
|
glCallList( m_glLists[GL_ID_3DSHAPES_TRANSP_FRONT] );
|
||||||
|
|
||||||
// Draw Board Shadow
|
// Draw Board Shadow
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.HightQualityMode() )
|
if( isEnabled( FL_MODULE ) && isRealisticMode() &&
|
||||||
|
isEnabled( FL_RENDER_SHADOWS ) )
|
||||||
{
|
{
|
||||||
if( m_glLists[GL_ID_SHADOW_BOARD] )
|
if( m_glLists[GL_ID_SHADOW_BOARD] )
|
||||||
{
|
{
|
||||||
|
@ -643,12 +686,12 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
{
|
{
|
||||||
BOARD* pcb = GetBoard();
|
BOARD* pcb = GetBoard();
|
||||||
|
|
||||||
// If hightQualityMode is true, holes are correctly removed from copper zones areas.
|
// If FL_RENDER_SHOW_HOLES_IN_ZONES is true, holes are correctly removed from copper zones areas.
|
||||||
// If hightQualityMode is false, holes are not 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.
|
// but the calculation time is twice shorter.
|
||||||
bool hightQualityMode = g_Parm_3D_Visu.HightQualityMode();
|
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
|
// 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
|
// Boost polygon (at least v 1.54, v1.55 and previous) in very rare cases crashes
|
||||||
|
@ -708,7 +751,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
|
|
||||||
// Skip non enabled layers in normal mode,
|
// Skip non enabled layers in normal mode,
|
||||||
// and internal layers in realistic mode
|
// and internal layers in realistic mode
|
||||||
if( !Is3DLayerEnabled( layer ) )
|
if( !is3DLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
|
@ -773,7 +816,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw copper zones
|
// Draw copper zones
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
|
if( isEnabled( FL_ZONE ) )
|
||||||
{
|
{
|
||||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -783,7 +826,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
if( zonelayer == layer )
|
if( zonelayer == layer )
|
||||||
{
|
{
|
||||||
zone->TransformSolidAreasShapesToPolygonSet(
|
zone->TransformSolidAreasShapesToPolygonSet(
|
||||||
hightQualityMode ? bufferPolys : bufferZonesPolys,
|
remove_Holes ? bufferPolys : bufferZonesPolys,
|
||||||
segcountLowQuality, correctionFactorLQ );
|
segcountLowQuality, correctionFactorLQ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -853,6 +896,13 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
thickness,
|
thickness,
|
||||||
g_Parm_3D_Visu.m_BiuTo3Dunits );
|
g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
|
|
||||||
|
if( isEnabled( FL_USE_COPPER_THICKNESS ) == true )
|
||||||
|
{
|
||||||
|
thickness -= ( 0.04 * IU_PER_MM );
|
||||||
|
}
|
||||||
|
|
||||||
|
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||||
|
|
||||||
if( bufferZonesPolys.GetCornersCount() )
|
if( bufferZonesPolys.GetCornersCount() )
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
|
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
|
||||||
thickness,
|
thickness,
|
||||||
|
@ -860,7 +910,7 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
throughHolesListBuilt = true;
|
throughHolesListBuilt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
|
if ( !isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||||
{
|
{
|
||||||
SetGLCopperColor();
|
SetGLCopperColor();
|
||||||
|
|
||||||
|
@ -881,13 +931,14 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
glEndList();
|
||||||
|
|
||||||
|
// Build the body board:
|
||||||
|
glNewList( aBodyOnlyList, GL_COMPILE );
|
||||||
|
|
||||||
|
if( isRealisticMode() )
|
||||||
{
|
{
|
||||||
SetGLEpoxyColor( 1.0 );
|
SetGLEpoxyColor( 0.95 );
|
||||||
if( g_Parm_3D_Visu.HightQualityMode() )
|
|
||||||
{
|
|
||||||
SetGLTexture( m_text_pcb, 35.0f );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -927,27 +978,10 @@ void EDA_3D_CANVAS::BuildBoard3DView(GLuint aBoardList, GLuint aBodyOnlyList)
|
||||||
bufferPcbOutlines.RemoveAllContours();
|
bufferPcbOutlines.RemoveAllContours();
|
||||||
bufferPcbOutlines.ImportFrom( currLayerPolyset );
|
bufferPcbOutlines.ImportFrom( currLayerPolyset );
|
||||||
|
|
||||||
// Draw board substrate:
|
|
||||||
if( bufferPcbOutlines.GetCornersCount() &&
|
|
||||||
( g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) ) )
|
|
||||||
{
|
|
||||||
|
|
||||||
// for Draw3D_SolidHorizontalPolyPolygons, zpos it the middle between bottom and top
|
|
||||||
// sides
|
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2.0,
|
|
||||||
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
|
||||||
}
|
|
||||||
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
|
|
||||||
glNewList( aBodyOnlyList, GL_COMPILE );
|
|
||||||
|
|
||||||
if( bufferPcbOutlines.GetCornersCount() )
|
if( bufferPcbOutlines.GetCornersCount() )
|
||||||
{
|
{
|
||||||
glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
|
||||||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2.0,
|
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2.0,
|
||||||
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||||
}
|
}
|
||||||
|
|
||||||
glEndList();
|
glEndList();
|
||||||
|
@ -1017,7 +1051,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
||||||
KI_POLYGON_SET brdpolysetHoles;
|
KI_POLYGON_SET brdpolysetHoles;
|
||||||
allLayerHoles.ExportTo( brdpolysetHoles );
|
allLayerHoles.ExportTo( brdpolysetHoles );
|
||||||
|
|
||||||
static const LAYER_ID sequence[] = {
|
static const LAYER_ID teckLayerList[] = {
|
||||||
B_Adhes,
|
B_Adhes,
|
||||||
F_Adhes,
|
F_Adhes,
|
||||||
B_Paste,
|
B_Paste,
|
||||||
|
@ -1028,18 +1062,15 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
||||||
F_Mask,
|
F_Mask,
|
||||||
};
|
};
|
||||||
|
|
||||||
for( LSEQ seq = pcb->GetEnabledLayers().Seq( sequence, DIM( sequence ) ); seq; ++seq )
|
// User layers are not drawn here, only technical layers
|
||||||
|
for( LSEQ seq = LSET::AllTechMask().Seq( teckLayerList, DIM( teckLayerList ) ); seq; ++seq )
|
||||||
{
|
{
|
||||||
LAYER_ID layer = *seq;
|
LAYER_ID layer = *seq;
|
||||||
|
|
||||||
// Skip user layers, which are not drawn here
|
if( !is3DLayerEnabled( layer ) )
|
||||||
if( IsUserLayer( layer) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !Is3DLayerEnabled( layer ) )
|
if( layer == Edge_Cuts && isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||||
continue;
|
|
||||||
|
|
||||||
if( layer == Edge_Cuts && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
|
@ -1091,7 +1122,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw non copper zones
|
// Draw non copper zones
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
|
if( isEnabled( FL_ZONE ) )
|
||||||
{
|
{
|
||||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1227,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
|
||||||
{
|
{
|
||||||
LAYER_ID layer = *aux;
|
LAYER_ID layer = *aux;
|
||||||
|
|
||||||
if( !Is3DLayerEnabled( layer ) )
|
if( !is3DLayerEnabled( layer ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bufferPolys.RemoveAllContours();
|
bufferPolys.RemoveAllContours();
|
||||||
|
@ -1328,7 +1359,7 @@ void EDA_3D_CANVAS::CreateDrawGL_List()
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw modules 3D shapes
|
// 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 );
|
m_glLists[GL_ID_3DSHAPES_SOLID_FRONT] = glGenLists( 1 );
|
||||||
|
|
||||||
|
@ -1427,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;
|
DISPLAY3D_FLG flg;
|
||||||
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
|
|
||||||
|
|
||||||
// see if layer needs to be shown
|
// see if layer needs to be shown
|
||||||
// check the flags
|
// check the flags
|
||||||
|
@ -1458,7 +1488,7 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
||||||
|
|
||||||
case Dwgs_User:
|
case Dwgs_User:
|
||||||
case Cmts_User:
|
case Cmts_User:
|
||||||
if( realistic_mode )
|
if( isRealisticMode() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
flg = FL_COMMENTS;
|
flg = FL_COMMENTS;
|
||||||
|
@ -1466,7 +1496,7 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
||||||
|
|
||||||
case Eco1_User:
|
case Eco1_User:
|
||||||
case Eco2_User:
|
case Eco2_User:
|
||||||
if( realistic_mode )
|
if( isRealisticMode() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
flg = FL_ECO;
|
flg = FL_ECO;
|
||||||
|
@ -1475,20 +1505,20 @@ static bool Is3DLayerEnabled( LAYER_ID aLayer )
|
||||||
case B_Cu:
|
case B_Cu:
|
||||||
case F_Cu:
|
case F_Cu:
|
||||||
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
|
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
|
||||||
|| realistic_mode;
|
|| isRealisticMode();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// the layer is an internal copper layer
|
// the layer is an internal copper layer, used the visibility
|
||||||
if( realistic_mode )
|
//
|
||||||
|
if( isRealisticMode() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer );
|
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the layer has a flag, return the flag
|
// The layer has a flag, return the flag
|
||||||
return g_Parm_3D_Visu.GetFlag( flg ) &&
|
return isEnabled( flg );
|
||||||
g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,7 @@ void CALLBACK tessCPolyPt2Vertex( const GLvoid* data )
|
||||||
// cast back to double type
|
// cast back to double type
|
||||||
const CPolyPt* ptr = (const CPolyPt*) data;
|
const CPolyPt* ptr = (const CPolyPt*) data;
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.HightQualityMode() )
|
if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) )
|
||||||
{
|
{
|
||||||
glTexCoord2f( ptr->x* g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale,
|
glTexCoord2f( ptr->x* g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale,
|
||||||
-ptr->y * g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale);
|
-ptr->y * g_Parm_3D_Visu.m_BiuTo3Dunits * m_texture_scale);
|
||||||
|
|
|
@ -40,16 +40,30 @@
|
||||||
#include <info3d_visu.h>
|
#include <info3d_visu.h>
|
||||||
#include <3d_draw_basic_functions.h>
|
#include <3d_draw_basic_functions.h>
|
||||||
|
|
||||||
|
#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
|
// Helper function: initialize the copper color to draw the board
|
||||||
// in realistic mode.
|
// in realistic mode.
|
||||||
void EDA_3D_CANVAS::SetGLCopperColor()
|
void EDA_3D_CANVAS::SetGLCopperColor()
|
||||||
{
|
{
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
glColor4f( g_Parm_3D_Visu.m_CopperColor.m_Red,
|
||||||
// Generates a golden yellow color, near board "copper" color
|
g_Parm_3D_Visu.m_CopperColor.m_Green,
|
||||||
const double lum = 0.7/255.0;
|
g_Parm_3D_Visu.m_CopperColor.m_Blue,
|
||||||
glColor4f( 255.0*lum, 223.0*lum, 0.0*lum, 1.0 );
|
1.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function: initialize the color to draw the epoxy
|
// Helper function: initialize the color to draw the epoxy
|
||||||
|
@ -57,8 +71,15 @@ void EDA_3D_CANVAS::SetGLCopperColor()
|
||||||
void EDA_3D_CANVAS::SetGLEpoxyColor( double aTransparency )
|
void EDA_3D_CANVAS::SetGLEpoxyColor( double aTransparency )
|
||||||
{
|
{
|
||||||
// Generates an epoxy color, near board color
|
// Generates an epoxy color, near board color
|
||||||
const double lum = 0.2/255.0;
|
glColor4f( g_Parm_3D_Visu.m_BoardBodyColor.m_Red,
|
||||||
glColor4f( 255.0*lum, 218.0*lum, 110.0*lum, aTransparency );
|
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 ) )
|
||||||
|
{
|
||||||
|
SetGLTexture( m_text_pcb, TEXTURE_PCB_SCALE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function: initialize the color to draw the
|
// Helper function: initialize the color to draw the
|
||||||
|
@ -66,8 +87,15 @@ void EDA_3D_CANVAS::SetGLEpoxyColor( double aTransparency )
|
||||||
void EDA_3D_CANVAS::SetGLSolderMaskColor( double aTransparency )
|
void EDA_3D_CANVAS::SetGLSolderMaskColor( double aTransparency )
|
||||||
{
|
{
|
||||||
// Generates a solder mask color
|
// Generates a solder mask color
|
||||||
const double lum = 0.2/255.0;
|
glColor4f( g_Parm_3D_Visu.m_SolderMaskColor.m_Red,
|
||||||
glColor4f( 100.0*lum, 255.0*lum, 180.0*lum, aTransparency );
|
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 ) )
|
||||||
|
{
|
||||||
|
SetGLTexture( m_text_pcb, TEXTURE_PCB_SCALE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function: initialize the color to draw the non copper layers
|
// Helper function: initialize the color to draw the non copper layers
|
||||||
|
@ -76,7 +104,7 @@ void EDA_3D_CANVAS::SetGLTechLayersColor( LAYER_NUM aLayer )
|
||||||
{
|
{
|
||||||
EDA_COLOR_T color;
|
EDA_COLOR_T color;
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
if( isRealisticMode() )
|
||||||
{
|
{
|
||||||
switch( aLayer )
|
switch( aLayer )
|
||||||
{
|
{
|
||||||
|
@ -87,20 +115,20 @@ void EDA_3D_CANVAS::SetGLTechLayersColor( LAYER_NUM aLayer )
|
||||||
|
|
||||||
case B_SilkS:
|
case B_SilkS:
|
||||||
case F_SilkS:
|
case F_SilkS:
|
||||||
SetGLColor( LIGHTGRAY, 0.9 );
|
glColor4f( g_Parm_3D_Visu.m_SilkScreenColor.m_Red,
|
||||||
if( g_Parm_3D_Visu.HightQualityMode() )
|
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 ) )
|
||||||
{
|
{
|
||||||
SetGLTexture( m_text_silk, 50.0f );
|
SetGLTexture( m_text_silk, 10.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_Mask:
|
case B_Mask:
|
||||||
case F_Mask:
|
case F_Mask:
|
||||||
SetGLSolderMaskColor( 0.7 );
|
SetGLSolderMaskColor( 0.90 );
|
||||||
if( g_Parm_3D_Visu.HightQualityMode() )
|
|
||||||
{
|
|
||||||
SetGLTexture( m_text_pcb, 35.0f );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -293,7 +321,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
|
||||||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu ) -
|
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu ) -
|
||||||
g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
|
g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
|
||||||
|
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
if( isRealisticMode() )
|
||||||
SetGLCopperColor();
|
SetGLCopperColor();
|
||||||
else
|
else
|
||||||
SetGLColor( DARKGRAY );
|
SetGLColor( DARKGRAY );
|
||||||
|
@ -345,7 +373,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
|
||||||
aVia->LayerPair( &top_layer, &bottom_layer );
|
aVia->LayerPair( &top_layer, &bottom_layer );
|
||||||
|
|
||||||
// Drawing via hole:
|
// Drawing via hole:
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() )
|
if( isRealisticMode() )
|
||||||
SetGLCopperColor();
|
SetGLCopperColor();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,8 +45,18 @@ INFO3D_VISU g_Parm_3D_Visu;
|
||||||
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
||||||
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
||||||
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
||||||
|
|
||||||
|
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 keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||||
static const wxChar keyUseHQinRealisticMode[] = wxT( "UseHQinRealisticMode" );
|
static const wxChar keyRenderShadows[] = wxT( "Render_Shadows" );
|
||||||
|
static const wxChar keyRenderRemoveHoles[] = wxT( "Render_RemoveHoles" );
|
||||||
|
static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
|
||||||
|
static const wxChar keyRenderSmooth[] = wxT( "Render_Smooth" );
|
||||||
|
static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
|
||||||
|
|
||||||
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
||||||
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
||||||
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
|
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
|
||||||
|
@ -216,16 +226,32 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||||
|
|
||||||
aCfg->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
aCfg->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.4 );
|
||||||
aCfg->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
aCfg->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.4 );
|
||||||
aCfg->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
aCfg->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.5 );
|
||||||
|
|
||||||
|
aCfg->Read( keyBgColor_Red_Top, &g_Parm_3D_Visu.m_BgColor_Top.m_Red, 0.8 );
|
||||||
|
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 );
|
||||||
|
|
||||||
bool tmp;
|
bool tmp;
|
||||||
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
||||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||||
|
|
||||||
aCfg->Read( keyUseHQinRealisticMode, &tmp, false );
|
aCfg->Read( keyRenderShadows, &tmp, false );
|
||||||
prms.SetFlag( FL_USE_MAXQUALITY_IN_REALISTIC_MODE, tmp );
|
prms.SetFlag( FL_RENDER_SHADOWS, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( keyRenderRemoveHoles, &tmp, false );
|
||||||
|
prms.SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( keyRenderTextures, &tmp, false );
|
||||||
|
prms.SetFlag( FL_RENDER_TEXTURES, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( keyRenderSmooth, &tmp, false );
|
||||||
|
prms.SetFlag( FL_RENDER_SMOOTH, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( keyRenderMaterial, &tmp, false );
|
||||||
|
prms.SetFlag( FL_RENDER_MATERIAL, tmp );
|
||||||
|
|
||||||
aCfg->Read( keyShowAxis, &tmp, true );
|
aCfg->Read( keyShowAxis, &tmp, true );
|
||||||
prms.SetFlag( FL_AXIS, tmp );
|
prms.SetFlag( FL_AXIS, tmp );
|
||||||
|
@ -234,7 +260,6 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
prms.SetFlag( FL_GRID, tmp );
|
prms.SetFlag( FL_GRID, tmp );
|
||||||
|
|
||||||
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
|
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
|
||||||
prms.SetFlag( FL_MODULE, tmp );
|
|
||||||
|
|
||||||
aCfg->Read( keyShowFootprints, &tmp, true );
|
aCfg->Read( keyShowFootprints, &tmp, true );
|
||||||
prms.SetFlag( FL_MODULE, tmp );
|
prms.SetFlag( FL_MODULE, tmp );
|
||||||
|
@ -277,21 +302,32 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
aCfg->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
aCfg->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||||
aCfg->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
aCfg->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||||
aCfg->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
aCfg->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||||
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
|
||||||
aCfg->Write( keyUseHQinRealisticMode, prms.GetFlag( FL_USE_MAXQUALITY_IN_REALISTIC_MODE ) );
|
aCfg->Write( keyBgColor_Red_Top, g_Parm_3D_Visu.m_BgColor_Top.m_Red );
|
||||||
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
aCfg->Write( keyBgColor_Green_Top, g_Parm_3D_Visu.m_BgColor_Top.m_Green );
|
||||||
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
|
aCfg->Write( keyBgColor_Blue_Top, g_Parm_3D_Visu.m_BgColor_Top.m_Blue );
|
||||||
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
|
|
||||||
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||||
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
|
||||||
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
aCfg->Write( keyRenderShadows, prms.GetFlag( FL_RENDER_SHADOWS ) );
|
||||||
aCfg->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
aCfg->Write( keyRenderRemoveHoles, prms.GetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES ) );
|
||||||
aCfg->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
aCfg->Write( keyRenderTextures, prms.GetFlag( FL_RENDER_TEXTURES ) );
|
||||||
aCfg->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
aCfg->Write( keyRenderSmooth, prms.GetFlag( FL_RENDER_SMOOTH ) );
|
||||||
aCfg->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
aCfg->Write( keyRenderMaterial, prms.GetFlag( FL_RENDER_MATERIAL ) );
|
||||||
aCfg->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
|
||||||
aCfg->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||||
aCfg->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
|
||||||
|
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
|
||||||
|
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||||
|
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||||
|
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||||
|
aCfg->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||||
|
aCfg->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||||
|
aCfg->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||||
|
aCfg->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||||
|
aCfg->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||||
|
aCfg->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||||
|
aCfg->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,7 +460,11 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MENU3D_BGCOLOR_SELECTION:
|
case ID_MENU3D_BGCOLOR_SELECTION:
|
||||||
Set3DBgColor();
|
Set3DBgColor( g_Parm_3D_Visu.m_BgColor );
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ID_MENU3D_BGCOLOR_TOP_SELECTION:
|
||||||
|
Set3DBgColor( g_Parm_3D_Visu.m_BgColor_Top );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_REALISTIC_MODE:
|
case ID_MENU3D_REALISTIC_MODE:
|
||||||
|
@ -432,8 +472,29 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
NewDisplay();
|
NewDisplay();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_MAX_QUALITY_FOR_REALISTIC_MODE:
|
case ID_MENU3D_FL_RENDER_SHADOWS:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_USE_MAXQUALITY_IN_REALISTIC_MODE, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_RENDER_SHADOWS, isChecked );
|
||||||
|
NewDisplay();
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES:
|
||||||
|
g_Parm_3D_Visu.SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, isChecked );
|
||||||
|
NewDisplay();
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ID_MENU3D_FL_RENDER_TEXTURES:
|
||||||
|
g_Parm_3D_Visu.SetFlag( FL_RENDER_TEXTURES, isChecked );
|
||||||
|
NewDisplay(GL_ID_BOARD);
|
||||||
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ID_MENU3D_FL_RENDER_SMOOTH:
|
||||||
|
g_Parm_3D_Visu.SetFlag( FL_RENDER_SMOOTH, isChecked );
|
||||||
|
NewDisplay();
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ID_MENU3D_FL_RENDER_MATERIAL:
|
||||||
|
g_Parm_3D_Visu.SetFlag( FL_RENDER_MATERIAL, isChecked );
|
||||||
NewDisplay();
|
NewDisplay();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -455,6 +516,7 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_MENU3D_USE_COPPER_THICKNESS:
|
case ID_MENU3D_USE_COPPER_THICKNESS:
|
||||||
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
||||||
NewDisplay(GL_ID_BOARD);
|
NewDisplay(GL_ID_BOARD);
|
||||||
|
NewDisplay(GL_ID_TECH_LAYERS);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ID_MENU3D_ZONE_ONOFF:
|
case ID_MENU3D_ZONE_ONOFF:
|
||||||
|
@ -506,7 +568,7 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
for( int ii = ID_MENU3D_GRID; ii < ID_MENU3D_GRID_END; ii++ )
|
for( int ii = ID_MENU3D_GRID_NOGRID; ii < ID_MENU3D_GRID_END; ii++ )
|
||||||
{
|
{
|
||||||
if( event.GetId() == ii )
|
if( event.GetId() == ii )
|
||||||
continue;
|
continue;
|
||||||
|
@ -574,27 +636,27 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
|
|
||||||
/* called to set the background color of the 3D scene
|
/* called to set the background color of the 3D scene
|
||||||
*/
|
*/
|
||||||
void EDA_3D_FRAME::Set3DBgColor()
|
bool EDA_3D_FRAME::Set3DBgColor( S3D_COLOR &color )
|
||||||
{
|
{
|
||||||
S3D_COLOR color;
|
|
||||||
wxColour newcolor, oldcolor;
|
wxColour newcolor, oldcolor;
|
||||||
|
|
||||||
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
oldcolor.Set( KiROUND( color.m_Red * 255 ),
|
||||||
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
KiROUND( color.m_Green * 255 ),
|
||||||
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
|
KiROUND( color.m_Blue * 255 ) );
|
||||||
|
|
||||||
newcolor = wxGetColourFromUser( this, oldcolor );
|
newcolor = wxGetColourFromUser( this, oldcolor );
|
||||||
|
|
||||||
if( !newcolor.IsOk() ) // Cancel command
|
if( !newcolor.IsOk() ) // Cancel command
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if( newcolor != oldcolor )
|
if( newcolor != oldcolor )
|
||||||
{
|
{
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
color.m_Red = (double) newcolor.Red() / 255.0;
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0;
|
color.m_Green = (double) newcolor.Green() / 255.0;
|
||||||
g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0;
|
color.m_Blue = (double) newcolor.Blue() / 255.0;
|
||||||
m_canvas->Redraw();
|
m_canvas->Redraw();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOARD* EDA_3D_FRAME::GetBoard()
|
BOARD* EDA_3D_FRAME::GetBoard()
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <3d_struct.h>
|
#include <3d_struct.h>
|
||||||
#include <3d_material.h>
|
#include <3d_material.h>
|
||||||
|
#include <info3d_visu.h>
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
# ifdef __DARWIN__
|
# ifdef __DARWIN__
|
||||||
|
@ -54,17 +55,18 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
||||||
|
|
||||||
void SetOpenGlDefaultMaterial()
|
void SetOpenGlDefaultMaterial()
|
||||||
{
|
{
|
||||||
glm::vec4 ambient( 0.15, 0.15, 0.15, 1.0 );
|
glm::vec4 ambient( 0.2, 0.2, 0.2, 1.0 );
|
||||||
glm::vec4 specular( 0.1, 0.1, 0.1, 1.0 );
|
glm::vec4 specular( 0.0, 0.0, 0.0, 1.0 );
|
||||||
glm::vec4 emissive( 0.1, 0.1, 0.1, 1.0 );
|
glm::vec4 emissive( 0.0, 0.0, 0.0, 1.0 );
|
||||||
GLint shininess_value = 80;
|
glm::vec4 diffuse( 0.0, 0.0, 0.0, 1.0 );
|
||||||
|
GLint shininess_value = 0;
|
||||||
|
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
//glColor4f( 1.0, 1.0, 1.0, 1.0 );
|
|
||||||
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
||||||
|
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.x );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,61 +78,73 @@ void S3D_MATERIAL::SetOpenGLMaterial( unsigned int materialIndex )
|
||||||
if( ! s3dParent->IsOpenGlAllowed() )
|
if( ! s3dParent->IsOpenGlAllowed() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float transparency_value = 0.0f;
|
if( g_Parm_3D_Visu.GetFlag( FL_RENDER_MATERIAL ) )
|
||||||
if( m_Transparency.size() > materialIndex )
|
|
||||||
{
|
{
|
||||||
transparency_value = m_Transparency[materialIndex];
|
float transparency_value = 0.0f;
|
||||||
s3dParent->SetLastTransparency( transparency_value );
|
if( m_Transparency.size() > materialIndex )
|
||||||
}
|
|
||||||
|
|
||||||
if( m_DiffuseColor.size() > materialIndex )
|
|
||||||
{
|
|
||||||
glm::vec3 color = m_DiffuseColor[materialIndex];
|
|
||||||
|
|
||||||
if( m_AmbientColor.size() == 0 )
|
|
||||||
{
|
{
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
transparency_value = m_Transparency[materialIndex];
|
||||||
|
s3dParent->SetLastTransparency( transparency_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
glColor4f( color.x, color.y, color.z, 1.0 - transparency_value );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_Shininess.size() > materialIndex )
|
if( m_DiffuseColor.size() > materialIndex )
|
||||||
{
|
{
|
||||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, m_Shininess[materialIndex] );
|
glm::vec3 color = m_DiffuseColor[materialIndex];
|
||||||
}
|
|
||||||
|
|
||||||
// emissive
|
if( m_AmbientColor.size() == 0 )
|
||||||
if( m_EmissiveColor.size() > materialIndex )
|
{
|
||||||
{
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
glm::vec4 emissive;
|
}
|
||||||
emissive[0] = m_EmissiveColor[materialIndex].x;
|
|
||||||
emissive[1] = m_EmissiveColor[materialIndex].y;
|
glColor4f( color.x, color.y, color.z, 1.0 - transparency_value );
|
||||||
emissive[2] = m_EmissiveColor[materialIndex].z;
|
}
|
||||||
emissive[3] = 1.0f;
|
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
|
||||||
}
|
|
||||||
|
|
||||||
// specular
|
if( m_Shininess.size() > materialIndex )
|
||||||
if( m_SpecularColor.size() > materialIndex )
|
{
|
||||||
{
|
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, m_Shininess[materialIndex] );
|
||||||
glm::vec4 specular;
|
}
|
||||||
specular[0] = m_SpecularColor[materialIndex].x;
|
|
||||||
specular[1] = m_SpecularColor[materialIndex].y;
|
|
||||||
specular[2] = m_SpecularColor[materialIndex].z;
|
|
||||||
specular[3] = 1.0f;
|
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ambient
|
// emissive
|
||||||
if( m_AmbientColor.size() > materialIndex )
|
if( m_EmissiveColor.size() > materialIndex )
|
||||||
|
{
|
||||||
|
glm::vec4 emissive;
|
||||||
|
emissive[0] = m_EmissiveColor[materialIndex].x;
|
||||||
|
emissive[1] = m_EmissiveColor[materialIndex].y;
|
||||||
|
emissive[2] = m_EmissiveColor[materialIndex].z;
|
||||||
|
emissive[3] = 1.0f;
|
||||||
|
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
// specular
|
||||||
|
if( m_SpecularColor.size() > materialIndex )
|
||||||
|
{
|
||||||
|
glm::vec4 specular;
|
||||||
|
specular[0] = m_SpecularColor[materialIndex].x;
|
||||||
|
specular[1] = m_SpecularColor[materialIndex].y;
|
||||||
|
specular[2] = m_SpecularColor[materialIndex].z;
|
||||||
|
specular[3] = 1.0f;
|
||||||
|
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ambient
|
||||||
|
if( m_AmbientColor.size() > materialIndex )
|
||||||
|
{
|
||||||
|
glm::vec4 ambient;
|
||||||
|
ambient[0] = m_AmbientColor[materialIndex].x;
|
||||||
|
ambient[1] = m_AmbientColor[materialIndex].y;
|
||||||
|
ambient[2] = m_AmbientColor[materialIndex].z;
|
||||||
|
ambient[3] = 1.0f;
|
||||||
|
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
glm::vec4 ambient;
|
if( m_DiffuseColor.size() > materialIndex )
|
||||||
ambient[0] = m_AmbientColor[materialIndex].x;
|
{
|
||||||
ambient[1] = m_AmbientColor[materialIndex].y;
|
glm::vec3 color = m_DiffuseColor[materialIndex];
|
||||||
ambient[2] = m_AmbientColor[materialIndex].z;
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
ambient[3] = 1.0f;
|
glColor4f( color.x, color.y, color.z, 1.0 );
|
||||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ void S3D_MESH::openGL_Render()
|
||||||
|
|
||||||
if( m_PerVertexNormalsNormalized.size() == 0 )
|
if( m_PerVertexNormalsNormalized.size() == 0 )
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.HightQualityMode() )
|
if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.GetFlag( FL_RENDER_SMOOTH ) )
|
||||||
{
|
{
|
||||||
calcPerPointNormals();
|
calcPerPointNormals();
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ void S3D_MESH::openGL_Render()
|
||||||
glm::vec3 point = m_Point[m_CoordIndex[idx][ii]];
|
glm::vec3 point = m_Point[m_CoordIndex[idx][ii]];
|
||||||
glVertex3fv( &point.x );
|
glVertex3fv( &point.x );
|
||||||
}
|
}
|
||||||
} else if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.HightQualityMode() )
|
} else if( g_Parm_3D_Visu.IsRealisticMode() && g_Parm_3D_Visu.GetFlag( FL_RENDER_SMOOTH ) )
|
||||||
{
|
{
|
||||||
std::vector< glm::vec3 > normals_list;
|
std::vector< glm::vec3 > normals_list;
|
||||||
normals_list = m_PerFaceVertexNormals[idx];
|
normals_list = m_PerFaceVertexNormals[idx];
|
||||||
|
|
|
@ -156,16 +156,46 @@ void EDA_3D_FRAME::CreateMenuBar()
|
||||||
_( "Realistic Mode" ),
|
_( "Realistic Mode" ),
|
||||||
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_MAX_QUALITY_FOR_REALISTIC_MODE,
|
wxMenu * renderOptionsMenu = new wxMenu;
|
||||||
_( "Max Quality in Realistic Mode" ),
|
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_COLOR,
|
||||||
_( "When using max quality, holes are removed from copper zones, "
|
_( "Render options" ), KiBitmap( tools_xpm ) );
|
||||||
"but the calculation time is longer" ),
|
|
||||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHADOWS,
|
||||||
|
_( "Render Shadows" ),
|
||||||
|
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
|
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||||
|
_( "Show Holes in Zones" ),
|
||||||
|
_( "Holes inside a copper layer copper zones are shown, "
|
||||||
|
"but the calculation time is longer" ),
|
||||||
|
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
|
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_TEXTURES,
|
||||||
|
_( "Render Textures" ),
|
||||||
|
_( "Apply a grid/cloud textures to Board, Solder Mask and Silkscreen" ),
|
||||||
|
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
|
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SMOOTH,
|
||||||
|
_( "Render Smooth Normals" ),
|
||||||
|
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
|
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_MATERIAL,
|
||||||
|
_( "Render Material properties" ),
|
||||||
|
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
prefsMenu->AppendSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_BGCOLOR_SELECTION,
|
wxMenu * backgrounColorMenu = new wxMenu;
|
||||||
_( "Choose Background Color" ), KiBitmap( palette_xpm ) );
|
|
||||||
|
// Add submenu Choose Colors
|
||||||
|
AddMenuItem( prefsMenu, backgrounColorMenu, ID_MENU3D_COLOR,
|
||||||
|
_( "Choose Colors" ), KiBitmap( palette_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( backgrounColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||||
|
_( "Background Top Color" ), KiBitmap( palette_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( backgrounColorMenu, ID_MENU3D_BGCOLOR_SELECTION,
|
||||||
|
_( "Background Bottom Color" ), KiBitmap( palette_xpm ) );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
|
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
|
||||||
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
|
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
|
||||||
|
@ -174,11 +204,11 @@ void EDA_3D_FRAME::CreateMenuBar()
|
||||||
wxMenu * gridlistMenu = new wxMenu;
|
wxMenu * gridlistMenu = new wxMenu;
|
||||||
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
||||||
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
|
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
|
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
|
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
|
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString );
|
||||||
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
|
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString );
|
||||||
|
|
||||||
// If the grid is on, check the corresponding menuitem showing the grid size
|
// If the grid is on, check the corresponding menuitem showing the grid size
|
||||||
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
|
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
|
||||||
|
@ -207,22 +237,26 @@ void EDA_3D_FRAME::CreateMenuBar()
|
||||||
|
|
||||||
prefsMenu->AppendSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
|
wxMenu * layersMenu = new wxMenu;
|
||||||
|
AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
|
||||||
|
_( "Show Layers" ), KiBitmap( tools_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
|
||||||
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
|
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
|
AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
|
||||||
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
|
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
|
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
|
||||||
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
|
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
|
||||||
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
|
AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
|
||||||
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
|
AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
|
||||||
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
|
@ -241,8 +275,23 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
|
||||||
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
|
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
|
||||||
item->Check( g_Parm_3D_Visu.IsRealisticMode() );
|
item->Check( g_Parm_3D_Visu.IsRealisticMode() );
|
||||||
|
|
||||||
item = menuBar->FindItem( ID_MENU3D_MAX_QUALITY_FOR_REALISTIC_MODE );
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHADOWS );
|
||||||
item->Check( g_Parm_3D_Visu.HightQualityMode() );
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_SHADOWS ) );
|
||||||
|
|
||||||
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHADOWS );
|
||||||
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_SHADOWS ) );
|
||||||
|
|
||||||
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||||
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES ) );
|
||||||
|
|
||||||
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_TEXTURES );
|
||||||
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_TEXTURES ) );
|
||||||
|
|
||||||
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SMOOTH );
|
||||||
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_SMOOTH ) );
|
||||||
|
|
||||||
|
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL );
|
||||||
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_RENDER_MATERIAL ) );
|
||||||
|
|
||||||
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
|
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
|
||||||
item->Check( g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) );
|
item->Check( g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
#include <3d_struct.h>
|
#include <3d_struct.h>
|
||||||
|
#include <info3d_visu.h>
|
||||||
|
|
||||||
#define KISYS3DMOD "KISYS3DMOD"
|
#define KISYS3DMOD "KISYS3DMOD"
|
||||||
|
|
||||||
|
@ -127,7 +128,7 @@ private:
|
||||||
double BestZoom();
|
double BestZoom();
|
||||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
||||||
|
|
||||||
void Set3DBgColor();
|
bool Set3DBgColor( S3D_COLOR &color );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,13 +8,15 @@
|
||||||
* Please add IDs that are unique to the 3D viewer here and not in the global
|
* Please add IDs that are unique to the 3D viewer here and not in the global
|
||||||
* id.h file. This will prevent the entire project from being rebuilt when
|
* id.h file. This will prevent the entire project from being rebuilt when
|
||||||
* adding new commands to the 3D viewer.
|
* adding new commands to the 3D viewer.
|
||||||
|
* However the number of IDs should be < ROOM_FOR_3D_VIEWER, defined in id.h
|
||||||
|
* Please change the value of ROOM_FOR_3D_VIEWER if too small.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <id.h> // Generic Id.
|
#include <id.h> // Generic Id.
|
||||||
|
|
||||||
enum id_3dview_frm
|
enum id_3dview_frm
|
||||||
{
|
{
|
||||||
ID_START_COMMAND_3D = ID_END_LIST,
|
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
|
||||||
ID_ROTATE3D_X_NEG,
|
ID_ROTATE3D_X_NEG,
|
||||||
ID_ROTATE3D_X_POS,
|
ID_ROTATE3D_X_POS,
|
||||||
ID_ROTATE3D_Y_NEG,
|
ID_ROTATE3D_Y_NEG,
|
||||||
|
@ -28,11 +30,14 @@ enum id_3dview_frm
|
||||||
ID_MOVE3D_UP,
|
ID_MOVE3D_UP,
|
||||||
ID_MOVE3D_DOWN,
|
ID_MOVE3D_DOWN,
|
||||||
ID_ORTHO,
|
ID_ORTHO,
|
||||||
|
ID_MENU3D_COLOR,
|
||||||
ID_MENU3D_BGCOLOR_SELECTION,
|
ID_MENU3D_BGCOLOR_SELECTION,
|
||||||
|
ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||||
ID_MENU3D_USE_COPPER_THICKNESS,
|
ID_MENU3D_USE_COPPER_THICKNESS,
|
||||||
ID_MENU3D_AXIS_ONOFF,
|
ID_MENU3D_AXIS_ONOFF,
|
||||||
ID_MENU3D_MODULE_ONOFF,
|
ID_MENU3D_MODULE_ONOFF,
|
||||||
ID_MENU3D_ZONE_ONOFF,
|
ID_MENU3D_ZONE_ONOFF,
|
||||||
|
ID_MENU3D_LAYERS,
|
||||||
ID_MENU3D_ADHESIVE_ONOFF,
|
ID_MENU3D_ADHESIVE_ONOFF,
|
||||||
ID_MENU3D_SILKSCREEN_ONOFF,
|
ID_MENU3D_SILKSCREEN_ONOFF,
|
||||||
ID_MENU3D_SOLDER_PASTE_ONOFF,
|
ID_MENU3D_SOLDER_PASTE_ONOFF,
|
||||||
|
@ -41,7 +46,11 @@ enum id_3dview_frm
|
||||||
ID_MENU3D_ECO_ONOFF,
|
ID_MENU3D_ECO_ONOFF,
|
||||||
ID_MENU3D_SHOW_BOARD_BODY,
|
ID_MENU3D_SHOW_BOARD_BODY,
|
||||||
ID_MENU3D_REALISTIC_MODE,
|
ID_MENU3D_REALISTIC_MODE,
|
||||||
ID_MENU3D_MAX_QUALITY_FOR_REALISTIC_MODE,
|
ID_MENU3D_FL_RENDER_SHADOWS,
|
||||||
|
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||||
|
ID_MENU3D_FL_RENDER_TEXTURES,
|
||||||
|
ID_MENU3D_FL_RENDER_SMOOTH,
|
||||||
|
ID_MENU3D_FL_RENDER_MATERIAL,
|
||||||
ID_END_COMMAND_3D,
|
ID_END_COMMAND_3D,
|
||||||
|
|
||||||
ID_TOOL_SET_VISIBLE_ITEMS,
|
ID_TOOL_SET_VISIBLE_ITEMS,
|
||||||
|
|
|
@ -66,13 +66,41 @@ INFO3D_VISU::INFO3D_VISU()
|
||||||
m_epoxyThickness = 0;
|
m_epoxyThickness = 0;
|
||||||
m_nonCopperLayerThickness = 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
|
// default all special item layers Visible
|
||||||
for( ii = 0; ii < FL_LAST; ii++ )
|
for( ii = 0; ii < FL_LAST; ii++ )
|
||||||
m_drawFlags[ii] = true;
|
m_drawFlags[ii] = true;
|
||||||
|
|
||||||
SetFlag( FL_GRID, false );
|
SetFlag( FL_GRID, false );
|
||||||
SetFlag( FL_USE_COPPER_THICKNESS, false );
|
SetFlag( FL_USE_COPPER_THICKNESS, false );
|
||||||
SetFlag( FL_USE_MAXQUALITY_IN_REALISTIC_MODE, false );
|
SetFlag( FL_RENDER_SHADOWS, false );
|
||||||
|
SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,11 @@ enum DISPLAY3D_FLG {
|
||||||
FL_USE_COPPER_THICKNESS,
|
FL_USE_COPPER_THICKNESS,
|
||||||
FL_SHOW_BOARD_BODY,
|
FL_SHOW_BOARD_BODY,
|
||||||
FL_USE_REALISTIC_MODE,
|
FL_USE_REALISTIC_MODE,
|
||||||
FL_USE_MAXQUALITY_IN_REALISTIC_MODE,
|
FL_RENDER_SHADOWS,
|
||||||
|
FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||||
|
FL_RENDER_TEXTURES,
|
||||||
|
FL_RENDER_SMOOTH,
|
||||||
|
FL_RENDER_MATERIAL,
|
||||||
FL_LAST
|
FL_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,6 +88,11 @@ public:
|
||||||
double m_Zoom; // 3D zoom value
|
double m_Zoom; // 3D zoom value
|
||||||
double m_3D_Grid; // 3D grid value, in mm
|
double m_3D_Grid; // 3D grid value, in mm
|
||||||
S3D_COLOR m_BgColor;
|
S3D_COLOR m_BgColor;
|
||||||
|
S3D_COLOR m_BgColor_Top;
|
||||||
|
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
|
wxPoint m_BoardPos; // center board actual position in board units
|
||||||
wxSize m_BoardSize; // board actual size in board units
|
wxSize m_BoardSize; // board actual size in board units
|
||||||
int m_CopperLayersCount; // Number of copper layers actually used by the board
|
int m_CopperLayersCount; // Number of copper layers actually used by the board
|
||||||
|
@ -97,7 +106,7 @@ public:
|
||||||
// used in some calculation
|
// used in some calculation
|
||||||
|
|
||||||
double zpos_offset;
|
double zpos_offset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_layerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized)
|
double m_layerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized)
|
||||||
double m_copperThickness; // Copper thickness (normalized)
|
double m_copperThickness; // Copper thickness (normalized)
|
||||||
|
@ -200,7 +209,6 @@ public: INFO3D_VISU();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
|
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
|
||||||
bool HightQualityMode() { return GetFlag( FL_USE_MAXQUALITY_IN_REALISTIC_MODE ); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern INFO3D_VISU g_Parm_3D_Visu;
|
extern INFO3D_VISU g_Parm_3D_Visu;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -65,9 +65,6 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glShadeModel( GL_SMOOTH );
|
|
||||||
glEnable( GL_NORMALIZE );
|
|
||||||
|
|
||||||
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||||
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glShadeModel( GL_SMOOTH );
|
|
||||||
glEnable( GL_NORMALIZE );
|
|
||||||
|
|
||||||
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||||
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,6 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glShadeModel( GL_SMOOTH );
|
|
||||||
glEnable( GL_NORMALIZE );
|
|
||||||
|
|
||||||
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||||
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
|
||||||
|
@ -295,6 +293,13 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||||
if( values.GetNextToken().ToDouble( &shine ) )
|
if( values.GetNextToken().ToDouble( &shine ) )
|
||||||
{
|
{
|
||||||
// VRML value is normalized and openGL expects a value 0 - 128
|
// VRML value is normalized and openGL expects a value 0 - 128
|
||||||
|
if( shine > 1.0 )
|
||||||
|
{
|
||||||
|
shine = 1.0;
|
||||||
|
} else if( shine < 0.0 )
|
||||||
|
{
|
||||||
|
shine = 0.0;
|
||||||
|
}
|
||||||
shine = shine * 128.0f;
|
shine = shine * 128.0f;
|
||||||
m_model->m_Materials->m_Shininess.push_back( shine );
|
m_model->m_Materials->m_Shininess.push_back( shine );
|
||||||
}
|
}
|
||||||
|
@ -607,7 +612,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coord_list.push_back( index );
|
coord_list.push_back( index );
|
||||||
vrml_coord_indx_list.Append( wxString::Format( wxT( "%u " ), index ) );
|
vrml_coord_indx_list.Append( wxString::Format( wxT( "%ld " ), index ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
43
include/id.h
43
include/id.h
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -31,8 +31,6 @@
|
||||||
#ifndef ID_H_
|
#ifndef ID_H_
|
||||||
#define ID_H_
|
#define ID_H_
|
||||||
|
|
||||||
#define MAX_ITEMS_IN_PICKER 15 ///< max no. items in the popup menu for item selection
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common command IDs shared by more than one of the KiCad applications.
|
* Common command IDs shared by more than one of the KiCad applications.
|
||||||
*
|
*
|
||||||
|
@ -40,8 +38,28 @@
|
||||||
* across multple applications such as the zoom, grid, and language IDs.
|
* across multple applications such as the zoom, grid, and language IDs.
|
||||||
* Application specific IDs should be defined in the appropriate header
|
* Application specific IDs should be defined in the appropriate header
|
||||||
* file to prevent the entire project from being rebuilt.
|
* file to prevent the entire project from being rebuilt.
|
||||||
|
*
|
||||||
|
* However, we must avoid duplicate IDs in menus and toolbar items, when wxUpdateUIEvent
|
||||||
|
* are associated to menuitems and/or toolbar items
|
||||||
|
* The reason is the fact wxWidgets try to send a wxUpdateUIEvent event to a given window and,
|
||||||
|
* if a wxUpdateUIEvent event function is not defined for a menuitem, wxWidgets
|
||||||
|
* propagates this event ID to parents of the given window.
|
||||||
|
* Therefore duplicate IDs could create strange behavior in menus and subtle bugs, depending
|
||||||
|
* on the code inside the wxUpdateUIEvent event functions called in parent frames.
|
||||||
|
* I did not seen this propagation to child frames, only to parent frames
|
||||||
|
*
|
||||||
|
* Issues exist only if 2 menus have the same ID, and only one menu is associated to
|
||||||
|
* a wxUpdateUIEvent event, and this one is defined in a parent Window.
|
||||||
|
* The probability it happens is low, but not null.
|
||||||
|
*
|
||||||
|
* Therefore we reserve room in ID list for each sub application.
|
||||||
|
* Please, change these values if needed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Define room for IDs, for each sub application
|
||||||
|
#define ROOM_FOR_KICADMANAGER 50
|
||||||
|
#define ROOM_FOR_3D_VIEWER 100
|
||||||
|
|
||||||
enum main_id
|
enum main_id
|
||||||
{
|
{
|
||||||
ID_RUN_PCB = wxID_HIGHEST,
|
ID_RUN_PCB = wxID_HIGHEST,
|
||||||
|
@ -250,6 +268,25 @@ enum main_id
|
||||||
|
|
||||||
ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
|
ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
|
||||||
|
|
||||||
|
// IDs specifics to a sub-application (Eeschema, Kicad manager....) start here
|
||||||
|
//
|
||||||
|
// We reserve here Ids for each sub-application, to avoid duplicate IDs
|
||||||
|
// between them.
|
||||||
|
// mainly we experienced issues related to wxUpdateUIEvent calls when 2 (or more) wxFrames
|
||||||
|
// share the same ID in menus, mainly in menubars/toolbars
|
||||||
|
// The reason is the fact wxWidgets propagates the wxUpdateUIEvent to all parent windows
|
||||||
|
// to find wxUpdateUIEvent event functions matching the menuitem IDs found when activate a menu in the first frame.
|
||||||
|
|
||||||
|
// Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
|
||||||
|
// Change it if this count is too small.
|
||||||
|
ID_KICAD_MANAGER_START,
|
||||||
|
ID_KICAD_MANAGER_END = ID_KICAD_MANAGER_START + ROOM_FOR_KICADMANAGER,
|
||||||
|
|
||||||
|
// Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
|
||||||
|
// Change it if this count is too small.
|
||||||
|
ID_KICAD_3D_VIEWER_START,
|
||||||
|
ID_KICAD_3D_VIEWER_END = ID_KICAD_3D_VIEWER_START + ROOM_FOR_3D_VIEWER,
|
||||||
|
|
||||||
ID_END_LIST
|
ID_END_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,13 +81,26 @@ enum TreeFileType {
|
||||||
/**
|
/**
|
||||||
* Command IDs for KiCad.
|
* Command IDs for KiCad.
|
||||||
*
|
*
|
||||||
* Please add IDs that are unique to Kicad here and not in the global id.h
|
* Please add IDs that are unique to Kicad here and not in the global id.h file.
|
||||||
* file. This will prevent the entire project from being rebuilt when adding
|
* This will prevent the entire project from being rebuilt when adding
|
||||||
* new commands to KiCad.
|
* new commands to KiCad.
|
||||||
|
*
|
||||||
|
* However, now the Kicad manager and other sub applications are running inside
|
||||||
|
* the same application, these IDs are kept unique inside the whole Kicad code
|
||||||
|
* See the global id.h which reserves room for the Kicad manager IDs
|
||||||
|
* and expand this room if needed
|
||||||
|
*
|
||||||
|
* We have experienced issues with duplicate menus IDs between frames
|
||||||
|
* because wxUpdateUIEvent events are sent to parent frames, when a wxUpdateUIEvent
|
||||||
|
* event function does not exists for some menuitems ID, and therefore
|
||||||
|
* with duplicate menuitems IDs in different frames, the wrong menuitem can be used
|
||||||
|
* by a function called by the wxUpdateUIEvent event loop.
|
||||||
|
*
|
||||||
|
* The number of items in this list should be less than ROOM_FOR_KICADMANAGER (see id.h)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum id_kicad_frm {
|
enum id_kicad_frm {
|
||||||
ID_LEFT_FRAME = ID_END_LIST,
|
ID_LEFT_FRAME = ID_KICAD_MANAGER_START,
|
||||||
ID_PROJECT_TREE,
|
ID_PROJECT_TREE,
|
||||||
ID_PROJECT_TXTEDIT,
|
ID_PROJECT_TXTEDIT,
|
||||||
ID_PROJECT_TREE_REFRESH,
|
ID_PROJECT_TREE_REFRESH,
|
||||||
|
@ -114,9 +127,12 @@ enum id_kicad_frm {
|
||||||
ID_SELECT_DEFAULT_PDF_BROWSER,
|
ID_SELECT_DEFAULT_PDF_BROWSER,
|
||||||
ID_SAVE_AND_ZIP_FILES,
|
ID_SAVE_AND_ZIP_FILES,
|
||||||
ID_READ_ZIP_ARCHIVE,
|
ID_READ_ZIP_ARCHIVE,
|
||||||
ID_INIT_WATCHED_PATHS
|
ID_INIT_WATCHED_PATHS,
|
||||||
};
|
|
||||||
|
|
||||||
|
// Please, verify: the number of items in this list should be
|
||||||
|
// less than ROOM_FOR_KICADMANAGER (see id.h)
|
||||||
|
ID_KICADMANAGER_END_LIST
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class KICAD_MANAGER_FRAME
|
* Class KICAD_MANAGER_FRAME
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
* from being rebuilt when adding new commands to the Pcbnew.
|
* from being rebuilt when adding new commands to the Pcbnew.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define MAX_ITEMS_IN_PICKER 15 ///< max no. items in the popup menu for item selection
|
||||||
|
|
||||||
enum pcbnew_ids
|
enum pcbnew_ids
|
||||||
{
|
{
|
||||||
ID_MAIN_MENUBAR = ID_END_LIST,
|
ID_MAIN_MENUBAR = ID_END_LIST,
|
||||||
|
@ -371,7 +373,9 @@ enum pcbnew_ids
|
||||||
ID_FOOTPRINT_WIZARD_PAGES_WINDOW,
|
ID_FOOTPRINT_WIZARD_PAGES_WINDOW,
|
||||||
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW,
|
ID_FOOTPRINT_WIZARD_PARAMETERS_WINDOW,
|
||||||
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
||||||
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD
|
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
||||||
|
|
||||||
|
ID_PCBNEW_END_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PCBNEW_ID_H_
|
#endif // PCBNEW_ID_H_
|
||||||
|
|
Loading…
Reference in New Issue