Commit 6fe89f58 authored by Mike Kremer's avatar Mike Kremer

Implemented 3D-First-Person-Shooter navigation mode that still doesn't work too well.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7014 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 37a72c9e
......@@ -285,7 +285,7 @@ public:
/// Setup the main menubar
void setupMenuBar();
/** @} */
//===========================================================================
......@@ -554,7 +554,7 @@ public:
/// Setup and update the global draw menu
void slotUpdateGlobalDrawMenu();
/// Change viewer layout that was selected in the combo box
void setViewerLayout(int _idx);
......@@ -579,18 +579,18 @@ public:
QAction* perspectiveProjectionAction_;
QAction* orthogonalProjectionAction_;
/// Action to globally set Animation
QAction* globalAnimationAction_;
/// Action to globally set backface culling
QAction* globalBackfaceCullingAction_;
/// Action to globally set Two-Sided lighting
QAction* globalTwosidedLightingAction_;
QAction* globalTwosidedLightingAction_;
/// Action to globally set multisampling
QAction* globalMultisamplingAction_;
QAction* globalMultisamplingAction_;
int activeDrawModes_;
......@@ -642,6 +642,9 @@ public:
/// Show / hide wheels
void slotSwitchWheels(bool _state);
/// Switch navigation mode
void slotSwitchNavigation(bool _egomode);
/// Set the snapShot name for all examiners
void slotSnapshotName();
......@@ -927,15 +930,15 @@ public:
/// Set two sided lighting for active viewer
void slotLocalChangeTwoSidedLighting(bool _lighting);
/// Set Multisampling for all viewers
void slotGlobalChangeMultisampling(bool _lighting);
/// Set Multisampling for active viewer
void slotLocalChangeMultisampling(bool _lighting);
/// When using first person mode move backward
void moveBack();
......
This diff is collapsed.
......@@ -75,7 +75,7 @@ void CoreWidget::slotToggleStereoMode()
}
cursorPainter_->setEnabled (stereoActive_);
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
examiner_widgets_[i]->setStereoMode(stereoActive_);
}
......@@ -120,10 +120,20 @@ void CoreWidget::slotContextHomeView() {
void CoreWidget::slotSwitchWheels(bool _state) {
std::vector< glViewer* >::iterator it = examiner_widgets_.begin();
for(; it != examiner_widgets_.end(); it++)
for(; it != examiner_widgets_.end(); it++)
_state ? (*it)->slotShowWheels() : (*it)->slotHideWheels();
}
/// Switch navigation mode
void CoreWidget::slotSwitchNavigation(bool _egomode) {
std::vector< glViewer* >::iterator it = examiner_widgets_.begin();
for(; it != examiner_widgets_.end(); it++) {
_egomode ? (*it)->navigationMode(glViewer::EGOSHOOTER_NAVIGATION) :
(*it)->navigationMode(glViewer::NORMAL_NAVIGATION);
}
}
/// Set the viewer to home position
void CoreWidget::slotGlobalHomeView() {
for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
......@@ -186,7 +196,7 @@ void CoreWidget::slotLocalChangeAnimation(bool _animation){
void CoreWidget::slotGlobalChangeBackFaceCulling(bool _backFaceCulling){
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
PluginFunctions::viewerProperties(i).backFaceCulling(_backFaceCulling);
}
/// Set Backface culling for active viewer
......@@ -582,14 +592,14 @@ void CoreWidget::slotCoordSysVisibility(bool _visible){
return;
}
if (_visible)
if (_visible)
coordSys->show();
else
else
coordSys->hide();
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
examiner_widgets_[i]->updateGL();
}
void CoreWidget::slotSetViewingDirection(QAction* _action) {
......
This diff is collapsed.
......@@ -71,6 +71,7 @@
#include <QDragEnterEvent>
#include <QMouseEvent>
#include <QAction>
#include <QKeyEvent>
#include <QSize>
#include <QMap>
#include <QString>
......@@ -191,11 +192,21 @@ public:
PERSPECTIVE_PROJECTION //!< perspective
};
/// Navigation mode
enum NavigationMode {
NORMAL_NAVIGATION, //!< Normal mode
EGOSHOOTER_NAVIGATION //!< Egoshooter mode
};
/// Changes the projection mode and updates the projection matrix.
void projectionMode(ProjectionMode _p);
/// get current projection mode
ProjectionMode projectionMode() const { return projectionMode_; }
/// Changes the navigation mode
void navigationMode(NavigationMode _n);
/// get current navigation mode
NavigationMode navigationMode() const { return navigationMode_; }
/** Sets the center and dimension of the whole scene. This point is
used as fixpoint for rotations and to set the eye point far
......@@ -217,7 +228,6 @@ public:
*/
double scene_radius() const { return scene_radius_; }
/// set the viewing direction
void viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up );
......@@ -341,10 +351,13 @@ public slots:
virtual void orthographicProjection();
/// toggle projection mode
virtual void toggleProjectionMode();
/// toggle navigation mode
virtual void toggleNavigationMode();
signals:
void projectionModeChanged( bool _ortho );
void navigationModeChanged( bool _normal );
public slots:
......@@ -437,6 +450,8 @@ protected:
void viewMouseEvent( QMouseEvent* _event);
/// specialized viewer: handle wheel events
void viewWheelEvent(QWheelEvent* _event);
/// specialized viewer: hande key events
void viewKeyEvent( QKeyEvent* _event);
/// optional: hande mouse events to rotate light
void lightMouseEvent( QMouseEvent* /* _event */ );
......@@ -533,6 +548,7 @@ private:
// modi
NormalsMode normalsMode_;
ProjectionMode projectionMode_;
NavigationMode navigationMode_;
// helper
......@@ -651,7 +667,7 @@ private:
*
* This function is called by the internal gl widget when receiving a key press event.
*/
virtual void keyPressEvent(QKeyEvent* _event) { _event->ignore(); };
virtual void keyPressEvent(QKeyEvent* _event);
/** \brief Get keyRelease events from the glArea
*
......@@ -668,7 +684,7 @@ private:
*
* @return If the derived class handled the event it has to return true otherwise false
*/
virtual bool viewKeyPressEvent(QKeyEvent* /*_event*/) { return false; };
virtual bool viewKeyPressEvent(QKeyEvent* _event);
/** @} */
......@@ -834,6 +850,12 @@ private:
/// virtual trackball: map 2D screen point to unit sphere
bool mapToSphere(const QPoint& _p, ACG::Vec3d& _result) const;
/// Navigate through scene if ego-shooter mode has been selected
void treatEgoShooterNavigation( QMouseEvent* _event);
/// Navigate through scene if normal mode has been selected
void treatNormalNavigation( QMouseEvent* _event);
// mouse interaction
ACG::Vec3d lastPoint3D_;
......
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