KiCad PCB EDA Suite
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) 2021 3Dconnexion
5 * Copyright (C) 2021 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// Convenience typedef.
46typedef TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D;
47
53{
54public:
61
63
70 void SetFocus( bool aFocus = true );
71
72private:
77
78 long GetCameraMatrix( navlib::matrix_t& aMatrix ) const override;
79 long GetPointerPosition( navlib::point_t& aPosition ) const override;
80 long GetViewExtents( navlib::box_t& aExtents ) const override;
81 long GetViewFOV( double& aFov ) const override;
82 long GetViewFrustum( navlib::frustum_t& aFrustum ) const override;
83 long GetIsViewPerspective( navlib::bool_t& aPerspective ) const override;
84 long SetCameraMatrix( const navlib::matrix_t& aMatrix ) override;
85 long SetViewExtents( const navlib::box_t& aExtents ) override;
86 long SetViewFOV( double aFov ) override;
87 long SetViewFrustum( const navlib::frustum_t& aFrustum ) override;
88 long GetModelExtents( navlib::box_t& aExtents ) const override;
89 long GetSelectionExtents( navlib::box_t& aExtents ) const override;
90 long GetSelectionTransform( navlib::matrix_t& aTransform ) const override;
91 long GetIsSelectionEmpty( navlib::bool_t& aEmpty ) const override;
92 long SetSelectionTransform( const navlib::matrix_t& aMatrix ) override;
93 long GetPivotPosition( navlib::point_t& aPosition ) const override;
94 long IsUserPivot( navlib::bool_t& aUserPivot ) const override;
95 long SetPivotPosition( const navlib::point_t& aPosition ) override;
96 long GetPivotVisible( navlib::bool_t& aVisible ) const override;
97 long SetPivotVisible( bool aVisible ) override;
98 long GetHitLookAt( navlib::point_t& aPosition ) const override;
99 long SetHitAperture( double aAperture ) override;
100 long SetHitDirection( const navlib::vector_t& aDirection ) override;
101 long SetHitLookFrom( const navlib::point_t& aPosition ) override;
102 long SetHitSelectionOnly( bool aSelectionOnly ) override;
103 long SetActiveCommand( std::string aCommandId ) override;
104
105 long SetSettingsChanged( long aChangeNumber ) override;
106 long SetMotionFlag( bool aValue ) override;
107 long SetTransaction( long aValue ) override;
108 long SetCameraTarget( const navlib::point_t& aPosition ) override;
109
110 long GetFrontView( navlib::matrix_t& aMatrix ) const override;
111 long GetCoordinateSystem( navlib::matrix_t& aMatrix ) const override;
112 long GetIsViewRotatable( navlib::bool_t& isRotatable ) const override;
113
114private:
121
122 // The cached CAMERA affine matrix. This is used to determine if the camera has been
123 // moved. The camera matrix is the world to camera affine.
124 mutable glm::mat4 m_cameraMatrix;
125
126
133 static const wxChar* m_logTrace;
134};
135
136#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
long SetHitLookFrom(const navlib::point_t &aPosition) override
long SetActiveCommand(std::string aCommandId) override
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
NL_3D_VIEWER_PLUGIN_IMPL(EDA_3D_CANVAS *aCanvas)
Initializes a new instance of the NL_3DVIEWER_PLUGIN.
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
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.
TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44