KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_3d_model_viewer.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
33#ifndef _C3D_MODEL_VIEWER_H_
34#define _C3D_MODEL_VIEWER_H_
35
37#include <gal/hidpi_gl_canvas.h>
38
39class S3D_CACHE;
40class MODEL_3D;
41
46{
47public:
54 EDA_3D_MODEL_VIEWER( wxWindow* aParent, const wxGLAttributes& aGLAttribs,
55 S3D_CACHE* aCacheManager = nullptr );
56
58
64 void Set3DModel( const S3DMODEL& a3DModel );
65
73 void Set3DModel( const wxString& aModelPathName );
74
78 void Clear3DModel();
79
80private:
81 void ogl_initialize();
83
84 void OnPaint( wxPaintEvent& event );
85
86 void OnEraseBackground( wxEraseEvent& event );
87
88 void OnMouseWheel( wxMouseEvent& event );
89
90#ifdef USE_OSX_MAGNIFY_EVENT
91 void OnMagnify( wxMouseEvent& event );
92#endif
93
94 void OnMouseMove( wxMouseEvent& event );
95
96 void OnLeftDown( wxMouseEvent& event );
97
98 void OnLeftUp( wxMouseEvent& event );
99
100 void OnMiddleUp( wxMouseEvent& event );
101
102 void OnMiddleDown( wxMouseEvent& event );
103
104 void OnRightClick( wxMouseEvent& event );
105
106 DECLARE_EVENT_TABLE()
107
108
109 wxGLContext* m_glRC;
110
113
116
119
122
125
130
133
140 static const wxChar* m_logTrace;
141};
142
143#endif // _C3D_MODEL_VIEWER_H_
Implement a canvas based on a wxGLCanvas.
MODEL_3D * m_ogl_3dmodel
Class holder for 3d model to display on openGL.
void OnMiddleDown(wxMouseEvent &event)
void OnMouseMove(wxMouseEvent &event)
void OnEraseBackground(wxEraseEvent &event)
S3D_CACHE * m_cacheManager
Optional cache manager.
void Clear3DModel()
Unload the displayed 3D model.
bool m_reload_is_needed
Flag that we have a new model and it need to be reloaded when the paint is called.
void OnLeftDown(wxMouseEvent &event)
double m_BiuTo3dUnits
factor to convert the model or any other items to keep it in relation to the +/-RANGE_SCALE_3D (it is...
void OnRightClick(wxMouseEvent &event)
void Set3DModel(const S3DMODEL &a3DModel)
Set this model to be displayed.
void OnPaint(wxPaintEvent &event)
bool m_ogl_initialized
Flag if open gl was initialized.
const S3DMODEL * m_3d_model
Original 3d model data.
TRACK_BALL m_trackBallCamera
Camera used in this canvas.
wxGLContext * m_glRC
openGL context
void OnMiddleUp(wxMouseEvent &event)
void OnLeftUp(wxMouseEvent &event)
void OnMouseWheel(wxMouseEvent &event)
wxGLCanvas wrapper for HiDPI/Retina support.
Cache for storing the 3D shapes.
Definition: 3d_cache.h:55
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Store the a model based on meshes and materials.
Definition: c3dmodel.h:91
Declaration for a track ball camera.