Commit be7648fc authored by Frédéric Larue's avatar Frédéric Larue

Function to recover the scene bounding box added to GLViewer.

parent 4a558998
......@@ -545,26 +545,28 @@ void GLViewer::frameItems( QList<GenericUIData*> &items )
void GLViewer::frameAll()
{
if( !m_Displayables.empty() )
{
Box3f box;
frameBox( sceneBox() );
}
for( DisplayableMap::iterator dispInfo=m_Displayables.begin(); dispInfo!=m_Displayables.end(); ++dispInfo )
{
Box3f objectBox;
dispInfo->second.displayable->boundingBox( objectBox );
if( !objectBox.IsNull() )
{
Box3f::CornerSet objectBoxCorners;
objectBox.Corners( objectBoxCorners );
Box3f GLViewer::sceneBox() const
{
Box3f box;
for( auto c=objectBoxCorners.begin(); c!=objectBoxCorners.end(); ++c )
box.Add( dispInfo->second.GetTransform().map(*c) );
}
}
for( auto &dispInfo : m_Displayables )
{
const Box3f &objectBox = dispInfo.second.boundingBox;
if( !objectBox.IsNull() )
{
Box3f::CornerSet objectBoxCorners;
objectBox.Corners( objectBoxCorners );
frameBox( box );
for( auto &c : objectBoxCorners )
box.Add( dispInfo.second.GetTransform().map(c) );
}
}
return box;
}
......
......@@ -362,6 +362,7 @@ public:
virtual void frameItem( GenericUIData* item );
virtual void frameItems( QList<GenericUIData*> &items );
virtual void frameAll();
Box3f sceneBox() const;
inline bool isSelectionEnabled() const { return m_SelectionEnabled; }
inline const SelectionTool& currentSelectionTool() const { return *m_SelectionCurrentTool; }
......
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