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
 
void SetScaleFactor (double aFactor)
 Set the canvas scale factor, probably for a hi-DPI display. More...
 
double GetScaleFactor () const
 Get the current scale factor. More...
 

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 161 of file eda_3d_canvas.cpp.

162 {
163  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::~EDA_3D_CANVAS" );
164 
165  releaseOpenGL();
166 }
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 307 of file eda_3d_canvas.cpp.

308 {
309  if( m_parentStatusBar )
310  {
311  wxString msg;
312 
313  msg.Printf( "dx %3.2f", m_settings.CameraGet().GetCameraPos().x );
314  m_parentStatusBar->SetStatusText( msg, 1 );
315 
316  msg.Printf( "dy %3.2f", m_settings.CameraGet().GetCameraPos().y );
317  m_parentStatusBar->SetStatusText( msg, 2 );
318  }
319 }
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 56 of file hidpi_gl_canvas.cpp.

57 {
58 #ifdef RETINA_OPENGL_PATCH
59  // this is ugly, but original method isn't marked const although it doesn't modify anything
60  // => clean up when it officially has arrived in wxWidgets
61  return static_cast< wxGLCanvas* >( const_cast< HIDPI_GL_CANVAS* >( this ))->GetBackingScaleFactor();
62 #else
63 
64  // Return the cached value (which originally was set from config or automatically)
65  return m_scale_factor;
66 #endif
67 }
double m_scale_factor
The current scale factor (e.g.

References HIDPI_GL_CANVAS::m_scale_factor.

Referenced by KIGFX::OPENGL_GAL::beginDrawing(), KIGFX::OPENGL_GAL::DrawGrid(), 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 44 of file hidpi_gl_canvas.cpp.

45 {
46  wxSize size = wxGLCanvas::GetClientSize();
47 
48  const float scaleFactor = GetBackingScaleFactor();
49  size.x *= scaleFactor;
50  size.y *= scaleFactor;
51 
52  return size;
53 }
virtual float GetBackingScaleFactor() const

References HIDPI_GL_CANVAS::GetBackingScaleFactor().

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

◆ GetScaleFactor()

double HIDPI_GL_CANVAS::GetScaleFactor ( ) const
inherited

Get the current scale factor.

Definition at line 76 of file hidpi_gl_canvas.cpp.

77 {
78  return m_scale_factor;
79 }
double m_scale_factor
The current scale factor (e.g.

References HIDPI_GL_CANVAS::m_scale_factor.

Referenced by KIGFX::OPENGL_GAL::updatedGalDisplayOptions().

◆ 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 274 of file eda_3d_canvas.cpp.

275 {
276  OGL_GetScreenshot( aDstImage );
277 }
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 205 of file eda_3d_canvas.cpp.

206 {
207  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL" );
208 
209  const GLenum err = glewInit();
210 
211  if( GLEW_OK != err )
212  {
213  const wxString msgError = (const char*) glewGetErrorString( err );
214 
215  wxLogMessage( msgError );
216 
217  return false;
218  }
219  else
220  {
221  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s",
222  FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
223  }
224 
225  wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
226 
227  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL version string %s.",
228  __WXFUNCTION__, version );
229 
230  // Extract OpenGL version from string. This method is used because prior to OpenGL 2,
231  // getting the OpenGL major and minor version as integers didn't exist.
232  wxString tmp;
233 
234  wxStringTokenizer tokenizer( version );
235 
237 
238  if( tokenizer.HasMoreTokens() )
239  {
240  long major = 0;
241  long minor = 0;
242 
243  tmp = tokenizer.GetNextToken();
244 
245  tokenizer.SetString( tmp, wxString( "." ) );
246 
247  if( tokenizer.HasMoreTokens() )
248  tokenizer.GetNextToken().ToLong( &major );
249 
250  if( tokenizer.HasMoreTokens() )
251  tokenizer.GetNextToken().ToLong( &minor );
252 
253  if( major < 2 || ( (major == 2 ) && (minor < 1) ) )
254  {
255  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::%s OpenGL ray tracing not supported.",
256  __WXFUNCTION__ );
257 
258  if( GetParent() )
259  {
260  wxCommandEvent evt( wxEVT_MENU, ID_DISABLE_RAY_TRACING );
261  GetParent()->ProcessWindowEvent( evt );
262  }
263 
265  }
266  }
267 
269 
270  return true;
271 }
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:61
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 923 of file eda_3d_canvas.cpp.

924 {
925  SFVEC3F rayOrigin;
926  SFVEC3F rayDir;
927 
928  // Generate a ray origin and direction based on current mouser position and camera
929  m_settings.CameraGet().MakeRayAtCurrrentMousePosition( rayOrigin, rayDir );
930 
931  RAY mouseRay;
932  mouseRay.Init( rayOrigin, rayDir );
933 
934  float hit_t;
935 
936  // Test it with the board bounding box
937  if( m_settings.GetBBox3DU().Intersect( mouseRay, &hit_t ) )
938  {
941  m_settings.CameraGet().SetLookAtPos_T1( mouseRay.at( hit_t ) );
943 
945  }
946 }
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 807 of file eda_3d_canvas.cpp.

808 {
809  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnCharHook" );
810  event.Skip();
811 }

◆ OnCloseWindow()

void EDA_3D_CANVAS::OnCloseWindow ( wxCloseEvent &  event)
private

OnCloseWindow - called when the frame is closed.

Parameters
event

Definition at line 191 of file eda_3d_canvas.cpp.

192 {
193  releaseOpenGL();
194 
195  event.Skip();
196 }
void releaseOpenGL()
releaseOpenGL - free created targets and openGL context

References releaseOpenGL().

◆ OnEraseBackground()

void EDA_3D_CANVAS::OnEraseBackground ( wxEraseEvent &  event)
private

Definition at line 484 of file eda_3d_canvas.cpp.

485 {
486  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnEraseBackground" );
487  // Do nothing, to avoid flashing.
488 }
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 814 of file eda_3d_canvas.cpp.

815 {
816  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnKeyEvent" );
817  int localkey = event.GetKeyCode();
818 
819  // Use only upper char values in comparisons
820  // (the Shift modifier is a separate attribute)
821  if( (localkey >= 'a') && (localkey <= 'z') )
822  localkey += 'A' - 'a';
823 
824  if( m_camera_is_moving )
825  return;
826 
827  if( event.ShiftDown() )
828  localkey |= GR_KB_SHIFT;
829 
830  if( event.ControlDown() )
831  localkey |= GR_KB_CTRL;
832 
833  if( event.AltDown() )
834  localkey |= GR_KB_ALT;
835 
836  if( !SetView3D( localkey ) )
837  event.Skip();
838 }
#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 608 of file eda_3d_canvas.cpp.

609 {
610  SetFocus();
612 }
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 615 of file eda_3d_canvas.cpp.

616 {
617  if( m_camera_is_moving )
618  return;
619 
620  if( m_mouse_is_moving )
621  {
622  m_mouse_is_moving = false;
624  }
625 }
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 628 of file eda_3d_canvas.cpp.

629 {
630  SetFocus();
632 }
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 635 of file eda_3d_canvas.cpp.

636 {
637  if( m_camera_is_moving )
638  return;
639 
640  if( m_mouse_is_moving )
641  {
642  m_mouse_is_moving = false;
644  }
645  else
646  {
648  }
649 }
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 579 of file eda_3d_canvas.cpp.

580 {
581  //wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnMouseMove" ) );
582 
583  if( m_camera_is_moving )
584  return;
585 
587 
588  if( event.Dragging() )
589  {
590  if( event.LeftIsDown() ) // Drag
591  m_settings.CameraGet().Drag( event.GetPosition() );
592  else if( event.MiddleIsDown() ) // Pan
593  m_settings.CameraGet().Pan( event.GetPosition() );
594 
595  m_mouse_is_moving = true;
596  m_mouse_was_moved = true;
597 
598  // orientation has changed, redraw mesh
599  DisplayStatus();
600  Request_refresh();
601  }
602 
603  const wxPoint eventPosition = event.GetPosition();
604  m_settings.CameraGet().SetCurMousePosition( eventPosition );
605 }
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 491 of file eda_3d_canvas.cpp.

492 {
493  bool mouseActivity = false;
494 
495  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnMouseWheel" );
496 
497  if( m_camera_is_moving )
498  return;
499 
500  float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
501 
503  delta_move *= (0.01f * event.GetWheelRotation());
504  else
505  if( event.GetWheelRotation() < 0 )
506  delta_move = -delta_move;
507 
508  // mousewheel_panning enabled:
509  // wheel -> pan;
510  // wheel + shift -> horizontal scrolling;
511  // wheel + ctrl -> zooming;
512  // mousewheel_panning disabled:
513  // wheel + shift -> vertical scrolling;
514  // wheel + ctrl -> horizontal scrolling;
515  // wheel -> zooming.
516 
517  if( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) && !event.ControlDown() )
518  {
519  if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
520  m_settings.CameraGet().Pan( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
521  else
522  m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
523 
524  mouseActivity = true;
525  }
526  else if( event.ShiftDown() && !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
527  {
528  m_settings.CameraGet().Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
529  mouseActivity = true;
530  }
531  else if( event.ControlDown() && !m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) )
532  {
533  m_settings.CameraGet().Pan( SFVEC3F( delta_move, 0.0f, 0.0f ) );
534  mouseActivity = true;
535  }
536  else
537  {
538  mouseActivity = m_settings.CameraGet().Zoom( event.GetWheelRotation() > 0 ? 1.1f : 1/1.1f );
539  }
540 
541  // If it results on a camera movement
542  if( mouseActivity )
543  {
544  DisplayStatus();
545  Request_refresh();
546 
547  m_mouse_is_moving = true;
548  m_mouse_was_moved = true;
549 
551  }
552 
553  // Update the cursor current mouse position on the camera
554  m_settings.CameraGet().SetCurMousePosition( event.GetPosition() );
555 }
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 322 of file eda_3d_canvas.cpp.

323 {
324  // Please have a look at:
325  // https://lists.launchpad.net/kicad-developers/msg25149.html
326  // wxPaintDC( this );
327  // event.Skip( false );
328 
329  // SwapBuffer requires the window to be shown before calling
330  if( !IsShownOnScreen() )
331  {
332  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPaint !IsShown" );
333  return;
334  }
335 
336  // Because the board to draw is handled by the parent viewer frame,
337  // ensure this parent is still alive. When it is closed before the viewer
338  // frame, a paint event can be generated after the parent is closed,
339  // therefore with invalid board.
340  // This is dependent of the platform.
341  // Especially on OSX, but also on Windows, it frequently happens
342  if( !GetParent()->GetParent()->IsShown() )
343  return; // The parent board editor frame is no more alive
344 
345  wxString err_messages;
346 
347  // !TODO: implement error reporter
348  //WX_STRING_REPORTER errorReporter( &err_messages );
349  STATUS_TEXT_REPORTER activityReporter( m_parentStatusBar, 0 );
350 
351  unsigned strtime = GetRunningMicroSecs();
352 
353  // "Makes the OpenGL state that is represented by the OpenGL rendering
354  // context context current, i.e. it will be used by all subsequent OpenGL calls.
355  // This function may only be called when the window is shown on screen"
356 
357  // Explicitly create a new rendering context instance for this canvas.
358  if( m_glRC == NULL )
360 
362 
363  // Set the OpenGL viewport according to the client size of this canvas.
364  // This is done here rather than in a wxSizeEvent handler because our
365  // OpenGL rendering context (and thus viewport setting) is used with
366  // multiple canvases: If we updated the viewport in the wxSizeEvent
367  // handler, changing the size of one canvas causes a viewport setting that
368  // is wrong when next another canvas is repainted.
369  wxSize clientSize = GetNativePixelSize();
370 
371  const bool windows_size_changed = m_settings.CameraGet().SetCurWindowSize( clientSize );
372 
373  // Initialize openGL if need
374  // /////////////////////////////////////////////////////////////////////////
376  {
377  if( !initializeOpenGL() )
378  {
380 
381  return;
382  }
383  }
384 
385  // Don't attend to ray trace if OpenGL doesn't support it.
387  {
391  }
392 
393  // Check if a raytacing was requested and need to switch to raytracing mode
395  {
396  const bool was_camera_changed = m_settings.CameraGet().ParametersChanged();
397 
398  // It reverts back to OpenGL mode if it was requested a raytracing
399  // render of the current scene. AND the mouse / camera is moving
400  if( ( m_mouse_is_moving ||
402  was_camera_changed ||
403  windows_size_changed ) &&
405  {
408  }
409  }
410 
411  float curtime_delta_s = 0.0f;
412 
413  if( m_camera_is_moving )
414  {
415  const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
416  curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
417  m_settings.CameraGet().Interpolate( curtime_delta_s );
418 
419  if( curtime_delta_s > 1.0f )
420  {
421  m_render_pivot = false;
422  m_camera_is_moving = false;
423  m_mouse_was_moved = true;
424 
426  DisplayStatus();
427  }
428  else
429  {
430  Request_refresh();
431  }
432  }
433 
434  // It will return true if the render request a new redraw
435  bool requested_redraw = false;
436 
437  if( m_3d_render )
438  {
439  m_3d_render->SetCurWindowSize( clientSize );
440 
441  requested_redraw = m_3d_render->Redraw( m_mouse_was_moved || m_camera_is_moving,
442  &activityReporter );
443  }
444 
445  if( m_render_pivot )
446  {
447  const float scale = glm::min( m_settings.CameraGet().ZoomGet(), 1.0f );
448  render_pivot( curtime_delta_s, scale * scale );
449  }
450 
451  // "Swaps the double-buffer of this window, making the back-buffer the
452  // front-buffer and vice versa, so that the output of the previous OpenGL
453  // commands is displayed on the window."
454  SwapBuffers();
455 
457 
458  if( !activityReporter.HasMessage() )
459  {
461  {
462  // Calculation time in milliseconds
463  const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
464 
465  activityReporter.Report( wxString::Format( _( "Render time %.0f ms ( %.1f fps)" ),
466  calculation_time, 1000.0 / calculation_time ) );
467  }
468  }
469 
470  // This will reset the flag of camera parameters changed
472 
473  if( !err_messages.IsEmpty() )
474  wxLogMessage( err_messages );
475 
476  if( (!m_camera_is_moving) && requested_redraw )
477  {
478  m_mouse_was_moved = false;
479  Request_refresh( false );
480  }
481 }
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 741 of file eda_3d_canvas.cpp.

742 {
743  int id = event.GetId();
744 
745  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPopUpMenu id:%d", id );
746 
747  int key = 0;
748 
749  switch( id )
750  {
751  case ID_POPUP_ZOOMIN:
752  key = WXK_F1;
753  break;
754 
755  case ID_POPUP_ZOOMOUT:
756  key = WXK_F2;
757  break;
758 
759  case ID_POPUP_VIEW_XPOS:
760  key = 'X';
761  break;
762 
763  case ID_POPUP_VIEW_XNEG:
764  key = GR_KB_SHIFT + 'X';
765  break;
766 
767  case ID_POPUP_VIEW_YPOS:
768  key = 'Y';
769  break;
770 
771  case ID_POPUP_VIEW_YNEG:
772  key = GR_KB_SHIFT + 'Y';
773  break;
774 
775  case ID_POPUP_VIEW_ZPOS:
776  key = 'Z';
777  break;
778 
779  case ID_POPUP_VIEW_ZNEG:
780  key = GR_KB_SHIFT + 'Z';
781  break;
782 
784  key = WXK_LEFT;
785  break;
786 
788  key = WXK_RIGHT;
789  break;
790 
791  case ID_POPUP_MOVE3D_UP:
792  key = WXK_UP;
793  break;
794 
796  key = WXK_DOWN;
797  break;
798 
799  default:
800  return;
801  }
802 
803  SetView3D( key );
804 }
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 199 of file eda_3d_canvas.cpp.

200 {
201  this->Request_refresh();
202 }
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 652 of file eda_3d_canvas.cpp.

653 {
654  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnRightClick" );
655 
656  SetFocus();
657 
658  if( m_camera_is_moving )
659  return;
660 
661  wxPoint pos;
662  wxMenu PopUpMenu;
663  wxString msg;
664 
665  pos.x = event.GetX();
666  pos.y = event.GetY();
667 
668  msg = AddHotkeyName( _( "Zoom +" ), GetHotkeyConfig(),
669  ID_POPUP_ZOOMIN );
670  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
671  msg, KiBitmap( zoom_in_xpm ) );
672 
673 
674  msg = AddHotkeyName( _( "Zoom -" ), GetHotkeyConfig(),
676  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
677  msg, KiBitmap( zoom_out_xpm ) );
678 
679  PopUpMenu.AppendSeparator();
680 
681  msg = AddHotkeyName( _( "Top View" ), GetHotkeyConfig(),
683  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
684  msg, KiBitmap( axis3d_top_xpm ) );
685 
686  msg = AddHotkeyName( _( "Bottom View" ), GetHotkeyConfig(),
688  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
689  msg, KiBitmap( axis3d_bottom_xpm ) );
690 
691  PopUpMenu.AppendSeparator();
692 
693  msg = AddHotkeyName( _( "Right View" ), GetHotkeyConfig(),
695  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
696  msg, KiBitmap( axis3d_right_xpm ) );
697 
698  msg = AddHotkeyName( _( "Left View" ), GetHotkeyConfig(),
700  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
701  msg, KiBitmap( axis3d_left_xpm ) );
702 
703  PopUpMenu.AppendSeparator();
704 
705  msg = AddHotkeyName( _( "Front View" ), GetHotkeyConfig(),
707  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
708  msg, KiBitmap( axis3d_front_xpm ) );
709 
710  msg = AddHotkeyName( _( "Back View" ), GetHotkeyConfig(),
712  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
713  msg, KiBitmap( axis3d_back_xpm ) );
714 
715  PopUpMenu.AppendSeparator();
716 
717  msg = AddHotkeyName( _( "Move Left <-" ), GetHotkeyConfig(),
719  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
720  msg, KiBitmap( left_xpm ) );
721 
722  msg = AddHotkeyName( _( "Move Right ->" ), GetHotkeyConfig(),
724  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
725  msg, KiBitmap( right_xpm ) );
726 
727  msg = AddHotkeyName( _( "Move Up ^" ), GetHotkeyConfig(),
729  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
730  msg, KiBitmap( up_xpm ) );
731 
732  msg = AddHotkeyName( _( "Move Down" ), GetHotkeyConfig(),
734  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
735  msg, KiBitmap( down_xpm ) );
736 
737  PopupMenu( &PopUpMenu, pos );
738 }
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:251
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 841 of file eda_3d_canvas.cpp.

842 {
843  (void)event;
844 
845  m_mouse_is_moving = false;
846  m_mouse_was_moved = false;
847 
848  Request_refresh();
849 }
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 864 of file eda_3d_canvas.cpp.

865 {
866  (void)event;
867 
868  //Refresh();
869  //Update();
870 
871  wxPaintEvent redrawEvent;
872  wxPostEvent( this, redrawEvent );
873 }

Referenced by EVT_MENU_RANGE().

◆ releaseOpenGL()

void EDA_3D_CANVAS::releaseOpenGL ( )
private

releaseOpenGL - free created targets and openGL context

Definition at line 169 of file eda_3d_canvas.cpp.

170 {
171  if( m_glRC )
172  {
174 
175  delete m_3d_render_raytracing;
176  m_3d_render_raytracing = NULL;
177 
178  delete m_3d_render_ogl_legacy;
179  m_3d_render_ogl_legacy = NULL;
180 
181  // This is just a copy of a pointer, can safely be set to NULL
182  m_3d_render = NULL;
183 
186  m_glRC = NULL;
187  }
188 }
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 280 of file eda_3d_canvas.cpp.

281 {
282  if( aCachePointer != NULL )
283  m_settings.Set3DCacheManager( aCachePointer );
284 
285  if( aBoard != NULL )
286  m_settings.SetBoard( aBoard );
287 
288  if( m_3d_render )
290 }
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 1131 of file eda_3d_canvas.cpp.

1132 {
1133 
1134  switch( m_settings.RenderEngineGet() )
1135  {
1138  break;
1139 
1142  break;
1143 
1144  default:
1145  m_3d_render = NULL;
1146  break;
1147  }
1148 
1149  if( m_3d_render )
1151 
1152  m_mouse_was_moved = false;
1153 
1154  Request_refresh();
1155 }
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 293 of file eda_3d_canvas.cpp.

294 {
296 
297  if( m_3d_render )
299 
301  //m_mouse_was_moved = true;
302 
303  Request_refresh();
304 }
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().

Referenced by EDA_3D_VIEWER::Process_Special_Functions().

◆ 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 876 of file eda_3d_canvas.cpp.

877 {
878  if( aRedrawImmediately )
879  {
880  // On some systems, just calling Refresh does not work always
881  // (Issue experienced on Win7 MSYS2)
882  //Refresh();
883  //Update();
884 
885  // Using PostEvent will take priority to other events, like
886  // mouse movements, keys, etc.
887  wxPaintEvent redrawEvent;
888  wxPostEvent( this, redrawEvent );
889 
890  // This behaves the same
891  // wxQueueEvent( this,
892  // From wxWidget documentation: "The heap-allocated and
893  // non-NULL event to queue, the function takes ownership of it."
894  // new wxPaintEvent()
895  // );
896  }
897  else
898  {
899  // Schedule a timed redraw
900  m_redraw_trigger_timer.Start( 10 , wxTIMER_ONE_SHOT );
901  }
902 }
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(), EDA_3D_VIEWER::takeScreenshot(), 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 905 of file eda_3d_canvas.cpp.

906 {
907  wxASSERT( aMovingSpeed > FLT_EPSILON );
908 
909  m_render_pivot = aRenderPivot;
910  m_camera_moving_speed = aMovingSpeed;
911 
913 
914  DisplayStatus();
915  Request_refresh();
916 
917  m_camera_is_moving = true;
918 
920 }
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 858 of file eda_3d_canvas.cpp.

859 {
860  m_editing_timeout_timer.Start( m_3d_render->GetWaitForEditingTimeOut() , wxTIMER_ONE_SHOT );
861 }
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().

◆ SetScaleFactor()

void HIDPI_GL_CANVAS::SetScaleFactor ( double  aFactor)
inherited

Set the canvas scale factor, probably for a hi-DPI display.

Definition at line 70 of file hidpi_gl_canvas.cpp.

71 {
72  m_scale_factor = aNewScaleFactor;
73 }
double m_scale_factor
The current scale factor (e.g.

References HIDPI_GL_CANVAS::m_scale_factor.

Referenced by PANEL_PREV_3D::loadCommonSettings(), EDA_3D_VIEWER::loadCommonSettings(), and KIGFX::OPENGL_GAL::updatedGalDisplayOptions().

◆ 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 949 of file eda_3d_canvas.cpp.

950 {
951  if( m_camera_is_moving )
952  return false;
953 
954  const float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
955  const float arrow_moving_time_speed = 8.0f;
956  bool handled = false;
957 
958  switch( aKeycode )
959  {
960  case WXK_SPACE:
962  return true;
963 
964  case WXK_LEFT:
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_RIGHT:
974  m_settings.CameraGet().Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
975  request_start_moving_camera( arrow_moving_time_speed, false );
976  return true;
977 
978  case WXK_UP:
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_DOWN:
988  m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
989  request_start_moving_camera( arrow_moving_time_speed, false );
990  return true;
991 
992  case WXK_HOME:
997  return true;
998 
999  case WXK_END:
1000  break;
1001 
1002  case WXK_TAB:
1005  m_settings.CameraGet().RotateZ_T1( glm::radians( 45.0f ) );
1007  handled = true;
1008  break;
1009 
1010  case WXK_F1:
1013 
1014  if( m_settings.CameraGet().Zoom_T1( 1.4f ) )
1016 
1017  return true;
1018 
1019  case WXK_F2:
1022 
1023  if( m_settings.CameraGet().Zoom_T1( 1/1.4f ) )
1025 
1026  return true;
1027 
1028  case '+':
1029  case '-':
1030  break;
1031 
1032  case 't':
1033  case 'T':
1036  ReloadRequest();
1037  handled = true;
1038  break;
1039 
1040  case 's':
1041  case 'S':
1044  ReloadRequest();
1045  handled = true;
1046  break;
1047 
1048  case 'v':
1049  case 'V':
1052  ReloadRequest();
1053  handled = true;
1054  break;
1055 
1056  case 'r':
1057  case 'R':
1062  return true;
1063 
1064  case 'X':
1068  m_settings.CameraGet().RotateZ_T1( glm::radians( -90.0f ) );
1069  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1071  return true;
1072 
1073  case GR_KB_SHIFT + 'X':
1077  m_settings.CameraGet().RotateZ_T1( glm::radians( 90.0f ) );
1078  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1080  return true;
1081 
1082  case 'Y':
1086  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1088  return true;
1089 
1090  case GR_KB_SHIFT + 'Y':
1094  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1095  m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
1097  return true;
1098 
1099  case 'Z':
1104  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1105  return true;
1106 
1107  case GR_KB_SHIFT + 'Z':
1111  m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
1113  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1114  return true;
1115 
1116  default:
1117  return false;
1118  }
1119 
1120  m_mouse_was_moved = true;
1121 
1123 
1124  DisplayStatus();
1125  Request_refresh();
1126 
1127  return handled;
1128 }
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 852 of file eda_3d_canvas.cpp.

853 {
855 }
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: