~ubuntu-branches/ubuntu/lucid/meshlab/lucid

« back to all changes in this revision

Viewing changes to meshlab/src/meshlabplugins/filter_meshing/meshfilter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * for more details.                                                         *
20
20
 *                                                                           *
21
21
 ****************************************************************************/
22
 
/****************************************************************************
23
 
  History
24
 
$Log: meshfilter.cpp,v $
25
 
Revision 1.107  2008/04/04 13:22:30  cignoni
26
 
Solved namespace ambiguities caused by the removal of a silly 'using namespace' in meshmodel.h, and added a manifoldness check on the reorient tool.
27
 
 
28
 
Revision 1.106  2008/03/18 10:33:53  cignoni
29
 
added Post-Simplification cleaning filter, improved help
30
 
 
31
 
Revision 1.105  2008/03/06 08:25:04  cignoni
32
 
updated to the error message reporting style for filters
33
 
 
34
 
Revision 1.104  2008/02/12 14:21:39  cignoni
35
 
changed the function getParameter into the more meaningful getCustomParameter and added the freeze option
36
 
 
37
 
Revision 1.103  2008/02/10 09:32:39  cignoni
38
 
added a missing clear border flag in remove non manifold
39
 
 
40
 
Revision 1.102  2007/11/21 09:48:03  cignoni
41
 
better help and color clustering
42
 
 
43
 
Revision 1.101  2007/11/05 23:44:23  cignoni
44
 
Added tex simplification check, selection to paso doble and better comments
45
 
 
46
 
Revision 1.100  2007/10/16 12:19:25  cignoni
47
 
mismatch between float and absperc parameters
48
 
 
49
 
Revision 1.99  2007/10/06 23:39:01  cignoni
50
 
Updated used defined dialog to the new filter interface.
51
 
 
52
 
Revision 1.98  2007/10/02 08:13:44  cignoni
53
 
New filter interface. Hopefully more clean and easy to use.
54
 
 
55
 
Revision 1.97  2007/07/24 07:20:20  cignoni
56
 
Added Freeze transform and improved transformation dialog
57
 
 
58
 
Revision 1.96  2007/04/20 10:09:56  cignoni
59
 
issue on vertex selection from face selection
60
 
 
61
 
Revision 1.95  2007/04/16 10:16:25  cignoni
62
 
Added missing info on filtering actions
63
 
 
64
 
Revision 1.94  2007/04/16 09:25:29  cignoni
65
 
** big change **
66
 
Added Layers managemnt.
67
 
Interfaces are changing again...
68
 
 
69
 
 
70
 
****************************************************************************/
71
22
#include <QtGui>
72
23
 
73
24
#include <math.h>
85
36
#include <vcg/complex/trimesh/update/selection.h>
86
37
#include <vcg/complex/trimesh/update/curvature.h>
87
38
#include <vcg/space/normal_extrapolation.h>
88
 
 
 
39
#include "quadric_tex_simp.h"
 
40
#include "quadric_simp.h"
89
41
#include "../../meshlab/GLLogStream.h"
90
42
 
91
43
using namespace std;
92
44
using namespace vcg;
93
45
 
94
 
void QuadricSimplification(CMeshO &m,int  TargetFaceNum, float QualityThr, bool PreserveBoundary, bool PreserveNormal, bool OptimalPlacement, bool PlanarQuadric, bool Selected, CallBackPos *cb);
95
 
void QuadricTexSimplification(CMeshO &m,int  TargetFaceNum, float QualityThr,float c, bool PreserveBoundary, bool optimalPlacement, bool Selected,CallBackPos *cb);
 
46
void QuadricTexSimplification(CMeshO &m,int  TargetFaceNum, bool Selected, CallBackPos *cb);
96
47
 
97
48
ExtraMeshFilterPlugin::ExtraMeshFilterPlugin()
98
49
{
135
86
        lastq_OptimalPlacement = true;
136
87
        lastq_Selected = false;
137
88
        lastq_PlanarQuadric = false;
 
89
        lastq_QualityWeight =false;
138
90
 
139
91
        lastqtex_QualityThr = 0.3f;
140
92
        lastqtex_extratw = 0.0;
175
127
}
176
128
 
177
129
 
178
 
const QString ExtraMeshFilterPlugin::filterName(FilterIDType filter)
 
130
const QString ExtraMeshFilterPlugin::filterName(FilterIDType filter) const
179
131
{
180
132
 switch(filter)
181
133
  {
216
168
//      }
217
169
}
218
170
 
219
 
const QString ExtraMeshFilterPlugin::filterInfo(FilterIDType filterID)
 
171
const QString ExtraMeshFilterPlugin::filterInfo(FilterIDType filterID) const
220
172
{
221
173
  switch(filterID)
222
174
  {
288
240
// return
289
241
//              true if has some parameters
290
242
//              false is has no params
291
 
void ExtraMeshFilterPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet &parlst)
 
243
 
 
244
void ExtraMeshFilterPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst)
292
245
{
293
246
        float maxVal;
294
247
        QStringList methods;
298
251
                methods.push_back("Taubin approximation");
299
252
                methods.push_back("Principal Component Analysis");
300
253
                methods.push_back("Normal Cycles");
301
 
                parlst.addEnum("Method", 0, methods, tr("Method:"), tr("Choose a method"));
302
 
                parlst.addBool("Autoclean",true,QString("Remove Unreferenced Vertices"));
 
254
                parlst.addParam(new RichEnum("Method", 0, methods, tr("Method:"), tr("Choose a method")));
 
255
                parlst.addParam(new RichBool("Autoclean",true,QString("Remove Unreferenced Vertices")));
303
256
                break;
304
257
                case FP_QUADRIC_SIMPLIFICATION:
305
 
                  parlst.addInt  ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces", "The desired final number of faces.");
306
 
                  parlst.addFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size.");
307
 
                  parlst.addFloat("QualityThr",lastq_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n");
308
 
                  parlst.addBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries");
309
 
                  parlst.addBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface");
310
 
                  parlst.addBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. ");
311
 
                  parlst.addBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh.");
312
 
                  parlst.addBool ("AutoClean",true,"Post-simplification cleaning","After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)");
313
 
                  parlst.addBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
 
258
                  parlst.addParam(new RichInt  ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces", "The desired final number of faces."));
 
259
                  parlst.addParam(new RichFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size."));
 
260
                  parlst.addParam(new RichFloat("QualityThr",lastq_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n"));
 
261
                  parlst.addParam(new RichBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries"));
 
262
                  parlst.addParam(new RichBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface"));
 
263
                  parlst.addParam(new RichBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. "));
 
264
                  parlst.addParam(new RichBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh."));
 
265
                  parlst.addParam(new RichBool ("QualityWeight",lastq_QualityWeight,"Weighted Simplification","Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified."));
 
266
                  parlst.addParam(new RichBool ("AutoClean",true,"Post-simplification cleaning","After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)"));
 
267
                  parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!"));
314
268
                  break;
315
269
                case FP_QUADRIC_TEXCOORD_SIMPLIFICATION:
316
 
                  parlst.addInt  ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces");
317
 
                  parlst.addFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial mesh.");
318
 
                  parlst.addFloat("QualityThr",lastqtex_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n");
319
 
                  parlst.addFloat("Extratcoordw",lastqtex_extratw,"Texture Weight","Additional weight for each extra Texture Coordinates for every (selected) vertex");
320
 
                  parlst.addBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries");
321
 
                  parlst.addBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. ");
322
 
                  parlst.addBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
 
270
                  parlst.addParam(new RichInt  ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces"));
 
271
                  parlst.addParam(new RichFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial mesh."));
 
272
                  parlst.addParam(new RichFloat("QualityThr",lastqtex_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n"));
 
273
                  parlst.addParam(new RichFloat("Extratcoordw",lastqtex_extratw,"Texture Weight","Additional weight for each extra Texture Coordinates for every (selected) vertex"));
 
274
                  parlst.addParam(new RichBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries"));
 
275
                  parlst.addParam(new RichBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. "));
 
276
                        parlst.addParam(new RichBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface"));
 
277
                  parlst.addParam(new RichBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh."));
 
278
                  parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!"));
323
279
                  break;
324
280
                case FP_CLOSE_HOLES:
325
 
                  parlst.addInt ("MaxHoleSize",(int)30,"Max size to be closed ","The size is expressed as number of edges composing the hole boundary");
326
 
                  parlst.addBool("Selected",m.cm.sfn>0,"Close holes with selected faces","Only the holes with at least one of the boundary faces selected are closed");
327
 
                  parlst.addBool("NewFaceSelected",true,"Select the newly created faces","After closing a hole the faces that have been created are left selected. Any previous selection is lost. Useful for example for smoothing the newly created holes.");
328
 
                  parlst.addBool("SelfIntersection",true,"Prevent creation of selfIntersecting faces","When closing an holes it tries to prevent the creation of faces that intersect faces adjacent to the boundary of the hole. It is an heuristic, non intersetcting hole filling can be NP-complete.");
 
281
                  parlst.addParam(new RichInt ("MaxHoleSize",(int)30,"Max size to be closed ","The size is expressed as number of edges composing the hole boundary"));
 
282
                  parlst.addParam(new RichBool("Selected",m.cm.sfn>0,"Close holes with selected faces","Only the holes with at least one of the boundary faces selected are closed"));
 
283
                  parlst.addParam(new RichBool("NewFaceSelected",true,"Select the newly created faces","After closing a hole the faces that have been created are left selected. Any previous selection is lost. Useful for example for smoothing the newly created holes."));
 
284
                  parlst.addParam(new RichBool("SelfIntersection",true,"Prevent creation of selfIntersecting faces","When closing an holes it tries to prevent the creation of faces that intersect faces adjacent to the boundary of the hole. It is an heuristic, non intersetcting hole filling can be NP-complete."));
329
285
                  break;
330
286
                case FP_LOOP_SS:
331
287
                case FP_BUTTERFLY_SS:
332
288
                case FP_MIDPOINT:
333
289
                  maxVal = m.cm.bbox.Diag();
334
 
                  parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the edges <b>longer</b> than this threshold will be refined.<br>Setting this value to zero will force an uniform refinement.");
335
 
                  parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
 
290
                  parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the edges <b>longer</b> than this threshold will be refined.<br>Setting this value to zero will force an uniform refinement."));
 
291
                  parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
336
292
                        break;
337
293
                case FP_REMOVE_FACES_BY_EDGE:
338
294
                  maxVal = m.cm.bbox.Diag();
339
 
                  parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the faces with an edge <b>longer</b> than this threshold will be deleted. Useful for removing long skinny faces obtained by bad triangulation of range maps.");
340
 
                  parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
 
295
                  parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the faces with an edge <b>longer</b> than this threshold will be deleted. Useful for removing long skinny faces obtained by bad triangulation of range maps."));
 
296
                  parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
341
297
                        break;
342
298
                case FP_CLUSTERING:
343
299
                  maxVal = m.cm.bbox.Diag();
344
 
                  parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values.");
345
 
                  parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
 
300
                  parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values."));
 
301
                  parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
346
302
                  break;
347
303
                case FP_CYLINDER_UNWRAP:        
348
 
                        parlst.addFloat("startAngle", 0,"Start angle (deg)", "The starting angle of the unrolling process.");
349
 
                  parlst.addFloat("endAngle",360,"End angle (deg)","The ending angle of the unrolling process. Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n");
350
 
                        parlst.addFloat("radius", 0,"Projection Radius", "If non zero, this parameter specifies the desired radius of the reference cylinder used for the projection. Changing this parameter affect the <b>X</b> horizontal scaling of the resulting mesh. If zero (default) the average distance of the mesh from the axis is chosen.");
 
304
                        parlst.addParam(new RichFloat("startAngle", 0,"Start angle (deg)", "The starting angle of the unrolling process."));
 
305
                  parlst.addParam(new RichFloat("endAngle",360,"End angle (deg)","The ending angle of the unrolling process. Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5  penalize faces with quality < 0.5, proportionally to their shape\n"));
 
306
                        parlst.addParam(new RichFloat("radius", 0,"Projection Radius", "If non zero, this parameter specifies the desired radius of the reference cylinder used for the projection. Changing this parameter affect the <b>X</b> horizontal scaling of the resulting mesh. If zero (default) the average distance of the mesh from the axis is chosen."));
351
307
                        
352
308
                break;
353
309
                case FP_NORMAL_EXTRAPOLATION:
354
 
                        parlst.addInt ("K",(int)10,"Number of neigbors","The number of neighbors used to estimate and propagate normals.");
 
310
                        parlst.addParam(new RichInt ("K",(int)10,"Number of neigbors","The number of neighbors used to estimate and propagate normals."));
355
311
                        break;
356
312
                         }
357
313
}
391
347
// It is called only for filters that have a not empty list of parameters and
392
348
// that do not use the autogenerated dialog, but want a personalized dialog.
393
349
 
394
 
bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &m, FilterParameterSet & params, MainWindowInterface *mw)
 
350
bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &m, RichParameterSet & params, MainWindowInterface *mw)
395
351
{
396
352
 switch(ID(action))
397
353
  {
408
364
                            return false;
409
365
 
410
366
        Matrix44f matrixDlg = transformDialog->getTransformation();
411
 
        params.addMatrix44("Transform",matrixDlg);
 
367
        params.addParam(new RichMatrix44f("Transform",matrixDlg));
412
368
                                mw->executeFilter(action,params, false);
413
369
        break;
414
370
          }
417
373
  return true;
418
374
}
419
375
 
420
 
bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
 
376
bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
421
377
{
422
378
        MeshModel &m=*md.mm();
423
379
 
445
401
                                        break;
446
402
                                case FP_MIDPOINT :
447
403
                                        Refine<CMeshO,MidPoint<CMeshO> >
448
 
                                                (m.cm, MidPoint<CMeshO>(), threshold, selected, cb);
 
404
                                                (m.cm, MidPoint<CMeshO>(&m.cm), threshold, selected, cb);
449
405
                        }
450
406
 
451
407
                 m.clearDataMask(MeshModel::MM_VERTFACETOPO);
523
479
          {
524
480
      bool selected  = par.getBool("Selected");
525
481
      float threshold = par.getAbsPerc("Threshold");
526
 
                                vcg::tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO> > Grid;
527
 
                                Grid.Init(m.cm.bbox,100000,threshold);
528
 
                                Grid.Add(m.cm);
529
 
                                Grid.Extract(m.cm);
 
482
                                vcg::tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO> > ClusteringGrid;
 
483
                                ClusteringGrid.Init(m.cm.bbox,100000,threshold);
 
484
                                ClusteringGrid.AddMesh(m.cm);
 
485
                                ClusteringGrid.ExtractMesh(m.cm);
530
486
                        vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm);
531
487
      m.clearDataMask(MeshModel::MM_FACEFACETOPO | MeshModel::MM_FACEFLAGBORDER);
532
488
          }
555
511
 
556
512
                int TargetFaceNum = par.getInt("TargetFaceNum");
557
513
                if(par.getFloat("TargetPerc")!=0) TargetFaceNum = m.cm.fn*par.getFloat("TargetPerc");
558
 
 
559
 
                lastq_QualityThr = par.getFloat("QualityThr");
560
 
                lastq_PreserveBoundary = par.getBool("PreserveBoundary");
561
 
                lastq_PreserveNormal = par.getBool("PreserveNormal");
562
 
                lastq_OptimalPlacement = par.getBool("OptimalPlacement");
563
 
                lastq_PlanarQuadric = par.getBool("PlanarQuadric");
 
514
                
 
515
                tri::MyTriEdgeCollapse::SetDefaultParams();
 
516
                tri::TriEdgeCollapseQuadricParameter &pp = tri::MyTriEdgeCollapse::Params();
 
517
                pp.QualityThr=lastq_QualityThr =par.getFloat("QualityThr");
 
518
                pp.PreserveBoundary=lastq_PreserveBoundary = par.getBool("PreserveBoundary");
 
519
                pp.QualityWeight=lastq_QualityWeight = par.getBool("QualityWeight");
 
520
                pp.NormalCheck=lastq_PreserveNormal = par.getBool("PreserveNormal");
 
521
                pp.OptimalPlacement=lastq_OptimalPlacement = par.getBool("OptimalPlacement");
 
522
                pp.QualityQuadric=lastq_PlanarQuadric = par.getBool("PlanarQuadric");
564
523
                lastq_Selected = par.getBool("Selected");
565
524
 
566
 
                QuadricSimplification(m.cm,TargetFaceNum,lastq_QualityThr, lastq_PreserveBoundary,lastq_PreserveNormal, lastq_OptimalPlacement,lastq_OptimalPlacement,lastq_Selected,  cb);
 
525
                QuadricSimplification(m.cm,TargetFaceNum,lastq_Selected,  cb);
567
526
 
568
527
                if(par.getBool("AutoClean"))
569
528
                {
596
555
 
597
556
                int TargetFaceNum = par.getInt("TargetFaceNum");
598
557
                if(par.getFloat("TargetPerc")!=0) TargetFaceNum = m.cm.fn*par.getFloat("TargetPerc");
599
 
                lastqtex_QualityThr = par.getFloat("QualityThr");
600
 
                lastqtex_extratw = par.getFloat("Extratcoordw");
601
 
                lastq_OptimalPlacement = par.getBool("OptimalPlacement");
602
 
                lastq_PreserveBoundary = par.getBool("PreserveBoundary");
 
558
                
 
559
                
 
560
                tri::MyTriEdgeCollapseQTex::SetDefaultParams();
 
561
                tri::TriEdgeCollapseQuadricTexParameter & pp=tri::MyTriEdgeCollapseQTex::Params();
 
562
                  
 
563
        
 
564
                lastqtex_QualityThr = pp.QualityThr = par.getFloat("QualityThr");
 
565
                lastqtex_extratw = pp.ExtraTCoordWeight = par.getFloat("Extratcoordw");
 
566
                lastq_OptimalPlacement = pp.OptimalPlacement = par.getBool("OptimalPlacement");
 
567
                lastq_PreserveBoundary = pp.PreserveBoundary = par.getBool("PreserveBoundary");
 
568
                lastq_PlanarQuadric  = pp.QualityQuadric = par.getBool("PlanarQuadric");
 
569
                lastq_PreserveNormal = pp.NormalCheck = par.getBool("PreserveNormal");
 
570
 
603
571
                lastq_Selected = par.getBool("Selected");
604
572
 
605
 
                QuadricTexSimplification(m.cm,TargetFaceNum,lastqtex_QualityThr,lastqtex_extratw,lastq_PreserveBoundary,lastq_OptimalPlacement,lastq_Selected, cb);
 
573
                QuadricTexSimplification(m.cm,TargetFaceNum,lastq_Selected, cb);
606
574
                tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm);
607
575
                tri::UpdateBounding<CMeshO>::Box(m.cm);
608
576
        }