Commit Graph

35 Commits

Author SHA1 Message Date
Mikolaj Wielgus afccea34a5 Remove default zoom level from camera constructor
Initial distance should be sufficient to determine default zoom.
2021-10-24 18:14:49 +00:00
Jeff Young 6c0110ecd3 Naming conventions.
There's nothing "legacy" about the OpenGL 3D renderer.
2021-10-21 14:30:03 +01:00
Ian McInerney 961c127ebe Convert mouse coordinates to native pixesl in the 3D viewer
All operations in the camera are done using the native pixel sizes,
so we need to ensure the mouse coordinates are converted to native
pixels to make the mouse operations line up with the view.

Fixes https://gitlab.com/kicad/code/kicad/issues/2561
Fixes https://gitlab.com/kicad/code/kicad/issues/8410
2021-10-10 17:52:12 +01:00
Wayne Stambaugh 37b200cb3e Pass wxString objects by reference instead of on the stack. 2021-07-27 08:41:27 -04:00
Jeff Young 3347531f70 Better zoom defaults for 3D viewer.
Also includes a fix for 3D model viewer in the file dialog for Retina
(and possibly other HIDPI) displays.

Fixes https://gitlab.com/kicad/code/kicad/issues/6144
2021-06-28 19:08:23 +01:00
Jeff Young 73b91a1a92 More sensible zoom defaults for 3D viewers.
Also fixes a bug where the model viewer in the file picker was using
only 1/4 of the screen on HIDPI displays.
2021-06-28 19:08:23 +01:00
Jeff Young 89718dd3ba Naming conventions. 2021-06-19 19:36:53 +01:00
Ian McInerney ecd9bf696e Be consistent about using nullptr instead of 0
0 can be too easily overloaded into an int, so ensure we use nullptr
when we mean pointers.
2021-04-22 22:20:34 +01:00
Wayne Stambaugh 1c7a5c46e5 3D Viewer: member variable and method naming improvements.
A few build improvements thrown in for a good measure.
2021-01-05 17:24:29 -05:00
Wayne Stambaugh 710e621c6a 3D Viewer: remove all instances of "c" prefix from file names. 2021-01-03 17:44:49 -05:00
Wayne Stambaugh 8416c1fc37 3D Viewer: remove all instances of "C" prefix from object names. 2021-01-02 17:45:36 -05:00
Wayne Stambaugh f8efe4a65a 3D viewer code cleaning round 5. 2020-12-16 17:11:05 -05: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 5a7f875602 3D-Viewer: implements opacity property for 3D models
fixes #2087
2020-05-08 21:28:16 +00: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 191d4daf53 Fix crash on OSX. (It appears the DC isn't used anyway.) 2020-04-10 22:49:56 +01: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
Bernhard Stegmaier 909d95b5be Create HIDPI_GL_CANVAS wrapper for transparent wxGLCanvas HiDPI/Retina support. Enable HiDPI/Retina for 3d-viewer. 2017-12-18 16:26:01 +01:00
Marvin Schmidt 69974b73db Remove some extra semicolons 2017-11-09 19:52:18 +01: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
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
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
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
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 862cd7e5a4 Fix event processing on C3D_MODEL_VIEWER to allow click-to-focus 2016-03-02 12:29:20 +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 86c54ce636 Modified IDF plugin to support IDF assemblies (*.emn) in addition to component outlines (*.idf) 2015-12-18 19:43:27 +11:00
Cirilo Bernardo 008d8a540a + Fixed bug in SGSHAPE::Prepare() : bad assignment of color pointer
+ Reworked s3d_plugin_demo2.cpp to use per-vertex-per-face normals
+ Reworked s3d_plugin_idf.cpp to use per-vertex-per-face normals
2015-12-17 13:55:35 +11:00
Cirilo Bernardo c0fcb15e3a + Rework S3D_CACHE::Prepare() to take only a filename and return
non-transformed S3DMODEL for rendering.
+ S3D_CACHE now caches S3DMODEL and returns a pointer to a single
  instance of the S3DMODEL for repeated calls to Prepare()
+ Beginning the VRML Plugin
2015-12-16 20:01:44 +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
Cirilo Bernardo a0597c4614 GUI improvements including interactive update of model orientation/position 2015-12-09 16:43:30 +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