Commit 7c660fcf authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps - surface Radiance : append "half" or "full" in export file names

parent f7173772
......@@ -40,7 +40,7 @@ struct MapParameters
VertexAttribute<Geom::Vec2i, PFP2::MAP> param;
Utils::VBO* paramVBO;
DartAttribute<PFP2::REAL, PFP2::MAP> halfedgeError;
// DartAttribute<PFP2::REAL, PFP2::MAP> halfedgeError;
Algo::Surface::Decimation::ApproximatorGen<PFP2>* positionApproximator;
Algo::Surface::Decimation::ApproximatorGen<PFP2>* normalApproximator;
......@@ -115,12 +115,14 @@ public slots:
protected:
MapHandlerGen* currentlyDecimatedMap() { return m_currentlyDecimatedMap; }
bool currentDecimationHalf() { return m_currentDecimationHalf; }
static void checkNbVerticesAndExport(Surface_Radiance_Plugin* p, const unsigned int* nbVertices);
Surface_Radiance_DockTab* m_dockTab;
QHash<MapHandlerGen*, MapParameters> h_mapParameterSet;
MapHandlerGen* m_currentlyDecimatedMap;
bool m_currentDecimationHalf;
std::vector<unsigned int> exportNbVert;
unsigned int nextExportIndex;
......
......@@ -60,6 +60,7 @@ void Surface_Radiance_Plugin::drawMap(View* view, MapHandlerGen* map)
{
p.radiancePerVertexShader->setAttributePosition(p.positionVBO);
p.radiancePerVertexShader->setAttributeNormal(p.normalVBO);
p.radiancePerVertexShader->setAttributeRadiance(p.paramVBO, p.radianceTexture, GL_TEXTURE1);
qglviewer::Vec c = view->getCurrentCamera()->position();
PFP2::VEC3 camera(c.x, c.y, c.z);
......@@ -263,14 +264,14 @@ MapHandlerGen* Surface_Radiance_Plugin::importFromFile(const QString& fileName)
mapParams.radianceTexture->update();
// map->removeAttribute(mapParams.radiance);
mapParams.paramVBO = new Utils::VBO();
mapParams.paramVBO->updateData(mapParams.param);
mapParams.radiancePerVertexShader = new Utils::ShaderRadiancePerVertex(Utils::SphericalHarmonics<PFP2::REAL, PFP2::VEC3>::get_resolution());
registerShader(mapParams.radiancePerVertexShader);
mapParams.radiancePerVertexShader->setAttributeRadiance(mapParams.paramVBO, mapParams.radianceTexture, GL_TEXTURE1);
// compute map bounding box
mh->updateBB(position);
}
......@@ -400,6 +401,7 @@ void Surface_Radiance_Plugin::decimate(const QString& mapName, const QString& po
}
m_currentlyDecimatedMap = mh;
m_currentDecimationHalf = halfCollapse;
Algo::Surface::Decimation::decimate<PFP2>(*map, mapParams.selector, approximators, decimationGoal * nbVertices, true, NULL, (void (*)(void*, const void*))(Surface_Radiance_Plugin::checkNbVerticesAndExport), (void*)(this));
m_currentlyDecimatedMap = NULL;
......@@ -415,7 +417,7 @@ void Surface_Radiance_Plugin::checkNbVerticesAndExport(Surface_Radiance_Plugin*
if (*nbVertices == p->exportNbVert[p->nextExportIndex])
{
std::stringstream exportName;
exportName << p->currentlyDecimatedMap()->getName().toStdString() << "_" << *nbVertices << ".ply";
exportName << p->currentlyDecimatedMap()->getName().toStdString() << "_" << (p->currentDecimationHalf() ? "half_" : "full_") << (*nbVertices) << ".ply";
std::cout << "export : " << exportName.str() << std::endl;
p->exportPLY(mhg->getName(), "position", "normal", QString::fromStdString(exportName.str()));
p->nextExportIndex++;
......
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