Commit f26762e1 authored by Jan Möbius's avatar Jan Möbius

Moved more settings to qsettings

Enabled multipass

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7737 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e90ba07
......@@ -324,20 +324,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
if( _ini.get_entry(logFile, "Options", "LogFileLocation") )
OpenFlipper::Options::logFile(logFile);
//============================================================================
// Load the WheelZoomFactor setting
//============================================================================
double wheelZoomFactor = 1.0;
if ( _ini.get_entry( wheelZoomFactor, "Options" , "WheelZoomFactor") )
OpenFlipper::Options::wheelZoomFactor(wheelZoomFactor);
//============================================================================
// Load the WheelZoomFactorShift setting
//============================================================================
double wheelZoomFactorShift = 0.2;
if ( _ini.get_entry( wheelZoomFactorShift, "Options" , "WheelZoomFactorShift" ) )
OpenFlipper::Options::wheelZoomFactorShift(wheelZoomFactorShift);
//============================================================================
// Load restrictFrameRate
//============================================================================
......@@ -345,13 +331,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
if( _ini.get_entry(restrictFrameRate, "Options", "RestrictFrameRate") )
OpenFlipper::Options::restrictFrameRate(restrictFrameRate);
//============================================================================
// Load showWheelsAtStartup
//============================================================================
bool showWheelsAtStartup = false;
if( _ini.get_entry(showWheelsAtStartup, "Options", "ShowWheelsAtStartup") )
OpenFlipper::Options::showWheelsAtStartup(showWheelsAtStartup);
//============================================================================
// Load maxFrameRate
//============================================================================
......@@ -560,12 +539,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
//============================================================================
// other
//============================================================================
_ini.add_entry("Options","WheelZoomFactor", OpenFlipper::Options::wheelZoomFactor() );
_ini.add_entry("Options","WheelZoomFactorShift", OpenFlipper::Options::wheelZoomFactorShift() );
// restrict Framerate
_ini.add_entry("Options","RestrictFrameRate",OpenFlipper::Options::restrictFrameRate() );
// Show wheels on startup
_ini.add_entry("Options","ShowWheelsAtStartup",OpenFlipper::Options::showWheelsAtStartup() );
// max Framerate
_ini.add_entry("Options","MaxFrameRate",OpenFlipper::Options::maxFrameRate() );
......
......@@ -135,8 +135,8 @@ void Core::applyOptions(){
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
//wheel zoom factor
PluginFunctions::viewerProperties(i).wheelZoomFactor(OpenFlipper::Options::wheelZoomFactor());
PluginFunctions::viewerProperties(i).wheelZoomFactorShift(OpenFlipper::Options::wheelZoomFactorShift());
PluginFunctions::viewerProperties(i).wheelZoomFactor( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactor").toDouble() );
PluginFunctions::viewerProperties(i).wheelZoomFactorShift( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactorShift").toDouble() );
// Picking Debugger
PluginFunctions::viewerProperties(i).renderPicking(OpenFlipper::Options::renderPicking(), target );
......
......@@ -142,18 +142,9 @@ static bool stereoMousePick_ = true;
/// Store the synchronization mode
static bool synchronization_ = false;
/// Store the wheelZoomFactor mode
static double wheelZoomFactor_ = 1.0;
/// Store the wheelZoomFactorShift mode
static double wheelZoomFactorShift_ = 0.2;
/// Store the restrictFrameRate_ mode
static bool restrictFrameRate_ = false;
/// Store the wheel settings
static bool showWheelsAtStartup_ = false;
/// Store the maxFrameRate_ mode
static int maxFrameRate_ = 35;
......@@ -528,42 +519,14 @@ bool synchronization( ) {
return synchronization_;
}
/// Store wheelZoomFactor setting
void wheelZoomFactor( double _factor ) {
wheelZoomFactor_ = _factor;
}
/// get wheelZoomFactor setting
double wheelZoomFactor( ) {
return wheelZoomFactor_;
}
/// Store wheelZoomFactorShift setting
void wheelZoomFactorShift( double _factor ) {
wheelZoomFactorShift_ = _factor;
}
/// get wheelZoomFactorShift setting
double wheelZoomFactorShift( ) {
return wheelZoomFactorShift_;
}
void restrictFrameRate( bool _enable ){
restrictFrameRate_ = _enable;
}
void showWheelsAtStartup( bool _show ){
showWheelsAtStartup_ = _show;
}
bool restrictFrameRate( ){
return restrictFrameRate_;
}
bool showWheelsAtStartup( ){
return showWheelsAtStartup_;
}
void maxFrameRate( int _fps ){
maxFrameRate_ = _fps;
}
......@@ -1043,8 +1006,21 @@ bool initializeSettings() {
//==================================================================================================
// Initialize with default values if not already set
//==================================================================================================
// User Interface Settings
if ( ! settings_->contains("Core/Gui/glViewer/showControlWheels") )
settings_->setValue("Core/Gui/glViewer/showControlWheels",false);
// Mouse Controls
if ( ! settings_->contains("Core/Mouse/Wheel/ZoomFactor") )
settings_->setValue("Core/Mouse/Wheel/ZoomFactor",1.0);
if ( ! settings_->contains("Core/Mouse/Wheel/ZoomFactorShift") )
settings_->setValue("Core/Mouse/Wheel/ZoomFactorShift",0.2);
// Stereo defaults
// General Stereo Settings
if ( ! settings_->contains("Core/Stereo/FocalLength") )
settings_->setValue("Core/Stereo/FocalLength",0.5);
......@@ -1052,7 +1028,7 @@ bool initializeSettings() {
settings_->setValue("Core/Stereo/EyeDistance",0.07);
// Philips Stereo
// Philips stereo display settings
if ( ! settings_->contains("Core/Stereo/Philips/Content") )
settings_->setValue("Core/Stereo/Philips/Content",3);
......
......@@ -84,6 +84,13 @@
*
* The following entries are available through the settings:
*
* <b>User Interface Settings</b>
* * Core/Gui/glViewer/showControlWheels This setting controls if the control wheels should be visible in the glViewer (bool)
*
* <b>Mouse Controls<b>\n
* * Core/Mouse/Wheel/ZoomFactor Zoom factor used when turning the mouse wheel (double)\n
* * Core/Mouse/Wheel/ZoomFactorShift Zoom factor used when turning the mouse wheel while shift is pressed (makes zoom slower while shift is pressed) (double)\n
*
* <b>General Stereo Settings<b>\n
* * Core/Stereo/EyeDistance Distance between eyes. Defaults to 7 cm (double)\n
* * Core/Stereo/FocalDistance Focal distance. Defaults to center of scene (double)\n
......@@ -100,7 +107,6 @@ QSettings& OpenFlipperSettings();
/** @} */
namespace OpenFlipper {
namespace Options {
......@@ -436,22 +442,6 @@ QString helpDirStr();
DLLEXPORT
bool synchronization( );
/// Store wheelZoomFactor setting
DLLEXPORT
void wheelZoomFactor( double _factor );
/// get wheelZoomFactor setting
DLLEXPORT
double wheelZoomFactor( );
/// Store wheelZoomFactorShift setting
DLLEXPORT
void wheelZoomFactorShift( double _factor );
/// get wheelZoomFactorShift setting
DLLEXPORT
double wheelZoomFactorShift( );
/// Store restrictFrameRate setting
DLLEXPORT
void restrictFrameRate( bool _enable );
......@@ -460,14 +450,6 @@ QString helpDirStr();
DLLEXPORT
bool restrictFrameRate( );
/// set wheel appearance setting
DLLEXPORT
void showWheelsAtStartup( bool _show );
/// get wheel appearance setting
DLLEXPORT
bool showWheelsAtStartup( );
/// Store maxFrameRate setting
DLLEXPORT
void maxFrameRate( int _fps );
......
......@@ -365,9 +365,10 @@ void CoreWidget::setupMenuBar()
wheelSwitchAction->setWhatsThis( tr("Show / hide navigation wheels in viewer widget.<br><br>"
" These wheels appear in the corners of the viewports. "
" Use wheels to rotate and scale scene."));
if(OpenFlipper::Options::showWheelsAtStartup()) {
wheelSwitchAction->setChecked(true);
}
if(OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() )
wheelSwitchAction->setChecked(true);
connect( wheelSwitchAction,SIGNAL( toggled(bool) ), this, SLOT( slotSwitchWheels(bool) ) );
viewMenu_->addAction( wheelSwitchAction);
......
......@@ -264,7 +264,16 @@ void glViewer::sceneGraph(ACG::SceneGraph::BaseNode* _root, const bool _resetTra
if (sceneGraphRoot_ )
{
// set max number of render pass
// Single pass action, this info is static during multipass
ACG::SceneGraph::MultiPassInfoAction info_act;
ACG::SceneGraph::traverse(sceneGraphRoot_, info_act);
glstate_->set_max_render_passes(info_act.getMaxPasses());
// get scene size
// Single pass action, as the bounding box is not influenced by multipass traversal
ACG::SceneGraph::BoundingBoxAction act;
ACG::SceneGraph::traverse(sceneGraphRoot_, act);
......@@ -596,12 +605,12 @@ void glViewer::drawScene_mono()
}
ACG::SceneGraph::DrawAction action( properties_.drawMode() , false);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode() );
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action, *glstate_, properties_.drawMode() );
if( blending_ )
{
ACG::SceneGraph::DrawAction action(properties_.drawMode(), true);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode());
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action, *glstate_, properties_.drawMode());
}
if (oM)
......@@ -689,7 +698,7 @@ void glViewer::drawScene_mono()
// do the picking
glstate_->pick_init (true);
ACG::SceneGraph::PickAction action(*glstate_, properties_.renderPickingMode(), properties_.drawMode());
ACG::SceneGraph::traverse(sceneGraphRoot_, action);
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action,*glstate_);
glEnable(GL_LIGHTING);
glEnable(GL_BLEND);
......@@ -1343,10 +1352,8 @@ glViewer::createWidgets()
wheelX_->setWhatsThis( tr("Rotate around <b>x-axis</b>."));
// Hide or show wheels (depending on ini option)
if(!OpenFlipper::Options::showWheelsAtStartup()) {
slotHideWheels();
}
if( ! OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() )
slotHideWheels();
QGraphicsWidget *wheelX = glScene_->addWidget (wheelX_);
QGraphicsWidget *wheelY = glScene_->addWidget (wheelY_);
......@@ -2280,7 +2287,7 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
// Project the depth value of the stereo mode zero paralax plane.
// We need to use this depth to to get the cursor exactly on zero paralax plane in stereo mode
double zerop = near_ + ((far_ - near_) * OpenFlipper::Options::focalDistance ());
double zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalLength").toDouble() );
ACG::Vec3d zerod = glstate_->project (ACG::Vec3d (0.0, 0.0, -zerop));
// unproject the cursor into the scene
......
......@@ -184,7 +184,7 @@ int glViewer::pickColor( ACG::SceneGraph::PickTarget _pickTarget,
// do the picking
ACG::SceneGraph::PickAction action(properties_.glState(), _pickTarget, properties_.drawMode());
ACG::SceneGraph::traverse(sceneGraphRoot_, action);
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action,properties_.glState() );
// restore GL state
glMatrixMode( GL_PROJECTION );
......@@ -446,7 +446,7 @@ bool glViewer::pickGL( ACG::SceneGraph::PickTarget _pickTarget,
// do the picking
ACG::SceneGraph::PickAction action(properties_.glState(), _pickTarget, properties_.drawMode());
ACG::SceneGraph::traverse(sceneGraphRoot_, action);
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action, properties_.glState());
int hits = glRenderMode(GL_RENDER);
// restore GL state
......@@ -579,7 +579,7 @@ bool glViewer::pick_region( ACG::SceneGraph::PickTarget _pickTarg
// do the picking
ACG::SceneGraph::PickAction action(properties_.glState(), _pickTarget, properties_.drawMode());
ACG::SceneGraph::traverse(sceneGraphRoot_, action);
ACG::SceneGraph::traverse_multipass(sceneGraphRoot_, action,properties_.glState());
// restore GL state
glMatrixMode( GL_PROJECTION );
......
......@@ -321,10 +321,10 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
//Init Viewer Settings
wZoomFactor->setText( QString::number(OpenFlipper::Options::wheelZoomFactor(), 'f') );
wZoomFactorShift->setText( QString::number(OpenFlipper::Options::wheelZoomFactorShift(), 'f') );
wZoomFactor->setText( QString::number(OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactor").toDouble(), 'f') );
wZoomFactorShift->setText( QString::number(OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactorShift").toDouble(), 'f') );
wheelBox->setChecked( OpenFlipper::Options::showWheelsAtStartup() );
wheelBox->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() );
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() );
......@@ -536,11 +536,11 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::logFile( logFile->text() );
//viewer
OpenFlipper::Options::wheelZoomFactor( wZoomFactor->text().toDouble() );
OpenFlipper::Options::wheelZoomFactorShift( wZoomFactorShift->text().toDouble() );
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactor", wZoomFactor->text().toDouble());
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactorShift", wZoomFactorShift->text().toDouble());
OpenFlipper::Options::restrictFrameRate( restrictFPS->isChecked() );
OpenFlipper::Options::showWheelsAtStartup( wheelBox->isChecked() );
OpenFlipperSettings().setValue("Core/Gui/glViewer/showControlWheels", wheelBox->isChecked() );
OpenFlipper::Options::maxFrameRate( FPS->value() );
......
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