Commit 8107effb authored by Mike Kremer's avatar Mike Kremer

Plugin functons now offers a function to directly set lookAt.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9012 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e706f921
......@@ -605,6 +605,19 @@ void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewe
std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl;
}
void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up, int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->lookAt(_eye,_center, _up);
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
examiner_widgets_[i]->lookAt(_eye,_center, _up);
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->lookAt(_eye,_center, _up);
else
std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl;
}
const ACG::Vec3d trackBallCenter(const ACG::Vec3d& _center, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
return examiner_widgets_[activeExaminer_]->trackBallCenter();
......
......@@ -141,6 +141,18 @@ void setMainGLContext();
DLLEXPORT
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewer = ACTIVE_VIEWER);
/** \brief Set the look at transformation directly
* @param _eye eye point
* @param _center center point
* @param _up up vector
* @param _viewer Id of the viewer to use.
* ALL_VIEWERS will set all viewers (Default)
* ACTIVE_VIEWER active viewer
* 0..3 Choose viewer explicitly
*/
DLLEXPORT
void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up, int _viewer = ACTIVE_VIEWER);
/** \brief Set the Scene position
* @param _center Center of the current scene
* @param _radius Radius of the scene ( Use scene_radius to get the current radius )
......
......@@ -457,6 +457,18 @@ void glViewer::viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up )
emit viewChanged();
}
//-----------------------------------------------------------------------------
void glViewer::lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up) {
glstate_->reset_modelview();
glstate_->lookAt(_eye, _center, _up);
scene_center_ = _center;
scene_radius_ = (scene_center_ - _eye).norm();
emit viewChanged();
}
//-----------------------------------------------------------------------------
......
......@@ -243,6 +243,9 @@ public:
/// set the viewing direction
void viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up );
/// Set look at transformation directly
void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up);
/// Automatically normalize normals?
enum NormalsMode {
......
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