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

Display state of mesh boundary edges now stored in GLViewer and controlled by...

Display state of mesh boundary edges now stored in GLViewer and controlled by toolbar buttons in UIMainWindow.
parent 94ff822d
......@@ -253,10 +253,11 @@ void GLViewer::init( DisplayDoF dof )
m_View.lightRotationMatrix.setToIdentity();
m_View.isLightTrackingEnabled = true;
m_View.isLightingEnabled = true;
m_View.isWireframeEnabled = false;
m_View.isFlatShaded = false;
m_View.isLightTrackingEnabled = true;
m_View.isLightingEnabled = true;
m_View.isWireframeEnabled = false;
m_View.isFlatShaded = false;
m_View.areBoundaryEdgesVisible = false;
m_AnimationsRunningAtPreviousFrame = false;
......@@ -2764,6 +2765,20 @@ void GLViewer::setFlatShading( bool enabled )
}
void GLViewer::setBoundaryEdgesVisible( bool visible )
{
if( visible != m_View.areBoundaryEdgesVisible )
toggleBoundaryEdgeVisibility();
}
void GLViewer::toggleBoundaryEdgeVisibility()
{
m_View.areBoundaryEdgesVisible = !m_View.areBoundaryEdgesVisible;
update();
}
void GLViewer::setLightingEnabled( const bool enabled )
{
if( m_View.isLightingEnabled != enabled )
......
......@@ -53,6 +53,7 @@ public:
bool isLightingEnabled;
bool isLightTrackingEnabled;
bool isCullingEnabled;
bool areBoundaryEdgesVisible;
MetricGrid metricGrid2D;
MetricGrid metricGrid3D;
......@@ -360,6 +361,7 @@ public:
inline bool isLightingEnabled() const { return m_View.isLightingEnabled; }
inline bool isWireframeEnabled() const { return m_View.isWireframeEnabled; }
inline bool isFlatShaded() const { return m_View.isFlatShaded; }
inline bool areBoundaryEdgesVisible() const { return m_View.areBoundaryEdgesVisible; }
inline bool isCullingEnabled() const { return m_View.isCullingEnabled; }
inline bool isLightTrackingEye() const { return m_View.isLightTrackingEnabled; }
......@@ -499,6 +501,8 @@ public slots:
inline void setSolidEnabled( const bool enabled ) { setWireframeEnabled(!enabled); }
void setFlatShading( bool enabled = true );
inline void setSmoothShading( bool enabled = true ) { setFlatShading(!enabled); }
void setBoundaryEdgesVisible( bool visible );
void toggleBoundaryEdgeVisibility();
void setLightingEnabled( const bool enabled );
void setLightTrackingEnabled( const bool enabled );
void toggleWireframe();
......
......@@ -265,17 +265,22 @@ void UIMainWindow::init()
connect( m_CurrentViewer, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(keyPressedInGLViewer(QKeyEvent*)) );
connect( ui->actionCustomizeTheme, SIGNAL(triggered()), this, SLOT(showThemeSettingsDialog()) );
connect( ui->actionBoundaryEdges, SIGNAL(toggled(bool)), this, SLOT(toggleBoundaryEdgesVisibility(bool)) );
ui->actionBoundaryEdges->setChecked( m_CurrentViewer->areBoundaryEdgesVisible() );
connect( ui->actionToggleLighting, SIGNAL(toggled(bool)), this, SLOT(toggleLighting(bool)) );
connect( m_CurrentViewer, SIGNAL(lightingToggled(bool)), ui->actionToggleLighting, SLOT(setChecked(bool)) );
ui->actionToggleLighting->setChecked( true );
ui->actionToggleLighting->setChecked( m_CurrentViewer->isLightingEnabled() );
connect( ui->actionShadingSmooth, SIGNAL(triggered()), this, SLOT(toShadingFlat()) );
connect( ui->actionShadingFlat, SIGNAL(triggered()), this, SLOT(toShadingSmooth()) );
ui->actionShadingFlat->setVisible( false );
ui->actionShadingFlat->setVisible( m_CurrentViewer->isFlatShaded() );
ui->actionShadingSmooth->setVisible( !m_CurrentViewer->isFlatShaded() );
connect( ui->actionWireframeMode, SIGNAL(triggered()), this, SLOT(toSolidMode()) );
connect( ui->actionSolidMode, SIGNAL(triggered()), this, SLOT(toWireframeMode()) );
ui->actionWireframeMode->setVisible( false );
ui->actionWireframeMode->setVisible( m_CurrentViewer->isWireframeEnabled() );
ui->actionSolidMode->setVisible( !m_CurrentViewer->isWireframeEnabled() );
connect( ui->tableCurrentProjContent, SIGNAL(contentDropped(QDropEvent*)), this, SLOT(tableItemsContentDropped(QDropEvent*)) );
connect( ui->tableCurrentProjContent, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(modifyItem(QTreeWidgetItem*,int)) );
......@@ -1568,6 +1573,13 @@ void UIMainWindow::toggleLighting( bool enabled )
m_CurrentViewer->setLightingEnabled( enabled );
}
void UIMainWindow::toggleBoundaryEdgesVisibility( bool enabled )
{
m_CurrentViewer->setBoundaryEdgesVisible( enabled );
}
void UIMainWindow::launchExport( ExportInterface *exportPlugIn,
int id,
const QString &name )
......
......@@ -187,6 +187,7 @@ public slots:
void toShadingSmooth();
void toShadingFlat();
void toggleLighting( bool enabled );
void toggleBoundaryEdgesVisibility( bool enabled );
void giveSelectionToTool();
......
......@@ -114,6 +114,7 @@
<addaction name="actionShadingFlat"/>
<addaction name="actionSolidMode"/>
<addaction name="actionWireframeMode"/>
<addaction name="actionBoundaryEdges"/>
<addaction name="actionDecreasePointSize"/>
<addaction name="actionIncreasePointSize"/>
<addaction name="separator"/>
......@@ -851,7 +852,7 @@
<normaloff>:/images/resources/iconShadingSmooth.png</normaloff>:/images/resources/iconShadingSmooth.png</iconset>
</property>
<property name="text">
<string>ShadingSmooth</string>
<string>Shading smooth</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Current shading mode: &lt;span style=&quot; font-weight:600;&quot;&gt;Smooth&lt;/span&gt; (click for flat shading)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
......@@ -863,12 +864,23 @@
<normaloff>:/images/resources/iconShadingFlat.png</normaloff>:/images/resources/iconShadingFlat.png</iconset>
</property>
<property name="text">
<string>ShadingFlat</string>
<string>Shading flat</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Current shading mode: &lt;span style=&quot; font-weight:600;&quot;&gt;Flat&lt;/span&gt; (click for smooth shading)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</action>
<action name="actionBoundaryEdges">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show/hide boundary edges</string>
</property>
<property name="toolTip">
<string>Show/hide boundary edges</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......
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