Commit Graph

49 Commits

Author SHA1 Message Date
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 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
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
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 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
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
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand 888c01d11b pcbnew: Move tracks to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand d1877d7c1b Moving modules from DLIST to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand ddc6079ceb Move remaining hard-coded segment counts
This removes the remaining hard-coded segments counts and replaces them
with the relative error calculation where the segments per arc is
determined by the maximum error we allow (smaller arcs = fewer segments)
2019-05-16 08:49:55 -07:00
John Beard 18593d2dbb 3D viewer: decouple renderers from wxCursors
Provide a toolkit-agnostic interface for "busy indicators", which
allows the 3D viewer to show a busy cursor, without the canvases
having to to know how a wxCursore works.

The motivation here is to decouple the 3D renderers from the WX
GUI system, as they can then be used when when there is not an
active window (e.g. for offscreen rendering).

Otherwise, attempting to use a wxBusyCursor without a GUI
available is an instant segfault.
2019-05-12 14:19:39 +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
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
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
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
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 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
Seth Hillbrand f6bd6b1360 3d: Replace glFinish with glFlush
glFinish is meant to ensure every aspect of the screen is fully-drawn
before continuing.  This causes issues with certain chipsets (Intel
4-8k)

glFlush is more of a suggestion that CPU work is complete and the GPU
should complete its work in a "timely" fashion.

We add an additional glFinish call before getting a screenshot as this
will copy the actual data from the card buffer.

Fixes: lp:1775976
* https://bugs.launchpad.net/kicad/+bug/1775976
2018-06-13 15:32:18 -07:00
jean-pierre charras 6e5131be5a Minor fix in fp editor and fp viewer: display the fp info instead of the useless board info.
board info makes sense only in board editor, not in fp editor and fp viewer.
2018-05-12 10:44:31 +02:00
jean-pierre charras 4cc62ce038 3D viewer: minor enhancement: display the name of the 3D shape being loaded. 2018-05-08 16:07:09 +02:00
Carsten Schoenert a11714b1a4 fix misspelled 'an other' -> 'another' 2018-04-08 13:24:37 -04:00
Jeff Young cd0cd242d1 Move 3D polygon approximation to absolute-error algorithm.
Also inflates via and pad hole polygons to bisect their circles.

Fixes: lp:1758137
* https://bugs.launchpad.net/kicad/+bug/1758137
2018-03-23 12:46:17 +00:00
Jean Philippe EIMER e0f7958dbd Compatibility fixes for GLM 0.9.9
Fixes: lp:1746546
* https://bugs.launchpad.net/kicad/+bug/1746546
2018-02-06 13:30:13 +01:00
jean-pierre charras 5d08f1a0d9 Breaks the large create_layer_items.cpp file into 2 smaller specialized files, to make changes in 3D shapes calculations more easy. 2018-01-28 14:05:17 +01:00
Mark Roszko b98cc0b937 Some coverity fixes 2018-01-05 22:51:03 -07:00
jean-pierre charras 00c2257b26 3D viewer: Remove outdated option "show holes in zones" that was no longer used in opengl mode, and useless in ray tracing
(it was only used to reduce the calculation time)
Also add a wxBusyCursor when rebuilding the 3D scene.
2017-12-28 11:01:10 +01:00
Oliver b80449b069 Fixes for 3D model offset
- Display offset units in 3D preview window (inches or mm)
- Fix offset in 3D renderer
- Fix offset in Raytracing renderer
- Fix offset in STEP export
- Fix offset in VRML export
2017-11-20 17:46:03 -05:00
Wayne Stambaugh f3908bd87c Revert premature commit of 17ab319b, "Fixes for 3D model offset".
This reverts commit 17ab319b99.
2017-11-11 20:04:46 -05:00
Oliver 17ab319b99 Fixes for 3D model offset
- Display offset units in 3D preview window (inches or mm)
- Fix offset in 3D renderer
- Fix offset in Raytracing renderer
- Fix offset in STEP export
- Fix offset in VRML export
2017-11-11 15:08:08 -05:00
Tomasz Włostowski 90ab5860dc refactoring: removed dependency of libpcbcommon on 3d-viewer. 2017-11-03 20:01:42 +01:00
jean-pierre charras 43084daa40 Fix a few doxygen warnings 2017-07-03 10:45:56 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
jean-pierre charras d56a49d218 Performance counter rework: More comments, code cleaning, and move GetRunningMicroSecs() prototype from common.h to profile.h.
profile.h should now contain all info for profiling.
2017-01-02 13:49:36 +01:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Mrio Luzeiro d8eab321f7 3D Viewer: complete refactor of the 3D viewer.
* Split and rewrite the preview window and canvas.
* Create a new class for handling the board information.
* Adds new render targets: openGL, legacy, and ray tracing.
* Render targets take full advantage of the new 3D plugins system and 3D cache
  for a fast 3D model loading.
* Faster board loading.
* New OpenGL render is faster than the old one.
* New ray tracing render target with a post processing shader.
* Use of new 3D plugins (WRL, X3D, STEP and IGES) and 3D model caching.
* Preview of 3D model while browsing the file name.
* 3D preview of the footprint while adding / align 3D shapes.
* Render of 3D models according to attributes: Normal, Normal+Insert, Virtual.
* Pivot rotation centered in one point over the PCB board.
* Shortcuts keys improved for XYZ orientation..
* Animated camera.
2016-07-19 13:35:25 -04:00
Jon Neal 1293d04a7a Fix a bunch of misspellings of length. 2016-07-10 23:09:18 -04:00
jean-pierre charras a4658ab6be Fix a few compil warnings (not used vars, shadowed local vars) 2016-06-01 14:22:05 +02:00
Chris Pavlina 5904e4c942 Correct handling of unused parameter
Coverity: CID 143742
2016-05-10 23:25:53 -04:00
Chris Pavlina ec67218b5a Remove unneeded 'new' and NULL check
Coverity CID: 143743
2016-05-10 22:36:44 -04:00
Cirilo Bernardo c2a60d14d7 3D: fix issues reported by Coverity scan
*** CID 143752:  Incorrect expression  (USELESS_CALL)
*** CID 143751:  Incorrect expression  (UNUSED_VALUE)
*** CID 143749:  Uninitialized members  (UNINIT_CTOR)
*** CID 143748:  Uninitialized members  (UNINIT_CTOR)
*** CID 143747:  Uninitialized members  (UNINIT_CTOR)
*** CID 143746:  Uninitialized members  (UNINIT_CTOR)
*** CID 143745:  Uninitialized members  (UNINIT_CTOR)
*** CID 143744:  Uninitialized members  (UNINIT_CTOR)
*** CID 143740:  Null pointer dereferences  (NULL_RETURNS)
*** CID 143739:  Memory - corruptions  (MISMATCHED_ITERATOR)
*** CID 143735:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
*** CID 143734:  Error handling issues  (CHECKED_RETURN)
2016-04-06 21:41:52 -04:00
Cirilo Bernardo 20b40aba1c Fixed bad delete/delete [] invocations and other warnings and errors as suggested by cppcheck 2016-04-05 20:32:22 +10:00
Bernhard Stegmaier 5b0a250609 Fix compilation and install for OSX plus general code cleanup 2016-03-01 10:08:19 +11:00
Cirilo Bernardo f247b05b3e Merged Mario's fix to Material + per-vertex colors and transparency 2016-02-16 08:07:17 +11:00
Cirilo Bernardo 86635aeb23 Manually select changes from Mario Luzeiro's branch to fix model lighting in the preview window. 2016-02-04 12:16:19 +11:00
Cirilo Bernardo 70be4e8f7f + Reverted accidental edit of sg_node.cpp
+ Fixed invocation of SHAPE_POLY_SET::Simplify() to match changes in main
2015-12-19 17:53:07 +11:00
Cirilo Bernardo 4e12999fa8 Removed some trailing white space. Fixed FindGLM. 2015-12-10 11:31:44 +11:00
Cirilo Bernardo ac3acb0061 Moving headers to facilitate support for building 3D plugins out-of-tree 2015-12-09 18:30:48 +11:00
Mario Luzeiro 69cc788e8e + Removed glm source from kicad tree (Maciej / Cirilo)
+ Added renderer for 3D model preview (Mario)
+ Added 3d_cache including name resolver and modifications to 3D model dialogs (Cirilo)
2015-12-08 18:31:57 +11:00