From 5b0ed49cf875ae91e2c8a61c1caa51519aa945bc Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Thu, 2 Sep 2010 20:11:07 +0000 Subject: [PATCH] updated VASE to compile with new meshlab --- src/meshlabplugins/edit_scan/edit_scan.cpp | 4 ++-- src/meshlabplugins/edit_vase/balloon.cpp | 14 ++++++++++---- src/meshlabplugins/edit_vase/vasewidget.cpp | 17 +++++++++-------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/meshlabplugins/edit_scan/edit_scan.cpp b/src/meshlabplugins/edit_scan/edit_scan.cpp index 45cc6cfc2..226f0d5da 100644 --- a/src/meshlabplugins/edit_scan/edit_scan.cpp +++ b/src/meshlabplugins/edit_scan/edit_scan.cpp @@ -48,7 +48,7 @@ bool VirtualScan::StartEdit(MeshDocument& md, GLArea* gla){ timer = 0; //--- Create a new model to store the scan cloud - cloud = new MeshModel("Scan cloud"); + cloud = new MeshModel(&md, "Scan cloud"); //--- Instantiate the UI, and connect events widget = new Widget(gla->window()); @@ -101,7 +101,7 @@ void VirtualScan::EndEdit(MeshModel&, GLArea* ){ void VirtualScan::save_requested(){ md->addNewMesh("scan",cloud,false); //--- Create a new model to store the scan cloud - cloud = new MeshModel("Scan cloud"); + cloud = new MeshModel(this->md, "Scan cloud"); } // This is called only when mouse is pressed at first during a drag or a click is received diff --git a/src/meshlabplugins/edit_vase/balloon.cpp b/src/meshlabplugins/edit_vase/balloon.cpp index 7c119b6cd..2eb72f635 100644 --- a/src/meshlabplugins/edit_vase/balloon.cpp +++ b/src/meshlabplugins/edit_vase/balloon.cpp @@ -278,7 +278,7 @@ void Balloon::evolveBalloon(){ } //--- Compute updates from amount stored in vertex quality - float a,b,c; + Point3f c; // barycentric coefficients Point3f voxp; std::vector updates_view(vol.band.size(),0); std::vector updates_curv(vol.band.size(),0); @@ -294,16 +294,22 @@ void Balloon::evolveBalloon(){ vol.off2pos(voxi, voxp); vcg::SignedFacePointDistance(f, voxp, proj); Triangle3 triFace( f.P(0), f.P(1), f.P(2) ); - vcg::InterpolationParameters(triFace, proj, a,b,c); + + // Paolo, is this really necessary? + int axis; + if (f.Flags() & CFaceO::NORMX ) axis = 0; + else if(f.Flags() & CFaceO::NORMY ) axis = 1; + else axis = 2; + vcg::InterpolationParameters(triFace, axis, proj, c); // Interpolate update amounts & keep track of the range if( surf.vert.QualityEnabled ){ - updates_view[i] = a*f.V(0)->Q() + b*f.V(1)->Q() + c*f.V(2)->Q(); + updates_view[i] = c[0]*f.V(0)->Q() + c[1]*f.V(1)->Q() + c[2]*f.V(2)->Q(); view_maxdst = (fabs(updates_view[i])>view_maxdst) ? fabs(updates_view[i]) : view_maxdst; } // Interpolate curvature amount & keep track of the range if( surf.vert.CurvatureEnabled ){ - updates_curv[i] = a*f.V(0)->Kh() + b*f.V(1)->Kh() + c*f.V(2)->Kh(); + updates_curv[i] = c[0]*f.V(0)->Kh() + c[1]*f.V(1)->Kh() + c[2]*f.V(2)->Kh(); curv_maxval = (fabs(updates_curv[i])>curv_maxval) ? fabs(updates_curv[i]) : curv_maxval; } } diff --git a/src/meshlabplugins/edit_vase/vasewidget.cpp b/src/meshlabplugins/edit_vase/vasewidget.cpp index d5acad864..7710db9ed 100644 --- a/src/meshlabplugins/edit_vase/vasewidget.cpp +++ b/src/meshlabplugins/edit_vase/vasewidget.cpp @@ -88,7 +88,7 @@ void VaseWidget::on_initButton_released(){ int gridsize = ui.gridsize->text().toInt(); int gridpad = ui.padsize->text().toInt(); balloon->init( gridsize, gridpad ); - gla->log.Log(GLLogStream::FILTER, "Field refreshed with new distances"); + gla->log->Log(GLLogStream::FILTER, "Field refreshed with new distances"); gla->update(); // Pick Z slice and update slice view @@ -105,7 +105,7 @@ void VaseWidget::on_slice_offset_sliderMoved(int){ void VaseWidget::on_iterationButton_released(){ bool op_succeed = false; for(int i=0; ivalue(); i++){ - gla->log.Logf(GLLogStream::FILTER, "\n----- began iteration %d -----", balloon->numiterscompleted); + gla->log->Logf(GLLogStream::FILTER, "\n----- began iteration %d -----", balloon->numiterscompleted); op_succeed = balloon->initializeField(); if( !op_succeed ) break; balloon->interpolateField(); if( !op_succeed ) break; balloon->computeCurvature(); if( !op_succeed ) break; @@ -118,18 +118,18 @@ void VaseWidget::on_iterationButton_released(){ void VaseWidget::on_refreshButton_released(){ bool op_failed = balloon->initializeField(); balloon->render(gla); // why is this here???? - gla->log.Logf(GLLogStream::FILTER, "Refreshed view-based distance field %s", ((op_failed)?"**FAILED!**":"completed") ); + gla->log->Logf(GLLogStream::FILTER, "Refreshed view-based distance field %s", ((op_failed)?"**FAILED!**":"completed") ); gla->update(); } void VaseWidget::on_interpButton_released(){ balloon->interpolateField(); balloon->rm |= Balloon::SURF_VCOLOR; - gla->log.Log(GLLogStream::FILTER, "Distance field interpolated"); + gla->log->Log(GLLogStream::FILTER, "Distance field interpolated"); gla->update(); } void VaseWidget::on_evolveButton_released(){ balloon->evolveBalloon(); - gla->log.Logf(GLLogStream::FILTER, "Finished ballon evolution iteration %d", balloon->numiterscompleted); + gla->log->Logf(GLLogStream::FILTER, "Finished ballon evolution iteration %d", balloon->numiterscompleted); gla->update(); } void VaseWidget::on_laplButton_released(){ @@ -142,9 +142,10 @@ void VaseWidget::on_pushButton_released(){ // This way of creating a new model in the model is awkward // - why there is not a MeshModel( CMeshO& mesh )? // - what's the need to specify the name twice? - MeshModel* mm = new MeshModel("Balloon"); - vcg::tri::Append::Mesh(mm->cm, balloon->surf); - meshDocument->addNewMesh("Balloon",mm,false); + MeshModel* mm = new MeshModel(this->meshDocument, "Balloon"); + qDebug() << "warning: save has been disabled, Append fails"; + //vcg::tri::Append::Mesh(mm->cm, balloon->surf); + // meshDocument->addNewMesh("Balloon",mm,false); } void VaseWidget::on_viewDirs_toggled(bool checked){