Commit Graph

627 Commits

Author SHA1 Message Date
Mario Luzeiro 33449216b5 3D-Viewer: Improvements on reflection and refraction
- crete an option for absorvance (works better to make the epoxy
different for regular transparent materials).
- visual fix an issue related with the epoxy render (square bands on the
render).
- fix a reflection issue (it was not take in account the reflection
material color).
2017-01-21 09:21:44 -05:00
Mario Luzeiro 2eb840b2ed 3D-Viewer: Fix precision issues (experienced on isometric mode) in frustum tests 2017-01-18 18:09:27 -05:00
Baranovskiy Konstantin 3dc2050498 Improved MousewheelPAN mode. 2017-01-17 16:34:11 -05:00
Simon Wells 19512b46a3 Fix unlimited zoom with "Use touchpad to pan"
Additionally, fix an unreported bug allowing zoom level to get stuck at
MAX_ZOOM.

Fixes: lp:1625754 (3dviewer zoom not limited with Use touchpad to pan)
https://bugs.launchpad.net/kicad/+bug/1625754
2017-01-14 09:17:56 -05: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
Chris Pavlina 6078ca85e5 Improve broken edge outline error message 2016-12-29 12:31:12 -05:00
Mario Luzeiro d365dc590e Soft plastic textures even more 2016-12-22 16:18:38 -05:00
Mario Luzeiro b33e42ef2c Soft plastic textures 2016-12-22 16:18:30 -05:00
Mario Luzeiro ad2458056a Improvements on 3DViewer raytracing render
+ Implement sRGB to Linear and Linear to sRGB conversions.
+ Fix an issue in the AntiAliasing adaptive logic.
+ Improves the ambient color use on the shader.
+ Improves post-shader calculation. Fixes the saturated dark regions.
+ Improves the transparency of soldermak material.
2016-12-22 16:18:20 -05:00
Chris Pavlina 4c340cefee Also rename footprint attributes in 3D viewer
Follow-up to commit: 809e71a
2016-12-15 14:48:14 -05:00
Mario Luzeiro 86dcfeb69d improve anti-aliasing
+re-implement anti-aliasing, making it more acurate, not blured, better
and much faster (unsing much less lines of code)
+rewrite some function on camera and raypacket.
+small improvements on raytracing realtime, remove useless ifs
comparisons.
2016-10-27 10:22:21 -04:00
Simon Richter 6000336fe7 Add missing include
std::iota is defined in <numeric>
2016-10-10 19:44:46 -04:00
Mario Luzeiro 6d27087053 Improve board texture (make it square), add directional light to top/bot. 2016-10-09 11:34:28 -04:00
Mario Luzeiro f59bde8cc3 Improve brushed and plastic textures 2016-10-09 11:34:20 -04:00
Mario Luzeiro ae8c62843e Raytracing: implement brushed metal perturbator 2016-10-09 11:34:09 -04:00
Mario Luzeiro 995fde8d9c (forget to staged modified files) 2016-10-09 11:33:53 -04:00
Mario Luzeiro 8493a2f6d5 Raytracing: implement textures based on normal perturbation
Implement normal perturbation for black epoxy and color plastic.
Fix some UI issues in 3D-Viewer (menu options was not proper saved or
updated)
2016-10-09 11:33:25 -04:00
Mario Luzeiro ee71875b4b Implement normal perturbation materials on raytracing 2016-10-09 11:33:16 -04:00
Mario Luzeiro 89bb47ede6 Improve shadow on postshader and add a gamma sRGB color space convertion 2016-10-09 11:33:09 -04:00
Mario Luzeiro 49dce5d191 Improve shadow calculation on Raytracing
Makes it not so dark.
Speed optimization on post shader calculation.
2016-10-09 11:32:59 -04:00
Chris Pavlina 278ee7da7d Remove deprecated 'register' storage spec 2016-09-30 22:32:24 -04:00
Chris Pavlina b9abcc309f Fix Validate hiding overloaded virtual in 3D viewer dialog 2016-09-30 22:32:24 -04:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Cirilo Bernardo d3771d53ef Updated VRML exporter and fixed some VRML related bugs 2016-09-21 09:31:52 -04:00
José Ignacio Romero cd976d36b7 Use a symmetrical clip plane for the orthographic projection 2016-09-07 01:12:01 -04:00
José Ignacio Romero df40159ce7 Pixel perfect panning for the 3D viewer
Use the correct math to unproject the mouse movement from screen space
to the Z=0 plane on the camera space. This handles both perspective
and orthographic projection at any window size or zoom level.
2016-09-06 20:10:51 -04:00
Chris Pavlina 378def4734 3D viewer: suggest correct extension when saving image
Fixes: lp:1620102
* https://bugs.launchpad.net/kicad/+bug/1620102
2016-09-06 01:15:59 -04:00
Chris Pavlina 20aca7d7bb Fix direction of ctrl+scroll in 3D viewer
Fixes: lp:1620453
* https://bugs.launchpad.net/kicad/+bug/1620453
2016-09-06 00:48:27 -04:00
Chris Pavlina 9740d5e433 Fix nonstandard, unsigned OpenMP loop counter
OpenMP does not yet permit unsigned loop counters. Most compilers seem
to allow them anyway, but a few have been seen to complain.

Mistake introduced in:
    commit 82ed0fde32
    Author: Chris Pavlina <pavlina.chris@gmail.com>
    Date:   Sun Aug 28 02:05:49 2016 -0400

    Fix shared data access in raytracer, tidy up render loop
2016-09-04 21:41:09 -04:00
Wayne Stambaugh cbcb3b896b Fix incorrect string translation macros.
* Replace _T() with _() for translatable strings.

* Don't translate debug messages.

* Don't translate copyright symbol.
2016-09-03 12:10:49 -04:00
Chris Pavlina 82ed0fde32 Fix shared data access in raytracer, tidy up render loop
Render loop lost track of which blocks had been rendered due to a
synchronization issue. Specifically, std::vector<bool> is special-cased
as a bitfield and so is pretty much guaranteed not to be atomic unless
synchronized externally.

Also:

- Clean up types of a few variables
- Clean up openmp sharing type of variables (may result in better
  optimization)
- Replace shared rendered block count with an openmp reduction (results
  in fewer locks)

Fixes: lp:1608289
* https://bugs.launchpad.net/kicad/+bug/1608289
2016-08-28 02:13:55 -04:00
jean-pierre charras 9f46d83175 Gerbview: locate item now does not take in account not visible layers. Remove an unused file
3d viewer: Remove a few ToUTF8() bad  usage (replaced by GetData() )
2016-08-19 09:45:59 +02:00
jean-pierre charras 3f1a90c8a4 3D viewer; Fix a few incorrect use of ToUTF8() in log and error messages. Only noticeable when messages contain non ASCII7 chars. 2016-08-17 09:37:51 +02:00
jean-pierre charras 7bc8cb56e0 Fix bug: Impossible to rescale 3D models 2016-08-05 21:30:23 +02:00
jean-pierre charras f029047a97 Uncrustify cbbox_ray.cpp to avoid a lot of warnings on gcc 6.1 2016-07-27 14:52:04 +02: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 1fbb84fd98 Move call of SetSizeHints in dialogs in a wxInitDialogEvent event, because some widgets sizes are not fully initialized before this event.
It is especially true in some Window Managers like KDE, but can be true in any WM, when initializations are mage by TransferDataToWindow() method.
2016-07-02 14:44:36 +02:00
Simon Richter da5699de0a Replace boost::shared_ptr with std::shared_ptr. 2016-06-29 11:09:55 -04:00
Cirilo Bernhardo c11b0cef99 3D Viewer: change 3D model cache path.
* Use platform cache path insted of the KiCad configuration path to write the
  3D model cache.
* OSX: ${HOME}/Library/Caches/kicad/3d
* Linux: ${XDG_CACHE_HOME}/kicad/3d or ${HOME}/.cache/kicad/3d
* Windows: AppData\Local\kicad\3d
2016-06-21 14:02:04 -04:00
jean-pierre charras 7abf006c80 Very minor fix: fix shadowed local vars. 2016-06-15 10:27:24 +02:00
Maciej Suminski b82ccc3b4e Reverted 6912 with minor changes (LockCtx requires to specify canvas that locks a context). 2016-06-13 16:43:33 +02:00
jean-pierre charras 1c838ba92f Slightly modify a declaration to make compil compatible with gcc 4.8.4, used in Ubuntu 14.04 LTS (the latest LTS currently available), and to avoid many bug reports. 2016-06-13 14:19:47 +02:00
jean-pierre charras 688fb5caaa Minor enhancements in dlg_3d_pathconfig (better look, but not perfect). Also fix an issue: the minimal dialog size was not always calculated. 2016-06-13 12:41:27 +02:00
Cirilo Bernardo b09f079ab4 3D file name resolver improvements.
* Add a Help button and text to the 3D alias configuration dialog
* Display KISYS3DMOD and internally defined KiCad path env vars
* Add a button to bring up the "Configure Paths" (env vars) dialog
* Remove the file name mapping feature from the resolver; this results in
  the resolver always using the current definition rather than a possibly
  outdated cache value.
2016-06-12 18:46:00 -04:00
Mário Luzeiro f25d12f571 Footprint 3D properties dialog panel: fixes a bug on the offset of 3D Settings (Footprint) (the value range of the offset parameters were not set so it was not able to enter values <-10)
Also make some small layout changes on the orientation parameters in order to make it vertical smaller.
2016-06-09 14:27:58 +02:00
Cirilo Bernardo e0a7f0041a Better 3D filename resolution 2016-06-09 07:48:49 +02:00
Maciej Suminski 71aade6b51 Fixed a few warnings (mostly gcc6 -Wmisleading-indent). 2016-06-07 14:42:42 +02:00
Maciej Suminski b83c148e10 Delete OpenGL context on GLCanvas subclasses destruction. 2016-06-03 15:46:13 +02:00
Maciej Suminski 94a460080e Added missing code for C3D_MODEL_VIEWER to use GL_CONTEXT_MANAGER. 2016-06-03 15:46:12 +02:00
Maciej Suminski 01f32dd52c GL_CONTEXT_MANAGER class to avoid unexpected GL context switches. 2016-06-03 15:46:12 +02:00
Wayne Stambaugh 42b659efe1 Fix build error on non-debug builds. 2016-06-01 16:58:27 -04:00
jean-pierre charras 0a6245e5cc Remove not working bom_cvs.xsl file. Fix minor compil warnings in x3dmodelparser.cpp. 2016-06-01 18:42:01 +02:00
jean-pierre charras a4658ab6be Fix a few compil warnings (not used vars, shadowed local vars) 2016-06-01 14:22:05 +02:00
Cirilo Bernardo 34f223a707 Fix FP Editor : Invalid Filename Err.msg message wheb trying to edit a 3D filename 2016-05-30 10:22:19 +02:00
Simon Richter 48ad75719c Remove redundant old copy of cimage class (3d-viewer/CImage.cpp and 3d-viewer/CImage.h) 2016-05-30 08:31:32 +02:00
jean-pierre charras f1c9f284fd Dialog 3D path config: fix incorrect grid cells sizes when opening the dialog, and incorrect min size dialog. 2016-05-28 11:33:20 +02:00
jean-pierre charras 3c0859686b Gerbview: fix a stupid mistake I made in rev 6829 (crash when reading a gbr file). 3d path config dialog: make it resizable. 2016-05-26 18:58:32 +02:00
jean-pierre charras dbb78db7ef Gerbview: Shows now in the Layer manager the filename of gerber or drill files loaded.
A fex minor compil warnng fixes
2016-05-23 17:47:16 +02:00
Chris Pavlina 5904e4c942 Correct handling of unused parameter
Coverity: CID 143742
2016-05-10 23:25:53 -04:00
Chris Pavlina 05255cbae8 Clean up dodgy array dimension
Array is in pairs but has a single sentinel, trips up Coverity (CID 147346) and
does allow an out-of-bounds write if WX_GL_SAMPLES were ever removed from the
array.
2016-05-10 23:15:33 -04:00
Chris Pavlina ec67218b5a Remove unneeded 'new' and NULL check
Coverity CID: 143743
2016-05-10 22:36:44 -04:00
Maciej Suminski d8ca03b362 3D viewer: set right OpenGL context before freeing memory. 2016-05-09 17:59:59 +02:00
Maciej Suminski da312db7a4 Fixed a wxWidgets assertion. Newer wxWidgets (3.1) display a message saying that horizontal alignment flags are ignored with wxEXPAND. 2016-05-02 15:56:12 +02:00
Matthew Petroff db54f3e7a7 Correct multiple UI spelling errors 2016-05-02 10:01:43 -04:00
unknown ce331b03e8 3D_cache/cmakelists.txt: Don't clear CMAKE_CXX_FLAGS compiler flags 2016-05-02 11:45:23 +02:00
jean-pierre charras d7f1400e44 Make strings only used in debug mode not translatable. 2016-04-21 09:19:08 +02:00
Cirilo Bernardo 6120472d60 3D file name resolver improvements.
* Paths defined via pcbnew->Preferences->Configure Paths are now included in
  the 3D file browser's drop-down list except for KICAD_PTEMPLATES, KIGITHUB,
  KISYSMOD, any paths resembling a URL, and any non-existent paths. When an
  absolute path is shortened using one of these path aliases, let's say
  'KISYS3DMOD' then the name appears in the pcb file as "${KISYS3DMOD}/blah.wrl".
  If a user defines and actual environment variable with the same name, then
  that user defined variable will have precedence over the internally defined
  variable.

* Paths relative to the current project directory are no longer represented
  as "some/path/to/file.wrl".  For compatibility with previous KiCad versions
  it shall always be stored as ${KIPRJMOD}/some/path/to/file.wrl.

* Various restrictions on alias path values have been removed since the
  imposed restrictions could result in corrupted user data as aliases are
  silently dropped.

* Overall the patch should improve back-compatibility by providing a ${ENV_VAR}
  mechanism for supporting different model root directories and ensuring that
  paths relative to KIPRJMOD are expressed in a way that is compatible with
  earlier KiCad versions. This allows users more flexibility and the ability
  to work in a way that ensures 3D model files can be correctly resolved in
  earlier versions of KiCad. Users who do not care about back-compatibility
  may prefer to use the newer alias system.
2016-04-17 18:35:32 -04:00
Cirilo Bernardo 28d49b6589 fix race condition related to 3D cache and resolver
The attached patch fixes a segfault due to a race condition.
If a user starts eeschema with an empty sheet and clicks
the 'cvpcb' button, memory is corrupted and the program
segfaults. The issue appears to arise from multiple threads
accessing the 3D cache and resolver. This patch makes
relevant code thread-safe by using a wxCriticalSection.
2016-04-10 23:03:39 -04:00
jean-pierre charras c146cc09eb Kicad: fix a crash when changing a project, if pcbnew was run and "Update PCB from Schematic" was run and Schematic editor never opened.
(In this case the schematic frame exists, but some members are not initialized as expected, and a crash happens when calling the schematic editor dtor)
Minor other fix: avoid multiple very similar strings to translate in 3d_filename_resolver.cpp
2016-04-08 14:11:05 +02:00
Cirilo Bernardo 973786d75d Fix 3D Coverity issue, other minor fixes
* CID 143740:  Null pointer dereferences  (NULL_RETURNS)
A few minor cut/paste and style issues in the 3D code are also fixed.
2016-04-07 18:54:14 -04:00
Simon Richter 6a65341599 3D: Make file test more portable 2016-04-06 22:41:24 -04:00
Mário Luzeiro ffc7740cc2 3D: fix bounding box assert and include order 2016-04-06 21:48:51 -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 e1b308b3b1 fix segfault in python scripting caused by new 3D code
The attached patch ensures the S3D_MASTER class does not cause
a segfault in pcbnew when used from Python scripting.

The issue is due to an "extern KIWAY* TheKiway" which was exposed
to allow S3D_MASTER to use the new resolver to handle 3D filenames.
Unfortunately TheKiway cannot be assigned a value until a window is
created which implements Kiway. The change introduced by this
patch should not alter the behavior of S3D_MASTER compared to
the behavior before the 3D merge.

The extern variable is only there to support S3D_MASTER which in
turn is there to support the current 3DViewer. In the planned software
structure the rather complex S3D_MASTER class is replaced with
a simple struct which only holds the model name and position/
orientation/scale data as stored in the PCB file; since the replacement
does not perform filename resolution there is no need to expose the
Kiway. For example in Mario's branch we removed the extern and
S3D_MASTER class many months ago.
2016-04-05 20:32:50 -04:00
jean-pierre charras d18cdf1c53 merge 3d_initial_merge branch 2016-04-05 19:56:01 +02: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
Cirilo Bernardo 80f8e74797 Make changes to GLM header includes as per suggestions by Mario Luzeiro 2016-03-21 18:39:25 +11:00
Cirilo Bernardo 10c8a57c59 Fixed timestamp checking code to use canonical filename 2016-03-21 07:21:54 +11:00
Cirilo Bernardo aa16666d72 Added file modification check to model cache code 2016-03-20 11:45:55 +11:00
Cirilo Bernardo 491e0250c0 Suppress dialog pop-up when 3D file resolver does not find a file 2016-03-15 11:39:28 +11:00
Cirilo Bernardo a30151231f Fix invocation of glm::cross and glm::normalize 2016-03-15 11:38:55 +11:00
Cirilo Bernardo 30f9aba7c9 Work on SG consistency checks: fixed a number of bugs and improved integrity checking when writing cache files 2016-03-14 12:30:59 +11:00
Cirilo Bernardo 0085d1aea7 Fixed unsigned vs signed int comparisons 2016-03-11 09:37:39 +11:00
Cirilo Bernardo 862cd7e5a4 Fix event processing on C3D_MODEL_VIEWER to allow click-to-focus 2016-03-02 12:29:20 +11:00
Mário Luzerio d4655020f9 Fix zoom issue on MSWin (wxCanvas requires focus) 2016-03-02 07:50:32 +11:00
Cirilo Bernardo d0a2080823 Merge with main branch r6601 2016-03-01 11:44:15 +11:00
Bernhard Stegmaier 5b0a250609 Fix compilation and install for OSX plus general code cleanup 2016-03-01 10:08:19 +11:00
Bernhard Stegmaier 04000883f3 Fix 3d-viewer regressions introduced by touchpad-panning for non-touchpad-panning.
* Fix broken horizontal scrolling with ctrl-wheel
* Restore previous step size
2016-02-26 17:19:22 -05:00
Cirilo Bernardo 0b18af3fdb Changed resolver failure message to use wxLogMessage instead of wxMessageBox 2016-02-26 15:18:59 +11:00
Cirilo Bernardo 37c85113ee Changed resolver failure message to use wxLogMessage instead of wxMessageBox 2016-02-26 15:16:55 +11:00
Cirilo Bernardo 097ac3a6b7 Changed resolver failure message to use wxLogMessage instead of wxMessageBox 2016-02-26 15:14:20 +11:00
Cirilo Bernardo e7c32873ea Remove bad default behavior of adding current working dir to default search path 2016-02-25 14:31:59 +11:00
Cirilo Bernardo b2bdca4b7b Remove wxASSERT in new cbbox code which was a nuisance to the legacy 3DViewer 2016-02-25 09:52:00 +11:00
Bernhard Stegmaier f8abe9c191 Add support for optional touchpad panning. 2016-02-24 14:53:02 -05:00
Cirilo Bernardo 5306db0c98 Added missing include to 3d_plugin_manager 2016-02-24 07:26:58 +11:00
Cirilo Bernardo 9195451e12 Switched SG* classes and plugin loader logging code from stderr to wxLogTrace 2016-02-23 17:46:22 +11:00
Cirilo Bernardo d051a8f47e Changed IFSG* log reports from stderr/stdout to wxLogTrace 2016-02-23 16:28:41 +11:00
Cirilo Bernardo c98ebdb8f0 Changed 3d_cache log reporting from stderr/stdout to wxLogTrace 2016-02-23 14:33:24 +11:00
Cirilo Bernardo 2f8c55cd99 Fixed segfault on getSHA1 (fopen result was not checked) 2016-02-23 11:38:58 +11:00