From b9c7612ade8ad31a3486a12b982cbb8a9ef7cca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 28 Sep 2010 15:15:09 +0000 Subject: [PATCH] Removed gridnode from core, added function to set glstate bounding box git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10132 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Core/Core.cc | 4 ---- Core/Core.hh | 4 ---- widgets/glWidget/QtBaseViewer.cc | 15 +++++++++++++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Core/Core.cc b/Core/Core.cc index 37c50413..6e99c2fd 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -150,10 +150,6 @@ Core() : // seperator handling the nodes for data dataRootNode_ = new ACG::SceneGraph::SeparatorNode(dataSeparatorNode_, "Data Root Node"); - - -// gridNode_ = new ACG::SceneGraph::GridNode(core_nodes_,"Grid Node"); -// gridNode_->hide(); // Add ViewMode All ViewMode* vm = new ViewMode(); diff --git a/Core/Core.hh b/Core/Core.hh index fbcf91b9..6a582a53 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -107,7 +107,6 @@ #include #include -#include #include @@ -766,9 +765,6 @@ private slots: /// Node for the coordinate system ACG::SceneGraph::CoordsysNode* coordsysNode_; - /// Node for the grid -// ACG::SceneGraph::GridNode* gridNode_; - /** @} */ //=========================================================================== diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc index ed402b6c..dba53048 100644 --- a/widgets/glWidget/QtBaseViewer.cc +++ b/widgets/glWidget/QtBaseViewer.cc @@ -280,13 +280,24 @@ void glViewer::sceneGraph(ACG::SceneGraph::BaseNode* _root, const bool _resetTra if ( ( bbmin[0] > bbmax[0] ) || ( bbmin[1] > bbmax[1] ) || - ( bbmin[2] > bbmax[2] ) ) + ( bbmin[2] > bbmax[2] ) ) { + + // Invalid bounding box, try to recover setScenePos( ACG::Vec3d( 0.0,0.0,0.0 ) , 1.0, _resetTrackBall ); - else + + // Update bounding box to match the scene geometry after recovery + bbmin = ACG::Vec3d(-1.0,-1.0,-1.0); + bbmax = ACG::Vec3d( 1.0, 1.0, 1.0); + } else setScenePos( ( bbmin + bbmax ) * 0.5, ( bbmax - bbmin ).norm() * 0.5, _resetTrackBall); + + // remember the new bounding box for the state + glstate_->set_bounding_box(bbmin,bbmax); + } + updateGL(); -- GitLab