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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
28
29#ifndef _C3D_MODEL_VIEWER_H_
30#define _C3D_MODEL_VIEWER_H_
31
33#include <gal/hidpi_gl_canvas.h>
34
35class S3D_CACHE;
36class MODEL_3D;
37
42{
43public:
50 EDA_3D_MODEL_VIEWER( wxWindow* aParent, const wxGLAttributes& aGLAttribs,
51 S3D_CACHE* aCacheManager = nullptr );
52
54
60 void Set3DModel( const S3DMODEL& a3DModel );
61
69 void Set3DModel( const wxString& aModelPathName );
70
74 void Clear3DModel();
75
76private:
77 void ogl_initialize();
79
80 void OnPaint( wxPaintEvent& event );
81
82 void OnEraseBackground( wxEraseEvent& event );
83
84 void OnMouseWheel( wxMouseEvent& event );
85
86#ifdef USE_OSX_MAGNIFY_EVENT
87 void OnMagnify( wxMouseEvent& event );
88#endif
89
90 void OnMouseMove( wxMouseEvent& event );
91
92 void OnLeftDown( wxMouseEvent& event );
93
94 void OnLeftUp( wxMouseEvent& event );
95
96 void OnMiddleUp( wxMouseEvent& event );
97
98 void OnMiddleDown( wxMouseEvent& event );
99
100 void OnRightClick( wxMouseEvent& event );
101
102 DECLARE_EVENT_TABLE()
103
104
105 wxGLContext* m_glRC;
106
109
112
115
118
121
126
129
136 static const wxChar* m_logTrace;
137};
138
139#endif // _C3D_MODEL_VIEWER_H_
MODEL_3D * m_ogl_3dmodel
Class holder for 3d model to display on openGL.
void OnMiddleDown(wxMouseEvent &event)
EDA_3D_MODEL_VIEWER(wxWindow *aParent, const wxGLAttributes &aGLAttribs, S3D_CACHE *aCacheManager=nullptr)
Create a new 3D Canvas with a attribute list.
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)
HIDPI_GL_CANVAS(const KIGFX::VC_SETTINGS &aSettings, wxWindow *aParent, const wxGLAttributes &aGLAttribs, wxWindowID aId=wxID_ANY, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, long aStyle=0, const wxString &aName=wxGLCanvasName, const wxPalette &aPalette=wxNullPalette)
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.