48 Commits

Author SHA1 Message Date
Damjan
2c92f95a1c 3d-viewer: Navigation gizmo for 3D viewer
ADDED: Blender-like navigational gizmo - new feature

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16956
2025-06-09 10:29:34 -07:00
Jeff Young
e0e1f73f9e Fix rendering issues with hide-holes-while-moving.
Also fixes the checkbox names to be more accurate.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20775
2025-04-28 17:39:54 +01:00
Jeff Young
9fc60621f6 Fix rendering issues with solderpaste and hide-holes-while-moving. 2025-04-28 17:39:54 +01:00
Seth Hillbrand
e75076ab41 Revert "Replace glew with epoxy"
This reverts merge request !2217
2025-04-22 15:16:58 -07:00
Michal Suchánek
0c36e16292 Replace glew with epoxy
Glew has the problem that it has to be selected at build time if GLX or
EGL is supported by the library, and this in not encoded in the library
name, nor ABI, nor anything.

Then it's easy to get into the situation that a binary is built but
cannot run because glew supports an API different from the one used by
wxWidgets, or the binary fails to link in the end after all objects are
compiled.

epoxy can support both with the same library avoiding this problem.

epoxy is not initialized explicitly, replaced initialization with
version check where one was not done already.

It seems to be available as vcpkg https://vcpkg.link/ports/libepoxy

There are problems related to GL context switching on Windows which does
not seem to be used in kicad
https://github.com/anholt/libepoxy#known-issues-when-running-on-windows
There is also a problem related to multithreaded rendering on Windows
https://github.com/anholt/libepoxy/pull/265 It's harder to tell if
threading is used for rendering but it does not look like kicad is doing
anything complex enough to warrant using multiple rendering threads.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20630
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12543
2025-04-22 12:54:39 -07:00
Jeff Young
6307f0aee8 Use board layer names when available.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20360
2025-03-17 21:23:56 +00:00
Jeff Young
533551f014 Don't bleed settings between 3D viewer and 3D footprint preview.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17353
2025-03-16 11:52:56 +00:00
Jeff Young
f33f10bb38 User-defined layers for 3D viewer. 2025-03-15 16:14:33 +00:00
Wayne Stambaugh
42a1d1cf0b Include folder and 3D viewer code housekeeping. 2025-01-11 07:25:14 -05:00
Seth Hillbrand
09e30adbb1 Move GL_CONTEXT_MGR into PGM_BASE singleton
This is the second try at 5326c36a5f.  The difference here is that we
have moved GL_CONTEXT_MGR into kicommon first which will hopefully
address some of the Windows linkage issues

The GL context lock needs to be shared across kifaces.  Otherwise, we
can end up blocking the lock from one kiface.  Unfortunately, I can't
find the issue in GitLab right now for where the footprint viewer shows
a blank screen after opening too many contexts.  But that's what this
fixes.
2025-01-09 09:03:08 -08:00
Seth Hillbrand
f38e661a02 Revert "Move GL Context into Singleton class"
This reverts commit 5326c36a5ff8a3a465d386cc31172aa90847a9e9.
2025-01-03 21:22:37 -08:00
Seth Hillbrand
5326c36a5f Move GL Context into Singleton class
The GL context lock needs to be shared across kifaces.  Otherwise, we
can end up blocking the lock from one kiface.  Unfortunately, I can't
find the issue in GitLab right now for where the footprint viewer shows
a blank screen after opening too many contexts.  But that's what this
fixes.
2025-01-03 17:26:23 -08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
jean-pierre charras
36b6720feb 3D viewer: fix some issues after layer numbering changes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18684
2024-09-12 09:50:00 +02:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Seth Hillbrand
be2a52dd2b Avoid GL ctx deadlock
Allow non-drawing routines to access error messages without dealocking
the load
2024-09-06 16:00:49 -07:00
jean-pierre charras
1f608ec2b0 3D viewer: add option to use board editor copper colors for copper layers.
This is useful to analyze multilayers boards
2024-08-24 10:16:18 +02:00
Seth Hillbrand
cc850d0da0 Split out LSEQ/LSET from LAYER_ID
Separate the layer grouping classes for easier modification
2024-07-08 20:59:46 -07:00
Alex Shvartzkop
16e3692e71 Build time optimizations. 2024-04-27 23:49:13 +03:00
Alex Shvartzkop
f6f0b9a661 ADDED: PCB 3D image raytracing rendering from CLI.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/3691
2024-03-08 14:38:18 +00:00
Alex Shvartzkop
fb089a182b 3D viewer: support transparent background in Raytracing mode. 2024-03-04 15:09:31 +03:00
Alex Shvartzkop
80457d5871 Support transparent background in 3D viewer PNG/clipboard export.
Only really works with realtime renderer currently.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12060
2024-02-29 17:11:53 +03:00
Jeff Young
6136c2438d Make sure sorts are deterministic. 2023-10-04 18:43:36 +01:00
Jeff Young
da1405ec6a Draw off-board pads when drawing off-board silk. 2023-09-22 20:57:31 +01:00
Jeff Young
c1a988e3ff Handle plated vs non-plated copper for copper other than pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5569
2023-09-22 18:48:29 +01:00
Jeff Young
78f70b45e6 Minor readability improvements. 2023-09-22 18:48:29 +01:00
Jeff Young
8d06a794f4 Simplify code.
DrawAllCameraCulled() can handle up to 4 knockout lists, and any
of them can be null, so don't dance around how we call it.
2023-09-21 14:02:23 +01:00
Jeff Young
87af115ee0 Make better use of method overrides. 2023-09-20 23:28:50 +01:00
Jeff Young
0126841c44 ADDED: 3D appearance setting for off-board silk. 2023-09-20 23:28:50 +01:00
Jeff Young
7e70ceaa03 Don't trim non-physical layers to board-outline.
If the user wants a realistic render, then they'll turn off
non-physical layers entirely.
2023-09-20 13:43:23 +01:00
Jeff Young
22256c97f3 Fix logic errors in handling board body visibility.
Also fixes a bug where models were placed above the silk when the
solder paste layer was shown, but on the solder paste layer when
it wasn't shown.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15510

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6770
2023-08-26 17:33:57 +01:00
Jeff Young
0c37e3c443 Remove realistic-mode (and duplicated settings from preferences).
Most of these settings are now available in the appearances panel.
It was concluded in a Zulip discussion that any missing items can
be added back in time if people find they need them (ie: complain).

Also hooks up 3DViewer to the common language framework.
2023-08-23 14:07:58 +01:00
Jeff Young
f45760062b ADDED: appearances manager for 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12413
2023-08-14 18:08:36 +01:00
Jeff Young
b53bc1ae38 Trim solder paste (and other layers) to holes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8484
2023-05-30 00:02:27 +01:00
Mario Luzeiro
7bc976f3f4 3D-Viewer: sort models and material models when rendering in transparent
Also enables transparency on model preview and small optimizations fixes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14005
2023-03-02 22:29:08 +00:00
Mario Luzeiro
089d8b9cc1 3D-Viewer: Bind to a texture so glTextEnv will work.
Fixes https://gitlab.com/kicad/code/kicad/issues/11641
2022-12-21 16:02:51 +00:00
Marek Roszko
66e8931405 Remove IU_PER_MM thats standalone 2022-09-16 21:09:27 -04:00
Marek Roszko
a8613ee80f Combine Iu2Millimeter & remove PcbMm2iu 2022-09-16 21:09:26 -04:00
jean-pierre charras
993c446fdf Fix some warnings detected by PVS-STUDIO (most are not used vars) 2022-07-25 18:23:52 +02:00
Alex
58f9b82c1e 3D viewer: Fix GL_INVALID_ENUM error. 2022-06-09 18:35:07 +00:00
Jeff Young
0dc857b5ab Clean up pad handling in 3D viewer.
Most importantly, create F_Cu/B_Cu layers if they're otherwise empty
but we have plated pads to render on them.

Fixes https://gitlab.com/kicad/code/kicad/issues/10207
2022-03-06 13:57:12 +00:00
Jeff Young
abd3f5bc2b Move footprints to EDA_ANGLE. 2022-01-14 16:08:18 +00:00
Marek Roszko
2d1357dc54 Swap some of the 3d viewer to VECTOR2I 2021-12-29 14:20:40 -05:00
Mikolaj Wielgus
e9c29a4c1f 3D Viewer: Only highlight what is under the cursor
Fixes https://gitlab.com/kicad/code/kicad/issues/10136
2021-12-28 00:50:15 +01:00
Jeff Young
dabc75bee8 Source 3D dimensions from board stackup.
Also includes a performance improvemnt by caching the 3D model matrices.
2021-12-24 21:10:28 +00:00
Jeff Young
68d2630d08 Flatten a layer of indirection out of 3D config settings. 2021-12-24 13:08:54 +00:00
Seth Hillbrand
ccd3a1e6a9 3d-viewer: Don't special-case Paste
Paste layers should be clipped in Realistic mode.  Verifying that paste
doesn't extend beyond the board area should be left to DRC, or
non-realistic mode if you need a 3d view of it.

Fixes https://gitlab.com/kicad/code/kicad/issues/9460
2021-10-25 11:18:13 -07:00
Jeff Young
6c0110ecd3 Naming conventions.
There's nothing "legacy" about the OpenGL 3D renderer.
2021-10-21 14:30:03 +01:00