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
 
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 60 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:130

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().

◆ 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:62
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
bool m_is_opengl_initialized
Flag to store if opengl was initialized already.
bool m_opengl_supports_raytracing

References 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 137 of file eda_3d_canvas.h.

137 { 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 89 of file eda_3d_canvas.h.

90  {
91  if( m_3d_render )
93  else
94  return false;
95  }
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 886 of file eda_3d_canvas.cpp.

887 {
888  SFVEC3F rayOrigin;
889  SFVEC3F rayDir;
890 
891  // Generate a ray origin and direction based on current mouser position and camera
892  m_settings.CameraGet().MakeRayAtCurrrentMousePosition( rayOrigin, rayDir );
893 
894  RAY mouseRay;
895  mouseRay.Init( rayOrigin, rayDir );
896 
897  float hit_t;
898 
899  // Test it with the board bounding box
900  if( m_settings.GetBBox3DU().Intersect( mouseRay, &hit_t ) )
901  {
904  m_settings.CameraGet().SetLookAtPos_T1( mouseRay.at( hit_t ) );
906 
908  }
909 }
void SetLookAtPos_T1(const SFVEC3F &aLookAtPos)
Definition: ccamera.h:124
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:565
CINFO3D_VISU & m_settings
Stores all pre-computed 3D information and visualization settings to render the board.
void ResetXYpos_T1()
Definition: ccamera.cpp:412
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:40
Definition: ray.h:67
SFVEC3F at(float t) const
Definition: ray.h:89
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:380
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:197

References RAY::at(), BEZIER, CINFO3D_VISU::CameraGet(), CINFO3D_VISU::GetBBox3DU(), RAY::Init(), 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 770 of file eda_3d_canvas.cpp.

771 {
772  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnCharHook" );
773  event.Skip();
774 }

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

778 {
779  //wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnKeyEvent" );
780  int localkey = event.GetKeyCode();
781 
782  // Use only upper char values in comparisons
783  // (the Shift modifier is a separate attribute)
784  if( (localkey >= 'a') && (localkey <= 'z') )
785  localkey += 'A' - 'a';
786 
787  if( m_camera_is_moving )
788  return;
789 
790  if( event.ShiftDown() )
791  localkey |= GR_KB_SHIFT;
792 
793  if( event.ControlDown() )
794  localkey |= GR_KB_CTRL;
795 
796  if( event.AltDown() )
797  localkey |= GR_KB_ALT;
798 
799  if( !SetView3D( localkey ) )
800  event.Skip();
801 }
#define GR_KB_ALT
Definition: eda_3d_canvas.h:53
bool m_camera_is_moving
true if camera animation is ongoing
#define GR_KB_SHIFT
Definition: eda_3d_canvas.h:54
#define GR_KB_CTRL
Definition: eda_3d_canvas.h:52
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:431
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:458
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:431
bool Zoom(float aFactor)
Definition: ccamera.cpp:484
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:520
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:520
#define NULL
bool m_mouse_was_moved
true if there was some type of activity, it will be used to render in preview mode
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:579
bool SetCurWindowSize(const wxSize &aSize)
SetCurWindowSize - update the windows size of the camera.
Definition: ccamera.cpp:458
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
#define _(s)
Definition: 3d_actions.cpp:31
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
bool ParametersChanged()
Function ParametersChanged.
Definition: ccamera.cpp:597
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, NULL, OPENGL_LEGACY, CCAMERA::ParametersChanged(), C3D_RENDER_BASE::Redraw(), 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 704 of file eda_3d_canvas.cpp.

705 {
706  int id = event.GetId();
707 
708  wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPopUpMenu id:%d", id );
709 
710  int key = 0;
711 
712  switch( id )
713  {
714  case ID_POPUP_ZOOMIN:
715  key = WXK_F1;
716  break;
717 
718  case ID_POPUP_ZOOMOUT:
719  key = WXK_F2;
720  break;
721 
722  case ID_POPUP_VIEW_XPOS:
723  key = 'X';
724  break;
725 
726  case ID_POPUP_VIEW_XNEG:
727  key = GR_KB_SHIFT + 'X';
728  break;
729 
730  case ID_POPUP_VIEW_YPOS:
731  key = 'Y';
732  break;
733 
734  case ID_POPUP_VIEW_YNEG:
735  key = GR_KB_SHIFT + 'Y';
736  break;
737 
738  case ID_POPUP_VIEW_ZPOS:
739  key = 'Z';
740  break;
741 
742  case ID_POPUP_VIEW_ZNEG:
743  key = GR_KB_SHIFT + 'Z';
744  break;
745 
747  key = WXK_LEFT;
748  break;
749 
751  key = WXK_RIGHT;
752  break;
753 
754  case ID_POPUP_MOVE3D_UP:
755  key = WXK_UP;
756  break;
757 
759  key = WXK_DOWN;
760  break;
761 
762  default:
763  return;
764  }
765 
766  SetView3D( key );
767 }
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
#define GR_KB_SHIFT
Definition: eda_3d_canvas.h:54
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 
664  pos.x = event.GetX();
665  pos.y = event.GetY();
666 
667  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
668  _( "Zoom +\tF1" ), KiBitmap( zoom_in_xpm ) );
669  AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
670  _( "Zoom -\tF2" ), KiBitmap( zoom_out_xpm ) );
671 
672  PopUpMenu.AppendSeparator();
673  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
674  _( "Top View\tZ" ), KiBitmap( axis3d_top_xpm ) );
675  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
676  _( "Bottom View\tShift+Z" ), KiBitmap( axis3d_bottom_xpm ) );
677 
678  PopUpMenu.AppendSeparator();
679  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
680  _( "Right View\tX" ), KiBitmap( axis3d_right_xpm ) );
681  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
682  _( "Left View\tShift+X" ), KiBitmap( axis3d_left_xpm ) );
683 
684  PopUpMenu.AppendSeparator();
685  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
686  _( "Front View\tY" ), KiBitmap( axis3d_front_xpm ) );
687  AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
688  _( "Back View\tShift+Y" ), KiBitmap( axis3d_back_xpm ) );
689 
690  PopUpMenu.AppendSeparator();
691  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
692  _( "Move Left <-\tLeft" ), KiBitmap( left_xpm ) );
693  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
694  _( "Move Right ->\tRight" ), KiBitmap( right_xpm ) );
695  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
696  _( "Move Up ^\tUp" ), KiBitmap( up_xpm ) );
697  AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
698  _( "Move Down\tDown" ), KiBitmap( down_xpm ) );
699 
700  PopupMenu( &PopUpMenu, pos );
701 }
const BITMAP_OPAQUE right_xpm[1]
Definition: right.cpp:49
const BITMAP_OPAQUE down_xpm[1]
Definition: down.cpp:47
const BITMAP_OPAQUE axis3d_front_xpm[1]
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.
const BITMAP_OPAQUE left_xpm[1]
Definition: left.cpp:48
const BITMAP_OPAQUE zoom_out_xpm[1]
Definition: zoom_out.cpp:58
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
const BITMAP_OPAQUE axis3d_left_xpm[1]
Definition: axis3d_left.cpp:98
const BITMAP_OPAQUE up_xpm[1]
Definition: up.cpp:47
bool m_camera_is_moving
true if camera animation is ongoing
const BITMAP_OPAQUE axis3d_bottom_xpm[1]
const BITMAP_OPAQUE axis3d_top_xpm[1]
Definition: axis3d_top.cpp:94
#define _(s)
Definition: 3d_actions.cpp:31
const BITMAP_OPAQUE axis3d_right_xpm[1]
const BITMAP_OPAQUE axis3d_back_xpm[1]
Definition: axis3d_back.cpp:97
const BITMAP_OPAQUE zoom_in_xpm[1]
Definition: zoom_in.cpp:59

References _, AddMenuItem(), axis3d_back_xpm, axis3d_bottom_xpm, axis3d_front_xpm, axis3d_left_xpm, axis3d_right_xpm, axis3d_top_xpm, down_xpm, 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(), left_xpm, m_camera_is_moving, m_logTrace, right_xpm, up_xpm, wxPoint::x, wxPoint::y, zoom_in_xpm, and zoom_out_xpm.

◆ OnTimerTimeout_Editing()

void EDA_3D_CANVAS::OnTimerTimeout_Editing ( wxTimerEvent &  event)
private

Definition at line 804 of file eda_3d_canvas.cpp.

805 {
806  (void)event;
807 
808  m_mouse_is_moving = false;
809  m_mouse_was_moved = false;
810 
811  Request_refresh();
812 }
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 827 of file eda_3d_canvas.cpp.

828 {
829  (void)event;
830 
831  //Refresh();
832  //Update();
833 
834  wxPaintEvent redrawEvent;
835  wxPostEvent( this, redrawEvent );
836 }

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;
177 
178  delete m_3d_render_ogl_legacy;
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).
#define NULL
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, NULL, 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.
#define NULL
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, NULL, 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:128
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
const glm::mat4 & GetViewMatrix() const
Definition: ccamera.cpp:419
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
static void pivot_render_triangles(float t)
const glm::mat4 & GetProjectionMatrix() const
Definition: ccamera.cpp:389

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

1095 {
1096  switch( m_settings.RenderEngineGet() )
1097  {
1100  break;
1101 
1104  break;
1105 
1106  default:
1107  m_3d_render = NULL;
1108  break;
1109  }
1110 
1111  if( m_3d_render )
1113 
1114  m_mouse_was_moved = false;
1115 
1116  Request_refresh();
1117 }
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.
#define NULL
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, NULL, OPENGL_LEGACY, RAYTRACING, C3D_RENDER_BASE::ReloadRequest(), 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 839 of file eda_3d_canvas.cpp.

840 {
841  if( aRedrawImmediately )
842  {
843  // On some systems, just calling Refresh does not work always
844  // (Issue experienced on Win7 MSYS2)
845  //Refresh();
846  //Update();
847 
848  // Using PostEvent will take priority to other events, like
849  // mouse movements, keys, etc.
850  wxPaintEvent redrawEvent;
851  wxPostEvent( this, redrawEvent );
852 
853  // This behaves the same
854  // wxQueueEvent( this,
855  // From wxWidget documentation: "The heap-allocated and
856  // non-NULL event to queue, the function takes ownership of it."
857  // new wxPaintEvent()
858  // );
859  }
860  else
861  {
862  // Schedule a timed redraw
863  m_redraw_trigger_timer.Start( 10 , wxTIMER_ONE_SHOT );
864  }
865 }
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 868 of file eda_3d_canvas.cpp.

869 {
870  wxASSERT( aMovingSpeed > FLT_EPSILON );
871 
872  m_render_pivot = aRenderPivot;
873  m_camera_moving_speed = aMovingSpeed;
874 
876 
877  DisplayStatus();
878  Request_refresh();
879 
880  m_camera_is_moving = true;
881 
883 }
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 821 of file eda_3d_canvas.cpp.

822 {
823  m_editing_timeout_timer.Start( m_3d_render->GetWaitForEditingTimeOut() , wxTIMER_ONE_SHOT );
824 }
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 81 of file eda_3d_canvas.h.

81 { 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 912 of file eda_3d_canvas.cpp.

913 {
914  if( m_camera_is_moving )
915  return false;
916 
917  const float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
918  const float arrow_moving_time_speed = 8.0f;
919  bool handled = false;
920 
921  switch( aKeycode )
922  {
923  case WXK_SPACE:
925  return true;
926 
927  case WXK_LEFT:
930  m_settings.CameraGet().Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
931  request_start_moving_camera( arrow_moving_time_speed, false );
932  return true;
933 
934  case WXK_RIGHT:
937  m_settings.CameraGet().Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
938  request_start_moving_camera( arrow_moving_time_speed, false );
939  return true;
940 
941  case WXK_UP:
944  m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
945  request_start_moving_camera( arrow_moving_time_speed, false );
946  return true;
947 
948  case WXK_DOWN:
951  m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
952  request_start_moving_camera( arrow_moving_time_speed, false );
953  return true;
954 
955  case WXK_HOME:
959  request_start_moving_camera( glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 1/1.26f ), 1.26f ) );
960  return true;
961 
962  case WXK_END:
963  break;
964 
965  case WXK_TAB:
968  m_settings.CameraGet().RotateZ_T1( glm::radians( 45.0f ) );
970  handled = true;
971  break;
972 
973  case WXK_F1:
976 
977  if( m_settings.CameraGet().Zoom_T1( 1.26f ) ) // 3 steps per doubling
979 
980  return true;
981 
982  case WXK_F2:
985 
986  if( m_settings.CameraGet().Zoom_T1( 1/1.26f ) ) // 3 steps per halving
988 
989  return true;
990 
991  case '+':
992  case '-':
993  break;
994 
995  case 't':
996  case 'T':
999  ReloadRequest();
1000  handled = true;
1001  break;
1002 
1003  case 's':
1004  case 'S':
1007  ReloadRequest();
1008  handled = true;
1009  break;
1010 
1011  case 'v':
1012  case 'V':
1015  ReloadRequest();
1016  handled = true;
1017  break;
1018 
1019  case 'r':
1020  case 'R':
1024  request_start_moving_camera( glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1025  return true;
1026 
1027  case 'X':
1031  m_settings.CameraGet().RotateZ_T1( glm::radians( -90.0f ) );
1032  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1034  return true;
1035 
1036  case GR_KB_SHIFT + 'X':
1040  m_settings.CameraGet().RotateZ_T1( glm::radians( 90.0f ) );
1041  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1043  return true;
1044 
1045  case 'Y':
1049  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1051  return true;
1052 
1053  case GR_KB_SHIFT + 'Y':
1057  m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
1058  m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
1060  return true;
1061 
1062  case 'Z':
1067  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1068  return true;
1069 
1070  case GR_KB_SHIFT + 'Z':
1074  m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
1076  glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
1077  return true;
1078 
1079  default:
1080  return false;
1081  }
1082 
1083  m_mouse_was_moved = true;
1084 
1086 
1087  DisplayStatus();
1088  Request_refresh();
1089 
1090  return handled;
1091 }
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:565
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:520
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
Definition: eda_3d_canvas.h:54
bool Zoom_T1(float aFactor)
Definition: ccamera.cpp:503
virtual void Pan_T1(const SFVEC3F &aDeltaOffsetInc)=0
void RotateX_T1(float aAngleInRadians)
Definition: ccamera.cpp:547
virtual void Reset_T1()
Definition: ccamera.cpp:103
void RotateY_T1(float aAngleInRadians)
Definition: ccamera.cpp:553
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
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:559
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:197

References BEZIER, CINFO3D_VISU::CameraGet(), DisplayStatus(), EASING_IN_OUT, FL_MODULE_ATTRIBUTES_NORMAL, FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_MODULE_ATTRIBUTES_VIRTUAL, CINFO3D_VISU::GetFlag(), GR_KB_SHIFT, LINEAR, m_camera_is_moving, m_delta_move_step_factor, m_mouse_was_moved, m_settings, 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 815 of file eda_3d_canvas.cpp.

816 {
818 }
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 135 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 267 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 273 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 270 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 252 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 258 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 279 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 239 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 232 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 276 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 245 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 249 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 284 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 235 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 242 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 255 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 282 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 264 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 261 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: