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

Corrected setting of fovy value via options widget to be read directly out of OF settings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10353 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e5c9b6e1
......@@ -893,31 +893,6 @@ ACG::Vec3d upVector(int _viewer) {
return viewerProperties().glState().up();
}
double fovy(int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) {
return viewerProperties(activeExaminer_).glState().fovy();
} else if ( _viewer == ALL_VIEWERS )
std::cerr << "Please select viewer to get fovy!" << std::endl;
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
return viewerProperties(_viewer).glState().fovy();
else
std::cerr << "Requested illegal viewer for fovy!!" << std::endl;
return viewerProperties().glState().fovy();
}
void fovy(double _fovy, int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->setFOVY( _fovy );
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
examiner_widgets_[i]->setFOVY( _fovy );
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->setFOVY( _fovy );
else
std::cerr << "Requested illegal viewer for setFOVY!!" << std::endl;
}
void setViewObjectMarker(ViewObjectMarker * _marker)
{
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
......
......@@ -311,25 +311,6 @@ ACG::Vec3d eyePos(int _viewer = ACTIVE_VIEWER);
DLLEXPORT
ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER);
/** \brief Get the current fovy value
*
* @param _viewer Id of the viewer to use.
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
DLLEXPORT
double fovy(int _viewer = ACTIVE_VIEWER);
/** \brief Set the fovy value
*
* @param _fovy The new fovy value
* @param _viewer Id of the viewer to use.
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
DLLEXPORT
void fovy(double _fovy, int _viewer = ACTIVE_VIEWER);
/** \brief Switch to orthographic Projection
*
* @param _viewer Id of the viewer to use.
......
......@@ -167,7 +167,6 @@ glViewer::glViewer( QGraphicsScene* _scene,
lookAround_ = false;
near_ = 0.1;
far_ = 100.0;
fovy_ = 45.0;
sceneGraphRoot_ = 0;
......@@ -404,7 +403,10 @@ void glViewer::updateProjectionMatrix()
else
aspect = 1.0;
glstate_->perspective(fovy_, (GLdouble) aspect,
// Get fovy
double fovy = OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
glstate_->perspective(fovy, (GLdouble) aspect,
near_, far_);
}
else
......@@ -495,14 +497,6 @@ void glViewer::lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const A
//-----------------------------------------------------------------------------
void glViewer::setFOVY(double _fovy) {
fovy_ = _fovy;
updateProjectionMatrix();
}
//-----------------------------------------------------------------------------
void glViewer::normalsMode(NormalsMode _mode)
{
makeCurrent();
......
......@@ -247,9 +247,6 @@ public:
/// Set look at transformation directly
void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up);
/// Set the field of view value
void setFOVY(double _fovy);
/// Automatically normalize normals?
enum NormalsMode {
/// use provided normals as is
......@@ -551,7 +548,7 @@ protected:
// projection stuff
GLdouble orthoWidth_;
GLdouble near_, far_, fovy_;
GLdouble near_, far_;
// helper
bool isRotating_;
......
......@@ -117,7 +117,8 @@ glViewer::drawScene_glStereo()
h = glHeight();
a = w / h;
radians = fovy_ * 0.5 / 180.0 * M_PI;
double fovy = OpenFlipperSettings().value("Core/Projection/FOVY").toDouble();
radians = fovy * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
......@@ -512,7 +513,8 @@ glViewer::drawScene_anaglyphStereo()
h = glHeight();
a = w / h;
radians = fovy_ * 0.5 / 180.0 * M_PI;
double fovy = OpenFlipperSettings().value("Core/Projection/FOVY").toDouble();
radians = fovy * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
......@@ -643,7 +645,8 @@ glViewer::drawScene_customAnaglyphStereo()
h = glHeight();
a = w / h;
radians = fovy_ * 0.5 / 180.0 * M_PI;
double fovy = OpenFlipperSettings().value("Core/Projection/FOVY").toDouble();
radians = fovy * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
......
......@@ -379,8 +379,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
// Projection settings
// Get field of view in radiant
double fov = PluginFunctions::fovy() * 180/M_PI;
fieldOfView->setValue(fov);
double fovy = OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
fieldOfView->setValue(fovy);
restrictFPS->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate",false).toBool() );
FPS->setValue( OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
......@@ -613,12 +613,10 @@ void OptionsWidget::slotApply() {
// Projection settings
double fovy = fieldOfView->value();
double old_fovy = OpenFlipperSettings().value("Core/Projection/FOV", 45.0).toDouble();
double old_fovy = OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
if(fovy != old_fovy) {
OpenFlipperSettings().setValue("Core/Projection/FOV", fovy);
// Reset projection with new fovy
PluginFunctions::fovy(fovy);
OpenFlipperSettings().setValue("Core/Projection/FOVY", fovy);
}
OpenFlipperSettings().setValue("Core/Gui/glViewer/showControlWheels", wheelBox->isChecked() );
......@@ -983,4 +981,4 @@ void OptionsWidget::slotClearINI() {
tr("The changes will take effect after next restart."));
OpenFlipper::Options::deleteIniFile(true);
}
\ No newline at end of file
}
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