Commit Graph

235 Commits

Author SHA1 Message Date
Jeff Young f7333ad64a Update some classnames including archaic zone names. 2020-11-12 10:31:25 +00:00
Ian McInerney 11e6cac42b Introduce EGL backend support for the OpenGL canvas
wxWidgets 3.1.5+ on Linux will compile with the Wayland EGL
canvas as the backend instead of the X11 backend. This requires a
version of GLEW compiled with the proper EGL defines and a different
header/code for certain parts that are X11 GLEW specific.

This introduces an in-tree version of GLEW that will be built with the
GLEW_EGL flag then statically linked into the KiCad executables when
EGL support is needed.
2020-11-11 00:41:02 +00:00
Mario Luzeiro e105451f44 3D-Viewer: when possible, uses only the board edges to calculate boundings
Add Report messages to Raytracing

Fixes https://gitlab.com/kicad/code/kicad/issues/6316
2020-11-10 17:32:24 +00:00
Mario Luzeiro 753383d6ec 3D-Viewer: disable layer subtraction operations on non realistic mode 2020-11-10 14:40:42 +00:00
Roberto Fernandez Bautista ae26c92a16 Remove modal message box when catching exceptions in EDA_3D_CANVAS::DoRePaint
Rely on the wxInfobar instead
2020-11-07 15:39:57 +00:00
Roberto Fernandez Bautista 1bbc569151 Fix DoRePaint routine in EDA_3D_CANVAS
- Check that we aren't already painting (return if we are)
 - Check that GLEW functions exist before calling them in 3D canvas and throw exception if they are no longer available
 - Catch above exceptions in paint routine and show an infobar message to the user
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6246
2020-11-07 15:39:57 +00:00
Mario Luzeiro 89fea36ddd 3D-Viewer: OpenGL, remove outline polygons where it intersects a hole at edge of board 2020-11-06 20:21:40 +00:00
Mario Luzeiro b06db80151 3D-Viewer: raytracing, implement an outline board cut
it cut board items that are outside and on the edge of the board.
Allows castellations render.
2020-11-06 20:21:40 +00:00
Marek Roszko 304e5faf36 Move wxStringSplit to kicad_string 2020-10-24 00:17:07 -04:00
Jeff Young cce557b9ad Redo the board-edge-building logic to return better error reports.
Fixes https://gitlab.com/kicad/code/kicad/issues/6119
2020-10-22 21:29:04 +01:00
Seth Hillbrand f8a4edb1c9 First pass renaming module to footprint
This is mostly in comments and the few remainin text strings that
reference module
2020-10-20 20:49:11 -07:00
Seth Hillbrand 4085757aeb Remove beginning/ending spaces in translations
Adding space padding makes translations more difficult by increasing
string counts
2020-10-20 12:08:04 -07:00
Jeff Young 1703729269 Require explicit decl of maxError and errorLocations.
This should reduce both performance issues and clearance issues.
2020-10-13 13:49:07 +01:00
Mario Luzeiro d31c5c41e6 3D-Viewer: add an infobar to the panel preview 2020-10-06 10:42:46 +00:00
Mario Luzeiro 1cbe8fcc1f 3D-Viewer: check for minimum required version of OpenGL
Fixes https://gitlab.com/kicad/code/kicad/issues/5286
2020-10-06 10:42:46 +00:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Jeff Young 7a4900b8dc PCB_LINE_T -> PCB_SHAPE_T and PCB_MODULE_EDGE_T -> PCB_FP_SHAPE_T
Also updated footprint text and zone types for consistencey.
2020-10-04 16:49:04 +01:00
Jeff Young 3c01147f10 Fix 3D hole knock-out of silkscreen.
It still doesn't knock-out the board edges, but this is a good first
step.

Fixes https://gitlab.com/kicad/code/kicad/issues/4837
2020-10-01 11:49:28 +01:00
Ian McInerney a5ed5e5675 Handle single line segments on footprint edgecuts
Also, only display an infobar message for footprints when
there is no footprint loaded (instead of if the outline
isn't closed).

Fixes https://gitlab.com/kicad/code/kicad/issues/4866
2020-09-30 23:34:04 +01:00
Seth Hillbrand bf3cb0b1d0 Standardize pad type enums 2020-09-30 08:38:35 -07:00
Jeff Young d3f8f2b81e Remove confusion between pad->IsOnLayer and pad->IsPadOnLayer 2020-09-30 11:50:51 +01:00
Mario Luzeiro ab57c93c98 3D-Viewer: add selection color as an option 2020-09-28 02:26:25 +00:00
Mario Luzeiro ec3c20bf84 3D-Viewer: do not use selection while on preview 2020-09-28 02:26:25 +00:00
Mario Luzeiro 10676eb926 3D-Viewer: only show intersection information while using opengl 2020-09-28 02:26:25 +00:00
Mario Luzeiro 6bc19dbfe9 3D-Viewer: intercect modules and cooper items
show module and net information.
highlight shapes when selected.
2020-09-28 02:26:25 +00:00
Mario Luzeiro 0ab82ef66a 3D-Viewer: add an option to enable render of plated pads
by default this option is disabled and will render as in previous
version.
2020-09-27 13:35:55 +00:00
jean-pierre charras 0b03d8a5ff Fix a few Coverity warnings. 2020-09-20 16:30:23 +02:00
Jon Evans e9b627bfd8 ADDED: Center marker dimension type 2020-09-16 20:55:11 -04:00
Jon Evans 75ffce1a0b ADDED: Leader dimension object
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5555
2020-09-15 23:37:38 -04:00
Jon Evans b11e315d10 Refactor DIMENSION to hide internal details; add some new properties
This is a board file format change to account for the new properties.
Also, we now only store the critical information about the dimension's
geometry in the board, rather than storing every drawn line.

The DIMENSION object is now an abstract base, and ALIGNED_DIMENSION
is the implementation that exists today (we will add more dimension
types in the future)
2020-09-11 21:12:36 -04:00
Jeff Young e2bc7557cc Clean up arc/circle polygonization.
1) For a while now we've been using a calculated seg count from a given
maxError, and a correction factor to push the radius out so that all
the error is outside the arc/circle.  However, the second calculation
(which pre-dates the first) is pretty much just the inverse of the first
(and yields nothing more than maxError back). This is particularly
sub-optimal given the cost of trig functions.

2) There are a lot of old optimizations to reduce segcounts in certain
situations, someting that our error-based calculation compensates for
 anyway.  (Smaller radii need fewer segments to meet the maxError
condition.) But perhaps more importantly we now surface maxError in the
UI and we don't really want to call it "Max deviation except when it's
not".

3) We were also clamping the segCount twice: once in the calculation
routine and once in most of it's callers.  Furthermore, the caller
clamping was inconsistent (both in being done and in the clamping
value). We now clamp only in the calculation routine.

4) There's no reason to use the correction factors in the 3Dviewer;
it's just a visualization and whether the polygonization error is
inside or outside the shape isn't really material.

5) The arc-correction-disabling stuff (used for solder mask layer) was
somewhat fragile in that it depended on the caller to turn it back on
afterwards.  It's now only exposed as a RAII object which  automatically
cleans up when it goes out of scope.

6) There were also bugs in a couple of the polygonization routines where
we'd accumulate round-off error in adding up the segments and end up with
an overly long last segment (which of course would voilate the error
max). This was the cause of the linked bug and also some issues with vias
that we had fudged in the past with extra clearance.

Fixes https://gitlab.com/kicad/code/kicad/issues/5567
2020-09-11 11:23:49 +01:00
Mario Luzeiro e288218c4f 3D-Viewer: subtract pads poly to F_Cu and B_Cu poly layers 2020-09-08 21:02:20 +00:00
Mario Luzeiro 1ab968e72f 3D-Viewer: render different materials plated and non plated copper
implement on OpenGL
2020-09-08 21:02:19 +00:00
Mario Luzeiro 3544bc09fd 3D-Viewer: remove not used inner holes containers 2020-09-08 21:02:19 +00:00
qu1ck 636285311e Make DRAWSEGMENT::GetRectCorners return vector
... instead of modifying the argument.
This will make the method usable in python API and will not incur
permormance penalty because named return value optimization (NRVO)
is a thing since C++11.
But even if copy is not elided vector is moved instead of copied.
https://en.cppreference.com/w/cpp/language/copy_elision
2020-09-07 05:33:10 +00:00
Mario Luzeiro 306a8f57f7 3D-Viewer: Parameterize sampling options 2020-09-04 15:12:01 +00:00
Mario Luzeiro 820e3089a2 3D-Viewer: use the correct opacity meaning in the color settings 2020-09-01 01:08:38 +00:00
Mario Luzeiro 40d5746df6 3D-Viewer: Parameterize body board transparency
Fix/workarround raytracing render issues related with refraction
2020-09-01 01:08:38 +00:00
Mario Luzeiro 0302fe5570 3D-Viewer: Parameterize soldermask transparency 2020-09-01 01:08:37 +00:00
Jeff Young 56a531109a Don't try and shrink shapes generated from pads.
It ends up being different from shrinking the final outline.
2020-08-28 20:48:47 +01:00
Jeff Young b65bb8e7a8 Fix some out-of-order parameters that compiler didn't catch.
Fixes https://gitlab.com/kicad/code/kicad/issues/5363
2020-08-28 15:17:45 +01:00
Jeff Young ebb9a636fa Handle differential x:y clearance for solder mask.
Fixes https://gitlab.com/kicad/code/kicad/issues/5363
2020-08-28 14:00:37 +01:00
Jeff Young 2c4269d03e When inflating dummy pad make sure to reset clearance to zero.
And, the inflate-dummy-pad hack doesn't work for custom pad shapes,
so turn it off there.

Fixes https://gitlab.com/kicad/code/kicad/issues/5363
2020-08-28 11:05:58 +01:00
Jeff Young 9e12ea9bb6 Cleanup some dead code and make better use of iterators.
Also applies coding style around auto and lambdas.
2020-08-28 11:05:58 +01:00
Jeff Young e7db43285f ADDED new footprint fabrication attributes.
This commit also adds mapping of the new symbol properties
"exclude from BOM" and "exclude from board" to be correctly
handled in Update Board from Schematic.

Fixes https://gitlab.com/kicad/code/kicad/issues/2399

Fixes https://gitlab.com/kicad/code/kicad/issues/4643

Fixes https://gitlab.com/kicad/code/kicad/issues/2233
2020-08-28 11:05:58 +01:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Jeff Young 66ff16dd3d Better board-edge error reporting.
Fixes https://gitlab.com/kicad/code/kicad/issues/4950
2020-08-17 23:55:31 +01:00
Mario Luzeiro 78ac675316 3D-Viewer: parameterize raytracing lights, add it to options dialog
Remove some hacks related to postprocessing (not need now because the
previous postprocessing improvements, light parametrization could be
used for tune or future parameters could be implemented)
2020-08-15 09:41:34 +01:00
jean-pierre charras ffabc17372 style cleanup and a few comments added. 2020-08-13 14:17:53 +02:00
Jeff Young 393bb0fd83 Fix assert where geometry routine wasn't ready to handle layers.
This introduces layer handling to a lot of the geometry routines.
Many of them don't do much with it now, but it does help multi-layer
zones and will help when padstacks are implemented.
2020-08-12 22:20:08 +01:00
Jeff Young 463100d67f Remove a long-standing hack to keep divots out of adjacent zones.
The new algorithm unions any adjacent zones before doing the
chamfer/fillet and then subtracts the other zones back out afterwards.

Fixes https://gitlab.com/kicad/code/kicad/issues/3812
2020-08-12 22:20:08 +01:00
jean-pierre charras 29d6fe88f0 3D viewer: do not show via/pad shapes of pads not connected on copper layers.
Show the same vias/pad shapes as plot functions.
2020-08-11 11:26:00 +02:00
Tomasz Wlostowski 89a953e039 Migrated GetEffectiveShape(s) to SHAPE_COMPOUND 2020-07-29 23:14:03 +02:00
Jeff Young bf445c1a95 Performance enhancements.
1) cache pad polygon outlines
   huge improvement in connectivity performance and a decent
   improvement in DRC performance
2) don't pre-allocate CONTEXT stack
   significant improvement in DRC rule performance
2) don't keep re-encoding strings
   decent improvement in DRC rule performance
2020-07-25 13:03:33 +01:00
Joshua Redstone ad99d85390 3d-viewer: add option to clip silkscreen around via annular ring
Add more conservative clipping of silkscreen layers around vias.
Clips at outside of annular ring rather than outside of copper plating.
2020-07-16 22:36:06 +00:00
jean-pierre charras 55f4c2b167 Removing creation of a wxPaintEvent instance (step 2), not allowed in 3.1.4 wxWidgets:
Remove wxPaintEvent creation in 3D viewer
2020-07-14 15:52:01 +02:00
jean-pierre charras eab98eee1d 3D viewer: use the full board bounding box to define the visible area.
Remove also a printf now useless, used for debug.

Fixes #4815
https://gitlab.com/kicad/code/kicad/issues/4815
2020-07-07 11:40:35 +02:00
Jeff Young d85a707385 Move rest of DRC to SHAPE collision architecture. 2020-07-06 20:00:50 +01:00
Seth Hillbrand 3bf7cf2b54 Add VSYNC to 3d viewer 2020-07-03 21:43:49 -07:00
Seth Hillbrand a210fd570f Set VSYNC to adaptive (if available)
Swap syncs can limit the redraw rate as the screen waits for previously
issued syncs.  Setting this to -1 allows for adaptive swapping
(resorting to unsynced if it falls behind) if it is supported by the
card but will fall back to unsynced (0) if the adaptive is not
supported.

Fixes https://gitlab.com/kicad/code/kicad/issues/4226
2020-07-03 13:27:48 +00:00
Jon Evans c0aa6965de Migrate PcbNew project settings to new framework
Various architecture upgrades to support this.
Creating a BOARD now requires a valid PROJECT, which caused
some (mostly transparent) changes to the Python API internals.

ADDED: Project local settings file
CHANGED: Board design settings are no longer stored in PCB file
CHANGED: Net classes are no longer stored in PCB file
CHANGED: Importing board settings now reads boards, not just projects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2578
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4070
2020-07-02 22:08:54 -04:00
Seth Hillbrand d663be853f Explicitly add signed/unsigned comparison to warnings 2020-07-02 10:54:34 -07:00
Jeff Young 40a72d9530 Add SH_RECT handling to 3D shape conversion.
Also add some debugging for not-implemented shape cases in other
places to catch simmilar issues in future.

Fixes https://gitlab.com/kicad/code/kicad/issues/4757
2020-06-30 18:32:31 +01:00
Jon Evans 0d4ee39f75 CHANGED: Copper zones can be on more than one layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1963
2020-06-28 08:52:37 -04:00
Jeff Young d01b29ab37 Cleanup pad geometry handling.
There were a lot of plotters, exporters, etc. that were rolling their
own implementations.

This also introduces a lazily-built set of SHAPE objects for doing
collision detection and some forms of rendering (and later DRC).
2020-06-22 22:28:37 +01:00
Jeff Young 970921f88b Support for filled DRAWSEGMENT::S_RECT and S_CIRCLE.
One more step in unifying pad primitives and draw segments.
2020-06-20 14:34:53 +01:00
Seth Hillbrand 08c61e6788 Ensure triangulation follows moving zone
Dragging filled zones in OpenGL was extremely slow due to the
invalidated triangulation cache.  Moving the zone should also move the
triangles and keep the cache valid.
2020-06-17 19:43:11 -07:00
Jeff Young aeed8e6e2c Finish implementation of DRAWSEGMENT::C_RECT.
It's currently only supported in the Footprint Editor.  It could be
easily added to the board editor (all the code is there), but the board
editor is a little short on room in the drawing tools toolbar.
2020-06-15 20:51:31 +01:00
Electro707 4a3743e7dd 3D viewer flip action 2020-06-08 21:35:40 +00:00
Ian McInerney 4357c1d3b3 Coverity and compiler warning fixes
* Initialize variables
* Test dynamic casts

Fixes https://gitlab.com/kicad/code/kicad/issues/4620
2020-06-05 12:50:56 +01:00
Ian McInerney d46f9a5273 Give the 3D viewer an infobar & Infobar upgrades
ADDED: Infobar warning in 3d viewer for board outline issues
2020-06-04 00:13:27 +01:00
Jeff Young 874f13e29e Fix some issues with rotated oval pads. 2020-05-01 18:49:42 +01:00
Emery Burhan e20e45fa54 3d_viewer: Added Animation Speed option
ADDED: Option to set the speed of and enable/disable 3d viewer animations
2020-04-24 23:58:50 +00:00
Mario Luzeiro 00da17bc7d 3D-Viewer: Add new options: Anti-aliasing quality, "While moving"
Create new window options with tabs for 3D-Viewer. Remove
"showCopperThickness" option from menus and place it on OpenGL options.
2020-04-23 09:29:39 +00:00
Ian McInerney e528769637 Move TOOLS_HOLDER into tools/ folder
Also clean up some compiler warnings
2020-04-19 01:51:49 +01:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Simon Richter 99c1d7cf96 Add noexcept to some functions in the 3d viewer. 2020-04-16 16:11:21 +00:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
jean-pierre charras 2c8ada42a0 Arc shaped track segments: fix 3D viewer and track to polygon converter. 2020-04-09 10:37:17 +02:00
jean-pierre charras 00d9e77e7f 3D viewer: fix a minor problem: to many rotations when typing Shift+z or Shift+y
more than once.

Fixes #4135
https://gitlab.com/kicad/code/kicad/issues/4135
2020-03-31 17:35:45 +02:00
Jeff Young 5134856f18 Rationalise 3D settings data-structure.
Move the camera out to its own so that everything else is board-
related, and then rename BOARD_ADAPTER.

At some point the flags should probably be moved out too, and they
can have the EDA_3D_SETTINGS name.
2020-03-28 16:09:40 +00:00
jean-pierre charras 04d6ea982d 3D viewer: fix an issue with solder paste layer having negative clearance.
The code tried to draw outlines with segments having a negative thickness.
It happens mainly on solder paste layers.

Fixes #4090
https://gitlab.com/kicad/code/kicad/issues/4090
2020-03-26 13:46:14 +01:00
Jeff Young ba36fc0009 Fix some Coverity issues. 2020-03-25 14:38:43 +00:00
jean-pierre charras 5f7bcb9c34 3D viewer: fix a minor issue in solder paste rect pads:
the solder paste mask clearance was no taken in account for rect and trap shapes.
2020-03-25 13:04:30 +01:00
Jeff Young d69ebfae49 Push tool framework base down into TOOL_HOLDER.
This allows us to use it outside of EDA_BASE_FRAMEs (in this case, in
PANEL_PREVIEW_3D.)
2020-03-24 19:00:25 +00:00
Jeff Young 103b0c18de Hook up a few more 3D commands missed in last commit.
Fixes https://gitlab.com/kicad/code/kicad/issues/4074
2020-03-21 01:29:30 +00:00
Jeff Young e9cd9ee8ff Actionize the rest of the 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/issues/2228
2020-03-19 15:10:32 +00:00
jean-pierre charras b7cd0c54c2 Fix compil issues, especially on Windows:
Replace SEVERITY_ERROR by RPT_SEVERITY_ERROR to avoid collision with a system definition.
Replace other SEVERITY_XXX by RPT_SEVERITY_XX for consistency.
Fix compil warnings and some other compil issues.
2020-03-04 10:48:18 +01:00
Jeff Young 85c2e0d23a Add user-defined severities, exclusions and colors to DRC markers.
Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-04 00:39:28 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
jean-pierre charras 0049185d06 Eeschema: Speed up global changes in DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS.
Previously, OnModify() was called for a lot of items, even when not modified.
For large schematics, the calculation time was unreasonable ( several minutes)
It is now called only a few times.
2020-02-04 14:04:11 +01:00
Ian McInerney 5053f58bfc Move 3d viewer board outline warning to the status bar
This is less intrusive than a dialog that is constantly opening
whenever the 3d view is refreshed.
2020-02-03 22:09:14 +00:00
Mario Luzeiro 970a0a593a 3d-viewer, add an option to subtract Mask from Silk
Remove holes on Silk layer by default so the behaviour is the same
on OpenGL and Raytracing.
Fixes #1836
Fix raytracing shadow offset issue.
Some codestyle fix.
2020-01-29 16:00:05 +00:00
Fabien Corona 183bbf6914 3d-viewer : synchronise colours with board stackup.
ADDED: 3d-viewer can now look up colours defined in board properties

Fixes https://gitlab.com/kicad/code/kicad/issues/2261
2020-01-22 22:38:30 +00:00
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Seth Hillbrand 84048262bd Descope KB defines
The 3d viewer is the last component to not use the action framework, so
we descope the common defines to its canvas.  Once the 3d viewer is
converted, we can remove these entirely.
2020-01-06 05:43:18 -08:00
Mark Roszko b11d52eda1 Scope 3d viewer enums
Also fix one rogue character in a gerbview file that wasn't proper UTF8.
2019-12-30 13:01:06 +00:00
Jeff Young 9d0198bade Easier control of zoom in 3D viewer.
Go to 3 steps per doubling (instead of 2), and start at 2/3 instead
of 1/2.
2019-12-28 11:58:33 +00:00