Commit c4a807a7 authored by Pierre Kraemer's avatar Pierre Kraemer

uniformize per map parameters management in plugins

parent 63ee02b0
...@@ -49,7 +49,7 @@ struct ParameterSet ...@@ -49,7 +49,7 @@ struct ParameterSet
ParameterSet() : selectedMap(NULL) ParameterSet() : selectedMap(NULL)
{} {}
QHash<QString, PerMapParameterSet> perMap; QHash<QString, PerMapParameterSet*> perMap;
MapHandlerGen* selectedMap; MapHandlerGen* selectedMap;
}; };
...@@ -97,10 +97,17 @@ public slots: ...@@ -97,10 +97,17 @@ public slots:
void mapLinked(MapHandlerGen* m); void mapLinked(MapHandlerGen* m);
void mapUnlinked(MapHandlerGen* m); void mapUnlinked(MapHandlerGen* m);
protected:
void addManagedMap(View *v, MapHandlerGen* m);
void removeManagedMap(View *v, MapHandlerGen* m);
public slots:
void vboAdded(Utils::VBO* vbo); void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo);
void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false); void changeSelectedMap(View* view, MapHandlerGen* map);
void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false); void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false);
void changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false); void changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false);
void changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI = false); void changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _RENDER_DOCK_TAB_H_ #define _RENDER_DOCK_TAB_H_
#include "ui_render.h" #include "ui_render.h"
#include "Utils/vbo.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -30,8 +31,7 @@ public slots: ...@@ -30,8 +31,7 @@ public slots:
void refreshUI(ParameterSet* params); void refreshUI(ParameterSet* params);
void selectedMapChanged(); void selectedMapChanged();
void addVBOToList(QString name);
void removeVBOFromList(QString name);
void positionVBOChanged(int index); void positionVBOChanged(int index);
void normalVBOChanged(int index); void normalVBOChanged(int index);
void renderVerticesChanged(bool b); void renderVerticesChanged(bool b);
...@@ -39,6 +39,8 @@ public slots: ...@@ -39,6 +39,8 @@ public slots:
void renderEdgesChanged(bool b); void renderEdgesChanged(bool b);
void renderFacesChanged(bool b); void renderFacesChanged(bool b);
void faceStyleChanged(QAbstractButton* b); void faceStyleChanged(QAbstractButton* b);
void addVBOToList(Utils::VBO* vbo);
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -92,40 +92,40 @@ void RenderPlugin::redraw(View* view) ...@@ -92,40 +92,40 @@ void RenderPlugin::redraw(View* view)
const QList<MapHandlerGen*>& maps = view->getLinkedMaps(); const QList<MapHandlerGen*>& maps = view->getLinkedMaps();
foreach(MapHandlerGen* m, maps) foreach(MapHandlerGen* m, maps)
{ {
const PerMapParameterSet& p = params->perMap[m->getName()]; PerMapParameterSet* p = params->perMap[m->getName()];
if(p.positionVBO != NULL) if(p->positionVBO != NULL)
{ {
if(p.renderVertices) if(p->renderVertices)
{ {
m_pointSprite->setSize(m->getBBdiagSize() / 200.0f * p.verticesScaleFactor); m_pointSprite->setSize(m->getBBdiagSize() / 200.0f * p->verticesScaleFactor);
m_pointSprite->setAttributePosition(p.positionVBO); m_pointSprite->setAttributePosition(p->positionVBO);
m_pointSprite->predraw(CGoGN::Geom::Vec3f(0.0f, 0.0f, 1.0f)); m_pointSprite->predraw(CGoGN::Geom::Vec3f(0.0f, 0.0f, 1.0f));
m->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS); m->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS);
m_pointSprite->postdraw(); m_pointSprite->postdraw();
} }
if(p.renderEdges) if(p->renderEdges)
{ {
glLineWidth(1.0f); glLineWidth(1.0f);
m_simpleColorShader->setAttributePosition(p.positionVBO); m_simpleColorShader->setAttributePosition(p->positionVBO);
m->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES); m->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES);
} }
if(p.renderFaces) if(p->renderFaces)
{ {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, 1.0f); glPolygonOffset(1.0f, 1.0f);
switch(p.faceStyle) switch(p->faceStyle)
{ {
case FLAT : case FLAT :
m_flatShader->setAttributePosition(p.positionVBO); m_flatShader->setAttributePosition(p->positionVBO);
m->draw(m_flatShader, CGoGN::Algo::Render::GL2::TRIANGLES); m->draw(m_flatShader, CGoGN::Algo::Render::GL2::TRIANGLES);
break ; break ;
case PHONG : case PHONG :
if(p.normalVBO != NULL) if(p->normalVBO != NULL)
{ {
m_phongShader->setAttributePosition(p.positionVBO) ; m_phongShader->setAttributePosition(p->positionVBO) ;
m_phongShader->setAttributeNormal(p.normalVBO) ; m_phongShader->setAttributeNormal(p->normalVBO) ;
m->draw(m_phongShader, CGoGN::Algo::Render::GL2::TRIANGLES); m->draw(m_phongShader, CGoGN::Algo::Render::GL2::TRIANGLES);
} }
break ; break ;
...@@ -142,14 +142,10 @@ void RenderPlugin::viewLinked(View* view, Plugin* plugin) ...@@ -142,14 +142,10 @@ void RenderPlugin::viewLinked(View* view, Plugin* plugin)
{ {
ParameterSet* params = new ParameterSet(); ParameterSet* params = new ParameterSet();
h_viewParams.insert(view, params); h_viewParams.insert(view, params);
const QList<MapHandlerGen*>& maps = view->getLinkedMaps(); const QList<MapHandlerGen*>& maps = view->getLinkedMaps();
foreach(MapHandlerGen* map, maps) foreach(MapHandlerGen* mh, maps)
{ addManagedMap(view, mh);
PerMapParameterSet p(map);
params->perMap.insert(map->getName(), p);
}
if (!maps.empty())
changeSelectedMap(view, maps[0]);
connect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*))); connect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*)));
connect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*))); connect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*)));
...@@ -163,6 +159,12 @@ void RenderPlugin::viewUnlinked(View* view, Plugin* plugin) ...@@ -163,6 +159,12 @@ void RenderPlugin::viewUnlinked(View* view, Plugin* plugin)
{ {
if(plugin == this) if(plugin == this)
{ {
const QList<MapHandlerGen*>& maps = view->getLinkedMaps();
foreach(MapHandlerGen* mh, maps)
removeManagedMap(view, mh);
ParameterSet* params = h_viewParams[view];
delete params;
h_viewParams.remove(view); h_viewParams.remove(view);
disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*))); disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*)));
...@@ -173,68 +175,62 @@ void RenderPlugin::viewUnlinked(View* view, Plugin* plugin) ...@@ -173,68 +175,62 @@ void RenderPlugin::viewUnlinked(View* view, Plugin* plugin)
void RenderPlugin::currentViewChanged(View* view) void RenderPlugin::currentViewChanged(View* view)
{ {
if(isLinkedToView(view)) if(isLinkedToView(view))
{
ParameterSet* params = h_viewParams[view];
changeSelectedMap(view, params->selectedMap);
m_dockTab->refreshUI(h_viewParams[view]); m_dockTab->refreshUI(h_viewParams[view]);
}
} }
void RenderPlugin::mapLinked(MapHandlerGen* m) void RenderPlugin::mapLinked(MapHandlerGen* m)
{ {
View* view = static_cast<View*>(QObject::sender()); View* view = static_cast<View*>(QObject::sender());
assert(isLinkedToView(view)); assert(isLinkedToView(view));
addManagedMap(view, m);
}
void RenderPlugin::mapUnlinked(MapHandlerGen* m)
{
View* view = static_cast<View*>(QObject::sender());
assert(isLinkedToView(view));
removeManagedMap(view, m);
}
void RenderPlugin::addManagedMap(View* v, MapHandlerGen *m)
{
// connect(m, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString)));
// connect(m, SIGNAL(connectivityModified()), this, SLOT(connectivityModified()));
ParameterSet* params = h_viewParams[v];
PerMapParameterSet* perMap = new PerMapParameterSet(m);
params->perMap.insert(m->getName(), perMap);
ParameterSet* params = h_viewParams[view];
PerMapParameterSet p(m);
params->perMap.insert(m->getName(), p);
if(params->selectedMap == NULL || params->perMap.count() == 1) if(params->selectedMap == NULL || params->perMap.count() == 1)
changeSelectedMap(view, m); changeSelectedMap(v, m);
else else
m_dockTab->refreshUI(params); m_dockTab->refreshUI(params);
} }
void RenderPlugin::mapUnlinked(MapHandlerGen* m) void RenderPlugin::removeManagedMap(View *v, MapHandlerGen *m)
{ {
View* view = static_cast<View*>(QObject::sender()); // disconnect(m, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString)));
assert(isLinkedToView(view)); // disconnect(m, SIGNAL(connectivityModified()), this, SLOT(connectivityModified()));
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[v];
PerMapParameterSet* perMap = params->perMap[m->getName()];
delete perMap;
params->perMap.remove(m->getName()); params->perMap.remove(m->getName());
if(params->selectedMap == m) if(params->selectedMap == m)
{ {
if(!params->perMap.empty()) if(!params->perMap.empty())
changeSelectedMap(view, m_window->getMap(params->perMap.begin().key())); changeSelectedMap(v, m_window->getMap(params->perMap.begin().key()));
else else
changeSelectedMap(view, NULL); changeSelectedMap(v, NULL);
} }
else else
m_dockTab->refreshUI(params); m_dockTab->refreshUI(params);
} }
void RenderPlugin::vboAdded(Utils::VBO* vbo) void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map)
{
assert(h_viewParams[m_window->getCurrentView()]->selectedMap == static_cast<MapHandlerGen*>(QObject::sender()));
if(vbo->dataSize() == 3)
m_dockTab->addVBOToList(QString::fromStdString(vbo->name()));
}
void RenderPlugin::vboRemoved(Utils::VBO* vbo)
{
MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
View* view = m_window->getCurrentView();
ParameterSet* params = h_viewParams[view];
if(params->perMap[map->getName()].positionVBO == vbo)
changePositionVBO(view, map, NULL);
if(params->perMap[map->getName()].normalVBO == vbo)
changeNormalVBO(view, map, NULL);
m_dockTab->refreshUI(h_viewParams[view]);
}
void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
...@@ -244,19 +240,18 @@ void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI ...@@ -244,19 +240,18 @@ void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI
if(view->isCurrentView()) if(view->isCurrentView())
{ {
if(prev) if(prev)
disconnect(prev, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); disconnect(prev, SIGNAL(vboAdded(Utils::VBO*)), m_dockTab, SLOT(addVBOToList(Utils::VBO*)));
if(map) if(map)
connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); connect(map, SIGNAL(vboAdded(Utils::VBO*)), m_dockTab, SLOT(addVBOToList(Utils::VBO*)));
if(!fromUI) m_dockTab->refreshUI(params);
m_dockTab->refreshUI(params);
} }
} }
void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].positionVBO = vbo; params->perMap[map->getName()]->positionVBO = vbo;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -269,7 +264,7 @@ void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* ...@@ -269,7 +264,7 @@ void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO*
void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].normalVBO = vbo; params->perMap[map->getName()]->normalVBO = vbo;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -282,7 +277,7 @@ void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* v ...@@ -282,7 +277,7 @@ void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* v
void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI) void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].renderVertices = b; params->perMap[map->getName()]->renderVertices = b;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -295,7 +290,7 @@ void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b, ...@@ -295,7 +290,7 @@ void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b,
void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI) void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].verticesScaleFactor = i / 50.0; params->perMap[map->getName()]->verticesScaleFactor = i / 50.0;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -308,7 +303,7 @@ void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int ...@@ -308,7 +303,7 @@ void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int
void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI) void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].renderEdges = b; params->perMap[map->getName()]->renderEdges = b;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -321,7 +316,7 @@ void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, boo ...@@ -321,7 +316,7 @@ void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, boo
void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI) void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].renderFaces = b; params->perMap[map->getName()]->renderFaces = b;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
...@@ -334,7 +329,7 @@ void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, boo ...@@ -334,7 +329,7 @@ void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, boo
void RenderPlugin::changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style, bool fromUI) void RenderPlugin::changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style, bool fromUI)
{ {
ParameterSet* params = h_viewParams[view]; ParameterSet* params = h_viewParams[view];
params->perMap[map->getName()].faceStyle = style; params->perMap[map->getName()]->faceStyle = style;
if(view->isCurrentView()) if(view->isCurrentView())
{ {
......
...@@ -39,7 +39,7 @@ void RenderDockTab::refreshUI(ParameterSet* params) ...@@ -39,7 +39,7 @@ void RenderDockTab::refreshUI(ParameterSet* params)
MapHandlerGen* map = params->selectedMap; MapHandlerGen* map = params->selectedMap;
QHash<QString, PerMapParameterSet>::const_iterator i = params->perMap.constBegin(); QHash<QString, PerMapParameterSet*>::const_iterator i = params->perMap.constBegin();
while (i != params->perMap.constEnd()) while (i != params->perMap.constEnd())
{ {
mapList->addItem(i.key()); mapList->addItem(i.key());
...@@ -48,7 +48,7 @@ void RenderDockTab::refreshUI(ParameterSet* params) ...@@ -48,7 +48,7 @@ void RenderDockTab::refreshUI(ParameterSet* params)
QList<QListWidgetItem*> item = mapList->findItems(map->getName(), Qt::MatchExactly); QList<QListWidgetItem*> item = mapList->findItems(map->getName(), Qt::MatchExactly);
item[0]->setSelected(true); item[0]->setSelected(true);
PerMapParameterSet& p = params->perMap[map->getName()]; PerMapParameterSet* p = params->perMap[map->getName()];
QList<Utils::VBO*> vbos = map->getVBOList(); QList<Utils::VBO*> vbos = map->getVBOList();
unsigned int j = 0; unsigned int j = 0;
...@@ -57,23 +57,23 @@ void RenderDockTab::refreshUI(ParameterSet* params) ...@@ -57,23 +57,23 @@ void RenderDockTab::refreshUI(ParameterSet* params)
if(vbos[i]->dataSize() == 3) if(vbos[i]->dataSize() == 3)
{ {
combo_positionVBO->addItem(QString::fromStdString(vbos[i]->name())); combo_positionVBO->addItem(QString::fromStdString(vbos[i]->name()));
if(vbos[i] == p.positionVBO) if(vbos[i] == p->positionVBO)
combo_positionVBO->setCurrentIndex(j); combo_positionVBO->setCurrentIndex(j);
combo_normalVBO->addItem(QString::fromStdString(vbos[i]->name())); combo_normalVBO->addItem(QString::fromStdString(vbos[i]->name()));
if(vbos[i] == p.normalVBO) if(vbos[i] == p->normalVBO)
combo_normalVBO->setCurrentIndex(j); combo_normalVBO->setCurrentIndex(j);
++j; ++j;
} }
} }
check_renderVertices->setChecked(p.renderVertices); check_renderVertices->setChecked(p->renderVertices);
slider_verticesScaleFactor->setSliderPosition(p.verticesScaleFactor * 50.0); slider_verticesScaleFactor->setSliderPosition(p->verticesScaleFactor * 50.0);
check_renderEdges->setChecked(p.renderEdges); check_renderEdges->setChecked(p->renderEdges);
check_renderFaces->setChecked(p.renderFaces); check_renderFaces->setChecked(p->renderFaces);
radio_flatShading->setChecked(p.faceStyle == FLAT); radio_flatShading->setChecked(p->faceStyle == FLAT);
radio_phongShading->setChecked(p.faceStyle == PHONG); radio_phongShading->setChecked(p->faceStyle == PHONG);
} }
++i; ++i;
} }
...@@ -87,27 +87,10 @@ void RenderDockTab::selectedMapChanged() ...@@ -87,27 +87,10 @@ void RenderDockTab::selectedMapChanged()
{ {
QList<QListWidgetItem*> currentItems = mapList->selectedItems(); QList<QListWidgetItem*> currentItems = mapList->selectedItems();
if(!currentItems.empty()) if(!currentItems.empty())
m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text()), true); m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text()));
} }
} }
void RenderDockTab::addVBOToList(QString name)
{
combo_positionVBO->addItem(name);
combo_normalVBO->addItem(name);
}
void RenderDockTab::removeVBOFromList(QString name)
{
int itemIdx = combo_positionVBO->findText(name, Qt::MatchExactly);
if(itemIdx != -1)
combo_positionVBO->removeItem(itemIdx);
itemIdx = combo_normalVBO->findText(name, Qt::MatchExactly);
if(itemIdx != -1)
combo_normalVBO->removeItem(itemIdx);
}
void RenderDockTab::positionVBOChanged(int index) void RenderDockTab::positionVBOChanged(int index)
{ {
if(!b_refreshingUI) if(!b_refreshingUI)
...@@ -181,6 +164,16 @@ void RenderDockTab::faceStyleChanged(QAbstractButton* b) ...@@ -181,6 +164,16 @@ void RenderDockTab::faceStyleChanged(QAbstractButton* b)
} }
} }
void RenderDockTab::addVBOToList(Utils::VBO* vbo)
{
if(vbo->dataSize() == 3)
{
QString name = QString::fromStdString(vbo->name());
combo_positionVBO->addItem(name);
combo_normalVBO->addItem(name);
}
}
} // namespace SCHNApps } // namespace SCHNApps
} // namespace CGoGN } // namespace CGoGN
...@@ -25,10 +25,11 @@ struct PerMapParameterSet ...@@ -25,10 +25,11 @@ struct PerMapParameterSet
void updateRender(); void updateRender();
Algo::Render::GL2::ExplodeVolumeRender* m_renderExplod;
MapHandlerGen* mh; MapHandlerGen* mh;
Algo::Render::GL2::ExplodeVolumeRender* m_renderExplod;
VertexAttribute<PFP3::VEC3> positionAttribute; VertexAttribute<PFP3::VEC3> positionAttribute;
VolumeAttribute<PFP3::VEC3> colorAttribute; VolumeAttribute<PFP3::VEC3> colorAttribute;
float facesScaleFactor; float facesScaleFactor;
float volumesScaleFactor; float volumesScaleFactor;
bool renderEdges; bool renderEdges;
...@@ -84,13 +85,15 @@ public slots: ...@@ -84,13 +85,15 @@ public slots:
void mapLinked(MapHandlerGen* m); void mapLinked(MapHandlerGen* m);
void mapUnlinked(MapHandlerGen* m); void mapUnlinked(MapHandlerGen* m);
//void addAttributeToList(unsigned int orbit, const QString& nameAttr); protected:
void addManagedMap(View *v, MapHandlerGen* m);
void removeManagedMap(View *v, MapHandlerGen* m);
void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false); public slots:
void changeSelectedMap(View* view, MapHandlerGen* map);
void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP3::VEC3> attribute, bool fromUI = false); void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP3::VEC3> attribute, bool fromUI = false);
void changeColorAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP3::VEC3> attribute, bool fromUI = false); void changeColorAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP3::VEC3> attribute, bool fromUI = false);
void changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI = false); void changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
void changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI = false); void changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
void changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false); void changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false);
......
...@@ -36,6 +36,8 @@ public slots: ...@@ -36,6 +36,8 @@ public slots:
void renderFacesChanged(bool b); void renderFacesChanged(bool b);
void facesScaleFactorChanged(int i); void facesScaleFactorChanged(int i);
void volumesScaleFactorChanged(int i); void volumesScaleFactorChanged(int i);
void addAttributeToList(unsigned int orbit, const QString& nameAttr);
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -16,7 +16,6 @@ PerMapParameterSet::PerMapParameterSet(MapHandlerGen* m) : ...@@ -16,7 +16,6 @@ PerMapParameterSet::PerMapParameterSet(MapHandlerGen* m) :
renderFaces(true), renderFaces(true),
faceStyle(FLAT) faceStyle(FLAT)
{ {
m_renderExplod = new Algo::Render::GL2::ExplodeVolumeRender(false, false, false); m_renderExplod = new Algo::Render::GL2::ExplodeVolumeRender(false, false, false);
m_renderExplod->setNoClippingPlane(); m_renderExplod->setNoClippingPlane();
...@@ -50,16 +49,12 @@ PerMapParameterSet::~PerMapParameterSet() ...@@ -50,16 +49,12 @@ PerMapParameterSet::~PerMapParameterSet()
void PerMapParameterSet::updateRender() void PerMapParameterSet::updateRender()
{ {
MapHandler<PFP3>* mh3 = static_cast<MapHandler<PFP3>*>(mh); PFP3::MAP* m = static_cast<MapHandler<PFP3>*>(mh)->getMap();
if(mh3 == NULL)
return;
PFP3::MAP* m = mh3->getMap();
//if(!color.isValid()) //if(!color.isValid())