updated VASE to compile with new meshlab

This commit is contained in:
Paolo Cignoni cignoni 2010-09-02 20:11:07 +00:00
parent bb3e4e9ad5
commit 5b0ed49cf8
3 changed files with 21 additions and 14 deletions

View File

@ -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

View File

@ -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<float> updates_view(vol.band.size(),0);
std::vector<float> updates_curv(vol.band.size(),0);
@ -294,16 +294,22 @@ void Balloon::evolveBalloon(){
vol.off2pos(voxi, voxp);
vcg::SignedFacePointDistance(f, voxp, proj);
Triangle3<float> 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;
}
}

View File

@ -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; i<ui.numItersSpin->value(); 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<CMeshO,CMeshO>::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<CMeshO,CMeshO>::Mesh(mm->cm, balloon->surf);
// meshDocument->addNewMesh("Balloon",mm,false);
}
void VaseWidget::on_viewDirs_toggled(bool checked){