Commit 40c61924 authored by Frédéric Larue's avatar Frédéric Larue

NavigationControl class added to GLViewer in order to give the possibility to...

NavigationControl class added to GLViewer in order to give the possibility to change the way the navigation is controlled by input devices.
parent 40a9e2a2
This diff is collapsed.
......@@ -57,6 +57,23 @@ public:
unsigned int pointSize;
};
class NavigationControl
{
GLViewer *m_Viewer;
public:
inline NavigationControl( GLViewer *viewer ) : m_Viewer(viewer) {}
inline GLViewer* GetViewer() const { return m_Viewer; }
virtual void mouseMoveEvent( double dx, double dy, QMouseEvent *evt );
virtual void wheelEvent( double delta, QWheelEvent* evt );
virtual void mouseDoubleClickEvent( QMouseEvent *evt );
virtual bool keyPressEvent( QKeyEvent *evt );
virtual void updateProjectionMatrix( QMatrix4x4 &m );
virtual void updateViewMatrix( QMatrix4x4 &m );
};
protected:
class DisplayableInfo;
......@@ -114,6 +131,7 @@ protected:
\********************/
protected:
RenderState m_View;
QList<NavigationControl*> m_NavigationCtrl;
float m_SpeedFactor;
float m_CtrlSpeedFactor;
......@@ -214,8 +232,6 @@ protected:
void updateSelectionMode( const Qt::KeyboardModifiers &modifiers );
void mouseMotionNavigationEvent( float dx, float dy, QMouseEvent *evt );
DisplayableMap::iterator removeDisplayable_Internal( DisplayableMap::iterator &dmapIt );
void displayLabel( DisplayableInterface *d );
......@@ -238,6 +254,11 @@ public:
inline void getRenderState( RenderState& state ) const { state = m_View; }
void setRenderState( const RenderState& state );
inline NavigationControl* navigationControl() const { return m_NavigationCtrl.empty()? NULL : m_NavigationCtrl.front(); }
inline void pushNavigationControl( NavigationControl* ctrl ) { m_NavigationCtrl.push_front(ctrl); }
inline void popNavigationControl() { if( !m_NavigationCtrl.empty() ) { delete m_NavigationCtrl.front(); m_NavigationCtrl.pop_front(); } }
inline void clearNavigationControlStack() { while( !m_NavigationCtrl.empty() ) popNavigationControl(); }
inline QVector2D screenPosToClipCoord( const QPoint &screenPos ) { return QVector2D( 2.0f*screenPos.x()/width()-1.0f, 1.0f-2.0f*screenPos.y()/height() ); }
virtual void initializeGL();
......@@ -357,6 +378,9 @@ signals:
| QT slot(s) |
\************/
public slots:
inline void emitScreenSpaceTranslation( const QVector2D& tr) { emit screenSpaceTranslation(tr); }
inline void emitViewRotationMatrixUpdated( const QMatrix4x4 &r ) { emit viewRotationMatrixUpdated(r); }
virtual bool addDisplayable( GenericUIData *m );
virtual void removeDisplayable( GenericUIData *m );
virtual void removeAllDisplayables();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment