KiCad PCB EDA Suite
Loading...
Searching...
No Matches
nl_3d_viewer_plugin_impl.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 3Dconnexion
5 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef NL_3D_VIEWER_PLUGIN_IMPL_H_
27#define NL_3D_VIEWER_PLUGIN_IMPL_H_
28
29// TDxWare SDK.
30#include <SpaceMouse/CNavigation3D.hpp>
31
32// KiCAD
34
35// wx
36#include <wx/chartype.h>
37
38// glm
39#include <glm/glm.hpp>
40
41// Forward declarations.
42class EDA_3D_CANVAS;
43class TRACK_BALL;
44
45// temporary store for the categories
46typedef std::map<std::string, TDx::CCommandTreeNode*> CATEGORY_STORE;
47
48CATEGORY_STORE::iterator add_category( std::string aCategoryPath, CATEGORY_STORE& aCategoryStore );
49
50// Convenience typedef.
51typedef TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D;
52
58{
59public:
66 NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, const std::string& aProfileHint );
67
69
76 void SetFocus( bool aFocus = true );
77
81 EDA_3D_CANVAS* GetCanvas() const;
82
86 void Connect();
87
88private:
92 virtual void exportCommandsAndImages();
93
94 long GetCameraMatrix( navlib::matrix_t& aMatrix ) const override;
95 long GetPointerPosition( navlib::point_t& aPosition ) const override;
96 long GetViewExtents( navlib::box_t& aExtents ) const override;
97 long GetViewFOV( double& aFov ) const override;
98 long GetViewFrustum( navlib::frustum_t& aFrustum ) const override;
99 long GetIsViewPerspective( navlib::bool_t& aPerspective ) const override;
100 long SetCameraMatrix( const navlib::matrix_t& aMatrix ) override;
101 long SetViewExtents( const navlib::box_t& aExtents ) override;
102 long SetViewFOV( double aFov ) override;
103 long SetViewFrustum( const navlib::frustum_t& aFrustum ) override;
104 long GetModelExtents( navlib::box_t& aExtents ) const override;
105 long GetSelectionExtents( navlib::box_t& aExtents ) const override;
106 long GetSelectionTransform( navlib::matrix_t& aTransform ) const override;
107 long GetIsSelectionEmpty( navlib::bool_t& aEmpty ) const override;
108 long SetSelectionTransform( const navlib::matrix_t& aMatrix ) override;
109 long GetPivotPosition( navlib::point_t& aPosition ) const override;
110 long IsUserPivot( navlib::bool_t& aUserPivot ) const override;
111 long SetPivotPosition( const navlib::point_t& aPosition ) override;
112 long GetPivotVisible( navlib::bool_t& aVisible ) const override;
113 long SetPivotVisible( bool aVisible ) override;
114 long GetHitLookAt( navlib::point_t& aPosition ) const override;
115 long SetHitAperture( double aAperture ) override;
116 long SetHitDirection( const navlib::vector_t& aDirection ) override;
117 long SetHitLookFrom( const navlib::point_t& aPosition ) override;
118 long SetHitSelectionOnly( bool aSelectionOnly ) override;
119 long SetActiveCommand( std::string aCommandId ) override;
120
121 long SetSettingsChanged( long aChangeNumber ) override;
122 long SetMotionFlag( bool aValue ) override;
123 long SetTransaction( long aValue ) override;
124 long SetCameraTarget( const navlib::point_t& aPosition ) override;
125
126 long GetFrontView( navlib::matrix_t& aMatrix ) const override;
127 long GetCoordinateSystem( navlib::matrix_t& aMatrix ) const override;
128 long GetIsViewRotatable( navlib::bool_t& isRotatable ) const override;
129
130
131private:
138
139 // The cached CAMERA affine matrix. This is used to determine if the camera has been
140 // moved. The camera matrix is the world to camera affine.
141 mutable glm::mat4 m_cameraMatrix;
142
143
150 static const wxChar* m_logTrace;
151};
152
153#endif // NL_3D_VIEWER_PLUGIN_IMPL_H_
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
The class that implements the accessors and mutators required for 3D navigation in an EDA_3D_CANVAS u...
long GetViewExtents(navlib::box_t &aExtents) const override
long GetCameraMatrix(navlib::matrix_t &aMatrix) const override
void Connect()
Connect plugin implementation to the driver.
long SetHitLookFrom(const navlib::point_t &aPosition) override
long SetActiveCommand(std::string aCommandId) override
EDA_3D_CANVAS * GetCanvas() const
Get the m_canvas pointer.
long GetPivotPosition(navlib::point_t &aPosition) const override
long GetModelExtents(navlib::box_t &aExtents) const override
long GetPointerPosition(navlib::point_t &aPosition) const override
long SetPivotVisible(bool aVisible) override
long SetTransaction(long aValue) override
long SetViewFOV(double aFov) override
long SetMotionFlag(bool aValue) override
long SetCameraMatrix(const navlib::matrix_t &aMatrix) override
long GetHitLookAt(navlib::point_t &aPosition) const override
long SetHitAperture(double aAperture) override
long SetPivotPosition(const navlib::point_t &aPosition) override
long SetHitDirection(const navlib::vector_t &aDirection) override
long GetSelectionTransform(navlib::matrix_t &aTransform) const override
long SetSelectionTransform(const navlib::matrix_t &aMatrix) override
long SetSettingsChanged(long aChangeNumber) override
long SetHitSelectionOnly(bool aSelectionOnly) override
long GetIsSelectionEmpty(navlib::bool_t &aEmpty) const override
long GetSelectionExtents(navlib::box_t &aExtents) const override
long GetCoordinateSystem(navlib::matrix_t &aMatrix) const override
long IsUserPivot(navlib::bool_t &aUserPivot) const override
long GetViewFOV(double &aFov) const override
long GetPivotVisible(navlib::bool_t &aVisible) const override
long GetFrontView(navlib::matrix_t &aMatrix) const override
long GetViewFrustum(navlib::frustum_t &aFrustum) const override
long GetIsViewPerspective(navlib::bool_t &aPerspective) const override
long SetViewFrustum(const navlib::frustum_t &aFrustum) override
long SetViewExtents(const navlib::box_t &aExtents) override
virtual void exportCommandsAndImages()
Export the invocable actions and images to the 3Dconnexion UI.
void SetFocus(bool aFocus=true)
Set the connection to the 3Dconnexion driver to the focus state so that 3DMouse data is routed here.
long GetIsViewRotatable(navlib::bool_t &isRotatable) const override
long SetCameraTarget(const navlib::point_t &aPosition) override
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
std::map< std::string, TDx::CCommandTreeNode * > CATEGORY_STORE
CATEGORY_STORE::iterator add_category(std::string aCategoryPath, CATEGORY_STORE &aCategoryStore)
Add a category to the store.
TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44