Commit 3eeb00bd authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: Surface_Radiance: start distance computation

parent f54353e0
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<width>227</width>
<height>600</height>
</rect>
</property>
......@@ -21,8 +21,8 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="combo_normalVBO">
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="combo_positionVBO">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -36,8 +36,15 @@
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="combo_positionVBO">
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Normal :</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="combo_normalVBO">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -51,60 +58,87 @@
</item>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="button_decimate">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="checkbox_fragInterp">
<property name="text">
<string>Decimate</string>
<string>Fragment interpolation</string>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="3" column="0" colspan="3">
<widget class="QSlider" name="slider_decimationGoal">
<property name="maximum">
<number>100</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="value">
<number>50</number>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Normal :</string>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="checkbox_halfCollapse">
<property name="text">
<string>Half Collapse</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QSlider" name="slider_decimationGoal">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
<item row="5" column="0" colspan="3">
<widget class="QPushButton" name="button_decimate">
<property name="text">
<string>Decimate</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkbox_fragInterp">
<item row="8" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Fragment interpolation</string>
<string>Object 2 :</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QPushButton" name="button_computeDistance">
<property name="text">
<string>Compute distance</string>
</property>
</widget>
</item>
<item row="10" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1" colspan="2">
<widget class="QComboBox" name="combo_object2"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Object 1 :</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<widget class="QComboBox" name="combo_object1"/>
</item>
</layout>
</widget>
<resources/>
......
......@@ -108,6 +108,10 @@ public slots:
bool halfCollapse = false,
bool exportMeshes = false
);
void computeDistance(
const QString& mapName1,
const QString& mapName2
);
void exportPLY(
const QString& mapName,
const QString& positionAttributeName,
......
......@@ -35,12 +35,17 @@ private slots:
void fragmentInterpolationChanged(int state);
void decimateClicked();
void computeDistanceClicked();
private:
void addPositionVBO(QString name);
void removePositionVBO(QString name);
void addNormalVBO(QString name);
void removeNormalVBO(QString name);
void addObject(QString name);
void removeObject(QString name);
void updateMapParameters();
};
......
......@@ -97,6 +97,8 @@ void Surface_Radiance_Plugin::mapAdded(MapHandlerGen* map)
connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
connect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
connect(map, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString)));
m_dockTab->addObject(map->getName());
}
void Surface_Radiance_Plugin::mapRemoved(MapHandlerGen* map)
......@@ -104,6 +106,8 @@ void Surface_Radiance_Plugin::mapRemoved(MapHandlerGen* map)
disconnect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
disconnect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
disconnect(map, SIGNAL(attributeModified(unsigned int, QString)), this, SLOT(attributeModified(unsigned int, QString)));
m_dockTab->removeObject(map->getName());
}
......@@ -413,6 +417,11 @@ void Surface_Radiance_Plugin::decimate(const QString& mapName, const QString& po
mh->notifyAttributeModification(position);
}
void Surface_Radiance_Plugin::computeDistance(const QString& mapName1, const QString& mapName2)
{
}
void Surface_Radiance_Plugin::checkNbVerticesAndExport(Surface_Radiance_Plugin* p, const unsigned int* nbVertices)
{
if (!p->exportNbVert.empty())
......
......@@ -21,6 +21,7 @@ Surface_Radiance_DockTab::Surface_Radiance_DockTab(SCHNApps* s, Surface_Radiance
connect(combo_normalVBO, SIGNAL(currentIndexChanged(int)), this, SLOT(normalVBOChanged(int)));
connect(checkbox_fragInterp, SIGNAL(stateChanged(int)), this, SLOT(fragmentInterpolationChanged(int)));
connect(button_decimate, SIGNAL(clicked()), this, SLOT(decimateClicked()));
connect(button_computeDistance, SIGNAL(clicked()), this, SLOT(computeDistanceClicked()));
}
......@@ -89,6 +90,14 @@ void Surface_Radiance_DockTab::decimateClicked()
checkbox_halfCollapse->checkState() == Qt::Checked);
}
void Surface_Radiance_DockTab::computeDistanceClicked()
{
m_plugin->computeDistance(
combo_object1->currentText(),
combo_object2->currentText()
);
}
......@@ -129,6 +138,30 @@ void Surface_Radiance_DockTab::removeNormalVBO(QString name)
b_updatingUI = false;
}
void Surface_Radiance_DockTab::addObject(QString name)
{
b_updatingUI = true;
combo_object1->addItem(name);
combo_object2->addItem(name);
b_updatingUI = false;
}
void Surface_Radiance_DockTab::removeObject(QString name)
{
b_updatingUI = true;
int curIndex1 = combo_object1->currentIndex();
int index1 = combo_object1->findText(name, Qt::MatchExactly);
if(curIndex1 == index1)
combo_object1->setCurrentIndex(0);
combo_object1->removeItem(index1);
int curIndex2 = combo_object2->currentIndex();
int index2 = combo_object2->findText(name, Qt::MatchExactly);
if(curIndex2 == index2)
combo_object2->setCurrentIndex(0);
combo_object2->removeItem(index2);
b_updatingUI = false;
}
void Surface_Radiance_DockTab::updateMapParameters()
{
b_updatingUI = true;
......@@ -137,6 +170,10 @@ void Surface_Radiance_DockTab::updateMapParameters()
combo_positionVBO->addItem("- select VBO -");
combo_normalVBO->clear();
combo_normalVBO->addItem("- select VBO -");
combo_object1->clear();
combo_object1->addItem("- select map -");
combo_object2->clear();
combo_object2->addItem("- select map -");
MapHandlerGen* map = m_schnapps->getSelectedMap();
if(map)
......@@ -162,6 +199,12 @@ void Surface_Radiance_DockTab::updateMapParameters()
checkbox_fragInterp->setChecked(p.radiancePerVertexShader->getFragInterp());
}
foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
{
combo_object1->addItem(map->getName());
combo_object2->addItem(map->getName());
}
b_updatingUI = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment