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_3D_CANVAS HIDPI_GL_CANVAS

Public Member Functions

 EDA_3D_CANVAS (wxWindow *aParent, const int *aAttribList, BOARD_ADAPTER &aSettings, CAMERA &aCamera, S3D_CACHE *a3DCachePointer)
 Create a new 3D Canvas with an attribute list. More...
 
 ~EDA_3D_CANVAS ()
 
void SetEventDispatcher (TOOL_DISPATCHER *aEventDispatcher)
 Set a dispatcher that processes events and forwards them to tools. More...
 
void SetStatusBar (wxStatusBar *aStatusBar)
 
void SetInfoBar (WX_INFOBAR *aInfoBar)
 
void ReloadRequest (BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
 
bool IsReloadRequestPending () const
 Query if there is a pending reload request. More...
 
RENDER_3D_BASEGetCurrentRender () const
 
void 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)
 Helper function to call view commands. More...
 
void SetAnimationEnabled (bool aEnable)
 Enable or disable camera animation when switching to a pre-defined view. More...
 
bool GetAnimationEnabled () const
 
void SetMovingSpeedMultiplier (int aMultiplier)
 Set the camera animation moving speed multiplier option. More...
 
int GetMovingSpeedMultiplier () const
 
int GetProjectionMode () const
 
void SetProjectionMode (int aMode)
 
void RenderEngineChanged ()
 Notify that the render engine was changed. More...
 
void DisplayStatus ()
 Update the status bar with the position information. More...
 
void Request_refresh (bool aRedrawImmediately=true)
 Schedule a refresh update of the canvas. More...
 
void OnEvent (wxEvent &aEvent)
 Used to forward events to the canvas from popups, etc. More...
 
const BOARD_ADAPTERGetBoardAdapter () const
 Get information used to display 3D board. More...
 
bool GetRenderPivot ()
 Get a value indicating whether to render the pivot. More...
 
void SetRenderPivot (bool aValue)
 Set aValue indicating whether to render the pivot. More...
 
CAMERAGetCamera ()
 Get the canvas camera. More...
 
void OnMouseMoveCamera (wxMouseEvent &event)
 
void OnMouseWheelCamera (wxMouseEvent &event, bool aPan)
 
virtual wxSize GetNativePixelSize () const
 
wxPoint GetNativePosition (const wxPoint &aPoint) const
 Convert the given point from client coordinates to native pixel coordinates. More...
 
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...
 

Public Attributes

bool m_mouse_is_moving
 
bool m_mouse_was_moved
 
bool m_camera_is_moving
 
CAMERAm_camera
 

Static Public Attributes

static const float m_delta_move_step_factor = 0.7f
 

Private Member Functions

void OnPaint (wxPaintEvent &aEvent)
 Called by a wxPaintEvent event. More...
 
void DoRePaint ()
 The actual function to repaint the canvas. More...
 
void OnEraseBackground (wxEraseEvent &event)
 
void OnRefreshRequest (wxEvent &aEvent)
 
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 OnTimerTimeout_Editing (wxTimerEvent &event)
 
void OnCloseWindow (wxCloseEvent &event)
 
void OnResize (wxSizeEvent &event)
 
void OnTimerTimeout_Redraw (wxTimerEvent &event)
 
void stop_editingTimeOut_Timer ()
 Stop the editing time so it will not timeout. More...
 
void restart_editingTimeOut_Timer ()
 Reset the editing timer. More...
 
void request_start_moving_camera (float aMovingSpeed=2.0f, bool aRenderPivot=true)
 Start a camera movement. More...
 
void move_pivot_based_on_cur_mouse_position ()
 This function hits a ray to the board and start a movement. More...
 
void render_pivot (float t, float aScale)
 Render the pivot cursor. More...
 
bool initializeOpenGL ()
 
void releaseOpenGL ()
 Free created targets and openGL context. More...
 
RAY getRayAtCurrentMousePosition ()
 

Private Attributes

TOOL_DISPATCHERm_eventDispatcher
 
wxStatusBar * m_parentStatusBar
 
WX_INFOBARm_parentInfoBar
 
wxGLContext * m_glRC
 
bool m_is_opengl_initialized
 
bool m_is_opengl_version_supported
 
wxTimer m_editing_timeout_timer
 
wxTimer m_redraw_trigger_timer
 
std::atomic_flag m_is_currently_painting
 
bool m_render_pivot
 
float m_camera_moving_speed
 
unsigned m_strtime_camera_movement
 
bool m_animation_enabled
 
int m_moving_speed_multiplier
 
BOARD_ADAPTERm_boardAdapter
 
RENDER_3D_BASEm_3d_render
 
RENDER_3D_RAYTRACEm_3d_render_raytracing
 
RENDER_3D_OPENGLm_3d_render_opengl
 
bool m_opengl_supports_raytracing
 
bool m_render_raytracing_was_requested
 
ACCELERATOR_3Dm_accelerator3DShapes
 
BOARD_ITEMm_currentRollOverItem
 
double m_scale_factor
 The current scale factor (e.g. More...
 

Static Private Attributes

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

Constructor & Destructor Documentation

◆ EDA_3D_CANVAS()

EDA_3D_CANVAS::EDA_3D_CANVAS ( wxWindow *  aParent,
const int *  aAttribList,
BOARD_ADAPTER aSettings,
CAMERA aCamera,
S3D_CACHE a3DCachePointer 
)

Create a new 3D Canvas with an 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.

Definition at line 87 of file eda_3d_canvas.cpp.

89 :
90 HIDPI_GL_3D_CANVAS( aCamera, aParent, wxID_ANY, aAttribList, wxDefaultPosition,
91 wxDefaultSize, wxFULL_REPAINT_ON_RESIZE ),
92 m_eventDispatcher( nullptr ),
93 m_parentStatusBar( nullptr ),
94 m_parentInfoBar( nullptr ),
95 m_glRC( nullptr ),
98 m_editing_timeout_timer( this, wxID_HIGHEST + 1 ),
99 m_redraw_trigger_timer( this, wxID_HIGHEST + 2 ),
100 m_render_pivot( false ),
101 m_camera_moving_speed( 1.0f ),
103 m_animation_enabled( true ),
105 m_boardAdapter( aBoardAdapter ),
106 m_3d_render( nullptr ),
109 m_accelerator3DShapes( nullptr ),
110 m_currentRollOverItem( nullptr )
111{
112 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::EDA_3D_CANVAS" ) );
113
114 m_editing_timeout_timer.SetOwner( this );
115 Connect( m_editing_timeout_timer.GetId(), wxEVT_TIMER,
116 wxTimerEventHandler( EDA_3D_CANVAS::OnTimerTimeout_Editing ), nullptr, this );
117
118 m_redraw_trigger_timer.SetOwner( this );
119 Connect( m_redraw_trigger_timer.GetId(), wxEVT_TIMER,
120 wxTimerEventHandler( EDA_3D_CANVAS::OnTimerTimeout_Redraw ), nullptr, this );
121
123
126
127 wxASSERT( m_3d_render_raytracing != nullptr );
128 wxASSERT( m_3d_render_opengl != nullptr );
129
130 auto busy_indicator_factory =
131 []()
132 {
133 return std::make_unique<WX_BUSY_INDICATOR>();
134 };
135
136 m_3d_render_raytracing->SetBusyIndicatorFactory( busy_indicator_factory );
137 m_3d_render_opengl->SetBusyIndicatorFactory( busy_indicator_factory );
138
139 // We always start with the opengl engine (raytracing is avoided due to very
140 // long calculation time)
142
143 m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
144
145 wxASSERT( a3DCachePointer != nullptr );
146 m_boardAdapter.Set3dCacheManager( a3DCachePointer );
147
148 const wxEventType events[] =
149 {
150 // Binding both EVT_CHAR and EVT_CHAR_HOOK ensures that all key events,
151 // especially special key like arrow keys, are handled by the GAL event dispatcher,
152 // and not sent to GUI without filtering, because they have a default action (scroll)
153 // that must not be called.
154 wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK,
155 wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
156 wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
157 wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, wxEVT_CHAR_HOOK,
158#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
159 wxEVT_MAGNIFY,
160#endif
161 wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT
162 };
163
164 for( wxEventType eventType : events )
165 Connect( eventType, wxEventHandler( EDA_3D_CANVAS::OnEvent ), nullptr, m_eventDispatcher );
166}
void Set3dCacheManager(S3D_CACHE *aCacheMgr) noexcept
Update the cache manager pointer.
Definition: board_adapter.h:80
void SetColorSettings(COLOR_SETTINGS *aSettings) noexcept
RENDER_3D_OPENGL * m_3d_render_opengl
TOOL_DISPATCHER * m_eventDispatcher
void OnEvent(wxEvent &aEvent)
Used to forward events to the canvas from popups, etc.
unsigned m_strtime_camera_movement
RENDER_3D_RAYTRACE * m_3d_render_raytracing
BOARD_ITEM * m_currentRollOverItem
RENDER_3D_BASE * m_3d_render
bool m_is_opengl_initialized
WX_INFOBAR * m_parentInfoBar
wxTimer m_editing_timeout_timer
wxGLContext * m_glRC
ACCELERATOR_3D * m_accelerator3DShapes
void OnTimerTimeout_Redraw(wxTimerEvent &event)
wxStatusBar * m_parentStatusBar
int m_moving_speed_multiplier
bool m_is_opengl_version_supported
wxTimer m_redraw_trigger_timer
BOARD_ADAPTER & m_boardAdapter
bool m_render_raytracing_was_requested
float m_camera_moving_speed
bool m_animation_enabled
std::atomic_flag m_is_currently_painting
bool m_opengl_supports_raytracing
void OnTimerTimeout_Editing(wxTimerEvent &event)
HIDPI_GL_3D_CANVAS(CAMERA &aCamera, wxWindow *parent, wxWindowID id=wxID_ANY, const int *attribList=nullptr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxGLCanvasName, const wxPalette &palette=wxNullPalette)
void SetBusyIndicatorFactory(BUSY_INDICATOR::FACTORY aNewFactory)
Set a new busy indicator factory.
Object to render the board using openGL.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
SETTINGS_MANAGER * GetSettingsManager()
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References GetSettingsManager(), OnEvent(), OnTimerTimeout_Editing(), OnTimerTimeout_Redraw(), and Pgm().

◆ ~EDA_3D_CANVAS()

EDA_3D_CANVAS::~EDA_3D_CANVAS ( )

Definition at line 169 of file eda_3d_canvas.cpp.

170{
171 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::~EDA_3D_CANVAS" ) );
172
174 m_accelerator3DShapes = nullptr;
175
177}
void releaseOpenGL()
Free created targets and openGL context.

References m_accelerator3DShapes, m_logTrace, and releaseOpenGL().

Member Function Documentation

◆ DisplayStatus()

void EDA_3D_CANVAS::DisplayStatus ( )

Update the status bar with the position information.

Definition at line 326 of file eda_3d_canvas.cpp.

327{
329 {
330 wxString msg;
331
332 msg.Printf( wxT( "dx %3.2f" ), m_camera.GetCameraPos().x );
333 m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::X_POS ) );
334
335 msg.Printf( wxT( "dy %3.2f" ), m_camera.GetCameraPos().y );
336 m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::Y_POS ) );
337 }
338}
const SFVEC3F & GetCameraPos() const
Definition: camera.h:140

References CAMERA::GetCameraPos(), HIDPI_GL_3D_CANVAS::m_camera, m_parentStatusBar, X_POS, and Y_POS.

Referenced by DoRePaint(), EDA_3D_CONTROLLER::doZoomInOut(), OnMouseMove(), OnMouseWheel(), request_start_moving_camera(), SetView3D(), and EDA_3D_CONTROLLER::ZoomFitScreen().

◆ DoRePaint()

void EDA_3D_CANVAS::DoRePaint ( )
private

The actual function to repaint the canvas.

It is usually called by OnPaint() but because it does not use a wxPaintDC it can be called outside a wxPaintEvent

Definition at line 348 of file eda_3d_canvas.cpp.

349{
350 if( m_is_currently_painting.test_and_set() )
351 return;
352
353 // SwapBuffer requires the window to be shown before calling
354 if( !IsShownOnScreen() )
355 {
356 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::DoRePaint !IsShown" ) );
358 return;
359 }
360
361 // Because the board to draw is handled by the parent viewer frame,
362 // ensure this parent is still alive. When it is closed before the viewer
363 // frame, a paint event can be generated after the parent is closed,
364 // therefore with invalid board.
365 // This is dependent of the platform.
366 // Especially on OSX, but also on Windows, it frequently happens
367 if( !GetParent()->GetParent()->IsShown() )
368 return; // The parent board editor frame is no more alive
369
370 wxString err_messages;
371
372 // !TODO: implement error reporter
373 INFOBAR_REPORTER warningReporter( m_parentInfoBar );
375
376 unsigned strtime = GetRunningMicroSecs();
377
378 // "Makes the OpenGL state that is represented by the OpenGL rendering
379 // context context current, i.e. it will be used by all subsequent OpenGL calls.
380 // This function may only be called when the window is shown on screen"
381
382 // Explicitly create a new rendering context instance for this canvas.
383 if( m_glRC == nullptr )
385
387
388 // Set the OpenGL viewport according to the client size of this canvas.
389 // This is done here rather than in a wxSizeEvent handler because our
390 // OpenGL rendering context (and thus viewport setting) is used with
391 // multiple canvases: If we updated the viewport in the wxSizeEvent
392 // handler, changing the size of one canvas causes a viewport setting that
393 // is wrong when next another canvas is repainted.
394 wxSize clientSize = GetNativePixelSize();
395
396 const bool windows_size_changed = m_camera.SetCurWindowSize( clientSize );
397
398 // Initialize openGL if need
400 {
401 if( !initializeOpenGL() )
402 {
405
406 return;
407 }
408
410 {
411 warningReporter.Report( _( "Your OpenGL version is not supported. Minimum required "
412 "is 1.5." ), RPT_SEVERITY_ERROR );
413
414 warningReporter.Finalize();
415 }
416 }
417
419 {
420 glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
421 glClear( GL_COLOR_BUFFER_BIT );
422
423 SwapBuffers();
424
427
428 return;
429 }
430
431 // Don't attend to ray trace if OpenGL doesn't support it.
433 {
437 }
438
439 // Check if a raytacing was requested and need to switch to raytracing mode
441 {
442 const bool was_camera_changed = m_camera.ParametersChanged();
443
444 // It reverts back to OpenGL mode if it was requested a raytracing
445 // render of the current scene. AND the mouse / camera is moving
446 if( ( m_mouse_is_moving || m_camera_is_moving || was_camera_changed
447 || windows_size_changed )
449 {
452 }
453 }
454
455 float curtime_delta_s = 0.0f;
456
458 {
459 const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
460 curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
461 m_camera.Interpolate( curtime_delta_s );
462
463 if( curtime_delta_s > 1.0f )
464 {
465 m_render_pivot = false;
466 m_camera_is_moving = false;
467 m_mouse_was_moved = true;
468
471 }
472 else
473 {
475 }
476 }
477
478 // It will return true if the render request a new redraw
479 bool requested_redraw = false;
480
481 if( m_3d_render )
482 {
483 try
484 {
485 m_3d_render->SetCurWindowSize( clientSize );
486
487 bool reloadRaytracingForCalculations = false;
488
491 {
492 reloadRaytracingForCalculations = true;
493 }
494
496 &activityReporter, &warningReporter );
497
498 // Raytracer renderer is responsible for some features also used by the OpenGL
499 // renderer.
500 // FIXME: Presumably because raytracing renderer reload is called only after current
501 // renderer redraw, the old zoom value stays for a single frame. This is ugly, but only
502 // cosmetic, so I'm not fixing that for now: I don't know how to do this without
503 // reloading twice (maybe it's not too bad of an idea?) or doing a complicated
504 // refactor.
505 if( reloadRaytracingForCalculations )
506 m_3d_render_raytracing->Reload( nullptr, nullptr, true );
507 }
508 catch( std::runtime_error& )
509 {
515 return;
516 }
517 }
518
519 if( m_render_pivot )
520 {
521 const float scale = glm::min( m_camera.GetZoom(), 1.0f );
522 render_pivot( curtime_delta_s, scale );
523 }
524
525#if defined( KICAD_USE_3DCONNEXION )
526 if( m_render3dmousePivot )
527 {
528 const float scale = glm::min( m_camera.GetZoom(), 1.0f );
529 render3dmousePivot( scale );
530 }
531#endif
532
533 // "Swaps the double-buffer of this window, making the back-buffer the
534 // front-buffer and vice versa, so that the output of the previous OpenGL
535 // commands is displayed on the window."
536 SwapBuffers();
537
539
540 if( !activityReporter.HasMessage() )
541 {
543 {
544 // Calculation time in milliseconds
545 const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
546
547 activityReporter.Report( wxString::Format( _( "Last render time %.0f ms" ),
548 calculation_time ) );
549 }
550 }
551
552 // This will reset the flag of camera parameters changed
554
555 warningReporter.Finalize();
556
557 if( !err_messages.IsEmpty() )
558 wxLogMessage( err_messages );
559
560 if( ( !m_camera_is_moving ) && requested_redraw )
561 {
562 m_mouse_was_moved = false;
563 Request_refresh( false );
564 }
565
567}
EDA_3D_VIEWER_SETTINGS * m_Cfg
virtual void Interpolate(float t)
It will update the matrix to interpolate between T0 and T1 values.
Definition: camera.cpp:645
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
Definition: camera.cpp:512
float GetZoom() const
Definition: camera.h:192
bool ParametersChanged()
Definition: camera.cpp:663
void restart_editingTimeOut_Timer()
Reset the editing timer.
bool initializeOpenGL()
void DisplayStatus()
Update the status bar with the position information.
void render_pivot(float t, float aScale)
Render the pivot cursor.
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
void UnlockCtx(wxGLContext *aContext)
Allow other canvases to bind an OpenGL context.
void LockCtx(wxGLContext *aContext, wxGLCanvas *aCanvas)
Set a context as current and prevents other canvases from switching it.
static GL_CONTEXT_MANAGER & Get()
Return the GL_CONTEXT_MANAGER instance (singleton).
wxGLContext * CreateCtx(wxGLCanvas *aCanvas, const wxGLContext *aOther=nullptr)
Create a managed OpenGL context.
virtual wxSize GetNativePixelSize() const
A wrapper for reporting to a WX_INFOBAR UI element.
Definition: reporter.h:316
virtual bool Redraw(bool aIsMoving, REPORTER *aStatusReporter=nullptr, REPORTER *aWarningReporter=nullptr)=0
Redraw the view.
virtual void SetCurWindowSize(const wxSize &aSize)=0
Before each render, the canvas will tell the render what is the size of its windows,...
bool IsReloadRequestPending() const
Query if there is a pending reload request.
void Reload(REPORTER *aStatusReporter, REPORTER *aWarningReporter, bool aOnlyLoadCopperAndShapes)
A wrapper for reporting to a specific text location in a statusbar.
Definition: reporter.h:287
#define _(s)
@ ACTIVITY
unsigned GetRunningMicroSecs()
An alternate way to calculate an elapsed time (in microsecondes) to class PROF_COUNTER.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ RPT_SEVERITY_ERROR
const int scale

References _, ACTIVITY, GL_CONTEXT_MANAGER::CreateCtx(), DisplayStatus(), EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS::engine, INFOBAR_REPORTER::Finalize(), Format(), GL_CONTEXT_MANAGER::Get(), HIDPI_GL_CANVAS::GetNativePixelSize(), GetRunningMicroSecs(), CAMERA::GetZoom(), STATUSBAR_REPORTER::HasMessage(), initializeOpenGL(), CAMERA::Interpolate(), RENDER_3D_BASE::IsReloadRequestPending(), GL_CONTEXT_MANAGER::LockCtx(), m_3d_render, m_3d_render_opengl, m_3d_render_raytracing, m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera, HIDPI_GL_3D_CANVAS::m_camera_is_moving, m_camera_moving_speed, BOARD_ADAPTER::m_Cfg, m_glRC, m_is_currently_painting, m_is_opengl_initialized, m_is_opengl_version_supported, m_logTrace, HIDPI_GL_3D_CANVAS::m_mouse_is_moving, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, m_opengl_supports_raytracing, m_parentInfoBar, m_parentStatusBar, EDA_3D_VIEWER_SETTINGS::m_Render, m_render_pivot, m_render_raytracing_was_requested, m_strtime_camera_movement, OPENGL, CAMERA::ParametersChanged(), RENDER_3D_BASE::Redraw(), RENDER_3D_RAYTRACE::Reload(), render_pivot(), STATUSBAR_REPORTER::Report(), INFOBAR_REPORTER::Report(), Request_refresh(), restart_editingTimeOut_Timer(), RPT_SEVERITY_ERROR, scale, CAMERA::SetCurWindowSize(), RENDER_3D_BASE::SetCurWindowSize(), and GL_CONTEXT_MANAGER::UnlockCtx().

Referenced by OnPaint(), and OnRefreshRequest().

◆ GetAnimationEnabled()

bool EDA_3D_CANVAS::GetAnimationEnabled ( ) const
inline

Definition at line 128 of file eda_3d_canvas.h.

128{ return m_animation_enabled; }

References m_animation_enabled.

Referenced by EDA_3D_VIEWER_FRAME::SaveSettings().

◆ GetBoardAdapter()

const BOARD_ADAPTER & EDA_3D_CANVAS::GetBoardAdapter ( ) const
inline

Get information used to display 3D board.

Definition at line 167 of file eda_3d_canvas.h.

167{ return m_boardAdapter; }

References m_boardAdapter.

Referenced by NL_3D_VIEWER_PLUGIN_IMPL::GetHitLookAt(), and NL_3D_VIEWER_PLUGIN_IMPL::GetModelExtents().

◆ GetCamera()

CAMERA * HIDPI_GL_3D_CANVAS::GetCamera ( )
inlineinherited

Get the canvas camera.

Definition at line 66 of file hidpi_gl_3D_canvas.h.

66{ return &m_camera; }

References HIDPI_GL_3D_CANVAS::m_camera.

Referenced by NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL().

◆ GetCurrentRender()

RENDER_3D_BASE * EDA_3D_CANVAS::GetCurrentRender ( ) const
inline
Returns
the current render ( a RENDER_3D_RAYTRACE* or a RENDER_3D_OPENGL* render )

Definition at line 102 of file eda_3d_canvas.h.

102{ return m_3d_render; }

References m_3d_render.

Referenced by EDA_3D_CONTROLLER::ToggleVisibility().

◆ GetMovingSpeedMultiplier()

int EDA_3D_CANVAS::GetMovingSpeedMultiplier ( ) const
inline

Definition at line 136 of file eda_3d_canvas.h.

References m_moving_speed_multiplier.

Referenced by EDA_3D_VIEWER_FRAME::SaveSettings().

◆ GetNativePixelSize()

wxSize HIDPI_GL_CANVAS::GetNativePixelSize ( ) const
virtualinherited

Definition at line 41 of file hidpi_gl_canvas.cpp.

42{
43 wxSize size = wxGLCanvas::GetClientSize();
44
45 const double scaleFactor = GetScaleFactor();
46 size.x *= scaleFactor;
47 size.y *= scaleFactor;
48
49 return size;
50}
double GetScaleFactor() const
Get the current scale factor.

References HIDPI_GL_CANVAS::GetScaleFactor().

Referenced by DoRePaint(), EDA_3D_MODEL_VIEWER::OnMouseMove(), HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), EDA_3D_MODEL_VIEWER::OnPaint(), and KIGFX::OPENGL_GAL::OPENGL_GAL().

◆ GetNativePosition()

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

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

Definition at line 53 of file hidpi_gl_canvas.cpp.

54{
55 wxPoint nativePoint = aPoint;
56
57 const double scaleFactor = GetScaleFactor();
58 nativePoint.x *= scaleFactor;
59 nativePoint.y *= scaleFactor;
60
61 return nativePoint;
62}

References HIDPI_GL_CANVAS::GetScaleFactor().

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

◆ GetProjectionMode()

int EDA_3D_CANVAS::GetProjectionMode ( ) const
inline

Definition at line 138 of file eda_3d_canvas.h.

138{ return (int) m_camera.GetProjection(); };
PROJECTION_TYPE GetProjection()
Definition: camera.h:176

References CAMERA::GetProjection(), and HIDPI_GL_3D_CANVAS::m_camera.

Referenced by EDA_3D_VIEWER_FRAME::SaveSettings().

◆ getRayAtCurrentMousePosition()

RAY EDA_3D_CANVAS::getRayAtCurrentMousePosition ( )
private

Definition at line 1094 of file eda_3d_canvas.cpp.

1095{
1096 SFVEC3F rayOrigin;
1097 SFVEC3F rayDir;
1098
1099 // Generate a ray origin and direction based on current mouser position and camera
1100 m_camera.MakeRayAtCurrentMousePosition( rayOrigin, rayDir );
1101
1102 RAY mouseRay;
1103 mouseRay.Init( rayOrigin, rayDir );
1104
1105 return mouseRay;
1106}
void MakeRayAtCurrentMousePosition(SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on the latest mouse position.
Definition: camera.cpp:403
Definition: ray.h:63
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:35
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

References RAY::Init(), HIDPI_GL_3D_CANVAS::m_camera, and CAMERA::MakeRayAtCurrentMousePosition().

Referenced by move_pivot_based_on_cur_mouse_position(), OnLeftDown(), and OnMouseMove().

◆ GetRenderPivot()

bool EDA_3D_CANVAS::GetRenderPivot ( )
inline

Get a value indicating whether to render the pivot.

Definition at line 172 of file eda_3d_canvas.h.

172{ return m_render_pivot; }

References m_render_pivot.

◆ GetScaleFactor()

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

293{
294 OglGetScreenshot( aDstImage );
295}
void OglGetScreenshot(wxImage &aDstImage)
Get the pixel data of current OpenGL image.
Definition: ogl_utils.cpp:37

References OglGetScreenshot().

Referenced by EDA_3D_VIEWER_FRAME::takeScreenshot().

◆ initializeOpenGL()

bool EDA_3D_CANVAS::initializeOpenGL ( )
private
Returns
true if OpenGL initialization succeeded.

Definition at line 216 of file eda_3d_canvas.cpp.

217{
218 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL" ) );
219
220 const GLenum err = glewInit();
221
222 if( GLEW_OK != err )
223 {
224 const wxString msgError = (const char*) glewGetErrorString( err );
225
226 wxLogMessage( msgError );
227
228 return false;
229 }
230 else
231 {
232 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s" ),
233 FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
234 }
235
236 wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
237
238 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
239 __WXFUNCTION__, version );
240
241 // Extract OpenGL version from string. This method is used because prior to OpenGL 2,
242 // getting the OpenGL major and minor version as integers didn't exist.
243 wxString tmp;
244
245 wxStringTokenizer tokenizer( version );
246
247 if( tokenizer.HasMoreTokens() )
248 {
249 long major = 0;
250 long minor = 0;
251
252 tmp = tokenizer.GetNextToken();
253
254 tokenizer.SetString( tmp, wxString( wxT( "." ) ) );
255
256 if( tokenizer.HasMoreTokens() )
257 tokenizer.GetNextToken().ToLong( &major );
258
259 if( tokenizer.HasMoreTokens() )
260 tokenizer.GetNextToken().ToLong( &minor );
261
262 if( major < 2 || ( ( major == 2 ) && ( minor < 1 ) ) )
263 {
264 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL ray tracing not supported." ),
265 __WXFUNCTION__ );
266
267 if( GetParent() )
268 {
269 wxCommandEvent evt( wxEVT_MENU, ID_DISABLE_RAY_TRACING );
270 GetParent()->ProcessWindowEvent( evt );
271 }
272
274 }
275
276 if( ( major == 1 ) && ( minor < 5 ) )
277 {
278 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL not supported." ),
279 __WXFUNCTION__ );
280
282 }
283 }
284
287
288 return true;
289}
@ ID_DISABLE_RAY_TRACING
Definition: 3d_viewer_id.h:42
static int SetSwapInterval(int aVal)
Attempts to set the OpenGL swap interval.
Definition: gl_utils.h:44
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110

References FROM_UTF8(), ID_DISABLE_RAY_TRACING, m_is_opengl_initialized, m_is_opengl_version_supported, m_logTrace, m_opengl_supports_raytracing, and GL_UTILS::SetSwapInterval().

Referenced by DoRePaint().

◆ IsReloadRequestPending()

bool EDA_3D_CANVAS::IsReloadRequestPending ( ) const
inline

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

92 {
93 if( m_3d_render )
95 else
96 return false;
97 }

References RENDER_3D_BASE::IsReloadRequestPending(), and m_3d_render.

Referenced by EDA_3D_VIEWER_FRAME::OnActivate().

◆ move_pivot_based_on_cur_mouse_position()

void EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position ( )
private

This function hits a ray to the board and start a movement.

Definition at line 892 of file eda_3d_canvas.cpp.

893{
895
896 float hit_t;
897
898 // Test it with the board bounding box
899 if( m_boardAdapter.GetBBox().Intersect( mouseRay, &hit_t ) )
900 {
903 m_camera.SetLookAtPos_T1( mouseRay.at( hit_t ) );
905
907 }
908}
const BBOX_3D & GetBBox() const noexcept
Get the board outling bounding box.
void SetInterpolateMode(CAMERA_INTERPOLATION aInterpolateMode)
Definition: camera.h:228
void ResetXYpos_T1()
Definition: camera.cpp:444
virtual void SetT0_and_T1_current_T()
This will set T0 and T1 with the current values.
Definition: camera.cpp:631
void SetLookAtPos_T1(const SFVEC3F &aLookAtPos)
Definition: camera.h:133
RAY getRayAtCurrentMousePosition()
void request_start_moving_camera(float aMovingSpeed=2.0f, bool aRenderPivot=true)
Start a camera movement.
bool Intersect(const RAY &aRay, float *t) const
Definition: bbox_3d_ray.cpp:46
SFVEC3F at(float t) const
Definition: ray.h:84

References RAY::at(), BEZIER, BOARD_ADAPTER::GetBBox(), getRayAtCurrentMousePosition(), BBOX_3D::Intersect(), m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera, request_start_moving_camera(), CAMERA::ResetXYpos_T1(), CAMERA::SetInterpolateMode(), CAMERA::SetLookAtPos_T1(), and CAMERA::SetT0_and_T1_current_T().

Referenced by OnMiddleUp(), and SetView3D().

◆ OnCloseWindow()

void EDA_3D_CANVAS::OnCloseWindow ( wxCloseEvent &  event)
private

Definition at line 202 of file eda_3d_canvas.cpp.

203{
205
206 event.Skip();
207}

References releaseOpenGL().

◆ OnEraseBackground()

void EDA_3D_CANVAS::OnEraseBackground ( wxEraseEvent &  event)
private

Definition at line 587 of file eda_3d_canvas.cpp.

588{
589 wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnEraseBackground" ) );
590 // Do nothing, to avoid flashing.
591}

References m_logTrace.

◆ OnEvent()

void EDA_3D_CANVAS::OnEvent ( wxEvent &  aEvent)

Used to forward events to the canvas from popups, etc.

Definition at line 576 of file eda_3d_canvas.cpp.

577{
578 if( !m_eventDispatcher )
579 aEvent.Skip();
580 else
582
583 Refresh();
584}
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...

References TOOL_DISPATCHER::DispatchWxEvent(), m_eventDispatcher, and Refresh().

Referenced by EDA_3D_CANVAS().

◆ OnLeftDown()

void EDA_3D_CANVAS::OnLeftDown ( wxMouseEvent &  event)
private

Definition at line 743 of file eda_3d_canvas.cpp.

744{
745 SetFocus();
747
748 if( !event.Dragging() && ( m_3d_render_raytracing != nullptr ) )
749 {
751
752 BOARD_ITEM *intersectedBoardItem = m_3d_render_raytracing->IntersectBoardItem( mouseRay );
753
754 // !TODO: send a selection item to pcbnew, eg: via kiway?
755 }
756}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
void stop_editingTimeOut_Timer()
Stop the editing time so it will not timeout.
BOARD_ITEM * IntersectBoardItem(const RAY &aRay)

References getRayAtCurrentMousePosition(), RENDER_3D_RAYTRACE::IntersectBoardItem(), m_3d_render_raytracing, and stop_editingTimeOut_Timer().

◆ OnLeftUp()

void EDA_3D_CANVAS::OnLeftUp ( wxMouseEvent &  event)
private

◆ OnMiddleDown()

void EDA_3D_CANVAS::OnMiddleDown ( wxMouseEvent &  event)
private

Definition at line 772 of file eda_3d_canvas.cpp.

773{
774 SetFocus();
776}

References stop_editingTimeOut_Timer().

◆ OnMiddleUp()

void EDA_3D_CANVAS::OnMiddleUp ( wxMouseEvent &  event)
private

Definition at line 779 of file eda_3d_canvas.cpp.

780{
782 return;
783
785 {
786 m_mouse_is_moving = false;
788 }
789 else
790 {
792 }
793}
void move_pivot_based_on_cur_mouse_position()
This function hits a ray to the board and start a movement.

References HIDPI_GL_3D_CANVAS::m_camera_is_moving, HIDPI_GL_3D_CANVAS::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 630 of file eda_3d_canvas.cpp.

631{
633 return;
634
635 OnMouseMoveCamera( event );
636
638 {
641 // *Do not* reactivate the timer here during the mouse move command:
642 // OnMiddleUp() will do it at the end of mouse drag/move command
643 }
644
645 if( !event.Dragging() && m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
646 {
649 BOARD_ITEM* rollOverItem = m_3d_render_raytracing->IntersectBoardItem( mouseRay );
650
651 auto printNetInfo =
652 []( BOARD_CONNECTED_ITEM* aItem )
653 {
654 return wxString::Format( _( "Net %s\tNet class %s" ),
655 aItem->GetNet()->GetNetname(),
656 aItem->GetNet()->GetNetClass()->GetName() );
657 };
658
659 if( rollOverItem )
660 {
661 wxString msg;
662
663 if( rollOverItem != m_currentRollOverItem )
664 {
666 m_currentRollOverItem = rollOverItem;
667
669 }
670
671 switch( rollOverItem->Type() )
672 {
673 case PCB_PAD_T:
674 {
675 PAD* pad = static_cast<PAD*>( rollOverItem );
676
677 if( !pad->GetNumber().IsEmpty() )
678 msg += wxString::Format( _( "Pad %s\t" ), pad->GetNumber() );
679
680 if( pad->IsOnCopperLayer() )
681 msg += printNetInfo( pad );
682
683 break;
684 }
685
686 case PCB_FOOTPRINT_T:
687 {
688 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( rollOverItem );
689 msg += footprint->GetReference();
690 break;
691 }
692
693 case PCB_TRACE_T:
694 case PCB_VIA_T:
695 case PCB_ARC_T:
696 {
697 PCB_TRACK* track = static_cast<PCB_TRACK*>( rollOverItem );
698 msg += printNetInfo( track );
699 break;
700 }
701
702 case PCB_ZONE_T:
703 {
704 ZONE* zone = static_cast<ZONE*>( rollOverItem );
705
706 if( !zone->GetZoneName().IsEmpty() )
707 {
708 if( zone->GetIsRuleArea() )
709 msg += wxString::Format( _( "Rule area %s\t" ), zone->GetZoneName() );
710 else
711 msg += wxString::Format( _( "Zone %s\t" ), zone->GetZoneName() );
712 }
713
714 if( zone->IsOnCopperLayer() )
715 msg += printNetInfo( zone );
716
717 break;
718 }
719
720 default:
721 break;
722 }
723
724 reporter.Report( msg );
725 }
726 else
727 {
730 {
733
734 reporter.Report( wxEmptyString );
735 }
736
737 m_currentRollOverItem = nullptr;
738 }
739 }
740}
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
const wxString & GetReference() const
Definition: footprint.h:519
void OnMouseMoveCamera(wxMouseEvent &event)
Definition: pad.h:59
void SetCurrentRollOverItem(BOARD_ITEM *aRollOverItem)
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:697
wxString GetZoneName() const
Definition: zone.h:124
bool IsOnCopperLayer() const override
Definition: zone.cpp:251
@ HOVERED_ITEM
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101

References _, DisplayStatus(), EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS::engine, Format(), ZONE::GetIsRuleArea(), getRayAtCurrentMousePosition(), FOOTPRINT::GetReference(), ZONE::GetZoneName(), HOVERED_ITEM, RENDER_3D_RAYTRACE::IntersectBoardItem(), ZONE::IsOnCopperLayer(), m_3d_render_opengl, m_3d_render_raytracing, m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera_is_moving, BOARD_ADAPTER::m_Cfg, m_currentRollOverItem, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, m_parentStatusBar, EDA_3D_VIEWER_SETTINGS::m_Render, HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), OPENGL, pad, PCB_ARC_T, PCB_FOOTPRINT_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, STATUSBAR_REPORTER::Report(), Request_refresh(), RENDER_3D_OPENGL::SetCurrentRollOverItem(), and EDA_ITEM::Type().

◆ OnMouseMoveCamera()

void HIDPI_GL_3D_CANVAS::OnMouseMoveCamera ( wxMouseEvent &  event)
inherited

Definition at line 43 of file hidpi_gl_3D_canvas.cpp.

44{
46 return;
47
48 const wxSize& nativeWinSize = GetNativePixelSize();
49 const wxPoint& nativePosition = GetNativePosition( event.GetPosition() );
50
51 m_camera.SetCurWindowSize( nativeWinSize );
52
53 if( event.Dragging() )
54 {
55 if( event.LeftIsDown() ) // Drag
56 m_camera.Drag( nativePosition );
57 else if( event.MiddleIsDown() ) // Pan
58 m_camera.Pan( nativePosition );
59
60 m_mouse_is_moving = true;
61 m_mouse_was_moved = true;
62 }
63
64 m_camera.SetCurMousePosition( nativePosition );
65}
virtual void Pan(const wxPoint &aNewMousePosition)=0
virtual void Drag(const wxPoint &aNewMousePosition)=0
Calculate a new mouse drag position.
void SetCurMousePosition(const wxPoint &aPosition)
Update the current mouse position without make any new calculations on camera.
Definition: camera.cpp:495
wxPoint GetNativePosition(const wxPoint &aPoint) const
Convert the given point from client coordinates to native pixel coordinates.

References CAMERA::Drag(), HIDPI_GL_CANVAS::GetNativePixelSize(), HIDPI_GL_CANVAS::GetNativePosition(), HIDPI_GL_3D_CANVAS::m_camera, HIDPI_GL_3D_CANVAS::m_camera_is_moving, HIDPI_GL_3D_CANVAS::m_mouse_is_moving, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, CAMERA::Pan(), CAMERA::SetCurMousePosition(), and CAMERA::SetCurWindowSize().

Referenced by OnMouseMove().

◆ OnMouseWheel()

void EDA_3D_CANVAS::OnMouseWheel ( wxMouseEvent &  event)
private

◆ OnMouseWheelCamera()

void HIDPI_GL_3D_CANVAS::OnMouseWheelCamera ( wxMouseEvent &  event,
bool  aPan 
)
inherited

Definition at line 67 of file hidpi_gl_3D_canvas.cpp.

68{
69 bool mouseActivity = false;
70
72 return;
73
74 float delta_move = m_delta_move_step_factor * m_camera.GetZoom();
75
76 if( aPan )
77 delta_move *= 0.01f * event.GetWheelRotation();
78 else if( event.GetWheelRotation() < 0 )
79 delta_move = -delta_move;
80
81 // mousewheel_panning enabled:
82 // wheel -> pan;
83 // wheel + shift -> horizontal scrolling;
84 // wheel + ctrl -> zooming;
85 // mousewheel_panning disabled:
86 // wheel + shift -> vertical scrolling;
87 // wheel + ctrl -> horizontal scrolling;
88 // wheel -> zooming.
89
90 if( aPan && !event.ControlDown() )
91 {
92 if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
93 m_camera.Pan( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
94 else
95 m_camera.Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
96
97 mouseActivity = true;
98 }
99 else if( event.ShiftDown() && !aPan )
100 {
101 m_camera.Pan( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
102 mouseActivity = true;
103 }
104 else if( event.ControlDown() && !aPan )
105 {
106 m_camera.Pan( SFVEC3F( delta_move, 0.0f, 0.0f ) );
107 mouseActivity = true;
108 }
109 else
110 {
111 mouseActivity = m_camera.Zoom( event.GetWheelRotation() > 0 ? 1.1f : 1 / 1.1f );
112 }
113
114 // If it results on a camera movement
115 if( mouseActivity )
116 {
117 m_mouse_is_moving = true;
118 m_mouse_was_moved = true;
119 }
120
121 // Update the cursor current mouse position on the camera
122 m_camera.SetCurMousePosition( GetNativePosition( event.GetPosition() ) );
123}
bool Zoom(float aFactor)
Definition: camera.cpp:539
static const float m_delta_move_step_factor

References HIDPI_GL_CANVAS::GetNativePosition(), CAMERA::GetZoom(), HIDPI_GL_3D_CANVAS::m_camera, HIDPI_GL_3D_CANVAS::m_camera_is_moving, HIDPI_GL_3D_CANVAS::m_delta_move_step_factor, HIDPI_GL_3D_CANVAS::m_mouse_is_moving, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, CAMERA::Pan(), CAMERA::SetCurMousePosition(), and CAMERA::Zoom().

Referenced by OnMouseWheel().

◆ OnPaint()

void EDA_3D_CANVAS::OnPaint ( wxPaintEvent &  aEvent)
private

Called by a wxPaintEvent event.

Definition at line 341 of file eda_3d_canvas.cpp.

342{
343 // Please have a look at: https://lists.launchpad.net/kicad-developers/msg25149.html
344 DoRePaint();
345}
void DoRePaint()
The actual function to repaint the canvas.

References DoRePaint().

◆ OnRefreshRequest()

void EDA_3D_CANVAS::OnRefreshRequest ( wxEvent &  aEvent)
private

Definition at line 836 of file eda_3d_canvas.cpp.

837{
838 DoRePaint();
839}

References DoRePaint().

◆ OnResize()

void EDA_3D_CANVAS::OnResize ( wxSizeEvent &  event)
private

Definition at line 210 of file eda_3d_canvas.cpp.

211{
213}

References Request_refresh().

◆ OnTimerTimeout_Editing()

void EDA_3D_CANVAS::OnTimerTimeout_Editing ( wxTimerEvent &  event)
private

Definition at line 796 of file eda_3d_canvas.cpp.

797{
798 if( aEvent.GetId() != m_editing_timeout_timer.GetId() )
799 {
800 aEvent.Skip();
801 return;
802 }
803
804 m_mouse_is_moving = false;
805 m_mouse_was_moved = false;
806
808}

References m_editing_timeout_timer, HIDPI_GL_3D_CANVAS::m_mouse_is_moving, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, and Request_refresh().

Referenced by EDA_3D_CANVAS().

◆ OnTimerTimeout_Redraw()

void EDA_3D_CANVAS::OnTimerTimeout_Redraw ( wxTimerEvent &  event)
private

Definition at line 824 of file eda_3d_canvas.cpp.

825{
826 if( aEvent.GetId() != m_redraw_trigger_timer.GetId() )
827 {
828 aEvent.Skip();
829 return;
830 }
831
832 Request_refresh( true );
833}

References m_redraw_trigger_timer, and Request_refresh().

Referenced by EDA_3D_CANVAS().

◆ releaseOpenGL()

void EDA_3D_CANVAS::releaseOpenGL ( )
private

Free created targets and openGL context.

Definition at line 180 of file eda_3d_canvas.cpp.

181{
182 if( m_glRC )
183 {
185
187 m_3d_render_raytracing = nullptr;
188
189 delete m_3d_render_opengl;
190 m_3d_render_opengl = nullptr;
191
192 // This is just a copy of a pointer, can safely be set to NULL.
193 m_3d_render = nullptr;
194
197 m_glRC = nullptr;
198 }
199}
void DestroyCtx(wxGLContext *aContext)
Destroy a managed OpenGL context.

References GL_CONTEXT_MANAGER::DestroyCtx(), GL_CONTEXT_MANAGER::Get(), GL_CONTEXT_MANAGER::LockCtx(), m_3d_render, m_3d_render_opengl, 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 = nullptr,
S3D_CACHE aCachePointer = nullptr 
)

Definition at line 298 of file eda_3d_canvas.cpp.

299{
300 if( aCachePointer != nullptr )
301 m_boardAdapter.Set3dCacheManager( aCachePointer );
302
303 if( aBoard != nullptr )
304 m_boardAdapter.SetBoard( aBoard );
305
306 m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() );
307
308 if( m_3d_render )
310}
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
void ReloadRequest()

References GetSettingsManager(), m_3d_render, m_boardAdapter, Pgm(), RENDER_3D_BASE::ReloadRequest(), BOARD_ADAPTER::Set3dCacheManager(), BOARD_ADAPTER::SetBoard(), and BOARD_ADAPTER::SetColorSettings().

Referenced by EDA_3D_VIEWER_FRAME::ReloadRequest(), PANEL_PREVIEW_3D_MODEL::UpdateDummyFootprint(), and PANEL_PREVIEW_3D_MODEL::View3DUpdate().

◆ render_pivot()

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

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_camera.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 glMatrixMode( GL_PROJECTION );
92 glLoadMatrixf( glm::value_ptr( m_camera.GetProjectionMatrix() ) );
93
94 glMatrixMode( GL_MODELVIEW );
95 glLoadIdentity();
96 glLoadMatrixf( glm::value_ptr( m_camera.GetViewMatrix() ) );
97
98 glEnable( GL_COLOR_MATERIAL );
99 glColor4f( 0.0f, 1.0f, 0.0f, 0.75f - t * 0.75f );
100
101 // Translate to the look at position
102 glTranslatef( lookAtPos.x, lookAtPos.y, lookAtPos.z );
103
104 glScalef( aScale, aScale, aScale );
105 pivot_render_triangles( t * 0.5f );
106
107 t = t * 0.80f;
108 glScalef( 1.0f - t, 1.0f - t, 1.0f - t );
109 glColor4f( 0.0f, 1.0f, 0.0f, 0.8f - t );
110
111 glPushMatrix();
112 glRotatef( t * 90.0f, 0.0f, 0.0f, 1.0f );
113 pivot_render_triangles( t * 0.5f );
114 glPopMatrix();
115
116 glPushMatrix();
117 glRotatef( -t * 90.0f, 0.0f, 0.0f, 1.0f );
118 pivot_render_triangles( t * 0.5f );
119 glPopMatrix();
120}
const glm::mat4 & GetProjectionMatrix() const
Definition: camera.cpp:415
const glm::mat4 & GetViewMatrix() const
Definition: camera.cpp:451
const SFVEC3F & GetLookAtPos_T1() const
Definition: camera.h:138
static void pivot_render_triangles(float t)

References CAMERA::GetLookAtPos_T1(), CAMERA::GetProjectionMatrix(), CAMERA::GetViewMatrix(), HIDPI_GL_3D_CANVAS::m_camera, and pivot_render_triangles().

Referenced by DoRePaint().

◆ RenderEngineChanged()

void EDA_3D_CANVAS::RenderEngineChanged ( )

Notify that the render engine was changed.

Definition at line 1073 of file eda_3d_canvas.cpp.

1074{
1075 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
1077
1078 switch( cfg->m_Render.engine )
1079 {
1082 default: m_3d_render = nullptr; break;
1083 }
1084
1085 if( m_3d_render )
1087
1088 m_mouse_was_moved = false;
1089
1091}
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...

References EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS::engine, SETTINGS_MANAGER::GetAppSettings(), m_3d_render, m_3d_render_opengl, m_3d_render_raytracing, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, EDA_3D_VIEWER_SETTINGS::m_Render, OPENGL, Pgm(), RAYTRACING, RENDER_3D_BASE::ReloadRequest(), and Request_refresh().

Referenced by EDA_3D_VIEWER_FRAME::RenderEngineChanged().

◆ RenderRaytracingRequest()

void EDA_3D_CANVAS::RenderRaytracingRequest ( )

◆ Request_refresh()

void EDA_3D_CANVAS::Request_refresh ( bool  aRedrawImmediately = true)

Schedule a refresh update of the canvas.

Parameters
aRedrawImmediatelytrue will request a redraw, false will schedule a redraw after a short timeout.

Definition at line 842 of file eda_3d_canvas.cpp.

843{
844 if( aRedrawImmediately )
845 {
846 // Just calling Refresh() does not work always
847 // Using an event to call DoRepaint ensure the repaint code will be executed,
848 // and PostEvent will take priority to other events like mouse movements, keys, etc.
849 // and is executed during the next idle time
850 wxCommandEvent redrawEvent( wxEVT_REFRESH_CUSTOM_COMMAND, ID_CUSTOM_EVENT_1 );
851 wxPostEvent( this, redrawEvent );
852 }
853 else
854 {
855 // Schedule a timed redraw
856 m_redraw_trigger_timer.Start( 10 , wxTIMER_ONE_SHOT );
857 }
858}
@ ID_CUSTOM_EVENT_1
Definition: 3d_viewer_id.h:44

References ID_CUSTOM_EVENT_1, and m_redraw_trigger_timer.

Referenced by EDA_3D_VIEWER_FRAME::applyViewport(), DoRePaint(), EDA_3D_CONTROLLER::On3DGridSelection(), EDA_3D_VIEWER_FRAME::OnActivate(), OnMouseMove(), OnMouseWheel(), OnResize(), OnTimerTimeout_Editing(), OnTimerTimeout_Redraw(), EDA_3D_VIEWER_FRAME::Redraw(), EDA_3D_VIEWER_FRAME::refreshRender(), RenderEngineChanged(), RenderRaytracingRequest(), request_start_moving_camera(), EDA_3D_CONTROLLER::RotateView(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), EDA_3D_CONTROLLER::SetMaterial(), NL_3D_VIEWER_PLUGIN_IMPL::SetPivotPosition(), NL_3D_VIEWER_PLUGIN_IMPL::SetPivotVisible(), NL_3D_VIEWER_PLUGIN_IMPL::SetTransaction(), SetView3D(), EDA_3D_VIEWER_FRAME::takeScreenshot(), EDA_3D_CONTROLLER::ToggleOrtho(), EDA_3D_CONTROLLER::ToggleVisibility(), PANEL_PREVIEW_3D_MODEL::UpdateDummyFootprint(), and EDA_3D_CONTROLLER::ZoomRedraw().

◆ request_start_moving_camera()

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

Start a camera movement.

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

Definition at line 861 of file eda_3d_canvas.cpp.

862{
863 wxASSERT( aMovingSpeed > FLT_EPSILON );
864
865 // Fast forward the animation if the animation is disabled
867 {
868 m_camera.Interpolate( 1.0f );
871 return;
872 }
873
874 // Map speed multiplier option to actual multiplier value
875 // [1,2,3,4,5] -> [0.25, 0.5, 1, 2, 4]
876 aMovingSpeed *= ( 1 << m_moving_speed_multiplier ) / 8.0f;
877
878 m_render_pivot = aRenderPivot;
879 m_camera_moving_speed = aMovingSpeed;
880
882
885
886 m_camera_is_moving = true;
887
889}

References DisplayStatus(), GetRunningMicroSecs(), CAMERA::Interpolate(), m_animation_enabled, HIDPI_GL_3D_CANVAS::m_camera, HIDPI_GL_3D_CANVAS::m_camera_is_moving, m_camera_moving_speed, m_moving_speed_multiplier, 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

Reset the editing timer.

Definition at line 817 of file eda_3d_canvas.cpp.

818{
819 if( m_3d_render )
821}
virtual int GetWaitForEditingTimeOut()=0
Give the interface the time (in ms) that it should wait for editing or movements before (this works f...

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

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

◆ SetAnimationEnabled()

void EDA_3D_CANVAS::SetAnimationEnabled ( bool  aEnable)
inline

Enable or disable camera animation when switching to a pre-defined view.

Definition at line 127 of file eda_3d_canvas.h.

127{ m_animation_enabled = aEnable; }

References m_animation_enabled.

Referenced by PANEL_PREVIEW_3D_MODEL::loadSettings(), and EDA_3D_VIEWER_FRAME::LoadSettings().

◆ SetEventDispatcher()

void EDA_3D_CANVAS::SetEventDispatcher ( TOOL_DISPATCHER aEventDispatcher)

Set a dispatcher that processes events and forwards them to tools.

#DRAW_PANEL_GAL does not take over the ownership. Passing NULL disconnects all event handlers from the DRAW_PANEL_GAL and parent frame.

Parameters
aEventDispatcheris the object that will be used for dispatching events.

Definition at line 570 of file eda_3d_canvas.cpp.

571{
572 m_eventDispatcher = aEventDispatcher;
573}

References m_eventDispatcher.

Referenced by PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), and EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME().

◆ SetInfoBar()

void EDA_3D_CANVAS::SetInfoBar ( WX_INFOBAR aInfoBar)
inline

Definition at line 79 of file eda_3d_canvas.h.

80 {
81 m_parentInfoBar = aInfoBar;
82 }

References m_parentInfoBar.

Referenced by PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL().

◆ SetMovingSpeedMultiplier()

void EDA_3D_CANVAS::SetMovingSpeedMultiplier ( int  aMultiplier)
inline

Set the camera animation moving speed multiplier option.

Parameters
aMultiplierone of the possible integer options: [1,2,3,4,5].

Definition at line 135 of file eda_3d_canvas.h.

135{ m_moving_speed_multiplier = aMultiplier; }

References m_moving_speed_multiplier.

Referenced by PANEL_PREVIEW_3D_MODEL::loadSettings(), and EDA_3D_VIEWER_FRAME::LoadSettings().

◆ SetProjectionMode()

void EDA_3D_CANVAS::SetProjectionMode ( int  aMode)
inline

Definition at line 139 of file eda_3d_canvas.h.

PROJECTION_TYPE
Definition: camera.h:38
void SetProjection(PROJECTION_TYPE aProjection)
Definition: camera.h:177

References HIDPI_GL_3D_CANVAS::m_camera, and CAMERA::SetProjection().

Referenced by PANEL_PREVIEW_3D_MODEL::loadSettings(), and EDA_3D_VIEWER_FRAME::LoadSettings().

◆ SetRenderPivot()

void EDA_3D_CANVAS::SetRenderPivot ( bool  aValue)
inline

Set aValue indicating whether to render the pivot.

Parameters
aValuetrue will cause the pivot to be rendered on the next redraw.

Definition at line 179 of file eda_3d_canvas.h.

179{ m_render_pivot = aValue; }

References m_render_pivot.

◆ SetScaleFactor()

void HIDPI_GL_CANVAS::SetScaleFactor ( double  aFactor)
inherited

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

Definition at line 65 of file hidpi_gl_canvas.cpp.

66{
67 m_scale_factor = aNewScaleFactor;
68}

References HIDPI_GL_CANVAS::m_scale_factor.

Referenced by EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER(), EDA_3D_VIEWER_FRAME::loadCommonSettings(), PANEL_PREVIEW_3D_MODEL::loadSettings(), and KIGFX::OPENGL_GAL::updatedGalDisplayOptions().

◆ SetStatusBar()

void EDA_3D_CANVAS::SetStatusBar ( wxStatusBar *  aStatusBar)
inline

Definition at line 74 of file eda_3d_canvas.h.

75 {
76 m_parentStatusBar = aStatusBar;
77 }

References m_parentStatusBar.

◆ SetView3D()

bool EDA_3D_CANVAS::SetView3D ( int  aKeycode)

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

912{
914 return false;
915
916 const float delta_move = m_delta_move_step_factor * m_camera.GetZoom();
917 const float arrow_moving_time_speed = 8.0f;
918 bool handled = false;
919
920 switch( aKeycode )
921 {
922 case WXK_SPACE:
924 return true;
925
926 case WXK_LEFT:
929 m_camera.Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
930 request_start_moving_camera( arrow_moving_time_speed, false );
931 return true;
932
933 case WXK_RIGHT:
936 m_camera.Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
937 request_start_moving_camera( arrow_moving_time_speed, false );
938 return true;
939
940 case WXK_UP:
943 m_camera.Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
944 request_start_moving_camera( arrow_moving_time_speed, false );
945 return true;
946
947 case WXK_DOWN:
950 m_camera.Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
951 request_start_moving_camera( arrow_moving_time_speed, false );
952 return true;
953
954 case WXK_HOME:
958 request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 1 / 1.26f ), 1.26f ) );
959 return true;
960
961 case WXK_END:
962 break;
963
964 case WXK_TAB:
967 m_camera.RotateZ_T1( glm::radians( 45.0f ) );
969 handled = true;
970 break;
971
972 case WXK_F1:
975
976 if( m_camera.Zoom_T1( 1.26f ) ) // 3 steps per doubling
978
979 return true;
980
981 case WXK_F2:
984
985 if( m_camera.Zoom_T1( 1/1.26f ) ) // 3 steps per halving
987
988 return true;
989
990 case ID_VIEW3D_RESET:
994 request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
995 return true;
996
997 case ID_VIEW3D_RIGHT:
1001 m_camera.RotateZ_T1( glm::radians( -90.0f ) );
1002 m_camera.RotateX_T1( glm::radians( -90.0f ) );
1004 return true;
1005
1006 case ID_VIEW3D_LEFT:
1010 m_camera.RotateZ_T1( glm::radians( 90.0f ) );
1011 m_camera.RotateX_T1( glm::radians( -90.0f ) );
1013 return true;
1014
1015 case ID_VIEW3D_FRONT:
1019 m_camera.RotateX_T1( glm::radians( -90.0f ) );
1021 return true;
1022
1023 case ID_VIEW3D_BACK:
1027 m_camera.RotateX_T1( glm::radians( -90.0f ) );
1028
1029 // The rotation angle should be 180.
1030 // We use 179.999 (180 - epsilon) to avoid a full 360 deg rotation when
1031 // using 180 deg if the previous rotated position was already 180 deg
1032 m_camera.RotateZ_T1( glm::radians( 179.999f ) );
1034 return true;
1035
1036 case ID_VIEW3D_TOP:
1040 request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
1041 return true;
1042
1043 case ID_VIEW3D_BOTTOM:
1047 m_camera.RotateY_T1( glm::radians( 179.999f ) ); // Rotation = 180 - epsilon
1048 request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
1049 return true;
1050
1051 case ID_VIEW3D_FLIP:
1054 m_camera.RotateY_T1( glm::radians( 179.999f ) );
1056 return true;
1057
1058 default:
1059 return false;
1060 }
1061
1062 m_mouse_was_moved = true;
1063
1065
1066 DisplayStatus();
1068
1069 return handled;
1070}
@ ID_VIEW3D_BACK
Definition: 3d_viewer_id.h:26
@ ID_VIEW3D_RESET
Definition: 3d_viewer_id.h:27
@ ID_VIEW3D_RIGHT
Definition: 3d_viewer_id.h:24
@ ID_VIEW3D_FRONT
Definition: 3d_viewer_id.h:25
@ ID_VIEW3D_TOP
Definition: 3d_viewer_id.h:21
@ ID_VIEW3D_LEFT
Definition: 3d_viewer_id.h:23
@ ID_VIEW3D_FLIP
Definition: 3d_viewer_id.h:28
@ ID_VIEW3D_BOTTOM
Definition: 3d_viewer_id.h:22
void RotateY_T1(float aAngleInRadians)
Definition: camera.cpp:619
bool Zoom_T1(float aFactor)
Definition: camera.cpp:570
virtual void Reset_T1()
Definition: camera.cpp:103
virtual void Pan_T1(const SFVEC3F &aDeltaOffsetInc)=0
void RotateX_T1(float aAngleInRadians)
Definition: camera.cpp:613
void RotateZ_T1(float aAngleInRadians)
Definition: camera.cpp:625

References BEZIER, DisplayStatus(), EASING_IN_OUT, CAMERA::GetZoom(), ID_VIEW3D_BACK, ID_VIEW3D_BOTTOM, ID_VIEW3D_FLIP, ID_VIEW3D_FRONT, ID_VIEW3D_LEFT, ID_VIEW3D_RESET, ID_VIEW3D_RIGHT, ID_VIEW3D_TOP, LINEAR, HIDPI_GL_3D_CANVAS::m_camera, HIDPI_GL_3D_CANVAS::m_camera_is_moving, HIDPI_GL_3D_CANVAS::m_delta_move_step_factor, HIDPI_GL_3D_CANVAS::m_mouse_was_moved, move_pivot_based_on_cur_mouse_position(), CAMERA::Pan_T1(), Request_refresh(), request_start_moving_camera(), CAMERA::Reset_T1(), restart_editingTimeOut_Timer(), CAMERA::RotateX_T1(), CAMERA::RotateY_T1(), CAMERA::RotateZ_T1(), CAMERA::SetInterpolateMode(), CAMERA::SetT0_and_T1_current_T(), and CAMERA::Zoom_T1().

Referenced by EDA_3D_CONTROLLER::doZoomInOut(), EDA_3D_CONTROLLER::PanControl(), PANEL_PREVIEW_3D_MODEL::View3DBack(), PANEL_PREVIEW_3D_MODEL::View3DBottom(), PANEL_PREVIEW_3D_MODEL::View3DFront(), PANEL_PREVIEW_3D_MODEL::View3DLeft(), PANEL_PREVIEW_3D_MODEL::View3DRight(), PANEL_PREVIEW_3D_MODEL::View3DTop(), EDA_3D_CONTROLLER::ViewControl(), and EDA_3D_CONTROLLER::ZoomFitScreen().

◆ stop_editingTimeOut_Timer()

void EDA_3D_CANVAS::stop_editingTimeOut_Timer ( )
private

Stop the editing time so it will not timeout.

Definition at line 811 of file eda_3d_canvas.cpp.

812{
814}

References m_editing_timeout_timer.

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

Member Data Documentation

◆ m_3d_render

◆ m_3d_render_opengl

RENDER_3D_OPENGL* EDA_3D_CANVAS::m_3d_render_opengl
private

Definition at line 325 of file eda_3d_canvas.h.

Referenced by DoRePaint(), OnMouseMove(), releaseOpenGL(), and RenderEngineChanged().

◆ m_3d_render_raytracing

RENDER_3D_RAYTRACE* EDA_3D_CANVAS::m_3d_render_raytracing
private

◆ m_accelerator3DShapes

ACCELERATOR_3D* EDA_3D_CANVAS::m_accelerator3DShapes
private

Definition at line 330 of file eda_3d_canvas.h.

Referenced by ~EDA_3D_CANVAS().

◆ m_animation_enabled

bool EDA_3D_CANVAS::m_animation_enabled
private

◆ m_boardAdapter

BOARD_ADAPTER& EDA_3D_CANVAS::m_boardAdapter
private

◆ m_camera

◆ m_camera_is_moving

◆ m_camera_moving_speed

float EDA_3D_CANVAS::m_camera_moving_speed
private

Definition at line 317 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and request_start_moving_camera().

◆ m_currentRollOverItem

BOARD_ITEM* EDA_3D_CANVAS::m_currentRollOverItem
private

Definition at line 332 of file eda_3d_canvas.h.

Referenced by OnMouseMove().

◆ m_delta_move_step_factor

const float HIDPI_GL_3D_CANVAS::m_delta_move_step_factor = 0.7f
staticinherited

Definition at line 60 of file hidpi_gl_3D_canvas.h.

Referenced by HIDPI_GL_3D_CANVAS::OnMouseWheelCamera(), and SetView3D().

◆ m_editing_timeout_timer

wxTimer EDA_3D_CANVAS::m_editing_timeout_timer
private

◆ m_eventDispatcher

TOOL_DISPATCHER* EDA_3D_CANVAS::m_eventDispatcher
private

Definition at line 303 of file eda_3d_canvas.h.

Referenced by OnEvent(), and SetEventDispatcher().

◆ m_glRC

wxGLContext* EDA_3D_CANVAS::m_glRC
private

Definition at line 307 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and releaseOpenGL().

◆ m_is_currently_painting

std::atomic_flag EDA_3D_CANVAS::m_is_currently_painting
private

Definition at line 314 of file eda_3d_canvas.h.

Referenced by DoRePaint().

◆ m_is_opengl_initialized

bool EDA_3D_CANVAS::m_is_opengl_initialized
private

Definition at line 308 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and initializeOpenGL().

◆ m_is_opengl_version_supported

bool EDA_3D_CANVAS::m_is_opengl_version_supported
private

Definition at line 309 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and initializeOpenGL().

◆ m_mouse_is_moving

bool HIDPI_GL_3D_CANVAS::m_mouse_is_moving
inherited

◆ m_mouse_was_moved

◆ m_moving_speed_multiplier

int EDA_3D_CANVAS::m_moving_speed_multiplier
private

◆ m_opengl_supports_raytracing

bool EDA_3D_CANVAS::m_opengl_supports_raytracing
private

Definition at line 327 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and initializeOpenGL().

◆ m_parentInfoBar

WX_INFOBAR* EDA_3D_CANVAS::m_parentInfoBar
private

Definition at line 305 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and SetInfoBar().

◆ m_parentStatusBar

wxStatusBar* EDA_3D_CANVAS::m_parentStatusBar
private

Definition at line 304 of file eda_3d_canvas.h.

Referenced by DisplayStatus(), DoRePaint(), OnMouseMove(), and SetStatusBar().

◆ m_redraw_trigger_timer

wxTimer EDA_3D_CANVAS::m_redraw_trigger_timer
private

Definition at line 313 of file eda_3d_canvas.h.

Referenced by OnTimerTimeout_Redraw(), and Request_refresh().

◆ m_render_pivot

bool EDA_3D_CANVAS::m_render_pivot
private

◆ m_render_raytracing_was_requested

bool EDA_3D_CANVAS::m_render_raytracing_was_requested
private

Definition at line 328 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and RenderRaytracingRequest().

◆ m_scale_factor

double HIDPI_GL_CANVAS::m_scale_factor
privateinherited

The current scale factor (e.g.

for hi-DPI displays)

Definition at line 68 of file hidpi_gl_canvas.h.

Referenced by HIDPI_GL_CANVAS::GetScaleFactor(), and HIDPI_GL_CANVAS::SetScaleFactor().

◆ m_strtime_camera_movement

unsigned EDA_3D_CANVAS::m_strtime_camera_movement
private

Definition at line 318 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and request_start_moving_camera().


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