Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5614ba00
Commit
5614ba00
authored
Oct 07, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: 3D view: Better 3D rendering (fix some artifact issues). Add a realistic rendering mode.
parent
191cc6d1
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
249 additions
and
92 deletions
+249
-92
3d_draw.cpp
3d-viewer/3d_draw.cpp
+176
-52
3d_draw_basic_functions.h
3d-viewer/3d_draw_basic_functions.h
+1
-1
3d_frame.cpp
3d-viewer/3d_frame.cpp
+17
-0
3d_toolbar.cpp
3d-viewer/3d_toolbar.cpp
+27
-14
3d_viewer_id.h
3d-viewer/3d_viewer_id.h
+2
-0
info3d_visu.cpp
3d-viewer/info3d_visu.cpp
+14
-22
info3d_visu.h
3d-viewer/info3d_visu.h
+12
-3
No files found.
3d-viewer/3d_draw.cpp
View file @
5614ba00
This diff is collapsed.
Click to expand it.
3d-viewer/3d_draw_basic_functions.h
View file @
5614ba00
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
* @param aThickness = thickness in board internal units
* @param aThickness = thickness in board internal units
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
* @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 = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
* If aThickness
1
0, a solid object is drawn.
* If aThickness
>
0, a solid object is drawn.
* The top side is located at aZpos + aThickness / 2
* The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
* The bottom side is located at aZpos - aThickness / 2
*/
*/
...
...
3d-viewer/3d_frame.cpp
View file @
5614ba00
...
@@ -47,6 +47,7 @@ static const wxString keySizey( wxT( "Size_y" ) );
...
@@ -47,6 +47,7 @@ static const wxString keySizey( wxT( "Size_y" ) );
static
const
wxString
keyBgColor_Red
(
wxT
(
"BgColor_Red"
)
);
static
const
wxString
keyBgColor_Red
(
wxT
(
"BgColor_Red"
)
);
static
const
wxString
keyBgColor_Green
(
wxT
(
"BgColor_Green"
)
);
static
const
wxString
keyBgColor_Green
(
wxT
(
"BgColor_Green"
)
);
static
const
wxString
keyBgColor_Blue
(
wxT
(
"BgColor_Blue"
)
);
static
const
wxString
keyBgColor_Blue
(
wxT
(
"BgColor_Blue"
)
);
static
const
wxString
keyShowRealisticMode
(
wxT
(
"ShowRealisticMode"
)
);
static
const
wxString
keyShowAxis
(
wxT
(
"ShowAxis"
)
);
static
const
wxString
keyShowAxis
(
wxT
(
"ShowAxis"
)
);
static
const
wxString
keyShowZones
(
wxT
(
"ShowZones"
)
);
static
const
wxString
keyShowZones
(
wxT
(
"ShowZones"
)
);
static
const
wxString
keyShowFootprints
(
wxT
(
"ShowFootprints"
)
);
static
const
wxString
keyShowFootprints
(
wxT
(
"ShowFootprints"
)
);
...
@@ -56,6 +57,7 @@ static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) )
...
@@ -56,6 +57,7 @@ static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) )
static
const
wxString
keyShowSolderMaskLayers
(
wxT
(
"ShowSolderMasLayers"
)
);
static
const
wxString
keyShowSolderMaskLayers
(
wxT
(
"ShowSolderMasLayers"
)
);
static
const
wxString
keyShowSolderPasteLayers
(
wxT
(
"ShowSolderPasteLayers"
)
);
static
const
wxString
keyShowSolderPasteLayers
(
wxT
(
"ShowSolderPasteLayers"
)
);
static
const
wxString
keyShowCommentsLayer
(
wxT
(
"ShowCommentsLayers"
)
);
static
const
wxString
keyShowCommentsLayer
(
wxT
(
"ShowCommentsLayers"
)
);
static
const
wxString
keyShowBoardBody
(
wxT
(
"ShowBoardBody"
)
);
static
const
wxString
keyShowEcoLayers
(
wxT
(
"ShowEcoLayers"
)
);
static
const
wxString
keyShowEcoLayers
(
wxT
(
"ShowEcoLayers"
)
);
BEGIN_EVENT_TABLE
(
EDA_3D_FRAME
,
wxFrame
)
BEGIN_EVENT_TABLE
(
EDA_3D_FRAME
,
wxFrame
)
...
@@ -167,6 +169,8 @@ void EDA_3D_FRAME::GetSettings()
...
@@ -167,6 +169,8 @@ void EDA_3D_FRAME::GetSettings()
config
->
Read
(
keyBgColor_Green
,
&
g_Parm_3D_Visu
.
m_BgColor
.
m_Green
,
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
);
config
->
Read
(
keyBgColor_Blue
,
&
g_Parm_3D_Visu
.
m_BgColor
.
m_Blue
,
0.0
);
class
INFO3D_VISU
&
prms
=
g_Parm_3D_Visu
;
class
INFO3D_VISU
&
prms
=
g_Parm_3D_Visu
;
config
->
Read
(
keyShowRealisticMode
,
&
prms
.
m_DrawFlags
[
prms
.
FL_USE_REALISTIC_MODE
],
false
);
config
->
Read
(
keyShowAxis
,
&
prms
.
m_DrawFlags
[
prms
.
FL_AXIS
],
true
);
config
->
Read
(
keyShowAxis
,
&
prms
.
m_DrawFlags
[
prms
.
FL_AXIS
],
true
);
config
->
Read
(
keyShowFootprints
,
&
prms
.
m_DrawFlags
[
prms
.
FL_MODULE
],
true
);
config
->
Read
(
keyShowFootprints
,
&
prms
.
m_DrawFlags
[
prms
.
FL_MODULE
],
true
);
config
->
Read
(
keyShowCopperThickness
,
config
->
Read
(
keyShowCopperThickness
,
...
@@ -179,6 +183,7 @@ void EDA_3D_FRAME::GetSettings()
...
@@ -179,6 +183,7 @@ void EDA_3D_FRAME::GetSettings()
config
->
Read
(
keyShowSolderPasteLayers
,
&
prms
.
m_DrawFlags
[
prms
.
FL_SOLDERPASTE
],
true
);
config
->
Read
(
keyShowSolderPasteLayers
,
&
prms
.
m_DrawFlags
[
prms
.
FL_SOLDERPASTE
],
true
);
config
->
Read
(
keyShowCommentsLayer
,
&
prms
.
m_DrawFlags
[
prms
.
FL_COMMENTS
],
true
);
config
->
Read
(
keyShowCommentsLayer
,
&
prms
.
m_DrawFlags
[
prms
.
FL_COMMENTS
],
true
);
config
->
Read
(
keyShowEcoLayers
,
&
prms
.
m_DrawFlags
[
prms
.
FL_ECO
],
true
);
config
->
Read
(
keyShowEcoLayers
,
&
prms
.
m_DrawFlags
[
prms
.
FL_ECO
],
true
);
config
->
Read
(
keyShowBoardBody
,
&
prms
.
m_DrawFlags
[
prms
.
FL_SHOW_BOARD_BODY
],
true
);
}
}
}
}
...
@@ -195,6 +200,7 @@ void EDA_3D_FRAME::SaveSettings()
...
@@ -195,6 +200,7 @@ void EDA_3D_FRAME::SaveSettings()
config
->
Write
(
keyBgColor_Green
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Green
);
config
->
Write
(
keyBgColor_Green
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Green
);
config
->
Write
(
keyBgColor_Blue
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Blue
);
config
->
Write
(
keyBgColor_Blue
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Blue
);
class
INFO3D_VISU
&
prms
=
g_Parm_3D_Visu
;
class
INFO3D_VISU
&
prms
=
g_Parm_3D_Visu
;
config
->
Write
(
keyShowRealisticMode
,
prms
.
m_DrawFlags
[
prms
.
FL_USE_REALISTIC_MODE
]
);
config
->
Write
(
keyShowAxis
,
prms
.
m_DrawFlags
[
prms
.
FL_AXIS
]
);
config
->
Write
(
keyShowAxis
,
prms
.
m_DrawFlags
[
prms
.
FL_AXIS
]
);
config
->
Write
(
keyShowFootprints
,
prms
.
m_DrawFlags
[
prms
.
FL_MODULE
]
);
config
->
Write
(
keyShowFootprints
,
prms
.
m_DrawFlags
[
prms
.
FL_MODULE
]
);
config
->
Write
(
keyShowCopperThickness
,
prms
.
m_DrawFlags
[
prms
.
FL_USE_COPPER_THICKNESS
]
);
config
->
Write
(
keyShowCopperThickness
,
prms
.
m_DrawFlags
[
prms
.
FL_USE_COPPER_THICKNESS
]
);
...
@@ -205,6 +211,7 @@ void EDA_3D_FRAME::SaveSettings()
...
@@ -205,6 +211,7 @@ void EDA_3D_FRAME::SaveSettings()
config
->
Write
(
keyShowSolderPasteLayers
,
prms
.
m_DrawFlags
[
prms
.
FL_SOLDERPASTE
]
);
config
->
Write
(
keyShowSolderPasteLayers
,
prms
.
m_DrawFlags
[
prms
.
FL_SOLDERPASTE
]
);
config
->
Write
(
keyShowCommentsLayer
,
prms
.
m_DrawFlags
[
prms
.
FL_COMMENTS
]
);
config
->
Write
(
keyShowCommentsLayer
,
prms
.
m_DrawFlags
[
prms
.
FL_COMMENTS
]
);
config
->
Write
(
keyShowEcoLayers
,
prms
.
m_DrawFlags
[
prms
.
FL_ECO
]
);
config
->
Write
(
keyShowEcoLayers
,
prms
.
m_DrawFlags
[
prms
.
FL_ECO
]
);
config
->
Write
(
keyShowBoardBody
,
prms
.
m_DrawFlags
[
prms
.
FL_SHOW_BOARD_BODY
]
);
if
(
IsIconized
()
)
if
(
IsIconized
()
)
return
;
return
;
...
@@ -355,6 +362,16 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -355,6 +362,16 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
Set3DBgColor
();
Set3DBgColor
();
return
;
return
;
case
ID_MENU3D_REALISTIC_MODE
:
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_USE_REALISTIC_MODE
]
=
isChecked
;
NewDisplay
();
return
;
case
ID_MENU3D_SHOW_BOARD_BODY
:
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_SHOW_BOARD_BODY
]
=
isChecked
;
NewDisplay
();
return
;
case
ID_MENU3D_AXIS_ONOFF
:
case
ID_MENU3D_AXIS_ONOFF
:
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_AXIS
]
=
isChecked
;
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_AXIS
]
=
isChecked
;
NewDisplay
();
NewDisplay
();
...
...
3d-viewer/3d_toolbar.cpp
View file @
5614ba00
...
@@ -158,17 +158,19 @@ void EDA_3D_FRAME::CreateMenuBar()
...
@@ -158,17 +158,19 @@ void EDA_3D_FRAME::CreateMenuBar()
menuBar
->
Append
(
prefsMenu
,
_
(
"&Preferences"
)
);
menuBar
->
Append
(
prefsMenu
,
_
(
"&Preferences"
)
);
AddMenuItem
(
prefsMenu
,
ID_MENU3D_REALISTIC_MODE
,
_
(
"Realistic Mode"
),
KiBitmap
(
use_3D_copper_thickness_xpm
),
wxITEM_CHECK
);
prefsMenu
->
AppendSeparator
();
AddMenuItem
(
prefsMenu
,
ID_MENU3D_BGCOLOR_SELECTION
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_BGCOLOR_SELECTION
,
_
(
"Choose background color"
),
KiBitmap
(
palette_xpm
)
);
_
(
"Choose background color"
),
KiBitmap
(
palette_xpm
)
);
wxMenuItem
*
item
;
AddMenuItem
(
prefsMenu
,
ID_MENU3D_AXIS_ONOFF
,
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_AXIS_ONOFF
,
_
(
"Show 3D &Axis"
),
KiBitmap
(
axis3d_front_xpm
),
wxITEM_CHECK
);
_
(
"Show 3D &Axis"
),
KiBitmap
(
axis3d_front_xpm
),
wxITEM_CHECK
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_AXIS
]);
// Creates grid menu
// Creates grid menu
wxMenu
*
gridlistMenu
=
new
wxMenu
;
wxMenu
*
gridlistMenu
=
new
wxMenu
;
item
=
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
->
Append
(
ID_MENU3D_GRID_NOGRID
,
_
(
"No 3D Grid"
),
wxEmptyString
,
true
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_NOGRID
,
true
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_NOGRID
,
true
);
...
@@ -178,32 +180,34 @@ void EDA_3D_FRAME::CreateMenuBar()
...
@@ -178,32 +180,34 @@ void EDA_3D_FRAME::CreateMenuBar()
gridlistMenu
->
Append
(
ID_MENU3D_GRID_2P5_MM
,
_
(
"3D Grid 2.5 mm"
),
wxEmptyString
,
true
);
gridlistMenu
->
Append
(
ID_MENU3D_GRID_2P5_MM
,
_
(
"3D Grid 2.5 mm"
),
wxEmptyString
,
true
);
gridlistMenu
->
Append
(
ID_MENU3D_GRID_1_MM
,
_
(
"3D Grid 1 mm"
),
wxEmptyString
,
true
);
gridlistMenu
->
Append
(
ID_MENU3D_GRID_1_MM
,
_
(
"3D Grid 1 mm"
),
wxEmptyString
,
true
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_USE_COPPER_THICKNESS
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_SHOW_BOARD_BODY
,
_
(
"Show Board Body"
),
KiBitmap
(
use_3D_copper_thickness_xpm
),
wxITEM_CHECK
);
AddMenuItem
(
prefsMenu
,
ID_MENU3D_USE_COPPER_THICKNESS
,
_
(
"Show Copper Thickness"
),
KiBitmap
(
use_3D_copper_thickness_xpm
),
wxITEM_CHECK
);
_
(
"Show Copper Thickness"
),
KiBitmap
(
use_3D_copper_thickness_xpm
),
wxITEM_CHECK
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_MODULE_ONOFF
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_MODULE_ONOFF
,
_
(
"Show 3D F&ootprints"
),
KiBitmap
(
shape_3d_xpm
),
wxITEM_CHECK
);
_
(
"Show 3D F&ootprints"
),
KiBitmap
(
shape_3d_xpm
),
wxITEM_CHECK
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_ZONE_ONOFF
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_ZONE_ONOFF
,
_
(
"Show Zone &Filling"
),
KiBitmap
(
add_zone_xpm
),
wxITEM_CHECK
);
_
(
"Show Zone &Filling"
),
KiBitmap
(
add_zone_xpm
),
wxITEM_CHECK
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_ADHESIVE_ONOFF
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_ADHESIVE_ONOFF
,
_
(
"Show &Adhesive Layers"
),
KiBitmap
(
tools_xpm
),
wxITEM_CHECK
);
_
(
"Show &Adhesive Layers"
),
KiBitmap
(
tools_xpm
),
wxITEM_CHECK
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_ADHESIVE
]);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_SILKSCREEN_ONOFF
,
AddMenuItem
(
prefsMenu
,
ID_MENU3D_SILKSCREEN_ONOFF
,
_
(
"Show &Silkscreen Layer"
),
KiBitmap
(
add_text_xpm
),
wxITEM_CHECK
);
_
(
"Show &Silkscreen Layer"
),
KiBitmap
(
add_text_xpm
),
wxITEM_CHECK
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_SOLDER_MASK_ONOFF
,
AddMenuItem
(
prefsMenu
,
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
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_SOLDER_PASTE_ONOFF
,
AddMenuItem
(
prefsMenu
,
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
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_COMMENTS_ONOFF
,
AddMenuItem
(
prefsMenu
,
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
);
item
=
AddMenuItem
(
prefsMenu
,
ID_MENU3D_ECO_ONOFF
,
AddMenuItem
(
prefsMenu
,
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
);
...
@@ -219,6 +223,12 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
...
@@ -219,6 +223,12 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
wxMenuItem
*
item
;
wxMenuItem
*
item
;
// Set the state of toggle menus according to the current display options
// Set the state of toggle menus according to the current display options
item
=
menuBar
->
FindItem
(
ID_MENU3D_REALISTIC_MODE
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_USE_REALISTIC_MODE
]);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SHOW_BOARD_BODY
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_SHOW_BOARD_BODY
]);
item
=
menuBar
->
FindItem
(
ID_MENU3D_USE_COPPER_THICKNESS
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_USE_COPPER_THICKNESS
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_USE_COPPER_THICKNESS
]);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_USE_COPPER_THICKNESS
]);
...
@@ -228,6 +238,9 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
...
@@ -228,6 +238,9 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
item
=
menuBar
->
FindItem
(
ID_MENU3D_ZONE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ZONE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_ZONE
]);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_ZONE
]);
item
=
menuBar
->
FindItem
(
ID_MENU3D_AXIS_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_AXIS
]);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ADHESIVE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ADHESIVE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_ADHESIVE
]);
item
->
Check
(
g_Parm_3D_Visu
.
m_DrawFlags
[
g_Parm_3D_Visu
.
FL_ADHESIVE
]);
...
...
3d-viewer/3d_viewer_id.h
View file @
5614ba00
...
@@ -39,6 +39,8 @@ enum id_3dview_frm
...
@@ -39,6 +39,8 @@ enum id_3dview_frm
ID_MENU3D_SOLDER_MASK_ONOFF
,
ID_MENU3D_SOLDER_MASK_ONOFF
,
ID_MENU3D_COMMENTS_ONOFF
,
ID_MENU3D_COMMENTS_ONOFF
,
ID_MENU3D_ECO_ONOFF
,
ID_MENU3D_ECO_ONOFF
,
ID_MENU3D_SHOW_BOARD_BODY
,
ID_MENU3D_REALISTIC_MODE
,
ID_END_COMMAND_3D
,
ID_END_COMMAND_3D
,
ID_TOOL_SET_VISIBLE_ITEMS
,
ID_TOOL_SET_VISIBLE_ITEMS
,
...
...
3d-viewer/info3d_visu.cpp
View file @
5614ba00
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
// Thickness of copper
// Thickness of copper
// TODO: define the actual copper thickness by user
// TODO: define the actual copper thickness by user
#define COPPER_THICKNESS KiROUND( 0.035 * IU_PER_MM ) // for 35
µ
m
#define COPPER_THICKNESS KiROUND( 0.035 * IU_PER_MM ) // for 35
u
m
#define TECH_LAYER_THICKNESS KiROUND( 0.04 * IU_PER_MM )
#define TECH_LAYER_THICKNESS KiROUND( 0.04 * IU_PER_MM )
#define EPOXY_THICKNESS KiROUND( 1.6 * IU_PER_MM ) // for 1.6 mm
#define EPOXY_THICKNESS KiROUND( 1.6 * IU_PER_MM ) // for 1.6 mm
...
@@ -124,8 +124,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
...
@@ -124,8 +124,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
m_EpoxyThickness
*
layer
/
(
copper_layers_cnt
-
1
);
m_EpoxyThickness
*
layer
/
(
copper_layers_cnt
-
1
);
}
}
double
zpos_copper_back
=
m_LayerZcoord
[
0
];
#define layerThicknessMargin 1.1
double
zpos_copper_front
=
m_EpoxyThickness
;
double
zpos_offset
=
m_NonCopperLayerThickness
*
layerThicknessMargin
;
double
zpos_copper_back
=
m_LayerZcoord
[
0
]
-
layerThicknessMargin
*
m_CopperThickness
/
2
;
double
zpos_copper_front
=
m_EpoxyThickness
+
layerThicknessMargin
*
m_CopperThickness
/
2
;
// Fill remaining unused copper layers and front layer zpos
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// with m_EpoxyThickness
...
@@ -138,54 +140,44 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
...
@@ -138,54 +140,44 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
for
(
int
layer_id
=
FIRST_NON_COPPER_LAYER
;
layer_id
<
NB_PCB_LAYERS
;
layer_id
++
)
for
(
int
layer_id
=
FIRST_NON_COPPER_LAYER
;
layer_id
<
NB_PCB_LAYERS
;
layer_id
++
)
{
{
double
zpos
;
double
zpos
;
#define NonCopperLayerThicknessMargin 1.1
switch
(
layer_id
)
switch
(
layer_id
)
{
{
case
ADHESIVE_N_BACK
:
case
ADHESIVE_N_BACK
:
zpos
=
zpos_copper_back
-
zpos
=
zpos_copper_back
-
4
*
zpos_offset
;
4
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
ADHESIVE_N_FRONT
:
case
ADHESIVE_N_FRONT
:
zpos
=
zpos_copper_front
+
zpos
=
zpos_copper_front
+
4
*
zpos_offset
;
4
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SOLDERPASTE_N_BACK
:
case
SOLDERPASTE_N_BACK
:
zpos
=
zpos_copper_back
-
zpos
=
zpos_copper_back
-
3
*
zpos_offset
;
3
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SOLDERPASTE_N_FRONT
:
case
SOLDERPASTE_N_FRONT
:
zpos
=
zpos_copper_front
+
zpos
=
zpos_copper_front
+
3
*
zpos_offset
;
3
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SOLDERMASK_N_BACK
:
case
SOLDERMASK_N_BACK
:
zpos
=
zpos_copper_back
-
zpos
=
zpos_copper_back
-
1
*
zpos_offset
;
1
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SOLDERMASK_N_FRONT
:
case
SOLDERMASK_N_FRONT
:
zpos
=
zpos_copper_front
+
zpos
=
zpos_copper_front
+
2
*
zpos_offset
;
1
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SILKSCREEN_N_BACK
:
case
SILKSCREEN_N_BACK
:
zpos
=
zpos_copper_back
-
zpos
=
zpos_copper_back
-
2
*
zpos_offset
;
2
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
case
SILKSCREEN_N_FRONT
:
case
SILKSCREEN_N_FRONT
:
zpos
=
zpos_copper_front
+
zpos
=
zpos_copper_front
+
2
*
zpos_offset
;
2
*
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
default
:
default
:
zpos
=
zpos_copper_front
+
zpos
=
zpos_copper_front
+
(
layer_id
-
FIRST_NON_COPPER_LAYER
+
5
)
*
(
layer_id
-
FIRST_NON_COPPER_LAYER
+
5
)
*
zpos_offset
;
m_NonCopperLayerThickness
*
NonCopperLayerThicknessMargin
;
break
;
break
;
}
}
...
...
3d-viewer/info3d_visu.h
View file @
5614ba00
...
@@ -72,6 +72,8 @@ public:
...
@@ -72,6 +72,8 @@ public:
FL_COMMENTS
,
FL_ECO
,
FL_COMMENTS
,
FL_ECO
,
FL_GRID
,
FL_GRID
,
FL_USE_COPPER_THICKNESS
,
FL_USE_COPPER_THICKNESS
,
FL_SHOW_BOARD_BODY
,
FL_USE_REALISTIC_MODE
,
FL_LAST
FL_LAST
};
};
...
@@ -133,11 +135,14 @@ public: INFO3D_VISU();
...
@@ -133,11 +135,14 @@ public: INFO3D_VISU();
* note: the thickness (Z size) of the copper is not the thickness
* note: the thickness (Z size) of the copper is not the thickness
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
*
*
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
* Note: if m_DrawFlags[FL_USE_COPPER_THICKNESS] is not set,
* and normal mode, returns 0
*/
*/
int
GetCopperThicknessBIU
()
const
int
GetCopperThicknessBIU
()
const
{
{
return
m_DrawFlags
[
FL_USE_COPPER_THICKNESS
]
?
bool
use_copper_thickness
=
m_DrawFlags
[
FL_USE_COPPER_THICKNESS
]
||
m_DrawFlags
[
FL_USE_REALISTIC_MODE
];
return
use_copper_thickness
?
KiROUND
(
m_CopperThickness
/
m_BiuTo3Dunits
)
KiROUND
(
m_CopperThickness
/
m_BiuTo3Dunits
)
:
0
;
:
0
;
}
}
...
@@ -160,7 +165,9 @@ public: INFO3D_VISU();
...
@@ -160,7 +165,9 @@ public: INFO3D_VISU();
*/
*/
int
GetNonCopperLayerThicknessBIU
()
const
int
GetNonCopperLayerThicknessBIU
()
const
{
{
return
m_DrawFlags
[
FL_USE_COPPER_THICKNESS
]
?
bool
use_copper_thickness
=
m_DrawFlags
[
FL_USE_COPPER_THICKNESS
]
||
m_DrawFlags
[
FL_USE_REALISTIC_MODE
];
return
use_copper_thickness
?
KiROUND
(
m_NonCopperLayerThickness
/
m_BiuTo3Dunits
)
KiROUND
(
m_NonCopperLayerThickness
/
m_BiuTo3Dunits
)
:
0
;
:
0
;
}
}
...
@@ -178,6 +185,8 @@ public: INFO3D_VISU();
...
@@ -178,6 +185,8 @@ public: INFO3D_VISU();
GetNonCopperLayerThicknessBIU
()
:
GetNonCopperLayerThicknessBIU
()
:
GetCopperThicknessBIU
();
GetCopperThicknessBIU
();
}
}
bool
IsRealisticMode
()
{
return
m_DrawFlags
[
FL_USE_REALISTIC_MODE
];
}
};
};
extern
INFO3D_VISU
g_Parm_3D_Visu
;
extern
INFO3D_VISU
g_Parm_3D_Visu
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment