1 /**************************************************************************** 2 * MeshLab o o * 3 * A versatile mesh processing toolbox o o * 4 * _ O _ * 5 * Copyright(C) 2005 \/)\/ * 6 * Visual Computing Lab /\/| * 7 * ISTI - Italian National Research Council | * 8 * \ * 9 * All rights reserved. * 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 * for more details. * 21 * * 22 ****************************************************************************/ 23 24 #ifndef FILTER_FUNC_PLUGIN_H 25 #define FILTER_FUNC_PLUGIN_H 26 27 #include <QObject> 28 29 #include <common/interfaces.h> 30 31 #include "muParser.h" 32 #include "filter_refine.h" 33 34 class FilterFunctionPlugin : public QObject, public MeshFilterInterface 35 { 36 Q_OBJECT 37 MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) 38 Q_INTERFACES(MeshFilterInterface) 39 40 protected: 41 double x,y,z,nx,ny,nz,r,g,b,a,q,rad,vtu,vtv,vsel; 42 double x0,y0,z0,x1,y1,z1,x2,y2,z2,nx0,ny0,nz0,nx1,ny1,nz1,nx2,ny2,nz2,r0,g0,b0,a0,r1,g1,b1,a1,r2,g2,b2,a2,q0,q1,q2,wtu0,wtv0,wtu1,wtv1,wtu2,wtv2,vsel0,vsel1,vsel2; 43 double fr,fg,fb,fa,fnx,fny,fnz,fq,fsel; 44 double v,f,v0i,v1i,v2i,ti; 45 std::vector<std::string> v_attrNames; // names of the <float> per vertex attributes 46 std::vector<double> v_attrValue; // values of the <float> per vertex attributes 47 std::vector<std::string> v3_attrNames; // names of the <Point3f> per vertex attributes There are 3x (one foreach coord _x, _y, _z) 48 std::vector<double> v3_attrValue; // values of the <Point3f> per vertex attributes. There are 3x (one foreach coord _x, _y, _z) 49 std::vector<std::string> f_attrNames; 50 std::vector<double> f_attrValue; 51 std::vector<CMeshO::PerVertexAttributeHandle<float> > v_handlers; 52 std::vector<CMeshO::PerVertexAttributeHandle<Point3f> > v3_handlers; 53 std::vector<CMeshO::PerFaceAttributeHandle<float> > f_handlers; 54 55 public: 56 enum { 57 FF_VERT_SELECTION, 58 FF_FACE_SELECTION, 59 FF_GEOM_FUNC, 60 FF_VERT_TEXTURE_FUNC, 61 FF_WEDGE_TEXTURE_FUNC, 62 FF_FACE_COLOR, 63 FF_VERT_COLOR, 64 FF_VERT_NORMAL, 65 FF_VERT_QUALITY, 66 FF_FACE_QUALITY, 67 FF_DEF_VERT_ATTRIB, 68 FF_DEF_FACE_ATTRIB, 69 FF_GRID, 70 FF_ISOSURFACE, 71 FF_REFINE 72 } ; 73 74 FilterFunctionPlugin(); 75 ~FilterFunctionPlugin(); 76 77 virtual QString filterName(FilterIDType filter) const; 78 virtual QString filterInfo(FilterIDType filter) const; 79 virtual FilterClass getClass(QAction *); 80 virtual int postCondition(QAction *action) const; 81 virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/); 82 virtual int getRequirements(QAction *); 83 virtual bool applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ; 84 FILTER_ARITY filterArity(QAction* filter) const; 85 86 87 void showParserError(const QString &s, mu::Parser::exception_type &e); 88 void setAttributes(CMeshO::VertexIterator &vi,CMeshO &m); 89 void setAttributes(CMeshO::FaceIterator &fi,CMeshO &m); 90 void setPerVertexVariables(mu::Parser &p, CMeshO &m); 91 void setPerFaceVariables(mu::Parser &p, CMeshO &m); 92 93 }; 94 95 #endif 96