Commit Graph

746 Commits

Author SHA1 Message Date
Seth Hillbrand 89d2e67e45 3d-viewer: Refresh raytracing on rotate 2019-04-09 15:01:06 -07:00
Seth Hillbrand 707e7b4b65 3d-viewer: Force canvas refresh before screenshot
In some linux configurations, the canvas refresh must be posted before
being handled.  Simply requesting the refresh can queue the event,
preventing an up to date GL canvas from being saved.

Fixes: lp:1819536
* https://bugs.launchpad.net/kicad/+bug/1819536
2019-04-09 14:47:11 -07:00
John Beard 8548e69382 3D viewer: update icons from common settings
Use the icon scaling logic and call a toolbar rebuild when the
common settings change (echos the handling in Pcbnew and friends).

Remove an unused function.
2019-04-08 14:29:15 +01:00
John Beard 124dd5e59a 3D viewer: use hi-DPI settings for canvases
The 3D viewer also uses OpenGL, so it also needs to
adjust based on DPI scale factors.

This patch moves the 3D viewer common config code solely
within the 3D viewer, and adds handling of the DPI scale. This
also avoids duplicated logic in PCB_BASE_FRAME::CommonSettingsChanged.

For now, as EDA_3D_VIEWER is not included in the Kiway settings
dispatch, still manually invoke the settings update from
PCB_BASE_FRAME.

The PANEL_3D_PREV gets a similar function to read the config, but
it doesn't have a listener for the update, so it's set just once
at dialog init, just like the existing pan settings.

Fixes: lp:1823681
* https://bugs.launchpad.net/kicad/+bug/1823681
2019-04-08 14:29:15 +01:00
Jeff Young 1ae47b6069 Implement a copper-to-edge-clearance setting.
For legacy boards, the setting is picked up from the board outline
thickness.  If the board outline has mixed thicknesses, then the
max is used and a warning is displayed.

Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
2019-04-05 22:18:44 +01:00
jean-pierre charras d259459a14 Pcbnew: add a new primitive pad shape: chamfered round rect pad.
Allows 0 to 4 chamfered corners, not only one.

A custom shape allow this kind of shape. However because it is a primitive,
it is easier to edit and it support thermal reliefs.
2019-03-11 10:26:15 +01:00
Jeff Young e71b215963 Restore 3D canvas to full size on Retina displays. 2019-02-19 16:18:11 -07:00
John Beard e6a6266f3d Build: libpolygon provides its own includes
Libpolygon can provide its own includes via target_include_dirs PUBLIC.
This means any linking targets do not need to specifiy them manually.

As common requires polygon, the polygon dep is also now no longer
required downstream of libcommon, as it's transisitvely implied
by libcommon's target_link_libraries.

This resolves a circular dependency previously detected and also
simplifies CMakeLists.
2019-02-04 19:29:31 -08:00
Seth Hillbrand 4a641ec5ea 3d-viewer: Center the about window
Fixes: lp:1814412
* https://bugs.launchpad.net/kicad/+bug/1814412
2019-02-04 07:18:52 +01:00
jean-pierre charras 098d9bf056 3D viewer: Fix: board outlines ignored in 3D for triangular board shapes
Fix also a few minor coding style issues.

Fixes: lp:1814324
https://bugs.launchpad.net/kicad/+bug/1814324
2019-02-02 17:59:53 +01:00
jean-pierre charras 4543bde56b Minor enhancements in 3D viewer hotkey code 2019-01-31 21:03:38 +01:00
Wayne Stambaugh 75f18cfe62 3D Viewer: disable ray tracing for OpenGL less than 2.1.
Add code to parse OpenGL version string and determine if ray tracing is
supported.

Rationalize ray tracing menu and toolbar to have the same behavior so
a single command ID can be used for setting states.

Fixes lp:1797500

https://bugs.launchpad.net/kicad/+bug/1797500
2019-01-19 08:03:09 -05:00
Wayne Stambaugh 4f0749b0b4 3D viewer: fix update UI event infinite loop.
Lay groundwork to fetch OpenGL version for disabling ray tracing when the
current OpenGL version lacks proper support.
2019-01-13 14:05:21 -05:00
Seth Hillbrand 6f5a7b3ab7 3d-viewer: Clear memset warnings
C++11 can clear by empty copy-constructor
2019-01-09 21:43:23 -08:00
jean-pierre charras 3dd5a912b6 remove dead code. 2019-01-07 19:42:18 +01:00
Seth Hillbrand 1e5ba6f1b1 Replace DIM() macro
The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time.  Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
2019-01-06 08:43:12 -08:00
Seth Hillbrand 3b54a44540 wildcard strings update
Replace a few other cases where we used Windows-only or *nix specific
wildcard strings
2019-01-05 20:26:45 -08:00
Seth Hillbrand a46f5c3af5 3d-viewer: Clamp inner radius of rings
Thick segments can cause radius to be set negative.  Effective radius of
these segments should be 0.

Fixes: lp:1803797
* https://bugs.launchpad.net/kicad/+bug/1803797
2019-01-04 16:49:21 -08:00
Seth Hillbrand 25f8b1ce72 pcbnew: Update multiple zone segments
Where we can get away with lower segment counts (localizing an anchor),
we keep the low-def 16 segment count.  Intermediate values and values
that are visible to the user are set to high definition.  Most are
simply hints to the inflation correction but where they show, the user
show see smooth lines.
2019-01-03 17:34:59 -08:00
Seth Hillbrand 6662891f34 string update: Help->List hotkeys
The hotkey name "Help (this window)" does not describe what the hotkey
and associated action does.  It displays the current hotkey list, so the
action name should reflect that behavior
2019-01-02 15:44:13 -08:00
Stefan Brüns 9490fd9d30 Use absolute path CMAKE_INSTALL_FULL_LIBDIR for 3d viewer PLUGINDIR
Currently, the plugindir in the plugin manager is constructed as
{CMAKE_INSTALL_PREFIX}/bin/../{CMAKE_INSTALL_LIBDIR}/kicad/..., while
CMakes install uses {CMAKE_INSTALL_LIBDIR}/kicad/...

In case CMAKE_INSTALL_LIBDIR is a relative path "install" prefixes it
with CMAKE_INSTALL_PREFIX and both paths happen to match, otherwise
the constructed path ends up as e.g. "/usr/bin/../usr/lib/kicad/...".

For these cases where an absolute path is wanted CMake provides the
CMAKE_INSTALL_FULL_<dir> variants which works the same as
CMAKE_INSTALL_<dir> when used as DIRECTORY for install.
2018-12-11 14:28:01 -05:00
Seth Hillbrand 0769b0409f 3d-viewer: Remove threading on middle layer
The middle layer of the 3d contours does not need threading as it does
not have substantial calculations.  It also contains has a few
wx*Asserts that may not be called from other than the main thread.
Rather than remove useful error checking, we remove excess threading.

Fixes: lp:1802940
* https://bugs.launchpad.net/kicad/+bug/1802940
2018-12-10 19:51:32 -08:00
Seth Hillbrand 47fe01f793 3d-viewer: Remove duplicate call
Simplify is called by GetBoardPolygonOutlines(), it does not need to be
called a second time.
2018-12-09 07:52:58 -08:00
Wayne Stambaugh c7998cfc23 3D Viewer: fix screenshot file extension bug with GTK+
Append the appropriate file extension to the file name if the file name
does not have a file extension.  This is a know issue with the GTK+ file
dialog.

Make the last 3D viewer screenshot last file used code more coherent.

Add the 3D viewer main frame trace string to the trace environment
variables doxygen group.

Doxygen comment and other minor code cleaning.

Fixes lp:1804980

https://bugs.launchpad.net/bugs/1804980
2018-12-08 08:20:32 -05:00
jean-pierre charras 90139d540c 3D viewer: Fix hanging when a board is displayed in non realistic mode and the body is not shown. 2018-11-26 15:58:54 +01:00
jean-pierre charras a3b82d770e dialog_3D_view_option_base.cpp: fix a minor wxWidgets alert. 2018-11-26 14:49:06 +01:00
jean-pierre charras 65a967dca1 Fix minor I10n issues. 2018-11-18 14:40:36 +01:00
Jeff Young bcc8c64256 Consider edge cuts items to have zero width when filling zones.
Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
2018-11-14 23:45:32 +00:00
Mario Luzeiro 350a6052c0 Fixes 3D Viewer: Raytracing line artifact, lp:1680530 2018-11-14 09:46:03 -05:00
John Beard e52688586a Don't use memset to initialise aggregate of floats.
In C3D_RENDER_OGL_LEGACY::setupMaterial(), the struct
m_materials (which is made up of floats and glm::vec3f's)
is initialised with a memset to 0. This is unsafe, as
floating point value representations in C++ are implementation-
defined (so 0 in memory is not 0-valued for sure).

Use empty-brace aggregate-initialisation, which does the right thing.
2018-11-13 13:37:59 -05:00
jean-pierre charras 830c5e7db7 3D viewer: ensure 0 sized circles (that crash the viewer) are skipped. 2018-11-05 08:30:54 +01:00
Seth Hillbrand df562b7ec0 pcbnew: Prevent degenerate values in Eagle import
Importing Eagle files allowed for invalid zone values for clearance and
minimum width that triggered asserts in the 3d-viewer.

Fixes: lp:1801188
* https://bugs.launchpad.net/kicad/+bug/1801188
2018-11-04 11:01:08 -08:00
Simon Richter abe1ffabda Replace WIN32 preprocessor symbol by the official symbol _WIN32, used almost everywhere 2018-10-20 09:22:24 +02:00
jean-pierre charras 7df4ddc74d Use our DIALOG_COLOR_PICKER in 3D viewer to set a color.
the wxWidgets color picker is not the best for the 3D viewer that does not use transparency color.
2018-10-13 08:23:14 +02:00
jean-pierre charras dbc9130da9 Fix: 3D footprint preview does not zoom using mouse wheel (Windows specific)
This was due to clicking on the preview canvas does dot give the focus to the canvas on Windows.
Now the focus is set when clicking on this canvas.

Fixes: lp:1794090
https://bugs.launchpad.net/kicad/+bug/1794090
2018-10-12 13:41:44 +02:00
Seth Hillbrand ddea4e11d1 3d-viewer: Fix intersection bug
Bounding box check always returned false, leading to incorrect BBox
checks when one bbox is interior to the other
2018-10-11 14:47:06 -07:00
Tomasz Wlostowski e439b17fa1 eeschema-gal: make sure all other Kicad apps compile after eeschema gal hacks 2018-10-09 11:08:52 +01:00
Jeff Young 86b654e493 Hook up 3D viewer to common preferences.
Also removes nanny limits on text sizes.

Fixes: lp:1794093
* https://bugs.launchpad.net/kicad/+bug/1794093

Fixes: lp:1794345
* https://bugs.launchpad.net/kicad/+bug/1794345
2018-09-25 20:47:03 +01:00
Seth Hillbrand f8784f30a8 Removing OpenMP
This commit finishes the removal of OpenMP from the KiCad codebase.
Removed in this commit are the OpenMP calls in 3d-viewer and
qa/polygon_triangulation as well as all references in CMakeLists.txt

std::thread is used instead for multithreaded computation
2018-09-21 12:44:20 -07:00
Seth Hillbrand d139a49690 3d-viewer: corrected rrect zero-length radius
Previous commit mistakenly included the full clearance for the rounded
rectangle circle.  The CFILLEDCIRCLE2d takes the radius rather than the
diameter.
2018-09-20 08:52:41 -07:00
Seth Hillbrand 8efcf81cf5 3d-viewer: Approximate 0-length element is rrect
Apply same logic of using a filled circle to represent a zero-length
element as a filled circle with radius of the line.

Fixes: lp:1785823
* https://bugs.launchpad.net/kicad/+bug/1785823
2018-09-19 20:19:37 -07:00
Seth Hillbrand 8999f4604f 3d-viewer: Require simplified polygons
3d viewer requires simplified polygons not just for triangulation but
also for its own internal routines.

Fixes: lp:1793085
* https://bugs.launchpad.net/kicad/+bug/1793085
2018-09-18 09:35:30 -07:00
Jeff Young 02a3f83040 Implement poor-man's RTTI for use over KiWAY.
Fixes: lp:1777883
* https://bugs.launchpad.net/kicad/+bug/1777883
2018-09-15 20:06:42 +01:00
jean-pierre charras df5aafc481 3D viewer: Better axis rotation when selecting "Bottom view"
It allows keeping texts on bottom side readable (rotation similar to the Flip board view in board editor)
2018-09-13 09:03:58 +02:00
Seth Hillbrand c1c89d13ff 3d-viewer: Check for at least 3 segments in circle
Fixes: lp:1792173
* https://bugs.launchpad.net/kicad/+bug/1792173
2018-09-12 19:34:55 +01:00
Maciej Suminski 18c38bd60e Fixed a shadowed variable warning 2018-09-10 10:06:17 +02:00
Seth Hillbrand a6325aab29 Replacing Tesselation
Replaces Poly2Tri with updated code to process polygons faster and more
robustly.  Notably, we can now handle overlapping holes in the polygons,
allowing us to cache the triangulation of complex boards
2018-09-01 19:30:50 -07:00
Wayne Stambaugh 825f57d912 Fix build error with Boost 1.68.
The Boost folks kindly decided to move the sha1.hpp header file location
so check the Boost version to include the proper header path.

Clean up debug trace code.
2018-08-24 08:34:45 -04:00
Jeff Young d81faa72c9 Overhaul border drawing in all the Kicad frames.
Primary change is to replace most control/window borders with
AUI pane borders.  We implement our own AUI border drawing
routine which avoids the ugly one-pixel white frames around
dark canvasses.

Also increases the signal-to-noise ratio of all the pane
creation code in the various frames.
2018-08-11 17:25:38 +01:00
Wayne Stambaugh 8e7d6063fd Minor dialog and frame window improvements.
Drop all uses of wxRAISED_BORDER and wxSUNKEN_BORDER from dialogs and
panels used in main frame windows.

Drop use of wxSP_3DSASH options on all wxSplitterWindow definitions.

Minor dialog alignment and spacing fixes.
2018-08-02 13:00:41 -04:00