Commit 46ce9692 authored by Jan Möbius's avatar Jan Möbius
Browse files

Add menu entries to set multisampling

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6689 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4da3a8ca
...@@ -58,6 +58,7 @@ namespace Viewer { ...@@ -58,6 +58,7 @@ namespace Viewer {
locked_(0), locked_(0),
backFaceCulling_(false), backFaceCulling_(false),
twoSidedLighting_(true), twoSidedLighting_(true),
multisampling_(true),
animation_(false), animation_(false),
glState_(0), glState_(0),
objectMarker_(0) objectMarker_(0)
......
...@@ -302,6 +302,18 @@ namespace Viewer { ...@@ -302,6 +302,18 @@ namespace Viewer {
private: private:
bool twoSidedLighting_; bool twoSidedLighting_;
//===========================================================================
public slots:
/// set multisampling on/off
void multisampling(bool _state ) { multisampling_ = _state; emit updated(); }
/// is multisampling enabled?
bool multisampling() { return multisampling_; };
private:
bool multisampling_;
//=========================================================================== //===========================================================================
......
...@@ -165,6 +165,16 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/ ...@@ -165,6 +165,16 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
twoSidedLighting->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") ); twoSidedLighting->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
twoSidedLighting->setChecked( PluginFunctions::viewerProperties().twoSidedLighting() ); twoSidedLighting->setChecked( PluginFunctions::viewerProperties().twoSidedLighting() );
connect(twoSidedLighting, SIGNAL(triggered(bool)), this , SLOT( slotLocalChangeTwoSidedLighting(bool) ) ); connect(twoSidedLighting, SIGNAL(triggered(bool)), this , SLOT( slotLocalChangeTwoSidedLighting(bool) ) );
//====================================================================================================
QAction* multisampling = renderingOptionsMenu->addAction("Multisampling");
multisampling->setToolTip("Enable Multisampling");
multisampling->setCheckable( true );
// TODO:Add icon for multisampling
// twoSidedLighting->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
multisampling->setChecked( PluginFunctions::viewerProperties().multisampling() );
connect(multisampling, SIGNAL(triggered(bool)), this , SLOT( slotLocalChangeMultisampling(bool) ) );
//==================================================================================================== //====================================================================================================
// Other Toplevel Action // Other Toplevel Action
...@@ -456,7 +466,7 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) { ...@@ -456,7 +466,7 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
break; break;
case OBJECTCONTEXT: case OBJECTCONTEXT:
updatePopupMenuObject(contextMenu_ , object ); updatePopupMenuObject(contextMenu_ , object );
// return; return;
break; break;
case COORDSYSCONTEXT: case COORDSYSCONTEXT:
updatePopupMenuCoordsysNode(contextMenu_,target_idx); updatePopupMenuCoordsysNode(contextMenu_,target_idx);
......
...@@ -273,8 +273,13 @@ public: ...@@ -273,8 +273,13 @@ public:
public: public:
/// Setup the main menubar /// Setup the main menubar
void setupMenuBar(); void setupMenuBar();
private slots:
/// Update the menubat
void slotUpdateMenuBar();
/** @} */ /** @} */
...@@ -895,8 +900,15 @@ public: ...@@ -895,8 +900,15 @@ public:
/// Set two sided lighting for active viewer /// Set two sided lighting for active viewer
void slotLocalChangeTwoSidedLighting(bool _lighting); void slotLocalChangeTwoSidedLighting(bool _lighting);
/// Set Multisampling for all viewers
void slotGlobalChangeMultisampling(bool _lighting);
/// Set Multisampling for active viewer
void slotLocalChangeMultisampling(bool _lighting);
private : private :
bool stereoActive_; bool stereoActive_;
......
...@@ -275,6 +275,7 @@ void CoreWidget::setupMenuBar() ...@@ -275,6 +275,7 @@ void CoreWidget::setupMenuBar()
disabledCount++; disabledCount++;
} }
backfaceCulling->setCheckable( true );
if ( enabledCount != 0 && disabledCount != 0 ) if ( enabledCount != 0 && disabledCount != 0 )
backfaceCulling->setChecked(Qt::PartiallyChecked); backfaceCulling->setChecked(Qt::PartiallyChecked);
else if ( enabledCount == 4 ) else if ( enabledCount == 4 )
...@@ -283,7 +284,6 @@ void CoreWidget::setupMenuBar() ...@@ -283,7 +284,6 @@ void CoreWidget::setupMenuBar()
backfaceCulling->setChecked( Qt::Unchecked ); backfaceCulling->setChecked( Qt::Unchecked );
backfaceCulling->setToolTip("Enable backface culling"); backfaceCulling->setToolTip("Enable backface culling");
backfaceCulling->setCheckable( true );
backfaceCulling->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"backFaceCulling.png") ); backfaceCulling->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"backFaceCulling.png") );
connect(backfaceCulling, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeBackFaceCulling(bool) ) ); connect(backfaceCulling, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeBackFaceCulling(bool) ) );
...@@ -300,6 +300,7 @@ void CoreWidget::setupMenuBar() ...@@ -300,6 +300,7 @@ void CoreWidget::setupMenuBar()
disabledCount++; disabledCount++;
} }
twoSidedLighting->setCheckable( true );
if ( enabledCount != 0 && disabledCount != 0 ) if ( enabledCount != 0 && disabledCount != 0 )
twoSidedLighting->setChecked(Qt::PartiallyChecked); twoSidedLighting->setChecked(Qt::PartiallyChecked);
else if ( enabledCount == 4 ) else if ( enabledCount == 4 )
...@@ -308,10 +309,34 @@ void CoreWidget::setupMenuBar() ...@@ -308,10 +309,34 @@ void CoreWidget::setupMenuBar()
twoSidedLighting->setChecked( Qt::Unchecked ); twoSidedLighting->setChecked( Qt::Unchecked );
twoSidedLighting->setToolTip("Enable two-sided lighting"); twoSidedLighting->setToolTip("Enable two-sided lighting");
twoSidedLighting->setCheckable( true );
twoSidedLighting->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") ); twoSidedLighting->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
twoSidedLighting->setChecked( PluginFunctions::viewerProperties().twoSidedLighting() );
connect(twoSidedLighting, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeTwoSidedLighting(bool) ) ); connect(twoSidedLighting, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeTwoSidedLighting(bool) ) );
//======================
QAction* multisampling = renderingOptionsMenu->addAction("Multisampling");
enabledCount = 0;
disabledCount = 0;
for ( int i = 0 ; i< PluginFunctions::viewers(); ++i ) {
if ( PluginFunctions::viewerProperties(i).multisampling() )
enabledCount++;
else
disabledCount++;
}
multisampling->setCheckable( true );
if ( enabledCount != 0 && disabledCount != 0 )
multisampling->setChecked(Qt::PartiallyChecked);
else if ( enabledCount == 4 )
multisampling->setChecked( Qt::Checked );
else
multisampling->setChecked( Qt::Unchecked );
multisampling->setToolTip("Enable Multisampling");
// TODO:Icon for multisampling
// multisampling->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"twosidedLighting.png") );
connect(multisampling, SIGNAL(triggered(bool)), this , SLOT( slotGlobalChangeMultisampling(bool)) );
//============================================================================================================ //============================================================================================================
// Other toplevel actions // Other toplevel actions
...@@ -501,6 +526,10 @@ void CoreWidget::setupMenuBar() ...@@ -501,6 +526,10 @@ void CoreWidget::setupMenuBar()
} }
void CoreWidget::slotUpdateMenuBar() {
}
void CoreWidget::slotViewMenuAboutToShow() { void CoreWidget::slotViewMenuAboutToShow() {
uint perspectiveCount = 0; uint perspectiveCount = 0;
......
...@@ -198,6 +198,17 @@ void CoreWidget::slotLocalChangeTwoSidedLighting(bool _lighting) { ...@@ -198,6 +198,17 @@ void CoreWidget::slotLocalChangeTwoSidedLighting(bool _lighting) {
PluginFunctions::viewerProperties().twoSidedLighting(_lighting); PluginFunctions::viewerProperties().twoSidedLighting(_lighting);
} }
/// Set Multisampling for all viewers
void CoreWidget::slotGlobalChangeMultisampling(bool _multisampling) {
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
PluginFunctions::viewerProperties(i).multisampling( _multisampling );
}
/// Set Multisampling for active viewer
void CoreWidget::slotLocalChangeMultisampling(bool _multisampling) {
PluginFunctions::viewerProperties().multisampling( _multisampling );
}
/// Take a snapshot of the current Viewer /// Take a snapshot of the current Viewer
void CoreWidget::slotSnapshot() { void CoreWidget::slotSnapshot() {
......
...@@ -1949,6 +1949,8 @@ void glViewer::applyProperties() { ...@@ -1949,6 +1949,8 @@ void glViewer::applyProperties() {
glstate_->set_twosided_lighting( properties_.twoSidedLighting() ); glstate_->set_twosided_lighting( properties_.twoSidedLighting() );
glstate_->set_clear_color( properties_.backgroundColor() ); glstate_->set_clear_color( properties_.backgroundColor() );
glstate_->allow_multisampling( properties_.multisampling() );
if (properties_.isCCWFront() ) if (properties_.isCCWFront() )
glFrontFace( GL_CCW ); glFrontFace( GL_CCW );
......
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