diff --git a/SCHNApps/Plugins/differentialProperties/forms/computeCurvatureDialog.ui b/SCHNApps/Plugins/differentialProperties/forms/computeCurvatureDialog.ui index 17856bc2a7ad18d2f9b6d20ae1d446cfeb62c8c6..91245f8ae15ec05a6c8075445bc2b0fd1f0732a8 100644 --- a/SCHNApps/Plugins/differentialProperties/forms/computeCurvatureDialog.ui +++ b/SCHNApps/Plugins/differentialProperties/forms/computeCurvatureDialog.ui @@ -67,41 +67,6 @@ Computed attributes - - - - - 75 - true - true - - - - Kmax : - - - - - - - - - Existing attribute : - - - - - - - - 0 - 0 - - - - - - @@ -116,16 +81,6 @@ - - - - create VBO - - - true - - - @@ -175,16 +130,6 @@ - - - - create VBO - - - true - - - @@ -234,16 +179,6 @@ - - - - create VBO - - - true - - - @@ -293,16 +228,6 @@ - - - - create VBO - - - true - - - @@ -352,16 +277,41 @@ - - - - create VBO + + + + + 75 + true + true + - - true + + Kmax : + + + + + + Existing attribute : + + + + + + + + 0 + 0 + + + + + + diff --git a/SCHNApps/Plugins/differentialProperties/forms/computeNormalDialog.ui b/SCHNApps/Plugins/differentialProperties/forms/computeNormalDialog.ui index 0366795dce036a731537c4fea5716a4dd1596cdd..0afad975a6f0ff77b32af1ac259d8d93f5713fc1 100644 --- a/SCHNApps/Plugins/differentialProperties/forms/computeNormalDialog.ui +++ b/SCHNApps/Plugins/differentialProperties/forms/computeNormalDialog.ui @@ -6,8 +6,8 @@ 0 0 - 447 - 311 + 472 + 276 @@ -75,16 +75,6 @@ - - - - create VBO - - - true - - - diff --git a/SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h b/SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h index eefab71f65a3a7f4929055c5150c7e560a6e9931..9a65c05f6abf4c2fcf6afd4a8db6fd99bc94bed5 100644 --- a/SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h +++ b/SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h @@ -28,8 +28,6 @@ public slots: void addMapToList(MapHandlerGen* m); void removeMapFromList(MapHandlerGen* m); void addAttributeToList(unsigned int orbit, const QString& nameAttr); - - void attributeModified(unsigned int orbit, QString nameAttr); }; } // namespace SCHNApps diff --git a/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h b/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h index a56f0b2cca7ef8ba466bd26d3d060b8b7e6bc349..c971956d5b97d4bf09a34774af4aab743a2d5c0f 100644 --- a/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h +++ b/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h @@ -38,18 +38,21 @@ public: virtual void wheelEvent(View* view, QWheelEvent* event) {} public slots: + void mapAdded(MapHandlerGen* map); + void mapRemoved(MapHandlerGen* map); + void attributeModified(unsigned int orbit, QString nameAttr); + void openComputeNormalDialog(); void openComputeCurvatureDialog(); void computeNormalFromDialog(); void computeCurvatureFromDialog(); - void computeNormal( - const QString& mapName, + void computeNormal(const QString& mapName, const QString& positionAttributeName = "position", const QString& normalAttributeName = "normal", - bool createNormalVBO = true - ); + bool autoUpdate = true); + void computeCurvature( const QString& mapName, const QString& positionAttributeName = "position", @@ -59,11 +62,7 @@ public slots: const QString& KminAttributeName = "Kmin", const QString& kminAttributeName = "kmin", const QString& KnormalAttributeName = "Knormal", - bool createKmaxVBO = true, - bool createkmaxVBO = true, - bool createKminVBO = true, - bool createkminVBO = true, - bool createKnormalVBO = true + bool autoUpdate = true ); private: @@ -76,11 +75,36 @@ private: struct ComputeNormalParameters { ComputeNormalParameters() {} - ComputeNormalParameters(QString p, QString n) : positionName(p), normalName(n) {} + ComputeNormalParameters(const QString& p, const QString& n, bool update) : + positionName(p), normalName(n), autoUpdate(update) + {} QString positionName; QString normalName; + bool autoUpdate; }; QHash computeNormalLastParameters; + + struct ComputeCurvatureParameters + { + ComputeCurvatureParameters() {} + ComputeCurvatureParameters( + const QString& p, const QString& n, + const QString& Kmax, const QString& kmax, const QString& Kmin, const QString& kmin, const QString& Knormal, + bool update) : + positionName(p), normalName(n), + KmaxName(Kmax), kmaxName(kmax), KminName(Kmin), kminName(kmin), KnormalName(Knormal), + autoUpdate(update) + {} + QString positionName; + QString normalName; + QString KmaxName; + QString kmaxName; + QString KminName; + QString kminName; + QString KnormalName; + bool autoUpdate; + }; + QHash computeCurvatureLastParameters; }; #endif diff --git a/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp b/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp index 20878ce3c4a5b7d324bf20df2b98e5eb871f2e66..2f126497da1296804b2c6a6cd545ce1753bd21b7 100644 --- a/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp +++ b/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp @@ -105,15 +105,6 @@ void ComputeNormalDialog::addAttributeToList(unsigned int orbit, const QString& } } -void ComputeNormalDialog::attributeModified(unsigned int orbit, QString nameAttr) -{ - MapHandlerGen* map = static_cast(QObject::sender()); -// if(orbit == VERTEX && nameAttr == ) -// { - -// } -} - } // namespace SCHNApps } // namespace CGoGN diff --git a/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp b/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp index 673c2e91ad5b96b2b24bea15ae22dec0ef584133..66ca755749248942b63045e2e43ddfb91492f5e9 100644 --- a/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp +++ b/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp @@ -25,9 +25,36 @@ bool DifferentialPropertiesPlugin::enable() connect(m_computeCurvatureDialog, SIGNAL(accepted()), this, SLOT(computeCurvatureFromDialog())); connect(m_computeCurvatureDialog->button_apply, SIGNAL(clicked()), this, SLOT(computeCurvatureFromDialog())); + connect(m_window, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*))); + connect(m_window, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*))); + return true; } +void DifferentialPropertiesPlugin::mapAdded(MapHandlerGen *map) +{ + connect(map, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString))); +} + +void DifferentialPropertiesPlugin::mapRemoved(MapHandlerGen *map) +{ + disconnect(map, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString))); +} + +void DifferentialPropertiesPlugin::attributeModified(unsigned int orbit, QString nameAttr) +{ + if(orbit == VERTEX) + { + MapHandlerGen* map = static_cast(QObject::sender()); + if(computeNormalLastParameters.contains(map->getName())) + { + ComputeNormalParameters& params = computeNormalLastParameters[map->getName()]; + if(params.positionName == nameAttr && params.autoUpdate) + computeNormal(map->getName(), params.positionName, params.normalName); + } + } +} + void DifferentialPropertiesPlugin::openComputeNormalDialog() { m_computeNormalDialog->show(); @@ -46,15 +73,16 @@ void DifferentialPropertiesPlugin::computeNormalFromDialog() const QString& mapName = currentItems[0]->text(); QString positionName = m_computeNormalDialog->combo_positionAttribute->currentText(); + QString normalName; if(m_computeNormalDialog->normalAttributeName->text().isEmpty()) normalName = m_computeNormalDialog->combo_normalAttribute->currentText(); else normalName = m_computeNormalDialog->normalAttributeName->text(); - bool createVBO = (m_computeNormalDialog->check_createVBO->checkState() == Qt::Checked); + bool autoUpdate = (currentItems[0]->checkState() == Qt::Checked); - computeNormal(mapName, positionName, normalName, createVBO); + computeNormal(mapName, positionName, normalName, autoUpdate); } } @@ -98,19 +126,13 @@ void DifferentialPropertiesPlugin::computeCurvatureFromDialog() else KnormalName = m_computeCurvatureDialog->KnormalAttributeName->text(); - bool KmaxVBO = (m_computeCurvatureDialog->check_KmaxCreateVBO->checkState() == Qt::Checked); - - bool kmaxVBO = (m_computeCurvatureDialog->check_kmaxCreateVBO->checkState() == Qt::Checked); - - bool KminVBO = (m_computeCurvatureDialog->check_KminCreateVBO->checkState() == Qt::Checked); - - bool kminVBO = (m_computeCurvatureDialog->check_kminCreateVBO->checkState() == Qt::Checked); - - bool KnormalVBO = (m_computeCurvatureDialog->check_KnormalCreateVBO->checkState() == Qt::Checked); + bool autoUpdate = (currentItems[0]->checkState() == Qt::Checked); computeCurvature( - mapName, positionName, normalName, KmaxName, kmaxName, KminName, kminName, KnormalName, - KmaxVBO, kmaxVBO, KminVBO, kminVBO, KnormalVBO + mapName, + positionName, normalName, + KmaxName, kmaxName, KminName, kminName, KnormalName, + autoUpdate ); } } @@ -119,7 +141,7 @@ void DifferentialPropertiesPlugin::computeNormal( const QString& mapName, const QString& positionAttributeName, const QString& normalAttributeName, - bool createNormalVBO) + bool autoUpdate) { MapHandler* mh = static_cast*>(m_window->getMap(mapName)); if(mh == NULL) @@ -136,15 +158,12 @@ void DifferentialPropertiesPlugin::computeNormal( PFP2::MAP* map = mh->getMap(); Algo::Surface::Geometry::computeNormalVertices(*map, position, normal); - if(createNormalVBO) - mh->createVBO(normal); - computeNormalLastParameters[mapName] = - ComputeNormalParameters(positionAttributeName, normalAttributeName) ; + ComputeNormalParameters(positionAttributeName, normalAttributeName, autoUpdate); - QList views = mh->getLinkedViews(); - foreach(View* view, views) - view->updateGL(); + mh->createVBO(normal); + + mh->notifyAttributeModification(normal); } void DifferentialPropertiesPlugin::computeCurvature( @@ -156,11 +175,7 @@ void DifferentialPropertiesPlugin::computeCurvature( const QString& KminAttributeName, const QString& kminAttributeName, const QString& KnormalAttributeName, - bool createKmaxVBO, - bool createkmaxVBO, - bool createKminVBO, - bool createkminVBO, - bool createKnormalVBO) + bool autoUpdate) { MapHandler* mh = static_cast*>(m_window->getMap(mapName)); if(mh == NULL) @@ -202,15 +217,23 @@ void DifferentialPropertiesPlugin::computeCurvature( Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges(*map, position, edgeAngle); Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles_Projected(*map, 0.02f * mh->getBBdiagSize(), position, normal, edgeAngle, kmax, kmin, Kmax, Kmin, Knormal); - if(createKmaxVBO) mh->createVBO(Kmax); - if(createkmaxVBO) mh->createVBO(kmax); - if(createKminVBO) mh->createVBO(Kmin); - if(createkminVBO) mh->createVBO(kmin); - if(createKnormalVBO) mh->createVBO(Knormal); - - QList views = mh->getLinkedViews(); - foreach(View* view, views) - view->updateGL(); + computeCurvatureLastParameters[mapName] = + ComputeCurvatureParameters( + positionAttributeName, normalAttributeName, + KmaxAttributeName, kmaxAttributeName, KminAttributeName, kminAttributeName, KnormalAttributeName, + autoUpdate); + + mh->createVBO(Kmax); + mh->createVBO(kmax); + mh->createVBO(Kmin); + mh->createVBO(kmin); + mh->createVBO(Knormal); + + mh->notifyAttributeModification(Kmax); + mh->notifyAttributeModification(kmax); + mh->notifyAttributeModification(Kmin); + mh->notifyAttributeModification(kmin); + mh->notifyAttributeModification(Knormal); } #ifndef DEBUG diff --git a/SCHNApps/Plugins/importSurface/include/importSurface.h b/SCHNApps/Plugins/importSurface/include/importSurface.h index d7a08004475283e63d0d3369b906d8898a3f6e9e..e9e2cbcb918a7e834a5bba05ea318ed61ea12e3d 100644 --- a/SCHNApps/Plugins/importSurface/include/importSurface.h +++ b/SCHNApps/Plugins/importSurface/include/importSurface.h @@ -4,9 +4,11 @@ #include "plugin.h" -using namespace CGoGN; -using namespace SCHNApps; +namespace CGoGN +{ +namespace SCHNApps +{ class ImportSurfacePlugin : public Plugin { @@ -42,4 +44,8 @@ private: QAction* importAction; }; +} // namespace SCHNApps + +} // namespace CGoGN + #endif diff --git a/SCHNApps/Plugins/importSurface/src/importSurface.cpp b/SCHNApps/Plugins/importSurface/src/importSurface.cpp index b88ddff39ff8c3df8a21b5fd1c3938ccc1425e60..6d72b390bd6125ba5c22e0ac30799e2ae07e7762 100644 --- a/SCHNApps/Plugins/importSurface/src/importSurface.cpp +++ b/SCHNApps/Plugins/importSurface/src/importSurface.cpp @@ -7,6 +7,12 @@ #include #include +namespace CGoGN +{ + +namespace SCHNApps +{ + bool ImportSurfacePlugin::enable() { importAction = new QAction("import", this); @@ -30,12 +36,15 @@ MapHandlerGen* ImportSurfacePlugin::importFromFile(const QString& fileName) Algo::Surface::Import::importMesh(*map, fileName.toStdString(), attrNames); // get vertex position attribute - VertexAttribute position = map->getAttribute(attrNames[0]); - mh->registerAttribute(position); + VertexAttribute position = map->getAttribute(attrNames[0]); + mh->registerAttribute(position); - // create VBO for vertex position attribute + // create position VBO mh->createVBO(position); + // update corresponding VBO & emit attribute update signal + mh->notifyAttributeModification(position); + // compute map bounding box mh->updateBB(position); } @@ -56,3 +65,7 @@ Q_EXPORT_PLUGIN2(ImportSurfacePlugin, ImportSurfacePlugin) #else Q_EXPORT_PLUGIN2(ImportSurfacePluginD, ImportSurfacePlugin) #endif + +} // namespace SCHNApps + +} // namespace CGoGN diff --git a/SCHNApps/Plugins/importVolume/include/importVolume.h b/SCHNApps/Plugins/importVolume/include/importVolume.h index 0f5e3c90833b51ff7fec1217f1b2c7b56810f048..d35c926f3efbeec162af5c49e7545b6c25f1c3c8 100644 --- a/SCHNApps/Plugins/importVolume/include/importVolume.h +++ b/SCHNApps/Plugins/importVolume/include/importVolume.h @@ -4,9 +4,11 @@ #include "plugin.h" -using namespace CGoGN; -using namespace SCHNApps; +namespace CGoGN +{ +namespace SCHNApps +{ class ImportVolumePlugin : public Plugin { @@ -42,4 +44,8 @@ private: QAction* importAction; }; +} // namespace SCHNApps + +} // namespace CGoGN + #endif diff --git a/SCHNApps/Plugins/importVolume/src/importVolume.cpp b/SCHNApps/Plugins/importVolume/src/importVolume.cpp index 51297ab8e1575fce4ae58703edc202f7c6fab0ae..102c6034862dd17f1bcc79d5e545c00f73b7ea10 100644 --- a/SCHNApps/Plugins/importVolume/src/importVolume.cpp +++ b/SCHNApps/Plugins/importVolume/src/importVolume.cpp @@ -7,6 +7,12 @@ #include #include +namespace CGoGN +{ + +namespace SCHNApps +{ + bool ImportVolumePlugin::enable() { importAction = new QAction("import", this); @@ -30,12 +36,15 @@ MapHandlerGen* ImportVolumePlugin::importFromFile(const QString& fileName) Algo::Volume::Import::importMesh(*map, fileName.toStdString(), attrNames); // get vertex position attribute - VertexAttribute position = map->getAttribute(attrNames[0]); - mh->registerAttribute(position); + VertexAttribute position = map->getAttribute(attrNames[0]); + mh->registerAttribute(position); - // create VBO for vertex position attribute + // create position VBO mh->createVBO(position); + // update corresponding VBO & emit attribute update signal + mh->notifyAttributeModification(position); + // compute map bounding box mh->updateBB(position); } @@ -56,3 +65,7 @@ Q_EXPORT_PLUGIN2(ImportVolumePlugin, ImportVolumePlugin) #else Q_EXPORT_PLUGIN2(ImportVolumePluginD, ImportVolumePlugin) #endif + +} // namespace SCHNApps + +} // namespace CGoGN diff --git a/SCHNApps/Plugins/render/include/render.h b/SCHNApps/Plugins/render/include/render.h index e1c1f150962b9a6c95e1e7b5c6affc44576c4999..f1afce8a7f9e429ffee9137f0fd31d06bd577498 100644 --- a/SCHNApps/Plugins/render/include/render.h +++ b/SCHNApps/Plugins/render/include/render.h @@ -100,14 +100,14 @@ public slots: void vboAdded(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo); - void changeSelectedMap(View* view, MapHandlerGen* map); - void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo); - void changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo); - void changeRenderVertices(View* view, MapHandlerGen* map, bool b); - void changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i); - void changeRenderEdges(View* view, MapHandlerGen* map, bool b); - void changeRenderFaces(View* view, MapHandlerGen* map, bool b); - void changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style); + void changeSelectedMap(View* view, MapHandlerGen* map, 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 changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI = false); + void changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i, 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 changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style, bool fromUI = false); }; } // namespace SCHNApps diff --git a/SCHNApps/Plugins/render/include/renderDockTab.h b/SCHNApps/Plugins/render/include/renderDockTab.h index aeb84a30a22ea80e2fd20bc7e19b2c300d3abc1c..22c406017c1ea481807ff4087bbcd648e57fd63f 100644 --- a/SCHNApps/Plugins/render/include/renderDockTab.h +++ b/SCHNApps/Plugins/render/include/renderDockTab.h @@ -11,7 +11,7 @@ namespace SCHNApps class Window; class RenderPlugin; -class ParameterSet; +struct ParameterSet; class RenderDockTab : public QWidget, public Ui::RenderDockWidget { @@ -30,6 +30,8 @@ public slots: void refreshUI(ParameterSet* params); void selectedMapChanged(); + void addVBOToList(QString name); + void removeVBOFromList(QString name); void positionVBOChanged(int index); void normalVBOChanged(int index); void renderVerticesChanged(bool b); diff --git a/SCHNApps/Plugins/render/src/render.cpp b/SCHNApps/Plugins/render/src/render.cpp index 67167b57accb01637c4847be5900ad0825d118c9..7815040e6031d40e0f5ce209e8385de7d4c492af 100644 --- a/SCHNApps/Plugins/render/src/render.cpp +++ b/SCHNApps/Plugins/render/src/render.cpp @@ -215,7 +215,9 @@ void RenderPlugin::mapUnlinked(MapHandlerGen* m) void RenderPlugin::vboAdded(Utils::VBO* vbo) { - m_dockTab->refreshUI(h_viewParams[m_window->getCurrentView()]); + assert(h_viewParams[m_window->getCurrentView()]->selectedMap == static_cast(QObject::sender())); + if(vbo->dataSize() == 3) + m_dockTab->addVBOToList(QString::fromStdString(vbo->name())); } void RenderPlugin::vboRemoved(Utils::VBO* vbo) @@ -232,7 +234,7 @@ void RenderPlugin::vboRemoved(Utils::VBO* vbo) m_dockTab->refreshUI(h_viewParams[view]); } -void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map) +void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI) { ParameterSet* params = h_viewParams[view]; @@ -246,91 +248,99 @@ void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map) if(map) connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo) +void RenderPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].positionVBO = vbo; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo) +void RenderPlugin::changeNormalVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].normalVBO = vbo; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b) +void RenderPlugin::changeRenderVertices(View* view, MapHandlerGen* map, bool b, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].renderVertices = b; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i) +void RenderPlugin::changeVerticesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].verticesScaleFactor = i / 50.0; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b) +void RenderPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].renderEdges = b; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b) +void RenderPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].renderFaces = b; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderPlugin::changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style) +void RenderPlugin::changeFacesStyle(View* view, MapHandlerGen* map, FaceShadingStyle style, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].faceStyle = style; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } diff --git a/SCHNApps/Plugins/render/src/renderDockTab.cpp b/SCHNApps/Plugins/render/src/renderDockTab.cpp index 3b451702878192b0e0baa3cb0487a1aa01c344a3..903c0a25b4ba24c298d34172e17da3045cf86547 100644 --- a/SCHNApps/Plugins/render/src/renderDockTab.cpp +++ b/SCHNApps/Plugins/render/src/renderDockTab.cpp @@ -87,17 +87,34 @@ void RenderDockTab::selectedMapChanged() { QList currentItems = mapList->selectedItems(); if(!currentItems.empty()) - m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text())); + m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text()), true); } } +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) { if(!b_refreshingUI) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText())); + m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); } } @@ -107,7 +124,7 @@ void RenderDockTab::normalVBOChanged(int index) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeNormalVBO(view, map, map->getVBO(combo_normalVBO->currentText())); + m_plugin->changeNormalVBO(view, map, map->getVBO(combo_normalVBO->currentText()), true); } } @@ -117,7 +134,7 @@ void RenderDockTab::renderVerticesChanged(bool b) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeRenderVertices(view, map, b); + m_plugin->changeRenderVertices(view, map, b, true); } } @@ -127,7 +144,7 @@ void RenderDockTab::verticesScaleFactorChanged(int i) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeVerticesScaleFactor(view, map, i); + m_plugin->changeVerticesScaleFactor(view, map, i, true); } } @@ -137,7 +154,7 @@ void RenderDockTab::renderEdgesChanged(bool b) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeRenderEdges(view, map, b); + m_plugin->changeRenderEdges(view, map, b, true); } } @@ -147,7 +164,7 @@ void RenderDockTab::renderFacesChanged(bool b) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeRenderFaces(view, map, b); + m_plugin->changeRenderFaces(view, map, b, true); } } @@ -158,9 +175,9 @@ void RenderDockTab::faceStyleChanged(QAbstractButton* b) View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; if(radio_flatShading->isChecked()) - m_plugin->changeFacesStyle(view, map, FLAT); + m_plugin->changeFacesStyle(view, map, FLAT, true); else if(radio_phongShading->isChecked()) - m_plugin->changeFacesStyle(view, map, PHONG); + m_plugin->changeFacesStyle(view, map, PHONG, true); } } diff --git a/SCHNApps/Plugins/renderExplod/include/renderExplod.h b/SCHNApps/Plugins/renderExplod/include/renderExplod.h index 16273727edbfcae7bf09d82f3ad4245dc9fbee4d..1227cb7e9d7ae8d76e02d31d6844411e4200757b 100644 --- a/SCHNApps/Plugins/renderExplod/include/renderExplod.h +++ b/SCHNApps/Plugins/renderExplod/include/renderExplod.h @@ -84,13 +84,13 @@ public slots: void vboAdded(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo); - void changeSelectedMap(View* view, MapHandlerGen* map); - void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo); - void changeColorVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo); - void changeRenderEdges(View* view, MapHandlerGen* map, bool b); - void changeRenderFaces(View* view, MapHandlerGen* map, bool b); - void changeFacesScaleFactor(View* view, MapHandlerGen* map, int i); - void changeVolumesScaleFactor(View* view, MapHandlerGen* map, int i); + void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false); + void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false); + void changeColorVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, 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 changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false); + void changeVolumesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false); }; } // namespace SCHNApps diff --git a/SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h b/SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h index 7e62a440f7d598b15e59c2d89b98ecbbc281ed5c..d181d9050a5022c05e4f8d1d3e25ef28513ae352 100644 --- a/SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h +++ b/SCHNApps/Plugins/renderExplod/include/renderExplodDockTab.h @@ -11,7 +11,7 @@ namespace SCHNApps class Window; class RenderExplodPlugin; -class ParameterSet; +struct ParameterSet; class RenderExplodDockTab : public QWidget, public Ui::RenderExplodDockWidget { diff --git a/SCHNApps/Plugins/renderExplod/src/renderExplod.cpp b/SCHNApps/Plugins/renderExplod/src/renderExplod.cpp index 9f40805d4104a5b7ebe2aa3c95cdc246181c49e4..66d61d4efee4ccfa6a1a09d5f1a5ddcf05c638a5 100644 --- a/SCHNApps/Plugins/renderExplod/src/renderExplod.cpp +++ b/SCHNApps/Plugins/renderExplod/src/renderExplod.cpp @@ -195,7 +195,7 @@ void RenderExplodPlugin::vboRemoved(Utils::VBO* vbo) m_dockTab->refreshUI(h_viewParams[view]); } -void RenderExplodPlugin::changeSelectedMap(View* view, MapHandlerGen* map) +void RenderExplodPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI) { ParameterSet* params = h_viewParams[view]; @@ -209,79 +209,86 @@ void RenderExplodPlugin::changeSelectedMap(View* view, MapHandlerGen* map) if(map) connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo) +void RenderExplodPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].positionVBO = vbo; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changeColorVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo) +void RenderExplodPlugin::changeColorVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].colorVBO = vbo; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b) +void RenderExplodPlugin::changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].renderEdges = b; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b) +void RenderExplodPlugin::changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].renderFaces = b; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changeFacesScaleFactor(View* view, MapHandlerGen* map, int i) +void RenderExplodPlugin::changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].facesScaleFactor = i / 50.0; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderExplodPlugin::changeVolumesScaleFactor(View* view, MapHandlerGen* map, int i) +void RenderExplodPlugin::changeVolumesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].volumesScaleFactor = i / 50.0; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } diff --git a/SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp b/SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp index 4b29176ee3f48b1533e7d45b819915ab41c636b2..6959f72e189231f929465530b843f3159d032960 100644 --- a/SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp +++ b/SCHNApps/Plugins/renderExplod/src/renderExplodDockTab.cpp @@ -84,7 +84,7 @@ void RenderExplodDockTab::selectedMapChanged() { QList currentItems = mapList->selectedItems(); if(!currentItems.empty()) - m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text())); + m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text()), true); } } @@ -94,7 +94,7 @@ void RenderExplodDockTab::positionVBOChanged(int index) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText())); + m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); } } @@ -104,7 +104,7 @@ void RenderExplodDockTab::colorVBOChanged(int index) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeColorVBO(view, map, map->getVBO(combo_colorVBO->currentText())); + m_plugin->changeColorVBO(view, map, map->getVBO(combo_colorVBO->currentText()), true); } } @@ -114,7 +114,7 @@ void RenderExplodDockTab::renderEdgesChanged(bool b) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeRenderEdges(view, map, b); + m_plugin->changeRenderEdges(view, map, b, true); } } @@ -124,7 +124,7 @@ void RenderExplodDockTab::renderFacesChanged(bool b) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeRenderFaces(view, map, b); + m_plugin->changeRenderFaces(view, map, b, true); } } @@ -134,7 +134,7 @@ void RenderExplodDockTab::facesScaleFactorChanged(int i) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeFacesScaleFactor(view, map, i); + m_plugin->changeFacesScaleFactor(view, map, i, true); } } @@ -144,7 +144,7 @@ void RenderExplodDockTab::volumesScaleFactorChanged(int i) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeVolumesScaleFactor(view, map, i); + m_plugin->changeVolumesScaleFactor(view, map, i, true); } } diff --git a/SCHNApps/Plugins/renderVector/include/renderVector.h b/SCHNApps/Plugins/renderVector/include/renderVector.h index 58994b11e095644adbb333614af80b66a2fdd0ad..23eda7535cd69cd85cb32154df2074b77f65f274 100644 --- a/SCHNApps/Plugins/renderVector/include/renderVector.h +++ b/SCHNApps/Plugins/renderVector/include/renderVector.h @@ -79,10 +79,10 @@ public slots: void vboAdded(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo); - void changeSelectedMap(View* view, MapHandlerGen* map); - void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo); - void changeSelectedVectorsVBO(View* view, MapHandlerGen* map, const std::vector& vbos); - void changeVectorsScaleFactor(View* view, MapHandlerGen* map, int i); + void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false); + void changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI = false); + void changeSelectedVectorsVBO(View* view, MapHandlerGen* map, const std::vector& vbos, bool fromUI = false); + void changeVectorsScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false); }; } // namespace SCHNApps diff --git a/SCHNApps/Plugins/renderVector/include/renderVectorDockTab.h b/SCHNApps/Plugins/renderVector/include/renderVectorDockTab.h index a8b289af679cacc6251c527ff8a958cb1bff7197..797322b85f1e8f5f91e524e5702c51a16bd36909 100644 --- a/SCHNApps/Plugins/renderVector/include/renderVectorDockTab.h +++ b/SCHNApps/Plugins/renderVector/include/renderVectorDockTab.h @@ -11,7 +11,7 @@ namespace SCHNApps class Window; class RenderVectorPlugin; -class ParameterSet; +struct ParameterSet; class RenderVectorDockTab : public QWidget, public Ui::RenderVectorDockWidget { @@ -30,6 +30,8 @@ public slots: void refreshUI(ParameterSet* params); void selectedMapChanged(); + void addVBOToList(QString name); + void removeVBOFromList(QString name); void positionVBOChanged(int index); void selectedVectorsVBOChanged(); void vectorsScaleFactorChanged(int i); diff --git a/SCHNApps/Plugins/renderVector/src/renderVector.cpp b/SCHNApps/Plugins/renderVector/src/renderVector.cpp index ca32a4795e4c13815eb5527b494691b034db0d2b..c45f4041ba0343938591e5593d6f0da5a94b7e7a 100644 --- a/SCHNApps/Plugins/renderVector/src/renderVector.cpp +++ b/SCHNApps/Plugins/renderVector/src/renderVector.cpp @@ -149,7 +149,9 @@ void RenderVectorPlugin::mapUnlinked(MapHandlerGen* m) void RenderVectorPlugin::vboAdded(Utils::VBO* vbo) { - m_dockTab->refreshUI(h_viewParams[m_window->getCurrentView()]); + assert(h_viewParams[m_window->getCurrentView()]->selectedMap == static_cast(QObject::sender())); + if(vbo->dataSize() == 3) + m_dockTab->addVBOToList(QString::fromStdString(vbo->name())); } void RenderVectorPlugin::vboRemoved(Utils::VBO* vbo) @@ -164,7 +166,7 @@ void RenderVectorPlugin::vboRemoved(Utils::VBO* vbo) m_dockTab->refreshUI(h_viewParams[view]); } -void RenderVectorPlugin::changeSelectedMap(View* view, MapHandlerGen* map) +void RenderVectorPlugin::changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI) { ParameterSet* params = h_viewParams[view]; @@ -178,43 +180,47 @@ void RenderVectorPlugin::changeSelectedMap(View* view, MapHandlerGen* map) if(map) connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderVectorPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo) +void RenderVectorPlugin::changePositionVBO(View* view, MapHandlerGen* map, Utils::VBO* vbo, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].positionVBO = vbo; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderVectorPlugin::changeSelectedVectorsVBO(View* view, MapHandlerGen* map, const std::vector& vbos) +void RenderVectorPlugin::changeSelectedVectorsVBO(View* view, MapHandlerGen* map, const std::vector& vbos, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].vectorVBO = vbos; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } -void RenderVectorPlugin::changeVectorsScaleFactor(View* view, MapHandlerGen* map, int i) +void RenderVectorPlugin::changeVectorsScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI) { ParameterSet* params = h_viewParams[view]; params->perMap[map->getName()].vectorsScaleFactor = i / 50.0; if(view->isCurrentView()) { - m_dockTab->refreshUI(params); + if(!fromUI) + m_dockTab->refreshUI(params); view->updateGL(); } } diff --git a/SCHNApps/Plugins/renderVector/src/renderVectorDockTab.cpp b/SCHNApps/Plugins/renderVector/src/renderVectorDockTab.cpp index e2dba8bdee0f3a992c272865cd406dee2bb0b092..9591a63489cf611db5ca1ba94ceacb7deb1579cc 100644 --- a/SCHNApps/Plugins/renderVector/src/renderVectorDockTab.cpp +++ b/SCHNApps/Plugins/renderVector/src/renderVectorDockTab.cpp @@ -78,17 +78,34 @@ void RenderVectorDockTab::selectedMapChanged() { QList currentItems = mapList->selectedItems(); if(!currentItems.empty()) - m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text())); + m_plugin->changeSelectedMap(m_window->getCurrentView(), m_window->getMap(currentItems[0]->text()), true); } } +void RenderVectorDockTab::addVBOToList(QString name) +{ + combo_positionVBO->addItem(name); + list_vectorVBO->addItem(name); +} + +void RenderVectorDockTab::removeVBOFromList(QString name) +{ + int itemIdx = combo_positionVBO->findText(name, Qt::MatchExactly); + if(itemIdx != -1) + combo_positionVBO->removeItem(itemIdx); + + QList items = list_vectorVBO->findItems(name, Qt::MatchExactly); + if(!items.empty()) + delete items[0]; +} + void RenderVectorDockTab::positionVBOChanged(int index) { if(!b_refreshingUI) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText())); + m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); } } @@ -102,7 +119,7 @@ void RenderVectorDockTab::selectedVectorsVBOChanged() std::vector vbos; foreach(QListWidgetItem* item, currentItems) vbos.push_back(map->getVBO(item->text())); - m_plugin->changeSelectedVectorsVBO(view, map, vbos); + m_plugin->changeSelectedVectorsVBO(view, map, vbos, true); } } @@ -112,7 +129,7 @@ void RenderVectorDockTab::vectorsScaleFactorChanged(int i) { View* view = m_window->getCurrentView(); MapHandlerGen* map = m_currentParams->selectedMap; - m_plugin->changeVectorsScaleFactor(view, map, i); + m_plugin->changeVectorsScaleFactor(view, map, i, true); } } diff --git a/SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h b/SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h index e4ed112104f09629d8735576a7a6d91e73a43594..46147165ff7293b1c732966e15a75b28b685c5a7 100644 --- a/SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h +++ b/SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h @@ -38,11 +38,20 @@ public: public slots: void openSubdivideSurfaceDialog(); - void subdivideSurface(); - - void loopSubdivision(PFP2::MAP* map, VertexAttribute& position); - void CCSubdivision(PFP2::MAP* map, VertexAttribute& position); - void trianguleFaces(PFP2::MAP* map, VertexAttribute& position); + void subdivideSurfaceFromDialog(); + + void loopSubdivision( + const QString& mapName, + const QString& positionAttributeName = "position" + ); + void CCSubdivision( + const QString& mapName, + const QString& positionAttributeName = "position" + ); + void trianguleFaces( + const QString& mapName, + const QString& positionAttributeName = "position" + ); private: SubdivideSurfaceDialog* m_subdivideSurfaceDialog; diff --git a/SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp b/SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp index 9ba5642bff3146dfd603e0afe33701830e2e9287..2328eb93485a4fa0f98d0bcff51ae2eb67399fa6 100644 --- a/SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp +++ b/SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp @@ -20,8 +20,8 @@ bool SubdivideSurfacePlugin::enable() connect(m_subdivideSurfaceAction, SIGNAL(triggered()), this, SLOT(openSubdivideSurfaceDialog())); - connect(m_subdivideSurfaceDialog, SIGNAL(accepted()), this, SLOT(subdivideSurface())); - connect(m_subdivideSurfaceDialog->button_apply, SIGNAL(clicked()), this, SLOT(subdivideSurface())); + connect(m_subdivideSurfaceDialog, SIGNAL(accepted()), this, SLOT(subdivideSurfaceFromDialog())); + connect(m_subdivideSurfaceDialog->button_apply, SIGNAL(clicked()), this, SLOT(subdivideSurfaceFromDialog())); return true; } @@ -31,50 +31,90 @@ void SubdivideSurfacePlugin::openSubdivideSurfaceDialog() m_subdivideSurfaceDialog->show(); } -void SubdivideSurfacePlugin::subdivideSurface() +void SubdivideSurfacePlugin::subdivideSurfaceFromDialog() { QList currentItems = m_subdivideSurfaceDialog->mapList->selectedItems(); if(!currentItems.empty()) { - const QString& mapname = currentItems[0]->text(); - MapHandler* mh = static_cast*>(m_window->getMap(mapname)); - PFP2::MAP* map = mh->getMap(); - - std::string positionName = m_subdivideSurfaceDialog->combo_positionAttribute->currentText().toStdString(); - VertexAttribute position = map->getAttribute(positionName); + const QString& mapName = currentItems[0]->text(); + const QString& positionName = m_subdivideSurfaceDialog->combo_positionAttribute->currentText(); if(m_subdivideSurfaceDialog->radio_Loop->isChecked()) - loopSubdivision(map, position); + loopSubdivision(mapName, positionName); else if(m_subdivideSurfaceDialog->radio_CC->isChecked()) - CCSubdivision(map, position); + CCSubdivision(mapName, positionName); else if(m_subdivideSurfaceDialog->radio_trianguleFaces->isChecked()) - trianguleFaces(map, position); - - mh->setPrimitiveDirty(Algo::Render::GL2::POINTS); - mh->setPrimitiveDirty(Algo::Render::GL2::LINES); - mh->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES); - - mh->updateVBO(position); - - QList views = mh->getLinkedViews(); - foreach(View* view, views) - view->updateGL(); + trianguleFaces(mapName, positionName); } } -void SubdivideSurfacePlugin::loopSubdivision(PFP2::MAP* map, VertexAttribute& position) +void SubdivideSurfacePlugin::loopSubdivision( + const QString& mapName, + const QString& positionAttributeName) { + MapHandler* mh = static_cast*>(m_window->getMap(mapName)); + if(mh == NULL) + return; + + VertexAttribute position = mh->getAttribute(positionAttributeName); + if(!position.isValid()) + return; + + PFP2::MAP* map = mh->getMap(); Algo::Surface::Modelisation::LoopSubdivision(*map, position); + + mh->notifyAttributeModification(position); + mh->notifyConnectivityModification(); + + QList views = mh->getLinkedViews(); + foreach(View* view, views) + view->updateGL(); } -void SubdivideSurfacePlugin::CCSubdivision(PFP2::MAP* map, VertexAttribute& position) +void SubdivideSurfacePlugin::CCSubdivision( + const QString& mapName, + const QString& positionAttributeName) { + MapHandler* mh = static_cast*>(m_window->getMap(mapName)); + if(mh == NULL) + return; + + VertexAttribute position = mh->getAttribute(positionAttributeName); + if(!position.isValid()) + return; + + PFP2::MAP* map = mh->getMap(); Algo::Surface::Modelisation::CatmullClarkSubdivision(*map, position); + + mh->notifyAttributeModification(position); + mh->notifyConnectivityModification(); + + QList views = mh->getLinkedViews(); + foreach(View* view, views) + view->updateGL(); } -void SubdivideSurfacePlugin::trianguleFaces(PFP2::MAP* map, VertexAttribute& position) +void SubdivideSurfacePlugin::trianguleFaces( + const QString& mapName, + const QString& positionAttributeName) { + MapHandler* mh = static_cast*>(m_window->getMap(mapName)); + if(mh == NULL) + return; + + VertexAttribute position = mh->getAttribute(positionAttributeName); + if(!position.isValid()) + return; + + PFP2::MAP* map = mh->getMap(); Algo::Surface::Modelisation::trianguleFaces(*map, position); + + mh->notifyAttributeModification(position); + mh->notifyConnectivityModification(); + + QList views = mh->getLinkedViews(); + foreach(View* view, views) + view->updateGL(); } #ifndef DEBUG diff --git a/SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformationDockTab.h b/SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformationDockTab.h index 20766fbf617441e0adb7c553d6b8745e7880b089..83d4b7db28a2e0a06d28e11f136aec5547a5113a 100644 --- a/SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformationDockTab.h +++ b/SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformationDockTab.h @@ -11,7 +11,7 @@ namespace SCHNApps class Window; class SurfaceDeformationPlugin; -class ParameterSet; +struct ParameterSet; class SurfaceDeformationDockTab : public QWidget, public Ui::SurfaceDeformationWidget { diff --git a/SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp b/SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp index 393ffd25f1a9c054a0352d47958d8d1e65035b60..e086091cb937312435c97a976b152abe349602a2 100644 --- a/SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp +++ b/SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp @@ -193,7 +193,6 @@ void SurfaceDeformationPlugin::keyPress(View* view, QKeyEvent* event) { asRigidAsPossible(view, map); PerMapParameterSet* perMap = params->perMap[map->getName()]; - params->selectedMap->updateVBO(perMap->positionAttribute); params->selectedMap->notifyAttributeModification(perMap->positionAttribute); view->updateGL(); } @@ -319,7 +318,6 @@ void SurfaceDeformationPlugin::mouseMove(View* view, QMouseEvent* event) // matchDiffCoord(view, map); asRigidAsPossible(view, params->selectedMap); - params->selectedMap->updateVBO(perMap->positionAttribute); params->selectedMap->notifyAttributeModification(perMap->positionAttribute); view->updateGL(); diff --git a/SCHNApps/bin/init.py b/SCHNApps/bin/init.py index 0b19f79a31c2685150ea44a26dc636ba1a4bfa1d..d229607b94fc7b864fecee2874054a4c501df960 100644 --- a/SCHNApps/bin/init.py +++ b/SCHNApps/bin/init.py @@ -1,6 +1,6 @@ importPlugin = schnapps.loadPlugin("ImportSurface"); -renderPlugin = schnapps.loadPlugin("Render"); -renderVectorPlugin = schnapps.loadPlugin("RenderVector"); +renderPlugin = schnapps.loadPlugin("RenderD"); +renderVectorPlugin = schnapps.loadPlugin("RenderVectorD"); differentialPropertiesPlugin = schnapps.loadPlugin("DifferentialProperties"); subdivisionPlugin = schnapps.loadPlugin("SubdivideSurface"); surfaceDeformationPlugin = schnapps.loadPlugin("SurfaceDeformation"); diff --git a/SCHNApps/include/dialogs/mapsDialog.h b/SCHNApps/include/dialogs/mapsDialog.h index b055dc29633957abe9e27c6ddaff85de3c117ba4..f8e131f064747bd87b204abf0b9de4ad66155bff 100644 --- a/SCHNApps/include/dialogs/mapsDialog.h +++ b/SCHNApps/include/dialogs/mapsDialog.h @@ -26,10 +26,11 @@ private: void clearInfo(); public slots: - void cb_removeMap(); - void cb_selectedMapChanged(); - void cb_addMapToList(MapHandlerGen* m); - void cb_removeMapFromList(MapHandlerGen* m); + void removeMap(); + void selectedMapChanged(); + void toggleVBO(QListWidgetItem* item); + void addMapToList(MapHandlerGen* m); + void removeMapFromList(MapHandlerGen* m); }; } // namespace SCHNApps diff --git a/SCHNApps/include/mapHandler.h b/SCHNApps/include/mapHandler.h index 01c834fa182fb9a6fccd821eadbb678c8f7d2cbc..7787cf1e0878b73e5689923034ce2fe9da9558cf 100644 --- a/SCHNApps/include/mapHandler.h +++ b/SCHNApps/include/mapHandler.h @@ -71,12 +71,26 @@ public: template inline void notifyAttributeModification(const AttributeHandler& attr) { - emit(attributeModified(ORBIT, QString::fromStdString(attr.name()))); + QString nameAttr = QString::fromStdString(attr.name()); + if(h_vbo.contains(nameAttr)) + h_vbo[nameAttr]->updateData(attr); + + emit(attributeModified(ORBIT, nameAttr)); + + foreach(View* view, l_views) + view->updateGL(); } inline void notifyConnectivityModification() { + m_render->setPrimitiveDirty(Algo::Render::GL2::POINTS); + m_render->setPrimitiveDirty(Algo::Render::GL2::LINES); + m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES); + emit(connectivityModified()); + + foreach(View* view, l_views) + view->updateGL(); } /********************************************************* diff --git a/SCHNApps/include/mapHandler.hpp b/SCHNApps/include/mapHandler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fd5407aac0340bb930e3b416176870b108156132 --- /dev/null +++ b/SCHNApps/include/mapHandler.hpp @@ -0,0 +1,92 @@ + +namespace CGoGN +{ + +namespace SCHNApps +{ + +template +AttributeHandler MapHandlerGen::getAttribute(const QString& nameAttr, bool onlyRegistered) const +{ + if(onlyRegistered) + { + if(h_attribs[ORBIT].contains(nameAttr)) + return static_cast(m_map)->getAttribute(nameAttr.toStdString()); + else + return AttributeHandler(); + } + else + return static_cast(m_map)->getAttribute(nameAttr.toStdString()); +} + +template +AttributeHandler MapHandlerGen::addAttribute(const QString& nameAttr, bool registerAttr) +{ + AttributeHandler ah = static_cast(m_map)->addAttribute(nameAttr.toStdString()); + if(ah.isValid() && registerAttr) + { + registerAttribute(ah); + emit(attributeAdded(ORBIT, nameAttr)); + } + return ah; +} + +template +inline void MapHandlerGen::registerAttribute(const AttributeHandler& ah) +{ + h_attribs[ORBIT].insert(QString::fromStdString(ah.name()), QString::fromStdString(nameOfType(T()))); +} + +inline QString MapHandlerGen::getAttributeTypeName(unsigned int orbit, const QString& nameAttr) const +{ + if(h_attribs[orbit].contains(nameAttr)) + return h_attribs[orbit][nameAttr]; + else + return ""; +} + +template +Utils::VBO* MapHandlerGen::createVBO(const ATTR_HANDLER& attr) +{ + QString name = QString::fromStdString(attr.name()); + Utils::VBO* vbo = getVBO(name); + if(!vbo) + { + vbo = new Utils::VBO(attr.name()); + vbo->updateData(attr); + h_vbo.insert(name, vbo); + emit(vboAdded(vbo)); + } + return vbo; +} + +template +inline void MapHandlerGen::updateVBO(const ATTR_HANDLER& attr) +{ + Utils::VBO* vbo = getVBO(QString::fromStdString(attr.name())); + if(vbo) + vbo->updateData(attr); +} + + + +template +void MapHandler::draw(Utils::GLSLShader* shader, int primitive) +{ + if(!m_render->isPrimitiveUpToDate(primitive)) + m_render->initPrimitives(*(static_cast(m_map)), allDarts, primitive) ; + m_render->draw(shader, primitive); +} + +template +void MapHandler::updateBB(const VertexAttribute& position) +{ + CGoGN::Geom::BoundingBox bb = CGoGN::Algo::Geometry::computeBoundingBox(*(static_cast(m_map)), position); + m_bbMin = qglviewer::Vec(bb.min()[0], bb.min()[1], bb.min()[2]); + m_bbMax = qglviewer::Vec(bb.max()[0], bb.max()[1], bb.max()[2]); + m_bbDiagSize = (m_bbMax - m_bbMin).norm(); +} + +} // namespace SCHNApps + +} // namespace CGoGN diff --git a/SCHNApps/src/dialogs/mapsDialog.cpp b/SCHNApps/src/dialogs/mapsDialog.cpp index 624ce43db797a08b188d9de360c42d7188a4e2b9..9d04c94e60091fce5a54660645c9c85eedddf205 100644 --- a/SCHNApps/src/dialogs/mapsDialog.cpp +++ b/SCHNApps/src/dialogs/mapsDialog.cpp @@ -17,15 +17,16 @@ MapsDialog::MapsDialog(Window* window) : m_window(window) { setupUi(this); - setModal(false); +// setModal(false); - connect(button_removeMap, SIGNAL(clicked()), this, SLOT(cb_removeMap())); - connect(button_refreshMapInfo, SIGNAL(clicked()), this, SLOT(cb_selectedMapChanged())); + connect(button_removeMap, SIGNAL(clicked()), this, SLOT(removeMap())); + connect(button_refreshMapInfo, SIGNAL(clicked()), this, SLOT(selectedMapChanged())); - connect(mapList, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedMapChanged())); + connect(mapList, SIGNAL(itemSelectionChanged()), this, SLOT(selectedMapChanged())); + connect(vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(toggleVBO(QListWidgetItem*))); - connect(m_window, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(cb_addMapToList(MapHandlerGen*))); - connect(m_window, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(cb_removeMapFromList(MapHandlerGen*))); + connect(m_window, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(addMapToList(MapHandlerGen*))); + connect(m_window, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(removeMapFromList(MapHandlerGen*))); } MapsDialog::~MapsDialog() @@ -48,7 +49,7 @@ void MapsDialog::clearInfo() lineEdit_face_cells->setText(""); } -void MapsDialog::cb_removeMap() +void MapsDialog::removeMap() { QList currentItems = mapList->selectedItems(); if(!currentItems.empty()) @@ -58,14 +59,14 @@ void MapsDialog::cb_removeMap() if(!m->isUsed()) { m_window->removeMap(name); - cb_selectedMapChanged(); + clearInfo(); } else QMessageBox::warning(this, tr("Warning"), "Map is currently used"); } } -void MapsDialog::cb_selectedMapChanged() +void MapsDialog::selectedMapChanged() { clearInfo(); @@ -127,11 +128,25 @@ void MapsDialog::cb_selectedMapChanged() QString type = QString::fromStdString(types[i]); switch(orbit) { - case DART : dartAttributes->addItem(name + " (" + type + ")"); break; - case VERTEX : vertexAttributes->addItem(name + " (" + type + ")"); break; - case EDGE : edgeAttributes->addItem(name + " (" + type + ")"); break; - case FACE : faceAttributes->addItem(name + " (" + type + ")"); break; - case VOLUME : volumeAttributes->addItem(name + " (" + type + ")"); break; + case DART : { + dartAttributes->addItem(name + " (" + type + ")"); + } break; + case VERTEX : { + QListWidgetItem* item = new QListWidgetItem(name + " (" + type + ")", vertexAttributes); + if(mh->getVBO(name)) + item->setCheckState(Qt::Checked); + else + item->setCheckState(Qt::Unchecked); + } break; + case EDGE : { + edgeAttributes->addItem(name + " (" + type + ")"); + } break; + case FACE : { + faceAttributes->addItem(name + " (" + type + ")"); + } break; + case VOLUME : { + volumeAttributes->addItem(name + " (" + type + ")"); + } break; } } } @@ -139,12 +154,32 @@ void MapsDialog::cb_selectedMapChanged() } } -void MapsDialog::cb_addMapToList(MapHandlerGen* m) +void MapsDialog::toggleVBO(QListWidgetItem *item) +{ + QList currentItems = mapList->selectedItems(); + if(!currentItems.empty()) + { +// QListWidgetItem* current = currentItems[0]; +// const QString& mapName = current->text(); +// MapHandlerGen* mh = m_window->getMap(mapName); + + if(item->checkState() == Qt::Checked) + { + + } + else // Unchecked + { + + } + } +} + +void MapsDialog::addMapToList(MapHandlerGen* m) { mapList->addItem(m->getName()); } -void MapsDialog::cb_removeMapFromList(MapHandlerGen* m) +void MapsDialog::removeMapFromList(MapHandlerGen* m) { QList items = mapList->findItems(m->getName(), Qt::MatchExactly); if(!items.empty()) diff --git a/include/Algo/BooleanOperator/mergeVertices.hpp b/include/Algo/BooleanOperator/mergeVertices.hpp index 552721a8d9494a0e54daa70e6221b39d93047558..acae96b2498be67d966ddad5915b9b369256cfed 100644 --- a/include/Algo/BooleanOperator/mergeVertices.hpp +++ b/include/Algo/BooleanOperator/mergeVertices.hpp @@ -53,15 +53,16 @@ void mergeVertex(typename PFP::MAP& map, VertexAttribute& po Dart e1 = map.alpha1(e) ; // e1 stores next dart of vertex of e if (e1 == e) notempty = false ; // last dart of vertex of e - else { + else + { map.removeEdgeFromVertex(e) ; // detach e from its vertex } // Searchs where e may be inserted in the vertex of d Dart d1 = d ; do { - if (CGoGN::Algo::BooleanOperator::isBetween(map, positions, e, d, - map.alpha1(d))) break ; + if (isBetween(map, positions, e, d, map.alpha1(d))) + break ; d = map.alpha1(d) ; } while (d != d1) ; @@ -91,8 +92,10 @@ void mergeVertices(typename PFP::MAP& map, VertexAttribute& { if(positions[d1].isNear(positions[d2], precision)) { - if (map.sameVertex(d1,d2)) std::cout << "fusion: sameVertex" << std::endl ; - if (!map.sameVertex(d1,d2)) mergeVertex(map,positions,d1,d2,precision); + if (map.sameVertex(d1,d2)) + std::cout << "fusion: sameVertex" << std::endl ; + if (!map.sameVertex(d1,d2)) + mergeVertex(map,positions,d1,d2,precision); } } } diff --git a/include/Algo/Import/importSvg.hpp b/include/Algo/Import/importSvg.hpp index c70c3ac339d918c25ed18e3b5dd5de40df522abd..fb92cf136087b7839ee9b8ecf80eb7f41281693f 100644 --- a/include/Algo/Import/importSvg.hpp +++ b/include/Algo/Import/importSvg.hpp @@ -350,7 +350,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib ///////////////////////////////////////////////////////////////////////////////////////////// // Merge near vertices - Algo::BooleanOperator::mergeVertices(map,position,1); + BooleanOperator::mergeVertices(map,position,1); std::cout << "importSVG : Merging of vertices." << std::endl; ///////////////////////////////////////////////////////////////////////////////////////////// @@ -521,7 +521,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib { for (Dart d = map.begin() ; d != map.end() ; map.next(d)) { - if(map.isBoundaryMarked(d)) + if(map.isBoundaryMarked2(d)) { map.fillHole(d); } @@ -557,7 +557,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib for (Dart d = map.begin() ; d != map.end() ; map.next(d)) { - if (!map.isBoundaryMarked(d) && brokenL.isMarked(d)) + if (!map.isBoundaryMarked2(d) && brokenL.isMarked(d)) { map.deleteFace(d,false); } @@ -567,7 +567,7 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib for (Dart d = map.begin() ; d != map.end() ; map.next(d)) { - if (map.isBoundaryMarked(d)) + if (map.isBoundaryMarked2(d)) buildingMark.mark(d); } diff --git a/include/Algo/MovingObjects/particle_cell_2D.h b/include/Algo/MovingObjects/particle_cell_2D.h index ce382194b8de82dc92f78cc872d017f069a454a7..cafc9f81ddc3add6e4d78871f0a4f45d383aa0b5 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.h +++ b/include/Algo/MovingObjects/particle_cell_2D.h @@ -29,7 +29,7 @@ enum } ; template -class ParticleCell2D : public MovingObjects::ParticleBase +class ParticleCell2D : public Algo::MovingObjects::ParticleBase { public: typedef typename PFP::MAP MAP ; @@ -46,7 +46,7 @@ public: unsigned int crossCell ; ParticleCell2D(MAP& map, Dart belonging_cell, const VEC3& pos, const TAB_POS& tabPos) : - ParticleBase(pos), + Algo::MovingObjects::ParticleBase(pos), m(map), positionAttribut(tabPos), d(belonging_cell), @@ -105,7 +105,7 @@ public: else { // TODO Des petits pas répétés peuvent faire sortir de la cellule actuelle - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; } } } ; diff --git a/include/Algo/MovingObjects/particle_cell_2D.hpp b/include/Algo/MovingObjects/particle_cell_2D.hpp index 27ce79a164a00271171070c2449549bad638e02c..aba74824ef689256acdf76d7b756986905914c73 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D.hpp @@ -104,7 +104,7 @@ void ParticleCell2D::vertexState(const VEC3& goal) if (Geometry::isPointOnVertex < PFP > (m, d, positionAttribut, goal)) { this->setState(VERTEX) ; - this->ParticleBase < PFP > ::move(goal) ; + this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ; return ; } else @@ -147,7 +147,7 @@ void ParticleCell2D::vertexState(const VEC3& goal) this->setState(VERTEX) ; - this->ParticleBase < PFP > ::move(goal) ; + this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ; return ; } } @@ -212,19 +212,19 @@ void ParticleCell2D::edgeState(const VEC3& goal, Geom::Orientation2D sideOf if (!Geometry::isPointOnHalfEdge < PFP > (m, d, positionAttribut, goal)) { - this->ParticleBase < PFP > ::move(positionAttribut[d]) ; + this->Algo::MovingObjects::ParticleBase < PFP > ::move(positionAttribut[d]) ; vertexState(goal) ; return ; } else if (!Geometry::isPointOnHalfEdge < PFP > (m, m.phi2(d), positionAttribut, goal)) { d = m.phi2(d) ; - this->ParticleBase < PFP > ::move(positionAttribut[d]) ; + this->Algo::MovingObjects::ParticleBase < PFP > ::move(positionAttribut[d]) ; vertexState(goal) ; return ; } - this->ParticleBase < PFP > ::move(goal) ; + this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ; } template @@ -341,16 +341,16 @@ void ParticleCell2D::faceState(const VEC3& goal) d = m.phi1(d) ; break ; case Geom::ALIGNED : - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; edgeState(goal) ; return ; case Geom::RIGHT : - this->ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; + this->Algo::MovingObjects::ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; edgeState(goal, Geom::RIGHT) ; return ; } } while (d != dd) ; - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; this->setState(FACE) ; // m_position = Geometry::faceCentroid(m,d,m_positions); @@ -387,19 +387,19 @@ void ParticleCell2D::faceState(const VEC3& goal) break ; case Geom::ALIGNED : // CGoGNout << "pic" << CGoGNendl; - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; edgeState(goal) ; return ; case Geom::RIGHT : // CGoGNout << "smthg went bad(2) " << m_position << CGoGNendl; - this->ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; + this->Algo::MovingObjects::ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; // CGoGNout << " " << m_position << CGoGNendl; edgeState(goal, Geom::RIGHT) ; return ; } } while (d != dd) ; - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; this->setState(FACE) ; return ; } @@ -409,7 +409,7 @@ void ParticleCell2D::faceState(const VEC3& goal) switch (getOrientationEdge(goal, d)) { case Geom::LEFT : - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; this->setState(FACE) ; ; break ; @@ -428,12 +428,12 @@ void ParticleCell2D::faceState(const VEC3& goal) if (wsoe == Geom::ALIGNED) { d = m.phi1(d) ; //to check - this->ParticleBase::move(positionAttribut[d]) ; + this->Algo::MovingObjects::ParticleBase::move(positionAttribut[d]) ; vertexState(goal) ; } else { - this->ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; + this->Algo::MovingObjects::ParticleBase::move(intersectLineEdge(goal, this->getPosition(), d)) ; edgeState(goal, Geom::RIGHT) ; } break ; diff --git a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp index d4d667dfa60a585093fb5341929f399e4db6d8be..d1dd3f39040f96cf00efdd21fee7275d3d552e63 100644 --- a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp @@ -59,7 +59,7 @@ std::vector ParticleCell2DMemo::move(const VEC3& goal) return memo_cross.get_markedCells(); } else - this->ParticleBase::move(goal) ; + this->Algo::MovingObjects::ParticleBase::move(goal) ; std::vector res; res.push_back(this->d); @@ -87,7 +87,7 @@ void ParticleCell2DMemo::vertexState(const VEC3& current, CellMarkerMemo (this->m, this->d, this->positionAttribut, current)) { this->setState(VERTEX) ; - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; return ; } else @@ -130,7 +130,7 @@ void ParticleCell2DMemo::vertexState(const VEC3& current, CellMarkerMemod = this->m.phi2_1(this->d) ; } while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ; - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; this->setState(VERTEX) ; return ; } @@ -199,7 +199,7 @@ void ParticleCell2DMemo::edgeState(const VEC3& current, CellMarkerMemo (this->m, this->d, this->positionAttribut, current)) { - this->ParticleBase::move(this->positionAttribut[this->d]) ; + this->Algo::MovingObjects::ParticleBase::move(this->positionAttribut[this->d]) ; vertexState(current,memo_cross) ; return ; } @@ -207,12 +207,12 @@ void ParticleCell2DMemo::edgeState(const VEC3& current, CellMarkerMemo (this->m, this->m.phi2(this->d), this->positionAttribut, current)) { this->d = this->m.phi2(this->d) ; - this->ParticleBase::move(this->positionAttribut[this->d]) ; + this->Algo::MovingObjects::ParticleBase::move(this->positionAttribut[this->d]) ; vertexState(current,memo_cross) ; return ; } - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; } template @@ -253,20 +253,20 @@ void ParticleCell2DMemo::faceState(const VEC3& current, CellMarkerMemod = this->m.phi1(this->d) ; break ; case Geom::ALIGNED : - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; edgeState(current,memo_cross) ; return ; case Geom::RIGHT : // CGoGNout << "smthg went bad " << m_position << " " << current << CGoGNendl; // CGoGNout << "d1 " << m_positions[d] << " d2 " << m_positions[m.phi1(d)] << CGoGNendl; - this->ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; + this->Algo::MovingObjects::ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; // CGoGNout << " " << m_position << CGoGNendl; edgeState(current,memo_cross, Geom::RIGHT) ; return ; } } while (this->d != dd) ; - this->ParticleBase::move(current); + this->Algo::MovingObjects::ParticleBase::move(current); this->setState(FACE) ; // m_position = Geometry::faceCentroid(m,d,m_positions); @@ -303,19 +303,19 @@ void ParticleCell2DMemo::faceState(const VEC3& current, CellMarkerMemoParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; edgeState(current,memo_cross) ; return ; case Geom::RIGHT : // CGoGNout << "smthg went bad(2) " << m_position << CGoGNendl; - this->ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; + this->Algo::MovingObjects::ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; // CGoGNout << " " << m_position << CGoGNendl; edgeState(current,memo_cross ,Geom::RIGHT) ; return ; } } while (this->d != dd) ; - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; this->setState(FACE) ; return ; } @@ -325,7 +325,7 @@ void ParticleCell2DMemo::faceState(const VEC3& current, CellMarkerMemogetOrientationEdge(current, this->d)) { case Geom::LEFT : - this->ParticleBase::move(current) ; + this->Algo::MovingObjects::ParticleBase::move(current) ; this->setState(FACE) ; ; break ; @@ -345,12 +345,12 @@ void ParticleCell2DMemo::faceState(const VEC3& current, CellMarkerMemod = this->m.phi1(this->d) ; //to check - this->ParticleBase::move(this->positionAttribut[this->d]) ; + this->Algo::MovingObjects::ParticleBase::move(this->positionAttribut[this->d]) ; vertexState(current,memo_cross) ; } else { - this->ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; + this->Algo::MovingObjects::ParticleBase::move(this->intersectLineEdge(current, this->getPosition(), this->d)) ; edgeState(current,memo_cross, Geom::RIGHT) ; } } diff --git a/include/Utils/vbo_base.h b/include/Utils/vbo_base.h index bded8e6cb351e0ce3348d60a2a9ae80adb7187b1..e202210a2159655509417208d860e179a779c4fd 100644 --- a/include/Utils/vbo_base.h +++ b/include/Utils/vbo_base.h @@ -70,7 +70,7 @@ public: /** * constructor: allocate the OGL VBO */ - VBO(); + VBO(const std::string& name = ""); /** * copy constructor, new VBO copy content diff --git a/src/Utils/vbo.cpp b/src/Utils/vbo.cpp index 954309c0544c6005f8bada7c550a354907be933a..56e7cc0c0d343d347313a2536f9973645193245a 100644 --- a/src/Utils/vbo.cpp +++ b/src/Utils/vbo.cpp @@ -33,7 +33,7 @@ namespace CGoGN namespace Utils { -VBO::VBO() : m_nbElts(0), m_lock(false) +VBO::VBO(const std::string& name) : m_nbElts(0), m_lock(false), m_name(name) { glGenBuffers(1, &(*m_id)); m_refs.reserve(4);