KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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

Classes

struct  MODEL_HIT
 
struct  OVERLAY
 A translucent triangle soup drawn over the scene. More...
 

Public Member Functions

 EDA_3D_CANVAS (wxWindow *aParent, const wxGLAttributes &aGLAttribs, BOARD_ADAPTER &aSettings, CAMERA &aCamera, S3D_CACHE *a3DCachePointer)
 Create a new 3D Canvas with an attribute list.
 
 ~EDA_3D_CANVAS () override
 
void SetEventDispatcher (TOOL_DISPATCHER *aEventDispatcher)
 Set a dispatcher that processes events and forwards them to tools.
 
void SetStatusBar (wxStatusBar *aStatusBar)
 
void SetInfoBar (WX_INFOBAR *aInfoBar)
 
void SetPickHandler (std::function< bool(const RAY &)> aHandler)
 Consume plain canvas clicks before the normal selection handler.
 
void SetHoverHandler (std::function< void(const std::optional< RAY > &)> aHandler)
 Report the mouse position while a pick handler is installed.
 
void SetOverlays (std::vector< OVERLAY > aOverlays)
 
std::optional< MODEL_HIT > PickModel (const RAY &aRay, const S3DMODEL &aGeometry, const FP_3DMODEL &aModel, const FOOTPRINT &aFootprint) const
 Pick current mesh geometry; independent of the renderer's cached hit-test scene.
 
PAD * PickFootprintPad (const RAY &aRay, const FOOTPRINT &aFootprint) const
 Project onto the footprint's seating plane and hit-test copper pads.
 
void ReloadRequest (BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
 
void ReloadRaytracingForHitTesting (std::stop_token aStop)
 Rebuild the auxiliary raytracing BVH used for hover hit-testing in OpenGL mode.
 
void InvalidateRaytracingHitTesting ()
 Invalidate the hover hit-test BVH before board layers are rebuilt.
 
bool IsReloadRequestPending () const
 Query if there is a pending reload request.
 
RENDER_3D_BASE * GetCurrentRender () const
 
void RenderRaytracingRequest ()
 Request to render the current view in Raytracing mode.
 
void GetScreenshot (wxImage &aDstImage)
 Request a screenshot and output it to the aDstImage.
 
void JoinBgWorker ()
 Block until any in-progress OpenGL background loading has finished.
 
bool SetView3D (VIEW3D_TYPE aRequestedView)
 Select a specific 3D view or operation.
 
void SetAnimationEnabled (bool aEnable)
 Enable or disable camera animation when switching to a pre-defined view.
 
bool GetAnimationEnabled () const
 
void SetMovingSpeedMultiplier (int aMultiplier)
 Set the camera animation moving speed multiplier option.
 
int GetMovingSpeedMultiplier () const
 
int GetProjectionMode () const
 
void SetProjectionMode (int aMode)
 
void RenderEngineChanged ()
 Notify that the render engine was changed.
 
void DisplayStatus ()
 Update the status bar with the position information.
 
void Request_refresh (bool aRedrawImmediately=true)
 Schedule a refresh update of the canvas.
 
void OnEvent (wxEvent &aEvent)
 Used to forward events to the canvas from popups, etc.
 
const BOARD_ADAPTER & GetBoardAdapter () const
 Get information used to display 3D board.
 
bool GetRenderPivot ()
 Get a value indicating whether to render the pivot.
 
void SetRenderPivot (bool aValue)
 Set aValue indicating whether to render the pivot.
 
bool GetRender3dmousePivot ()
 Get a value indicating whether to render the 3dmouse pivot.
 
void SetRender3dmousePivot (bool aValue)
 Set aValue indicating whether to render the 3dmouse pivot.
 
void Set3dmousePivotPos (const SFVEC3F &aPos)
 Set the position of the the 3dmouse pivot.
 
void DoRePaint ()
 The actual function to repaint the canvas.
 
void RenderToFrameBuffer (unsigned char *aBuffer, int aWidth, int aHeight)
 
void OnCloseWindow (wxCloseEvent &event)
 
CAMERA * GetCamera ()
 Get the canvas camera.
 
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.
 
double GetScaleFactor () const
 Get the current scale factor.
 
void SetVcSettings (const KIGFX::VC_SETTINGS &aVcSettings)
 

Public Attributes

bool m_mouse_is_moving
 
bool m_mouse_was_moved
 
bool m_camera_is_moving
 
CAMERA & m_camera
 

Static Public Attributes

static const float m_delta_move_step_factor = 0.7f
 

Protected Attributes

KIGFX::VC_SETTINGS m_settings
 Current VIEW_CONTROLS settings.
 

Private Member Functions

void OnPaint (wxPaintEvent &aEvent)
 
void OnEraseBackground (wxEraseEvent &event)
 
void OnRefreshRequest (wxEvent &aEvent)
 
void OnMouseWheel (wxMouseEvent &event)
 
void OnMagnify (wxMouseEvent &event)
 
void OnMouseMove (wxMouseEvent &event)
 
void OnMouseLeave (wxMouseEvent &event)
 
void OnLeftDown (wxMouseEvent &event)
 
void OnLeftUp (wxMouseEvent &event)
 
void OnMiddleUp (wxMouseEvent &event)
 
void OnMiddleDown (wxMouseEvent &event)
 
void OnRightUp (wxMouseEvent &event)
 
void OnRightDown (wxMouseEvent &event)
 
void OnTimerTimeout_Editing (wxTimerEvent &event)
 
void OnResize (wxSizeEvent &event)
 
void OnTimerTimeout_Redraw (wxTimerEvent &event)
 
void OnZoomGesture (wxZoomGestureEvent &event)
 
void OnPanGesture (wxPanGestureEvent &event)
 
void OnRotateGesture (wxRotateGestureEvent &event)
 
void stop_editingTimeOut_Timer ()
 Stop the editing time so it will not timeout.
 
void restart_editingTimeOut_Timer ()
 Reset the editing timer.
 
void request_start_moving_camera (float aMovingSpeed=2.0f, bool aRenderPivot=true)
 Start a camera movement.
 
void move_pivot_based_on_cur_mouse_position ()
 This function hits a ray to the board and start a movement.
 
void render_pivot (float t, float aScale)
 Render the pivot cursor.
 
void render3dmousePivot (float aScale)
 Render the 3dmouse pivot cursor.
 
void render_overlays ()
 Draw the translucent overlays over the rendered scene.
 
bool initializeOpenGL ()
 
void releaseOpenGL ()
 Free created targets and openGL context.
 
RAY getRayAtCurrentMousePosition ()
 

Private Attributes

std::function< bool(const RAY &)> m_pickHandler
 
std::function< void(const std::optional< RAY > &)> m_hoverHandler
 
std::vector< OVERLAY > m_overlays
 
TOOL_DISPATCHER * m_eventDispatcher = nullptr
 
wxStatusBar * m_parentStatusBar = nullptr
 
WX_INFOBAR * m_parentInfoBar = nullptr
 
std::unique_ptr< STATUSBAR_REPORTER > m_statusBarReporter
 
std::unique_ptr< INFOBAR_REPORTER > m_infoBarReporter
 
std::shared_ptr< SYNC_REPORTER > m_activityReporterSync
 
std::shared_ptr< SYNC_REPORTER > m_warningReporterSync
 
wxGLContext * m_glRC = nullptr
 
bool m_is_opengl_initialized = false
 
bool m_is_opengl_version_supported = true
 
wxTimer m_editing_timeout_timer
 
wxTimer m_redraw_trigger_timer
 
std::atomic_flag m_is_currently_painting = ATOMIC_FLAG_INIT
 
bool m_render_pivot = false
 
float m_camera_moving_speed = 1.0f
 
int64_t m_strtime_camera_movement = 0
 
bool m_animation_enabled = true
 
int m_moving_speed_multiplier = 3
 
BOARD_ADAPTER & m_boardAdapter
 
RENDER_3D_BASE * m_3d_render = nullptr
 Non-owning pointer to the active renderer (one of the two below).
 
std::unique_ptr< RENDER_3D_RAYTRACE_GL > m_3d_render_raytracing
 
std::unique_ptr< RENDER_3D_OPENGL > m_3d_render_opengl
 
bool m_opengl_supports_raytracing = true
 
bool m_render_raytracing_was_requested = false
 
ACCELERATOR_3D * m_accelerator3DShapes = nullptr
 
BOARD_ITEM * m_currentRollOverItem = nullptr
 
bool m_render3dmousePivot = false
 
SFVEC3F m_3dmousePivotPos
 
double m_gestureLastZoomFactor = 1.0
 Used to track gesture events.
 
double m_gestureLastAngle = 0.0
 

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.
 

Detailed Description

Implement a canvas based on a wxGLCanvas.

Definition at line 59 of file eda_3d_canvas.h.

Constructor & Destructor Documentation

◆ EDA_3D_CANVAS()

EDA_3D_CANVAS::EDA_3D_CANVAS ( wxWindow * aParent,
const wxGLAttributes & aGLAttribs,
BOARD_ADAPTER & aSettings,
CAMERA & aCamera,
S3D_CACHE * a3DCachePointer )

Create a new 3D Canvas with an attribute list.

Parameters
aParentthe parent creator of this canvas.
aGLAttribsopenGL attributes created by OGL_ATT_LIST::GetAttributesList.
aSettingsthe settings options to be used by this canvas.
aCamerais the CAMERA settings.
a3DCachePointeris a pointer to the 3D cache.

Definition at line 118 of file eda_3d_canvas.cpp.

References EDA_3D_CANVAS(), EDA_3D_CANVAS_ID, HIDPI_GL_3D_CANVAS::HIDPI_GL_3D_CANVAS(), m_3d_render, m_3d_render_opengl, m_3d_render_raytracing, m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera, m_editing_timeout_timer, m_eventDispatcher, m_is_currently_painting, m_logTrace, m_redraw_trigger_timer, OnEvent(), OnTimerTimeout_Editing(), and OnTimerTimeout_Redraw().

Referenced by EDA_3D_CANVAS().

◆ ~EDA_3D_CANVAS()

EDA_3D_CANVAS::~EDA_3D_CANVAS ( )
override

Member Function Documentation

◆ DisplayStatus()

void EDA_3D_CANVAS::DisplayStatus ( )

Update the status bar with the position information.

Definition at line 396 of file eda_3d_canvas.cpp.

References HIDPI_GL_3D_CANVAS::m_camera, m_parentStatusBar, X_POS, Y_POS, and ZOOM_LEVEL.

Referenced by DoRePaint(), OnMagnify(), OnMouseMove(), OnMouseWheel(), OnPanGesture(), OnRotateGesture(), OnZoomGesture(), and request_start_moving_camera().

◆ DoRePaint()

◆ GetAnimationEnabled()

bool EDA_3D_CANVAS::GetAnimationEnabled ( ) const
inline

Definition at line 201 of file eda_3d_canvas.h.

References m_animation_enabled.

◆ GetBoardAdapter()

const BOARD_ADAPTER & EDA_3D_CANVAS::GetBoardAdapter ( ) const
inline

Get information used to display 3D board.

Definition at line 240 of file eda_3d_canvas.h.

References m_boardAdapter.

Referenced by NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::GetModelExtents().

◆ GetCamera()

CAMERA * HIDPI_GL_3D_CANVAS::GetCamera ( )
inlineinherited

Get the canvas camera.

Definition at line 58 of file hidpi_gl_3D_canvas.h.

References m_camera.

Referenced by SPNAV_VIEWER_PLUGIN::SPNAV_VIEWER_PLUGIN().

◆ GetCurrentRender()

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

Definition at line 170 of file eda_3d_canvas.h.

References m_3d_render.

◆ GetMovingSpeedMultiplier()

int EDA_3D_CANVAS::GetMovingSpeedMultiplier ( ) const
inline

Definition at line 209 of file eda_3d_canvas.h.

References m_moving_speed_multiplier.

◆ GetNativePixelSize()

wxSize HIDPI_GL_CANVAS::GetNativePixelSize ( ) const
virtualinherited

◆ GetNativePosition()

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

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

Definition at line 50 of file hidpi_gl_canvas.cpp.

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

References HIDPI_GL_3D_CANVAS::m_camera.

◆ getRayAtCurrentMousePosition()

RAY EDA_3D_CANVAS::getRayAtCurrentMousePosition ( )
private

◆ GetRender3dmousePivot()

bool EDA_3D_CANVAS::GetRender3dmousePivot ( )
inline

Get a value indicating whether to render the 3dmouse pivot.

Definition at line 257 of file eda_3d_canvas.h.

References m_render3dmousePivot.

◆ GetRenderPivot()

bool EDA_3D_CANVAS::GetRenderPivot ( )
inline

Get a value indicating whether to render the pivot.

Definition at line 245 of file eda_3d_canvas.h.

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

References OglGetScreenshot().

◆ initializeOpenGL()

bool EDA_3D_CANVAS::initializeOpenGL ( )
private

◆ InvalidateRaytracingHitTesting()

void EDA_3D_CANVAS::InvalidateRaytracingHitTesting ( )

Invalidate the hover hit-test BVH before board layers are rebuilt.

Definition at line 376 of file eda_3d_canvas.cpp.

References m_3d_render_raytracing.

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

References m_3d_render.

◆ JoinBgWorker()

void EDA_3D_CANVAS::JoinBgWorker ( )

Block until any in-progress OpenGL background loading has finished.

Definition at line 344 of file eda_3d_canvas.cpp.

References m_3d_render.

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

References RAY::at(), BEZIER, getRayAtCurrentMousePosition(), m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera, and request_start_moving_camera().

Referenced by OnMiddleUp(), and SetView3D().

◆ OnCloseWindow()

void EDA_3D_CANVAS::OnCloseWindow ( wxCloseEvent & event)

Definition at line 240 of file eda_3d_canvas.cpp.

References releaseOpenGL().

Referenced by wxDEFINE_EVENT().

◆ OnEraseBackground()

void EDA_3D_CANVAS::OnEraseBackground ( wxEraseEvent & event)
private

Definition at line 906 of file eda_3d_canvas.cpp.

References m_logTrace.

Referenced by wxDEFINE_EVENT().

◆ OnEvent()

void EDA_3D_CANVAS::OnEvent ( wxEvent & aEvent)

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

Definition at line 895 of file eda_3d_canvas.cpp.

References m_eventDispatcher.

Referenced by EDA_3D_CANVAS().

◆ OnLeftDown()

void EDA_3D_CANVAS::OnLeftDown ( wxMouseEvent & event)
private

◆ OnLeftUp()

◆ OnMagnify()

void EDA_3D_CANVAS::OnMagnify ( wxMouseEvent & event)
private

◆ OnMiddleDown()

void EDA_3D_CANVAS::OnMiddleDown ( wxMouseEvent & event)
private

Definition at line 1284 of file eda_3d_canvas.cpp.

References stop_editingTimeOut_Timer().

Referenced by wxDEFINE_EVENT().

◆ OnMiddleUp()

void EDA_3D_CANVAS::OnMiddleUp ( wxMouseEvent & event)
private

◆ OnMouseLeave()

void EDA_3D_CANVAS::OnMouseLeave ( wxMouseEvent & event)
private

Definition at line 1140 of file eda_3d_canvas.cpp.

References m_hoverHandler.

Referenced by wxDEFINE_EVENT().

◆ OnMouseMove()

◆ OnMouseMoveCamera()

◆ OnMouseWheel()

void EDA_3D_CANVAS::OnMouseWheel ( wxMouseEvent & event)
private

◆ OnMouseWheelCamera()

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

◆ OnPaint()

void EDA_3D_CANVAS::OnPaint ( wxPaintEvent & aEvent)
private

Definition at line 415 of file eda_3d_canvas.cpp.

References DoRePaint().

Referenced by wxDEFINE_EVENT().

◆ OnPanGesture()

void EDA_3D_CANVAS::OnPanGesture ( wxPanGestureEvent & event)
private

◆ OnRefreshRequest()

void EDA_3D_CANVAS::OnRefreshRequest ( wxEvent & aEvent)
private

Definition at line 1348 of file eda_3d_canvas.cpp.

Referenced by wxDEFINE_EVENT().

◆ OnResize()

void EDA_3D_CANVAS::OnResize ( wxSizeEvent & event)
private

Definition at line 248 of file eda_3d_canvas.cpp.

References Request_refresh().

Referenced by wxDEFINE_EVENT().

◆ OnRightDown()

void EDA_3D_CANVAS::OnRightDown ( wxMouseEvent & event)
private

◆ OnRightUp()

void EDA_3D_CANVAS::OnRightUp ( wxMouseEvent & event)
private

◆ OnRotateGesture()

void EDA_3D_CANVAS::OnRotateGesture ( wxRotateGestureEvent & event)
private

◆ OnTimerTimeout_Editing()

void EDA_3D_CANVAS::OnTimerTimeout_Editing ( wxTimerEvent & event)
private

◆ OnTimerTimeout_Redraw()

void EDA_3D_CANVAS::OnTimerTimeout_Redraw ( wxTimerEvent & event)
private

Definition at line 1336 of file eda_3d_canvas.cpp.

References m_redraw_trigger_timer, and Request_refresh().

Referenced by EDA_3D_CANVAS().

◆ OnZoomGesture()

void EDA_3D_CANVAS::OnZoomGesture ( wxZoomGestureEvent & event)
private

◆ PickFootprintPad()

PAD * EDA_3D_CANVAS::PickFootprintPad ( const RAY & aRay,
const FOOTPRINT & aFootprint ) const

Project onto the footprint's seating plane and hit-test copper pads.

Definition at line 1649 of file eda_3d_canvas.cpp.

References std::abs(), B_Cu, distance(), F_Cu, FOOTPRINT::IsFlipped(), KiROUND(), m_boardAdapter, RAY::m_Dir, RAY::m_Origin, pad, and FOOTPRINT::Pads().

◆ PickModel()

std::optional< EDA_3D_CANVAS::MODEL_HIT > EDA_3D_CANVAS::PickModel ( const RAY & aRay,
const S3DMODEL & aGeometry,
const FP_3DMODEL & aModel,
const FOOTPRINT & aFootprint ) const

◆ releaseOpenGL()

void EDA_3D_CANVAS::releaseOpenGL ( )
private

◆ ReloadRaytracingForHitTesting()

void EDA_3D_CANVAS::ReloadRaytracingForHitTesting ( std::stop_token aStop)

Rebuild the auxiliary raytracing BVH used for hover hit-testing in OpenGL mode.

Called from the OpenGL background loader once board layers are ready.

Definition at line 369 of file eda_3d_canvas.cpp.

References m_3d_render_raytracing.

◆ ReloadRequest()

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

Definition at line 351 of file eda_3d_canvas.cpp.

References m_3d_render, m_3d_render_opengl, and m_boardAdapter.

◆ render3dmousePivot()

void EDA_3D_CANVAS::render3dmousePivot ( float aScale)
private

Render the 3dmouse pivot cursor.

Parameters
aScalescale to apply on the cursor.

Definition at line 120 of file eda_3d_canvas_pivot.cpp.

References m_3dmousePivotPos, and HIDPI_GL_3D_CANVAS::m_camera.

Referenced by DoRePaint().

◆ render_overlays()

void EDA_3D_CANVAS::render_overlays ( )
private

Draw the translucent overlays over the rendered scene.

Definition at line 1536 of file eda_3d_canvas.cpp.

References m_boardAdapter, HIDPI_GL_3D_CANVAS::m_camera, m_overlays, OPENGL, and overlay.

Referenced by DoRePaint().

◆ 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 73 of file eda_3d_canvas_pivot.cpp.

References HIDPI_GL_3D_CANVAS::m_camera, and pivot_render_triangles().

Referenced by DoRePaint().

◆ RenderEngineChanged()

void EDA_3D_CANVAS::RenderEngineChanged ( )

◆ RenderRaytracingRequest()

void EDA_3D_CANVAS::RenderRaytracingRequest ( )

Request to render the current view in Raytracing mode.

Definition at line 383 of file eda_3d_canvas.cpp.

References m_3d_render, m_3d_render_raytracing, m_render_raytracing_was_requested, and Request_refresh().

◆ RenderToFrameBuffer()

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

References ID_CUSTOM_EVENT_1, and m_redraw_trigger_timer.

Referenced by DoRePaint(), OnMagnify(), OnMouseMove(), OnMouseWheel(), OnPanGesture(), OnResize(), OnRotateGesture(), OnTimerTimeout_Editing(), OnTimerTimeout_Redraw(), OnZoomGesture(), RenderEngineChanged(), RenderRaytracingRequest(), and request_start_moving_camera().

◆ request_start_moving_camera()

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

◆ restart_editingTimeOut_Timer()

void EDA_3D_CANVAS::restart_editingTimeOut_Timer ( )
private

Reset the editing timer.

Definition at line 1329 of file eda_3d_canvas.cpp.

References m_3d_render, and m_editing_timeout_timer.

Referenced by DoRePaint(), OnLeftUp(), OnMagnify(), OnMiddleUp(), OnMouseWheel(), OnRightUp(), and OnZoomGesture().

◆ Set3dmousePivotPos()

void EDA_3D_CANVAS::Set3dmousePivotPos ( const SFVEC3F & aPos)
inline

Set the position of the the 3dmouse pivot.

Parameters
aPosis the position of the 3dmouse rotation pivot

Definition at line 279 of file eda_3d_canvas.h.

References m_3dmousePivotPos.

◆ SetAnimationEnabled()

void EDA_3D_CANVAS::SetAnimationEnabled ( bool aEnable)
inline

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

Definition at line 200 of file eda_3d_canvas.h.

References m_animation_enabled.

◆ SetEventDispatcher()

void EDA_3D_CANVAS::SetEventDispatcher ( TOOL_DISPATCHER * aEventDispatcher)

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

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

References m_eventDispatcher.

◆ SetHoverHandler()

void EDA_3D_CANVAS::SetHoverHandler ( std::function< void(const std::optional< RAY > &)> aHandler)
inline

Report the mouse position while a pick handler is installed.

The handler is called with the ray under the cursor, or with nothing when the cursor leaves the canvas. Board item roll-over is suspended while it is set.

Definition at line 108 of file eda_3d_canvas.h.

References m_hoverHandler.

◆ SetInfoBar()

void EDA_3D_CANVAS::SetInfoBar ( WX_INFOBAR * aInfoBar)
inline

Definition at line 91 of file eda_3d_canvas.h.

References m_parentInfoBar.

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

References m_moving_speed_multiplier.

◆ SetOverlays()

void EDA_3D_CANVAS::SetOverlays ( std::vector< OVERLAY > aOverlays)
inline

Definition at line 122 of file eda_3d_canvas.h.

References m_overlays.

◆ SetPickHandler()

void EDA_3D_CANVAS::SetPickHandler ( std::function< bool(const RAY &)> aHandler)
inline

Consume plain canvas clicks before the normal selection handler.

Definition at line 97 of file eda_3d_canvas.h.

References m_pickHandler.

◆ SetProjectionMode()

void EDA_3D_CANVAS::SetProjectionMode ( int aMode)
inline

Definition at line 212 of file eda_3d_canvas.h.

References HIDPI_GL_3D_CANVAS::m_camera.

◆ SetRender3dmousePivot()

void EDA_3D_CANVAS::SetRender3dmousePivot ( bool aValue)
inline

Set aValue indicating whether to render the 3dmouse pivot.

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

Definition at line 268 of file eda_3d_canvas.h.

References m_render3dmousePivot.

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

References m_render_pivot.

◆ SetStatusBar()

void EDA_3D_CANVAS::SetStatusBar ( wxStatusBar * aStatusBar)
inline

Definition at line 86 of file eda_3d_canvas.h.

References m_parentStatusBar.

◆ SetVcSettings()

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

Definition at line 60 of file hidpi_gl_canvas.h.

References m_settings.

◆ SetView3D()

bool EDA_3D_CANVAS::SetView3D ( VIEW3D_TYPE aRequestedView)

◆ stop_editingTimeOut_Timer()

void EDA_3D_CANVAS::stop_editingTimeOut_Timer ( )
private

Stop the editing time so it will not timeout.

Definition at line 1323 of file eda_3d_canvas.cpp.

References m_editing_timeout_timer.

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

Member Data Documentation

◆ m_3d_render

RENDER_3D_BASE* EDA_3D_CANVAS::m_3d_render = nullptr
private

◆ m_3d_render_opengl

std::unique_ptr<RENDER_3D_OPENGL> EDA_3D_CANVAS::m_3d_render_opengl
private

◆ m_3d_render_raytracing

◆ m_3dmousePivotPos

SFVEC3F EDA_3D_CANVAS::m_3dmousePivotPos
private

Definition at line 426 of file eda_3d_canvas.h.

Referenced by render3dmousePivot(), and Set3dmousePivotPos().

◆ m_accelerator3DShapes

ACCELERATOR_3D* EDA_3D_CANVAS::m_accelerator3DShapes = nullptr
private

Definition at line 421 of file eda_3d_canvas.h.

Referenced by ~EDA_3D_CANVAS().

◆ m_activityReporterSync

std::shared_ptr<SYNC_REPORTER> EDA_3D_CANVAS::m_activityReporterSync
private

Definition at line 393 of file eda_3d_canvas.h.

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

◆ m_animation_enabled

bool EDA_3D_CANVAS::m_animation_enabled = true
private

◆ m_boardAdapter

◆ m_camera

◆ m_camera_is_moving

◆ m_camera_moving_speed

float EDA_3D_CANVAS::m_camera_moving_speed = 1.0f
private

Definition at line 406 of file eda_3d_canvas.h.

Referenced by DoRePaint(), RenderToFrameBuffer(), and request_start_moving_camera().

◆ m_currentRollOverItem

BOARD_ITEM* EDA_3D_CANVAS::m_currentRollOverItem = nullptr
private

Definition at line 423 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 52 of file hidpi_gl_3D_canvas.h.

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

◆ m_editing_timeout_timer

wxTimer EDA_3D_CANVAS::m_editing_timeout_timer
private

◆ m_eventDispatcher

TOOL_DISPATCHER* EDA_3D_CANVAS::m_eventDispatcher = nullptr
private

Definition at line 386 of file eda_3d_canvas.h.

Referenced by EDA_3D_CANVAS(), OnEvent(), and SetEventDispatcher().

◆ m_gestureLastAngle

double EDA_3D_CANVAS::m_gestureLastAngle = 0.0
private

Definition at line 430 of file eda_3d_canvas.h.

Referenced by OnRotateGesture().

◆ m_gestureLastZoomFactor

double EDA_3D_CANVAS::m_gestureLastZoomFactor = 1.0
private

Used to track gesture events.

Definition at line 429 of file eda_3d_canvas.h.

Referenced by OnZoomGesture().

◆ m_glRC

wxGLContext* EDA_3D_CANVAS::m_glRC = nullptr
private

Definition at line 396 of file eda_3d_canvas.h.

Referenced by DoRePaint(), releaseOpenGL(), and RenderToFrameBuffer().

◆ m_hoverHandler

std::function<void( const std::optional<RAY>& )> EDA_3D_CANVAS::m_hoverHandler
private

Definition at line 383 of file eda_3d_canvas.h.

Referenced by OnMouseLeave(), OnMouseMove(), and SetHoverHandler().

◆ m_infoBarReporter

std::unique_ptr<INFOBAR_REPORTER> EDA_3D_CANVAS::m_infoBarReporter
private

Definition at line 391 of file eda_3d_canvas.h.

Referenced by DoRePaint().

◆ m_is_currently_painting

std::atomic_flag EDA_3D_CANVAS::m_is_currently_painting = ATOMIC_FLAG_INIT
private

Definition at line 403 of file eda_3d_canvas.h.

Referenced by DoRePaint(), EDA_3D_CANVAS(), and RenderToFrameBuffer().

◆ m_is_opengl_initialized

bool EDA_3D_CANVAS::m_is_opengl_initialized = false
private

Definition at line 397 of file eda_3d_canvas.h.

Referenced by DoRePaint(), initializeOpenGL(), and RenderToFrameBuffer().

◆ m_is_opengl_version_supported

bool EDA_3D_CANVAS::m_is_opengl_version_supported = true
private

Definition at line 398 of file eda_3d_canvas.h.

Referenced by DoRePaint(), initializeOpenGL(), and RenderToFrameBuffer().

◆ m_mouse_is_moving

◆ m_mouse_was_moved

◆ m_moving_speed_multiplier

int EDA_3D_CANVAS::m_moving_speed_multiplier = 3
private

◆ m_opengl_supports_raytracing

bool EDA_3D_CANVAS::m_opengl_supports_raytracing = true
private

Definition at line 418 of file eda_3d_canvas.h.

Referenced by DoRePaint(), initializeOpenGL(), and RenderToFrameBuffer().

◆ m_overlays

std::vector<OVERLAY> EDA_3D_CANVAS::m_overlays
private

Definition at line 384 of file eda_3d_canvas.h.

Referenced by render_overlays(), and SetOverlays().

◆ m_parentInfoBar

WX_INFOBAR* EDA_3D_CANVAS::m_parentInfoBar = nullptr
private

Definition at line 388 of file eda_3d_canvas.h.

Referenced by DoRePaint(), and SetInfoBar().

◆ m_parentStatusBar

wxStatusBar* EDA_3D_CANVAS::m_parentStatusBar = nullptr
private

Definition at line 387 of file eda_3d_canvas.h.

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

◆ m_pickHandler

std::function<bool( const RAY& )> EDA_3D_CANVAS::m_pickHandler
private

Definition at line 382 of file eda_3d_canvas.h.

Referenced by OnLeftUp(), and SetPickHandler().

◆ m_redraw_trigger_timer

wxTimer EDA_3D_CANVAS::m_redraw_trigger_timer
private

Definition at line 402 of file eda_3d_canvas.h.

Referenced by EDA_3D_CANVAS(), OnTimerTimeout_Redraw(), and Request_refresh().

◆ m_render3dmousePivot

bool EDA_3D_CANVAS::m_render3dmousePivot = false
private

Definition at line 425 of file eda_3d_canvas.h.

Referenced by DoRePaint(), GetRender3dmousePivot(), and SetRender3dmousePivot().

◆ m_render_pivot

bool EDA_3D_CANVAS::m_render_pivot = false
private

◆ m_render_raytracing_was_requested

bool EDA_3D_CANVAS::m_render_raytracing_was_requested = false
private

Definition at line 419 of file eda_3d_canvas.h.

Referenced by DoRePaint(), RenderRaytracingRequest(), and RenderToFrameBuffer().

◆ m_settings

KIGFX::VC_SETTINGS HIDPI_GL_CANVAS::m_settings
protectedinherited

Current VIEW_CONTROLS settings.

Definition at line 64 of file hidpi_gl_canvas.h.

Referenced by HIDPI_GL_CANVAS(), HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), HIDPI_GL_3D_CANVAS::OnMouseWheelCamera(), and SetVcSettings().

◆ m_statusBarReporter

std::unique_ptr<STATUSBAR_REPORTER> EDA_3D_CANVAS::m_statusBarReporter
private

Definition at line 390 of file eda_3d_canvas.h.

Referenced by DoRePaint().

◆ m_strtime_camera_movement

int64_t EDA_3D_CANVAS::m_strtime_camera_movement = 0
private

Definition at line 407 of file eda_3d_canvas.h.

Referenced by DoRePaint(), RenderToFrameBuffer(), and request_start_moving_camera().

◆ m_warningReporterSync

std::shared_ptr<SYNC_REPORTER> EDA_3D_CANVAS::m_warningReporterSync
private

Definition at line 394 of file eda_3d_canvas.h.

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


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