📄 progviewerwidget.hh
字号:
//=============================================================================// // OpenMesh // Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen // www.openmesh.org // //-----------------------------------------------------------------------------// // License // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Library General Public License as published // by the Free Software Foundation, version 2. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // //-----------------------------------------------------------------------------// // $Revision: 1.2 $// $Date: 2005-12-21 14:01:28 $// //=============================================================================#ifndef OPENMESHAPPS_PROGVIEWERWIDGET_HH#define OPENMESHAPPS_PROGVIEWERWIDGET_HH//== INCLUDES =================================================================#include <qtimer.h>#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>#include <OpenMesh/Core/Mesh/Types/TriMesh_ArrayKernelT.hh>#include <OpenMesh/Core/Attributes/Attributes.hh>#include <string>//== CLASS DEFINITION =========================================================using namespace OpenMesh;using namespace OpenMesh::Attributes;struct MyTraits : public OpenMesh::DefaultTraits{ VertexAttributes ( OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status ); EdgeAttributes ( OpenMesh::Attributes::Status ); HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); FaceAttributes ( OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status ); }; typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;typedef MeshViewerWidgetT<MyMesh> MeshViewerWidget;//== CLASS DEFINITION ========================================================= class ProgViewerWidget : public MeshViewerWidget{ Q_OBJECT public: typedef MeshViewerWidget Base; typedef ProgViewerWidget This;public: /// default constructor ProgViewerWidget(QWidget* _parent=0, const char* _name=0) : MeshViewerWidget(_parent, _name) { timer_ = new QTimer(this); connect( timer_, SIGNAL(timeout()), SLOT(animate()) ); } /// destructor ~ProgViewerWidget() { delete timer_; } /// open progressive mesh void open_prog_mesh(const char* _filename);protected slots:void animate( void ); private: QTimer *timer_; struct PMInfo { MyMesh::Point p0; MyMesh::VertexHandle v0, v1, vl, vr; }; typedef std::vector<PMInfo> PMInfoContainer; typedef PMInfoContainer::iterator PMInfoIter; /// refine mesh up to _n vertices void refine(unsigned int _n); /// coarsen mesh down to _n vertices void coarsen(unsigned int _n); virtual void keyPressEvent(QKeyEvent* _event); // mesh data bool animateRefinement_; PMInfoContainer pminfos_; PMInfoIter pmiter_; size_t n_base_vertices_, n_base_faces_, n_detail_vertices_; size_t n_max_vertices_;};//=============================================================================#endif // OPENMESHAPPS_PROGVIEWERWIDGET_HH defined//=============================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -