KiCad PCB EDA Suite
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 int* aAttribList = nullptr,
55 S3D_CACHE* aCacheManager = nullptr );
56
58
64 void Set3DModel( const S3DMODEL& a3DModel );
65
71 void Set3DModel( const wxString& aModelPathName );
72
76 void Clear3DModel();
77
78private:
79 void ogl_initialize();
81
82 void OnPaint( wxPaintEvent& event );
83
84 void OnEraseBackground( wxEraseEvent& event );
85
86 void OnMouseWheel( wxMouseEvent& event );
87
88#ifdef USE_OSX_MAGNIFY_EVENT
89 void OnMagnify( wxMouseEvent& event );
90#endif
91
92 void OnMouseMove( wxMouseEvent& event );
93
94 void OnLeftDown( wxMouseEvent& event );
95
96 void OnLeftUp( wxMouseEvent& event );
97
98 void OnMiddleUp( wxMouseEvent& event );
99
100 void OnMiddleDown( wxMouseEvent& event );
101
102 void OnRightClick( wxMouseEvent& event );
103
104 DECLARE_EVENT_TABLE()
105
106
107 wxGLContext* m_glRC;
108
111
114
117
120
123
128
131
138 static const wxChar* m_logTrace;
139};
140
141#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)
EDA_3D_MODEL_VIEWER(wxWindow *aParent, const int *aAttribList=nullptr, S3D_CACHE *aCacheManager=nullptr)
Create a new 3D Canvas with a attribute list.
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:53
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.