KiCad PCB EDA Suite
EDA_3D_CANVAS Class Reference

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

#include <eda_3d_canvas.h>

Inheritance diagram for EDA_3D_CANVAS:
HIDPI_GL_CANVAS

Public Member Functions

 EDA_3D_CANVAS (wxWindow *aParent, const int *aAttribList=0, BOARD *aBoard=NULL, CINFO3D_VISU &aSettings=G_null_CINFO3D_VISU, S3D_CACHE *a3DCachePointer=NULL)
 EDA_3D_CANVAS - Creates a new 3D Canvas with a attribute list. More...
 
 ~EDA_3D_CANVAS ()
 
void SetStatusBar (wxStatusBar *aStatusBar)
 
void ReloadRequest (BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
 
bool IsReloadRequestPending () const
 IsReloadRequestPending - Query if there is a pending reload request. More...
 
void RenderRaytracingRequest ()
 RenderRaytracingRequest - Request to render the current view in Raytracing mode. More...
 
void GetScreenshot (wxImage &aDstImage)
 Request a screenshot and output it to the aDstImage. More...
 
bool SetView3D (int aKeycode)
 SetView3D - Helper function to call view commands. More...
 
void RenderEngineChanged ()
 RenderEngineChanged - Notify that the render engine was changed. More...
 
void DisplayStatus ()
 DisplayStatus - Update the status bar with the position information. More...
 
void Request_refresh (bool aRedrawImmediately=true)
 Request_refresh - Schedule a refresh update of the canvas. More...
 
void OnKeyEvent (wxKeyEvent &event)
 
bool SupportsRayTracing () const
 
bool IsOpenGLInitialized () const
 
EDA_HOTKEY_CONFIGGetHotkeyConfig () const
 Return a structure containing currently used hotkey mapping. More...
 
virtual wxSize GetNativePixelSize () const
 
virtual float GetBackingScaleFactor () const
 

Private Member Functions

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)
 
void OnPopUpMenu (wxCommandEvent &event)
 
void OnCharHook (wxKeyEvent &event)
 
void OnTimerTimeout_Editing (wxTimerEvent &event)
 
void OnCloseWindow (wxCloseEvent &event)
 OnCloseWindow - called when the frame is closed. More...
 
void OnResize (wxSizeEvent &event)
 
void OnTimerTimeout_Redraw (wxTimerEvent &event)
 
void stop_editingTimeOut_Timer ()
 stop_editingTimeOut_Timer - stop the editing time, so it will not timeout More...
 
void restart_editingTimeOut_Timer ()
 restart_editingTimeOut_Timer - reset the editing timer More...
 
void request_start_moving_camera (float aMovingSpeed=2.0f, bool aRenderPivot=true)
 request_start_moving_camera - start a camera movement More...
 
void move_pivot_based_on_cur_mouse_position ()
 move_pivot_based_on_cur_mouse_position - This function hits a ray to the board and start a moviment More...
 
void render_pivot (float t, float aScale)
 render_pivot - render the pivot cursor More...
 
bool initializeOpenGL ()
 initializeOpenGL More...
 
void releaseOpenGL ()
 releaseOpenGL - free created targets and openGL context More...
 

Private Attributes

wxGLContext * m_glRC
 current OpenGL context More...
 
wxStatusBar * m_parentStatusBar
 Parent statusbar to report progress. More...
 
wxTimer m_editing_timeout_timer
 Time timeout will expires after some time sinalizing that the mouse / keyboard movements are over. More...
 
wxTimer m_redraw_trigger_timer
 This timer will be used to schedule a redraw event. More...
 
bool m_mouse_is_moving
 true if mouse activity is on progress More...
 
bool m_mouse_was_moved
 true if there was some type of activity, it will be used to render in preview mode More...
 
bool m_camera_is_moving
 true if camera animation is ongoing More...
 
bool m_render_pivot
 activated the render of pivot while camera moving More...
 
float m_camera_moving_speed
 1.0f will be 1:1 More...
 
unsigned m_strtime_camera_movement
 Stores the ticktime when the camera star its movement. More...
 
CINFO3D_VISUm_settings
 Stores all pre-computed 3D information and visualization settings to render the board. More...
 
C3D_RENDER_BASEm_3d_render
 The current render in used for this canvas. More...
 
C3D_RENDER_RAYTRACINGm_3d_render_raytracing
 Raytracing render class. More...
 
C3D_RENDER_OGL_LEGACYm_3d_render_ogl_legacy
 OpenGL legacy render class. More...
 
bool m_is_opengl_initialized
 Flag to store if opengl was initialized already. More...
 
bool m_render_raytracing_was_requested
 Flags that the user requested the current view to be render with raytracing. More...
 
bool m_opengl_supports_raytracing
 

Static Private Attributes

static const float m_delta_move_step_factor = 0.7f
 Step factor to used with cursor on relation to the current zoom. More...
 
static const wxChar * m_logTrace = wxT( "KI_TRACE_EDA_3D_CANVAS" )
 Trace mask used to enable or disable the trace output of this class. More...
 

Detailed Description

Implement a canvas based on a wxGLCanvas.

Definition at line 52 of file eda_3d_canvas.h.

Constructor & Destructor Documentation

◆ EDA_3D_CANVAS()

EDA_3D_CANVAS::EDA_3D_CANVAS ( wxWindow *  aParent,
const int *  aAttribList = 0,
BOARD aBoard = NULL,
CINFO3D_VISU aSettings = G_null_CINFO3D_VISU,
S3D_CACHE a3DCachePointer = NULL 
)

EDA_3D_CANVAS - Creates a new 3D Canvas with a attribute list.

Parameters
aParentthe parent creator of this canvas
aAttribLista list of openGL options created by GetOpenGL_AttributesList
aBoardThe board
aSettingsthe settings options to be used by this canvas

◆ ~EDA_3D_CANVAS()

EDA_3D_CANVAS::~EDA_3D_CANVAS ( )

Definition at line 154 of file eda_3d_canvas.cpp.

155 {
156  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::~EDA_3D_CANVAS" );
157 
158  releaseOpenGL();
159 }
void releaseOpenGL()
releaseOpenGL - free created targets and openGL context
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.

References m_logTrace, and releaseOpenGL().

Member Function Documentation

◆ DisplayStatus()

void EDA_3D_CANVAS::DisplayStatus ( )

DisplayStatus - Update the status bar with the position information.

Definition at line 300 of file eda_3d_canvas.cpp.

301 {
302  if( m_parentStatusBar )
303  {
304  wxString msg;
305 
306  msg.Printf( "dx %3.2f", m_settings.CameraGet().GetCameraPos().x );
307  m_parentStatusBar->SetStatusText( msg, 1 );
308 
309  msg.Printf( "dy %3.2f", m_settings.CameraGet().GetCameraPos().y );
310  m_parentStatusBar->SetStatusText( msg, 2 );
311  }
312 }
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
wxStatusBar * m_parentStatusBar
Parent statusbar to report progress.
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
const SFVEC3F & GetCameraPos() const
Definition: ccamera.h:131

References CINFO3D_VISU::CameraGet(), CCAMERA::GetCameraPos(), m_parentStatusBar, and m_settings.

Referenced by OnMouseMove(), OnMouseWheel(), OnPaint(), EDA_3D_VIEWER::ProcessZoom(), request_start_moving_camera(), and SetView3D().

◆ GetBackingScaleFactor()

float HIDPI_GL_CANVAS::GetBackingScaleFactor ( ) const
virtualinherited

Definition at line 59 of file hidpi_gl_canvas.cpp.

60 {
61 #ifdef RETINA_OPENGL_PATCH
62  // this is ugly, but original method isn't marked const although it doesn't modify anything
63  // => clean up when it officially has arrived in wxWidgets
64  return static_cast< wxGLCanvas* >( const_cast< HIDPI_GL_CANVAS* >( this ))->GetBackingScaleFactor();
65 #else
66  return 1.0f;
67 #endif
68 }

Referenced by KIGFX::OPENGL_GAL::beginDrawing(), HIDPI_GL_CANVAS::GetNativePixelSize(), KIGFX::OPENGL_GAL::getScreenPixelSize(), and KIGFX::OPENGL_GAL::ResizeScreen().

◆ GetHotkeyConfig()

EDA_HOTKEY_CONFIG * EDA_3D_CANVAS::GetHotkeyConfig ( ) const

Return a structure containing currently used hotkey mapping.

Definition at line 102 of file 3d-viewer/3d_viewer/hotkeys.cpp.

103 {
105 }
static struct EDA_HOTKEY_CONFIG s_3DViewer_Hotkeys_Descr[]

References s_3DViewer_Hotkeys_Descr.

Referenced by OnRightClick().

◆ GetNativePixelSize()

wxSize HIDPI_GL_CANVAS::GetNativePixelSize ( ) const
virtualinherited

Definition at line 46 of file hidpi_gl_canvas.cpp.

47 {
48  wxSize size = wxGLCanvas::GetClientSize();
49 
50 #ifdef RETINA_OPENGL_PATCH
51  const float scaleFactor = GetBackingScaleFactor();
52  size.x *= scaleFactor;
53  size.y *= scaleFactor;
54 #endif
55 
56  return size;
57 }
virtual float GetBackingScaleFactor() const

References HIDPI_GL_CANVAS::GetBackingScaleFactor().

Referenced by OnMouseMove(), OnPaint(), and KIGFX::OPENGL_GAL::OPENGL_GAL().

◆ GetScreenshot()

void EDA_3D_CANVAS::GetScreenshot ( wxImage &  aDstImage)

Request a screenshot and output it to the aDstImage.

Parameters
aDstImage- Screenshot destination image

Definition at line 267 of file eda_3d_canvas.cpp.

268 {
269  OGL_GetScreenshot( aDstImage );
270 }
void OGL_GetScreenshot(wxImage &aDstImage)
OGL_GetScreenshot - got the pixel data of current OpenGL image.
Definition: ogl_utils.cpp:35

References OGL_GetScreenshot().

Referenced by EDA_3D_VIEWER::takeScreenshot().

◆ initializeOpenGL()

bool EDA_3D_CANVAS::initializeOpenGL ( )
private

initializeOpenGL

Returns
if OpenGL initialization succeed

Definition at line 198 of file eda_3d_canvas.cpp.

199 {
200  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL" );
201 
202  const GLenum err = glewInit();
203 
204  if( GLEW_OK != err )
205  {
206  const wxString msgError = (const char*) glewGetErrorString( err );
207 
208  wxLogMessage( msgError );
209 
210  return false;
211  }
212  else
213  {
214  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s",
215  FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
216  }
217 
218  wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
219 
220  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL version string %s.",
221  __WXFUNCTION__, version );
222 
223  // Extract OpenGL version from string. This method is used because prior to OpenGL 2,
224  // getting the OpenGL major and minor version as integers didn't exist.
225  wxString tmp;
226 
227  wxStringTokenizer tokenizer( version );
228 
230 
231  if( tokenizer.HasMoreTokens() )
232  {
233  long major = 0;
234  long minor = 0;
235 
236  tmp = tokenizer.GetNextToken();
237 
238  tokenizer.SetString( tmp, wxString( "." ) );
239 
240  if( tokenizer.HasMoreTokens() )
241  tokenizer.GetNextToken().ToLong( &major );
242 
243  if( tokenizer.HasMoreTokens() )
244  tokenizer.GetNextToken().ToLong( &minor );
245 
246  if( major < 2 || ( (major == 2 ) && (minor < 1) ) )
247  {
248  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL ray tracing not supported.",
249  __WXFUNCTION__ );
250 
251  if( GetParent() )
252  {
253  wxCommandEvent evt( wxEVT_MENU, ID_DISABLE_RAY_TRACING );
254  GetParent()->ProcessWindowEvent( evt );
255  }
256 
258  }
259  }
260 
262 
263  return true;
264 }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:53
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
string & err
Definition: json11.cpp:598
bool m_is_opengl_initialized
Flag to store if opengl was initialized already.
bool m_opengl_supports_raytracing

References err, FROM_UTF8(), ID_DISABLE_RAY_TRACING, m_is_opengl_initialized, m_logTrace, and m_opengl_supports_raytracing.

Referenced by OnPaint().

◆ IsOpenGLInitialized()

bool EDA_3D_CANVAS::IsOpenGLInitialized ( ) const
inline

Definition at line 129 of file eda_3d_canvas.h.

129 { return m_is_opengl_initialized; }
bool m_is_opengl_initialized
Flag to store if opengl was initialized already.

References m_is_opengl_initialized.

◆ IsReloadRequestPending()

bool EDA_3D_CANVAS::IsReloadRequestPending ( ) const
inline

IsReloadRequestPending - Query if there is a pending reload request.

Returns
true if it wants to reload, false if there is no reload pending

Definition at line 81 of file eda_3d_canvas.h.

82  {
83  if( m_3d_render )
85  else
86  return false;
87  }
bool IsReloadRequestPending() const
IsReloadRequestPending - Query if there is a pending reload request.
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.

References C3D_RENDER_BASE::IsReloadRequestPending(), and m_3d_render.

Referenced by EDA_3D_VIEWER::OnActivate().

◆ move_pivot_based_on_cur_mouse_position()

void EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position ( )
private

move_pivot_based_on_cur_mouse_position - This function hits a ray to the board and start a moviment

Definition at line 916 of file eda_3d_canvas.cpp.

917 {
918  SFVEC3F rayOrigin;
919  SFVEC3F rayDir;
920 
921  // Generate a ray origin and direction based on current mouser position and camera
922  m_settings.CameraGet().MakeRayAtCurrrentMousePosition( rayOrigin, rayDir );
923 
924  RAY mouseRay;
925  mouseRay.Init( rayOrigin, rayDir );
926 
927  float hit_t;
928 
929  // Test it with the board bounding box
930  if( m_settings.GetBBox3DU().Intersect( mouseRay, &hit_t ) )
931  {
934  m_settings.CameraGet().SetLookAtPos_T1( mouseRay.at( hit_t ) );
936 
938  }
939 }
void SetLookAtPos_T1(const SFVEC3F &aLookAtPos)
Definition: ccamera.h:125
void request_start_moving_camera(float aMovingSpeed=2.0f, bool aRenderPivot=true)
request_start_moving_camera - start a camera movement
virtual void SetT0_and_T1_current_T()
SetT0_and_T1_current_T - This will set T0 and T1 with the current values.
Definition: ccamera.cpp:535
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
void ResetXYpos_T1()
Definition: ccamera.cpp:382
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:40
Definition: ray.h:43
SFVEC3F at(float t) const
Definition: ray.h:65
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
const CBBOX & GetBBox3DU() const
GetBBox3DU - Get the bbox of the pcb board.
Definition: cinfo3d_visu.h:147
void MakeRayAtCurrrentMousePosition(SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
MakeRayAtCurrrentMousePosition - Make a ray based on the latest mouse position.
Definition: ccamera.cpp:350
bool Intersect(const RAY &aRay, float *t) const
Function Intersect.
Definition: cbbox_ray.cpp:46
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void SetInterpolateMode(CAMERA_INTERPOLATION aInterpolateMode)
Definition: ccamera.h:198

References RAY::at(), CINFO3D_VISU::CameraGet(), CINFO3D_VISU::GetBBox3DU(), RAY::Init(), INTERPOLATION_BEZIER, CBBOX::Intersect(), m_settings, CCAMERA::MakeRayAtCurrrentMousePosition(), request_start_moving_camera(), CCAMERA::ResetXYpos_T1(), CCAMERA::SetInterpolateMode(), CCAMERA::SetLookAtPos_T1(), and CCAMERA::SetT0_and_T1_current_T().

Referenced by OnMiddleUp(), and SetView3D().

◆ OnCharHook()

void EDA_3D_CANVAS::OnCharHook ( wxKeyEvent &  event)
private

Definition at line 800 of file eda_3d_canvas.cpp.

801 {
802  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnCharHook" );
803  event.Skip();
804 }

◆ OnCloseWindow()

void EDA_3D_CANVAS::OnCloseWindow ( wxCloseEvent &  event)
private

OnCloseWindow - called when the frame is closed.

Parameters
event

Definition at line 184 of file eda_3d_canvas.cpp.

185 {
186  releaseOpenGL();
187 
188  event.Skip();
189 }
void releaseOpenGL()
releaseOpenGL - free created targets and openGL context

References releaseOpenGL().

◆ OnEraseBackground()

void EDA_3D_CANVAS::OnEraseBackground ( wxEraseEvent &  event)
private

Definition at line 477 of file eda_3d_canvas.cpp.

478 {
479  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnEraseBackground" );
480  // Do nothing, to avoid flashing.
481 }
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.

References m_logTrace.

◆ OnKeyEvent()

void EDA_3D_CANVAS::OnKeyEvent ( wxKeyEvent &  event)

Definition at line 807 of file eda_3d_canvas.cpp.

808 {
809  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnKeyEvent" );
810  int localkey = event.GetKeyCode();
811 
812  // Use only upper char values in comparisons
813  // (the Shift modifier is a separate attribute)
814  if( (localkey >= 'a') && (localkey <= 'z') )
815  localkey += 'A' - 'a';
816 
817  if( m_camera_is_moving )
818  return;
819 
820  if( event.ShiftDown() )
821  localkey |= GR_KB_SHIFT;
822 
823  if( event.ControlDown() )
824  localkey |= GR_KB_CTRL;
825 
826  if( event.AltDown() )
827  localkey |= GR_KB_ALT;
828 
829  if( !SetView3D( localkey ) )
830  event.Skip();
831 }
#define GR_KB_ALT
#define GR_KB_CTRL
bool m_camera_is_moving
true if camera animation is ongoing
#define GR_KB_SHIFT
bool SetView3D(int aKeycode)
SetView3D - Helper function to call view commands.

References GR_KB_ALT, GR_KB_CTRL, GR_KB_SHIFT, m_camera_is_moving, and SetView3D().

Referenced by EDA_3D_VIEWER::OnKeyEvent().

◆ OnLeftDown()

void EDA_3D_CANVAS::OnLeftDown ( wxMouseEvent &  event)
private

Definition at line 601 of file eda_3d_canvas.cpp.

602 {
603  SetFocus();
605 }
void stop_editingTimeOut_Timer()
stop_editingTimeOut_Timer - stop the editing time, so it will not timeout

References stop_editingTimeOut_Timer().

◆ OnLeftUp()

void EDA_3D_CANVAS::OnLeftUp ( wxMouseEvent &  event)
private

Definition at line 608 of file eda_3d_canvas.cpp.

609 {
610  if( m_camera_is_moving )
611  return;
612 
613  if( m_mouse_is_moving )
614  {
615  m_mouse_is_moving = false;
617  }
618 }
bool m_mouse_is_moving
true if mouse activity is on progress
void restart_editingTimeOut_Timer()
restart_editingTimeOut_Timer - reset the editing timer
bool m_camera_is_moving
true if camera animation is ongoing

References m_camera_is_moving, m_mouse_is_moving, and restart_editingTimeOut_Timer().

◆ OnMiddleDown()

void EDA_3D_CANVAS::OnMiddleDown ( wxMouseEvent &  event)
private

Definition at line 621 of file eda_3d_canvas.cpp.

622 {
623  SetFocus();
625 }
void stop_editingTimeOut_Timer()
stop_editingTimeOut_Timer - stop the editing time, so it will not timeout

References stop_editingTimeOut_Timer().

◆ OnMiddleUp()

void EDA_3D_CANVAS::OnMiddleUp ( wxMouseEvent &  event)
private

Definition at line 628 of file eda_3d_canvas.cpp.

629 {
630  if( m_camera_is_moving )
631  return;
632 
633  if( m_mouse_is_moving )
634  {
635  m_mouse_is_moving = false;
637  }
638  else
639  {
641  }
642 }
bool m_mouse_is_moving
true if mouse activity is on progress
void restart_editingTimeOut_Timer()
restart_editingTimeOut_Timer - reset the editing timer
bool m_camera_is_moving
true if camera animation is ongoing
void move_pivot_based_on_cur_mouse_position()
move_pivot_based_on_cur_mouse_position - This function hits a ray to the board and start a moviment

References m_camera_is_moving, m_mouse_is_moving, move_pivot_based_on_cur_mouse_position(), and restart_editingTimeOut_Timer().

◆ OnMouseMove()

void EDA_3D_CANVAS::OnMouseMove ( wxMouseEvent &  event)
private

Definition at line 572 of file eda_3d_canvas.cpp.

573 {
574  //wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnMouseMove" ) );
575 
576  if( m_camera_is_moving )
577  return;
578 
580 
581  if( event.Dragging() )
582  {
583  if( event.LeftIsDown() ) // Drag
584  m_settings.CameraGet().Drag( event.GetPosition() );
585  else if( event.MiddleIsDown() ) // Pan
586  m_settings.CameraGet().Pan( event.GetPosition() );
587 
588  m_mouse_is_moving = true;
589  m_mouse_was_moved = true;
590 
591  // orientation has changed, redraw mesh
592  DisplayStatus();
593  Request_refresh();
594  }
595 
596  const wxPoint eventPosition = event.GetPosition();
597  m_settings.CameraGet().SetCurMousePosition( eventPosition );
598 }
virtual wxSize GetNativePixelSize() const
bool m_mouse_is_moving
true if mouse activity is on progress
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void SetCurMousePosition(const wxPoint &aPosition)
It updates the current mouse position without make any new recalculations on camera.
Definition: ccamera.cpp:401
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
bool m_camera_is_moving
true if camera animation is ongoing
virtual void Drag(const wxPoint &aNewMousePosition)=0
Calculate a new mouse drag position.
bool SetCurWindowSize(const wxSize &aSize)
SetCurWindowSize - update the windows size of the camera.
Definition: ccamera.cpp:428
virtual void Pan(const wxPoint &aNewMousePosition)=0

References CINFO3D_VISU::CameraGet(), DisplayStatus(), CCAMERA::Drag(), HIDPI_GL_CANVAS::GetNativePixelSize(), m_camera_is_moving, m_mouse_is_moving, m_mouse_was_moved, m_settings, CCAMERA::Pan(), Request_refresh(), CCAMERA::SetCurMousePosition(), and CCAMERA::SetCurWindowSize().

◆ OnMouseWheel()

void EDA_3D_CANVAS::OnMouseWheel ( wxMouseEvent &  event)
private

Definition at line 484 of file eda_3d_canvas.cpp.

485 {
486  bool mouseActivity = false;
487 
488  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnMouseWheel" );
489 
490  if( m_camera_is_moving )
491  return;
492 
493  float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
494 
496  delta_move *= (0.01f * event.GetWheelRotation());
497  else
498  if( event.GetWheelRotation() < 0 )
499  delta_move = -delta_move;
500 
501  // mousewheel_panning enabled:
502  // wheel -> pan;
503  // wheel + shift -> horizontal scrolling;
504  // wheel + ctrl -> zooming;
505  // mousewheel_panning disabled:
506  // wheel + shift -> vertical scrolling;
507  // wheel + ctrl -> horizontal scrolling;
508  // wheel -> zooming.
509 
510  if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) && !event.ControlDown() )
511  {
512  if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
513  m_settings.CameraGet().Pan( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
514  else
515  m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
516 
517  mouseActivity = true;
518  }
519  else if( event.ShiftDown() && !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
520  {
521  m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
522  mouseActivity = true;
523  }
524  else if( event.ControlDown() && !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
525  {
526  m_settings.CameraGet().Pan( SFVEC3F( delta_move, 0.0f, 0.0f ) );
527  mouseActivity = true;
528  }
529  else
530  {
531  mouseActivity = m_settings.CameraGet().Zoom( event.GetWheelRotation() > 0 ? 1.1f : 1/1.1f );
532  }
533 
534  // If it results on a camera movement
535  if( mouseActivity )
536  {
537  DisplayStatus();
538  Request_refresh();
539 
540  m_mouse_is_moving = true;
541  m_mouse_was_moved = true;
542 
544  }
545 
546  // Update the cursor current mouse position on the camera
547  m_settings.CameraGet().SetCurMousePosition( event.GetPosition() );
548 }
bool m_mouse_is_moving
true if mouse activity is on progress
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
void SetCurMousePosition(const wxPoint &aPosition)
It updates the current mouse position without make any new recalculations on camera.
Definition: ccamera.cpp:401
bool Zoom(float aFactor)
Definition: ccamera.cpp:454
void restart_editingTimeOut_Timer()
restart_editingTimeOut_Timer - reset the editing timer
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
float ZoomGet() const
Definition: ccamera.cpp:490
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
bool m_camera_is_moving
true if camera animation is ongoing
virtual void Pan(const wxPoint &aNewMousePosition)=0
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
static const float m_delta_move_step_factor
Step factor to used with cursor on relation to the current zoom.

References CINFO3D_VISU::CameraGet(), DisplayStatus(), FL_MOUSEWHEEL_PANNING, CINFO3D_VISU::GetFlag(), m_camera_is_moving, m_delta_move_step_factor, m_logTrace, m_mouse_is_moving, m_mouse_was_moved, m_settings, CCAMERA::Pan(), Request_refresh(), restart_editingTimeOut_Timer(), CCAMERA::SetCurMousePosition(), CCAMERA::Zoom(), and CCAMERA::ZoomGet().

◆ OnPaint()

void EDA_3D_CANVAS::OnPaint ( wxPaintEvent &  event)
private

Definition at line 315 of file eda_3d_canvas.cpp.

316 {
317  // Please have a look at:
318  // https://lists.launchpad.net/kicad-developers/msg25149.html
319  // wxPaintDC( this );
320  // event.Skip( false );
321 
322  // SwapBuffer requires the window to be shown before calling
323  if( !IsShownOnScreen() )
324  {
325  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPaint !IsShown" );
326  return;
327  }
328 
329  // Because the board to draw is handled by the parent viewer frame,
330  // ensure this parent is still alive. When it is closed before the viewer
331  // frame, a paint event can be generated after the parent is closed,
332  // therefore with invalid board.
333  // This is dependent of the platform.
334  // Especially on OSX, but also on Windows, it frequently happens
335  if( !GetParent()->GetParent()->IsShown() )
336  return; // The parent board editor frame is no more alive
337 
338  wxString err_messages;
339 
340  // !TODO: implement error reporter
341  //WX_STRING_REPORTER errorReporter( &err_messages );
342  STATUS_TEXT_REPORTER activityReporter( m_parentStatusBar, 0 );
343 
344  unsigned strtime = GetRunningMicroSecs();
345 
346  // "Makes the OpenGL state that is represented by the OpenGL rendering
347  // context context current, i.e. it will be used by all subsequent OpenGL calls.
348  // This function may only be called when the window is shown on screen"
349 
350  // Explicitly create a new rendering context instance for this canvas.
351  if( m_glRC == NULL )
353 
355 
356  // Set the OpenGL viewport according to the client size of this canvas.
357  // This is done here rather than in a wxSizeEvent handler because our
358  // OpenGL rendering context (and thus viewport setting) is used with
359  // multiple canvases: If we updated the viewport in the wxSizeEvent
360  // handler, changing the size of one canvas causes a viewport setting that
361  // is wrong when next another canvas is repainted.
362  wxSize clientSize = GetNativePixelSize();
363 
364  const bool windows_size_changed = m_settings.CameraGet().SetCurWindowSize( clientSize );
365 
366  // Initialize openGL if need
367  // /////////////////////////////////////////////////////////////////////////
369  {
370  if( !initializeOpenGL() )
371  {
373 
374  return;
375  }
376  }
377 
378  // Don't attend to ray trace if OpenGL doesn't support it.
380  {
384  }
385 
386  // Check if a raytacing was requested and need to switch to raytracing mode
388  {
389  const bool was_camera_changed = m_settings.CameraGet().ParametersChanged();
390 
391  // It reverts back to OpenGL mode if it was requested a raytracing
392  // render of the current scene. AND the mouse / camera is moving
393  if( ( m_mouse_is_moving ||
395  was_camera_changed ||
396  windows_size_changed ) &&
398  {
401  }
402  }
403 
404  float curtime_delta_s = 0.0f;
405 
406  if( m_camera_is_moving )
407  {
408  const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
409  curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
410  m_settings.CameraGet().Interpolate( curtime_delta_s );
411 
412  if( curtime_delta_s > 1.0f )
413  {
414  m_render_pivot = false;
415  m_camera_is_moving = false;
416  m_mouse_was_moved = true;
417 
419  DisplayStatus();
420  }
421  else
422  {
423  Request_refresh();
424  }
425  }
426 
427  // It will return true if the render request a new redraw
428  bool requested_redraw = false;
429 
430  if( m_3d_render )
431  {
432  m_3d_render->SetCurWindowSize( clientSize );
433 
434  requested_redraw = m_3d_render->Redraw( m_mouse_was_moved || m_camera_is_moving,
435  &activityReporter );
436  }
437 
438  if( m_render_pivot )
439  {
440  const float scale = glm::min( m_settings.CameraGet().ZoomGet(), 1.0f );
441  render_pivot( curtime_delta_s, scale * scale );
442  }
443 
444  // "Swaps the double-buffer of this window, making the back-buffer the
445  // front-buffer and vice versa, so that the output of the previous OpenGL
446  // commands is displayed on the window."
447  SwapBuffers();
448 
450 
451  if( !activityReporter.HasMessage() )
452  {
454  {
455  // Calculation time in milliseconds
456  const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
457 
458  activityReporter.Report( wxString::Format( _( "Render time %.0f ms ( %.1f fps)" ),
459  calculation_time, 1000.0 / calculation_time ) );
460  }
461  }
462 
463  // This will reset the flag of camera parameters changed
465 
466  if( !err_messages.IsEmpty() )
467  wxLogMessage( err_messages );
468 
469  if( (!m_camera_is_moving) && requested_redraw )
470  {
471  m_mouse_was_moved = false;
472  Request_refresh( false );
473  }
474 }
virtual wxSize GetNativePixelSize() const
bool m_mouse_is_moving
true if mouse activity is on progress
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
unsigned m_strtime_camera_movement
Stores the ticktime when the camera star its movement.
wxStatusBar * m_parentStatusBar
Parent statusbar to report progress.
wxGLContext * m_glRC
current OpenGL context
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
C3D_RENDER_OGL_LEGACY * m_3d_render_ogl_legacy
OpenGL legacy render class.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void UnlockCtx(wxGLContext *aContext)
Function UnlockCtx allows other canvases to bind an OpenGL context.
float m_camera_moving_speed
1.0f will be 1:1
void RenderEngineSet(RENDER_ENGINE aRenderEngine)
RenderEngineSet.
Definition: cinfo3d_visu.h:228
static GL_CONTEXT_MANAGER & Get()
Function Get returns the GL_CONTEXT_MANAGER instance (singleton).
void restart_editingTimeOut_Timer()
restart_editingTimeOut_Timer - reset the editing timer
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
float ZoomGet() const
Definition: ccamera.cpp:490
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
Class STATUS_TEXT_REPORTER is a wrapper for reporting to a wxString in a wxFrame status text.
bool m_camera_is_moving
true if camera animation is ongoing
virtual void Interpolate(float t)
Interpolate - It will update the matrix to interpolate between T0 and T1 values.
Definition: ccamera.cpp:549
bool SetCurWindowSize(const wxSize &aSize)
SetCurWindowSize - update the windows size of the camera.
Definition: ccamera.cpp:428
void LockCtx(wxGLContext *aContext, wxGLCanvas *aCanvas)
Function LockCtx sets a context as current and prevents other canvases from switching it.
bool m_render_pivot
activated the render of pivot while camera moving
RENDER_ENGINE RenderEngineGet() const
RenderEngineGet.
Definition: cinfo3d_visu.h:234
bool m_is_opengl_initialized
Flag to store if opengl was initialized already.
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.
virtual bool Redraw(bool aIsMoving, REPORTER *aStatusTextReporter=NULL)=0
Redraw - Ask to redraw the view.
const int scale
bool initializeOpenGL()
initializeOpenGL
bool m_opengl_supports_raytracing
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
unsigned GetRunningMicroSecs()
Function GetRunningMicroSecs An alternate way to calculate an elapset time (in microsecondes) to clas...
wxGLContext * CreateCtx(wxGLCanvas *aCanvas, const wxGLContext *aOther=NULL)
Function CreateCtx creates a managed OpenGL context.
virtual void SetCurWindowSize(const wxSize &aSize)=0
SetCurWindowSize - Before each render, the canvas will tell the render what is the size of its window...
void render_pivot(float t, float aScale)
render_pivot - render the pivot cursor
#define min(a, b)
Definition: auxiliary.h:85
bool ParametersChanged()
Function ParametersChanged.
Definition: ccamera.cpp:567
bool m_render_raytracing_was_requested
Flags that the user requested the current view to be render with raytracing.

References CINFO3D_VISU::CameraGet(), GL_CONTEXT_MANAGER::CreateCtx(), DisplayStatus(), Format(), GL_CONTEXT_MANAGER::Get(), HIDPI_GL_CANVAS::GetNativePixelSize(), GetRunningMicroSecs(), STATUS_TEXT_REPORTER::HasMessage(), initializeOpenGL(), CCAMERA::Interpolate(), GL_CONTEXT_MANAGER::LockCtx(), m_3d_render, m_3d_render_ogl_legacy, m_camera_is_moving, m_camera_moving_speed, m_glRC, m_is_opengl_initialized, m_logTrace, m_mouse_is_moving, m_mouse_was_moved, m_opengl_supports_raytracing, m_parentStatusBar, m_render_pivot, m_render_raytracing_was_requested, m_settings, m_strtime_camera_movement, min, CCAMERA::ParametersChanged(), C3D_RENDER_BASE::Redraw(), RENDER_ENGINE_OPENGL_LEGACY, render_pivot(), CINFO3D_VISU::RenderEngineGet(), CINFO3D_VISU::RenderEngineSet(), STATUS_TEXT_REPORTER::Report(), Request_refresh(), restart_editingTimeOut_Timer(), scale, C3D_RENDER_BASE::SetCurWindowSize(), CCAMERA::SetCurWindowSize(), GL_CONTEXT_MANAGER::UnlockCtx(), and CCAMERA::ZoomGet().

◆ OnPopUpMenu()

void EDA_3D_CANVAS::OnPopUpMenu ( wxCommandEvent &  event)
private

Definition at line 734 of file eda_3d_canvas.cpp.

735 {
736  int id = event.GetId();
737 
738  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPopUpMenu id:%d", id );
739 
740  int key = 0;
741 
742  switch( id )
743  {
744  case ID_POPUP_ZOOMIN:
745  key = WXK_F1;
746  break;
747 
748  case ID_POPUP_ZOOMOUT:
749  key = WXK_F2;
750  break;
751 
752  case ID_POPUP_VIEW_XPOS:
753  key = 'X';
754  break;
755 
756  case ID_POPUP_VIEW_XNEG:
757  key = GR_KB_SHIFT + 'X';
758  break;
759 
760  case ID_POPUP_VIEW_YPOS:
761  key = 'Y';
762  break;
763 
764  case ID_POPUP_VIEW_YNEG:
765  key = GR_KB_SHIFT + 'Y';
766  break;
767 
768  case ID_POPUP_VIEW_ZPOS:
769  key = 'Z';
770  break;
771 
772  case ID_POPUP_VIEW_ZNEG:
773  key = GR_KB_SHIFT + 'Z';
774  break;
775 
777  key = WXK_LEFT;
778  break;
779 
781  key = WXK_RIGHT;
782  break;
783 
784  case ID_POPUP_MOVE3D_UP:
785  key = WXK_UP;
786  break;
787 
789  key = WXK_DOWN;
790  break;
791 
792  default:
793  return;
794  }
795 
796  SetView3D( key );
797 }
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
#define GR_KB_SHIFT
bool SetView3D(int aKeycode)
SetView3D - Helper function to call view commands.

References GR_KB_SHIFT, ID_POPUP_MOVE3D_DOWN, ID_POPUP_MOVE3D_LEFT, ID_POPUP_MOVE3D_RIGHT, ID_POPUP_MOVE3D_UP, ID_POPUP_VIEW_XNEG, ID_POPUP_VIEW_XPOS, ID_POPUP_VIEW_YNEG, ID_POPUP_VIEW_YPOS, ID_POPUP_VIEW_ZNEG, ID_POPUP_VIEW_ZPOS, ID_POPUP_ZOOMIN, ID_POPUP_ZOOMOUT, m_logTrace, and SetView3D().

◆ OnResize()

void EDA_3D_CANVAS::OnResize ( wxSizeEvent &  event)
private

Definition at line 192 of file eda_3d_canvas.cpp.

193 {
194  this->Request_refresh();
195 }
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.

References Request_refresh().

◆ OnRightClick()

void EDA_3D_CANVAS::OnRightClick ( wxMouseEvent &  event)
private

Definition at line 645 of file eda_3d_canvas.cpp.

646 {
647  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnRightClick" );
648 
649  SetFocus();
650 
651  if( m_camera_is_moving )
652  return;
653 
654  wxPoint pos;
655  wxMenu PopUpMenu;
656  wxString msg;
657 
658  pos.x = event.GetX();
659  pos.y = event.GetY();
660 
661  msg = AddHotkeyName( _( "Zoom +" ), GetHotkeyConfig(),
662  ID_POPUP_ZOOMIN );
663  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
664  msg, KiBitmap( zoom_in_xpm ) );
665 
666 
667  msg = AddHotkeyName( _( "Zoom -" ), GetHotkeyConfig(),
669  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
670  msg, KiBitmap( zoom_out_xpm ) );
671 
672  PopUpMenu.AppendSeparator();
673 
674  msg = AddHotkeyName( _( "Top View" ), GetHotkeyConfig(),
676  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
677  msg, KiBitmap( axis3d_top_xpm ) );
678 
679  msg = AddHotkeyName( _( "Bottom View" ), GetHotkeyConfig(),
681  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
682  msg, KiBitmap( axis3d_bottom_xpm ) );
683 
684  PopUpMenu.AppendSeparator();
685 
686  msg = AddHotkeyName( _( "Right View" ), GetHotkeyConfig(),
688  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
689  msg, KiBitmap( axis3d_right_xpm ) );
690 
691  msg = AddHotkeyName( _( "Left View" ), GetHotkeyConfig(),
693  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
694  msg, KiBitmap( axis3d_left_xpm ) );
695 
696  PopUpMenu.AppendSeparator();
697 
698  msg = AddHotkeyName( _( "Front View" ), GetHotkeyConfig(),
700  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
701  msg, KiBitmap( axis3d_front_xpm ) );
702 
703  msg = AddHotkeyName( _( "Back View" ), GetHotkeyConfig(),
705  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
706  msg, KiBitmap( axis3d_back_xpm ) );
707 
708  PopUpMenu.AppendSeparator();
709 
710  msg = AddHotkeyName( _( "Move Left <-" ), GetHotkeyConfig(),
712  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
713  msg, KiBitmap( left_xpm ) );
714 
715  msg = AddHotkeyName( _( "Move Right ->" ), GetHotkeyConfig(),
717  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
718  msg, KiBitmap( right_xpm ) );
719 
720  msg = AddHotkeyName( _( "Move Up ^" ), GetHotkeyConfig(),
722  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
723  msg, KiBitmap( up_xpm ) );
724 
725  msg = AddHotkeyName( _( "Move Down" ), GetHotkeyConfig(),
727  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
728  msg, KiBitmap( down_xpm ) );
729 
730  PopupMenu( &PopUpMenu, pos );
731 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool m_camera_is_moving
true if camera animation is ongoing
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value)
EDA_HOTKEY_CONFIG * GetHotkeyConfig() const
Return a structure containing currently used hotkey mapping.

References AddHotkeyName(), AddMenuItem(), GetHotkeyConfig(), ID_POPUP_MOVE3D_DOWN, ID_POPUP_MOVE3D_LEFT, ID_POPUP_MOVE3D_RIGHT, ID_POPUP_MOVE3D_UP, ID_POPUP_VIEW_XNEG, ID_POPUP_VIEW_XPOS, ID_POPUP_VIEW_YNEG, ID_POPUP_VIEW_YPOS, ID_POPUP_VIEW_ZNEG, ID_POPUP_VIEW_ZPOS, ID_POPUP_ZOOMIN, ID_POPUP_ZOOMOUT, KiBitmap(), m_camera_is_moving, and m_logTrace.

◆ OnTimerTimeout_Editing()

void EDA_3D_CANVAS::OnTimerTimeout_Editing ( wxTimerEvent &  event)
private

Definition at line 834 of file eda_3d_canvas.cpp.

835 {
836  (void)event;
837 
838  m_mouse_is_moving = false;
839  m_mouse_was_moved = false;
840 
841  Request_refresh();
842 }
bool m_mouse_is_moving
true if mouse activity is on progress
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode

References m_mouse_is_moving, m_mouse_was_moved, and Request_refresh().

Referenced by EVT_MENU_RANGE().

◆ OnTimerTimeout_Redraw()

void EDA_3D_CANVAS::OnTimerTimeout_Redraw ( wxTimerEvent &  event)
private

Definition at line 857 of file eda_3d_canvas.cpp.

858 {
859  (void)event;
860 
861  //Refresh();
862  //Update();
863 
864  wxPaintEvent redrawEvent;
865  wxPostEvent( this, redrawEvent );
866 }

Referenced by EVT_MENU_RANGE().

◆ releaseOpenGL()

void EDA_3D_CANVAS::releaseOpenGL ( )
private

releaseOpenGL - free created targets and openGL context

Definition at line 162 of file eda_3d_canvas.cpp.

163 {
164  if( m_glRC )
165  {
167 
168  delete m_3d_render_raytracing;
169  m_3d_render_raytracing = NULL;
170 
171  delete m_3d_render_ogl_legacy;
172  m_3d_render_ogl_legacy = NULL;
173 
174  // This is just a copy of a pointer, can safely be set to NULL
175  m_3d_render = NULL;
176 
179  m_glRC = NULL;
180  }
181 }
C3D_RENDER_RAYTRACING * m_3d_render_raytracing
Raytracing render class.
wxGLContext * m_glRC
current OpenGL context
C3D_RENDER_OGL_LEGACY * m_3d_render_ogl_legacy
OpenGL legacy render class.
void UnlockCtx(wxGLContext *aContext)
Function UnlockCtx allows other canvases to bind an OpenGL context.
static GL_CONTEXT_MANAGER & Get()
Function Get returns the GL_CONTEXT_MANAGER instance (singleton).
void LockCtx(wxGLContext *aContext, wxGLCanvas *aCanvas)
Function LockCtx sets a context as current and prevents other canvases from switching it.
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.
void DestroyCtx(wxGLContext *aContext)
Function DestroyCtx destroys a managed OpenGL context.

References GL_CONTEXT_MANAGER::DestroyCtx(), GL_CONTEXT_MANAGER::Get(), GL_CONTEXT_MANAGER::LockCtx(), m_3d_render, m_3d_render_ogl_legacy, m_3d_render_raytracing, m_glRC, and GL_CONTEXT_MANAGER::UnlockCtx().

Referenced by OnCloseWindow(), and ~EDA_3D_CANVAS().

◆ ReloadRequest()

void EDA_3D_CANVAS::ReloadRequest ( BOARD aBoard = NULL,
S3D_CACHE aCachePointer = NULL 
)

Definition at line 273 of file eda_3d_canvas.cpp.

274 {
275  if( aCachePointer != NULL )
276  m_settings.Set3DCacheManager( aCachePointer );
277 
278  if( aBoard != NULL )
279  m_settings.SetBoard( aBoard );
280 
281  if( m_3d_render )
283 }
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.
void ReloadRequest()
ReloadRequest - !TODO: this must be reviewed to add flags to improve specific render.
void SetBoard(BOARD *aBoard)
SetBoard - Set current board to be rendered.
Definition: cinfo3d_visu.h:122
void Set3DCacheManager(S3D_CACHE *aCachePointer)
Set3DCacheManager - Update the Cache manager pointer.
Definition: cinfo3d_visu.h:82

References m_3d_render, m_settings, C3D_RENDER_BASE::ReloadRequest(), CINFO3D_VISU::Set3DCacheManager(), and CINFO3D_VISU::SetBoard().

Referenced by EDA_3D_VIEWER::ReloadRequest(), SetView3D(), PANEL_PREV_3D::UpdateDummyModule(), and PANEL_PREV_3D::View3DUpdate().

◆ render_pivot()

void EDA_3D_CANVAS::render_pivot ( float  t,
float  aScale 
)
private

render_pivot - render the pivot cursor

Parameters
ttime between 0.0 and 1.0
aScalescale to apply on the cursor

Definition at line 76 of file eda_3d_canvas_pivot.cpp.

77 {
78  wxASSERT( aScale >= 0.0f );
79  wxASSERT( t >= 0.0f );
80 
81  if( t > 1.0f )
82  t = 1.0f;
83 
84  const SFVEC3F &lookAtPos = m_settings.CameraGet().GetLookAtPos_T1();
85 
86  glDisable( GL_LIGHTING );
87  glDisable( GL_DEPTH_TEST );
88  glDisable( GL_CULL_FACE );
89 
90  // Set projection and modelview matrixes
91  // /////////////////////////////////////////////////////////////////////////
92  glMatrixMode( GL_PROJECTION );
93  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetProjectionMatrix() ) );
94 
95  glMatrixMode( GL_MODELVIEW );
96  glLoadIdentity();
97  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetViewMatrix() ) );
98 
99  glEnable( GL_COLOR_MATERIAL );
100  glColor4f( 0.0f, 1.0f, 0.0f, 0.75f - t * 0.75f );
101 
102  // Translate to the look at position
103  glTranslatef( lookAtPos.x, lookAtPos.y, lookAtPos.z );
104 
105  glScalef( aScale, aScale, aScale );
106 
107  pivot_render_triangles( t * 0.5f );
108 
109  t = t * 0.80f;
110  glScalef( 1.0f - t, 1.0f - t, 1.0f - t );
111  glColor4f( 0.0f, 1.0f, 0.0f, 0.8f - t );
112 
113  glPushMatrix();
114  glRotatef( t * 90.0f, 0.0f, 0.0f, 1.0f );
115  pivot_render_triangles( t * 0.5f );
116  glPopMatrix();
117 
118  glPushMatrix();
119  glRotatef( -t * 90.0f, 0.0f, 0.0f, 1.0f );
120  pivot_render_triangles( t * 0.5f );
121  glPopMatrix();
122 }
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
const SFVEC3F & GetLookAtPos_T1() const
Definition: ccamera.h:129
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
const glm::mat4 & GetViewMatrix() const
Definition: ccamera.cpp:389
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
static void pivot_render_triangles(float t)
const glm::mat4 & GetProjectionMatrix() const
Definition: ccamera.cpp:359

References CINFO3D_VISU::CameraGet(), CCAMERA::GetLookAtPos_T1(), CCAMERA::GetProjectionMatrix(), CCAMERA::GetViewMatrix(), m_settings, and pivot_render_triangles().

Referenced by OnPaint().

◆ RenderEngineChanged()

void EDA_3D_CANVAS::RenderEngineChanged ( )

RenderEngineChanged - Notify that the render engine was changed.

Definition at line 1124 of file eda_3d_canvas.cpp.

1125 {
1126 
1127  switch( m_settings.RenderEngineGet() )
1128  {
1131  break;
1132 
1135  break;
1136 
1137  default:
1138  m_3d_render = NULL;
1139  break;
1140  }
1141 
1142  if( m_3d_render )
1144 
1145  m_mouse_was_moved = false;
1146 
1147  Request_refresh();
1148 }
C3D_RENDER_RAYTRACING * m_3d_render_raytracing
Raytracing render class.
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
C3D_RENDER_OGL_LEGACY * m_3d_render_ogl_legacy
OpenGL legacy render class.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
RENDER_ENGINE RenderEngineGet() const
RenderEngineGet.
Definition: cinfo3d_visu.h:234
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.
void ReloadRequest()
ReloadRequest - !TODO: this must be reviewed to add flags to improve specific render.

References m_3d_render, m_3d_render_ogl_legacy, m_3d_render_raytracing, m_mouse_was_moved, m_settings, C3D_RENDER_BASE::ReloadRequest(), RENDER_ENGINE_OPENGL_LEGACY, RENDER_ENGINE_RAYTRACING, CINFO3D_VISU::RenderEngineGet(), and Request_refresh().

Referenced by EDA_3D_VIEWER::RenderEngineChanged().

◆ RenderRaytracingRequest()

void EDA_3D_CANVAS::RenderRaytracingRequest ( )

RenderRaytracingRequest - Request to render the current view in Raytracing mode.

Definition at line 286 of file eda_3d_canvas.cpp.

287 {
289 
290  if( m_3d_render )
292 
294  //m_mouse_was_moved = true;
295 
296  Request_refresh();
297 }
C3D_RENDER_RAYTRACING * m_3d_render_raytracing
Raytracing render class.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.
void ReloadRequest()
ReloadRequest - !TODO: this must be reviewed to add flags to improve specific render.
bool m_render_raytracing_was_requested
Flags that the user requested the current view to be render with raytracing.

References m_3d_render, m_3d_render_raytracing, m_render_raytracing_was_requested, C3D_RENDER_BASE::ReloadRequest(), and Request_refresh().

◆ Request_refresh()

void EDA_3D_CANVAS::Request_refresh ( bool  aRedrawImmediately = true)

Request_refresh - Schedule a refresh update of the canvas.

Parameters
aRedrawImmediately- true will request a redraw, false will schedule a redraw, after a short timeout.

Definition at line 869 of file eda_3d_canvas.cpp.

870 {
871  if( aRedrawImmediately )
872  {
873  // On some systems, just calling Refresh does not work always
874  // (Issue experienced on Win7 MSYS2)
875  //Refresh();
876  //Update();
877 
878  // Using PostEvent will take priority to other events, like
879  // mouse movements, keys, etc.
880  wxPaintEvent redrawEvent;
881  wxPostEvent( this, redrawEvent );
882 
883  // This behaves the same
884  // wxQueueEvent( this,
885  // From wxWidget documentation: "The heap-allocated and
886  // non-NULL event to queue, the function takes ownership of it."
887  // new wxPaintEvent()
888  // );
889  }
890  else
891  {
892  // Schedule a timed redraw
893  m_redraw_trigger_timer.Start( 10 , wxTIMER_ONE_SHOT );
894  }
895 }
wxTimer m_redraw_trigger_timer
This timer will be used to schedule a redraw event.

References m_redraw_trigger_timer.

Referenced by EDA_3D_VIEWER::On3DGridSelection(), EDA_3D_VIEWER::OnActivate(), OnMouseMove(), OnMouseWheel(), OnPaint(), OnResize(), OnTimerTimeout_Editing(), EDA_3D_VIEWER::Process_Special_Functions(), EDA_3D_VIEWER::ProcessZoom(), RenderEngineChanged(), RenderRaytracingRequest(), request_start_moving_camera(), SetView3D(), and PANEL_PREV_3D::UpdateDummyModule().

◆ request_start_moving_camera()

void EDA_3D_CANVAS::request_start_moving_camera ( float  aMovingSpeed = 2.0f,
bool  aRenderPivot = true 
)
private

request_start_moving_camera - start a camera movement

Parameters
aMovingSpeedthe time speed
aRenderPivotif it should display pivot cursor while move

Definition at line 898 of file eda_3d_canvas.cpp.

899 {
900  wxASSERT( aMovingSpeed > FLT_EPSILON );
901 
902  m_render_pivot = aRenderPivot;
903  m_camera_moving_speed = aMovingSpeed;
904 
906 
907  DisplayStatus();
908  Request_refresh();
909 
910  m_camera_is_moving = true;
911 
913 }
unsigned m_strtime_camera_movement
Stores the ticktime when the camera star its movement.
void stop_editingTimeOut_Timer()
stop_editingTimeOut_Timer - stop the editing time, so it will not timeout
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
float m_camera_moving_speed
1.0f will be 1:1
bool m_camera_is_moving
true if camera animation is ongoing
bool m_render_pivot
activated the render of pivot while camera moving
unsigned GetRunningMicroSecs()
Function GetRunningMicroSecs An alternate way to calculate an elapset time (in microsecondes) to clas...

References DisplayStatus(), GetRunningMicroSecs(), m_camera_is_moving, m_camera_moving_speed, m_render_pivot, m_strtime_camera_movement, Request_refresh(), and stop_editingTimeOut_Timer().

Referenced by move_pivot_based_on_cur_mouse_position(), and SetView3D().

◆ restart_editingTimeOut_Timer()

void EDA_3D_CANVAS::restart_editingTimeOut_Timer ( )
private

restart_editingTimeOut_Timer - reset the editing timer

Definition at line 851 of file eda_3d_canvas.cpp.

852 {
853  m_editing_timeout_timer.Start( m_3d_render->GetWaitForEditingTimeOut() , wxTIMER_ONE_SHOT );
854 }
wxTimer m_editing_timeout_timer
Time timeout will expires after some time sinalizing that the mouse / keyboard movements are over.
virtual int GetWaitForEditingTimeOut()=0
GetWaitForEditingTimeOut - Give the interface the time (in ms) that it should wait for editing or mov...
C3D_RENDER_BASE * m_3d_render
The current render in used for this canvas.

References C3D_RENDER_BASE::GetWaitForEditingTimeOut(), m_3d_render, and m_editing_timeout_timer.

Referenced by OnLeftUp(), OnMiddleUp(), OnMouseWheel(), OnPaint(), and SetView3D().

◆ SetStatusBar()

void EDA_3D_CANVAS::SetStatusBar ( wxStatusBar *  aStatusBar)
inline

Definition at line 73 of file eda_3d_canvas.h.

73 { m_parentStatusBar = aStatusBar; }
wxStatusBar * m_parentStatusBar
Parent statusbar to report progress.

References m_parentStatusBar.

Referenced by EDA_3D_VIEWER::EDA_3D_VIEWER().

◆ SetView3D()

bool EDA_3D_CANVAS::SetView3D ( int  aKeycode)

SetView3D - Helper function to call view commands.

Parameters
aKeycodeascii key commands
Returns
true if the key code was handled, false if no command found for this code.

Definition at line 942 of file eda_3d_canvas.cpp.

943 {
944  if( m_camera_is_moving )
945  return false;
946 
947  const float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
948  const float arrow_moving_time_speed = 8.0f;
949  bool handled = false;
950 
951  switch( aKeycode )
952  {
953  case WXK_SPACE:
955  return true;
956 
957  case WXK_LEFT:
960  m_settings.CameraGet().Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
961  request_start_moving_camera( arrow_moving_time_speed, false );
962  return true;
963 
964  case WXK_RIGHT:
967  m_settings.CameraGet().Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
968  request_start_moving_camera( arrow_moving_time_speed, false );
969  return true;
970 
971  case WXK_UP:
974  m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
975  request_start_moving_camera( arrow_moving_time_speed, false );
976  return true;
977 
978  case WXK_DOWN:
981  m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
982  request_start_moving_camera( arrow_moving_time_speed, false );
983  return true;
984 
985  case WXK_HOME:
990  return true;
991 
992  case WXK_END:
993  break;
994 
995  case WXK_TAB:
998  m_settings.CameraGet().RotateZ_T1( glm::radians( 45.0f ) );
1000  handled = true;
1001  break;
1002 
1003  case WXK_F1:
1006 
1007  if( m_settings.CameraGet().Zoom_T1( 1.4f ) )
1009 
1010  return true;
1011 
1012  case WXK_F2:
1015 
1016  if( m_settings.CameraGet().Zoom_T1( 1/1.4f ) )
1018 
1019  return true;
1020 
1021  case '+':
1022  case '-':
1023  break;
1024 
1025  case 't':
1026  case 'T':
1029  ReloadRequest();
1030  handled = true;
1031  break;
1032 
1033  case 's':
1034  case 'S':
1037  ReloadRequest();
1038  handled = true;
1039  break;
1040 
1041  case 'v':
1042  case 'V':
1045  ReloadRequest();
1046  handled = true;
1047  break;
1048 
1049  case 'r':
1050  case 'R':
1055  return true;
1056 
1057  case 'X':
1061  m_settings.CameraGet().RotateZ_T1( glm::radians( -90.0f ) );
1062  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1064  return true;
1065 
1066  case GR_KB_SHIFT + 'X':
1070  m_settings.CameraGet().RotateZ_T1( glm::radians( 90.0f ) );
1071  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1073  return true;
1074 
1075  case 'Y':
1079  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1081  return true;
1082 
1083  case GR_KB_SHIFT + 'Y':
1087  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1088  m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
1090  return true;
1091 
1092  case 'Z':
1097  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1098  return true;
1099 
1100  case GR_KB_SHIFT + 'Z':
1104  m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
1106  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1107  return true;
1108 
1109  default:
1110  return false;
1111  }
1112 
1113  m_mouse_was_moved = true;
1114 
1116 
1117  DisplayStatus();
1118  Request_refresh();
1119 
1120  return handled;
1121 }
void request_start_moving_camera(float aMovingSpeed=2.0f, bool aRenderPivot=true)
request_start_moving_camera - start a camera movement
virtual void SetT0_and_T1_current_T()
SetT0_and_T1_current_T - This will set T0 and T1 with the current values.
Definition: ccamera.cpp:535
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void ReloadRequest(BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
void restart_editingTimeOut_Timer()
restart_editingTimeOut_Timer - reset the editing timer
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
float ZoomGet() const
Definition: ccamera.cpp:490
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
bool m_camera_is_moving
true if camera animation is ongoing
#define GR_KB_SHIFT
bool Zoom_T1(float aFactor)
Definition: ccamera.cpp:473
virtual void Pan_T1(const SFVEC3F &aDeltaOffsetInc)=0
void RotateX_T1(float aAngleInRadians)
Definition: ccamera.cpp:517
virtual void Reset_T1()
Definition: ccamera.cpp:92
void RotateY_T1(float aAngleInRadians)
Definition: ccamera.cpp:523
void move_pivot_based_on_cur_mouse_position()
move_pivot_based_on_cur_mouse_position - This function hits a ray to the board and start a moviment
#define max(a, b)
Definition: auxiliary.h:86
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
void RotateZ_T1(float aAngleInRadians)
Definition: ccamera.cpp:529
static const float m_delta_move_step_factor
Step factor to used with cursor on relation to the current zoom.
void SetInterpolateMode(CAMERA_INTERPOLATION aInterpolateMode)
Definition: ccamera.h:198
#define min(a, b)
Definition: auxiliary.h:85

References CINFO3D_VISU::CameraGet(), DisplayStatus(), FL_MODULE_ATTRIBUTES_NORMAL, FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_MODULE_ATTRIBUTES_VIRTUAL, CINFO3D_VISU::GetFlag(), GR_KB_SHIFT, INTERPOLATION_BEZIER, INTERPOLATION_EASING_IN_OUT, INTERPOLATION_LINEAR, m_camera_is_moving, m_delta_move_step_factor, m_mouse_was_moved, m_settings, max, min, move_pivot_based_on_cur_mouse_position(), CCAMERA::Pan_T1(), ReloadRequest(), Request_refresh(), request_start_moving_camera(), CCAMERA::Reset_T1(), restart_editingTimeOut_Timer(), CCAMERA::RotateX_T1(), CCAMERA::RotateY_T1(), CCAMERA::RotateZ_T1(), CINFO3D_VISU::SetFlag(), CCAMERA::SetInterpolateMode(), CCAMERA::SetT0_and_T1_current_T(), CCAMERA::Zoom_T1(), and CCAMERA::ZoomGet().

Referenced by OnKeyEvent(), OnPopUpMenu(), EDA_3D_VIEWER::Process_Special_Functions(), EDA_3D_VIEWER::ProcessZoom(), PANEL_PREV_3D::View3DBack(), PANEL_PREV_3D::View3DBottom(), PANEL_PREV_3D::View3DFront(), PANEL_PREV_3D::View3DLeft(), PANEL_PREV_3D::View3DRight(), and PANEL_PREV_3D::View3DTop().

◆ stop_editingTimeOut_Timer()

void EDA_3D_CANVAS::stop_editingTimeOut_Timer ( )
private

stop_editingTimeOut_Timer - stop the editing time, so it will not timeout

Definition at line 845 of file eda_3d_canvas.cpp.

846 {
848 }
wxTimer m_editing_timeout_timer
Time timeout will expires after some time sinalizing that the mouse / keyboard movements are over.

References m_editing_timeout_timer.

Referenced by OnLeftDown(), OnMiddleDown(), and request_start_moving_camera().

◆ SupportsRayTracing()

bool EDA_3D_CANVAS::SupportsRayTracing ( ) const
inline

Definition at line 127 of file eda_3d_canvas.h.

bool m_opengl_supports_raytracing

References m_opengl_supports_raytracing.

Member Data Documentation

◆ m_3d_render

C3D_RENDER_BASE* EDA_3D_CANVAS::m_3d_render
private

The current render in used for this canvas.

Definition at line 264 of file eda_3d_canvas.h.

Referenced by IsReloadRequestPending(), OnPaint(), releaseOpenGL(), ReloadRequest(), RenderEngineChanged(), RenderRaytracingRequest(), and restart_editingTimeOut_Timer().

◆ m_3d_render_ogl_legacy

C3D_RENDER_OGL_LEGACY* EDA_3D_CANVAS::m_3d_render_ogl_legacy
private

OpenGL legacy render class.

Definition at line 270 of file eda_3d_canvas.h.

Referenced by OnPaint(), releaseOpenGL(), and RenderEngineChanged().

◆ m_3d_render_raytracing

C3D_RENDER_RAYTRACING* EDA_3D_CANVAS::m_3d_render_raytracing
private

Raytracing render class.

Definition at line 267 of file eda_3d_canvas.h.

Referenced by releaseOpenGL(), RenderEngineChanged(), and RenderRaytracingRequest().

◆ m_camera_is_moving

bool EDA_3D_CANVAS::m_camera_is_moving
private

true if camera animation is ongoing

Definition at line 249 of file eda_3d_canvas.h.

Referenced by OnKeyEvent(), OnLeftUp(), OnMiddleUp(), OnMouseMove(), OnMouseWheel(), OnPaint(), OnRightClick(), request_start_moving_camera(), and SetView3D().

◆ m_camera_moving_speed

float EDA_3D_CANVAS::m_camera_moving_speed
private

1.0f will be 1:1

Definition at line 255 of file eda_3d_canvas.h.

Referenced by OnPaint(), and request_start_moving_camera().

◆ m_delta_move_step_factor

const float EDA_3D_CANVAS::m_delta_move_step_factor = 0.7f
staticprivate

Step factor to used with cursor on relation to the current zoom.

Definition at line 276 of file eda_3d_canvas.h.

Referenced by OnMouseWheel(), and SetView3D().

◆ m_editing_timeout_timer

wxTimer EDA_3D_CANVAS::m_editing_timeout_timer
private

Time timeout will expires after some time sinalizing that the mouse / keyboard movements are over.

Definition at line 236 of file eda_3d_canvas.h.

Referenced by restart_editingTimeOut_Timer(), and stop_editingTimeOut_Timer().

◆ m_glRC

wxGLContext* EDA_3D_CANVAS::m_glRC
private

current OpenGL context

Definition at line 229 of file eda_3d_canvas.h.

Referenced by OnPaint(), and releaseOpenGL().

◆ m_is_opengl_initialized

bool EDA_3D_CANVAS::m_is_opengl_initialized
private

Flag to store if opengl was initialized already.

Definition at line 273 of file eda_3d_canvas.h.

Referenced by initializeOpenGL(), IsOpenGLInitialized(), and OnPaint().

◆ m_mouse_is_moving

bool EDA_3D_CANVAS::m_mouse_is_moving
private

true if mouse activity is on progress

Definition at line 242 of file eda_3d_canvas.h.

Referenced by OnLeftUp(), OnMiddleUp(), OnMouseMove(), OnMouseWheel(), OnPaint(), and OnTimerTimeout_Editing().

◆ m_mouse_was_moved

bool EDA_3D_CANVAS::m_mouse_was_moved
private

true if there was some type of activity, it will be used to render in preview mode

Definition at line 246 of file eda_3d_canvas.h.

Referenced by OnMouseMove(), OnMouseWheel(), OnPaint(), OnTimerTimeout_Editing(), RenderEngineChanged(), and SetView3D().

◆ m_opengl_supports_raytracing

bool EDA_3D_CANVAS::m_opengl_supports_raytracing
private

Definition at line 281 of file eda_3d_canvas.h.

Referenced by initializeOpenGL(), OnPaint(), and SupportsRayTracing().

◆ m_parentStatusBar

wxStatusBar* EDA_3D_CANVAS::m_parentStatusBar
private

Parent statusbar to report progress.

Definition at line 232 of file eda_3d_canvas.h.

Referenced by DisplayStatus(), OnPaint(), and SetStatusBar().

◆ m_redraw_trigger_timer

wxTimer EDA_3D_CANVAS::m_redraw_trigger_timer
private

This timer will be used to schedule a redraw event.

Definition at line 239 of file eda_3d_canvas.h.

Referenced by Request_refresh().

◆ m_render_pivot

bool EDA_3D_CANVAS::m_render_pivot
private

activated the render of pivot while camera moving

Definition at line 252 of file eda_3d_canvas.h.

Referenced by OnPaint(), and request_start_moving_camera().

◆ m_render_raytracing_was_requested

bool EDA_3D_CANVAS::m_render_raytracing_was_requested
private

Flags that the user requested the current view to be render with raytracing.

Definition at line 279 of file eda_3d_canvas.h.

Referenced by OnPaint(), and RenderRaytracingRequest().

◆ m_settings

CINFO3D_VISU& EDA_3D_CANVAS::m_settings
private

Stores all pre-computed 3D information and visualization settings to render the board.

Definition at line 261 of file eda_3d_canvas.h.

Referenced by DisplayStatus(), move_pivot_based_on_cur_mouse_position(), OnMouseMove(), OnMouseWheel(), OnPaint(), ReloadRequest(), render_pivot(), RenderEngineChanged(), and SetView3D().

◆ m_strtime_camera_movement

unsigned EDA_3D_CANVAS::m_strtime_camera_movement
private

Stores the ticktime when the camera star its movement.

Definition at line 258 of file eda_3d_canvas.h.

Referenced by OnPaint(), and request_start_moving_camera().


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