Commit Graph

1123 Commits

Author SHA1 Message Date
Mario Luzeiro 10676eb926 3D-Viewer: only show intersection information while using opengl 2020-09-28 02:26:25 +00:00
Mario Luzeiro 3f2cada6c6 3D-Viewer: fix a bug introduced in the previous commits 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 a1e94c2583 3D-Viewer: request a redraw when a footprint is selected in pcbnew 2020-09-28 02:26:25 +00:00
Mario Luzeiro fe51cc947c 3D-Viewer: render 3D shapes in green if footprint is selected 2020-09-28 02:26:25 +00:00
Mario Luzeiro c7a546042e 3D-Viewer: add skip material to model loading 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
Ian McInerney fc565edb33 Add a palette to the toolbars to display groups of actions
This adds a palette to toolbar items that displays groups
of actions when long-pressed on a button.
2020-09-27 01:00:44 +01:00
jean-pierre charras 0b03d8a5ff Fix a few Coverity warnings. 2020-09-20 16:30:23 +02:00
jean-pierre charras 6ec6baf401 3d viewer: save color settings.
The call to SaveColorSettings() was not at the right place, and the new
color settings never saved.

Fixes #5529
https://gitlab.com/kicad/code/kicad/issues/5529
2020-09-17 17:15:25 +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
jean-pierre charras 98339cd5eb 3d viewer: fix incorrect calculation of pad hole size of vertical shape.
Fixes #5627
https://gitlab.com/kicad/code/kicad/issues/5627
2020-09-15 10:17:31 +02: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
Seth Hillbrand 08d4e91f3b Change partitions to fixed size
Partititioning small polygons causes excessive partitions when we use a
fixed number of cells per side.  Partitioning by size keeps the
partition count limited and speeds the calculations.

Also adds an option to not partition the grid for elements (like 3d
raytracing) that do not need it.

Fixes https://gitlab.com/kicad/code/kicad/issues/5579
2020-09-10 09:31:20 -07:00
Mario Luzeiro d52c475b27 3D-Viewer: implements plated copper texture
improves copper and board textures.
Related to https://gitlab.com/kicad/code/kicad/-/issues/2058
Use only one PerlinNoise class.
2020-09-08 21:02:20 +00:00
Mario Luzeiro f0edbd088c 3D-Viewer: fixing z-fight issues 2020-09-08 21:02:20 +00: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 d7a95951e1 3D-Viewer: implement nonplated copper on raytracing 2020-09-08 21:02:19 +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
Jeff Young 2251716784 Don't show 3D models with their show flag set to false.
Fixes https://gitlab.com/kicad/code/kicad/issues/5548
2020-09-08 20:42:09 +01: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 2feef44fca 3D-Viewer: Limit the recursive reflection level
Fixes https://gitlab.com/kicad/code/kicad/issues/5426
2020-09-01 01:08:38 +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 7c9bb9ab07 3D-Viewer: add color to "Clear Color" action in the color picker 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
Mario Luzeiro 744a8f011e 3D-Viewer: add button to reset light defaults
Fixes https://gitlab.com/kicad/code/kicad/issues/

Fixes https://gitlab.com/kicad/code/kicad/issues/
2020-08-19 01:57:22 +00: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
Mario Luzeiro 2764a41d96 3D-Viewer: fixes a shadow hit bug 2020-08-18 00:31:35 +00: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
jean-pierre charras 5b365053db Fix a few I18n issues.
Especially, only ASCII7 chars can be used in messages.
Do not mark debug messages as I18n strings
2020-08-17 09:18:49 +02:00
Ian McInerney 45fb030b9b Rename and shorten the names in ACTION_CONDITIONS 2020-08-16 19:10:25 +00:00
Ian McInerney f34ffd3906 Migrate more 3d viewer actions to the tool framework 2020-08-16 19:10:25 +00:00
Ian McInerney 72a1c71e07 Implement a framework to handle wxUpdateUIEvents for tool actions
This allows for the tool framework to keep track of a universal
set of conditions for the UI state (enabled/checked/shown) for
controls of actions. It removes the need for the main menubar
menus to be CONDITIONAL_MENUs and be rebuilt on each open,
and instead makes the updates of the check and enabling of
items handled in the native wxWidgets way.

This commit switchs the 3d viewer and kicad project manager window
over to this system.
2020-08-16 19:10:25 +00: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
Peter Montgomery 4d460ec073 Delete 3D cache files with GUI settable number of days
KiCad stores 3D cache files but never gets rid of any of them.
This patch adds a new function called 'CleanCacheDir()'.  Any cache
files older than the passed 'number of days' parameter are deleted.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1928
2020-08-09 10:41:45 +00: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
Jeff Young 73c6fc8b8b Make opacity box line up with scale, rotation and offset boxes. 2020-07-25 13:03:33 +01:00
Ian McInerney 50b2271f84 Fix missing variable initialization 2020-07-18 23:56:39 +01:00
Jeff Young 3fd0a3f842 Update text variables even when they're changed from other binary.
For instance, you might have PCBNew open but change the variable
value through EEschema > Schematic Setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/4918
2020-07-17 21:05:11 +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
Mario Luzeiro 779ed40588 3D-Viewer: improve SSAO
Implement blur based on depth weights.
Improve occlusion based on direct light/shadow it receives.
Improve occlusion mixing with the final color by using multiply instead
of subtract.
Remove debug and test code.
2020-07-16 11:23:02 +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
Seth Hillbrand e19a7910f8 Revert "Revert "Set DoubleBuffering to reduce flicker""
This reverts commit c18cab6154.
2020-07-13 20:19:10 -07:00
Mario Luzeiro 74c6f6ab82 3D-Viewer: set missing scale and position to the list
Fixes https://gitlab.com/kicad/code/kicad/issues/4826
2020-07-11 16:55:49 +00:00
Mario Luzeiro ef7d7477d0 3D-Viewer: Remove not used list 2020-07-11 16:55:49 +00:00
Seth Hillbrand c18cab6154 Revert "Set DoubleBuffering to reduce flicker"
This reverts commit 106259f6e6.

In its place, we set double buffering to only menubars in an attempt to
find a soluton to #4785

Fixes https://gitlab.com/kicad/code/kicad/issues/4863
2020-07-11 09:43:30 -07: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
Ian McInerney 3bb44f3804 Don't install the import library for the 3dsg library
No one on Windows should be linking to it outside of
the build process, so there is no need for it in the
installer

Fixes https://gitlab.com/kicad/code/kicad/issues/1842
2020-06-30 15:38:41 +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
Ian McInerney fb10406e67 Add right-click context menus for toolbar items 2020-06-26 21:29:03 +00:00
Ian McInerney 52856a8ce4 Move scaled toolbar separator into ACTION_TOOLBAR
* Ensure all separators are scaled separators
* Clean up toolbar creation functions
2020-06-26 21:29:03 +00: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
Ian McInerney 5649558cff Move DPI_SCALING into the GAL from common
It should be owned by the GAL, since it is used
with the OpenGL canvas infrastructure.
2020-06-19 17:02:46 +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
Jeff Young f84406009b Push a couple of layers of indirection out of grid settings. 2020-06-13 11:35:56 +01:00
Electro707 4a3743e7dd 3D viewer flip action 2020-06-08 21:35:40 +00:00
Ian McInerney a9fa592f5f Fix button size on 3d preview panel
Fixes https://gitlab.com/kicad/code/kicad/issues/4626
2020-06-07 15:47:34 +01:00
Ian McInerney 6083c0849f Make the 3d viewer rotation increment configurable
ADDED: Setting for the 3d viewer rotation increment

Fixes https://gitlab.com/kicad/code/kicad/issues/4618
2020-06-07 11:44:07 +01:00
Ian McInerney 9d0ea66a96 Don't use the accelerator table in the menubars
It seems that the accelerator table causes issues with
keyboard events on MSW.

Fixes https://gitlab.com/kicad/code/kicad/issues/1941
2020-06-06 22:50:35 +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
Wayne Stambaugh 0032845f9e Fix clipped bitmap buttons with GTK on Linux.
A note to developers, please do not set the minimum and/or size of bitmap
buttons.  It causes bitmaps to get clipped using GTK on Linux.  If the
bitmap button size is not acceptable, then supply an appropriately sized
bitmap rather than attempt to force the wxWidgets sizing mechanism to do
what you want.  This almost always causes platform differences that do
not work well.
2020-06-03 14:01:44 -04:00
Érico Rolim e9e72bd8e4 Fix sg_version detection for cross compilation
Fixes https://gitlab.com/kicad/code/kicad/issues/4525
2020-05-28 13:05:49 +00:00
Jon Evans a52435bbb0 ADDED: New mouse settings panel, expanded mouse settings
You can now choose the behavior of dragging with the
middle and right mouse buttons.

You can also choose which modifier keys to use for
panning and zooming with the scroll wheel or trackpad.

You can also customize the zoom speed, which makes
it possible to have a good zoom experience on a wider
range of input devices.

You can also now zoom by dragging with the right or
middle button if desired.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3885
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4348
2020-05-24 14:38:28 -04:00
Mario Luzeiro 94ed433f64 3D-Viewer: Fixes #4432
Set default transparency of model from the assigned material.
2020-05-22 13:28:04 +00:00
jean-pierre charras 2215d8a96b 3d viewer: ensure the opengl engine is selected on start.
(the ray tracing engine is too time consuming to be select on start)
2020-05-16 13:18:56 +02:00
jean-pierre charras 3b84653591 3D viewer: avoid crash in raytracing (null pointer use) if layer mask is
not shown and must be removed from silk screen layer.

Fixes #4430
https://gitlab.com/kicad/code/kicad/issues/4430
2020-05-14 11:50:12 +02:00
Simon Richter 632494cba7 Add missing includes
A few more instances of missing <algorithm> for std::max
2020-05-10 00:24:11 +02:00
jean-pierre charras c78e7c5485 Fix compil issues (warnings and missing include) 2020-05-09 08:59:00 +02:00
Jon Evans 7ca069e63e A few formatting fixes 2020-05-08 17:32:06 -04:00
Mario Luzeiro 9446a9166d 3D-Viewer: implement opacity in raytracing
fix opacity implementation on OpenGL
2020-05-08 21:28:16 +00:00
Mario Luzeiro 5a7f875602 3D-Viewer: implements opacity property for 3D models
fixes #2087
2020-05-08 21:28:16 +00:00
Jon Evans 4923d993a7 Factor out raytracing background color calculation 2020-05-07 18:40:06 -04:00
Emery Burhan 6c3cc0cfd4 3d_viewer: Ceiling plane: fixed formatting. 2020-05-07 18:00:55 -04:00
Emery Burhan c665bf69b6 3d_viewer: Added a ceiling plane, similar to the floor plane. 2020-05-07 18:00:55 -04:00
jean-pierre charras a43e4fa163 3D Viewer: Animation Speed setting looks wonky (GTK only)
Fixes #4317
https://gitlab.com/kicad/code/kicad/issues/4317
2020-05-05 10:41:35 +02:00
Wayne Stambaugh 63291141df Pcbnew: minor footprint properties dialog layout improvements. 2020-05-03 11:45:18 -04:00
Jeff Young 874f13e29e Fix some issues with rotated oval pads. 2020-05-01 18:49:42 +01:00
jean-pierre charras 262283995c string fix 2020-04-30 21:03:03 +02:00
jean-pierre charras 93b9be7ebe DLG_SELECT_3DMODEL rework: better dialog (use split window) and fix a few issues. 2020-04-30 19:49:41 +02:00
Jeff Young d2046b17d7 More shrinking of Footprint Properties. 2020-04-27 00:24:57 +01:00
Ian McInerney d006acecf4 More window sizing fixes
* Push all sizing operations into EDA_BASE_FRAME
* Save the unmaximized window size when maximizing
  so that we can then save it in the config if the
  window is maximized. Otherwise the config ends up
  with the maximized size saved, and weird behavior
  occurs when unmaximizing on the next opening.
2020-04-27 00:14:12 +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
Ian McInerney 99dcadf7e6 Introduce new KI_FALLTHROUGH macro
Annotate purposeful fallthroughs in switch statements with the
KI_FALLTHROUGH macro.
2020-04-25 00:44:09 +01:00
Ian McInerney ff67d6300d Hide more OpenGL deprecation warnings on OSX 2020-04-24 23:28:31 +01:00
jean-pierre charras cf66aac15d 3d viewer: fix compil issue (missing include in c3d_render_ogl_legacy.cpp) 2020-04-24 08:24:59 +02:00
Mario Luzeiro b0bf9f7b57 3D-Viewer: use wxStaticBoxSizer for options, fix coding style 2020-04-23 17:28:56 +01:00
Mario Luzeiro 67fe304f1f change the default display tab 2020-04-23 09:29:39 +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
Mario Luzeiro 656efc8d62 3D-Viewer: disable AA while moving
disable AA for Raytracing
Fixes #4007
2020-04-23 09:29:38 +00:00
Emery Burhan b1ac504fcd 3d_viewer: Fix bottom view image being too dark when floor+shadows are enabled
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2083
2020-04-22 23:00:15 +00:00
Jeff Young c08a6adb2a Implement GUI and file R/W for 3D model opacity.
Fixes https://gitlab.com/kicad/code/kicad/issues/2087
2020-04-19 18:24:39 +01:00
Ian McInerney e528769637 Move TOOLS_HOLDER into tools/ folder
Also clean up some compiler warnings
2020-04-19 01:51:49 +01:00
Ian McInerney 7bda8178d1 Move library includes to main CMake file
Placing them behind the SYSTEM directive tells CMake to tell
the compiler they are system libraries, so it shouldn't show
warnings created from them.
2020-04-19 01:11:56 +01:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Oleg Endo ae6fbc9c60 Improve 3D viewer rendering performance
* Use GL vertex buffers and index buffers for 3D model rendering
* Use material or average vertex color for bounding boxes instead of red
* Reinstate bounding box rendering with GL vertex/index buffers
* Use compact vertex/index data representation
  - 8-bit normals
  - 8-bit colors
  - 16-bit or 32-bit indices, depending on model size

This should improve performance a bit on lower end GPUs with less memory
and bandwidth.

Fixes #4112
2020-04-17 16:10:04 +00: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
Jeff Young 174856bac5 Promote 3D model "preview" flag to a persisted "show" flag.
Fixes https://gitlab.com/kicad/code/kicad/issues/2061
2020-04-10 22:49:56 +01:00
Jeff Young 191d4daf53 Fix crash on OSX. (It appears the DC isn't used anyway.) 2020-04-10 22:49:56 +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 2401917776 Fix a bug I added in commit b1b8a320.
Fixes #4170
https://gitlab.com/kicad/code/kicad/issues/4170
2020-04-07 16:36:38 +02:00
Ian McInerney cb380cda0c Fix some build warnings 2020-04-06 00:31:45 +01:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +01:00
jean-pierre charras b1b8a32078 fix a few Coverity warnings and compil minor warnings. 2020-04-03 09:54:47 +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 42a876d963 Fix a duplicate definition of the TOOL_DISPATCHER.
Fixes https://gitlab.com/kicad/code/kicad/issues/4110
2020-03-28 18:44:34 +00: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
jean-pierre charras cc47062b17 Fix a few Coverity issues 2020-03-23 16:17:22 +01:00
Wayne Stambaugh d8e99dc5be 3D Viewer: fix broken check for write image permission check.
Fixes https://gitlab.com/kicad/code/kicad/issues/4081
2020-03-21 16:19:55 -04: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 55e56c6cc1 Don't let 3DViewer steal other tools' hotkeys.
Fixes https://gitlab.com/kicad/code/kicad/issues/4074
2020-03-20 20:35:52 +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
Wayne Stambaugh fc20f9f0b2 3D viewer: fix double warning attempting to save screen shot file.
Fixes https://gitlab.com/kicad/code/kicad/issues/4028.
2020-03-16 12:45:09 -04:00
Jon Evans 0df2191663 Fix missing changes from last commit 2020-03-07 16:17:25 -05: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
Ian McInerney 34e5b76c5f Add virtual constructors to some classes that should have them
This is more for safety from undefined deletion behavior than
anything else (it also silences the Clang -Wnon-virtual-dtor warning).
2020-02-05 22:19:14 +00: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
Ian McInerney c5a9479953 Only get 3D viewer colors when launched from the PCb editor
When launched from CVPCB or the footprint editor/viewer the stackup
isn't user-editable, so it just gives its default colors.
2020-01-22 22:48:20 +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
Ian McInerney 39b1f0e1ff Replace wxCriticalSection with std::mutex 2020-01-15 23:42:16 +00:00
Ian McInerney 56f6b529c8 Simplify 3D object cache class structure
Remove the CACHE_WRAPPER whose sole purpose was to allow the
cache to be stored in the project, and instead just have the cache
inherit the proper class.
2020-01-15 23:32:05 +00:00
Ian McInerney bc6139359b Smoothen rotation in 3D viewer when crossing the 0-2pi line
Rotating to 0 when above pi would result in the board spinning back
through pi to get there. This led to jarring motion.

Also fix an issue added in b6f64815 where the board would rotate
2pi when crossing over the 0-2pi boundary.
2020-01-15 18:10:05 +00:00
jean-pierre charras b6f64815f4 3D viewer: normalize rotation angles between -2_PI and 2_PI.
Fixes #3761
https://gitlab.com/kicad/code/kicad/issues/3761
2020-01-13 14:30:49 +01:00
Ian McInerney f896043067 Fix comments for switch statement fall throughs
This cleans up all GCC warnings (-Wimplicit-fallthrough=2) about
implicitly falling through switch cases.
2020-01-11 19:16:32 +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
Mario Luzeiro 2c00540ad6 3d-viewer, make ortho projection zoom similar as prespective projection
Fixes #1843
Fixes reload of Raytracing when the projection button is pressed.
2020-01-07 03:29:36 +00:00
Mario Luzeiro 518c1df81b 3d-viewer, ray-tracing, do not add coincident segments
Fixes #1946 (lp 1852970)
2020-01-06 14:11:02 +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
Mario Luzeiro 37c3e34486 3D-viewer: raytracing, implement multiple shape board.
Fixes #1879 (lp:1820099)
Fixes #2126 (lp:1764039)
2020-01-04 20:50:37 +00: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
Ian McInerney c21e96bcf9 Add virtual destructor to CMATERIAL
CMATERIAL is a base class, so it should have a virtual constructor
to prevent undefined behavior (and silence warnings).
2019-12-28 16:44:28 +00:00
Ian McInerney 6faa2188ed Silence warnings on MacOS about OpenGL deprecation
Apple has apparently deprecated OpenGL and replaced it with
their Metal API. It still works for now though.
2019-12-28 16:05:03 +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
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Mark Roszko ae785194ce Silence/fix double to float conversion warnings 2019-12-12 21:51:21 +00:00
Seth Hillbrand eb3d32f967 SHAPE_LINE_CHAIN: Unify constructors
Keeps the multi element SHAPE_LINE_CHAIN constructors in a single
routine using std::vector and implicit construction.
2019-12-12 13:54:48 +00:00
Seth Hillbrand 6983c56cf8 Use const references where possible
This avoids copy cost on local vars where we only read.
2019-12-05 14:40:22 -08:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand 4d2e953f42 Cleanup: Replace C-only deprecated headers
This replaces headers deprecated by C++14 with their equivalent
replacement
2019-12-05 11:03:15 -08:00
Seth Hillbrand 79972a3867 3d: Fix initialization call
The vector duplication call was invalid as growing the vector
invalidates the iterators.
2019-11-07 04:45:46 -08:00
jean-pierre charras 9f156aa115 3D viewer: do not translate Ctrl and Shift hotkey modifiers: Translations do not always work 2019-09-24 09:41:05 +02:00
jean-pierre charras 06a50751e8 3d viewer: Fix duplicate hotkeys/accelerator keys.
keys X, Y, Z were used both to rotate view and to force left/right view, front/back view, top/bottom view
Now rotate view uses Ctrl+ X,Y,Z keys
2019-09-23 18:51:18 +02:00
Michal Jahelka ae79a2bdcf c3d_render_ogl_legacy.cpp: initialize m_Emissive member of SMATERIAL to be sure it is set to 0, 0, 0 2019-09-10 17:39:48 +02:00
Jeff Young 8dd8740fa3 Performance enhancement for pad drawing.
Fixes: lp:1843065
* https://bugs.launchpad.net/kicad/+bug/1843065
2019-09-09 13:45:06 +01:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Jeff Young baeb3689b5 Improve SNR (and spelling). 2019-08-20 18:02:28 +01:00
Seth Hillbrand 4fcfd266e0 3d: Disable floor rendering by default
The floor render in raytracing creates interesting shadow effects but
significantly increasing the processing time for renders and has the
side effect of making the bottom of the board very dark if you simply
flip it over.  Making this option off by default, we allow power users
to turn it on if needed for their renders while speeding up the default
raytrace and preventing new user confusion.
2019-08-16 11:39:36 -07:00
Seth Hillbrand 59ed9f086f 3d-viewer: Remove dead code
The 2d-bbox of the 3d viewer was calculated and set but never used
2019-08-16 10:56:32 -07:00
Simon Schubert 0823692dda 3d: min dot needs to be square
Given that we compare the dot product (square of length) to s_min_dot,
it means that s_min_dot also needs to be square, or we wind up
converting line segments into circles that are visually distinct from
circles, leading to gaps in polylines.
2019-08-15 14:02:00 -07:00
Simon Schubert e01348cccc 3d canvas: use radius, not width for circles 2019-08-15 14:02:00 -07:00
Ian McInerney 8493daf9ff Unify menu item creation for closing a window
* Push a function into CONDITIONAL_MENU that adds the item
* Modify the tooltip for close and exit items to have the
  program name

Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
2019-08-14 09:35:15 +01:00
Jeff Young 17d015ed5d Strip illegal chars from 3D filepath and change rotation increment to 90deg.
Fixes: lp:1823559
* https://bugs.launchpad.net/kicad/+bug/1823559
2019-08-08 23:02:37 +01:00
Jeff Young 4399a52ad3 Work around a wxWidgets bug that loses the preferences item from the menu.
Fixes: lp:1839148
* https://bugs.launchpad.net/kicad/+bug/1839148
2019-08-06 11:50:19 -06:00
Jeff Young 6069263beb Add ctrl-W to 3D viewer.
Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
2019-08-05 16:48:18 -06:00
jean-pierre charras d4e9ddc14c 3D viewer: fix check state of some menuitems not correctly updated.
Fixes: lp:1837950
https://bugs.launchpad.net/kicad/+bug/1837950
2019-07-31 09:19:44 +02:00
Michael Kavanagh 300fb43a38 Fix a couple more lost menubar separators
Fixes: lp:1838422
https://bugs.launchpad.net/kicad/+bug/1838422
2019-07-30 20:05:36 +02:00
jean-pierre charras 9b6c8c885b 3D viewer: fix preferences/grid issues: grid menuitems always disabled. 2019-07-30 19:12:34 +02:00
Jeff Young 37af3adffb Add preference for flip axis.
Fixes: lp:1836267
* https://bugs.launchpad.net/kicad/+bug/1836267
2019-07-14 10:36:48 +01:00
Jeff Young 2d17d2b91f Cleanup and commenting. 2019-07-14 10:36:48 +01:00
Jeff Young f088d4d762 Add env-var setting to CommonSettingsChanged().
Fixes: lp:1804925
* https://bugs.launchpad.net/kicad/+bug/1804925
2019-06-25 11:34:28 +01:00
Jeff Young 65821f747d Bring 3D viewer in line with Pcbnew's solder mask rendering. 2019-06-25 11:34:28 +01:00
Seth Hillbrand 98124e68c7 Update exit strategy to match UI guidelines
In singletop mode, all frames show the "Quit" option in the file menu
and will quit on Ctrl-Q.  When launched from the main KiCad interface,
sub-programs show the "Close" option instead and will close with Ctrl-W.
In this mode, Ctrl-Q will instruct the main program to exit.

Fixes: lp:1779938
* https://bugs.launchpad.net/kicad/+bug/1779938
2019-06-24 21:46:42 -07:00
Seth Hillbrand d132cf37e0 Allow null path in 3d model
This allows a setting where the path is not one of the options.  This
permits the user to select once to go to any path option (rather than
off the current and then back to currect) when the filetree doesn't
match the dropdown.  This also selects the drop down item if it matches
the tree.

(cherry picked from commit f5284ced54)
2019-06-20 20:15:40 -07:00