Commit 1044b501 authored by Jan Möbius's avatar Jan Möbius

Revert mikes Scene Center Patchsvn merge -r 6139:6138 .

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6146 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 92f8a00f
......@@ -400,72 +400,29 @@ void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewe
}
void setScenePos(const double _radius, int _viewer ) {
if (_viewer == ACTIVE_VIEWER) {
examiner_widgets_[activeExaminer_]->setScenePos(_radius);
}
else if (_viewer == ALL_VIEWERS) {
for (uint i = 0; i < examiner_widgets_.size(); ++i) {
examiner_widgets_[i]->setScenePos( _radius);
}
}
else if ((_viewer >= 0) && _viewer < (int) examiner_widgets_.size()) {
examiner_widgets_[_viewer]->setScenePos(_radius);
}
else {
std::cerr << "Requested illegal viewer for setScenePos!!" << std::endl;
}
examiner_widgets_[activeExaminer_];
}
void setScenePos(int _viewer) {
if (_viewer == ACTIVE_VIEWER) {
examiner_widgets_[activeExaminer_]->setScenePos(examiner_widgets_[activeExaminer_]->scene_radius());
}
else if (_viewer == ALL_VIEWERS) {
for (uint i = 0; i < examiner_widgets_.size(); ++i) {
examiner_widgets_[i]->setScenePos(examiner_widgets_[i]->scene_radius());
}
}
else if ((_viewer >= 0) && _viewer < (int) examiner_widgets_.size()) {
examiner_widgets_[_viewer]->setScenePos(examiner_widgets_[_viewer]->scene_radius());
}
else {
std::cerr << "Requested illegal viewer for setScenePos!!" << std::endl;
}
void setScenePos(const ACG::Vec3d& _center,const double _radius, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->setScenePos( _center, _radius );
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
examiner_widgets_[i]->setScenePos( _center, _radius );
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->setScenePos( _center, _radius );
else
std::cerr << "Requested illegal viewer for setScenePos!!" << std::endl;
examiner_widgets_[activeExaminer_];
}
void setSceneCenter(const ACG::Vec3d& _center, int _viewer ) {
if (_viewer == ACTIVE_VIEWER) {
examiner_widgets_[activeExaminer_]->setSceneCenter(_center);
}
else if (_viewer == ALL_VIEWERS) {
for (uint i = 0; i < examiner_widgets_.size(); ++i) {
examiner_widgets_[i]->setSceneCenter(_center);
}
}
else if ((_viewer >= 0) && _viewer < (int) examiner_widgets_.size()) {
examiner_widgets_[_viewer]->setSceneCenter(_center);
}
else {
std::cerr << "Requested illegal viewer for setSceneCenter!!" << std::endl;
}
void setScenePos(const ACG::Vec3d& _center, int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->setScenePos( _center, examiner_widgets_[activeExaminer_]->scene_radius() );
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
examiner_widgets_[i]->setScenePos( _center, examiner_widgets_[i]->scene_radius() );
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[_viewer]->setScenePos( _center, examiner_widgets_[_viewer]->scene_radius() );
else
std::cerr << "Requested illegal viewer for setScenePos!!" << std::endl;
}
const ACG::Vec3d& sceneCenter( int _viewer ) {
......
......@@ -263,24 +263,6 @@ Viewer::ActionMode actionMode();
DLLEXPORT
void allowRotation(bool _mode);
/**
* Set eye position of scene
*/
DLLEXPORT
void setScenePos(const double _radius, int _viewer );
/**
* Calculate and set eye position of scene
*/
DLLEXPORT
void setScenePos(int _viewer);
/**
* Set center of scene
*/
DLLEXPORT
void setSceneCenter(const ACG::Vec3d& _center, int _viewer );
/** \brief Map coordinates of GL Widget to global coordinates
*
*/
......
......@@ -389,7 +389,7 @@ private:
int loadObject ( QString _filename );
/// Do a reset of the scenegraph (bounding box update,...)
void resetScenegraph(bool _updateCenter = false);
void resetScenegraph();
public :
......
......@@ -45,13 +45,13 @@
#include <time.h>
void Core::resetScenegraph(bool _updateCenter) {
void Core::resetScenegraph() {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() ) {
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
// update scene graph (get new bounding box and set projection right, including near and far plane)
PluginFunctions::viewerProperties(i).lockUpdate();
coreWidget_->examiner_widgets_[i]->sceneGraph(root_node_scenegraph_, _updateCenter);
coreWidget_->examiner_widgets_[i]->sceneGraph(root_node_scenegraph_);
PluginFunctions::viewerProperties(i).unLockUpdate();
coreWidget_->examiner_widgets_[i]->updateGL();
}
......@@ -231,9 +231,8 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
if ( _id < 0 )
_id = -1;
else
if ( OpenFlipper::Options::gui() ) {
if ( OpenFlipper::Options::gui() )
coreWidget_->addRecent(_filename,_type);
}
}
/// Slot gets called after a file-plugin has opened an object
......@@ -293,7 +292,7 @@ void Core::slotObjectOpened ( int _id ) {
// ================================================================================
// Recompute bounding box and scenegraph info
// ================================================================================
resetScenegraph(true);
resetScenegraph();
// ================================================================================
// Tell plugins, that a file has been opened
......
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="8" >
<DocsAndViews NumberOfDocuments="16" >
<Doc0 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TextureControl/TextureData.cc" >
<View0 Encoding="" Type="Source" />
</Doc0>
......@@ -14,18 +14,42 @@
<Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/ACG/Scenegraph/EnvMapNode.hh" >
<View0 Encoding="" Type="Source" />
</Doc3>
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/openFunctions.cc" >
<View0 Encoding="" Type="Source" />
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/Core.hh" >
<View0 Encoding="" line="206" Type="Source" />
</Doc4>
<Doc5 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/Core.hh" >
<View0 Encoding="" Type="Source" />
<Doc5 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/ParseObj.cc" >
<View0 Encoding="" line="0" Type="Source" />
</Doc5>
<Doc6 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/ParseObj.cc" >
<View0 Encoding="" Type="Source" />
<Doc6 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/BasePlugin/INIInterface.hh" >
<View0 Encoding="" line="143" Type="Source" />
</Doc6>
<Doc7 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/glWidget/QtBaseViewer.cc" >
<View0 Encoding="" line="387" Type="Source" />
<Doc7 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/DataControlPlugin.hh" >
<View0 Encoding="" line="85" Type="Source" />
</Doc7>
<Doc8 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Datacontrol/DataControlPlugin.cc" >
<View0 Encoding="" line="749" Type="Source" />
</Doc8>
<Doc9 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/PluginLoader.cc" >
<View0 Encoding="" line="772" Type="Source" />
</Doc9>
<Doc10 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/ParseIni.cc" >
<View0 Encoding="" line="553" Type="Source" />
</Doc10>
<Doc11 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/saveSettings.cc" >
<View0 Encoding="" line="217" Type="Source" />
</Doc11>
<Doc12 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/Core/Core.cc" >
<View0 Encoding="" line="865" Type="Source" />
</Doc12>
<Doc13 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/ContextMenu.cc" >
<View0 Encoding="" line="201" Type="Source" />
</Doc13>
<Doc14 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/glWidget/QtBaseViewer.cc" >
<View0 Encoding="" line="615" Type="Source" />
</Doc14>
<Doc15 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/MenuBar.cc" >
<View0 Encoding="" line="316" Type="Source" />
</Doc15>
</DocsAndViews>
<pluginList>
<kdevdebugger>
......
......@@ -244,7 +244,7 @@ void glViewer::swapBuffers() {
//-----------------------------------------------------------------------------
void glViewer::sceneGraph(ACG::SceneGraph::BaseNode* _root, bool _updateCenter)
void glViewer::sceneGraph(ACG::SceneGraph::BaseNode* _root)
{
// if (sceneGraphRoot_ == _root)
// return;
......@@ -262,21 +262,11 @@ void glViewer::sceneGraph(ACG::SceneGraph::BaseNode* _root, bool _updateCenter)
if ( ( bbmin[0] > bbmax[0] ) ||
( bbmin[1] > bbmax[1] ) ||
( bbmin[2] > bbmax[2] ) ) {
setScenePos( 1.0 );
if(_updateCenter) {
setSceneCenter( ACG::Vec3d( 0.0,0.0,0.0 ) );
}
} else {
setScenePos( (bbmax - bbmin).norm() * 0.5 );
if(_updateCenter) {
setSceneCenter( (bbmin + bbmax)* 0.5);
}
}
( bbmin[2] > bbmax[2] ) )
setScenePos( ACG::Vec3d( 0.0,0.0,0.0 ) , 1.0 );
else
setScenePos( ( bbmin + bbmax ) * 0.5,
( bbmax - bbmin ).norm() * 0.5 );
}
updateGL();
......@@ -372,34 +362,23 @@ void glViewer::updateProjectionMatrix()
//-----------------------------------------------------------------------------
void glViewer::setScenePos(double _radius)
void glViewer::setScenePos(const ACG::Vec3d& _center, double _radius)
{
scene_radius_ = trackball_radius_ = _radius;
scene_center_ = trackball_center_ = _center;
scene_radius_ = trackball_radius_ = _radius;
orthoWidth_ = 2.0 * scene_radius_;
near_ = 0.001 * scene_radius_;
far_ = 10.0 * scene_radius_;
orthoWidth_ = 2.0 * scene_radius_;
near_ = 0.001 * scene_radius_;
far_ = 10.0 * scene_radius_;
updateProjectionMatrix();
updateGL();
}
//----------------------------------------------------------------------------
void glViewer::setSceneCenter(const ACG::Vec3d& _center)
{
scene_center_ = trackball_center_ = _center;
updateProjectionMatrix();
updateGL();
updateProjectionMatrix();
updateGL();
}
//----------------------------------------------------------------------------
void glViewer::viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up )
{
// calc eye point for this direction
......
......@@ -178,7 +178,7 @@ public:
The \c sceneGraphToched() signal will be emitted (even if
\c _root does not actually change).
*/
void sceneGraph(ACG::SceneGraph::BaseNode* _root, bool _updateCenter = false);
void sceneGraph(ACG::SceneGraph::BaseNode* _root);
/// projection mode
......@@ -193,16 +193,11 @@ public:
ProjectionMode projectionMode() const { return projectionMode_; }
/** Sets the dimension of the whole scene. It sets the eye point far
/** Sets the center and dimension of the whole scene. This point is
used as fixpoint for rotations and to set the eye point far
enough from the scene so that the whole scene is visible.
*/
void setScenePos( double _radius );
/** Sets the center of the whole scene. This point is
used as fixpoint for rotation.
*/
void setSceneCenter( const ACG::Vec3d& _center );
void setScenePos( const ACG::Vec3d& _center, double _radius );
/** 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