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

Stuff related to the display of the primitive count removed.

parent b3bacae0
...@@ -262,42 +262,7 @@ void GLViewer::populateDisplayerFactories( DisplayableFactoryInterface *plugin ) ...@@ -262,42 +262,7 @@ void GLViewer::populateDisplayerFactories( DisplayableFactoryInterface *plugin )
for( auto &type : types ) for( auto &type : types )
if( m_Factories.find(type) == m_Factories.end() && (plugin->viewerDoF() & dof()) ) if( m_Factories.find(type) == m_Factories.end() && (plugin->viewerDoF() & dof()) )
{
m_Factories[type] = plugin; m_Factories[type] = plugin;
QStringList primNames;
plugin->primitiveNames( primNames );
foreach( QString name, primNames )
{
if( !m_PrimitiveCountMap.contains(name) )
{
PrimitiveInfo pInfo;
pInfo.count = 0;
pInfo.row = m_PrimitiveCountMap.size() % (NB_ROWS-1);
if( !pInfo.row )
{
pInfo.panel = new Panel(NB_ROWS,2,15,2);
pInfo.panel->setColAlignment( 0, Panel::LEFT );
pInfo.panel->setColAlignment( 1, Panel::RIGHT );
pInfo.panel->hideFrame();
pInfo.panel->setColMinWidth( 1, 30 );
for( unsigned int i=1; i<NB_ROWS; ++i )
pInfo.panel->set( new Label(" "), i,0 );
m_InfoBarManager->infoBar( InfoBar::BOTTOM )->append( pInfo.panel );
}
else
pInfo.panel = m_InfoBarManager->infoBar( InfoBar::BOTTOM )->panels().back();
pInfo.panel->set( new Label(name+":",QVector4D(1.0f,1.0f,1.0f,1.0f)), pInfo.row, 0 );
pInfo.panel->set( new Label("0",QVector4D(1.0f,1.0f,1.0f,1.0f)) , pInfo.row, 1 );
m_PrimitiveCountMap[ name ] = pInfo;
}
}
}
} }
...@@ -308,53 +273,6 @@ void GLViewer::populateDisplayerFactories( QList<DisplayableFactoryInterface*> & ...@@ -308,53 +273,6 @@ void GLViewer::populateDisplayerFactories( QList<DisplayableFactoryInterface*> &
} }
void GLViewer::updatePrimitiveCounts()
{
#if 0
// Reset all primitive counts to zero.
for( QMap<QString,PrimitiveInfo>::iterator prim=m_PrimitiveCountMap.begin(); prim!=m_PrimitiveCountMap.end(); ++prim )
prim->count = 0;
// Checks every displayable and update primitive counts accordingly.
for( DisplayableMap::iterator d=m_Displayables.begin(); d!=m_Displayables.end(); ++d )
{
// Recovers the factory of the current displayable.
FactoryMap::iterator factory = m_Factories.find( d->first->TypeString() );
if( factory == m_Factories.end() )
continue;
// Updates the primitive counts.
QStringList primNames;
factory->second->primitiveNames( primNames );
foreach( QString name, primNames )
m_PrimitiveCountMap[ name ].count += d->second.displayable->primitiveCount( name );
}
// Updates the display of primitive counts in the viewer UI.
for( QMap<QString,PrimitiveInfo>::iterator prim=m_PrimitiveCountMap.begin(); prim!=m_PrimitiveCountMap.end(); ++prim )
{
QString countStr;
if( prim->count )
{
countStr = "";
for( unsigned int c=prim->count; c; c/=1000 )
countStr.prepend( c<1000? QString().setNum(c) : QString().sprintf(" %03i",c%1000) );
}
else
countStr = "0";
prim->panel->set( new Label(countStr), prim->row,1 );
m_InfoBarManager->repackInfoBars();
}
#endif
}
bool GLViewer::addDisplayable( GenericUIData *m ) bool GLViewer::addDisplayable( GenericUIData *m )
{ {
// If a displayable already exists for this manageable, remove it before creating a new one. // If a displayable already exists for this manageable, remove it before creating a new one.
...@@ -430,7 +348,6 @@ bool GLViewer::addDisplayable( GenericUIData *m ) ...@@ -430,7 +348,6 @@ bool GLViewer::addDisplayable( GenericUIData *m )
} }
} }
updatePrimitiveCounts();
update(); update();
} }
...@@ -497,7 +414,6 @@ void GLViewer::updateDisplayable( GenericUIData *m, bool resetSelectionManagers ...@@ -497,7 +414,6 @@ void GLViewer::updateDisplayable( GenericUIData *m, bool resetSelectionManagers
} }
} }
updatePrimitiveCounts();
update(); update();
} }
} }
...@@ -705,7 +621,6 @@ void GLViewer::removeDisplayable( GenericUIData *m ) ...@@ -705,7 +621,6 @@ void GLViewer::removeDisplayable( GenericUIData *m )
else else
removeDisplayable_Internal( foundDisp ); removeDisplayable_Internal( foundDisp );
updatePrimitiveCounts();
update(); update();
} }
} }
...@@ -721,7 +636,6 @@ void GLViewer::removeAllDisplayables() ...@@ -721,7 +636,6 @@ void GLViewer::removeAllDisplayables()
m_AddingOrder.clear(); m_AddingOrder.clear();
updatePrimitiveCounts();
update(); update();
} }
......
...@@ -32,13 +32,6 @@ class GLViewer : public QOpenGLWidget ...@@ -32,13 +32,6 @@ class GLViewer : public QOpenGLWidget
| Internal type(s) | | Internal type(s) |
\******************/ \******************/
public: public:
struct PrimitiveInfo
{
Panel *panel;
unsigned int row;
unsigned int count;
};
struct RenderState struct RenderState
{ {
DisplayDoF DoF; DisplayDoF DoF;
...@@ -135,7 +128,6 @@ protected: ...@@ -135,7 +128,6 @@ protected:
QVBoxLayout *m_DisplayOptionsLayout; QVBoxLayout *m_DisplayOptionsLayout;
InfoBarManager *m_InfoBarManager; InfoBarManager *m_InfoBarManager;
QMap<QString,PrimitiveInfo> m_PrimitiveCountMap;
QList<DisplayableInterface*> m_AnimationStartingQueue; QList<DisplayableInterface*> m_AnimationStartingQueue;
QList<DisplayableInterface*> m_AnimationStoppingQueue; QList<DisplayableInterface*> m_AnimationStoppingQueue;
...@@ -221,7 +213,6 @@ protected: ...@@ -221,7 +213,6 @@ protected:
void mouseMotionNavigationEvent( float dx, float dy, QMouseEvent *evt ); void mouseMotionNavigationEvent( float dx, float dy, QMouseEvent *evt );
void updatePrimitiveCounts();
DisplayableMap::iterator removeDisplayable_Internal( DisplayableMap::iterator &dmapIt ); DisplayableMap::iterator removeDisplayable_Internal( DisplayableMap::iterator &dmapIt );
void displayLabel( DisplayableInterface *d ); void displayLabel( DisplayableInterface *d );
...@@ -250,6 +241,8 @@ public: ...@@ -250,6 +241,8 @@ public:
void paintGL(); void paintGL();
virtual void resizeGL( int width, int height ); virtual void resizeGL( int width, int height );
inline void setSelectionAllowed( bool selectionAllowed ) { m_IsSelectionAllowed = selectionAllowed; }
inline bool isSelectionAllowed() const { return m_IsSelectionAllowed; }
inline void setParametersDisplayed( bool displayed ) { ((QWidget*) m_DisplayOptionsLayout->parent())->setVisible( displayed ); } inline void setParametersDisplayed( bool displayed ) { ((QWidget*) m_DisplayOptionsLayout->parent())->setVisible( displayed ); }
inline bool areParametersDisplayed() const { return ((QWidget*) m_DisplayOptionsLayout->parent())->isVisible(); } inline bool areParametersDisplayed() const { return ((QWidget*) m_DisplayOptionsLayout->parent())->isVisible(); }
......
...@@ -188,8 +188,6 @@ public: ...@@ -188,8 +188,6 @@ public:
virtual DisplayDoF viewerDoF() const = 0; virtual DisplayDoF viewerDoF() const = 0;
/** Creates an instance of a displayer object with the correct type. */ /** Creates an instance of a displayer object with the correct type. */
virtual DisplayableInterface* newDisplayer( GenericUIData *m, GLViewer *v ) const = 0; virtual DisplayableInterface* newDisplayer( GenericUIData *m, GLViewer *v ) const = 0;
virtual void primitiveNames( QStringList &names ) const {}
}; };
......
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