KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EDA_3D_MODEL_VIEWER Class Reference

Implement a canvas based on a wxGLCanvas. More...

#include <eda_3d_model_viewer.h>

Inheritance diagram for EDA_3D_MODEL_VIEWER:
HIDPI_GL_CANVAS

Public Member Functions

 EDA_3D_MODEL_VIEWER (wxWindow *aParent, const wxGLAttributes &aGLAttribs, S3D_CACHE *aCacheManager=nullptr)
 Create a new 3D Canvas with a attribute list.
 
 ~EDA_3D_MODEL_VIEWER ()
 
void Set3DModel (const S3DMODEL &a3DModel)
 Set this model to be displayed.
 
void Set3DModel (const wxString &aModelPathName)
 Set this model to be displayed.
 
void Clear3DModel ()
 Unload the displayed 3D model.
 
virtual wxSize GetNativePixelSize () const
 
wxPoint GetNativePosition (const wxPoint &aPoint) const
 Convert the given point from client coordinates to native pixel coordinates.
 
double GetScaleFactor () const
 Get the current scale factor.
 
void SetVcSettings (const KIGFX::VC_SETTINGS &aVcSettings)
 

Protected Attributes

KIGFX::VC_SETTINGS m_settings
 < Current VIEW_CONTROLS settings.
 

Private Member Functions

void ogl_initialize ()
 
void ogl_set_arrow_material ()
 
void OnPaint (wxPaintEvent &event)
 
void OnEraseBackground (wxEraseEvent &event)
 
void OnMouseWheel (wxMouseEvent &event)
 
void OnMouseMove (wxMouseEvent &event)
 
void OnLeftDown (wxMouseEvent &event)
 
void OnLeftUp (wxMouseEvent &event)
 
void OnMiddleUp (wxMouseEvent &event)
 
void OnMiddleDown (wxMouseEvent &event)
 
void OnRightClick (wxMouseEvent &event)
 

Private Attributes

wxGLContext * m_glRC
 openGL context
 
TRACK_BALL m_trackBallCamera
 Camera used in this canvas.
 
const S3DMODELm_3d_model
 Original 3d model data.
 
MODEL_3Dm_ogl_3dmodel
 Class holder for 3d model to display on openGL.
 
bool m_reload_is_needed
 Flag that we have a new model and it need to be reloaded when the paint is called.
 
bool m_ogl_initialized
 Flag if open gl was initialized.
 
double m_BiuTo3dUnits
 factor to convert the model or any other items to keep it in relation to the +/-RANGE_SCALE_3D (it is named same as the board render for better understanding proposes)
 
S3D_CACHEm_cacheManager
 Optional cache manager.
 

Static Private Attributes

static const wxChar * m_logTrace = wxT( "KI_TRACE_EDA_3D_MODEL_VIEWER" )
 Trace mask used to enable or disable the trace output of this class.
 

Detailed Description

Implement a canvas based on a wxGLCanvas.

Definition at line 45 of file eda_3d_model_viewer.h.

Constructor & Destructor Documentation

◆ EDA_3D_MODEL_VIEWER()

EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER ( wxWindow *  aParent,
const wxGLAttributes &  aGLAttribs,
S3D_CACHE aCacheManager = nullptr 
)

Create a new 3D Canvas with a attribute list.

Parameters
aParentthe parent creator of this canvas.
aGLAttribsopenGL attributes created by OGL_ATT_LIST::GetAttributesList.

Definition at line 89 of file eda_3d_model_viewer.cpp.

References m_3d_model, m_BiuTo3dUnits, m_glRC, m_logTrace, m_ogl_3dmodel, m_ogl_initialized, and m_reload_is_needed.

◆ ~EDA_3D_MODEL_VIEWER()

Member Function Documentation

◆ Clear3DModel()

void EDA_3D_MODEL_VIEWER::Clear3DModel ( )

Unload the displayed 3D model.

Definition at line 169 of file eda_3d_model_viewer.cpp.

References m_3d_model, m_ogl_3dmodel, m_reload_is_needed, and Refresh().

Referenced by Set3DModel().

◆ GetNativePixelSize()

wxSize HIDPI_GL_CANVAS::GetNativePixelSize ( ) const
virtualinherited

◆ GetNativePosition()

wxPoint HIDPI_GL_CANVAS::GetNativePosition ( const wxPoint &  aPoint) const
inherited

Convert the given point from client coordinates to native pixel coordinates.

Definition at line 54 of file hidpi_gl_canvas.cpp.

References HIDPI_GL_CANVAS::GetScaleFactor().

Referenced by OnMouseMove(), HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), and HIDPI_GL_3D_CANVAS::OnMouseWheelCamera().

◆ GetScaleFactor()

◆ ogl_initialize()

void EDA_3D_MODEL_VIEWER::ogl_initialize ( )
private

Definition at line 183 of file eda_3d_model_viewer.cpp.

References From_UTF8(), m_logTrace, RANGE_SCALE_3D, and SetOpenGLInfo().

Referenced by OnPaint().

◆ ogl_set_arrow_material()

void EDA_3D_MODEL_VIEWER::ogl_set_arrow_material ( )
private

Definition at line 232 of file eda_3d_model_viewer.cpp.

Referenced by OnPaint().

◆ OnEraseBackground()

void EDA_3D_MODEL_VIEWER::OnEraseBackground ( wxEraseEvent &  event)
private

Definition at line 390 of file eda_3d_model_viewer.cpp.

References m_logTrace.

◆ OnLeftDown()

void EDA_3D_MODEL_VIEWER::OnLeftDown ( wxMouseEvent &  event)
private

Definition at line 454 of file eda_3d_model_viewer.cpp.

◆ OnLeftUp()

void EDA_3D_MODEL_VIEWER::OnLeftUp ( wxMouseEvent &  event)
private

Definition at line 460 of file eda_3d_model_viewer.cpp.

◆ OnMiddleDown()

void EDA_3D_MODEL_VIEWER::OnMiddleDown ( wxMouseEvent &  event)
private

Definition at line 466 of file eda_3d_model_viewer.cpp.

◆ OnMiddleUp()

void EDA_3D_MODEL_VIEWER::OnMiddleUp ( wxMouseEvent &  event)
private

Definition at line 472 of file eda_3d_model_viewer.cpp.

◆ OnMouseMove()

void EDA_3D_MODEL_VIEWER::OnMouseMove ( wxMouseEvent &  event)
private

◆ OnMouseWheel()

void EDA_3D_MODEL_VIEWER::OnMouseWheel ( wxMouseEvent &  event)
private

◆ OnPaint()

◆ OnRightClick()

void EDA_3D_MODEL_VIEWER::OnRightClick ( wxMouseEvent &  event)
private

Definition at line 478 of file eda_3d_model_viewer.cpp.

◆ Set3DModel() [1/2]

void EDA_3D_MODEL_VIEWER::Set3DModel ( const S3DMODEL a3DModel)

◆ Set3DModel() [2/2]

void EDA_3D_MODEL_VIEWER::Set3DModel ( const wxString &  aModelPathName)

Set this model to be displayed.

N.B. This will not load a model from the internal cache. Only from on disk.

Parameters
aModelPathName3D model path name. Must be a file on disk.

Definition at line 153 of file eda_3d_model_viewer.cpp.

References Clear3DModel(), S3D_CACHE::GetModel(), m_cacheManager, m_logTrace, and Set3DModel().

◆ SetVcSettings()

void HIDPI_GL_CANVAS::SetVcSettings ( const KIGFX::VC_SETTINGS aVcSettings)
inlineinherited

Definition at line 62 of file hidpi_gl_canvas.h.

Referenced by EDA_3D_VIEWER_FRAME::applySettings().

Member Data Documentation

◆ m_3d_model

const S3DMODEL* EDA_3D_MODEL_VIEWER::m_3d_model
private

Original 3d model data.

Definition at line 115 of file eda_3d_model_viewer.h.

Referenced by Clear3DModel(), EDA_3D_MODEL_VIEWER(), OnPaint(), and Set3DModel().

◆ m_BiuTo3dUnits

double EDA_3D_MODEL_VIEWER::m_BiuTo3dUnits
private

factor to convert the model or any other items to keep it in relation to the +/-RANGE_SCALE_3D (it is named same as the board render for better understanding proposes)

Definition at line 129 of file eda_3d_model_viewer.h.

Referenced by EDA_3D_MODEL_VIEWER(), and OnPaint().

◆ m_cacheManager

S3D_CACHE* EDA_3D_MODEL_VIEWER::m_cacheManager
private

Optional cache manager.

Definition at line 132 of file eda_3d_model_viewer.h.

Referenced by Set3DModel().

◆ m_glRC

wxGLContext* EDA_3D_MODEL_VIEWER::m_glRC
private

openGL context

Definition at line 109 of file eda_3d_model_viewer.h.

Referenced by EDA_3D_MODEL_VIEWER(), OnPaint(), and ~EDA_3D_MODEL_VIEWER().

◆ m_ogl_3dmodel

MODEL_3D* EDA_3D_MODEL_VIEWER::m_ogl_3dmodel
private

Class holder for 3d model to display on openGL.

Definition at line 118 of file eda_3d_model_viewer.h.

Referenced by Clear3DModel(), EDA_3D_MODEL_VIEWER(), OnPaint(), Set3DModel(), and ~EDA_3D_MODEL_VIEWER().

◆ m_ogl_initialized

bool EDA_3D_MODEL_VIEWER::m_ogl_initialized
private

Flag if open gl was initialized.

Definition at line 124 of file eda_3d_model_viewer.h.

Referenced by EDA_3D_MODEL_VIEWER(), and OnPaint().

◆ m_reload_is_needed

bool EDA_3D_MODEL_VIEWER::m_reload_is_needed
private

Flag that we have a new model and it need to be reloaded when the paint is called.

Definition at line 121 of file eda_3d_model_viewer.h.

Referenced by Clear3DModel(), EDA_3D_MODEL_VIEWER(), OnPaint(), and Set3DModel().

◆ m_settings

KIGFX::VC_SETTINGS HIDPI_GL_CANVAS::m_settings
protectedinherited

< Current VIEW_CONTROLS settings.

Definition at line 66 of file hidpi_gl_canvas.h.

Referenced by HIDPI_GL_3D_CANVAS::OnMouseWheelCamera().

◆ m_trackBallCamera

TRACK_BALL EDA_3D_MODEL_VIEWER::m_trackBallCamera
private

Camera used in this canvas.

Definition at line 112 of file eda_3d_model_viewer.h.

Referenced by OnMouseMove(), OnMouseWheel(), and OnPaint().


The documentation for this class was generated from the following files: