Commit 038b8c37 authored by Pierre Kraemer's avatar Pierre Kraemer

surface render: boundary + cage generation voxellisation update

parent 130a4ba4
......@@ -42,3 +42,4 @@ TARGET_LINK_LIBRARIES( SCHNAppsD
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../SCHNAppsPlugins ExtPluginsD)
......@@ -86,7 +86,7 @@
<item row="2" column="0" colspan="2">
<widget class="Line" name="line"/>
</item>
<item row="8" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -131,6 +131,13 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="check_renderBoundary">
<property name="text">
<string>render boundary</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
......@@ -41,6 +41,7 @@ struct MapParameters
bool renderVertices;
bool renderEdges;
bool renderFaces;
bool renderBoundary;
FaceShadingStyle faceStyle;
};
......@@ -86,6 +87,7 @@ private slots:
void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo);
public slots:
// slots for Python calls
void changePositionVBO(const QString& view, const QString& map, const QString& vbo);
......@@ -95,6 +97,7 @@ public slots:
void changeRenderEdges(const QString& view, const QString& map, bool b);
void changeRenderFaces(const QString& view, const QString& map, bool b);
void changeFacesStyle(const QString& view, const QString& map, MapParameters::FaceShadingStyle style);
void changeRenderBoundary(const QString& view, const QString& map, bool b);
protected:
Surface_Render_DockTab* m_dockTab;
......
......@@ -36,6 +36,7 @@ private slots:
void renderEdgesChanged(bool b);
void renderFacesChanged(bool b);
void faceStyleChanged(QAbstractButton* b);
void renderBoundaryChanged(bool b);
private:
void addPositionVBO(QString name);
......
......@@ -25,8 +25,6 @@ bool Surface_Render_Plugin::enable()
m_phongShader->setShininess(80.0f) ;
m_simpleColorShader = new CGoGN::Utils::ShaderSimpleColor();
CGoGN::Geom::Vec4f c(0.1f, 0.1f, 0.1f, 1.0f);
m_simpleColorShader->setColor(c);
m_pointSprite = new CGoGN::Utils::PointSprite();
......@@ -79,6 +77,8 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
if(p.renderEdges)
{
glLineWidth(1.0f);
CGoGN::Geom::Vec4f c(0.1f, 0.1f, 0.1f, 1.0f);
m_simpleColorShader->setColor(c);
m_simpleColorShader->setAttributePosition(p.positionVBO);
map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES);
}
......@@ -105,6 +105,14 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
}
glDisable(GL_POLYGON_OFFSET_FILL);
}
if(p.renderBoundary)
{
glLineWidth(5.0f);
CGoGN::Geom::Vec4f c(0.8f, 0.8f, 0.1f, 1.0f);
m_simpleColorShader->setColor(c);
m_simpleColorShader->setAttributePosition(p.positionVBO);
map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::BOUNDARY);
}
}
}
......@@ -300,6 +308,21 @@ void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString&
}
}
void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QString& map, bool b)
{
View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m)
{
h_viewParameterSet[v][m].renderBoundary = b;
if(v->isSelectedView())
{
if(v->isLinkedToMap(m)) v->updateGL();
if(m->isSelectedMap()) m_dockTab->updateMapParameters();
}
}
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2(Surface_Render_Plugin, Surface_Render_Plugin)
#else
......
......@@ -24,6 +24,7 @@ Surface_Render_DockTab::Surface_Render_DockTab(SCHNApps* s, Surface_Render_Plugi
connect(check_renderEdges, SIGNAL(toggled(bool)), this, SLOT(renderEdgesChanged(bool)));
connect(check_renderFaces, SIGNAL(toggled(bool)), this, SLOT(renderFacesChanged(bool)));
connect(group_faceShading, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(faceStyleChanged(QAbstractButton*)));
connect(check_renderBoundary, SIGNAL(toggled(bool)), this, SLOT(renderBoundaryChanged(bool)));
}
......@@ -131,6 +132,20 @@ void Surface_Render_DockTab::faceStyleChanged(QAbstractButton* b)
}
}
void Surface_Render_DockTab::renderBoundaryChanged(bool b)
{
if(!b_updatingUI)
{
View* view = m_schnapps->getSelectedView();
MapHandlerGen* map = m_schnapps->getSelectedMap();
if(view && map)
{
m_plugin->h_viewParameterSet[view][map].renderBoundary = b;
view->updateGL();
}
}
}
......
......@@ -42,3 +42,4 @@ TARGET_LINK_LIBRARIES( SCHNApps
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../SCHNAppsPlugins ExtPlugins)
......@@ -116,6 +116,7 @@ public:
m_render->setPrimitiveDirty(Algo::Render::GL2::POINTS);
m_render->setPrimitiveDirty(Algo::Render::GL2::LINES);
m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES);
m_render->setPrimitiveDirty(Algo::Render::GL2::BOUNDARY);
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
......
......@@ -32,6 +32,7 @@
#include <utility>
#include "Algo/Geometry/normal.h"
#include "Topology/generic/autoAttributeHandler.h"
namespace CGoGN
{
......
This diff is collapsed.
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