Commit 627488cb authored by Mike Kremer's avatar Mike Kremer

Added scripting function to set FOVY via view control plugin.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10373 383ad7c9-94d9-4d36-a494-682f7c89f535
parent ae734aca
...@@ -631,6 +631,19 @@ void orthographicProjection( int _viewer ) { ...@@ -631,6 +631,19 @@ void orthographicProjection( int _viewer ) {
std::cerr << "Requested illegal viewer for orthographicProjection()!!" << std::endl; std::cerr << "Requested illegal viewer for orthographicProjection()!!" << std::endl;
} }
void setFOVY( 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 allowRotation(bool _mode, int _viewer ) { void allowRotation(bool _mode, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) { if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->allowRotation(_mode); examiner_widgets_[activeExaminer_]->allowRotation(_mode);
......
...@@ -320,6 +320,17 @@ ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER); ...@@ -320,6 +320,17 @@ ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER);
DLLEXPORT DLLEXPORT
void orthographicProjection( int _viewer = ALL_VIEWERS ); void orthographicProjection( int _viewer = ALL_VIEWERS );
/** \brief Set field of view angle
*
* @param _fovy Field of view (in (1, 180) degrees)
* @param _viewer Id of the viewer to use.
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
DLLEXPORT
void setFOVY( double _fovy, int _viewer = ALL_VIEWERS );
/** \brief Switch to perspective Projection /** \brief Switch to perspective Projection
* *
* @param _viewer Id of the viewer to use. * @param _viewer Id of the viewer to use.
......
...@@ -383,6 +383,17 @@ void glViewer::navigationMode(NavigationMode _n) ...@@ -383,6 +383,17 @@ void glViewer::navigationMode(NavigationMode _n)
emit navigationModeChanged( false ); emit navigationModeChanged( false );
} }
void glViewer::setFOVY(double _fovy) {
if(_fovy <= 0.0 || _fovy >= 180) {
std::cerr << "Error: Minimum or maximum fovy angle exceeded!" << std::endl;
return;
}
OpenFlipperSettings().setValue("Core/Projection/FOVY", _fovy);
updateProjectionMatrix();
}
void glViewer::updateProjectionMatrix() void glViewer::updateProjectionMatrix()
{ {
......
...@@ -371,6 +371,9 @@ public slots: ...@@ -371,6 +371,9 @@ public slots:
/// toggle navigation mode /// toggle navigation mode
virtual void toggleNavigationMode(); virtual void toggleNavigationMode();
/// Set fovy
virtual void setFOVY(double _fovy);
signals: signals:
void projectionModeChanged( bool _ortho ); void projectionModeChanged( bool _ortho );
......
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