Commit 31ff1bac authored by jean-pierre charras's avatar jean-pierre charras

3D viewer:

  *  serious code cleanup (remove duplicate code)
  *  shows (option in 3D preference menu) the copper items (tracks, zones...)  in 3D, using 35 microns copper thickness.
      However, because there are a lot more3D data to show (roughly 4 times more), this is slower.
parent 0c4c65d7
......@@ -44,6 +44,9 @@
#include <info3d_visu.h>
#include <trackball.h>
// Exported function:
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
{
......@@ -75,7 +78,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
}
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices )
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
{
unsigned ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
......@@ -126,9 +129,9 @@ void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices )
/* draw polygon/triangle/quad */
for( ii = 0; ii < aVertices.size(); ii++ )
{
glVertex3f( aVertices[ii].x * DataScale3D,
aVertices[ii].y * DataScale3D,
aVertices[ii].z * DataScale3D );
glVertex3f( aVertices[ii].x * aBiuTo3DUnits,
aVertices[ii].y * aBiuTo3DUnits,
aVertices[ii].z * aBiuTo3DUnits );
}
glEnd();
......@@ -172,35 +175,6 @@ GLuint EDA_3D_CANVAS::DisplayCubeforTest()
return gllist;
}
INFO3D_VISU::INFO3D_VISU()
{
int ii;
m_Beginx = m_Beginy = 0.0; // position of mouse
m_Zoom = 1.0;
m_3D_Grid = 10.0; // Grid value in mm
trackball( m_Quat, 0.0, 0.0, 0.0, 0.0 );
for( ii = 0; ii < 4; ii++ )
m_Rot[ii] = 0.0;
m_CopperLayersCount = 2;
m_BoardSettings = NULL;
// default all special item layers Visible
for( ii = 0; ii < FL_LAST; ii++)
m_DrawFlags[ii] = true;
m_DrawFlags[FL_GRID] = false;
}
INFO3D_VISU::~INFO3D_VISU()
{
}
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer )
{
......
This diff is collapsed.
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file 3d_draw_basic_functions.h
*/
#ifndef _3D_DRAW_BASIC_FUNCTIONS_H_
#define _3D_DRAW_BASIC_FUNCTIONS_H_
// angle increment to draw a circle, approximated by segments
#define ANGLE_INC( x ) ( 3600 / (x) )
/**
* Function Draw3D_HorizontalPolygon
* draw one solid polygon
* @param aCornersList = a std::vector<wxPoint> list of corners, in board internal units
* @param aZpos = z position in board internal units
* @param aThickness = thickness in board internal units
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness 1 0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
*/
void Draw3D_HorizontalPolygon( std::vector<wxPoint>& aCornersList, int aZpos,
int aThickness, double aBiuTo3DUnits );
/** draw all solid polygons found in aPolysList
* @param aPolysList = the poligon list to draw
* @param aZpos = z position in board internal units
* @param aThickness = thickness in board internal units
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness 1 0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
*/
void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysList,
int aZpos, int aThickness, double aBiuTo3DUnits );
/** draw the solid polygon found in aPolysList
* The first polygonj is the main polygon, others are holes
* @param aPolysList = the polygon with holes to draw
* @param aZpos = z position in board internal units
* @param aThickness = thickness in board internal units
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness 1 0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
*/
void Draw3D_SolidHorizontalPolygonWithHoles( const std::vector<CPolyPt>& aPolysList,
int aZpos, int aThickness, double aBiuTo3DUnits );
/** draw a thick segment using 3D primitives, in a XY plane
* @param wxPoint aStart = YX position of start point in board units
* @param wxPoint aEnd = YX position of end point in board units
* @param aWidth = width of segment in board units
* @param aThickness = thickness of segment in board units
* @param aZpos = z position of segment in board units
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness 1 0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
*/
void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd,
int aWidth, int aThickness, int aZpos,
double aBiuTo3DUnits );
/** draw an arc using 3D primitives, in a plane parallel to the XY plane
* @param aCenterPos = 3D position of the center
* @param aStartPointX, aStartPointY = start point coordinate of arc (3D units)
* @param aWidth = width of the circle (3D units)
* @param aArcAngle = arc angle in 1/10 degrees
* @param aWidth = thickness of arc
*/
void Draw3D_ArcSegment( const S3D_VERTEX& aCenterPos,
double aStartPointX, double aStartPointY,
double aArcAngle, double aWidth );
/** draw a thick cylinder (a tube) using 3D primitives.
* the cylinder axis is parallel to the Z axis
* @param aCentPos = XY position of the axis cylinder ( board internal units)
* @param aRadius = radius of the cylinder ( board internal units)
* @param aHeight = height of the cylinder ( boardinternal units)
* @param aThickness = tichkness of tube ( boardinternal units)
* @param aZpos = Z position of the bottom side of the cylinder ( board internal units)
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
*
* If aHeight = height of the cylinder is 0, only one ring will be drawn
* If aThickness = 0, only one cylinder (not a tube) will be drawn
*/
void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius,
int aHeight, int aThickness,
int aZpos, double aBiuTo3DUnits );
/** draw an oblong cylinder (oblong tube) using 3D primitives.
* the cylinder axis are parallel to the Z axis
* @param aAxis1Pos = position of the first axis cylinder
* @param aAxis2Pos = position of the second axis cylinder
* @param aRadius = radius of the cylinder ( board internal units )
* @param aHeight = height of the cylinder ( board internal units )
* @param aThickness = tichkness of tube ( board internal units )
* @param aZpos = Z position of the bottom side of the cylinder ( board internal units )
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
*/
void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
int aRadius, int aHeight, int aThickness,
int aZpos, double aBiuTo3DUnits );
#endif // _3D_DRAW_BASIC_FUNCTIONS_H_
......@@ -37,8 +37,6 @@
#include <3d_viewer_id.h>
INFO3D_VISU g_Parm_3D_Visu;
double DataScale3D; // 3D conversion units.
BEGIN_EVENT_TABLE( EDA_3D_FRAME, wxFrame )
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
......@@ -130,6 +128,13 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
Destroy();
}
static const wxString keyPosx( wxT( "Pos_x" ) );
static const wxString keyPosy( wxT( "Pos_y" ) );
static const wxString keySizex( wxT( "Size_x" ) );
static const wxString keySizey( wxT( "Size_y" ) );
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
void EDA_3D_FRAME::GetSettings()
{
......@@ -138,17 +143,17 @@ void EDA_3D_FRAME::GetSettings()
if( config )
{
text = m_FrameName + wxT( "Pos_x" );
text = m_FrameName + keyPosx;
config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
text = m_FrameName + keyPosy;
config->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
text = m_FrameName + keySizex;
config->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" );
text = m_FrameName + keySizey;
config->Read( text, &m_FrameSize.y, 400 );
config->Read( wxT( "BgColor_Red" ), &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
config->Read( wxT( "BgColor_Green" ), &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
}
#if defined( __WXMAC__ )
// for macOSX, the window must be below system (macOSX) toolbar
......@@ -166,9 +171,9 @@ void EDA_3D_FRAME::SaveSettings()
if( !Config )
return;
Config->Write( wxT( "BgColor_Red" ), g_Parm_3D_Visu.m_BgColor.m_Red );
Config->Write( wxT( "BgColor_Green" ), g_Parm_3D_Visu.m_BgColor.m_Green );
Config->Write( wxT( "BgColor_Blue" ), g_Parm_3D_Visu.m_BgColor.m_Blue );
Config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
Config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
Config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
if( IsIconized() )
return;
......@@ -176,13 +181,13 @@ void EDA_3D_FRAME::SaveSettings()
m_FrameSize = GetSize();
m_FramePos = GetPosition();
text = m_FrameName + wxT( "Pos_x" );
text = m_FrameName + keyPosx;
Config->Write( text, (long) m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
text = m_FrameName + keyPosy;
Config->Write( text, (long) m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
text = m_FrameName + keySizex;
Config->Write( text, (long) m_FrameSize.x );
text = m_FrameName + wxT( "Size_y" );
text = m_FrameName + keySizey;
Config->Write( text, (long) m_FrameSize.y );
}
......@@ -322,6 +327,11 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
NewDisplay();
return;
case ID_MENU3D_USE_COPPER_THICKNESS:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] = isChecked;
NewDisplay();
return;
case ID_MENU3D_ZONE_ONOFF:
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] = isChecked;
NewDisplay();
......
......@@ -34,6 +34,10 @@
#include <appl_wxstruct.h>
#include <3d_viewer.h>
#include <info3d_visu.h>
// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
// separator chars
static const char* sep_chars = " \t\n\r";
......@@ -400,6 +404,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
int err = 1;
std::vector< double > points;
std::vector< double > list;
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
while( GetLine( file, line, LineNum, 512 ) )
{
......@@ -545,7 +550,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
Set_Object_Coords( vertices );
Set_Object_Data( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
vertices.clear();
coordIndex.clear();
}
......
......@@ -169,6 +169,10 @@ void EDA_3D_FRAME::ReCreateMenuBar()
if( full_options )
{
item = AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS]);
item = AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE]);
......
......@@ -30,8 +30,9 @@
#ifndef __3D_VIEWER_H__
#define __3D_VIEWER_H__
#include <wxBasePcbFrame.h> // m_auimanager member.
#include <wxBasePcbFrame.h> // for m_auimanager member.
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <PolyLine.h> // fot CPolyPt
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
......@@ -149,24 +150,6 @@ public:
*/
void Draw3D_Zone( ZONE_CONTAINER* aZone );
/**
* Function Draw3D_SolidPolygonsInZones
* draw all solid polygons used as filled areas in a zone
* Function used by Draw3D_Zone
* Note: polygons are drawn, but not the thick polygon outlines
* Use Draw3D_Zone to draw aZone
* @param aZone = the zone to draw
*/
void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone );
/**
* Function Draw3D_Polygon
* draw one solid polygon
* @param aCornersList = a std::vector<wxPoint> list of corners, in physical coordinates
* @param aZpos = the z position in 3D units
*/
void Draw3D_Polygon( std::vector<wxPoint>& aCornersList, double aZpos );
/**
* Function Draw3D_DrawText
* draws 3D segments to create text objects.
......@@ -258,7 +241,4 @@ private:
DECLARE_EVENT_TABLE()
};
void SetGLColor( int color );
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices );
#endif /* __3D_VIEWER_H__ */
......@@ -29,6 +29,7 @@ enum id_3dview_frm
ID_MOVE3D_DOWN,
ID_ORTHO,
ID_MENU3D_BGCOLOR_SELECTION,
ID_MENU3D_USE_COPPER_THICKNESS,
ID_MENU3D_AXIS_ONOFF,
ID_MENU3D_MODULE_ONOFF,
ID_MENU3D_ZONE_ONOFF,
......
......@@ -13,9 +13,11 @@ set(3D-VIEWER_SRCS
3d_canvas.cpp
3d_class.cpp
3d_draw.cpp
3d_draw_basic_functions.cpp
3d_frame.cpp
3d_read_mesh.cpp
3d_toolbar.cpp
info3d_visu.cpp
trackball.cpp
)
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file info3d_visu.cpp
*/
#include <fctsys.h>
#include <common.h>
#include <class_board_design_settings.h>
#include <class_board.h>
#include <3d_viewer.h>
#include <info3d_visu.h>
#include <trackball.h>
// Thickness of copper
// TODO: define the actual copper thickness by user
#define COPPER_THICKNESS (int)(0.035 * IU_PER_MM) // for 35 u
#define TECH_LAYER_THICKNESS (int)(0.04 * IU_PER_MM)
#define EPOXY_THICKNESS (int)(1.6 * IU_PER_MM) // for 1.6 mm
/* INFO3D_VISU in an helper class to store parameters like scaling factors,
* board size, Z coordinates of layers ...
* to create the 3D GLList
*/
INFO3D_VISU::INFO3D_VISU()
{
int ii;
m_Beginx = m_Beginy = 0.0; // position of mouse
m_Zoom = 1.0;
m_3D_Grid = 10.0; // Grid value in mm
trackball( m_Quat, 0.0, 0.0, 0.0, 0.0 );
for( ii = 0; ii < 4; ii++ )
m_Rot[ii] = 0.0;
m_CopperLayersCount = 2;
m_BoardSettings = NULL;
m_CopperThickness = 0;
m_EpoxyThickness = 0;
m_NonCopperLayerThickness = 0;
// default all special item layers Visible
for( ii = 0; ii < FL_LAST; ii++ )
m_DrawFlags[ii] = true;
m_DrawFlags[FL_GRID] = false;
m_DrawFlags[FL_USE_COPPER_THICKNESS] = false;
}
INFO3D_VISU::~INFO3D_VISU()
{
}
/* Initialize info 3D Parameters from aBoard
*/
void INFO3D_VISU::InitSettings( BOARD* aBoard )
{
EDA_RECT bbbox = aBoard->ComputeBoundingBox( false );
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
{
bbbox.SetWidth( 100 * IU_PER_MM );
bbbox.SetHeight( 100 * IU_PER_MM );
}
m_BoardSettings = &aBoard->GetDesignSettings();
m_BoardSize = bbbox.GetSize();
m_BoardPos = bbbox.Centre();
m_BoardPos.y = -m_BoardPos.y;
m_CopperLayersCount = aBoard->GetCopperLayerCount();
// Ensure the board has 2 sides for 3D views, because it is hard to find
// a *really* single side board in the true life...
if( m_CopperLayersCount < 2 )
m_CopperLayersCount = 2;
m_BiuTo3Dunits = 2.0 / std::max( m_BoardSize.x, m_BoardSize.y );
m_EpoxyThickness = aBoard->GetDesignSettings().GetBoardThickness() * m_BiuTo3Dunits;
// TODO use value defined by user (currently use default values by ctor
m_CopperThickness = COPPER_THICKNESS * m_BiuTo3Dunits;
m_NonCopperLayerThickness = TECH_LAYER_THICKNESS * m_BiuTo3Dunits;
// Init Z position of each layer
// calculate z position for each copper layer
int layer;
int copper_layers_cnt = m_CopperLayersCount;
for( layer = 0; layer < copper_layers_cnt; layer++ )
{
m_LayerZcoord[layer] =
m_EpoxyThickness * layer / (copper_layers_cnt - 1);
}
double zpos_copper_back = m_LayerZcoord[0];
double zpos_copper_front = m_EpoxyThickness;
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
for( ; layer <= LAST_COPPER_LAYER; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NO_COPPER_LAYER; layer_id < NB_LAYERS; layer_id++ )
{
double zpos;
#define NonCopperLayerThicknessMargin 1.1
switch( layer_id )
{
case ADHESIVE_N_BACK:
zpos = zpos_copper_back -
4 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front +
4 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back -
3 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SOLDERPASTE_N_FRONT:
zpos = zpos_copper_front +
3 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SOLDERMASK_N_BACK:
zpos = zpos_copper_back -
1 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SOLDERMASK_N_FRONT:
zpos = zpos_copper_front +
1 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SILKSCREEN_N_BACK:
zpos = zpos_copper_back -
2 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
case SILKSCREEN_N_FRONT:
zpos = zpos_copper_front +
2 * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NO_COPPER_LAYER + 5) *
m_NonCopperLayerThickness * NonCopperLayerThicknessMargin;
break;
}
m_LayerZcoord[layer_id] = zpos;
}
}
/*
* 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) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
......@@ -24,7 +24,7 @@
*/
/**
* @file 3d_viewer.h
* @file info3d_visu.h
*/
#ifndef __INFO3D_VISU_H__
......@@ -33,10 +33,6 @@
#include <wxBasePcbFrame.h> // m_auimanager member.
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include <wx/glcanvas.h>
#ifdef __WXMAC__
......@@ -74,34 +70,74 @@ public:
FL_AXIS=0, FL_MODULE, FL_ZONE,
FL_COMMENTS, FL_DRAWINGS, FL_ECO1, FL_ECO2,
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_LAST
};
double m_Beginx, m_Beginy; // position of mouse
double m_Quat[4]; // orientation of object
double m_Rot[4]; // man rotation of object
double m_Zoom; // field of view in degrees
double m_Beginx, m_Beginy; // position of mouse (used in drag commands)
double m_Quat[4]; // orientation of 3D view
double m_Rot[4]; // rotation parameters of 3D view
double m_Zoom; // 3D zoom value
double m_3D_Grid; // 3D grid valmue, in mm
S3D_COLOR m_BgColor;
bool m_DrawFlags[FL_LAST]; // show these special items
wxPoint m_BoardPos;
wxSize m_BoardSize;
bool m_DrawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
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
const BOARD_DESIGN_SETTINGS* m_BoardSettings; // Link to current board design settings
double m_BiuTo3Dunits; // Normalization scale to convert board
// internal units to 3D units
// to scale 3D units between -1.0 and +1.0
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized)
double m_ActZpos;
public: INFO3D_VISU();
~INFO3D_VISU();
/**
* Function InitSettings
* Initialize info 3D Parameters from aBoard
* @param aBoard: the board to display
*/
void InitSettings( BOARD* aBoard );
/**
* function m_BiuTo3Dunits
* @return the Z coordinate of the layer aLayer, in Board Internal Units
* @param aLayer: the layer number
*/
int GetLayerZcoordBIU( int aLayer )
{
return (int) (m_LayerZcoord[aLayer] / m_BiuTo3Dunits );
}
int GetCopperThicknessBIU() const
{
return m_DrawFlags[FL_USE_COPPER_THICKNESS] ?
(int) (m_CopperThickness / m_BiuTo3Dunits )
: 0;
}
int GetEpoxyThicknessBIU() const
{
return (int) (m_EpoxyThickness / m_BiuTo3Dunits );
}
int GetNonCopperLayerThicknessBIU() const
{
return m_DrawFlags[FL_USE_COPPER_THICKNESS] ?
(int) (m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0;
}
};
extern INFO3D_VISU g_Parm_3D_Visu;
extern double DataScale3D; // 3D scale units.
#endif /* __INFO3D_VISU_H__ */
......@@ -485,6 +485,7 @@ set( BMAPS_MID
unzip
update_module_board
up
use_3D_copper_thickness
via
via_sketch
warning
......
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x01, 0xa6, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xbd, 0xd5, 0xbf, 0x4b, 0xc3,
0x50, 0x10, 0x07, 0xf0, 0x4b, 0xfa, 0xde, 0x8b, 0x4e, 0x16, 0x71, 0x12, 0x2b, 0x0e, 0x2e, 0xa5,
0x43, 0x71, 0x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5b, 0x37, 0x55, 0x60, 0x79, 0xdf, 0x55, 0x0c, 0x6c, 0x03, 0x61, 0xa1, 0x94,
0x1a, 0x9d, 0x0a, 0x82, 0x0c, 0x72, 0x2b, 0x88, 0x1d, 0x7d, 0x01, 0xbf, 0xeb, 0x9b, 0xb8, 0x05,
0x3e, 0x9f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE use_3D_copper_thickness_xpm[1] = {{ png, sizeof( png ), "use_3D_copper_thickness_xpm" }};
//EOF
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="26"
width="26"
version="1.1"
id="svg2"
inkscape:version="0.48.1 "
sodipodi:docname="3d_use_copper_thickness.svg">
<metadata
id="metadata26">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="968"
id="namedview24"
showgrid="false"
inkscape:zoom="32.120513"
inkscape:cx="12.060967"
inkscape:cy="11.98812"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
showguides="true"
inkscape:guide-bbox="true"
showborder="true">
<sodipodi:guide
orientation="0,1"
position="45.626168,30.620228"
id="guide3799" />
</sodipodi:namedview>
<defs
id="defs4">
<filter
id="c"
height="1.212"
width="1.059"
color-interpolation-filters="sRGB"
y="-0.10598"
x="-0.029501">
<feGaussianBlur
stdDeviation="0.52522041"
id="feGaussianBlur7" />
</filter>
<filter
id="d"
height="1.212"
width="1.059"
color-interpolation-filters="sRGB"
y="-0.10598"
x="-0.029501">
<feGaussianBlur
stdDeviation="0.52522041"
id="feGaussianBlur10" />
</filter>
</defs>
<g
id="g3879"
transform="matrix(1.079734,0,0,0.8805836,0.04176086,4.8713303)">
<path
style="fill:#1c4d00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path22-1-0"
d="M 0.00743077,13.573317 H 18.058057 l 6.017018,10.471372 H 6.0244485 L 0.00816177,13.573317 z" />
<path
style="fill:#72ff06;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path22-9"
d="M -0.01750581,11.199955 H 18.033121 l 6.017018,10.471372 H 5.999512 L -0.01677418,11.199955 z" />
</g>
<g
id="g3873"
transform="matrix(1.0749484,0,0,0.90644265,-0.0011,1.998042)">
<path
style="fill:#740000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path22-1"
d="M 0.03961332,2.3524334 H 18.09024 L 24.107258,12.823805 H 6.056631 L 0.04034432,2.3524334 z" />
<path
style="fill:#ff0606;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path22"
d="M 0.01467674,-0.02092885 H 18.065304 L 24.082322,10.450443 H 6.0316946 L 0.01540837,-0.02092885 z" />
</g>
</svg>
......@@ -306,49 +306,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) );
/* these globals don't exist
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
&g_Sheet_A4.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ),
&g_Sheet_A4.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A3" ),
&g_Sheet_A3.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A3" ),
&g_Sheet_A3.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A2" ),
&g_Sheet_A2.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A2" ),
&g_Sheet_A2.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A1" ),
&g_Sheet_A1.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A1" ),
&g_Sheet_A1.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A0" ),
&g_Sheet_A0.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A0" ),
&g_Sheet_A0.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A" ),
&g_Sheet_A.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A" ),
&g_Sheet_A.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_B" ),
&g_Sheet_B.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_B" ),
&g_Sheet_B.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_C" ),
&g_Sheet_C.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_C" ),
&g_Sheet_C.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_D" ),
&g_Sheet_D.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_D" ),
&g_Sheet_D.m_Offset.y ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_E" ),
&g_Sheet_E.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
&g_Sheet_E.m_Offset.y ) );
*/
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x,
0, -1000, +1000 ) );
......
......@@ -458,6 +458,7 @@ EXTERN_BITMAP( unlocked_xpm )
EXTERN_BITMAP( unzip_xpm )
EXTERN_BITMAP( update_module_board_xpm )
EXTERN_BITMAP( up_xpm )
EXTERN_BITMAP( use_3D_copper_thickness_xpm )
EXTERN_BITMAP( via_xpm )
EXTERN_BITMAP( via_sketch_xpm )
EXTERN_BITMAP( viewlibs_icon_xpm )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment