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

New PluginFunctions for trackball handling

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7223 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3c1bdcfa
......@@ -554,7 +554,30 @@ void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewe
std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl;
}
//TODO: Make use of trackball center instead of scene center
const ACG::Vec3d trackBallCenter(const ACG::Vec3d& _center, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
return examiner_widgets_[activeExaminer_]->trackBallCenter();
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
return examiner_widgets_[i]->trackBallCenter( );
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
return examiner_widgets_[_viewer]->trackBallCenter( );
else
std::cerr << "Requested illegal viewer for setTrackBallCenter!!" << std::endl;
}
void setTrackBallCenter(const ACG::Vec3d& _center, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->setTrackBallCenter( _center );
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
examiner_widgets_[i]->setTrackBallCenter( _center );
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->setTrackBallCenter( _center );
else
std::cerr << "Requested illegal viewer for setTrackBallCenter!!" << std::endl;
}
void setScenePos(const ACG::Vec3d& _center,const double _radius, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->setScenePos( _center, _radius );
......@@ -565,7 +588,6 @@ void setScenePos(const ACG::Vec3d& _center,const double _radius, int _viewer ) {
examiner_widgets_[_viewer]->setScenePos( _center, _radius );
else
std::cerr << "Requested illegal viewer for setScenePos!!" << std::endl;
examiner_widgets_[activeExaminer_];
}
void setScenePos(const ACG::Vec3d& _center, int _viewer ) {
......
......@@ -151,6 +151,31 @@ void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _view
DLLEXPORT
void setScenePos(const ACG::Vec3d& _center, const double _radius , int _viewer = ALL_VIEWERS);
/** \brief Set the trackball Center
*
* The scene is rotated around the trackball center when using the mouse
*
* @param _center Center of the trackball
* @param _viewer Id of the viewer to use.
* ALL_VIEWERS will set all viewers (Default)
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
void setTrackBallCenter(const ACG::Vec3d& _center, int _viewer );
/** \brief Get the trackball Center
*
* The scene is rotated around the trackball center when using the mouse
*
* @param _center Center of the trackball
* @param _viewer Id of the viewer to use.
* ALL_VIEWERS will set all viewers (Default)
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
const ACG::Vec3d trackBallCenter(const ACG::Vec3d& _center, int _viewer );
/** \brief Set the scene position
*
* Same as setScenePos(const ACG::Vec3d& _center, double _radius) but reuses the current radius
......
......@@ -422,7 +422,14 @@ void glViewer::setScenePos(const ACG::Vec3d& _center, double _radius, const bool
void glViewer::setSceneCenter( const ACG::Vec3d& _center ) {
scene_center_ = trackball_center_ = _center;
scene_center_ = _center;
}
//-----------------------------------------------------------------------------
void glViewer::setTrackBallCenter( const ACG::Vec3d& _center ) {
trackball_center_ = _center;
}
//----------------------------------------------------------------------------
......
......@@ -216,6 +216,18 @@ public:
* Set new center point of scene
*/
void setSceneCenter( const ACG::Vec3d& _center );
/** \brief Set Trackball Center point of scene
*
* The scene is rotated around the trackball center when using the mouse
*/
void setTrackBallCenter( const ACG::Vec3d& _center );
/** \brief Get Trackball Center point of scene
*
* The scene is rotated around the trackball center when using the mouse
*/
const ACG::Vec3d trackBallCenter( ) { return trackball_center_; };
/** Get scene's center
\see setScenePos()
......
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